diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareAction.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareAction.java index f272f7d..e44bd93 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareAction.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareAction.java @@ -99,10 +99,10 @@ public class ProjectDeclareAction { project.setStatus(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode()); } - @OnTransition(source = "PRE_APPLYING", target = "PENDING_PREQUALIFICATION_CHOICE") + @OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_WITHDRAW_CHOICE") public void PRE_APPLYING_WITHDRAW(Message message) { Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); + project.setStatus(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE.getCode()); } @@ -256,23 +256,4 @@ public class ProjectDeclareAction { Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); } - - - public class ProjectDeclareChoiceAction implements Action { - - @Override - public void execute(StateContext stateContext) { - log.info(String.valueOf(stateContext.getTarget().getId())); - ProjectStatusEnum projectStatusEnum = stateContext.getTarget().getId(); - if (projectStatusEnum.equals(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE)) { - Project project = stateContext.getMessage().getHeaders().get(PROJECT_DECLARE, Project.class); - log.info("预审申报事件之前,项目的状态为:{}" + project.getStatus()); - if (StateMachineUtils.isCityProject(project) && StateMachineUtils.judgeDeclareAmount(project)) { - project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS.getCode()); - } else { - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); - } - } - } - } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareChoiceAction.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareChoiceAction.java index c95864f..f603ad4 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareChoiceAction.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareChoiceAction.java @@ -24,14 +24,35 @@ public class ProjectDeclareChoiceAction implements Action stateContext) { log.info(String.valueOf(stateContext.getTarget().getId())); ProjectStatusEnum projectStatusEnum = stateContext.getTarget().getId(); - if (projectStatusEnum.equals(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE)){ - Project project = stateContext.getMessage().getHeaders().get(PROJECT_DECLARE, Project.class); - log.info("预审申报事件之前,项目的状态为:{}"+project.getStatus()); - if (StateMachineUtils.isCityProject(project) && StateMachineUtils.judgeDeclareAmount(project)){ - project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode()); - }else { - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); - } + switch (projectStatusEnum){ + case PENDING_PREQUALIFICATION_CHOICE: + preDeclareChoice(stateContext); + break; + case PREQUALIFICATION_WITHDRAW_CHOICE: + preWithDrawChoice(stateContext); + break; + default: + throw new IllegalStateException("Unexpected value: " + projectStatusEnum); + } + } + + private void preDeclareChoice(StateContext stateContext) { + Project project = stateContext.getMessage().getHeaders().get(PROJECT_DECLARE, Project.class); + log.info("预审申报事件之前,项目的状态为:{}"+project.getStatus()); + if (StateMachineUtils.isCityProject(project) && StateMachineUtils.judgeDeclareAmount(project)){ + project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS.getCode()); + }else { + project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); + } + } + + private void preWithDrawChoice(StateContext stateContext) { + Project project = stateContext.getMessage().getHeaders().get(PROJECT_DECLARE, Project.class); + log.info("预审中撤回事件之前,项目的状态为:{}"+project.getStatus()); + if (StateMachineUtils.isCityProject(project) && StateMachineUtils.judgeDeclareAmount(project)){ + project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode()); + }else { + project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); } } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineBuilder.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineBuilder.java index 39ff3e3..4cffea8 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineBuilder.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineBuilder.java @@ -34,7 +34,6 @@ import java.util.EnumSet; @RequiredArgsConstructor public class ProjectDeclareStateMachineBuilder { private static final ProjectDeclareGuardFactory projectDeclareGuardFactory = new ProjectDeclareGuardFactory(); - private static final ProjectDeclareAction projectDeclareAction = new ProjectDeclareAction(); private final BeanFactory beanFactory; private Logger logger = LoggerFactory.getLogger(getClass()); /** @@ -64,6 +63,7 @@ public class ProjectDeclareStateMachineBuilder { .withStates() .initial(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) .choice(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) + .choice(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) .states(EnumSet.allOf(ProjectStatusEnum.class)); builder.configureTransitions() @@ -87,6 +87,7 @@ public class ProjectDeclareStateMachineBuilder { .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) .target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) .event(ProjectStatusChangeEvent.PROJECT_APPLICATION_SUBMIT).and() + // 待预审预审申报,从待预审到待预审选择 .withExternal() .source(ProjectStatusEnum.PENDING_PREQUALIFICATION) @@ -95,8 +96,9 @@ public class ProjectDeclareStateMachineBuilder { // 待预审申报,从待预审选择->省级部门联审中,预审中,完成其中一种状态 .withChoice() .source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),projectDeclareAction.new ProjectDeclareChoiceAction()) - .last(ProjectStatusEnum.PRE_APPLYING,projectDeclareAction.new ProjectDeclareChoiceAction()).and() + .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction()) + .last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and() + // 省级部门联审通过,从省级部门联审中到省级部门联审成功 .withExternal() .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) @@ -112,7 +114,7 @@ public class ProjectDeclareStateMachineBuilder { .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) .target(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED) .event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_REJECT).and() - // 省级部门联审中撤回,从省级部门联审中到省级部门联审不通过 + // 省级部门联审中撤回,从省级部门联审中到待预审 .withExternal() .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) .target(ProjectStatusEnum.PENDING_PREQUALIFICATION) @@ -128,17 +130,17 @@ public class ProjectDeclareStateMachineBuilder { .source(ProjectStatusEnum.PRE_APPLYING) .target(ProjectStatusEnum.PREQUALIFICATION_FAILED) .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT).and() - // 预审中撤回,从预审中到待预审选择 + // 预审中撤回,从预审中到预审中撤回选择态 .withExternal() .source(ProjectStatusEnum.PRE_APPLYING) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) + .target(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) .event(ProjectStatusChangeEvent.PRE_APPLYING_WITHDRAW).and() - // 预审中撤回,从待预审选择->省级部门联审成功,待预审,完成其中一种状态 + // 预审中撤回,从预审中撤回选择态->省级部门联审成功,待预审,完成其中一种状态 .withChoice() - .source(ProjectStatusEnum.PRE_APPLYING) + .source(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard() ,new ProjectDeclareChoiceAction()) - .last(ProjectStatusEnum.PENDING_PREQUALIFICATION,projectDeclareAction.new ProjectDeclareChoiceAction()).and() + .last(ProjectStatusEnum.PENDING_PREQUALIFICATION,new ProjectDeclareChoiceAction()).and() // 预审不通过重新提交,从预审不通过到待预审选择 .withExternal() .source(ProjectStatusEnum.PREQUALIFICATION_FAILED) @@ -147,8 +149,8 @@ public class ProjectDeclareStateMachineBuilder { // 预审不通过重新提交,从待预审选择->省级部门联审中,预审中,完成其中一种状态 .withChoice() .source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),projectDeclareAction.new ProjectDeclareChoiceAction()) - .last(ProjectStatusEnum.PRE_APPLYING,projectDeclareAction.new ProjectDeclareChoiceAction()).and() + .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction()) + .last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and() // 部门联审通过,从部门联审中到年度计划中 .withExternal() .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/util/ExcelDownUtil.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/util/ExcelDownUtil.java index 11b3ca3..bc6f5a3 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/util/ExcelDownUtil.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/util/ExcelDownUtil.java @@ -223,7 +223,10 @@ public class ExcelDownUtil { List nameList = CollUtils.fieldList(fileArray, w -> w.getString(CommonConst.FILE_NAME)); columnValue = nameList.stream().collect(Collectors.joining(StrPool.COMMA)); }else { - columnValue = jsonObject.getString(column.toString()); + columnValue = String.valueOf(jsonObject.get(column.toString())); + } + if (CommonConst.NULL.equals(columnValue)){ + columnValue = ""; } columnValues.add(columnValue); }); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/ProjectStatusEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/ProjectStatusEnum.java index 8ddf5f8..ec1cf1c 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/ProjectStatusEnum.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/ProjectStatusEnum.java @@ -44,6 +44,7 @@ public enum ProjectStatusEnum { TO_BE_DECLARED(10015, "待申报"), PLAN_TO_BE_DECLARED(10016, "方案待申报"), PENDING_PREQUALIFICATION_CHOICE(10017, "待预审选择态"), + PREQUALIFICATION_WITHDRAW_CHOICE(10019, "预审中撤回选择态"), /** * 项目阶段:已立项 */ diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java index b39f9d4..3523916 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java @@ -262,7 +262,17 @@ public class TodoCenterManage { req.setUserId(String.valueOf(userId)); req.setEmployeeCode(employeeCode); BeanUtils.copyProperties(param,req); - userTodoList = processTaskService.getUserTodoList(req); + + //有待办节点的(不包含退回) + List todoList = processTaskService.getUserTodoList(req); + //有退回待办的 + List backList = processTaskService.getBackTodoList(req); + //合并 并且排序 + userTodoList = Stream.concat(todoList.stream(),backList.stream()) + .filter(Objects::nonNull) + .sorted(Comparator.comparing(ProcessTaskVo::getTaskCreateTime) + .reversed()) + .collect(Collectors.toList()); } ExcelExportWriter excelExportWriter = new ExcelExportWriter(); @@ -549,7 +559,7 @@ public class TodoCenterManage { List projects = projectLibManage.projectList(projectListReq); List userIdoList = Lists.newArrayList(); Map projectInfoMap = Maps.newHashMap(); - if (CollUtil.isEmpty(projects)) { + if (CollUtil.isNotEmpty(projects)) { Map projectsMap = projects.stream().collect(Collectors.toMap(Project::getId, v -> v)); // 再查出项目关联的流程实例ID List projectIdList = projects.stream().map(Project::getId).collect(Collectors.toList()); @@ -687,7 +697,7 @@ public class TodoCenterManage { List userSubmittedList = Lists.newArrayList(); Map projectInfoMap = Maps.newHashMap(); - if (CollUtil.isEmpty(projects)) { + if (CollUtil.isNotEmpty(projects)) { Map projectsMap = projects.stream().collect(Collectors.toMap(Project::getId, v -> v)); // 再查出项目关联的流程实例ID List projectIdList = projects.stream().map(Project::getId).collect(Collectors.toList()); @@ -827,7 +837,7 @@ public class TodoCenterManage { List ccMeList = Lists.newArrayList(); Map projectInfoMap = Maps.newHashMap(); - if (CollUtil.isEmpty(projects)) { + if (CollUtil.isNotEmpty(projects)) { Map projectsMap = projects.stream().collect(Collectors.toMap(Project::getId, v -> v)); // 再查出项目关联的流程实例ID List projectIdList = projects.stream().map(Project::getId).collect(Collectors.toList());