|
@@ -20,6 +20,8 @@ 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;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
@@ -61,6 +63,10 @@ public class CommonCostEvent extends BaseController {
|
|
|
private DeptApi deptApi;
|
|
|
@Resource
|
|
|
private DeptLeaderApi deptLeaderApi;
|
|
|
+ @Resource
|
|
|
+ private AdminUserApi adminUserApi;
|
|
|
+
|
|
|
+ private static final String subType = "01";
|
|
|
|
|
|
/**
|
|
|
* 设置流程描述
|
|
@@ -433,6 +439,70 @@ public class CommonCostEvent extends BaseController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @PostMapping("/subcontract")
|
|
|
+ public String subcontract(@ParamModel Map flowInstance, @ParamModel Map flowDirectionInstance, @ParamModel Map previousActivityInstance, @ParamModel Map previousGatewayInstance, @ParamModel Map nextActivityTemplate, @ParamModel Map nextGatewayInstance) {
|
|
|
+ try {
|
|
|
+ String flowInstanceId = flowInstance.get("id").toString();
|
|
|
+ CommonCostDO entity = commonCostService.findByInstanceId(flowInstanceId);
|
|
|
+ List<CommonCostDetailDO> detailList = commonCostDetailService.getListByCommonCostId(entity.getId());
|
|
|
+ boolean subFlag = false;
|
|
|
+ for (CommonCostDetailDO commonCostDetailDO : detailList) {
|
|
|
+ if (commonCostDetailDO.getCostType().startsWith(subType)){
|
|
|
+ subFlag = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (subFlag) {
|
|
|
+ return "true";
|
|
|
+ }
|
|
|
+ return "false";
|
|
|
+ } catch (Exception ex) {
|
|
|
+ return error(ex.getMessage(), ErrorCode.DEFAULT);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/not-subcontract")
|
|
|
+ public String notSubcontract(@ParamModel Map flowInstance, @ParamModel Map flowDirectionInstance, @ParamModel Map previousActivityInstance, @ParamModel Map previousGatewayInstance, @ParamModel Map nextActivityTemplate, @ParamModel Map nextGatewayInstance) {
|
|
|
+ try {
|
|
|
+ String flowInstanceId = flowInstance.get("id").toString();
|
|
|
+ CommonCostDO entity = commonCostService.findByInstanceId(flowInstanceId);
|
|
|
+ List<CommonCostDetailDO> detailList = commonCostDetailService.getListByCommonCostId(entity.getId());
|
|
|
+ boolean subFlag = false;
|
|
|
+ for (CommonCostDetailDO commonCostDetailDO : detailList) {
|
|
|
+ if (commonCostDetailDO.getCostType().startsWith(subType)){
|
|
|
+ subFlag = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!subFlag) {
|
|
|
+ return "true";
|
|
|
+ }
|
|
|
+ return "false";
|
|
|
+ } catch (Exception ex) {
|
|
|
+ return error(ex.getMessage(), ErrorCode.DEFAULT);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/to-dept-manager")
|
|
|
+ public String toDeptManager(String flowInstanceId) {
|
|
|
+ try {
|
|
|
+ if (StringUtils.isNotBlank(flowInstanceId)) {
|
|
|
+ CommonCostDO entity = commonCostService.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("执行事件出错,请联系管理员!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@PostMapping("/to-project-dept-manager")
|
|
|
public String toProjectDeptManager(String flowInstanceId) {
|
|
|
try {
|
|
@@ -520,4 +590,68 @@ public class CommonCostEvent extends BaseController {
|
|
|
throw new BusinessException("执行事件出错,请联系管理员!");
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ @PostMapping("/to-project-marketing-manager")
|
|
|
+ public String toProjectMarketingManager(String flowInstanceId) {
|
|
|
+ try {
|
|
|
+ if (StringUtils.isNotBlank(flowInstanceId)) {
|
|
|
+ CommonCostDO entity = commonCostService.findByInstanceId(flowInstanceId);
|
|
|
+ List<CommonCostDetailDO> detailList = commonCostDetailService.getListByCommonCostId(entity.getId());
|
|
|
+ Set<String> xsryIdList = new HashSet<>();
|
|
|
+ detailList.forEach(x->{
|
|
|
+ Project project = projectService.selectById(x.getProjectId());
|
|
|
+ xsryIdList.add(project.getXsryId());
|
|
|
+ });
|
|
|
+ List<Map<String, String>> userMaps = new ArrayList<>();
|
|
|
+ List<AdminUserRespDTO> userList = adminUserApi.getUsers(xsryIdList).getCheckedData();
|
|
|
+ Set<String> depts = convertSet(userList, AdminUserRespDTO::getDeptId);
|
|
|
+ List<DeptRespDTO> deptList = deptApi.getDeptList(depts).getCheckedData();
|
|
|
+ for (DeptRespDTO deptRespDTO : deptList) {
|
|
|
+ if(deptRespDTO != null && StringUtils.isNotBlank(deptRespDTO.getLeaderUserId())){
|
|
|
+ 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("执行事件出错,请联系管理员!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/to-project-marketing-leader")
|
|
|
+ public String toProjectMarketingLeader(String flowInstanceId) {
|
|
|
+ try {
|
|
|
+ if (StringUtils.isNotBlank(flowInstanceId)) {
|
|
|
+ CommonCostDO entity = commonCostService.findByInstanceId(flowInstanceId);
|
|
|
+ List<CommonCostDetailDO> detailList = commonCostDetailService.getListByCommonCostId(entity.getId());
|
|
|
+ Set<String> xsryIdList = new HashSet<>();
|
|
|
+ detailList.forEach(x->{
|
|
|
+ Project project = projectService.selectById(x.getProjectId());
|
|
|
+ xsryIdList.add(project.getXsryId());
|
|
|
+ });
|
|
|
+ List<Map<String, String>> userMaps = new ArrayList<>();
|
|
|
+ List<AdminUserRespDTO> userList = adminUserApi.getUsers(xsryIdList).getCheckedData();
|
|
|
+ Set<String> depts = convertSet(userList, AdminUserRespDTO::getDeptId);
|
|
|
+ for (String dept : depts) {
|
|
|
+ DeptRespDTO deptRespDTO = deptApi.getSecondDeptByDeptId(dept).getCheckedData();
|
|
|
+ if(deptRespDTO != null && StringUtils.isNotBlank(deptRespDTO.getLeaderUserId())){
|
|
|
+ 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("执行事件出错,请联系管理员!");
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|