Browse Source

供应商入库事件bug修改

yewc 1 year ago
parent
commit
a314c202ec

+ 29 - 0
zjugis-business/src/main/java/com/zjugis/business/flow/supplier/event/SupplierEvent.java

@@ -15,7 +15,9 @@ 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.system.api.dept.DeptApi;
+import com.zjugis.module.system.api.dept.DeptLeaderApi;
 import com.zjugis.module.system.api.dept.PostApi;
+import com.zjugis.module.system.api.dept.dto.DeptLeaderRespDTO;
 import com.zjugis.module.system.api.dept.dto.DeptRespDTO;
 import com.zjugis.module.system.api.dept.dto.PostRespDTO;
 import com.zjugis.module.system.api.user.AdminUserApi;
@@ -55,6 +57,9 @@ public class SupplierEvent extends BaseController {
     private DeptApi deptApi;
     @Resource
     private AdminUserApi adminUserApi;
+
+    @Resource
+    private DeptLeaderApi deptLeaderApi;
     /**
      * 设置流程描述
      *
@@ -229,4 +234,28 @@ public class SupplierEvent extends BaseController {
             throw new BusinessException("执行事件出错,请联系管理员!");
         }
     }
+    @PostMapping("/to-project-dept-leader")
+    public String toProjectDeptLeader(String flowInstanceId) {
+        try {
+            if (StringUtils.isNotBlank(flowInstanceId)) {
+                SupplierDO entity = projectStatusService.findByInstanceId(flowInstanceId);
+                CommonResult<AdminUserRespDTO> result1 = adminUserApi.getUser(entity.getUserId());
+                List<Map<String, String>> userMaps = new ArrayList<>();
+                if(StringUtils.isNotBlank(result1.getData().getDeptId())){
+                    DeptLeaderRespDTO deptLeaderRespDTO = deptLeaderApi.getDeptLeaderByDeptId(result1.getData().getDeptId()).getCheckedData();
+                    if(deptLeaderRespDTO != null && StringUtils.isNotBlank(deptLeaderRespDTO.getUserId())){
+                        HashMap<String,String> map = new HashMap<>();
+                        map.put("id",deptLeaderRespDTO.getUserId());
+                        userMaps.add(map);
+                    }
+                }
+                return ok(userMaps);
+            } else {
+                throw new BusinessException("执行事件出错,请联系管理员!");
+            }
+        } catch (Exception e) {
+            log.error(e.getMessage(),e);
+            throw new BusinessException("执行事件出错,请联系管理员!");
+        }
+    }
 }