Sfoglia il codice sorgente

项目管理--项目阶段和项目状态的参数判断

buzhanyi 6 mesi fa
parent
commit
1c59cb28e2

+ 1 - 0
application-webadmin/src/main/java/com/ankaibei/workFlow/webadmin/ankaibei/enums/ProjectStageEnum.java

@@ -10,6 +10,7 @@ package com.ankaibei.workFlow.webadmin.ankaibei.enums;
  */
 public enum ProjectStageEnum {
 
+    //1,商机调研;2, 售前;3, 立项启动(中标);4, 交付(实习阶段);5, 验收;6, 结项回款;7, 关闭;
     BUSINESS_RESEARCHB("1", "商机调研"),
     PRE_SALES("2", " 售前"),
     PROJECT_START("3", " 立项启动(中标)"),

+ 1 - 0
application-webadmin/src/main/java/com/ankaibei/workFlow/webadmin/ankaibei/enums/ProjectStatusEnum.java

@@ -10,6 +10,7 @@ package com.ankaibei.workFlow.webadmin.ankaibei.enums;
  */
 public enum ProjectStatusEnum {
 
+    //1,正常;2, 延期;3, 取消;4, 有风险;5, 失控;
     NORMAL("1", "正常"),
     POSTPONE("2", " 延期"),
     CANCEL("3", " 取消"),

+ 64 - 49
application-webadmin/src/main/java/com/ankaibei/workFlow/webadmin/ankaibei/service/impl/ProjectInfoServiceImpl.java

@@ -68,50 +68,56 @@ public class ProjectInfoServiceImpl implements ProjectInfoService {
             UserInfoEntity userInfoEntity = userInfoMapper.findByUserIdEquals((map.get("projectPrincipal")));
             map1.put("projectPrincipal", userInfoEntity != null ? userInfoEntity.getShowName() : null);
             String projectStage = map.get("projectStage");
-            switch (ProjectStageEnum.getEnumByCode(projectStage)) {
-                case BUSINESS_RESEARCHB:
-                    map1.put("projectStage", ProjectStageEnum.BUSINESS_RESEARCHB.getReason());
-                    break;
-                case PRE_SALES:
-                    map1.put("projectStage", ProjectStageEnum.PRE_SALES.getReason());
-                    break;
-                case PROJECT_START:
-                    map1.put("projectStage", ProjectStageEnum.PROJECT_START.getReason());
-                    break;
-                case DELIVERY:
-                    map1.put("projectStage", ProjectStageEnum.DELIVERY.getReason());
-                    break;
-                case CHECK_AND_ACCEPT:
-                    map1.put("projectStage", ProjectStageEnum.CHECK_AND_ACCEPT.getReason());
-                    break;
-                case POST_PROJECT_THE_RECEIVABLE:
-                    map1.put("projectStage", ProjectStageEnum.POST_PROJECT_THE_RECEIVABLE.getReason());
-                    break;
-                case CLOSE:
-                    map1.put("projectStage", ProjectStageEnum.CLOSE.getReason());
-                    break;
-                default:
-                    break;
+            //项目阶段不为空时赋值
+            if (!ObjectUtils.isEmpty(projectStage)) {
+                switch (ProjectStageEnum.getEnumByCode(projectStage)) {
+                    case BUSINESS_RESEARCHB:
+                        map1.put("projectStage", ProjectStageEnum.BUSINESS_RESEARCHB.getReason());
+                        break;
+                    case PRE_SALES:
+                        map1.put("projectStage", ProjectStageEnum.PRE_SALES.getReason());
+                        break;
+                    case PROJECT_START:
+                        map1.put("projectStage", ProjectStageEnum.PROJECT_START.getReason());
+                        break;
+                    case DELIVERY:
+                        map1.put("projectStage", ProjectStageEnum.DELIVERY.getReason());
+                        break;
+                    case CHECK_AND_ACCEPT:
+                        map1.put("projectStage", ProjectStageEnum.CHECK_AND_ACCEPT.getReason());
+                        break;
+                    case POST_PROJECT_THE_RECEIVABLE:
+                        map1.put("projectStage", ProjectStageEnum.POST_PROJECT_THE_RECEIVABLE.getReason());
+                        break;
+                    case CLOSE:
+                        map1.put("projectStage", ProjectStageEnum.CLOSE.getReason());
+                        break;
+                    default:
+                        break;
+                }
             }
-            String projectStatus = (String) map.get("projectStatus");
-            switch (ProjectStatusEnum.getEnumByCode(projectStatus)) {
-                case NORMAL:
-                    map1.put("projectStatus", ProjectStatusEnum.NORMAL.getReason());
-                    break;
-                case POSTPONE:
-                    map1.put("projectStatus", ProjectStatusEnum.POSTPONE.getReason());
-                    break;
-                case CANCEL:
-                    map1.put("projectStatus", ProjectStatusEnum.CANCEL.getReason());
-                    break;
-                case RISKY:
-                    map1.put("projectStatus", ProjectStatusEnum.RISKY.getReason());
-                    break;
-                case OUT_OF_CONTROL:
-                    map1.put("projectStatus", ProjectStatusEnum.OUT_OF_CONTROL.getReason());
-                    break;
-                default:
-                    break;
+            //项目状态不为空时赋值
+            String projectStatus = map.get("projectStatus");
+            if (!ObjectUtils.isEmpty(projectStatus)) {
+                switch (ProjectStatusEnum.getEnumByCode(projectStatus)) {
+                    case NORMAL:
+                        map1.put("projectStatus", ProjectStatusEnum.NORMAL.getReason());
+                        break;
+                    case POSTPONE:
+                        map1.put("projectStatus", ProjectStatusEnum.POSTPONE.getReason());
+                        break;
+                    case CANCEL:
+                        map1.put("projectStatus", ProjectStatusEnum.CANCEL.getReason());
+                        break;
+                    case RISKY:
+                        map1.put("projectStatus", ProjectStatusEnum.RISKY.getReason());
+                        break;
+                    case OUT_OF_CONTROL:
+                        map1.put("projectStatus", ProjectStatusEnum.OUT_OF_CONTROL.getReason());
+                        break;
+                    default:
+                        break;
+                }
             }
             return map1;
         }).getContent(), projectInfo.getTotalElements()));
@@ -142,9 +148,11 @@ public class ProjectInfoServiceImpl implements ProjectInfoService {
                 return new ResMsg(CodeEnum.TNE_PROJECT_NAME_ALREADY_EXISTS);
             }
         }
-        //直接保存
-        projectInfoEntity.setProjectStage(ProjectStageEnum.BUSINESS_RESEARCHB.getCode());
-        projectInfoEntity.setProjectStatus(ProjectStatusEnum.NORMAL.getCode());
+        //不使用的字段不用管
+        //projectInfoEntity.setProjectStage(ProjectStageEnum.BUSINESS_RESEARCHB.getCode());
+        //projectInfoEntity.setProjectStatus(ProjectStatusEnum.NORMAL.getCode());
+        //需要有默认值
+        projectInfoEntity.setFlowTaskStatus(FlowTaskStatus.DRAFT);
         projectInfoEntity.setIsDelete(DataIsDeleteEnum.NORMAL.getCode());
         projectInfoEntity.setCreateDate(new Date());
         ProjectInfoEntity save = projectInfoMapper.save(projectInfoEntity);
@@ -197,7 +205,13 @@ public class ProjectInfoServiceImpl implements ProjectInfoService {
     public ResMsg updateProject(ProjectInfoEntity entity) {
         //获取原数据对象
         ProjectInfoEntity byId = projectInfoMapper.getById(entity.getProjectId());
-        String flowStatus = byId.getFlowTaskStatus().toString();
+        //获取原数据对象的流程状态
+        String flowStatus = "";
+        if (!ObjectUtils.isEmpty(byId.getFlowTaskStatus())) {
+            flowStatus = byId.getFlowTaskStatus().toString();
+        } else {
+            flowStatus = FlowTaskStatus.DRAFT.toString();
+        }
         //将修改的信息赋值给原数据对象
         byId.setProjectName(entity.getProjectName());//项目名称
         byId.setProjectPeriod(entity.getProjectPeriod());//项目周期
@@ -214,7 +228,7 @@ public class ProjectInfoServiceImpl implements ProjectInfoService {
         byId.setProjectStatus(entity.getProjectStatus());//项目状态
         if (FlowTaskStatus.REFUSED.equals(flowStatus)) {
             // 更新流程状态和流程信息,以便建立下一个流程实例
-            byId.setFlowTaskStatus(FlowTaskStatus.DRAFT);//流程状态
+            byId.setFlowTaskStatus(Integer.valueOf(flowStatus));//流程状态
             byId.setProcessDefinitionId(null);//流程定义id
             byId.setProcessInstanceId(null);//流程实例id
         }
@@ -240,11 +254,12 @@ public class ProjectInfoServiceImpl implements ProjectInfoService {
 
     @Override
     public ResMsg deleteProjects(List<ProjectInfoVo> projectInfoVos) {
-        //审批状态   已提交:0; 审批中:1; 被拒绝:2; 已结束:3; 提前停止:4; 已取消:5;
+        //审批状态   已提交:0; 审批中:1; 被拒绝:2; 已结束:3; 提前停止:4; 已取消:5;保存草稿:6
         StringBuffer optional = new StringBuffer("项目:[");
         int count = 0;
         for (ProjectInfoVo info : projectInfoVos) {
             ProjectInfoEntity byId = projectInfoMapper.getById(info.getProjectId());
+            //如果流程状态大于1,便是不在审核中,可删除
             if (byId.getFlowTaskStatus() > 1) {
                 projectInfoMapper.deleteProject(info.getProjectId());
                 count++;