Browse Source

优化撤回 删除逻辑 去除脏数据

master
PoffyZhang 1 year ago
parent
commit
ff75a89789
3 changed files with 54 additions and 22 deletions
  1. +42
    -18
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/HandlerManage.java
  2. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/mapper/StatisticsMapper.java
  3. +11
    -3
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/mapper/StatisticsMapper.xml

+ 42
- 18
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/HandlerManage.java View File

@@ -20,6 +20,7 @@ import com.ningdatech.pmapi.projectlib.model.dto.ProjectApplicationDTO;
import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO;
import com.ningdatech.pmapi.projectlib.model.entity.Project;
import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication;
import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst;
import com.ningdatech.pmapi.projectlib.service.IProjectApplicationService;
import com.ningdatech.pmapi.projectlib.service.IProjectInstService;
import com.ningdatech.pmapi.projectlib.service.IProjectService;
@@ -201,24 +202,9 @@ public class HandlerManage {
// 更新项目状态为待申报
updateWithdrawProjectStatus(userId, declaredProject);
// 保存到草稿箱中
ProjectDraftSaveDTO draftSaveDto = new ProjectDraftSaveDTO();
ProjectDTO projectInfo = new ProjectDTO();
BeanUtils.copyProperties(declaredProject,projectInfo);
// 查询出项目关联的应用信息
List<ProjectApplication> applicationList = projectApplicationService.list(Wrappers.lambdaQuery(ProjectApplication.class)
.eq(ProjectApplication::getProjectId, declaredProject.getId()));
List<ProjectApplicationDTO> applicationDTOList = applicationList.stream().map(a -> {
ProjectApplicationDTO applicationDTO = new ProjectApplicationDTO();
BeanUtils.copyProperties(a, applicationDTO);
return applicationDTO;
}).collect(Collectors.toList());
projectInfo.setApplicationList(applicationDTOList);
HashMap<String,Object> dynamicMap = JSON.parseObject(declaredProject.getDynamicForm(), HashMap.class);
projectInfo.setDynamicForm(dynamicMap);
draftSaveDto.setProjectInfo(projectInfo);
declaredProjectManage.saveToDraft(draftSaveDto);
// 并删除项目库中该项目信息
projectService.removeById(declaredProject);
saveToDraft(declaredProject);
//删除所有项目相关的信息
deleteProjectRelated(declaredProject);
break;
// 当前项目状态是预审中
case PRE_APPLYING:
@@ -235,6 +221,44 @@ public class HandlerManage {
}
}

// 保存到草稿箱中
private void saveToDraft(Project declaredProject) {
ProjectDraftSaveDTO draftSaveDto = new ProjectDraftSaveDTO();
ProjectDTO projectInfo = new ProjectDTO();
BeanUtils.copyProperties(declaredProject,projectInfo);
// 查询出项目关联的应用信息
List<ProjectApplication> applicationList = projectApplicationService.list(Wrappers.lambdaQuery(ProjectApplication.class)
.eq(ProjectApplication::getProjectId, declaredProject.getId()));
List<ProjectApplicationDTO> applicationDTOList = applicationList.stream().map(a -> {
ProjectApplicationDTO applicationDTO = new ProjectApplicationDTO();
BeanUtils.copyProperties(a, applicationDTO);
return applicationDTO;
}).collect(Collectors.toList());
projectInfo.setApplicationList(applicationDTOList);
HashMap<String,Object> dynamicMap = JSON.parseObject(declaredProject.getDynamicForm(), HashMap.class);
projectInfo.setDynamicForm(dynamicMap);
draftSaveDto.setProjectInfo(projectInfo);
declaredProjectManage.saveToDraft(draftSaveDto);
}

/**
* 删除项目的所有信息
* @param declaredProject
*/
public void deleteProjectRelated(Project declaredProject) {
//删除项目库中该项目信息
projectService.removeById(declaredProject);
//删除app信息
projectApplicationService.remove(Wrappers.lambdaQuery(ProjectApplication.class)
.eq(ProjectApplication::getProjectId,declaredProject.getId()));
// 删除关联表信息
projectInstService.remove(Wrappers.lambdaQuery(ProjectInst.class)
.eq(ProjectInst::getProjectId,declaredProject.getId())
.eq(ProjectInst::getInstCode,declaredProject.getInstCode()));
//删除项目的实例信息
historyService.deleteHistoricProcessInstance(declaredProject.getInstCode());
}

/**
* 退回审核后 所处理的逻辑
* @param declaredProject


+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/mapper/StatisticsMapper.java View File

@@ -15,5 +15,5 @@ public interface StatisticsMapper extends BaseMapper {

TodoCenterStatisticsPO ccNums(@Param("employeeCode") String employeeCode);

TodoCenterStatisticsPO getIdo(String employeeCode);
TodoCenterStatisticsPO getIdo(@Param("employeeCode") String employeeCode);
}

+ 11
- 3
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/mapper/StatisticsMapper.xml View File

@@ -27,9 +27,17 @@
<select id="getTodoOrIdo" parameterType="java.lang.String"
resultType="com.ningdatech.pmapi.todocenter.model.po.TodoCenterStatisticsPO">
SELECT
sum(CASE WHEN ht.assignee_ = #{employeeCode} AND ht.end_time_ is NULL THEN 1 end) todoNum
FROM
act_hi_taskinst ht
count(0) todoNum
FROM(SELECT
hp.ID_
FROM
act_hi_procinst hp
LEFT JOIN
act_hi_taskinst ht ON hp.PROC_INST_ID_ = ht.PROC_INST_ID_
WHERE (ht.assignee_ = #{employeeCode} AND ht.end_time_ is NULL
AND hp.PROC_INST_ID_ NOT IN (SELECT PROC_INST_ID_ FROM act_hi_procinst hp WHERE hp.business_status_ = 'back-end'))
OR (hp.start_user_id_ = #{employeeCode} and hp.business_status_ = 'back-end')
GROUP BY hp.ID_ )
</select>

<select id="getIdo" parameterType="java.lang.String"


Loading…
Cancel
Save