jzh 1 рік тому
батько
коміт
d0a5e0953f

+ 117 - 33
zjugis-business/src/main/java/com/zjugis/business/flow/resign/event/ResignEvent.java

@@ -1,36 +1,28 @@
 package com.zjugis.business.flow.resign.event;
 
 import cn.hutool.core.collection.CollectionUtil;
-import com.zjugis.business.bean.entity.ContractApply;
-import com.zjugis.business.constants.OfficialSealNameConstants;
-import com.zjugis.business.constants.PostConstants;
 import com.zjugis.business.constants.StaffStateConstants;
-import com.zjugis.business.converter.staff.StaffConvert;
-import com.zjugis.business.flow.officialSeal.entity.OfficialSealOuterDO;
 import com.zjugis.business.flow.resign.dao.ResignDAO;
-import com.zjugis.business.flow.resign.dao.ResignDetailDAO;
 import com.zjugis.business.flow.resign.entity.ResignDO;
 import com.zjugis.business.flow.resign.entity.ResignDetailDO;
 import com.zjugis.business.flow.resign.service.ResignDetailService;
 import com.zjugis.business.flow.resign.service.ResignService;
-import com.zjugis.business.flow.staff.entity.StaffDO;
-import com.zjugis.business.flow.staff.service.StaffService;
 import com.zjugis.framework.common.pojo.CommonResult;
 import com.zjugis.framework.common.util.date.LocalDateTimeUtils;
-import com.zjugis.framework.common.util.string.StrUtils;
 import com.zjugis.framework.workflow.exception.BusinessException;
 import com.zjugis.framework.workflow.model.BaseController;
 import com.zjugis.framework.workflow.rpc.remote.WorkflowClient;
 import com.zjugis.framework.workflow.spring.resovler.ParamModel;
 import com.zjugis.module.adm.api.staff.StaffApi;
-import com.zjugis.module.adm.api.staff.dto.StaffRecordsDTO;
 import com.zjugis.module.adm.api.staff.dto.StaffStateDTO;
 import com.zjugis.module.system.api.dept.DeptApi;
+import com.zjugis.module.system.api.dept.DeptLeaderApi;
 import com.zjugis.module.system.api.user.AdminUserApi;
 import com.zjugis.module.system.api.user.dto.AdminUserRespDTO;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -38,10 +30,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.annotation.Resource;
-import java.math.BigDecimal;
 import java.time.LocalDateTime;
 import java.util.*;
-import java.util.stream.Collectors;
 
 import static com.zjugis.business.constants.FlowStatusConstants.*;
 import static com.zjugis.framework.common.util.collection.CollectionUtils.convertSet;
@@ -55,6 +45,22 @@ import static com.zjugis.framework.common.util.collection.CollectionUtils.conver
 @RequestMapping("/resign-event")
 public class ResignEvent extends BaseController {
 
+    @Value("${resign.data.softDeptIds}")
+    private String softDeptIds;
+
+    @Value("${resign.data.planDeptIds}")
+    private String planDeptIds;
+
+    @Value("${resign.data.softPostIds}")
+    private String softPostIds;
+
+    @Value("${resign.data.planDeptIds}")
+    private String planPostIds;
+
+    @Value("${resign.data.checkDeptIds}")
+    private String checkDeptIds;
+
+
     @Resource
     private ResignDAO resignDAO;
     @Resource
@@ -71,6 +77,8 @@ public class ResignEvent extends BaseController {
 
     @Autowired
     AdminUserApi adminUserApi;
+    @Resource
+    private DeptLeaderApi deptLeaderApi;
 
     /**
      * 设置流程描述
@@ -257,61 +265,137 @@ public class ResignEvent extends BaseController {
     }
 
 
+    /**
+     * 数据中心接收人
+     */
+    @PostMapping("/dataReceiver")
+    public String dataReceiver(String flowInstanceId) {
+        try {
+            if (StringUtils.isNotBlank(flowInstanceId)) {
+                ResignDO entity = resignService.findByInstanceId(flowInstanceId);
+                List<Map<String, String>> userMaps = new ArrayList<>();
+                String deptId = deptApi.getSecondDeptByDeptId(entity.getDeptId()).getCheckedData().getId();
+                if (deptId != null) {
+                    List<AdminUserRespDTO> users = adminUserApi.getUserListByPostIds(dataLocationCheck(deptId)).getCheckedData();
+                    if (CollectionUtil.isNotEmpty(users)) {
+                        Set<String> ids = convertSet(users, AdminUserRespDTO::getId);
+
+                        ids.forEach(v -> {
+                            HashMap<String, String> map = new HashMap<>();
+                            if (v != null) {
+                                map.put("id", v);
+                                userMaps.add(map);
+                            }
+                        });
+
+
+                        return ok(userMaps);
+                    } else {
+                        throw new BusinessException("执行事件出错,请联系管理员!");
+                    }
+                }
+                throw new BusinessException("执行事件出错,请联系管理员!");
+
+
+            } else {
+                throw new BusinessException("执行事件出错,请联系管理员!");
+            }
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            throw new BusinessException("执行事件出错,请联系管理员!");
+        }
+    }
+
+
     /**
      * 判断是否存在
-     * 必须返回true 才会继续往下流转
      */
-    @PostMapping("/exist/{type}")
-    public String exist(@ParamModel Map flowInstance, @PathVariable String type) {
+    @PostMapping("/location/{type}")
+    public String existLocation(@ParamModel Map flowInstance, @PathVariable String type) {
         try {
             String flowInstanceId = flowInstance.get("id").toString();
 
             ResignDO entity = resignService.findByInstanceId(flowInstanceId);
-            List<ResignDetailDO> detailDOS = resignDetailService.getListByResignId(entity.getId());
+
+            if (type.equals(entity.getLzygszd())) {
+                return "true";
+            } else {
+                return "false";
+            }
+
+
+        } catch (Exception ex) {
+            return error(ex.getMessage(), ErrorCode.DEFAULT);
+        }
+    }
+
+
+    /**
+     * 判断部门是软件板块还是规划板块
+     * 1空间信息/规划/江苏分公司  2其他
+     */
+    @PostMapping("/department/{type}")
+    public String department(@ParamModel Map flowInstance, @PathVariable String type) {
+        try {
+            String flowInstanceId = flowInstance.get("id").toString();
 
 
+            ResignDO entity = resignService.findByInstanceId(flowInstanceId);
+            String deptId = deptApi.getSecondDeptByDeptId(entity.getDeptId()).getCheckedData().getId();
+
             switch (type) {
                 case "1":
-                    if (CollectionUtil.isNotEmpty(detailDOS)) {
+                    if (deptCheck(deptId)) {
                         return "true";
                     } else {
                         return "false";
                     }
                 case "2":
-                    if (CollectionUtil.isNotEmpty(detailDOS)) {
+                    if (!deptCheck(deptId)) {
                         return "false";
                     } else {
                         return "true";
                     }
+
                 default:
                     return "false";
             }
 
+
         } catch (Exception ex) {
             return error(ex.getMessage(), ErrorCode.DEFAULT);
         }
     }
 
-    /**
-     * 判断是否存在
-     */
-    @PostMapping("/location/{type}")
-    public String existLocation(@ParamModel Map flowInstance, @PathVariable String type) {
-        try {
-            String flowInstanceId = flowInstance.get("id").toString();
+    private boolean deptCheck(String deptId) {
+        return checkDeptIds.contains(deptId);
+    }
 
-            ResignDO entity = resignService.findByInstanceId(flowInstanceId);
+    private List<Long> dataLocationCheck(String deptId) {
+        List<Long> postIds = new ArrayList<>();
+        if (softDeptIds.contains(deptId)) {
+            postIds.addAll(convertStringListToLongList(Arrays.asList(softPostIds.split(","))));
+        } else if (planDeptIds.contains(deptId)) {
+            postIds.addAll(convertStringListToLongList(Arrays.asList(planPostIds.split(","))));
+        } else {
+            throw new BusinessException("部门不存在,请联系管理员");
+        }
 
-            if (type.equals(entity.getLzygszd())) {
-                return "true";
-            } else {
-                return "false";
-            }
+        return postIds;
+    }
 
 
-        } catch (Exception ex) {
-            return error(ex.getMessage(), ErrorCode.DEFAULT);
+    public static List<Long> convertStringListToLongList(List<String> stringList) {
+        List<Long> longList = new ArrayList<>();
+        for (String item : stringList) {
+            try {
+                Long.parseLong(item);
+                longList.add(Long.valueOf(item));
+            } catch (NumberFormatException e) {
+                throw new BusinessException("格式转换失败,请联系管理员");
+            }
         }
+        return longList;
     }
 
 

+ 12 - 0
zjugis-business/src/main/resources/application-dev.yaml

@@ -70,3 +70,15 @@ xxl:
 managerDeptId: ac4cc8f0-ad52-4ae9-9f88-c9a76f95e7fb
 managerPosId: 42
 
+resign:
+  data:
+    #    数据中心会审部门id
+    checkDeptIds: 5871705,70930c2e-8271-4b27-8bf1-f5ad715cc764,e788474e-3c0d-4289-82ce-3bf607089725
+    #    软件板块部门
+    softDeptIds: 5871705
+    #    规划板块部门
+    planDeptIds: 70930c2e-8271-4b27-8bf1-f5ad715cc764,e788474e-3c0d-4289-82ce-3bf607089725
+    #    软件板块岗位id
+    softPostIds: 125
+    #    规划板块部门id
+    planPostIds: 124

+ 12 - 0
zjugis-business/src/main/resources/application-prod.yaml

@@ -70,3 +70,15 @@ xxl:
 managerDeptId: ac4cc8f0-ad52-4ae9-9f88-c9a76f95e7fb
 managerPosId: 42
 
+resign:
+  data:
+    #    数据中心会审部门id
+    checkDeptIds: 5871705,70930c2e-8271-4b27-8bf1-f5ad715cc764,e788474e-3c0d-4289-82ce-3bf607089725
+    #    软件板块部门
+    softDeptIds: 5871705
+    #    规划板块部门
+    planDeptIds: 70930c2e-8271-4b27-8bf1-f5ad715cc764,e788474e-3c0d-4289-82ce-3bf607089725
+    #    软件板块岗位id
+    softPostIds: 3000022
+    #    规划板块部门id
+    planPostIds: 3000021