Commit b96d549077ce9cf35f7ad4f930a85ce03351c887

Authored by 颜惠青
1 parent e31696ea

大区经理 流程 和业务线变动改造

Showing 16 changed files with 943 additions and 17 deletions
urbanops-module-api/urbanops-module-garden-api/src/main/java/com/zteits/urbanops/module/garden/dto/road/RoadReqDTO.java
@@ -7,14 +7,14 @@ import lombok.Data; @@ -7,14 +7,14 @@ import lombok.Data;
7 /** 7 /**
8 * @author yanhuiqing 8 * @author yanhuiqing
9 * @version 1.0 9 * @version 1.0
10 - * @description: TODO 10 + * @description: 通过经纬度 获取道路列表
11 * @date 2025/12/9 22:43 11 * @date 2025/12/9 22:43
12 */ 12 */
13 @Data 13 @Data
14 public class RoadReqDTO { 14 public class RoadReqDTO {
15 @NotNull 15 @NotNull
16 - @Schema(description = "系统编码", example = "sls")  
17 - private String companyCode; 16 + @Schema(description = "系统编码,业务线:对应电子围栏的companyCode", example = "yl")
  17 + private String busiLine;
18 @NotNull 18 @NotNull
19 @Schema(description = "经度", example = "44.962685") 19 @Schema(description = "经度", example = "44.962685")
20 private String longitude; 20 private String longitude;
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/api/road/RoadApiImpl.java
@@ -38,12 +38,12 @@ public class RoadApiImpl implements RoadApi { @@ -38,12 +38,12 @@ public class RoadApiImpl implements RoadApi {
38 @Override 38 @Override
39 public List<RoadRespDTO> getRoadInfoBy(RoadReqDTO reqDTO) { 39 public List<RoadRespDTO> getRoadInfoBy(RoadReqDTO reqDTO) {
40 Map<String, Object> param = new HashMap<>(); 40 Map<String, Object> param = new HashMap<>();
41 - param.put("companyCode", reqDTO.getCompanyCode()); 41 + param.put("companyCode", reqDTO.getBusiLine());
42 param.put("longitude", reqDTO.getLongitude()); 42 param.put("longitude", reqDTO.getLongitude());
43 param.put("latitude", reqDTO.getLatitude()); 43 param.put("latitude", reqDTO.getLatitude());
44 44
45 String responseBody = HttpUtils.post(roadInfoUrl, null, JSON.toJSONString(param)); 45 String responseBody = HttpUtils.post(roadInfoUrl, null, JSON.toJSONString(param));
46 - log.info("获取道路信息接口,系统:{},经度:{},维度:{},返回结果:{}", reqDTO.getCompanyCode(), reqDTO.getLongitude(), reqDTO.getLatitude(), responseBody); 46 + log.info("获取道路信息接口,系统:{},经度:{},维度:{},返回结果:{}", reqDTO.getBusiLine(), reqDTO.getLongitude(), reqDTO.getLatitude(), responseBody);
47 JSONObject response = JSONUtil.parseObj(responseBody); 47 JSONObject response = JSONUtil.parseObj(responseBody);
48 if (response.getInt("code") != 200) { 48 if (response.getInt("code") != 200) {
49 return new ArrayList<>(); 49 return new ArrayList<>();
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/api/constant/BpmCommonConstant.java
@@ -34,6 +34,11 @@ public class BpmCommonConstant { @@ -34,6 +34,11 @@ public class BpmCommonConstant {
34 public static final String BPM_UNIVERSE_WO = "universe_workorder_prod"; 34 public static final String BPM_UNIVERSE_WO = "universe_workorder_prod";
35 35
36 /** 36 /**
  37 + * 大区经理 流程业务key
  38 + */
  39 + public static final String BPM_REGION_MGR_WO = "regionmgr_workorder_prod";
  40 +
  41 + /**
37 * 全域工单 督察员 流程业务key 42 * 全域工单 督察员 流程业务key
38 */ 43 */
39 public static final String BPM_UNIVERSE_INSPECTOR_WO = "universe_inspector_prod"; 44 public static final String BPM_UNIVERSE_INSPECTOR_WO = "universe_inspector_prod";
@@ -55,6 +60,10 @@ public class BpmCommonConstant { @@ -55,6 +60,10 @@ public class BpmCommonConstant {
55 public static final String BPM_COMMON_PROD_ISREVOKE = "isRevoke"; 60 public static final String BPM_COMMON_PROD_ISREVOKE = "isRevoke";
56 61
57 public static final String BPM_COMMON_PROD_ISVERIFY = "isVerify"; 62 public static final String BPM_COMMON_PROD_ISVERIFY = "isVerify";
  63 + /**
  64 + * 是否全域的大区经理 key
  65 + */
  66 + public static final String BPM_COMMON_PROD_GLOBAL = "isGlobal";
58 67
59 68
60 //----------------------------------------工单初始化流程变量key---------------------- 69 //----------------------------------------工单初始化流程变量key----------------------
@@ -110,6 +119,11 @@ public class BpmCommonConstant { @@ -110,6 +119,11 @@ public class BpmCommonConstant {
110 * 全域工单流程前缀 119 * 全域工单流程前缀
111 */ 120 */
112 public static final String WORK_ORDER_PREFFIX_UNIVERSE = "UWO"; 121 public static final String WORK_ORDER_PREFFIX_UNIVERSE = "UWO";
  122 +
  123 + /**
  124 + * 全域大区经理工单编号前缀
  125 + */
  126 + public static final String WORK_ORDER_PREFFIX_REGION = "RWO";
113 /** 127 /**
114 * 全域督察员工单流程前缀 128 * 全域督察员工单流程前缀
115 */ 129 */
@@ -137,8 +151,22 @@ public class BpmCommonConstant { @@ -137,8 +151,22 @@ public class BpmCommonConstant {
137 * 园林巡查员 角色编码 151 * 园林巡查员 角色编码
138 */ 152 */
139 public static final String YL_INSPECTOR = "yl_inspector"; 153 public static final String YL_INSPECTOR = "yl_inspector";
  154 + /**
  155 + * 全域巡查员 角色编码
  156 + */
  157 + public static final String PARTROL_GLOBAL = "patrol_global";
  158 + /**
  159 + * 大区经理 角色编码
  160 + */
  161 + public static final String REGIONAL_MANAGER = "regional_manager";
140 162
141 /*养护级别-字典key*/ 163 /*养护级别-字典key*/
142 public static final String CONSERVE_LEVEL = "conserve_level"; 164 public static final String CONSERVE_LEVEL = "conserve_level";
  165 + //---------------------------------------------------------------------------------
  166 +
  167 + /**
  168 + * 物业班组长 角色编码
  169 + */
  170 + public static final String TEAM_LEADER_WY = "team_leader_wy";
143 171
144 } 172 }
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/controller/app/garden/AppGardenWorkOrderRegionMgrController.java 0 → 100644
  1 +package com.zteits.urbanops.module.workorder.controller.app.garden;
  2 +
  3 +import com.zteits.urbanops.framework.common.pojo.CommonResult;
  4 +import com.zteits.urbanops.framework.common.util.object.ObjectUtils;
  5 +import com.zteits.urbanops.module.garden.api.road.RoadApi;
  6 +import com.zteits.urbanops.module.workorder.annotation.AutoUpdateWorkerOrderBuzStatus;
  7 +import com.zteits.urbanops.module.workorder.controller.app.garden.vo.common.AppUniversalApprovalReqVO;
  8 +import com.zteits.urbanops.module.workorder.controller.app.garden.vo.operator.AppGardenTaskReturnExtReqVO;
  9 +import com.zteits.urbanops.module.workorder.controller.app.garden.vo.operator.AppGardenTaskTeamLeaderAssignReqVO;
  10 +import com.zteits.urbanops.module.workorder.controller.app.garden.vo.operator.AppGardenTaskWorkerExcuteReqVO;
  11 +import com.zteits.urbanops.module.workorder.controller.app.garden.vo.task.AppGardenTaskApproveReqVO;
  12 +import com.zteits.urbanops.module.workorder.dto.AppGardenWorkOrderReqVO;
  13 +import com.zteits.urbanops.module.workorder.enums.OperateTypeEnum;
  14 +import com.zteits.urbanops.module.workorder.service.garden.BpmGardenService;
  15 +import com.zteits.urbanops.module.workorder.service.garden.BpmRegionMgrService;
  16 +import com.zteits.urbanops.module.workorder.service.garden.BpmUniversalService;
  17 +import io.swagger.v3.oas.annotations.Operation;
  18 +import io.swagger.v3.oas.annotations.tags.Tag;
  19 +import jakarta.annotation.Resource;
  20 +import jakarta.validation.Valid;
  21 +import lombok.extern.slf4j.Slf4j;
  22 +import org.springframework.transaction.annotation.Transactional;
  23 +import org.springframework.web.bind.annotation.PostMapping;
  24 +import org.springframework.web.bind.annotation.RequestBody;
  25 +import org.springframework.web.bind.annotation.RequestMapping;
  26 +import org.springframework.web.bind.annotation.RestController;
  27 +
  28 +import java.util.List;
  29 +
  30 +import static com.zteits.urbanops.framework.common.exception.util.ServiceExceptionUtil.exception;
  31 +import static com.zteits.urbanops.framework.common.pojo.CommonResult.success;
  32 +import static com.zteits.urbanops.module.workorder.enums.ErrorCodeConstants.*;
  33 +
  34 +/**
  35 + * 类描述:大区经理 app工单入口
  36 + * 创建人:yanhuiqing
  37 + * 创建时间:2025/12/25 23:25
  38 + * 修改人:yanhuiqing
  39 + * 修改时间:2025/12/25 23:25
  40 + * 修改备注:
  41 + *
  42 + * @author yanhuiqing
  43 + * @version 1.0
  44 + */
  45 +@Tag(name = "APP - 大区经理工单bpm")
  46 +@RestController
  47 +@Slf4j
  48 +@RequestMapping("/bpm/regionmgr/workorder")
  49 +public class AppGardenWorkOrderRegionMgrController {
  50 +
  51 + @Resource
  52 + private BpmGardenService gardenService;
  53 +
  54 + @Resource
  55 + private BpmRegionMgrService regionMgrService;
  56 + @Resource
  57 + private RoadApi roadApi;
  58 + @PostMapping("/createQuick")
  59 + //@PreAuthorize("@ss.hasPermission('bpm:garden-workorder:create')")
  60 + @Operation(summary = "app-创建快速工单信息")
  61 + public CommonResult<Long> createMainInfoQuick(@Valid @RequestBody AppGardenWorkOrderReqVO createReqVO) {
  62 + return success(gardenService.createWorkOrderQuick(createReqVO));
  63 + }
  64 +
  65 + @PostMapping("/create")
  66 + //@PreAuthorize("@ss.hasPermission('bpm:garden-workorder:create')")
  67 + @Operation(summary = "app-大区经理创建工单信息")
  68 + public CommonResult<Long> createMainInfo(@Valid @RequestBody AppGardenWorkOrderReqVO createReqVO) {
  69 + return success(regionMgrService.createWorkOrder(createReqVO));
  70 + }
  71 +
  72 + @Operation(summary = "app-统一审批入口")
  73 + @PostMapping("/universalApproval")
  74 + @AutoUpdateWorkerOrderBuzStatus
  75 + @Transactional(rollbackFor = Exception.class)
  76 + //@PreAuthorize("@ss.hasPermission('bpm:garden-workorder:update')")
  77 + public CommonResult<Boolean> universalApproval(@Valid @RequestBody AppUniversalApprovalReqVO reqVO) {
  78 +
  79 + log.info("【园林统一审批】接收前端请求,入参:curTaskKey={}, taskId={}, operateType={}, agree={}, reason={}",
  80 + reqVO.getTaskKey(), reqVO.getTaskId(), reqVO.getOperateType(), reqVO.getAgree(), reqVO.getReason());
  81 +
  82 + OperateTypeEnum operateType = OperateTypeEnum.getByCode(reqVO.getOperateType());
  83 +
  84 + switch (operateType) {
  85 + case YL_WORKER_RETURN:// 养护员退回
  86 + log.info("当前操作:"+OperateTypeEnum.YL_WORKER_RETURN.getDesc()+"开始,操作类型:"+OperateTypeEnum.YL_WORKER_RETURN.getCode()+"-->");
  87 + AppGardenTaskReturnExtReqVO retReqVO = new AppGardenTaskReturnExtReqVO();
  88 + retReqVO.setId(reqVO.getTaskId());
  89 + retReqVO.setCurTaskKey(reqVO.getTaskKey());
  90 + retReqVO.setReason(reqVO.getReason());
  91 + retReqVO.setWorkerDataId(reqVO.getWorkerDataId());
  92 + retReqVO.setReturnImgs(reqVO.getReturnImgs());
  93 + gardenService.returnPreviousNode(retReqVO);
  94 + log.info("当前操作:"+OperateTypeEnum.YL_WORKER_RETURN.getDesc()+"<--结束");
  95 + return success(true);
  96 + case YL_WORKER_IMPLEMENT://养护员实施 需修改更新工单数据 见切面
  97 + log.info("当前操作:"+OperateTypeEnum.YL_WORKER_IMPLEMENT.getDesc()+"开始,操作类型:"+OperateTypeEnum.YL_WORKER_IMPLEMENT.getCode()+"-->");
  98 + AppGardenTaskWorkerExcuteReqVO workerExcuteReqVO = new AppGardenTaskWorkerExcuteReqVO();
  99 + workerExcuteReqVO.setWorkerDataId(reqVO.getWorkerDataId());
  100 + workerExcuteReqVO.setId(reqVO.getTaskId());
  101 + workerExcuteReqVO.setCoHandlers(reqVO.getCoHandlers());
  102 + workerExcuteReqVO.setHandleResult(reqVO.getHandleResult());
  103 + workerExcuteReqVO.setProblemsImgs(reqVO.getProblemsImgs());
  104 + workerExcuteReqVO.setStartImgs(reqVO.getStartImgs());
  105 + workerExcuteReqVO.setProcessingImgs(reqVO.getProcessingImgs());
  106 + workerExcuteReqVO.setEndImgs(reqVO.getEndImgs());
  107 + workerExcuteReqVO.setPersonImgs(reqVO.getPersonImgs());
  108 + workerExcuteReqVO.setMaterialImgs(reqVO.getMaterialImgs());
  109 + gardenService.ylWorkerExcuteWOrder(workerExcuteReqVO);
  110 + log.info("当前操作:"+OperateTypeEnum.YL_WORKER_IMPLEMENT.getDesc()+"<--结束");
  111 + return success(true);
  112 + case YL_TEAM_LEADER_CONFIRM_PASS://养护组长验收通过
  113 + log.info("当前操作:"+OperateTypeEnum.YL_TEAM_LEADER_CONFIRM_PASS.getDesc()+"开始,操作类型:"+OperateTypeEnum.YL_TEAM_LEADER_CONFIRM_PASS.getCode()+"-->");
  114 + AppGardenTaskApproveReqVO approveReqVO = new AppGardenTaskApproveReqVO();
  115 + approveReqVO.setReason(reqVO.getReason());
  116 + approveReqVO.setId(reqVO.getTaskId());
  117 + gardenService.approveTask(approveReqVO);
  118 + log.info("当前操作:"+OperateTypeEnum.YL_TEAM_LEADER_CONFIRM_PASS.getDesc()+"<--结束");
  119 + return success(true);
  120 + case YL_TEAM_LEADER_CONFIRM_REJECT://养护组长验收不通过 需修改更新工单数据 见切面
  121 + log.info("当前操作:"+OperateTypeEnum.YL_TEAM_LEADER_CONFIRM_REJECT.getDesc()+"开始,操作类型:"+OperateTypeEnum.YL_TEAM_LEADER_CONFIRM_REJECT.getCode()+"-->");
  122 + AppGardenTaskReturnExtReqVO rejReqVO = new AppGardenTaskReturnExtReqVO();
  123 + rejReqVO.setId(reqVO.getTaskId());
  124 + rejReqVO.setCurTaskKey(reqVO.getTaskKey());
  125 + rejReqVO.setReason(reqVO.getReason());
  126 + rejReqVO.setWorkerDataId(reqVO.getWorkerDataId());
  127 + List<String> returnImgs = reqVO.getReturnImgs();
  128 + rejReqVO.setReturnImgs(returnImgs);
  129 + gardenService.returnPreviousNode(rejReqVO);
  130 + log.info("当前操作:"+OperateTypeEnum.YL_TEAM_LEADER_CONFIRM_REJECT.getDesc()+"<--结束");
  131 + return success(true);
  132 + case YL_TEAM_LEADER_ASSIGN: //养护组长分配 需修改更新工单数据 见切面
  133 + log.info("当前操作:"+OperateTypeEnum.YL_TEAM_LEADER_ASSIGN.getDesc()+"开始,操作类型:"+OperateTypeEnum.YL_TEAM_LEADER_ASSIGN.getCode()+"-->");
  134 + AppGardenTaskTeamLeaderAssignReqVO assignReqVO = new AppGardenTaskTeamLeaderAssignReqVO();
  135 + assignReqVO.setId(reqVO.getTaskId());
  136 + assignReqVO.setReason(reqVO.getReason());
  137 + Long userId = reqVO.getNextAssignee();
  138 + if(!ObjectUtils.isNotAllEmpty(userId)){
  139 + throw exception(APP_WORKER_NOT_EXISTS);
  140 + }
  141 + assignReqVO.setNextAssignee(reqVO.getNextAssignee());
  142 + Integer status = reqVO.getAgree();
  143 + if (status == null || (status != 0 && status != 1)) {
  144 + throw exception(APP_AGREE_CHOOSE);
  145 + }
  146 + assignReqVO.setAgree(status);
  147 + gardenService.ylTeamLeaderAssignWOrder(assignReqVO);
  148 + log.info("当前操作:"+OperateTypeEnum.YL_TEAM_LEADER_ASSIGN.getDesc()+"<--结束");
  149 + return success(true);
  150 +
  151 + case YL_TEAM_LEADER_RETURN://养护组长退回
  152 + log.info("当前操作:"+OperateTypeEnum.YL_TEAM_LEADER_RETURN.getDesc()+"开始,操作类型:"+OperateTypeEnum.YL_TEAM_LEADER_RETURN.getCode()+"-->");
  153 + AppGardenTaskApproveReqVO returnApproveReqVO = new AppGardenTaskApproveReqVO();
  154 + Integer approveStatus = reqVO.getAgree();
  155 + if (approveStatus == null || (approveStatus != 0 && approveStatus != 1)) {
  156 + throw exception(APP_AGREE_CHOOSE);
  157 + }
  158 + returnApproveReqVO.setAgree(approveStatus);
  159 + returnApproveReqVO.setReason(reqVO.getReason());
  160 + returnApproveReqVO.setId(reqVO.getTaskId());
  161 + returnApproveReqVO.setReturnImgs(reqVO.getReturnImgs());
  162 + gardenService.approveTask(returnApproveReqVO);
  163 + log.info("当前操作:"+OperateTypeEnum.YL_TEAM_LEADER_RETURN.getDesc()+"<--结束");
  164 + return success(true);
  165 + case YL_INSPECTOR_START_FINISH : //巡查员结束工单
  166 + log.info("当前操作:养护组长结束工单(不同意)或巡查员重新发起(同意)开始,是否同意:"+reqVO.getAgree()+"-->");
  167 + AppGardenTaskApproveReqVO inspectStartReqVO = new AppGardenTaskApproveReqVO();
  168 + Integer revokeStatus = reqVO.getAgree();
  169 + if (revokeStatus == null || (revokeStatus != 0 && revokeStatus != 1)) {
  170 + throw exception(APP_AGREE_CHOOSE);
  171 + }
  172 + inspectStartReqVO.setAgree(revokeStatus);
  173 + inspectStartReqVO.setReason(reqVO.getReason());
  174 + inspectStartReqVO.setId(reqVO.getTaskId());
  175 + inspectStartReqVO.setReturnImgs(reqVO.getReturnImgs());
  176 + gardenService.approveTask(inspectStartReqVO);
  177 + log.info("当前操作:"+OperateTypeEnum.YL_INSPECTOR_START_FINISH.getDesc()+"<--结束");
  178 + return success(true);
  179 + case YL_INSPECTOR_START_RELAUNCH : //巡查员重新发起 需修改更新工单数据 见切面
  180 + log.info("当前操作:"+OperateTypeEnum.YL_INSPECTOR_START_RELAUNCH.getDesc()+"开始,操作类型:"+OperateTypeEnum.YL_INSPECTOR_START_RELAUNCH.getCode()+"-->");
  181 + AppGardenTaskApproveReqVO reStartReqVO = new AppGardenTaskApproveReqVO();
  182 + Integer reStatus = reqVO.getAgree();
  183 + if (reStatus == null || (reStatus != 0 && reStatus != 1)) {
  184 + throw exception(APP_AGREE_CHOOSE);
  185 + }
  186 + Long id = reqVO.getWorkerDataId();
  187 + if (id == null) {
  188 + throw exception(APP_WORKER_ID_NOT_EMPTY);
  189 + }
  190 + reStartReqVO.setWorkerDataId(id);
  191 + reStartReqVO.setAgree(reStatus);
  192 + reStartReqVO.setReason(reqVO.getReason());
  193 + reStartReqVO.setId(reqVO.getTaskId());
  194 + gardenService.approveTask(reStartReqVO);
  195 + log.info("当前操作:"+OperateTypeEnum.YL_INSPECTOR_START_RELAUNCH.getDesc()+"<--结束");
  196 + return success(true);
  197 + case YL_INSPECTOR_CHECK_PASS , YL_INSPECTOR_CHECK_REJECT ://巡查员验收通过,巡查员验收不通过
  198 + log.info("当前操作:巡查员验收通过 或巡查员验收不通过开始,是否同意:"+reqVO.getAgree()+"-->");
  199 + AppGardenTaskApproveReqVO inspectReqVO = new AppGardenTaskApproveReqVO();
  200 + Integer verifyStatus = reqVO.getAgree();
  201 + if (verifyStatus == null || (verifyStatus != 0 && verifyStatus != 1)) {
  202 + throw exception(APP_AGREE_CHOOSE);
  203 + }
  204 + inspectReqVO.setAgree(verifyStatus);
  205 + inspectReqVO.setReason(reqVO.getReason());
  206 + inspectReqVO.setId(reqVO.getTaskId());
  207 + inspectReqVO.setReturnImgs(reqVO.getReturnImgs());
  208 + gardenService.approveTask(inspectReqVO);
  209 + log.info("当前操作:"+OperateTypeEnum.YL_INSPECTOR_START_FINISH.getDesc()+"<--结束");
  210 + return success(true);
  211 + default:
  212 + throw exception(APP_OPERATOR_NOT_EXISTS);
  213 + }
  214 + }
  215 +
  216 +}
0 \ No newline at end of file 217 \ No newline at end of file
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/controller/app/garden/AppGardenWorkOrderUniversalController.java 0 → 100644
  1 +package com.zteits.urbanops.module.workorder.controller.app.garden;
  2 +
  3 +import com.zteits.urbanops.framework.common.pojo.CommonResult;
  4 +import com.zteits.urbanops.module.garden.api.road.RoadApi;
  5 +import com.zteits.urbanops.module.workorder.dto.AppGardenWorkOrderReqVO;
  6 +import com.zteits.urbanops.module.workorder.service.garden.BpmGardenService;
  7 +import com.zteits.urbanops.module.workorder.service.garden.BpmUniversalService;
  8 +import io.swagger.v3.oas.annotations.Operation;
  9 +import io.swagger.v3.oas.annotations.tags.Tag;
  10 +import jakarta.annotation.Resource;
  11 +import jakarta.validation.Valid;
  12 +import lombok.extern.slf4j.Slf4j;
  13 +import org.springframework.web.bind.annotation.PostMapping;
  14 +import org.springframework.web.bind.annotation.RequestBody;
  15 +import org.springframework.web.bind.annotation.RequestMapping;
  16 +import org.springframework.web.bind.annotation.RestController;
  17 +
  18 +import static com.zteits.urbanops.framework.common.pojo.CommonResult.success;
  19 +
  20 +/**
  21 + * 类描述:园林 全域工单管理入口
  22 + * 创建人:yanhuiqing
  23 + * 创建时间:2025/12/25 15:30
  24 + * 修改人:yanhuiqing
  25 + * 修改时间:2025/12/25 15:30
  26 + * 修改备注:
  27 + *
  28 + * @author yanhuiqing
  29 + * @version 1.0
  30 + */
  31 +@Tag(name = "APP - 全域工单bpm")
  32 +@RestController
  33 +@Slf4j
  34 +@RequestMapping("/bpm/universal/workorder")
  35 +public class AppGardenWorkOrderUniversalController {
  36 + @Resource
  37 + private BpmGardenService gardenService;
  38 +
  39 + @Resource
  40 + private BpmUniversalService universalService;
  41 + @Resource
  42 + private RoadApi roadApi;
  43 + @PostMapping("/createQuick")
  44 + //@PreAuthorize("@ss.hasPermission('bpm:garden-workorder:create')")
  45 + @Operation(summary = "app-创建快速工单信息")
  46 + public CommonResult<Long> createMainInfoQuick(@Valid @RequestBody AppGardenWorkOrderReqVO createReqVO) {
  47 + return success(gardenService.createWorkOrderQuick(createReqVO));
  48 + }
  49 +
  50 + @PostMapping("/create")
  51 + //@PreAuthorize("@ss.hasPermission('bpm:garden-workorder:create')")
  52 + @Operation(summary = "app-创建工单信息")
  53 + public CommonResult<Long> createMainInfo(@Valid @RequestBody AppGardenWorkOrderReqVO createReqVO) {
  54 + return success(universalService.createWorkOrder(createReqVO));
  55 + }
  56 +
  57 +}
0 \ No newline at end of file 58 \ No newline at end of file
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/controller/app/garden/vo/common/UserInfoPageReqVO.java
@@ -19,7 +19,11 @@ import lombok.Data; @@ -19,7 +19,11 @@ import lombok.Data;
19 @Schema(description = "APP - 园林app下拉养护员信息分页 Request VO") 19 @Schema(description = "APP - 园林app下拉养护员信息分页 Request VO")
20 @Data 20 @Data
21 public class UserInfoPageReqVO extends PageParam { 21 public class UserInfoPageReqVO extends PageParam {
22 - @NotNull 22 + /**
  23 + * 暂时废弃 按业务线后台 路由去取
  24 + */
  25 + //@NotNull
  26 + @Deprecated
23 @Schema(description = "养护员角色编码", example = "yl_worker") 27 @Schema(description = "养护员角色编码", example = "yl_worker")
24 private String roleCode; 28 private String roleCode;
25 @NotNull 29 @NotNull
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/enums/BusiLineTeamLeaderRoleCodeEnum.java 0 → 100644
  1 +package com.zteits.urbanops.module.workorder.enums;
  2 +
  3 +import com.fasterxml.jackson.annotation.JsonValue;
  4 +import io.swagger.v3.oas.annotations.media.Schema;
  5 +import lombok.Getter;
  6 +
  7 +import java.util.Arrays;
  8 +
  9 +/**
  10 + * 类描述:业务线对应的角色编码
  11 + * 创建人:yanhuiqing
  12 + * 创建时间:2025/12/25 16:14
  13 + * 修改人:yanhuiqing
  14 + * 修改时间:2025/12/25 16:14
  15 + * 修改备注:
  16 + *
  17 + * @author yanhuiqing
  18 + * @version 1.0
  19 + */
  20 +@Schema(description = "业务线对应班组长角色编码类型枚举")
  21 +@Getter
  22 +public enum BusiLineTeamLeaderRoleCodeEnum { // 注意:枚举类必须用enum关键字(你代码里写的是class,这是致命错误!)
  23 +
  24 + /** 物业业务线-角色编码 */
  25 + ROLECODE_WY("wy", "team_leader_wy"),
  26 + /** 市政业务线-角色编码 */
  27 + ROLECODE_SZ("sz", "team_leader_sz"),
  28 + /** 园林业务线-角色编码 */
  29 + ROLECODE_YL("yl", "team_leader_yl"); // 最后一个常量必须以分号结尾
  30 +
  31 + /** 业务线标识(序列化时返回该值) */
  32 + @JsonValue // 序列化枚举时,返回busiLine字段值(如"wy")
  33 + private final String busiLine;
  34 + /** 对应的角色编码 */
  35 + private final String roleCode;
  36 +
  37 + // 枚举构造器必须显式声明为private(规范+强制)
  38 + private BusiLineTeamLeaderRoleCodeEnum(String busiLine, String roleCode) {
  39 + this.busiLine = busiLine;
  40 + this.roleCode = roleCode;
  41 + }
  42 +
  43 + /**
  44 + * 根据业务线标识获取枚举
  45 + * @param busiLine 业务线标识(wy/sz/yl)
  46 + * @return 对应枚举
  47 + * @throws IllegalArgumentException 传入无效标识/空值时抛出
  48 + */
  49 + public static BusiLineTeamLeaderRoleCodeEnum getByCode(String busiLine) {
  50 + // 先判空,避免后续equals空指针,且明确错误提示
  51 + if (busiLine == null || busiLine.trim().isEmpty()) {
  52 + throw new IllegalArgumentException("业务线标识不能为空");
  53 + }
  54 + return Arrays.stream(values())
  55 + .filter(e -> e.getBusiLine().equals(busiLine.trim())) // 去除首尾空格,增强兼容性
  56 + .findFirst()
  57 + .orElseThrow(() -> new IllegalArgumentException("无效的业务线标识:" + busiLine));
  58 + }
  59 +
  60 +}
0 \ No newline at end of file 61 \ No newline at end of file
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/enums/BusiLineWorkerRoleCodeEnum.java 0 → 100644
  1 +package com.zteits.urbanops.module.workorder.enums;
  2 +
  3 +import com.fasterxml.jackson.annotation.JsonValue;
  4 +import io.swagger.v3.oas.annotations.media.Schema;
  5 +import lombok.Getter;
  6 +
  7 +import java.util.Arrays;
  8 +
  9 +/**
  10 + * 类描述:养护员角色编码 enum
  11 + * 创建人:yanhuiqing
  12 + * 创建时间:2025/12/26 10:09
  13 + * 修改人:yanhuiqing
  14 + * 修改时间:2025/12/26 10:09
  15 + * 修改备注:
  16 + *
  17 + * @author yanhuiqing
  18 + * @version 1.0
  19 + */
  20 +@Schema(description = "业务线对应养护员角色编码类型枚举")
  21 +@Getter
  22 +public enum BusiLineWorkerRoleCodeEnum {
  23 +
  24 + /** 物业业务线-角色编码 */
  25 + ROLECODE_WORKER_WY("wy", "wy_worker"),
  26 + /** 市政业务线-角色编码 */
  27 + ROLECODE_WORKER_SZ("sz", "sz_worker"),
  28 + /** 园林业务线-角色编码 */
  29 + ROLECODE_WORKER_YL("yl", "yl_worker"); // 最后一个常量必须以分号结尾
  30 +
  31 + /** 业务线标识(序列化时返回该值) */
  32 + @JsonValue // 序列化枚举时,返回busiLine字段值(如"wy")
  33 + private final String busiLine;
  34 + /** 对应的角色编码 */
  35 + private final String roleCode;
  36 +
  37 + // 枚举构造器必须显式声明为private(规范+强制)
  38 + private BusiLineWorkerRoleCodeEnum(String busiLine, String roleCode) {
  39 + this.busiLine = busiLine;
  40 + this.roleCode = roleCode;
  41 + }
  42 +
  43 + /**
  44 + * 根据业务线标识获取枚举
  45 + * @param busiLine 业务线标识(wy/sz/yl)
  46 + * @return 对应枚举
  47 + * @throws IllegalArgumentException 传入无效标识/空值时抛出
  48 + */
  49 + public static BusiLineWorkerRoleCodeEnum getByCode(String busiLine) {
  50 + // 先判空,避免后续equals空指针,且明确错误提示
  51 + if (busiLine == null || busiLine.trim().isEmpty()) {
  52 + throw new IllegalArgumentException("业务线标识不能为空");
  53 + }
  54 + return Arrays.stream(values())
  55 + .filter(e -> e.getBusiLine().equals(busiLine.trim())) // 去除首尾空格,增强兼容性
  56 + .findFirst()
  57 + .orElseThrow(() -> new IllegalArgumentException("无效的业务线标识:" + busiLine));
  58 + }
  59 +}
0 \ No newline at end of file 60 \ No newline at end of file
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/enums/ErrorCodeConstants.java
@@ -34,4 +34,8 @@ public interface ErrorCodeConstants { @@ -34,4 +34,8 @@ public interface ErrorCodeConstants {
34 ErrorCode APP_WORK_ORADER_ERROR = new ErrorCode(1-900-002-002, "工单类型错误,快速工单无法走此流程 !"); 34 ErrorCode APP_WORK_ORADER_ERROR = new ErrorCode(1-900-002-002, "工单类型错误,快速工单无法走此流程 !");
35 35
36 ErrorCode APP_WORK_ORADER_NO_NOT_EXISTS = new ErrorCode(1-900-002-003, "工单编号不能为空!"); 36 ErrorCode APP_WORK_ORADER_NO_NOT_EXISTS = new ErrorCode(1-900-002-003, "工单编号不能为空!");
  37 +
  38 + ErrorCode APP_WORK_ORADER_ROLE_ILLEGLE = new ErrorCode(1-900-002-004, "该登录人即是 大区经理 角色,又是 全域督察员,无法处理流程!");
  39 +
  40 + ErrorCode APP_WORK_ORADER_ROLE_NOT_EXSITS = new ErrorCode(1-900-002-005, "该登录人即不是 大区经理 角色,又不是 全域督察员,无法处理流程!");
37 } 41 }
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/enums/TaskNodeEnum.java
@@ -18,12 +18,12 @@ import java.util.concurrent.ConcurrentHashMap; @@ -18,12 +18,12 @@ import java.util.concurrent.ConcurrentHashMap;
18 18
19 public enum TaskNodeEnum { 19 public enum TaskNodeEnum {
20 // 按业务顺序定义枚举常量:顺序值、节点名称 20 // 按业务顺序定义枚举常量:顺序值、节点名称
21 - YL_INSPECTOR_START(1, "ylInspectorStart"),  
22 - YL_TEAM_LEADER(2, "ylTeamLeader"), 21 + /*YL_INSPECTOR_START(1, "ylInspectorStart"),*/
  22 + /*YL_TEAM_LEADER(2, "ylTeamLeader"),*/
23 YL_WORKER(3, "ylWorker"), 23 YL_WORKER(3, "ylWorker"),
24 YL_TEAM_LEADER_CONFIRM(4, "ylTeamLeaderConfirm"), 24 YL_TEAM_LEADER_CONFIRM(4, "ylTeamLeaderConfirm"),
25 - YL_INSPECTOR(5, "ylInspector"),  
26 - YL_INSPECTOR_END(6, "ylInspectorEnd"); 25 + YL_INSPECTOR(5, "ylInspector")/*,
  26 + YL_INSPECTOR_END(6, "ylInspectorEnd")*/;
27 27
28 // 节点顺序(用于计算上一个节点) 28 // 节点顺序(用于计算上一个节点)
29 private final int order; 29 private final int order;
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/service/garden/BpmGardenServiceImpl.java
@@ -50,6 +50,8 @@ import com.zteits.urbanops.module.workorder.dal.mysql.maininfo.MainInfoExtMapper @@ -50,6 +50,8 @@ import com.zteits.urbanops.module.workorder.dal.mysql.maininfo.MainInfoExtMapper
50 import com.zteits.urbanops.module.workorder.dal.mysql.maininfo.MainInfoMapper; 50 import com.zteits.urbanops.module.workorder.dal.mysql.maininfo.MainInfoMapper;
51 import com.zteits.urbanops.module.workorder.dto.AppGardenWorkOrderReqVO; 51 import com.zteits.urbanops.module.workorder.dto.AppGardenWorkOrderReqVO;
52 import com.zteits.urbanops.module.workorder.dto.AppGardenWorkOrderRespVO; 52 import com.zteits.urbanops.module.workorder.dto.AppGardenWorkOrderRespVO;
  53 +import com.zteits.urbanops.module.workorder.enums.BusiLineTeamLeaderRoleCodeEnum;
  54 +import com.zteits.urbanops.module.workorder.enums.BusiLineWorkerRoleCodeEnum;
53 import com.zteits.urbanops.module.workorder.util.TaskNodeUtils; 55 import com.zteits.urbanops.module.workorder.util.TaskNodeUtils;
54 import jakarta.annotation.Resource; 56 import jakarta.annotation.Resource;
55 import jodd.util.StringUtil; 57 import jodd.util.StringUtil;
@@ -592,12 +594,11 @@ public class BpmGardenServiceImpl implements BpmGardenService{ @@ -592,12 +594,11 @@ public class BpmGardenServiceImpl implements BpmGardenService{
592 } 594 }
593 workOrder.setWoSourceId(roleList.get(0).getCode()); 595 workOrder.setWoSourceId(roleList.get(0).getCode());
594 workOrder.setWoSourceName(roleList.get(0).getName()); 596 workOrder.setWoSourceName(roleList.get(0).getName());
595 -  
596 - if(StringUtil.isNotEmpty(createRequestVo.getBusiLine())){  
597 - workOrder.setBusiLine(createRequestVo.getBusiLine());  
598 - }else {  
599 - workOrder.setBusiLine(SecurityFrameworkUtils.getBusiLine()); 597 + String busiLine = createRequestVo.getBusiLine();
  598 + if(StringUtil.isEmpty(busiLine)){
  599 + busiLine = SecurityFrameworkUtils.getBusiLine();
600 } 600 }
  601 + workOrder.setBusiLine(busiLine);
601 workOrder.setUserId(SecurityFrameworkUtils.getLoginUserId()); 602 workOrder.setUserId(SecurityFrameworkUtils.getLoginUserId());
602 workOrder.setUserName(SecurityFrameworkUtils.getLoginUserNickname()); 603 workOrder.setUserName(SecurityFrameworkUtils.getLoginUserNickname());
603 if(ObjectUtils.isNotAllEmpty(createRequestVo.getExpectedFinishDate())){ 604 if(ObjectUtils.isNotAllEmpty(createRequestVo.getExpectedFinishDate())){
@@ -616,7 +617,11 @@ public class BpmGardenServiceImpl implements BpmGardenService{ @@ -616,7 +617,11 @@ public class BpmGardenServiceImpl implements BpmGardenService{
616 processInstanceVariables.put(BPM_COMMON_PROD_APPLYUSERID, userId); 617 processInstanceVariables.put(BPM_COMMON_PROD_APPLYUSERID, userId);
617 processInstanceVariables.put(BPM_COMMON_PROD_ISNEED,null); 618 processInstanceVariables.put(BPM_COMMON_PROD_ISNEED,null);
618 Map<String, List<Long>> startUserSelectAssignees = new HashMap<>(); 619 Map<String, List<Long>> startUserSelectAssignees = new HashMap<>();
619 - List<AdminUserRespDTO> userList = workOrderExtMapper.getUserByRoadIdAndRoleCode(workOrder.getRoadId(),BpmCommonConstant.TEAM_LEADER_YL,createRequestVo.getBusiLine()); 620 + String roleCode = BusiLineTeamLeaderRoleCodeEnum.getByCode(busiLine).getRoleCode();
  621 + if(StringUtil.isEmpty(roleCode)){// 找不到 默认为园林组长的角色
  622 + roleCode = BpmCommonConstant.TEAM_LEADER_YL;
  623 + }
  624 + List<AdminUserRespDTO> userList = workOrderExtMapper.getUserByRoadIdAndRoleCode(workOrder.getRoadId(),roleCode,createRequestVo.getBusiLine());
620 if(org.springframework.util.ObjectUtils.isEmpty(userList)){ 625 if(org.springframework.util.ObjectUtils.isEmpty(userList)){
621 throw exception(TEAM_LEADER_YL_NOT_EXISTS); 626 throw exception(TEAM_LEADER_YL_NOT_EXISTS);
622 } 627 }
@@ -726,9 +731,15 @@ public class BpmGardenServiceImpl implements BpmGardenService{ @@ -726,9 +731,15 @@ public class BpmGardenServiceImpl implements BpmGardenService{
726 731
727 @Override 732 @Override
728 public PageResult<AdminUserRespDTO> getUserByLoginIdAndRoleCode(PageParam param, Long loginUserId, String roleCode, String busiLine, boolean notHas) { 733 public PageResult<AdminUserRespDTO> getUserByLoginIdAndRoleCode(PageParam param, Long loginUserId, String roleCode, String busiLine, boolean notHas) {
729 - if(org.springframework.util.ObjectUtils.isEmpty(loginUserId) || org.springframework.util.ObjectUtils.isEmpty(roleCode) || org.springframework.util.ObjectUtils.isEmpty(busiLine)){ 734 + if(org.springframework.util.ObjectUtils.isEmpty(loginUserId) ||
  735 + //org.springframework.util.ObjectUtils.isEmpty(roleCode) ||
  736 + org.springframework.util.ObjectUtils.isEmpty(busiLine)){
730 throw exception0(BAD_REQUEST.getCode(),"param:loginUserId,roleCode,busiLine 不能为空!"); 737 throw exception0(BAD_REQUEST.getCode(),"param:loginUserId,roleCode,busiLine 不能为空!");
731 } 738 }
  739 + /**
  740 + * 根据业务线获取养护员角色
  741 + */
  742 + roleCode = BusiLineWorkerRoleCodeEnum.getByCode(busiLine).getRoleCode();
732 return workOrderExtMapper.getUserByLoginIdAndRoleCodePage(param,loginUserId,roleCode,busiLine,notHas); 743 return workOrderExtMapper.getUserByLoginIdAndRoleCodePage(param,loginUserId,roleCode,busiLine,notHas);
733 } 744 }
734 745
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/service/garden/BpmRegionMgrService.java 0 → 100644
  1 +package com.zteits.urbanops.module.workorder.service.garden;
  2 +
  3 +import com.zteits.urbanops.module.workorder.dto.AppGardenWorkOrderReqVO;
  4 +import jakarta.validation.Valid;
  5 +
  6 +/**
  7 + * 类描述:大区经理工单service
  8 + * 创建人:yanhuiqing
  9 + * 创建时间:2025/12/25 23:27
  10 + * 修改人:yanhuiqing
  11 + * 修改时间:2025/12/25 23:27
  12 + * 修改备注:
  13 + *
  14 + * @author yanhuiqing
  15 + * @version 1.0
  16 + */
  17 +public interface BpmRegionMgrService {
  18 +
  19 + /**
  20 + * 全域工单申请 app service 接口
  21 + * @param createRequestVo
  22 + * @return
  23 + */
  24 + Long createWorkOrder(@Valid AppGardenWorkOrderReqVO createRequestVo);
  25 +
  26 +}
0 \ No newline at end of file 27 \ No newline at end of file
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/service/garden/BpmRegionMgrServiceImpl.java 0 → 100644
  1 +package com.zteits.urbanops.module.workorder.service.garden;
  2 +
  3 +import com.zteits.urbanops.framework.common.biz.system.dict.DictDataCommonApi;
  4 +import com.zteits.urbanops.framework.common.biz.system.dict.dto.DictDataRespDTO;
  5 +import com.zteits.urbanops.framework.common.util.object.BeanUtils;
  6 +import com.zteits.urbanops.framework.common.util.object.ObjectUtils;
  7 +import com.zteits.urbanops.framework.security.core.util.SecurityFrameworkUtils;
  8 +import com.zteits.urbanops.module.bpm.api.task.BpmProcessInstanceApi;
  9 +import com.zteits.urbanops.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO;
  10 +import com.zteits.urbanops.module.bpm.enums.task.BpmTaskStatusEnum;
  11 +import com.zteits.urbanops.module.bpm.service.definition.BpmProcessDefinitionService;
  12 +import com.zteits.urbanops.module.bpm.service.task.BpmProcessInstanceService;
  13 +import com.zteits.urbanops.module.bpm.service.task.BpmTaskService;
  14 +import com.zteits.urbanops.module.garden.api.road.RoadApi;
  15 +import com.zteits.urbanops.module.garden.dto.road.RoadStreetRespDTO;
  16 +import com.zteits.urbanops.module.system.api.permission.RoleApi;
  17 +import com.zteits.urbanops.module.system.api.user.AdminUserApi;
  18 +import com.zteits.urbanops.module.system.api.user.dto.AdminUserRespDTO;
  19 +import com.zteits.urbanops.module.system.controller.admin.permission.vo.role.RoleRespVO;
  20 +import com.zteits.urbanops.module.workorder.api.WorkOrderApi;
  21 +import com.zteits.urbanops.module.workorder.api.constant.BpmCommonConstant;
  22 +import com.zteits.urbanops.module.workorder.dal.dataobject.maininfo.MainInfoDO;
  23 +import com.zteits.urbanops.module.workorder.dal.mysql.attachment.AttachmentMapper;
  24 +import com.zteits.urbanops.module.workorder.dal.mysql.maininfo.MainInfoExtMapper;
  25 +import com.zteits.urbanops.module.workorder.dal.mysql.maininfo.MainInfoMapper;
  26 +import com.zteits.urbanops.module.workorder.dto.AppGardenWorkOrderReqVO;
  27 +import com.zteits.urbanops.module.workorder.enums.BusiLineTeamLeaderRoleCodeEnum;
  28 +import jakarta.annotation.Resource;
  29 +import jodd.util.StringUtil;
  30 +import org.flowable.engine.RuntimeService;
  31 +import org.springframework.stereotype.Service;
  32 +import org.springframework.transaction.annotation.Transactional;
  33 +import org.springframework.validation.annotation.Validated;
  34 +
  35 +import java.time.LocalDateTime;
  36 +import java.util.HashMap;
  37 +import java.util.List;
  38 +import java.util.Map;
  39 +import java.util.stream.Collectors;
  40 +
  41 +import static com.zteits.urbanops.framework.common.exception.util.ServiceExceptionUtil.exception;
  42 +import static com.zteits.urbanops.module.workorder.api.constant.BpmCommonConstant.*;
  43 +import static com.zteits.urbanops.module.workorder.api.constant.BpmCommonConstant.BPM_COMMON_PROD_LEADERID;
  44 +import static com.zteits.urbanops.module.workorder.enums.ErrorCodeConstants.*;
  45 +import static com.zteits.urbanops.module.workorder.enums.ErrorCodeConstants.TEAM_LEADER_YL_NOT_EXISTS;
  46 +
  47 +/**
  48 + * 类描述:大区经理工单入口 service实现类
  49 + * 创建人:yanhuiqing
  50 + * 创建时间:2025/12/25 23:28
  51 + * 修改人:yanhuiqing
  52 + * 修改时间:2025/12/25 23:28
  53 + * 修改备注:
  54 + *
  55 + * @author yanhuiqing
  56 + * @version 1.0
  57 + */
  58 +@Service
  59 +@Validated
  60 +public class BpmRegionMgrServiceImpl implements BpmRegionMgrService{
  61 + @Resource
  62 + private AttachmentMapper attachmentMapper;
  63 + @Resource
  64 + private MainInfoMapper workOrderMapper;
  65 +
  66 + @Resource
  67 + private MainInfoExtMapper workOrderExtMapper;
  68 + @Resource
  69 + private BpmProcessInstanceApi processInstanceApi;
  70 + @Resource
  71 + private WorkOrderApi workOrderApi;
  72 +
  73 + @Resource
  74 + private RoadApi roadApi;
  75 +
  76 + @Resource
  77 + private BpmTaskService taskService;
  78 +
  79 + @Resource
  80 + private BpmProcessDefinitionService processDefinitionService;
  81 +
  82 + @Resource
  83 + private AdminUserApi adminUserApi;
  84 +
  85 + @Resource
  86 + private RoleApi roleApi;
  87 +
  88 + @Resource
  89 + private BpmGardenService bpmGardenService;
  90 +
  91 + @Resource
  92 + private BpmProcessInstanceService processInstanceService;
  93 +
  94 + @Resource
  95 + private RuntimeService runtimeService;
  96 +
  97 + @Resource
  98 + private DictDataCommonApi dictDataCommonApi;
  99 + @Override
  100 + @Transactional(rollbackFor = Exception.class)
  101 + public Long createWorkOrder(AppGardenWorkOrderReqVO createRequestVo) {
  102 + List<String> problemsImgsList = createRequestVo.getProblemsImgs();
  103 +
  104 + MainInfoDO workOrder = BeanUtils.toBean(createRequestVo, MainInfoDO.class)
  105 + .setStatus(BpmTaskStatusEnum.RUNNING.getStatus());
  106 + RoadStreetRespDTO roadStreetRespDTO = roadApi.getRoadInfoById(createRequestVo.getRoadId());
  107 +
  108 + workOrder.setStreetId(roadStreetRespDTO.getStreetId());
  109 + workOrder.setStreetName(roadStreetRespDTO.getStreetName());
  110 + workOrder.setBuzStatus(ORDER_STATUS_INIT);//工单业务初始化状态 后续操作状态 见 OperateTypeEnum
  111 + if(StringUtil.isEmpty(createRequestVo.getOrderType())){
  112 + workOrder.setOrderType(BpmCommonConstant.ORDER_TYPE_C);
  113 + }else{
  114 + if(createRequestVo.getOrderType().equals(BpmCommonConstant.ORDER_TYPE_Q)){
  115 + throw exception(APP_WORK_ORADER_ERROR);
  116 + }
  117 + workOrder.setOrderType(createRequestVo.getOrderType());
  118 + }
  119 + DictDataRespDTO dictData = dictDataCommonApi.getDictData(CONSERVE_LEVEL, roadStreetRespDTO.getLevelId().toString());
  120 + if(null == dictData){
  121 + throw exception(APP_WORKER_LEVEL_ID_NOT_EXISTS);
  122 + }
  123 + workOrder.setCuringLevelId(Integer.valueOf(dictData.getValue()));
  124 + workOrder.setCuringLevelName(dictData.getLabel());
  125 + workOrder.setCommitDate(LocalDateTime.now());
  126 + workOrder.setCompanyId(SecurityFrameworkUtils.getCompanyId());
  127 +
  128 + workOrder.setDeptId(SecurityFrameworkUtils.getDeptId());
  129 + List<RoleRespVO> roleList = roleApi.getRoleListByUsrId(SecurityFrameworkUtils.getLoginUserId());
  130 + if(null == roleList || roleList.size()==0){
  131 + throw exception(APP_USER_ROLE_NOT_EXISTS);
  132 + }
  133 + workOrder.setWoSourceId(roleList.get(0).getCode());
  134 + workOrder.setWoSourceName(roleList.get(0).getName());
  135 + String busiLine = createRequestVo.getBusiLine();
  136 + if(StringUtil.isEmpty(busiLine)){
  137 + busiLine = SecurityFrameworkUtils.getBusiLine();
  138 + }
  139 + workOrder.setBusiLine(busiLine);
  140 + workOrder.setUserId(SecurityFrameworkUtils.getLoginUserId());
  141 + workOrder.setUserName(SecurityFrameworkUtils.getLoginUserNickname());
  142 + if(ObjectUtils.isNotAllEmpty(createRequestVo.getExpectedFinishDate())){
  143 + workOrder.setExpectedFinishDate(createRequestVo.getExpectedFinishDate());
  144 + }
  145 + String workOrderNum = workOrderApi.generateWONum(BpmCommonConstant.WORK_ORDER_PREFFIX_REGION);
  146 + workOrder.setOrderNo(workOrderNum);
  147 + workOrderMapper.insert(workOrder);
  148 + if(ObjectUtils.isNotAllEmpty(problemsImgsList) && problemsImgsList.size()>0){
  149 + bpmGardenService.attachmentInsertOrUpdate(problemsImgsList,BpmCommonConstant.PROBLEM_IMG_GROUP,workOrder);
  150 + }
  151 + // 发起 BPM 流程
  152 + Long userId = SecurityFrameworkUtils.getLoginUserId();
  153 + Map<String, Object> processInstanceVariables = new HashMap<>();
  154 + processInstanceVariables.put(BPM_COMMON_PROD_ROADID, workOrder.getRoadId());
  155 + processInstanceVariables.put(BPM_COMMON_PROD_APPLYUSERID, userId);
  156 + processInstanceVariables.put(BPM_COMMON_PROD_ISNEED,null);
  157 + Map<String, List<Long>> startUserSelectAssignees = new HashMap<>();
  158 + String roleCode = BusiLineTeamLeaderRoleCodeEnum.getByCode(busiLine).getRoleCode();
  159 + if(StringUtil.isEmpty(roleCode)){// 找不到 默认为园林组长的角色
  160 + roleCode = BpmCommonConstant.TEAM_LEADER_YL;
  161 + }
  162 + List<AdminUserRespDTO> userList = workOrderExtMapper.getUserByRoadIdAndRoleCode(workOrder.getRoadId(),roleCode,createRequestVo.getBusiLine());
  163 + if(org.springframework.util.ObjectUtils.isEmpty(userList)){
  164 + throw exception(TEAM_LEADER_YL_NOT_EXISTS);
  165 + }
  166 + // 提取id到List<Long>
  167 + List<Long> idList = userList.stream()
  168 + // 映射:将AdminUserRespDTO对象转为其id属性
  169 + .map(AdminUserRespDTO::getId)
  170 + // 收集结果到List
  171 + .collect(Collectors.toList());
  172 + processInstanceVariables.put(BPM_COMMON_PROD_LEADERID, idList.get(0));
  173 + String processInstanceId = processInstanceApi.createProcessInstance(userId,
  174 + // new BpmProcessInstanceCreateReqDTO().setProcessDefinitionKey(BpmCommonConstant.BPM_GARDEN_INSPECT_WO)
  175 + new BpmProcessInstanceCreateReqDTO().setProcessDefinitionKey(BpmCommonConstant.BPM_REGION_MGR_WO)
  176 + .setVariables(processInstanceVariables).setBusinessKey(String.valueOf(workOrder.getId()))
  177 + .setStartUserSelectAssignees(startUserSelectAssignees));
  178 +
  179 + // 将工作流的编号,更新到 工单中
  180 + workOrderMapper.updateById(new MainInfoDO().setId(workOrder.getId()).setProcessInstanceId(processInstanceId));
  181 + return workOrder.getId();
  182 + }
  183 +}
0 \ No newline at end of file 184 \ No newline at end of file
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/service/garden/BpmUniversalService.java 0 → 100644
  1 +package com.zteits.urbanops.module.workorder.service.garden;
  2 +
  3 +import com.zteits.urbanops.module.workorder.dto.AppGardenWorkOrderReqVO;
  4 +import jakarta.validation.Valid;
  5 +
  6 +/**
  7 + * 类描述:全域工单处理server
  8 + * 创建人:yanhuiqing
  9 + * 创建时间:2025/12/25 16:40
  10 + * 修改人:yanhuiqing
  11 + * 修改时间:2025/12/25 16:40
  12 + * 修改备注:
  13 + *
  14 + * @author yanhuiqing
  15 + * @version 1.0
  16 + */
  17 +public interface BpmUniversalService {
  18 +
  19 + /**
  20 + * 全域工单申请 app service 接口
  21 + * @param createRequestVo
  22 + * @return
  23 + */
  24 + Long createWorkOrder(@Valid AppGardenWorkOrderReqVO createRequestVo);
  25 +
  26 +}
0 \ No newline at end of file 27 \ No newline at end of file
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/service/garden/BpmUniversalServiceImpl.java 0 → 100644
  1 +package com.zteits.urbanops.module.workorder.service.garden;
  2 +
  3 +import com.zteits.urbanops.framework.common.biz.system.dict.DictDataCommonApi;
  4 +import com.zteits.urbanops.framework.common.biz.system.dict.dto.DictDataRespDTO;
  5 +import com.zteits.urbanops.framework.common.util.object.BeanUtils;
  6 +import com.zteits.urbanops.framework.common.util.object.ObjectUtils;
  7 +import com.zteits.urbanops.framework.security.core.util.SecurityFrameworkUtils;
  8 +import com.zteits.urbanops.module.bpm.api.task.BpmProcessInstanceApi;
  9 +import com.zteits.urbanops.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO;
  10 +import com.zteits.urbanops.module.bpm.enums.task.BpmTaskStatusEnum;
  11 +import com.zteits.urbanops.module.bpm.service.definition.BpmProcessDefinitionService;
  12 +import com.zteits.urbanops.module.bpm.service.task.BpmProcessInstanceService;
  13 +import com.zteits.urbanops.module.bpm.service.task.BpmTaskService;
  14 +import com.zteits.urbanops.module.garden.api.road.RoadApi;
  15 +import com.zteits.urbanops.module.garden.dto.road.RoadStreetRespDTO;
  16 +import com.zteits.urbanops.module.system.api.permission.RoleApi;
  17 +import com.zteits.urbanops.module.system.api.user.AdminUserApi;
  18 +import com.zteits.urbanops.module.system.api.user.dto.AdminUserRespDTO;
  19 +import com.zteits.urbanops.module.system.controller.admin.permission.vo.role.RoleRespVO;
  20 +import com.zteits.urbanops.module.workorder.api.WorkOrderApi;
  21 +import com.zteits.urbanops.module.workorder.api.constant.BpmCommonConstant;
  22 +import com.zteits.urbanops.module.workorder.dal.dataobject.maininfo.MainInfoDO;
  23 +import com.zteits.urbanops.module.workorder.dal.mysql.attachment.AttachmentMapper;
  24 +import com.zteits.urbanops.module.workorder.dal.mysql.maininfo.MainInfoExtMapper;
  25 +import com.zteits.urbanops.module.workorder.dal.mysql.maininfo.MainInfoMapper;
  26 +import com.zteits.urbanops.module.workorder.dto.AppGardenWorkOrderReqVO;
  27 +import com.zteits.urbanops.module.workorder.enums.BusiLineTeamLeaderRoleCodeEnum;
  28 +import com.zteits.urbanops.module.workorder.util.RoleListUtils;
  29 +import jakarta.annotation.Resource;
  30 +import jodd.util.StringUtil;
  31 +import org.flowable.engine.RuntimeService;
  32 +import org.springframework.stereotype.Service;
  33 +import org.springframework.validation.annotation.Validated;
  34 +
  35 +import java.time.LocalDateTime;
  36 +import java.util.HashMap;
  37 +import java.util.List;
  38 +import java.util.Map;
  39 +import java.util.stream.Collectors;
  40 +
  41 +import static com.zteits.urbanops.framework.common.exception.util.ServiceExceptionUtil.exception;
  42 +import static com.zteits.urbanops.module.workorder.api.constant.BpmCommonConstant.*;
  43 +import static com.zteits.urbanops.module.workorder.api.constant.BpmCommonConstant.BPM_COMMON_PROD_LEADERID;
  44 +import static com.zteits.urbanops.module.workorder.enums.ErrorCodeConstants.*;
  45 +import static com.zteits.urbanops.module.workorder.enums.ErrorCodeConstants.TEAM_LEADER_YL_NOT_EXISTS;
  46 +
  47 +/**
  48 + * 类描述:全域 app端工单服务实现类
  49 + * 创建人:yanhuiqing
  50 + * 创建时间:2025/12/25 16:42
  51 + * 修改人:yanhuiqing
  52 + * 修改时间:2025/12/25 16:42
  53 + * 修改备注:
  54 + *
  55 + * @author yanhuiqing
  56 + * @version 1.0
  57 + */
  58 +@Service
  59 +@Validated
  60 +public class BpmUniversalServiceImpl implements BpmUniversalService{
  61 +
  62 + @Resource
  63 + private AttachmentMapper attachmentMapper;
  64 + @Resource
  65 + private MainInfoMapper workOrderMapper;
  66 +
  67 + @Resource
  68 + private MainInfoExtMapper workOrderExtMapper;
  69 + @Resource
  70 + private BpmProcessInstanceApi processInstanceApi;
  71 + @Resource
  72 + private WorkOrderApi workOrderApi;
  73 +
  74 + @Resource
  75 + private RoadApi roadApi;
  76 +
  77 + @Resource
  78 + private BpmTaskService taskService;
  79 +
  80 + @Resource
  81 + private BpmProcessDefinitionService processDefinitionService;
  82 +
  83 + @Resource
  84 + private AdminUserApi adminUserApi;
  85 +
  86 + @Resource
  87 + private RoleApi roleApi;
  88 +
  89 + @Resource
  90 + private BpmGardenService bpmGardenService;
  91 +
  92 + @Resource
  93 + private BpmProcessInstanceService processInstanceService;
  94 +
  95 + @Resource
  96 + private RuntimeService runtimeService;
  97 +
  98 + @Resource
  99 + private DictDataCommonApi dictDataCommonApi;
  100 + @Override
  101 + public Long createWorkOrder(AppGardenWorkOrderReqVO createRequestVo) {
  102 + List<String> problemsImgsList = createRequestVo.getProblemsImgs();
  103 +
  104 + MainInfoDO workOrder = BeanUtils.toBean(createRequestVo, MainInfoDO.class)
  105 + .setStatus(BpmTaskStatusEnum.RUNNING.getStatus());
  106 + RoadStreetRespDTO roadStreetRespDTO = roadApi.getRoadInfoById(createRequestVo.getRoadId());
  107 +
  108 + workOrder.setStreetId(roadStreetRespDTO.getStreetId());
  109 + workOrder.setStreetName(roadStreetRespDTO.getStreetName());
  110 + workOrder.setBuzStatus(ORDER_STATUS_INIT);//工单业务初始化状态 后续操作状态 见 OperateTypeEnum
  111 + if(StringUtil.isEmpty(createRequestVo.getOrderType())){
  112 + workOrder.setOrderType(BpmCommonConstant.ORDER_TYPE_C);
  113 + }else{
  114 + if(createRequestVo.getOrderType().equals(BpmCommonConstant.ORDER_TYPE_Q)){
  115 + throw exception(APP_WORK_ORADER_ERROR);
  116 + }
  117 + workOrder.setOrderType(createRequestVo.getOrderType());
  118 + }
  119 + DictDataRespDTO dictData = dictDataCommonApi.getDictData(CONSERVE_LEVEL, roadStreetRespDTO.getLevelId().toString());
  120 + if(null == dictData){
  121 + throw exception(APP_WORKER_LEVEL_ID_NOT_EXISTS);
  122 + }
  123 + workOrder.setCuringLevelId(Integer.valueOf(dictData.getValue()));
  124 + workOrder.setCuringLevelName(dictData.getLabel());
  125 + workOrder.setCommitDate(LocalDateTime.now());
  126 + workOrder.setCompanyId(SecurityFrameworkUtils.getCompanyId());
  127 +
  128 + workOrder.setDeptId(SecurityFrameworkUtils.getDeptId());
  129 + List<RoleRespVO> roleList = roleApi.getRoleListByUsrId(SecurityFrameworkUtils.getLoginUserId());
  130 + if(null == roleList || roleList.size()==0){
  131 + throw exception(APP_USER_ROLE_NOT_EXISTS);
  132 + }
  133 + //校验人员不能有 双重角色
  134 + if(RoleListUtils.containsCodeOr(roleList, REGIONAL_MANAGER, PARTROL_GLOBAL)){
  135 + throw exception(APP_WORK_ORADER_ROLE_ILLEGLE);
  136 + }
  137 + if(!(RoleListUtils.containsCode(roleList,REGIONAL_MANAGER) || RoleListUtils.containsCode(roleList,PARTROL_GLOBAL))){
  138 + throw exception(APP_WORK_ORADER_ROLE_NOT_EXSITS);
  139 + }
  140 + workOrder.setWoSourceId(roleList.get(0).getCode());
  141 + workOrder.setWoSourceName(roleList.get(0).getName());
  142 + String busiLine = createRequestVo.getBusiLine();
  143 + if(StringUtil.isEmpty(busiLine)){
  144 + busiLine = SecurityFrameworkUtils.getBusiLine();
  145 + }
  146 + workOrder.setBusiLine(busiLine);
  147 + workOrder.setUserId(SecurityFrameworkUtils.getLoginUserId());
  148 + workOrder.setUserName(SecurityFrameworkUtils.getLoginUserNickname());
  149 + if(ObjectUtils.isNotAllEmpty(createRequestVo.getExpectedFinishDate())){
  150 + workOrder.setExpectedFinishDate(createRequestVo.getExpectedFinishDate());
  151 + }
  152 + String workOrderNum = workOrderApi.generateWONum(BpmCommonConstant.WORK_ORDER_PREFFIX_UNIVERSE);
  153 + workOrder.setOrderNo(workOrderNum);
  154 + workOrderMapper.insert(workOrder);
  155 + if(ObjectUtils.isNotAllEmpty(problemsImgsList) && problemsImgsList.size()>0){
  156 + bpmGardenService.attachmentInsertOrUpdate(problemsImgsList,BpmCommonConstant.PROBLEM_IMG_GROUP,workOrder);
  157 + }
  158 + // 发起 BPM 流程
  159 + Long userId = SecurityFrameworkUtils.getLoginUserId();
  160 + Map<String, Object> processInstanceVariables = new HashMap<>();
  161 +
  162 + String isGlobal = BPM_COMMON_PROD_GLOBAL;
  163 + if(RoleListUtils.containsCode(roleList, REGIONAL_MANAGER)){//大区经理
  164 + processInstanceVariables.put(isGlobal,true);
  165 + }else{//全域巡查员
  166 + processInstanceVariables.put(isGlobal,false);
  167 + }
  168 +
  169 + processInstanceVariables.put(BPM_COMMON_PROD_ROADID, workOrder.getRoadId());
  170 + processInstanceVariables.put(BPM_COMMON_PROD_APPLYUSERID, userId);
  171 + processInstanceVariables.put(BPM_COMMON_PROD_ISNEED,null);
  172 + Map<String, List<Long>> startUserSelectAssignees = new HashMap<>();
  173 + String roleCode = BusiLineTeamLeaderRoleCodeEnum.getByCode(busiLine).getRoleCode();
  174 + if(StringUtil.isEmpty(roleCode)){// 找不到 默认为园林组长的角色
  175 + roleCode = BpmCommonConstant.TEAM_LEADER_YL;
  176 + }
  177 + List<AdminUserRespDTO> userList = workOrderExtMapper.getUserByRoadIdAndRoleCode(workOrder.getRoadId(),roleCode,createRequestVo.getBusiLine());
  178 + if(org.springframework.util.ObjectUtils.isEmpty(userList)){
  179 + throw exception(TEAM_LEADER_YL_NOT_EXISTS);
  180 + }
  181 + // 提取id到List<Long>
  182 + List<Long> idList = userList.stream()
  183 + // 映射:将AdminUserRespDTO对象转为其id属性
  184 + .map(AdminUserRespDTO::getId)
  185 + // 收集结果到List
  186 + .collect(Collectors.toList());
  187 + processInstanceVariables.put(BPM_COMMON_PROD_LEADERID, idList.get(0));//养护组长分配
  188 + String processInstanceId = processInstanceApi.createProcessInstance(userId,
  189 + // new BpmProcessInstanceCreateReqDTO().setProcessDefinitionKey(BpmCommonConstant.BPM_GARDEN_INSPECT_WO)
  190 + new BpmProcessInstanceCreateReqDTO().setProcessDefinitionKey(BpmCommonConstant.BPM_UNIVERSE_WO)
  191 + .setVariables(processInstanceVariables).setBusinessKey(String.valueOf(workOrder.getId()))
  192 + .setStartUserSelectAssignees(startUserSelectAssignees));
  193 +
  194 + // 将工作流的编号,更新到 工单中
  195 + workOrderMapper.updateById(new MainInfoDO().setId(workOrder.getId()).setProcessInstanceId(processInstanceId));
  196 + return workOrder.getId();
  197 + }
  198 +}
0 \ No newline at end of file 199 \ No newline at end of file
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/util/RoleListUtils.java 0 → 100644
  1 +package com.zteits.urbanops.module.workorder.util;
  2 +
  3 +import com.zteits.urbanops.module.system.controller.admin.permission.vo.role.RoleRespVO;
  4 +
  5 +import java.util.List;
  6 +import java.util.Objects;
  7 +
  8 +/**
  9 + * 类描述:判断角色包含关系工具类
  10 + * 创建人:yanhuiqing
  11 + * 创建时间:2025/12/25 19:22
  12 + * 修改人:yanhuiqing
  13 + * 修改时间:2025/12/25 19:22
  14 + * 修改备注:
  15 + *
  16 + * @author yanhuiqing
  17 + * @version 1.0
  18 + */
  19 +public class RoleListUtils {
  20 +
  21 + /**
  22 + * 方法:判断角色列表中是否包含 code = "code" 的元素
  23 + * @param roleList 角色列表(允许为 null/空)
  24 + * @return true=包含,false=不包含/列表为空/列表为null
  25 + */
  26 + public static boolean containsCode(List<RoleRespVO> roleList, String code) {
  27 + // 1. 列表为null/空,直接返回false
  28 + if (roleList == null || roleList.isEmpty()) {
  29 + return false;
  30 + }
  31 + // 2. Stream 过滤:code不为null 且 等于"code"
  32 + return roleList.stream()
  33 + .map(RoleRespVO::getCode) // 提取code字段
  34 + .filter(Objects::nonNull) // 过滤掉code为null的元素
  35 + .anyMatch(code::equals); // 存在任意一个等于code则返回true
  36 + }
  37 +
  38 + /**
  39 + * 方法:判断角色列表中是否包含 code = "code1" 或 code = "code2" 的元素
  40 + * @param roleList 角色列表(允许为 null/空)
  41 + * @return true=包含code1或code2,false=不包含/列表为空/列表为null
  42 + */
  43 + public static boolean containsCodeOr(List<RoleRespVO> roleList,String code1,String code2) {
  44 + // 1. 列表为null/空,直接返回false
  45 + if (roleList == null || roleList.isEmpty()) {
  46 + return false;
  47 + }
  48 + // 2. Stream 过滤:code不为null 且 等于"code1"或"code2"
  49 + return roleList.stream()
  50 + .map(RoleRespVO::getCode)
  51 + .filter(Objects::nonNull)
  52 + .anyMatch(code -> code1.equals(code) || code2.equals(code));
  53 + }
  54 +}
0 \ No newline at end of file 55 \ No newline at end of file