Browse Source

1、项目验收表单生成

fuwb 1 year ago
parent
commit
0befe4ec75

+ 15 - 0
zjugis-business/src/main/java/com/zjugis/business/flow/project/controller/FlowProjectController.java

@@ -66,4 +66,19 @@ public class FlowProjectController extends BaseController {
     public String update(@ParamModel Project project) {
         return success(projectFlowService.updateById(project));
     }
+
+
+    /**
+     * 项目验收表单生成
+     *
+     * @param flowInstanceId
+     * @return
+     */
+    @WorkFlow(isReceiveMaterial = true, isReceiveOpinion = true)
+    @GetMapping("/index")
+    public String projectAccept(String flowInstanceId) {
+        Map<String, Object> map = projectFlowService.projectAccept(flowInstanceId);
+        return resultPage(map);
+    }
+
 }

+ 36 - 0
zjugis-business/src/main/java/com/zjugis/business/flow/project/service/FlowProjectService.java

@@ -98,10 +98,46 @@ public class FlowProjectService {
                 map.put("hyName", result.getData().getLabel());
             }
         }
+        CommonResult<DictDataRespDTO> projectStatus = dictDataApi.getDictData("project_status", String.valueOf(entity.getXmzt()));
+        if (projectStatus.isSuccess()) {
+            map.put("projectStatus", projectStatus.getData().getLabel());
+        }
         return map;
     }
 
     public int updateById(Project project) {
         return projectMapper.updateById(project);
     }
+
+    /**
+     * 项目验收表单生成
+     *
+     * @param flowInstanceId
+     * @return
+     */
+    public Map<String, Object> projectAccept(String flowInstanceId) {
+        String userId = SecurityFrameworkUtils.getLoginUserId();
+        CommonResult<IFlowInstance> flowResult = workflowClient.flowInstance(flowInstanceId);
+        if(flowResult.isSuccess()){
+            IFlowInstance flowInstance = flowResult.getData();
+            Project entity = projectService.selectByInstanceId(flowInstanceId);
+            if(Objects.isNull(entity)){
+                entity = new Project();
+                entity.setInstanceId(flowInstanceId);
+                entity.setLxsj(LocalDate.now());
+                entity.setIsSign(1);
+                entity.setWorkerId(userId);
+                entity.setFlowStatus(FlowStatusConstants.FLOW_NOT_START);
+                entity.setXmzt(XmztConstants.STATUS_APPLY);
+                CommonResult<AdminUserRespDTO> result = adminUserApi.getUser(userId);
+                AdminUserRespDTO user = result.getCheckedData();
+                entity.setApplyWorkerName(user.getNickname());
+                entity.setApplyWorkerDeptId(user.getDeptId());
+                entity.setApplyWorkerDept(StringUtils.isBlank(user.getDeptName())?deptApi.getDept(user.getDeptId()).getCheckedData().getName():user.getDeptName());
+                projectService.insert(entity);
+            }
+            return createMap(flowInstanceId,  entity, userId);
+        }
+        return createModelMap();
+    }
 }