Quellcode durchsuchen

fit:获取流程按钮

zzw vor 1 Monat
Ursprung
Commit
4379c00c25

+ 1 - 1
assistMg/src/main/java/com/hotent/constant/NodeConstant.java

@@ -3,7 +3,7 @@ package com.hotent.constant;
 public enum NodeConstant {
 
     tjcl("tjcl", "提交材料"),
-    ccls("ccls", "材料初审"),
+    ccls("clcs", "材料初审"),
     sdshenhe("sdshenhe", "实地审核"),
     yjgaozhi("yjgaozhi", "意见告知"),
     yjfk("yjfk", "意见反馈"),

+ 159 - 6
assistMg/src/main/java/com/hotent/enterpriseDeclare/controller/CostAuditReviewController.java

@@ -7,16 +7,16 @@ import com.hotent.base.annotation.ApiGroup;
 import com.hotent.base.constants.ApiGroupConsts;
 import com.hotent.base.model.CommonResult;
 import com.hotent.base.util.StringUtil;
+import com.hotent.constant.BaseConstant;
 import com.hotent.constant.NodeConstant;
 import com.hotent.constant.TaskStatusConstant;
 import com.hotent.enterpriseDeclare.req.CostTaskPageReq;
 import com.hotent.enterpriseDeclare.req.CostTaskReviewPageReq;
-import com.hotent.project.manager.CostProjectApprovalManager;
-import com.hotent.project.manager.CostProjectTaskManager;
-import com.hotent.project.manager.CostProjectTaskNodeManager;
+import com.hotent.project.manager.*;
 import com.hotent.project.model.CostProjectApproval;
 import com.hotent.project.model.CostProjectTask;
 import com.hotent.project.model.CostProjectTaskNode;
+import com.hotent.project.model.CostProjectTaskProccess;
 import com.hotent.sys.persistence.manager.DataDictManager;
 import com.hotent.sys.persistence.model.DataDict;
 import com.hotent.uc.api.model.IUser;
@@ -47,11 +47,18 @@ public class CostAuditReviewController {
     @Autowired
     private CostProjectTaskNodeManager costProjectTaskNodeManager;
 
+    @Autowired
+    private CostProjectTaskProccessManager costProjectTaskProccessManager;
+
     @Resource
     DataDictManager dataDictManager;
 
+    @Autowired
+    private CostNoticeManager costNoticeManager;
+
     /**
      * 分页查询待审核任务列表
+     *
      * @param req 分页查询请求参数
      * @return 待审核任务分页列表
      */
@@ -64,6 +71,7 @@ public class CostAuditReviewController {
 
     /**
      * 审核任务分页查询的具体实现
+     *
      * @param req 分页查询请求参数
      * @return 分页结果
      */
@@ -131,8 +139,8 @@ public class CostAuditReviewController {
             // 查询子任务列表
             LambdaQueryWrapper<CostProjectTask> childQueryWrapper = new LambdaQueryWrapper<>();
             childQueryWrapper.eq(CostProjectTask::getPid, rootTask.getId())
-                            .eq(CostProjectTask::getIsDeleted, "0")
-                            .orderByAsc(CostProjectTask::getOrderNum);
+                    .eq(CostProjectTask::getIsDeleted, "0")
+                    .orderByAsc(CostProjectTask::getOrderNum);
 
             List<CostProjectTask> childTasks = costProjectTaskManager.list(childQueryWrapper);
             for (CostProjectTask childTask : childTasks) {
@@ -146,13 +154,13 @@ public class CostAuditReviewController {
     }
 
 
-
     @PostMapping(value = "/getProcessBtn")
     @ApiOperation(value = "获取流程按钮", httpMethod = "POST", notes = "获取流程按钮")
     public CommonResult<List<java.util.Map<String, Object>>> getProcessBtn(@RequestBody CostTaskPageReq req) {
         CostProjectTaskNode one = costProjectTaskNodeManager.getOne(
                 new LambdaQueryWrapper<CostProjectTaskNode>()
                         .eq(CostProjectTaskNode::getTaskId, req.getTaskId())
+                        .eq(CostProjectTaskNode::getProcessNodeKey, req.getProcessNodeKey())
         );
 
         if (one == null || StringUtil.isEmpty(one.getStatus())) {
@@ -183,4 +191,149 @@ public class CostAuditReviewController {
 
         return CommonResult.<List<java.util.Map<String, Object>>>ok().value(buttonList);
     }
+
+
+    @PostMapping(value = "/doProcessBtn")
+    @ApiOperation(value = "流程按钮操作", httpMethod = "POST", notes = "流程按钮操作")
+    @org.springframework.transaction.annotation.Transactional
+    public CommonResult<String> doProcessBtn(@RequestBody CostTaskPageReq req) {
+        if (StringUtil.isEmpty(req.getTaskId()) || StringUtil.isEmpty(req.getKey())) {
+            return CommonResult.<String>error().message("任务ID和操作key不能为空");
+        }
+
+        // 获取任务信息
+        CostProjectTask task = costProjectTaskManager.getById(req.getTaskId());
+
+        String resultMessage = "";
+
+        switch (req.getKey()) {
+            case "1":
+                // 通过
+                resultMessage = supplementTask(task);
+                break;
+            case "2":
+                // 中止
+                resultMessage = suspendTask(task);
+                break;
+            case "4":
+                // 退回
+                resultMessage = returnToSubmit(task);
+                break;
+            default:
+                return CommonResult.<String>error().message("未知的操作类型");
+        }
+        return CommonResult.<String>ok().value(resultMessage);
+    }
+
+
+    /**
+     * 初审通过,只修改状态,节点变化需要等待所有子任务完成。
+     */
+    private String supplementTask(CostProjectTask task) {
+        // 将当前任务置为办结
+        task.setStatus(TaskStatusConstant.COMPLETED.getStatusCode());
+        costProjectTaskManager.updateById(task);
+
+        // 材料初审通过通知
+        String title = "材料初审通过";
+        String auditedUnit = task.getAuditedUnitName() == null ? "" : task.getAuditedUnitName();
+        String projectName = task.getProjectName() == null ? "" : task.getProjectName();
+        String year = task.getYear() == null ? "" : task.getYear();
+        String content = String.format("%s%s%s材料初审通过。", year, projectName, auditedUnit);
+        String enterpriseId = task.getAuditedUnitId() == null ? "" : task.getAuditedUnitId();
+        String noticeSource = "系统";
+        String sendTarget = task.getCreateBy() == null ? "" : task.getCreateBy();
+        costNoticeManager.sendNotice(task.getProjectId(), "1", title, content, enterpriseId, noticeSource, sendTarget);
+
+
+        // 检查同一父任务下是否所有子任务均已办结;若是,父任务节点流转
+        List<CostProjectTask> siblingTasks = costProjectTaskManager.list(
+                new LambdaQueryWrapper<CostProjectTask>()
+                        .eq(CostProjectTask::getPid, task.getPid())
+                        .eq(CostProjectTask::getIsDeleted, "0")
+        );
+
+        boolean allSiblingsCompleted = true;
+        for (CostProjectTask s : siblingTasks) {
+            if (!TaskStatusConstant.COMPLETED.getStatusCode().equals(s.getStatus())) {
+                allSiblingsCompleted = false;
+                break;
+            }
+        }
+
+        if (allSiblingsCompleted) {
+            CostProjectTask parentTask = costProjectTaskManager.getById(task.getPid());
+            if (parentTask != null) {
+                CostProjectTaskProccess parentProccess = costProjectTaskProccessManager.getOne(
+                        new LambdaQueryWrapper<CostProjectTaskProccess>()
+                                .eq(CostProjectTaskProccess::getTaskId, parentTask.getId())
+                );
+                // 将父任务流转到实地审核
+                parentTask.setCurrentNode(NodeConstant.sdshenhe.getNodeKey());
+                costProjectTaskManager.updateById(parentTask);
+                if (parentProccess != null) {
+                    parentProccess.setCurrentNode(NodeConstant.sdshenhe.getNodeKey());
+                    costProjectTaskProccessManager.updateById(parentProccess);
+                }
+            }
+        }
+
+        return "初审已通过。";
+    }
+
+    /**
+     * 初审退回,退回企业补充材料,并可额外增加补充材料。
+     */
+    private String returnToSubmit(CostProjectTask task) {
+        // 获取流程信息
+        CostProjectTaskProccess taskProccess = costProjectTaskProccessManager.getOne(
+                new LambdaQueryWrapper<CostProjectTaskProccess>()
+                        .eq(CostProjectTaskProccess::getTaskId, task.getId())
+        );
+        // 通知内容组装
+        String title = "材料初审退回";
+        String auditedUnit = task.getAuditedUnitName() == null ? "" : task.getAuditedUnitName();
+        String projectName = task.getProjectName() == null ? "" : task.getProjectName();
+        String year = task.getYear() == null ? "" : task.getYear();
+        String content = String.format("%s%s%s材料初审因材料不全被退回,请补充完善。", year, projectName, auditedUnit);
+        String enterpriseId = task.getAuditedUnitId() == null ? "" : task.getAuditedUnitId();
+        String noticeSource = "系统";
+        String sendTarget = task.getCreateBy() == null ? "" : task.getCreateBy();
+
+        costNoticeManager.sendNotice(task.getProjectId(), "1", title, content, enterpriseId, noticeSource, sendTarget);
+
+        // 退回提交材料环节
+        taskProccess.setCurrentNode(NodeConstant.tjcl.getNodeKey());
+        costProjectTaskProccessManager.updateById(taskProccess);
+
+        // 更新任务的当前节点和状态
+        task.setCurrentNode(NodeConstant.tjcl.getNodeKey());
+        task.setStatus(TaskStatusConstant.WAIT_SUBMIT.getStatusCode());
+        costProjectTaskManager.updateById(task);
+
+        return "初审已退回";
+    }
+
+    /**
+     * 中止监审,填写中止原因,并中止被监审单位审核
+     */
+    private String suspendTask(CostProjectTask task) {
+
+        // 更新任务状态为中止
+        task.setStatus(TaskStatusConstant.SUSPENDED.getStatusCode());
+        costProjectTaskManager.updateById(task);
+
+        // 更新流程阶段为中止(保持当前节点不变,但状态为中止)
+        CostProjectTaskProccess taskProccess = costProjectTaskProccessManager.getOne(
+                new LambdaQueryWrapper<CostProjectTaskProccess>()
+                        .eq(CostProjectTaskProccess::getTaskId, task.getId())
+        );
+        if (taskProccess != null) {
+            costProjectTaskProccessManager.updateById(taskProccess);
+        }
+
+        return "监审任务已中止";
+    }
+
+
 }

+ 6 - 0
assistMg/src/main/java/com/hotent/enterpriseDeclare/req/CostTaskPageReq.java

@@ -10,4 +10,10 @@ public class CostTaskPageReq {
 
     @ApiModelProperty(value = "任务ID", required = true)
     private String taskId;
+
+    private String processNodeKey;
+
+    @ApiModelProperty(value = "按钮操作key:1-补充材料、2-中止、3-退回上一步、4-退回、5-归档")
+    private String key;
+
 }

+ 2 - 0
assistMg/src/main/java/com/hotent/project/manager/CostNoticeManager.java

@@ -29,6 +29,8 @@ public interface CostNoticeManager extends BaseManager<CostNotice> {
 
 	IPage<CostNotice> pageList(CostProjectNoticePageReq req);
 
+	void sendNotice(String projectId, String number, String title, String content, String enterpriseId, String noticeSource, String sendTarget);
+
 
 	/**
 	 *

+ 15 - 1
assistMg/src/main/java/com/hotent/project/manager/impl/CostNoticeManagerImpl.java

@@ -32,7 +32,7 @@ public class CostNoticeManagerImpl extends BaseManagerImpl<CostNoticeDao, CostNo
 	@Override
 	public CostNotice getDetail(String id) {
     	CostNotice costNotice = this.get(id);
-    	
+
 
 		return costNotice;
 	}
@@ -61,6 +61,20 @@ public class CostNoticeManagerImpl extends BaseManagerImpl<CostNoticeDao, CostNo
 	}
 
 	@Override
+	public void sendNotice(String projectId, String number, String title, String content, String enterpriseId, String noticeSource, String sendTarget) {
+		CostNotice costNotice = new CostNotice();
+		costNotice.setNoticeTitle(title);
+		costNotice.setNoticeType(number);
+		costNotice.setProjectId(projectId);
+		costNotice.setStatus(BaseConstant.NORMAL_STATUS);
+		costNotice.setNoticeContent(content);
+		costNotice.setEnterpriseId(enterpriseId);
+		costNotice.setNoticeSource(noticeSource);
+		costNotice.setSendTarget(sendTarget);
+		this.save(costNotice);
+	}
+
+	@Override
 	public void sendNotice(String projectId ,String noticeType, String noticeTitle, String noticeContent) {
 		CostNotice costNotice = new CostNotice();
 		costNotice.setNoticeTitle(noticeTitle);

+ 35 - 7
assistMg/src/main/java/com/hotent/project/model/CostNotice.java

@@ -27,22 +27,22 @@ public class CostNotice extends BaseModel<CostNotice> {
     @TableId(value = "notice_id", type = IdType.ASSIGN_ID)
     @JsonProperty("noticeId")
     private String noticeId;
-    
+
     @ApiModelProperty(value = "公告标题")
     @TableField("notice_title")
     @JsonProperty("noticeTitle")
     private String noticeTitle;
-    
+
     @ApiModelProperty(value = "公告类型(1通知 2公告)")
     @TableField("notice_type")
     @JsonProperty("noticeType")
     private String noticeType;
-    
+
     @ApiModelProperty(value = "公告内容")
     @TableField("notice_content")
     @JsonProperty("noticeContent")
     private String noticeContent;
-    
+
     @ApiModelProperty(value = "公告状态(0正常 1关闭)")
     @TableField("status")
     @JsonProperty("status")
@@ -71,17 +71,45 @@ public class CostNotice extends BaseModel<CostNotice> {
     @TableField("remark")
     @JsonProperty("remark")
     private String remark;
-    
+
     @ApiModelProperty(value = "逻辑删除:0正常 1删除")
     @TableField("is_deleted")
     @JsonProperty("isDeleted")
     private String isDeleted;
-    
+
     @ApiModelProperty(value = "项目id")
     @TableField("project_id")
     @JsonProperty("projectId")
     private String projectId;
-    
+
+    @TableField("enterprise_id")
+    @JsonProperty("enterpriseId")
+    private String enterpriseId;
+
+
+    @ApiModelProperty(value = "消息来源")
+    @TableField("notice_source")
+    @JsonProperty("noticeSource")
+    private String noticeSource;
+
+    @ApiModelProperty(value = "发送对象")
+    @TableField("send_target")
+    @JsonProperty("sendTarget")
+    private String sendTarget;
+
+    // Getter & Setter
+    public String getNoticeSource() { return noticeSource; }
+    public void setNoticeSource(String noticeSource) { this.noticeSource = noticeSource; }
+
+    public String getSendTarget() { return sendTarget; }
+    public void setSendTarget(String sendTarget) { this.sendTarget = sendTarget; }
+    public String getEnterpriseId() {
+        return enterpriseId;
+    }
+
+    public void setEnterpriseId(String enterpriseId) {
+        this.enterpriseId = enterpriseId;
+    }
 
     public String getNoticeId() {
         return noticeId;