|
@@ -1,6 +1,8 @@
|
|
|
package com.zjugis.business.flow.officialSeal.event;
|
|
|
|
|
|
|
|
|
+import com.zjugis.business.constants.OfficialSealNameConstants;
|
|
|
+import com.zjugis.business.constants.PostConstants;
|
|
|
import com.zjugis.business.converter.officialSeal.OfficialSealConvert;
|
|
|
import com.zjugis.business.flow.officialSeal.entity.OfficialSealUseDO;
|
|
|
import com.zjugis.business.flow.officialSeal.service.OfficialSealUseService;
|
|
@@ -11,8 +13,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;
|
|
@@ -27,7 +33,6 @@ import java.util.*;
|
|
|
import static com.zjugis.business.constants.FlowStatusConstants.*;
|
|
|
|
|
|
/**
|
|
|
- *
|
|
|
* @author zjq
|
|
|
* @since 2024-03-15
|
|
|
*/
|
|
@@ -44,6 +49,11 @@ public class OfficialSealUseEvent extends BaseController {
|
|
|
private WorkflowClient workflowClient;
|
|
|
@Resource
|
|
|
private RoleApi roleApi;
|
|
|
+ @Resource
|
|
|
+ private DeptApi deptApi;
|
|
|
+ @Resource
|
|
|
+ private AdminUserApi adminUserApi;
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 设置流程描述
|
|
@@ -181,5 +191,95 @@ 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("执行事件出错,请联系管理员!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 用章参与人
|
|
|
+ *
|
|
|
+ * @param flowInstanceId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping("/use-people")
|
|
|
+ public String userOfficialSealFlow1(String flowInstanceId) {
|
|
|
+ try {
|
|
|
+ if (StringUtils.isNotBlank(flowInstanceId)) {
|
|
|
+ OfficialSealUseDO entity = officialSealUseService.findByInstanceId(flowInstanceId);
|
|
|
+ List<Map<String, String>> userMaps = new ArrayList<>();
|
|
|
+ if (entity.getOfficialSealName().equals(OfficialSealNameConstants.WW) || entity.getOfficialSealName().equals(OfficialSealNameConstants.WW_JS)) {
|
|
|
+ int pId = entity.getOfficialSealName().equals(OfficialSealNameConstants.WW) ? PostConstants.OFFICIAL_SEAL_MANAGER : PostConstants.JIANGSU_OFFICIAL_SEAL_MANAGER;
|
|
|
+ Collection<Long> collection = new ArrayList<>();
|
|
|
+ collection.add(Long.valueOf(pId));
|
|
|
+ List<AdminUserRespDTO> userList = adminUserApi.getUserListByPostIds(collection).getCheckedData();
|
|
|
+ for (AdminUserRespDTO adminUserRespDTO : userList) {
|
|
|
+ HashMap<String, String> map = new HashMap<>();
|
|
|
+ map.put("id", adminUserRespDTO.getId());
|
|
|
+ userMaps.add(map);
|
|
|
+ }
|
|
|
+ return ok(userMaps);
|
|
|
+ } else {
|
|
|
+ throw new BusinessException("执行事件出错,请联系管理员!");
|
|
|
+ }
|
|
|
+
|
|
|
+ } else {
|
|
|
+ throw new BusinessException("执行事件出错,请联系管理员!");
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error(e.getMessage(), e);
|
|
|
+ throw new BusinessException("执行事件出错,请联系管理员!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
}
|