|
@@ -4,6 +4,8 @@ import cn.hutool.core.collection.CollectionUtil;
|
|
|
import com.zjugis.business.converter.contractRenew.ContractRenewConvert;
|
|
|
import com.zjugis.business.flow.contractRenew.entity.ContractRenewDO;
|
|
|
import com.zjugis.business.flow.contractRenew.service.ContractRenewService;
|
|
|
+import com.zjugis.business.flow.staff.entity.StaffDO;
|
|
|
+import com.zjugis.framework.common.pojo.CommonResult;
|
|
|
import com.zjugis.framework.common.util.date.LocalDateTimeUtils;
|
|
|
import com.zjugis.framework.workflow.exception.BusinessException;
|
|
|
import com.zjugis.framework.workflow.model.BaseController;
|
|
@@ -14,6 +16,8 @@ import com.zjugis.module.adm.api.staff.dto.StaffRecordsDTO;
|
|
|
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;
|
|
|
import com.zjugis.module.system.api.user.dto.AdminUserRespDTO;
|
|
@@ -218,11 +222,68 @@ public class ContractRenewEvent extends BaseController {
|
|
|
}
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
+ * 转到部门经理
|
|
|
+ */
|
|
|
+ @PostMapping("/to-dept-manager")
|
|
|
+ public String toDeptManager(String flowInstanceId) {
|
|
|
+ try {
|
|
|
+ if (StringUtils.isNotBlank(flowInstanceId)) {
|
|
|
+ ContractRenewDO entity = contractRenewService.findByInstanceId(flowInstanceId);
|
|
|
+ List<Map<String, String>> userMaps = new ArrayList<>();
|
|
|
+ if (StringUtils.isNotBlank(entity.getDeptId())) {
|
|
|
+ CommonResult<DeptRespDTO> result = deptApi.getDept(entity.getDeptId());
|
|
|
+ DeptRespDTO dept = result.getCheckedData();
|
|
|
+ if (dept != null && StringUtils.isNotBlank(dept.getLeaderUserId())) {
|
|
|
+ HashMap<String, String> map = new HashMap<>();
|
|
|
+ map.put("id", dept.getLeaderUserId());
|
|
|
+ userMaps.add(map);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return ok(userMaps);
|
|
|
+ } else {
|
|
|
+ throw new BusinessException("找不到流程id");
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error(e.getMessage(), e);
|
|
|
+ throw new BusinessException("执行事件出错,请联系管理员!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 转到分管领导
|
|
|
+ */
|
|
|
+ @PostMapping("/to-dept-manager-leader")
|
|
|
+ public String toDeptManagerLeader(String flowInstanceId) {
|
|
|
+ try {
|
|
|
+ if (StringUtils.isNotBlank(flowInstanceId)) {
|
|
|
+ ContractRenewDO entity = contractRenewService.findByInstanceId(flowInstanceId);
|
|
|
+ List<Map<String, String>> userMaps = new ArrayList<>();
|
|
|
+ if (StringUtils.isNotBlank(entity.getDeptId())) {
|
|
|
+ DeptLeaderRespDTO deptLeaderRespDTO = deptLeaderApi.getDeptLeaderByDeptId(entity.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("找不到流程id");
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error(e.getMessage(), e);
|
|
|
+ throw new BusinessException("执行事件出错,请联系管理员!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 根据所在地查询hr
|
|
|
*/
|
|
|
@PostMapping("/to-hr")
|
|
|
- public String toDeptManager(String flowInstanceId) {
|
|
|
+ public String toHR(String flowInstanceId) {
|
|
|
try {
|
|
|
if (StringUtils.isNotBlank(flowInstanceId)) {
|
|
|
ContractRenewDO entity = contractRenewService.findByInstanceId(flowInstanceId);
|