diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java index 22cde80..b3bad8e 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java @@ -96,6 +96,12 @@ public class DeclaredProjectManage { Project oldProject = projectService.getById(projectInfo.getId()); VUtils.isTrue(Objects.isNull(oldProject)) .throwMessage(String.format("重新提交失败 该项目【%s】不存在",projectInfo.getId())); + + //重新要判断 项目当前状态 是不是 单位内部审核失败 + VUtils.isTrue(!ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode().equals(oldProject.getStatus()) || + !ProjectStatusEnum.NOT_APPROVED.getCode().equals(oldProject.getStage())) + .throwMessage("重新提交失败 该项目不是 单位内部拒绝或者未立项阶段"); + } String regionCode = projectInfo.getAreaCode(); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/schedule/task/BatchUpdateOrganizationTask.java b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/BatchUpdateOrganizationTask.java similarity index 82% rename from pmapi/src/main/java/com/ningdatech/pmapi/schedule/task/BatchUpdateOrganizationTask.java rename to pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/BatchUpdateOrganizationTask.java index 5bb5c29..c0de25c 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/schedule/task/BatchUpdateOrganizationTask.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/BatchUpdateOrganizationTask.java @@ -1,4 +1,4 @@ -package com.ningdatech.pmapi.schedule.task; +package com.ningdatech.pmapi.scheduler.task; import org.springframework.stereotype.Component; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/ProcdefController.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/SysProcDefController.java similarity index 94% rename from pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/ProcdefController.java rename to pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/SysProcDefController.java index 8a6b16a..859281e 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/ProcdefController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/SysProcDefController.java @@ -1,10 +1,7 @@ package com.ningdatech.pmapi.sys.controller; -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONArray; import com.ningdatech.basic.model.PageVo; import com.wflow.bean.dto.WflowModelHistorysDto; -import com.wflow.bean.vo.WflowFormVo; import com.wflow.bean.vo.WflowModelVo; import com.wflow.service.ModelGroupService; import com.wflow.workflow.service.ProcessModelService; @@ -27,7 +24,7 @@ import org.springframework.web.bind.annotation.*; @RequestMapping("/api/v1/sys/procdef") @Api(value = "SysProcdef", tags = "系统管理-流程配置") @RequiredArgsConstructor -public class ProcdefController { +public class SysProcDefController { private final ModelGroupService modelGroupService; 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 a73f362..2f152c5 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 @@ -3,10 +3,12 @@ package com.ningdatech.pmapi.todocenter.manage; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.date.StopWatch; import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.google.common.collect.Sets; import com.ningdatech.basic.exception.BizException; import com.ningdatech.basic.model.PageVo; +import com.ningdatech.basic.util.CollUtils; import com.ningdatech.pmapi.common.constant.CommonConstant; import com.ningdatech.pmapi.common.model.entity.ExcelExportWriter; import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; @@ -46,10 +48,12 @@ import com.wflow.workflow.enums.ProcessStatusEnum; import com.wflow.workflow.service.*; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; import org.assertj.core.util.Lists; import org.flowable.bpmn.model.*; import org.flowable.engine.*; import org.flowable.engine.history.HistoricProcessInstance; +import org.flowable.engine.repository.ProcessDefinition; import org.flowable.engine.runtime.ActivityInstance; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Component; @@ -79,11 +83,12 @@ public class TodoCenterManage { private final ProjectLibManage projectLibManage; private final StateMachineUtils stateMachineUtils; - private final ZwddClient zwddClient; + private final IDingEmployeeInfoService dingEmployeeInfoService; private final IDingOrganizationService dingOrganizationService; private final ProcessInstanceService processInstanceService; + /** * 待办中心待我处理项目列表查询 * @@ -96,46 +101,40 @@ public class TodoCenterManage { Long userId = LoginUserUtil.getUserId(); //因为要解耦 不能把项目和工作流一起查 //1.先查出用户工作流 - StopWatch stopWatch = new StopWatch(); - stopWatch.start(); List userTodoList = processTaskService.getUserTodoList(param.getProcessDefId(),String.valueOf(userId)); if(CollUtil.isEmpty(userTodoList)){ return PageVo.empty(); } List instCodes = userTodoList.stream().map(ProcessTaskVo::getInstanceId).collect(Collectors.toList()); - stopWatch.stop(); - log.info("查询 工作流个人列表 所消耗时间 :{}s" + stopWatch.getTotalTimeSeconds()); - - StopWatch stopWatch2 = new StopWatch(); - stopWatch2.start(); Map taskVoMap = userTodoList.stream().collect(Collectors.toMap(ProcessTaskVo::getInstanceId, v -> v)); //2.再分页查询项目信息 ProjectListReq projectListReq = new ProjectListReq(); projectListReq.setInstCodes(instCodes); BeanUtils.copyProperties(param,projectListReq); PageVo projectPage = projectLibManage.projectLibList(projectListReq); - stopWatch2.stop(); - log.info("查询 项目库列表 所消耗时间 :{}s" + stopWatch2.getTotalTimeSeconds()); if(0L == projectPage.getTotal()){ return PageVo.empty(); } - StopWatch stopWatch3 = new StopWatch(); - stopWatch3.start(); + List instances = historyService.createHistoricProcessInstanceQuery() + .list(); + Map instanceMap = CollUtils.listToMap(instances,HistoricProcessInstance::getId); + List resVos = projectPage.getRecords().stream().map(d -> { ResToBeProcessedVO res = new ResToBeProcessedVO(); BeanUtils.copyProperties(d, res); res.setProjectId(d.getId()); ProcessTaskVo taskVo = taskVoMap.get(d.getInstCode()); res.setNodeId(taskVo.getTaskDefKey()); - res.setProcessStatusName(ProcessStatusEnum.getDescByCode(d.getProcessStatus())); + if(instanceMap.containsKey(d.getInstCode())){ + res.setProcessStatusName(processInstanceService + .buildProcessStatusStr(instanceMap.get(d.getInstCode()).getEndActivityId())); + } res.setProcessLaunchTime(d.getCreateOn()); return res; }).collect(Collectors.toList()); - stopWatch3.stop(); - log.info("查询 转换实体 所消耗时间 :{}s" + stopWatch3.getTotalTimeSeconds()); return PageVo.of(resVos, projectPage.getTotal()); } @@ -576,12 +575,7 @@ public class TodoCenterManage { String instanceId = request.getInstanceId(); String nodeId = request.getNodeId(); Long projectId = request.getProjectId(); - ProcessProgressVo progressInstanceDetail = null; - if (Objects.isNull(nodeId)) { - progressInstanceDetail = processInstanceService.getProgressInstanceDetail(null, instanceId); - }else { - progressInstanceDetail = processInstanceService.getProgressInstanceDetail(nodeId, instanceId); - } + ProcessProgressVo progressInstanceDetail = processInstanceService.getProgressInstanceDetail(nodeId, instanceId); List progressInfo = progressInstanceDetail.getProgressInfo(); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/service/impl/UserInfoServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/service/impl/UserInfoServiceImpl.java index 3ebf4d3..528e7f0 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/service/impl/UserInfoServiceImpl.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/user/service/impl/UserInfoServiceImpl.java @@ -49,11 +49,11 @@ public class UserInfoServiceImpl extends ServiceImpl } // 根据浙政钉用户ID获取单位code DingEmployeeInfo employeeInfo = dingEmployeeInfoService.getOne(Wrappers.lambdaQuery(DingEmployeeInfo.class) - .eq(DingEmployeeInfo::getAccountId, accountId)); + .eq(DingEmployeeInfo::getAccountId, accountId).last("limit 1")); String organizationCode = employeeInfo.getOrganizationCode(); // 根据 单位code获取单位名称 DingOrganization dingOrganization = dingOrganizationService.getOne(Wrappers.lambdaQuery(DingOrganization.class) - .eq(DingOrganization::getOrganizationCode, organizationCode)); + .eq(DingOrganization::getOrganizationCode, organizationCode).last("limit 1")); String organizationName = dingOrganization.getOrganizationName(); userInfo.setOrgCode(organizationCode); userInfo.setOrgName(organizationName); diff --git a/pmapi/src/test/java/com/ningdatech/pmapi/statemachine/StateMachineTest.java b/pmapi/src/test/java/com/ningdatech/pmapi/statemachine/StateMachineTest.java index a6ccbcd..d563236 100644 --- a/pmapi/src/test/java/com/ningdatech/pmapi/statemachine/StateMachineTest.java +++ b/pmapi/src/test/java/com/ningdatech/pmapi/statemachine/StateMachineTest.java @@ -28,7 +28,6 @@ public class StateMachineTest extends AppTests { project.setStage(ProjectStatusEnum.PROJECT_APPROVED.getCode()); project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); project.setDeclareAmount(BigDecimal.valueOf(2000)); - // stateMachineUtils.execute(project, ProjectStatusChangeEvent.UNDER_INTERNAL_PASS); stateMachineUtils.execute(project, stateMachineUtils.getProjectStatusPassEvent(project.getStatus())); System.out.println(String.format("project:%s", JSON.toJSONString(project))); }