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 4aa4f05..ff57b93 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 @@ -12,13 +12,10 @@ import com.alibaba.excel.ExcelWriter; import com.alibaba.excel.write.metadata.WriteSheet; import com.alibaba.fastjson.JSONObject; import com.ningdatech.basic.exception.BizException; -import com.ningdatech.basic.model.PageVo; import com.ningdatech.basic.util.NdDateUtils; import com.ningdatech.pmapi.common.enumeration.ExportOptionEnum; import com.ningdatech.pmapi.common.model.entity.ExcelExportWriter; import com.ningdatech.pmapi.projectlib.model.entity.Project; -import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO; -import com.ningdatech.pmapi.todocenter.model.dto.req.ToBeProcessedExportReq; import com.wflow.workflow.enums.ProcessStatusEnum; import org.apache.commons.collections4.CollectionUtils; import org.apache.http.HttpStatus; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/controller/TodoCenterController.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/controller/TodoCenterController.java index a51ecd0..3def55b 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/controller/TodoCenterController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/controller/TodoCenterController.java @@ -4,15 +4,19 @@ package com.ningdatech.pmapi.todocenter.controller; import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; -import com.ningdatech.pmapi.todocenter.bean.vo.ProcessProgressDetailVo; -import com.ningdatech.pmapi.todocenter.model.dto.req.ProcessDetailReq; -import com.ningdatech.pmapi.todocenter.model.dto.req.ToBeProcessedExportReq; +import com.ningdatech.pmapi.projectdeclared.model.dto.DefaultDeclaredDTO; +import com.ningdatech.pmapi.todocenter.model.dto.AdjustHandleDTO; +import com.ningdatech.pmapi.todocenter.model.vo.ProcessProgressDetailVo; +import com.ningdatech.pmapi.todocenter.model.req.ProcessDetailReq; +import com.ningdatech.pmapi.todocenter.model.req.ToBeProcessedExportReq; import com.wflow.workflow.bean.dto.ReqProcessHandlerDTO; +import io.swagger.annotations.ApiOperation; +import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import com.ningdatech.basic.model.PageVo; import com.ningdatech.pmapi.todocenter.manage.TodoCenterManage; -import com.ningdatech.pmapi.todocenter.model.dto.req.ToBeProcessedReq; -import com.ningdatech.pmapi.todocenter.model.dto.vo.ResToBeProcessedVO; +import com.ningdatech.pmapi.todocenter.model.req.ToBeProcessedReq; +import com.ningdatech.pmapi.todocenter.model.vo.ResToBeProcessedVO; import io.swagger.annotations.Api; import lombok.AllArgsConstructor; @@ -158,4 +162,11 @@ public class TodoCenterController { param.setIsTemporaryAugment(isTemporaryAugment); todoCenterManage.exportCcMeProjectList(response,param); } + + @ApiOperation(value = "被退回项目内容调整并通过", notes = "被退回项目内容调整并通过") + @PostMapping + public String startTheProcess(@Validated @RequestBody AdjustHandleDTO dto) { + String instanceId = todoCenterManage.adjustment(dto); + return "退回项目内容调整并且重新通过 【" + instanceId + "】 成功"; + } } 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 8e5148d..26e0359 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 @@ -17,25 +17,32 @@ import com.ningdatech.pmapi.organization.model.entity.DingEmployeeInfo; import com.ningdatech.pmapi.organization.model.entity.DingOrganization; import com.ningdatech.pmapi.organization.service.IDingEmployeeInfoService; import com.ningdatech.pmapi.organization.service.IDingOrganizationService; +import com.ningdatech.pmapi.projectdeclared.manage.DefaultDeclaredProjectManage; +import com.ningdatech.pmapi.projectdeclared.model.dto.DefaultDeclaredDTO; import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; import com.ningdatech.pmapi.projectlib.manage.ProjectLibManage; +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.req.ProjectListReq; import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO; +import com.ningdatech.pmapi.projectlib.service.IProjectApplicationService; import com.ningdatech.pmapi.projectlib.service.IProjectService; import com.ningdatech.pmapi.staging.enums.MsgTypeEnum; import com.ningdatech.pmapi.staging.service.INdWorkNoticeStagingService; import com.ningdatech.pmapi.todocenter.bean.entity.WorkNoticeInfo; -import com.ningdatech.pmapi.todocenter.bean.vo.ProcessProgressDetailVo; +import com.ningdatech.pmapi.todocenter.model.dto.AdjustHandleDTO; +import com.ningdatech.pmapi.todocenter.model.vo.ProcessProgressDetailVo; import com.ningdatech.pmapi.todocenter.enumeration.IsAppendProjectEnum; -import com.ningdatech.pmapi.todocenter.model.dto.req.ProcessDetailReq; -import com.ningdatech.pmapi.todocenter.model.dto.req.ToBeProcessedExportReq; -import com.ningdatech.pmapi.todocenter.model.dto.req.ToBeProcessedReq; -import com.ningdatech.pmapi.todocenter.model.dto.vo.ResToBeProcessedVO; +import com.ningdatech.pmapi.todocenter.model.req.ProcessDetailReq; +import com.ningdatech.pmapi.todocenter.model.req.ToBeProcessedExportReq; +import com.ningdatech.pmapi.todocenter.model.req.ToBeProcessedReq; +import com.ningdatech.pmapi.todocenter.model.vo.ResToBeProcessedVO; import com.ningdatech.pmapi.user.entity.UserInfo; import com.ningdatech.pmapi.user.service.IUserInfoService; import com.ningdatech.pmapi.user.util.LoginUserUtil; import com.wflow.contants.HisProInsEndActId; +import com.wflow.exception.BusinessException; import com.wflow.workflow.bean.dto.ProcessInstanceUserDto; import com.wflow.workflow.bean.dto.ReqProcessHandlerDTO; import com.wflow.workflow.bean.process.ProgressNode; @@ -43,6 +50,7 @@ import com.wflow.workflow.bean.process.enums.NodeTypeEnum; import com.wflow.workflow.bean.vo.ProcessInstanceVo; import com.wflow.workflow.bean.vo.ProcessProgressVo; import com.wflow.workflow.bean.vo.ProcessTaskVo; +import com.wflow.workflow.enums.ProcessHandlerEnum; import com.wflow.workflow.enums.ProcessStatusEnum; import com.wflow.workflow.service.ProcessInstanceService; import com.wflow.workflow.service.ProcessTaskService; @@ -55,6 +63,7 @@ import org.flowable.engine.history.HistoricProcessInstance; import org.flowable.engine.runtime.ActivityInstance; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; import javax.servlet.http.HttpServletResponse; import java.time.LocalDateTime; @@ -85,6 +94,8 @@ public class TodoCenterManage { private final IDingOrganizationService dingOrganizationService; private final ProcessInstanceService processInstanceService; private final INdWorkNoticeStagingService workNoticeStagingService; + private final DefaultDeclaredProjectManage defaultDeclaredProjectManage; + private final IProjectApplicationService projectApplicationService; /** @@ -617,7 +628,9 @@ public class TodoCenterManage { return PageVo.empty(); } List instCodes = userIdoList.stream().map(ProcessTaskVo::getInstanceId).collect(Collectors.toList()); - + List instances = historyService.createHistoricProcessInstanceQuery() + .list(); + Map instanceMap = CollUtils.listToMap(instances, HistoricProcessInstance::getId); // 分页查询项目信息 ProjectListReq projectListReq = new ProjectListReq(); @@ -632,7 +645,7 @@ public class TodoCenterManage { ResToBeProcessedVO res = new ResToBeProcessedVO(); BeanUtils.copyProperties(d, res); res.setProjectId(d.getId()); - res.setProcessStatusName(ProcessStatusEnum.getDescByCode(d.getProcessStatus())); + res.setProcessStatusName(processInstanceService.buildProcessStatusStr(instanceMap.get(d.getInstCode()))); res.setProcessLaunchTime(d.getCreateOn()); res.setProcessHandleTime(d.getUpdateOn()); return res; @@ -886,4 +899,61 @@ public class TodoCenterManage { ExcelDownUtil.excelExportFile(response, excelExportWriter); } + + /** + * 被退回项目内容调整并重新通过 + * @param dto + * @return + */ + @Transactional(rollbackFor = Exception.class) + public String adjustment(AdjustHandleDTO dto) { + ProjectDTO projectDto = dto.getProjectInfo(); + Project projectInfo = projectService.getById(projectDto.getId()); + + VUtils.isTrue(Objects.isNull(projectInfo)).throwMessage("调整失败 此项目不存在!"); + + //项目名称去重 + defaultDeclaredProjectManage.checkDuplication(projectDto); + + //修改项目内容 + if(!modifyProject(projectDto)){ + throw new BusinessException("调整项目失败!"); + } + + //最后去审批(通过)当前退回节点的审核任务 + ReqProcessHandlerDTO handlerDTO = new ReqProcessHandlerDTO(); + handlerDTO.setProjectId(dto.getProjectId()); + handlerDTO.setInstanceId(dto.getInstanceId()); + handlerDTO.setTaskId(dto.getTaskId()); + handlerDTO.setAction(ProcessHandlerEnum.PASS); + handlerDTO.setAuditInfo(dto.getAuditInfo()); + handler(handlerDTO); + return dto.getInstanceId(); + + } + + private Boolean modifyProject(ProjectDTO projectDto) { + //先修改项目信息 + Project project = new Project(); + BeanUtils.copyProperties(projectDto,project); + project.setUpdateOn(LocalDateTime.now()); + if(!projectService.updateById(project)){ + throw new BusinessException("项目调整失败"); + } + //再修改应用信息 + if(CollUtil.isNotEmpty(projectDto.getApplicationList())){ + //采取批量删除 批量添加的方式 + projectApplicationService.remove(Wrappers.lambdaQuery(ProjectApplication.class) + .eq(ProjectApplication::getProjectId,project.getId())); + //批量添加 + List applications = projectDto.getApplicationList().stream().map(application -> { + ProjectApplication projectApplication = new ProjectApplication(); + BeanUtils.copyProperties(application, projectApplication); + projectApplication.setProjectId(project.getId()); + return projectApplication; + }).collect(Collectors.toList()); + projectApplicationService.saveBatch(applications); + } + return Boolean.TRUE; + } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/AdjustHandleDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/AdjustHandleDTO.java new file mode 100644 index 0000000..6378d49 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/AdjustHandleDTO.java @@ -0,0 +1,59 @@ +package com.ningdatech.pmapi.todocenter.model.dto; + +import java.io.Serializable; +import java.util.Map; + +import javax.validation.constraints.NotNull; + +import com.google.common.collect.Maps; +import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO; +import com.wflow.workflow.bean.process.ProcessComment; +import com.wflow.workflow.enums.ProcessHandlerEnum; + +import cn.hutool.core.collection.CollUtil; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @Classname DefaultDeclaredDTO + * @Description + * @Date 2023/2/14 17:16 + * @Author PoffyZhang + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class AdjustHandleDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @NotNull + @ApiModelProperty("项目信息") + private ProjectDTO projectInfo; + + @ApiModelProperty("表单信息 新增模块") + private Map formData; + + public Map getFormData(){ + if(CollUtil.isEmpty(this.formData)){ + this.formData = Maps.newHashMap(); + return this.formData; + } + return this.formData; + } + @ApiModelProperty("项目ID") + @NotNull(message = "要处理的项目ID不能为空!") + private Long projectId; + + @NotNull(message = "流程实例ID不能为空!") + private String instanceId; + + @ApiModelProperty("任务ID") + @NotNull(message = "任务ID不能为空!") + private String taskId; + + @ApiModelProperty("审核信息") + private ProcessComment auditInfo; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/dto/ResCcMeExportDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/ResCcMeExportDTO.java similarity index 94% rename from pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/dto/ResCcMeExportDTO.java rename to pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/ResCcMeExportDTO.java index 8cb3241..248657d 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/dto/ResCcMeExportDTO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/ResCcMeExportDTO.java @@ -1,4 +1,4 @@ -package com.ningdatech.pmapi.todocenter.model.dto.dto; +package com.ningdatech.pmapi.todocenter.model.dto; import java.io.Serializable; import java.time.LocalDateTime; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/dto/ResHandledExportDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/ResHandledExportDTO.java similarity index 94% rename from pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/dto/ResHandledExportDTO.java rename to pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/ResHandledExportDTO.java index 3adf4ae..40f68da 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/dto/ResHandledExportDTO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/ResHandledExportDTO.java @@ -1,4 +1,4 @@ -package com.ningdatech.pmapi.todocenter.model.dto.dto; +package com.ningdatech.pmapi.todocenter.model.dto; import java.io.Serializable; import java.time.LocalDateTime; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/dto/ResMySubmittedExportDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/ResMySubmittedExportDTO.java similarity index 94% rename from pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/dto/ResMySubmittedExportDTO.java rename to pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/ResMySubmittedExportDTO.java index af0382f..f3f2329 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/dto/ResMySubmittedExportDTO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/ResMySubmittedExportDTO.java @@ -1,4 +1,4 @@ -package com.ningdatech.pmapi.todocenter.model.dto.dto; +package com.ningdatech.pmapi.todocenter.model.dto; import java.io.Serializable; import java.time.LocalDateTime; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/req/ProcessDetailReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/req/ProcessDetailReq.java similarity index 91% rename from pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/req/ProcessDetailReq.java rename to pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/req/ProcessDetailReq.java index df66044..fd3dc3c 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/req/ProcessDetailReq.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/req/ProcessDetailReq.java @@ -1,4 +1,4 @@ -package com.ningdatech.pmapi.todocenter.model.dto.req; +package com.ningdatech.pmapi.todocenter.model.req; import io.swagger.annotations.ApiModelProperty; import lombok.AllArgsConstructor; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/req/ToBeProcessedExportReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/req/ToBeProcessedExportReq.java similarity index 83% rename from pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/req/ToBeProcessedExportReq.java rename to pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/req/ToBeProcessedExportReq.java index 0ffda75..7e1eb1e 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/req/ToBeProcessedExportReq.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/req/ToBeProcessedExportReq.java @@ -1,8 +1,7 @@ -package com.ningdatech.pmapi.todocenter.model.dto.req; +package com.ningdatech.pmapi.todocenter.model.req; import java.util.List; -import javax.validation.constraints.NotNull; import com.ningdatech.pmapi.common.enumeration.ExportOptionEnum; import io.swagger.annotations.ApiModelProperty; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/req/ToBeProcessedReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/req/ToBeProcessedReq.java similarity index 95% rename from pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/req/ToBeProcessedReq.java rename to pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/req/ToBeProcessedReq.java index 111f05d..ce41441 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/req/ToBeProcessedReq.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/req/ToBeProcessedReq.java @@ -1,4 +1,4 @@ -package com.ningdatech.pmapi.todocenter.model.dto.req; +package com.ningdatech.pmapi.todocenter.model.req; import java.io.Serializable; import java.time.LocalDateTime; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/bean/vo/ProcessProgressDetailVo.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/vo/ProcessProgressDetailVo.java similarity index 92% rename from pmapi/src/main/java/com/ningdatech/pmapi/todocenter/bean/vo/ProcessProgressDetailVo.java rename to pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/vo/ProcessProgressDetailVo.java index 975df53..a6a1be4 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/bean/vo/ProcessProgressDetailVo.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/vo/ProcessProgressDetailVo.java @@ -1,4 +1,4 @@ -package com.ningdatech.pmapi.todocenter.bean.vo; +package com.ningdatech.pmapi.todocenter.model.vo; import com.wflow.workflow.bean.dto.ProcessInstanceUserDto; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/vo/ResToBeProcessedVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/vo/ResToBeProcessedVO.java similarity index 97% rename from pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/vo/ResToBeProcessedVO.java rename to pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/vo/ResToBeProcessedVO.java index fee797c..b1dc02b 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/vo/ResToBeProcessedVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/vo/ResToBeProcessedVO.java @@ -1,4 +1,4 @@ -package com.ningdatech.pmapi.todocenter.model.dto.vo; +package com.ningdatech.pmapi.todocenter.model.vo; import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; import com.fasterxml.jackson.annotation.JsonFormat;