Преглед на файлове

用章管理部门经理和部门分管领导接口

zhangjq преди 1 година
родител
ревизия
ae89180561
променени са 1 файла, в които са добавени 60 реда и са изтрити 0 реда
  1. 60 0
      zjugis-business/src/main/java/com/zjugis/business/flow/officialSeal/event/OfficialSealUseEvent.java

+ 60 - 0
zjugis-business/src/main/java/com/zjugis/business/flow/officialSeal/event/OfficialSealUseEvent.java

@@ -11,8 +11,12 @@ 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.dto.DeptRespDTO;
 import com.zjugis.module.system.api.permission.RoleApi;
 
+import com.zjugis.module.system.api.user.AdminUserApi;
+import com.zjugis.module.system.api.user.dto.AdminUserRespDTO;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -44,6 +48,11 @@ public class OfficialSealUseEvent extends BaseController {
     private WorkflowClient workflowClient;
     @Resource
     private RoleApi roleApi;
+    @Resource
+    private DeptApi deptApi;
+    @Resource
+    private AdminUserApi adminUserApi;
+
 
     /**
      * 设置流程描述
@@ -181,5 +190,56 @@ public class OfficialSealUseEvent extends BaseController {
         }
     }
 
+    /**
+     * 部门经理
+     * @param flowInstanceId
+     * @return
+     */
+    @PostMapping("/to-dept-manager")
+    public String toDeptManager(String flowInstanceId) {
+        try {
+            if (StringUtils.isNotBlank(flowInstanceId)) {
+                OfficialSealUseDO entity = officialSealUseService.findByInstanceId(flowInstanceId);
+                DeptRespDTO deptRespDTO = deptApi.getDept(entity.getDeptId()).getCheckedData();
+                List<Map<String, String>> userMaps = new ArrayList<>();
+                HashMap<String,String> map = new HashMap<>();
+                map.put("id",deptRespDTO.getLeaderUserId());
+                userMaps.add(map);
+                return ok(userMaps);
+            } else {
+                throw new BusinessException("执行事件出错,请联系管理员!");
+            }
+        } catch (Exception e) {
+            log.error(e.getMessage(),e);
+            throw new BusinessException("执行事件出错,请联系管理员!");
+        }
+    }
+
 
+    /**
+     * 分管部门领导
+     * @param flowInstanceId
+     * @return
+     */
+    @PostMapping("/to-dept-manager-leader")
+    public String toDeptManagerLeader(String flowInstanceId) {
+        try {
+            if (StringUtils.isNotBlank(flowInstanceId)) {
+                OfficialSealUseDO entity = officialSealUseService.findByInstanceId(flowInstanceId);
+                DeptRespDTO deptRespDTO = deptApi.getDept(entity.getDeptId()).getCheckedData();
+
+                List<Map<String, String>> userMaps = new ArrayList<>();
+                AdminUserRespDTO userLeader = adminUserApi.getUserLeader(deptRespDTO.getLeaderUserId()).getCheckedData();
+                HashMap<String,String> map = new HashMap<>();
+                map.put("id",userLeader.getId());
+                userMaps.add(map);
+                return ok(userMaps);
+            } else {
+                throw new BusinessException("执行事件出错,请联系管理员!");
+            }
+        } catch (Exception e) {
+            log.error(e.getMessage(),e);
+            throw new BusinessException("执行事件出错,请联系管理员!");
+        }
+    }
 }