@@ -42,8 +42,7 @@ | |||||
) | ) | ||||
</if> | </if> | ||||
</where> | </where> | ||||
-- ORDER BY create_on DESC | |||||
ORDER BY update_on DESC | |||||
</sql> | </sql> | ||||
<sql id="Expert_Tag_Relation"> | <sql id="Expert_Tag_Relation"> | ||||
@@ -16,7 +16,7 @@ | |||||
sum(p.approval_amount) approvalAmount | sum(p.approval_amount) approvalAmount | ||||
FROM | FROM | ||||
nd_project p | nd_project p | ||||
WHERE build_org_code = #{orgCode} and project_year = #{year} | |||||
WHERE build_org_code = #{orgCode} and project_year = #{year} and newest = true | |||||
</select> | </select> | ||||
<select id="getRegionStatistics" resultType="com.ningdatech.pmapi.projectdeclared.model.po.DeclaredProjectStatisticsPO"> | <select id="getRegionStatistics" resultType="com.ningdatech.pmapi.projectdeclared.model.po.DeclaredProjectStatisticsPO"> | ||||
@@ -33,6 +33,6 @@ | |||||
sum(p.approval_amount) approvalAmount | sum(p.approval_amount) approvalAmount | ||||
FROM | FROM | ||||
nd_project p | nd_project p | ||||
WHERE area_code = #{regionCode} and project_year = #{year} | |||||
WHERE area_code = #{regionCode} and project_year = #{year} and newest = true | |||||
</select> | </select> | ||||
</mapper> | </mapper> |
@@ -82,8 +82,8 @@ public class TodoCenterController { | |||||
*/ | */ | ||||
@PostMapping("/handler") | @PostMapping("/handler") | ||||
public Object handler(@Valid @RequestBody ReqProcessHandlerDTO param) { | public Object handler(@Valid @RequestBody ReqProcessHandlerDTO param) { | ||||
todoCenterManage.handler(param); | |||||
return "操作成功"; | |||||
String nextTaskId = todoCenterManage.handler(param); | |||||
return nextTaskId; | |||||
} | } | ||||
/** | /** | ||||
@@ -94,7 +94,7 @@ public class WithDrawHandle { | |||||
children = children.stream() | children = children.stream() | ||||
.filter(c -> !NodeTypeEnum.CC.name().equals(c.getNodeType().name())) | .filter(c -> !NodeTypeEnum.CC.name().equals(c.getNodeType().name())) | ||||
.collect(Collectors.toList()); | .collect(Collectors.toList()); | ||||
if (CollUtil.isEmpty(currentProgressInfo)){ | |||||
if (CollUtil.isEmpty(children)){ | |||||
return Boolean.FALSE; | return Boolean.FALSE; | ||||
} | } | ||||
currentProgressNode = children.get(children.size() - 1); | currentProgressNode = children.get(children.size() - 1); | ||||
@@ -21,6 +21,8 @@ import org.flowable.engine.HistoryService; | |||||
import org.flowable.engine.RuntimeService; | import org.flowable.engine.RuntimeService; | ||||
import org.flowable.engine.TaskService; | import org.flowable.engine.TaskService; | ||||
import org.flowable.engine.history.HistoricProcessInstance; | import org.flowable.engine.history.HistoricProcessInstance; | ||||
import org.flowable.engine.runtime.ActivityInstance; | |||||
import org.flowable.engine.runtime.ActivityInstanceQuery; | |||||
import org.flowable.engine.task.Comment; | import org.flowable.engine.task.Comment; | ||||
import org.flowable.variable.api.history.HistoricVariableInstance; | import org.flowable.variable.api.history.HistoricVariableInstance; | ||||
import org.springframework.beans.BeanUtils; | import org.springframework.beans.BeanUtils; | ||||
@@ -202,8 +204,8 @@ public class TodoCenterManage { | |||||
Map<String, ProcessTaskVo> taskMap = userTodoList.stream() | Map<String, ProcessTaskVo> taskMap = userTodoList.stream() | ||||
.sorted((t1,t2) -> t2.getTaskCreateTime().compareTo(t1.getTaskCreateTime())) | .sorted((t1,t2) -> t2.getTaskCreateTime().compareTo(t1.getTaskCreateTime())) | ||||
.collect(Collectors.toList()).stream() | .collect(Collectors.toList()).stream() | ||||
.filter(v -> processSet.add(v.getInstanceId())) | |||||
.collect(Collectors.toMap(ProcessTaskVo::getInstanceId, v -> v)); | |||||
.filter(v -> processSet.add(v.getNodeId())) | |||||
.collect(Collectors.toMap(ProcessTaskVo::getNodeId, v -> v)); | |||||
List<ResToBeProcessedVO> resVos = userTodoList.stream().map(d -> { | List<ResToBeProcessedVO> resVos = userTodoList.stream().map(d -> { | ||||
Project projectInfo = projectInfoMap.get(d.getInstanceId()); | Project projectInfo = projectInfoMap.get(d.getInstanceId()); | ||||
@@ -213,11 +215,12 @@ public class TodoCenterManage { | |||||
res.setProjectId(projectInfo.getId()); | res.setProjectId(projectInfo.getId()); | ||||
res.setBuildOrg(projectInfo.getBuildOrgName()); | res.setBuildOrg(projectInfo.getBuildOrgName()); | ||||
res.setDeclaredAmount(projectInfo.getDeclareAmount()); | res.setDeclaredAmount(projectInfo.getDeclareAmount()); | ||||
ProcessTaskVo taskVo = taskMap.get(d.getInstanceId()); | |||||
res.setNodeId(taskVo.getTaskDefKey()); | |||||
ProcessTaskVo taskVo = taskMap.get(d.getNodeId()); | |||||
res.setNodeId(d.getNodeId()); | |||||
res.setProcessStatusName(taskVo.getStatus()); | res.setProcessStatusName(taskVo.getStatus()); | ||||
res.setProcessLaunchTime(d.getTaskCreateTime()); | res.setProcessLaunchTime(d.getTaskCreateTime()); | ||||
res.setProcessDefName(d.getProcessDefName()); | res.setProcessDefName(d.getProcessDefName()); | ||||
res.setTaskId(d.getTaskId()); | |||||
return res; | return res; | ||||
}).collect(Collectors.toList()); | }).collect(Collectors.toList()); | ||||
return PageVo.of(resVos, list.size()); | return PageVo.of(resVos, list.size()); | ||||
@@ -305,7 +308,7 @@ public class TodoCenterManage { | |||||
* @author CMM | * @author CMM | ||||
* @since 2023/02/01 | * @since 2023/02/01 | ||||
*/ | */ | ||||
public void handler(ReqProcessHandlerDTO param) { | |||||
public String handler(ReqProcessHandlerDTO param) { | |||||
// 获取登录用户ID | // 获取登录用户ID | ||||
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); | UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); | ||||
// 获取登录用户浙政钉code | // 获取登录用户浙政钉code | ||||
@@ -340,7 +343,8 @@ public class TodoCenterManage { | |||||
processTaskService.handleTask(param, employeeCode); | processTaskService.handleTask(param, employeeCode); | ||||
//通过审核后 所处理的逻辑 | //通过审核后 所处理的逻辑 | ||||
handlerManage.afterPassTodo(declaredProject,instance); | handlerManage.afterPassTodo(declaredProject,instance); | ||||
break; | |||||
return findNextTaskId(instance); | |||||
// 驳回 | // 驳回 | ||||
case REJECT: | case REJECT: | ||||
// 驳回该任务,中止流程并使项目进入对应状态,给项目创建人、流程发起人发送浙政钉工作通知: | // 驳回该任务,中止流程并使项目进入对应状态,给项目创建人、流程发起人发送浙政钉工作通知: | ||||
@@ -380,6 +384,26 @@ public class TodoCenterManage { | |||||
default: | default: | ||||
throw new IllegalStateException("Unexpected value: " + param.getAction()); | throw new IllegalStateException("Unexpected value: " + param.getAction()); | ||||
} | } | ||||
return "操作成功"; | |||||
} | |||||
/** | |||||
* 寻找下一个审核task | |||||
* @param instance | |||||
* @return | |||||
*/ | |||||
private String findNextTaskId(HistoricProcessInstance instance) { | |||||
List<ActivityInstance> userTasks = runtimeService.createActivityInstanceQuery() | |||||
.activityType("userTask") | |||||
.processInstanceId(instance.getId()) | |||||
.orderByActivityInstanceStartTime() | |||||
.desc() | |||||
.unfinished() | |||||
.list(); | |||||
if(CollUtil.isEmpty(userTasks)){ | |||||
return "处理成功"; | |||||
} | |||||
return userTasks.get(0).getTaskId(); | |||||
} | } | ||||
/** | /** | ||||
@@ -32,6 +32,9 @@ public class ResToBeProcessedVO implements Serializable { | |||||
@ApiModelProperty("待处理节点ID") | @ApiModelProperty("待处理节点ID") | ||||
private String nodeId; | private String nodeId; | ||||
@ApiModelProperty("任务ID") | |||||
private String taskId; | |||||
@ApiModelProperty("项目名称") | @ApiModelProperty("项目名称") | ||||
private String projectName; | private String projectName; | ||||
@@ -145,14 +145,28 @@ public class UserInfoManage { | |||||
// 查重符合筛选条件的组织列表 | // 查重符合筛选条件的组织列表 | ||||
if (StringUtils.isNotBlank(orgName)) { | if (StringUtils.isNotBlank(orgName)) { | ||||
List<DingOrganization> dingOrganizationList = iDingOrganizationService.list(Wrappers.lambdaQuery(DingOrganization.class) | List<DingOrganization> dingOrganizationList = iDingOrganizationService.list(Wrappers.lambdaQuery(DingOrganization.class) | ||||
.like(DingOrganization::getOrganizationName, orgName)); | |||||
List<String> compliantOrgNameList = dingOrganizationList.stream() | |||||
.like(DingOrganization::getOrganizationName, orgName) | |||||
.notIn(DingOrganization::getTypeCode, "GOV_INTERNAL_INSTITUTION") | |||||
); | |||||
List<String> compliantOrgNameCodeList = dingOrganizationList.stream() | |||||
.map(DingOrganization::getOrganizationCode) | .map(DingOrganization::getOrganizationCode) | ||||
.collect(Collectors.toList()); | .collect(Collectors.toList()); | ||||
if (CollUtil.isEmpty(compliantOrgNameList)) { | |||||
if (CollUtil.isEmpty(compliantOrgNameCodeList)) { | |||||
return new ArrayList<>(); | |||||
} | |||||
// 取交集 | |||||
List<String> tempCompliantOrgCodeList = new ArrayList<>(); | |||||
for (String compliantOrgNameCode : compliantOrgNameCodeList) { | |||||
if (compliantOrgCodeList.contains(compliantOrgNameCode)) { | |||||
tempCompliantOrgCodeList.add(compliantOrgNameCode); | |||||
} | |||||
} | |||||
compliantOrgCodeList = tempCompliantOrgCodeList; | |||||
if (CollUtil.isEmpty(compliantOrgCodeList)) { | |||||
return new ArrayList<>(); | return new ArrayList<>(); | ||||
} | } | ||||
compliantOrgCodeList.addAll(compliantOrgNameList); | |||||
} | } | ||||
if (StringUtils.isNotBlank(orgCode)) { | if (StringUtils.isNotBlank(orgCode)) { | ||||
@@ -417,7 +431,7 @@ public class UserInfoManage { | |||||
resUserDetailVO.setOrgName(userFullInfo.getOrganizationName()); | resUserDetailVO.setOrgName(userFullInfo.getOrganizationName()); | ||||
resUserDetailVO.setRegionCode(userFullInfo.getRegionCode()); | resUserDetailVO.setRegionCode(userFullInfo.getRegionCode()); | ||||
resUserDetailVO.setRegionName(regionCacheHelper.getRegionName(userFullInfo.getRegionCode() | resUserDetailVO.setRegionName(regionCacheHelper.getRegionName(userFullInfo.getRegionCode() | ||||
,RegionConst.RL_COUNTY)); | |||||
, RegionConst.RL_COUNTY)); | |||||
resUserDetailVO.setEmpPosUnitCode(userFullInfo.getEmpPosUnitCode()); | resUserDetailVO.setEmpPosUnitCode(userFullInfo.getEmpPosUnitCode()); | ||||
resUserDetailVO.setEmpPosUnitName(userFullInfo.getEmpPosUnitName()); | resUserDetailVO.setEmpPosUnitName(userFullInfo.getEmpPosUnitName()); | ||||
} | } | ||||