Commit 53ec7c1bb435fcb9dfb3536bb73a0eb097f91282
1 parent
cdb07079
AI工单 审批流程
Showing
7 changed files
with
675 additions
and
9 deletions
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/controller/app/garden/AppGardenWorkOrderAIController.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.AutoUpdateWorkerOrderInspectorBuzStatus; | ||
| 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.controller.app.garden.vo.task.AppGardenTaskInspectorApproveReqVO; | ||
| 13 | +import com.zteits.urbanops.module.workorder.controller.app.garden.vo.task.AppGardenTaskRegionMgrApproveReqVO; | ||
| 14 | +import com.zteits.urbanops.module.workorder.dto.AppGardenWorkOrderInspectorReqVO; | ||
| 15 | +import com.zteits.urbanops.module.workorder.dto.AppGardenWorkOrderReqVO; | ||
| 16 | +import com.zteits.urbanops.module.workorder.enums.AIOperateTypeEnum; | ||
| 17 | +import com.zteits.urbanops.module.workorder.service.garden.BpmAIService; | ||
| 18 | +import com.zteits.urbanops.module.workorder.service.garden.BpmGardenService; | ||
| 19 | +import com.zteits.urbanops.module.workorder.service.garden.BpmInspectorService; | ||
| 20 | +import io.swagger.v3.oas.annotations.Operation; | ||
| 21 | +import io.swagger.v3.oas.annotations.tags.Tag; | ||
| 22 | +import jakarta.annotation.Resource; | ||
| 23 | +import jakarta.validation.Valid; | ||
| 24 | +import lombok.extern.slf4j.Slf4j; | ||
| 25 | +import org.springframework.transaction.annotation.Transactional; | ||
| 26 | +import org.springframework.web.bind.annotation.PostMapping; | ||
| 27 | +import org.springframework.web.bind.annotation.RequestBody; | ||
| 28 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 29 | +import org.springframework.web.bind.annotation.RestController; | ||
| 30 | + | ||
| 31 | +import java.util.List; | ||
| 32 | + | ||
| 33 | +import static com.zteits.urbanops.framework.common.exception.util.ServiceExceptionUtil.exception; | ||
| 34 | +import static com.zteits.urbanops.framework.common.pojo.CommonResult.success; | ||
| 35 | +import static com.zteits.urbanops.module.workorder.enums.ErrorCodeConstants.*; | ||
| 36 | + | ||
| 37 | +/** | ||
| 38 | + * 类描述:园林 AI工单管理督察员入口 | ||
| 39 | + * 创建人:yanhuiqing | ||
| 40 | + * 创建时间:2025/12/25 15:30 | ||
| 41 | + * 修改人:yanhuiqing | ||
| 42 | + * 修改时间:2025/12/25 15:30 | ||
| 43 | + * 修改备注: | ||
| 44 | + * | ||
| 45 | + * @author yanhuiqing | ||
| 46 | + * @version 1.0 | ||
| 47 | + */ | ||
| 48 | +@Tag(name = "APP - 全域工单bpm") | ||
| 49 | +@RestController | ||
| 50 | +@Slf4j | ||
| 51 | +@RequestMapping("/bpm/ai/workorder") | ||
| 52 | +public class AppGardenWorkOrderAIController { | ||
| 53 | + @Resource | ||
| 54 | + private BpmGardenService gardenService; | ||
| 55 | + | ||
| 56 | + @Resource | ||
| 57 | + private BpmAIService aiService; | ||
| 58 | + @Resource | ||
| 59 | + private RoadApi roadApi; | ||
| 60 | + @PostMapping("/createQuick") | ||
| 61 | + //@PreAuthorize("@ss.hasPermission('bpm:garden-workorder:create')") | ||
| 62 | + @Operation(summary = "app-创建快速工单信息") | ||
| 63 | + public CommonResult<Long> createMainInfoQuick(@Valid @RequestBody AppGardenWorkOrderReqVO createReqVO) { | ||
| 64 | + return success(gardenService.createWorkOrderQuick(createReqVO)); | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + @PostMapping("/create") | ||
| 68 | + //@PreAuthorize("@ss.hasPermission('bpm:garden-workorder:create')") | ||
| 69 | + @Operation(summary = "app-AI工单派发人员创建工单信息") | ||
| 70 | + public CommonResult<Long> createMainInfo(@Valid @RequestBody AppGardenWorkOrderInspectorReqVO createReqVO) { | ||
| 71 | + return success(aiService.createWorkOrder(createReqVO)); | ||
| 72 | + } | ||
| 73 | + | ||
| 74 | + @Operation(summary = "app-统一审批入口") | ||
| 75 | + @PostMapping("/universalApproval") | ||
| 76 | + @AutoUpdateWorkerOrderInspectorBuzStatus | ||
| 77 | + @Transactional(rollbackFor = Exception.class) | ||
| 78 | + //@PreAuthorize("@ss.hasPermission('bpm:garden-workorder:update')") | ||
| 79 | + public CommonResult<Boolean> universalApproval(@Valid @RequestBody AppUniversalApprovalReqVO reqVO) { | ||
| 80 | + | ||
| 81 | + log.info("【全域督察员审批】接收前端请求,入参:curTaskKey={}, taskId={}, operateType={}, agree={}, reason={}", | ||
| 82 | + reqVO.getTaskKey(), reqVO.getTaskId(), reqVO.getOperateType(), reqVO.getAgree(), reqVO.getReason()); | ||
| 83 | + | ||
| 84 | + AIOperateTypeEnum operateType = AIOperateTypeEnum.getByCode(reqVO.getOperateType()); | ||
| 85 | + | ||
| 86 | + switch (operateType) { | ||
| 87 | + case AI_REGION_MANAGER_ASSIGN://大区经理分配 | ||
| 88 | + log.info("当前操作:"+AIOperateTypeEnum.AI_REGION_MANAGER_ASSIGN.getDesc()+"开始,操作类型:"+AIOperateTypeEnum.AI_REGION_MANAGER_ASSIGN.getCode()+"-->"); | ||
| 89 | + AppGardenTaskRegionMgrApproveReqVO regionPassReqVO = new AppGardenTaskRegionMgrApproveReqVO(); | ||
| 90 | + Integer passStatus = reqVO.getAgree(); | ||
| 91 | + if (passStatus == null || (passStatus != 0 && passStatus != 1)) { | ||
| 92 | + throw exception(APP_AGREE_CHOOSE); | ||
| 93 | + } | ||
| 94 | + regionPassReqVO.setBusiLine(reqVO.getBusiLine()); | ||
| 95 | + regionPassReqVO.setRoadId(reqVO.getRoadId()); | ||
| 96 | + regionPassReqVO.setAgree(passStatus); | ||
| 97 | + regionPassReqVO.setReason(reqVO.getReason()); | ||
| 98 | + regionPassReqVO.setId(reqVO.getTaskId()); | ||
| 99 | + regionPassReqVO.setReturnImgs(reqVO.getReturnImgs()); | ||
| 100 | + aiService.approveTask2TeamLeader(regionPassReqVO); | ||
| 101 | + log.info("当前操作:"+AIOperateTypeEnum.AI_REGION_MANAGER_ASSIGN.getDesc()+"<--结束"); | ||
| 102 | + return success(true); | ||
| 103 | + case AI_REGION_MANAGER_RETURN://大区经理退回 | ||
| 104 | + log.info("当前操作:"+AIOperateTypeEnum.AI_REGION_MANAGER_RETURN.getDesc()+"开始,操作类型:"+AIOperateTypeEnum.AI_REGION_MANAGER_RETURN.getCode()+"-->"); | ||
| 105 | + AppGardenTaskRegionMgrApproveReqVO regionArroveReqVO = new AppGardenTaskRegionMgrApproveReqVO(); | ||
| 106 | + Integer regionStatus = reqVO.getAgree(); | ||
| 107 | + if (regionStatus == null || (regionStatus != 0 && regionStatus != 1)) { | ||
| 108 | + throw exception(APP_AGREE_CHOOSE); | ||
| 109 | + } | ||
| 110 | + regionArroveReqVO.setAgree(regionStatus); | ||
| 111 | + regionArroveReqVO.setReason(reqVO.getReason()); | ||
| 112 | + regionArroveReqVO.setId(reqVO.getTaskId()); | ||
| 113 | + regionArroveReqVO.setReturnImgs(reqVO.getReturnImgs()); | ||
| 114 | + aiService.approveTask2TeamLeader(regionArroveReqVO); | ||
| 115 | + log.info("当前操作:"+AIOperateTypeEnum.AI_REGION_MANAGER_RETURN.getDesc()+"<--结束"); | ||
| 116 | + return success(true); | ||
| 117 | + case YL_WORKER_RETURN:// 养护员退回 | ||
| 118 | + log.info("当前操作:"+AIOperateTypeEnum.YL_WORKER_RETURN.getDesc()+"开始,操作类型:"+AIOperateTypeEnum.YL_WORKER_RETURN.getCode()+"-->"); | ||
| 119 | + AppGardenTaskReturnExtReqVO retReqVO = new AppGardenTaskReturnExtReqVO(); | ||
| 120 | + retReqVO.setId(reqVO.getTaskId()); | ||
| 121 | + retReqVO.setCurTaskKey(reqVO.getTaskKey()); | ||
| 122 | + retReqVO.setReason(reqVO.getReason()); | ||
| 123 | + retReqVO.setWorkerDataId(reqVO.getWorkerDataId()); | ||
| 124 | + retReqVO.setReturnImgs(reqVO.getReturnImgs()); | ||
| 125 | + gardenService.returnPreviousNode(retReqVO); | ||
| 126 | + log.info("当前操作:"+AIOperateTypeEnum.YL_WORKER_RETURN.getDesc()+"<--结束"); | ||
| 127 | + return success(true); | ||
| 128 | + case YL_WORKER_IMPLEMENT://养护员实施 需修改更新工单数据 见切面 | ||
| 129 | + log.info("当前操作:"+AIOperateTypeEnum.YL_WORKER_IMPLEMENT.getDesc()+"开始,操作类型:"+AIOperateTypeEnum.YL_WORKER_IMPLEMENT.getCode()+"-->"); | ||
| 130 | + AppGardenTaskWorkerExcuteReqVO workerExcuteReqVO = new AppGardenTaskWorkerExcuteReqVO(); | ||
| 131 | + workerExcuteReqVO.setWorkerDataId(reqVO.getWorkerDataId()); | ||
| 132 | + workerExcuteReqVO.setId(reqVO.getTaskId()); | ||
| 133 | + workerExcuteReqVO.setCoHandlers(reqVO.getCoHandlers()); | ||
| 134 | + workerExcuteReqVO.setHandleResult(reqVO.getHandleResult()); | ||
| 135 | + workerExcuteReqVO.setProblemsImgs(reqVO.getProblemsImgs()); | ||
| 136 | + workerExcuteReqVO.setStartImgs(reqVO.getStartImgs()); | ||
| 137 | + workerExcuteReqVO.setProcessingImgs(reqVO.getProcessingImgs()); | ||
| 138 | + workerExcuteReqVO.setEndImgs(reqVO.getEndImgs()); | ||
| 139 | + workerExcuteReqVO.setPersonImgs(reqVO.getPersonImgs()); | ||
| 140 | + workerExcuteReqVO.setMaterialImgs(reqVO.getMaterialImgs()); | ||
| 141 | + gardenService.ylWorkerExcuteWOrder(workerExcuteReqVO); | ||
| 142 | + log.info("当前操作:"+AIOperateTypeEnum.YL_WORKER_IMPLEMENT.getDesc()+"<--结束"); | ||
| 143 | + return success(true); | ||
| 144 | + case YL_TEAM_LEADER_CONFIRM_PASS://养护组长验收通过 | ||
| 145 | + log.info("当前操作:"+AIOperateTypeEnum.YL_TEAM_LEADER_CONFIRM_PASS.getDesc()+"开始,操作类型:"+AIOperateTypeEnum.YL_TEAM_LEADER_CONFIRM_PASS.getCode()+"-->"); | ||
| 146 | + AppGardenTaskApproveReqVO approveReqVO = new AppGardenTaskApproveReqVO(); | ||
| 147 | + approveReqVO.setReason(reqVO.getReason()); | ||
| 148 | + approveReqVO.setId(reqVO.getTaskId()); | ||
| 149 | + gardenService.approveTask(approveReqVO); | ||
| 150 | + log.info("当前操作:"+AIOperateTypeEnum.YL_TEAM_LEADER_CONFIRM_PASS.getDesc()+"<--结束"); | ||
| 151 | + return success(true); | ||
| 152 | + case YL_TEAM_LEADER_CONFIRM_REJECT://养护组长验收不通过 需修改更新工单数据 见切面 | ||
| 153 | + log.info("当前操作:"+AIOperateTypeEnum.YL_TEAM_LEADER_CONFIRM_REJECT.getDesc()+"开始,操作类型:"+AIOperateTypeEnum.YL_TEAM_LEADER_CONFIRM_REJECT.getCode()+"-->"); | ||
| 154 | + AppGardenTaskReturnExtReqVO rejReqVO = new AppGardenTaskReturnExtReqVO(); | ||
| 155 | + rejReqVO.setId(reqVO.getTaskId()); | ||
| 156 | + rejReqVO.setCurTaskKey(reqVO.getTaskKey()); | ||
| 157 | + rejReqVO.setReason(reqVO.getReason()); | ||
| 158 | + rejReqVO.setWorkerDataId(reqVO.getWorkerDataId()); | ||
| 159 | + List<String> returnImgs = reqVO.getReturnImgs(); | ||
| 160 | + rejReqVO.setReturnImgs(returnImgs); | ||
| 161 | + gardenService.returnPreviousNode(rejReqVO); | ||
| 162 | + log.info("当前操作:"+AIOperateTypeEnum.YL_TEAM_LEADER_CONFIRM_REJECT.getDesc()+"<--结束"); | ||
| 163 | + return success(true); | ||
| 164 | + case YL_TEAM_LEADER_ASSIGN: //养护组长分配 需修改更新工单数据 见切面 | ||
| 165 | + log.info("当前操作:"+AIOperateTypeEnum.YL_TEAM_LEADER_ASSIGN.getDesc()+"开始,操作类型:"+AIOperateTypeEnum.YL_TEAM_LEADER_ASSIGN.getCode()+"-->"); | ||
| 166 | + AppGardenTaskTeamLeaderAssignReqVO assignReqVO = new AppGardenTaskTeamLeaderAssignReqVO(); | ||
| 167 | + assignReqVO.setId(reqVO.getTaskId()); | ||
| 168 | + assignReqVO.setReason(reqVO.getReason()); | ||
| 169 | + Long userId = reqVO.getNextAssignee(); | ||
| 170 | + if(!ObjectUtils.isNotAllEmpty(userId)){ | ||
| 171 | + throw exception(APP_WORKER_NOT_EXISTS); | ||
| 172 | + } | ||
| 173 | + assignReqVO.setNextAssignee(reqVO.getNextAssignee()); | ||
| 174 | + Integer status = reqVO.getAgree(); | ||
| 175 | + if (status == null || (status != 0 && status != 1)) { | ||
| 176 | + throw exception(APP_AGREE_CHOOSE); | ||
| 177 | + } | ||
| 178 | + assignReqVO.setAgree(status); | ||
| 179 | + gardenService.ylTeamLeaderAssignWOrder(assignReqVO); | ||
| 180 | + log.info("当前操作:"+AIOperateTypeEnum.YL_TEAM_LEADER_ASSIGN.getDesc()+"<--结束"); | ||
| 181 | + return success(true); | ||
| 182 | + | ||
| 183 | + case YL_TEAM_LEADER_RETURN://养护组长退回 | ||
| 184 | + log.info("当前操作:"+AIOperateTypeEnum.YL_TEAM_LEADER_RETURN.getDesc()+"开始,操作类型:"+AIOperateTypeEnum.YL_TEAM_LEADER_RETURN.getCode()+"-->"); | ||
| 185 | + AppGardenTaskInspectorApproveReqVO returnApproveReqVO = new AppGardenTaskInspectorApproveReqVO(); | ||
| 186 | + Integer approveStatus = reqVO.getAgree(); | ||
| 187 | + if (approveStatus == null || (approveStatus != 0 && approveStatus != 1)) { | ||
| 188 | + throw exception(APP_AGREE_CHOOSE); | ||
| 189 | + } | ||
| 190 | + returnApproveReqVO.setAgree(approveStatus); | ||
| 191 | + returnApproveReqVO.setReason(reqVO.getReason()); | ||
| 192 | + returnApproveReqVO.setId(reqVO.getTaskId()); | ||
| 193 | + returnApproveReqVO.setReturnImgs(reqVO.getReturnImgs()); | ||
| 194 | + returnApproveReqVO.setRoadId(reqVO.getRoadId()); | ||
| 195 | + aiService.approveTask(returnApproveReqVO); | ||
| 196 | + log.info("当前操作:"+AIOperateTypeEnum.YL_TEAM_LEADER_RETURN.getDesc()+"<--结束"); | ||
| 197 | + return success(true); | ||
| 198 | + case YL_INSPECTOR_START_FINISH : //督察员结束工单 | ||
| 199 | + log.info("当前操作:督察员结束工单(不同意)开始,是否同意:"+reqVO.getAgree()+"-->"); | ||
| 200 | + AppGardenTaskApproveReqVO inspectStartReqVO = new AppGardenTaskApproveReqVO(); | ||
| 201 | + Integer revokeStatus = reqVO.getAgree(); | ||
| 202 | + if (revokeStatus == null || (revokeStatus != 0 && revokeStatus != 1)) { | ||
| 203 | + throw exception(APP_AGREE_CHOOSE); | ||
| 204 | + } | ||
| 205 | + inspectStartReqVO.setAgree(revokeStatus); | ||
| 206 | + inspectStartReqVO.setReason(reqVO.getReason()); | ||
| 207 | + inspectStartReqVO.setId(reqVO.getTaskId()); | ||
| 208 | + inspectStartReqVO.setReturnImgs(reqVO.getReturnImgs()); | ||
| 209 | + gardenService.approveTask(inspectStartReqVO); | ||
| 210 | + log.info("当前操作:"+AIOperateTypeEnum.YL_INSPECTOR_START_FINISH.getDesc()+"<--结束"); | ||
| 211 | + return success(true); | ||
| 212 | + case YL_INSPECTOR_START_RELAUNCH : //全域督察员重新发起 需修改更新工单数据 见切面 | ||
| 213 | + log.info("当前操作:"+AIOperateTypeEnum.YL_INSPECTOR_START_RELAUNCH.getDesc()+"开始,操作类型:"+AIOperateTypeEnum.YL_INSPECTOR_START_RELAUNCH.getCode()+"-->"); | ||
| 214 | + AppGardenTaskInspectorApproveReqVO reStartReqVO = new AppGardenTaskInspectorApproveReqVO(); | ||
| 215 | + Integer reStatus = reqVO.getAgree(); | ||
| 216 | + if (reStatus == null || (reStatus != 0 && reStatus != 1)) { | ||
| 217 | + throw exception(APP_AGREE_CHOOSE); | ||
| 218 | + } | ||
| 219 | + Long id = reqVO.getWorkerDataId(); | ||
| 220 | + if (id == null) { | ||
| 221 | + throw exception(APP_WORKER_ID_NOT_EMPTY); | ||
| 222 | + } | ||
| 223 | + reStartReqVO.setWorkerDataId(id); | ||
| 224 | + reStartReqVO.setAgree(reStatus); | ||
| 225 | + reStartReqVO.setReason(reqVO.getReason()); | ||
| 226 | + reStartReqVO.setId(reqVO.getTaskId()); | ||
| 227 | + reStartReqVO.setRoadId(reqVO.getRoadId()); | ||
| 228 | + aiService.approveTask(reStartReqVO); | ||
| 229 | + log.info("当前操作:"+AIOperateTypeEnum.YL_INSPECTOR_START_RELAUNCH.getDesc()+"<--结束"); | ||
| 230 | + return success(true); | ||
| 231 | + case YL_INSPECTOR_CHECK_PASS , YL_INSPECTOR_CHECK_REJECT ://督察员验收通过,督察员验收不通过 | ||
| 232 | + log.info("当前操作:AI工单派发人员验收通过 或AI工单派发人员验收不通过开始,是否同意:"+reqVO.getAgree()+"-->"); | ||
| 233 | + AppGardenTaskApproveReqVO inspectReqVO = new AppGardenTaskApproveReqVO(); | ||
| 234 | + Integer verifyStatus = reqVO.getAgree(); | ||
| 235 | + if (verifyStatus == null || (verifyStatus != 0 && verifyStatus != 1)) { | ||
| 236 | + throw exception(APP_AGREE_CHOOSE); | ||
| 237 | + } | ||
| 238 | + inspectReqVO.setAgree(verifyStatus); | ||
| 239 | + inspectReqVO.setReason(reqVO.getReason()); | ||
| 240 | + inspectReqVO.setId(reqVO.getTaskId()); | ||
| 241 | + inspectReqVO.setReturnImgs(reqVO.getReturnImgs()); | ||
| 242 | + gardenService.approveTask(inspectReqVO); | ||
| 243 | + log.info("当前操作:"+AIOperateTypeEnum.YL_INSPECTOR_START_FINISH.getDesc()+"<--结束"); | ||
| 244 | + return success(true); | ||
| 245 | + default: | ||
| 246 | + throw exception(APP_OPERATOR_NOT_EXISTS); | ||
| 247 | + } | ||
| 248 | + } | ||
| 249 | + | ||
| 250 | +} | ||
| 0 | \ No newline at end of file | 251 | \ No newline at end of file |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/controller/app/garden/AppGardenWorkOrderInspectorController.java
| @@ -38,7 +38,7 @@ import static com.zteits.urbanops.framework.common.pojo.CommonResult.success; | @@ -38,7 +38,7 @@ import static com.zteits.urbanops.framework.common.pojo.CommonResult.success; | ||
| 38 | import static com.zteits.urbanops.module.workorder.enums.ErrorCodeConstants.*; | 38 | import static com.zteits.urbanops.module.workorder.enums.ErrorCodeConstants.*; |
| 39 | 39 | ||
| 40 | /** | 40 | /** |
| 41 | - * 类描述:园林 全域工单管理督察员入口 | 41 | + * 类描述:园林 督察员工单管理督察员入口 |
| 42 | * 创建人:yanhuiqing | 42 | * 创建人:yanhuiqing |
| 43 | * 创建时间:2025/12/25 15:30 | 43 | * 创建时间:2025/12/25 15:30 |
| 44 | * 修改人:yanhuiqing | 44 | * 修改人:yanhuiqing |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/dal/mysql/maininfo/MainInfoExtMapper.java
| @@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; | @@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; | ||
| 6 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 6 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| 7 | import com.zteits.urbanops.framework.common.pojo.PageParam; | 7 | import com.zteits.urbanops.framework.common.pojo.PageParam; |
| 8 | import com.zteits.urbanops.framework.common.pojo.PageResult; | 8 | import com.zteits.urbanops.framework.common.pojo.PageResult; |
| 9 | +import com.zteits.urbanops.framework.datapermission.core.annotation.DataPermission; | ||
| 9 | import com.zteits.urbanops.framework.mybatis.core.mapper.BaseMapperX; | 10 | import com.zteits.urbanops.framework.mybatis.core.mapper.BaseMapperX; |
| 10 | import com.zteits.urbanops.framework.mybatis.core.util.MyBatisUtils; | 11 | import com.zteits.urbanops.framework.mybatis.core.util.MyBatisUtils; |
| 11 | import com.zteits.urbanops.module.system.api.user.dto.AdminUserRespDTO; | 12 | import com.zteits.urbanops.module.system.api.user.dto.AdminUserRespDTO; |
| @@ -150,8 +151,9 @@ public interface MainInfoExtMapper extends BaseMapperX<MainInfoDO> { | @@ -150,8 +151,9 @@ public interface MainInfoExtMapper extends BaseMapperX<MainInfoDO> { | ||
| 150 | @Result(column = "END_TIME_", property = "endTime"), | 151 | @Result(column = "END_TIME_", property = "endTime"), |
| 151 | @Result(column = "KEY_", property = "key_") | 152 | @Result(column = "KEY_", property = "key_") |
| 152 | }) | 153 | }) |
| 154 | + @DataPermission(enable = false) | ||
| 153 | IPage<MainInfoExtDO> selectDoneExtUniquePage(IPage<MainInfoExtDO> page, @Param("query") MainInfoHasTaskPageReqVO reqVO); | 155 | IPage<MainInfoExtDO> selectDoneExtUniquePage(IPage<MainInfoExtDO> page, @Param("query") MainInfoHasTaskPageReqVO reqVO); |
| 154 | - | 156 | + @DataPermission(enable = false) |
| 155 | default PageResult<MainInfoExtDO> selectWorkOrderDoneUniquePage(PageParam pageParam, @Param("query") MainInfoHasTaskPageReqVO reqVO) { | 157 | default PageResult<MainInfoExtDO> selectWorkOrderDoneUniquePage(PageParam pageParam, @Param("query") MainInfoHasTaskPageReqVO reqVO) { |
| 156 | IPage<MainInfoExtDO> mpPage = MyBatisUtils.buildPage(pageParam); | 158 | IPage<MainInfoExtDO> mpPage = MyBatisUtils.buildPage(pageParam); |
| 157 | mpPage = selectDoneExtUniquePage(mpPage, reqVO); | 159 | mpPage = selectDoneExtUniquePage(mpPage, reqVO); |
| @@ -267,8 +269,9 @@ public interface MainInfoExtMapper extends BaseMapperX<MainInfoDO> { | @@ -267,8 +269,9 @@ public interface MainInfoExtMapper extends BaseMapperX<MainInfoDO> { | ||
| 267 | @Result(column = "END_TIME_", property = "endTime"), | 269 | @Result(column = "END_TIME_", property = "endTime"), |
| 268 | @Result(column = "KEY_", property = "key_") | 270 | @Result(column = "KEY_", property = "key_") |
| 269 | }) | 271 | }) |
| 272 | + @DataPermission(enable = false) | ||
| 270 | IPage<MainInfoExtDO> selectDoneExtPage(IPage<MainInfoExtDO> page, @Param("query") MainInfoHasTaskPageReqVO reqVO); | 273 | IPage<MainInfoExtDO> selectDoneExtPage(IPage<MainInfoExtDO> page, @Param("query") MainInfoHasTaskPageReqVO reqVO); |
| 271 | - | 274 | + @DataPermission(enable = false) |
| 272 | default PageResult<MainInfoExtDO> selectWorkOrderDonePage(PageParam pageParam, @Param("query") MainInfoHasTaskPageReqVO reqVO) { | 275 | default PageResult<MainInfoExtDO> selectWorkOrderDonePage(PageParam pageParam, @Param("query") MainInfoHasTaskPageReqVO reqVO) { |
| 273 | IPage<MainInfoExtDO> mpPage = MyBatisUtils.buildPage(pageParam); | 276 | IPage<MainInfoExtDO> mpPage = MyBatisUtils.buildPage(pageParam); |
| 274 | mpPage = selectDoneExtPage(mpPage, reqVO); | 277 | mpPage = selectDoneExtPage(mpPage, reqVO); |
| @@ -378,8 +381,9 @@ public interface MainInfoExtMapper extends BaseMapperX<MainInfoDO> { | @@ -378,8 +381,9 @@ public interface MainInfoExtMapper extends BaseMapperX<MainInfoDO> { | ||
| 378 | @Result(column = "END_TIME_", property = "endTime"), | 381 | @Result(column = "END_TIME_", property = "endTime"), |
| 379 | @Result(column = "KEY_", property = "key_") | 382 | @Result(column = "KEY_", property = "key_") |
| 380 | }) | 383 | }) |
| 384 | + @DataPermission(enable = false) | ||
| 381 | IPage<MainInfoExtDO> selectTodoExtPage(IPage<MainInfoExtDO> page, @Param("query") MainInfoHasTaskPageReqVO reqVO); | 385 | IPage<MainInfoExtDO> selectTodoExtPage(IPage<MainInfoExtDO> page, @Param("query") MainInfoHasTaskPageReqVO reqVO); |
| 382 | - | 386 | + @DataPermission(enable = false) |
| 383 | default PageResult<MainInfoExtDO> selectWorkOrderTodoPage(PageParam pageParam, @Param("query") MainInfoHasTaskPageReqVO reqVO) { | 387 | default PageResult<MainInfoExtDO> selectWorkOrderTodoPage(PageParam pageParam, @Param("query") MainInfoHasTaskPageReqVO reqVO) { |
| 384 | IPage<MainInfoExtDO> mpPage = MyBatisUtils.buildPage(pageParam); | 388 | IPage<MainInfoExtDO> mpPage = MyBatisUtils.buildPage(pageParam); |
| 385 | mpPage = selectTodoExtPage(mpPage, reqVO); | 389 | mpPage = selectTodoExtPage(mpPage, reqVO); |
| @@ -499,8 +503,9 @@ public interface MainInfoExtMapper extends BaseMapperX<MainInfoDO> { | @@ -499,8 +503,9 @@ public interface MainInfoExtMapper extends BaseMapperX<MainInfoDO> { | ||
| 499 | @Result(column = "END_TIME_", property = "endTime"), | 503 | @Result(column = "END_TIME_", property = "endTime"), |
| 500 | @Result(column = "KEY_", property = "key_") | 504 | @Result(column = "KEY_", property = "key_") |
| 501 | }) | 505 | }) |
| 506 | + @DataPermission(enable = false) | ||
| 502 | IPage<MainInfoExtDO> selectMyStartUniquePage(IPage<MainInfoExtDO> page, @Param("query") MainInfoHasTaskPageReqVO reqVO); | 507 | IPage<MainInfoExtDO> selectMyStartUniquePage(IPage<MainInfoExtDO> page, @Param("query") MainInfoHasTaskPageReqVO reqVO); |
| 503 | - | 508 | + @DataPermission(enable = false) |
| 504 | default PageResult<MainInfoExtDO> selectWorkOrderUniqueMyPage(PageParam pageParam, @Param("query") MainInfoHasTaskPageReqVO reqVO) { | 509 | default PageResult<MainInfoExtDO> selectWorkOrderUniqueMyPage(PageParam pageParam, @Param("query") MainInfoHasTaskPageReqVO reqVO) { |
| 505 | IPage<MainInfoExtDO> mpPage = MyBatisUtils.buildPage(pageParam); | 510 | IPage<MainInfoExtDO> mpPage = MyBatisUtils.buildPage(pageParam); |
| 506 | mpPage = selectMyStartUniquePage(mpPage, reqVO); | 511 | mpPage = selectMyStartUniquePage(mpPage, reqVO); |
| @@ -611,8 +616,9 @@ public interface MainInfoExtMapper extends BaseMapperX<MainInfoDO> { | @@ -611,8 +616,9 @@ public interface MainInfoExtMapper extends BaseMapperX<MainInfoDO> { | ||
| 611 | @Result(column = "END_TIME_", property = "endTime"), | 616 | @Result(column = "END_TIME_", property = "endTime"), |
| 612 | @Result(column = "KEY_", property = "key_") | 617 | @Result(column = "KEY_", property = "key_") |
| 613 | }) | 618 | }) |
| 619 | + @DataPermission(enable = false) | ||
| 614 | IPage<MainInfoExtDO> selectMyStartPage(IPage<MainInfoExtDO> page, @Param("query") MainInfoHasTaskPageReqVO reqVO); | 620 | IPage<MainInfoExtDO> selectMyStartPage(IPage<MainInfoExtDO> page, @Param("query") MainInfoHasTaskPageReqVO reqVO); |
| 615 | - | 621 | + @DataPermission(enable = false) |
| 616 | default PageResult<MainInfoExtDO> selectWorkOrderMyPage(PageParam pageParam, @Param("query") MainInfoHasTaskPageReqVO reqVO) { | 622 | default PageResult<MainInfoExtDO> selectWorkOrderMyPage(PageParam pageParam, @Param("query") MainInfoHasTaskPageReqVO reqVO) { |
| 617 | IPage<MainInfoExtDO> mpPage = MyBatisUtils.buildPage(pageParam); | 623 | IPage<MainInfoExtDO> mpPage = MyBatisUtils.buildPage(pageParam); |
| 618 | mpPage = selectMyStartPage(mpPage, reqVO); | 624 | mpPage = selectMyStartPage(mpPage, reqVO); |
| @@ -627,6 +633,7 @@ public interface MainInfoExtMapper extends BaseMapperX<MainInfoDO> { | @@ -627,6 +633,7 @@ public interface MainInfoExtMapper extends BaseMapperX<MainInfoDO> { | ||
| 627 | * @param notHas | 633 | * @param notHas |
| 628 | * @return | 634 | * @return |
| 629 | */ | 635 | */ |
| 636 | + @DataPermission(enable = false) | ||
| 630 | default List<AdminUserRespDTO> getUserByLoginIdAndRoleCode( | 637 | default List<AdminUserRespDTO> getUserByLoginIdAndRoleCode( |
| 631 | @NonNull Long loginUserId, | 638 | @NonNull Long loginUserId, |
| 632 | @NonNull String roleCode, | 639 | @NonNull String roleCode, |
| @@ -670,11 +677,13 @@ public interface MainInfoExtMapper extends BaseMapperX<MainInfoDO> { | @@ -670,11 +677,13 @@ public interface MainInfoExtMapper extends BaseMapperX<MainInfoDO> { | ||
| 670 | @Result(column = "mobile", property = "mobile"), | 677 | @Result(column = "mobile", property = "mobile"), |
| 671 | @Result(column = "avatar", property = "avatar") | 678 | @Result(column = "avatar", property = "avatar") |
| 672 | }) | 679 | }) |
| 680 | + @DataPermission(enable = false) | ||
| 673 | IPage<AdminUserRespDTO> getUserByLoginIdAndRoleCodeIPage(IPage<AdminUserRespDTO> page, | 681 | IPage<AdminUserRespDTO> getUserByLoginIdAndRoleCodeIPage(IPage<AdminUserRespDTO> page, |
| 674 | @NonNull @Param("loginUserId") Long loginUserId, | 682 | @NonNull @Param("loginUserId") Long loginUserId, |
| 675 | @NonNull @Param("roleCode") String roleCode, | 683 | @NonNull @Param("roleCode") String roleCode, |
| 676 | @NonNull @Param("busiLine") String busiLines, | 684 | @NonNull @Param("busiLine") String busiLines, |
| 677 | @NonNull @Param("notHas") boolean notHas); | 685 | @NonNull @Param("notHas") boolean notHas); |
| 686 | + @DataPermission(enable = false) | ||
| 678 | default PageResult<AdminUserRespDTO> getUserByLoginIdAndRoleCodePage(PageParam pageParam,@NonNull @Param("loginUserId") Long loginUserId, | 687 | default PageResult<AdminUserRespDTO> getUserByLoginIdAndRoleCodePage(PageParam pageParam,@NonNull @Param("loginUserId") Long loginUserId, |
| 679 | @NonNull @Param("roleCode") String roleCode, | 688 | @NonNull @Param("roleCode") String roleCode, |
| 680 | @NonNull @Param("busiLine") String busiLines, | 689 | @NonNull @Param("busiLine") String busiLines, |
| @@ -715,9 +724,11 @@ public interface MainInfoExtMapper extends BaseMapperX<MainInfoDO> { | @@ -715,9 +724,11 @@ public interface MainInfoExtMapper extends BaseMapperX<MainInfoDO> { | ||
| 715 | @Result(column = "mobile", property = "mobile"), | 724 | @Result(column = "mobile", property = "mobile"), |
| 716 | @Result(column = "avatar", property = "avatar") | 725 | @Result(column = "avatar", property = "avatar") |
| 717 | }) | 726 | }) |
| 727 | + @DataPermission(enable = false) | ||
| 718 | IPage<AdminUserRespDTO> getUserByRoadIdAndRoleCodeIPage(IPage<AdminUserRespDTO> page,@NonNull @Param("roadId") Long roadId, | 728 | IPage<AdminUserRespDTO> getUserByRoadIdAndRoleCodeIPage(IPage<AdminUserRespDTO> page,@NonNull @Param("roadId") Long roadId, |
| 719 | @NonNull @Param("roleCode") String roleCode, | 729 | @NonNull @Param("roleCode") String roleCode, |
| 720 | @NonNull @Param("busiLine") String busiLine); | 730 | @NonNull @Param("busiLine") String busiLine); |
| 731 | + @DataPermission(enable = false) | ||
| 721 | default PageResult<AdminUserRespDTO> getUserByRoadIdAndRoleCodePage(PageParam pageParam,@NonNull @Param("roadId") Long roadId, | 732 | default PageResult<AdminUserRespDTO> getUserByRoadIdAndRoleCodePage(PageParam pageParam,@NonNull @Param("roadId") Long roadId, |
| 722 | @NonNull @Param("roleCode") String roleCode, | 733 | @NonNull @Param("roleCode") String roleCode, |
| 723 | @NonNull @Param("busiLine") String busiLine){ | 734 | @NonNull @Param("busiLine") String busiLine){ |
| @@ -727,7 +738,7 @@ public interface MainInfoExtMapper extends BaseMapperX<MainInfoDO> { | @@ -727,7 +738,7 @@ public interface MainInfoExtMapper extends BaseMapperX<MainInfoDO> { | ||
| 727 | 738 | ||
| 728 | } | 739 | } |
| 729 | 740 | ||
| 730 | - | 741 | + @DataPermission(enable = false) |
| 731 | default List<AdminUserRespDTO> getUserByRoadIdAndRoleCode(@NonNull @Param("roadId") Long roadId, | 742 | default List<AdminUserRespDTO> getUserByRoadIdAndRoleCode(@NonNull @Param("roadId") Long roadId, |
| 732 | @NonNull @Param("roleCode") String roleCode, | 743 | @NonNull @Param("roleCode") String roleCode, |
| 733 | @NonNull @Param("busiLine") String busiLine){ | 744 | @NonNull @Param("busiLine") String busiLine){ |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/enums/AIOperateTypeEnum.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 | + * 类描述:AI工单派发人员审批操作类型枚举 | ||
| 11 | + * 创建人:yanhuiqing | ||
| 12 | + * 创建时间:2025/12/29 9:56 | ||
| 13 | + * 修改人:yanhuiqing | ||
| 14 | + * 修改时间:2025/12/29 9:56 | ||
| 15 | + * 修改备注: | ||
| 16 | + * | ||
| 17 | + * @author yanhuiqing | ||
| 18 | + * @version 1.0 | ||
| 19 | + */ | ||
| 20 | +@Schema(description = "AI工单派发人员操作类型枚举") | ||
| 21 | +@Getter | ||
| 22 | +public enum AIOperateTypeEnum { | ||
| 23 | + AI_REGION_MANAGER_ASSIGN(40,"大区经理分配"), | ||
| 24 | + AI_REGION_MANAGER_RETURN(50,"大区经理退回"), | ||
| 25 | + YL_TEAM_LEADER_ASSIGN(110, "养护组长分配"), | ||
| 26 | + YL_TEAM_LEADER_RETURN(210, "养护组长退回"), | ||
| 27 | + YL_WORKER_IMPLEMENT(120, "养护员实施"), | ||
| 28 | + YL_WORKER_RETURN(220, "养护员退回"), | ||
| 29 | + YL_TEAM_LEADER_CONFIRM_PASS(130, "养护组长验收通过"), | ||
| 30 | + YL_TEAM_LEADER_CONFIRM_REJECT(230, "养护组长验收不通过"), | ||
| 31 | + YL_INSPECTOR_CHECK_PASS(140, "AI工单派发人员验收通过"), | ||
| 32 | + YL_INSPECTOR_CHECK_REJECT(240, "AI工单派发人员验收不通过"), | ||
| 33 | + YL_INSPECTOR_START_FINISH(200, "AI工单派发人员结束工单(不同意)"), | ||
| 34 | + YL_INSPECTOR_START_RELAUNCH(100, "AI工单派发人员重新发起(同意)"); | ||
| 35 | + | ||
| 36 | + @JsonValue // 序列化时返回code(前端接收数字) | ||
| 37 | + private final Integer code; | ||
| 38 | + private final String desc; | ||
| 39 | + | ||
| 40 | + AIOperateTypeEnum(Integer code, String desc) { | ||
| 41 | + this.code = code; | ||
| 42 | + this.desc = desc; | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + // 根据code获取枚举(业务层转换用) | ||
| 46 | + public static AIOperateTypeEnum getByCode(Integer code) { | ||
| 47 | + return Arrays.stream(values()) | ||
| 48 | + .filter(e -> e.getCode().equals(code)) | ||
| 49 | + .findFirst() | ||
| 50 | + .orElseThrow(() -> new IllegalArgumentException("无效的操作类型:" + code)); | ||
| 51 | + } | ||
| 52 | +} | ||
| 0 | \ No newline at end of file | 53 | \ No newline at end of file |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/framework/datapermission/config/OrderDataPermissionConfiguration.java
| @@ -9,7 +9,7 @@ import org.springframework.context.annotation.Configuration; | @@ -9,7 +9,7 @@ import org.springframework.context.annotation.Configuration; | ||
| 9 | * 订单模块的数据权限配置 | 9 | * 订单模块的数据权限配置 |
| 10 | * 每个模块独立配置,互不影响 | 10 | * 每个模块独立配置,互不影响 |
| 11 | */ | 11 | */ |
| 12 | -//@Configuration(proxyBeanMethods = false) | 12 | +@Configuration(proxyBeanMethods = false) |
| 13 | public class OrderDataPermissionConfiguration { | 13 | public class OrderDataPermissionConfiguration { |
| 14 | 14 | ||
| 15 | /** | 15 | /** |
| @@ -21,7 +21,7 @@ public class OrderDataPermissionConfiguration { | @@ -21,7 +21,7 @@ public class OrderDataPermissionConfiguration { | ||
| 21 | // 入参rule是全局的DeptDataPermissionRule实例,添加本模块的配置 | 21 | // 入参rule是全局的DeptDataPermissionRule实例,添加本模块的配置 |
| 22 | return rule -> { | 22 | return rule -> { |
| 23 | // 1. 工单表:MainInfoDO,部门字段默认dept_id | 23 | // 1. 工单表:MainInfoDO,部门字段默认dept_id |
| 24 | - //rule.addDeptColumn(MainInfoDO.class); // 默认映射表的dept_id字段 | 24 | + rule.addDeptColumn(MainInfoDO.class); // 默认映射表的dept_id字段 |
| 25 | }; | 25 | }; |
| 26 | } | 26 | } |
| 27 | 27 |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/service/garden/BpmAIService.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.workorder.service.garden; | ||
| 2 | + | ||
| 3 | +import com.zteits.urbanops.module.workorder.controller.app.garden.vo.task.AppGardenTaskInspectorApproveReqVO; | ||
| 4 | +import com.zteits.urbanops.module.workorder.controller.app.garden.vo.task.AppGardenTaskRegionMgrApproveReqVO; | ||
| 5 | +import com.zteits.urbanops.module.workorder.dto.AppGardenWorkOrderInspectorReqVO; | ||
| 6 | +import jakarta.validation.Valid; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * 类描述:AI工单处理server | ||
| 10 | + * 创建人:yanhuiqing | ||
| 11 | + * 创建时间:2025/12/25 16:40 | ||
| 12 | + * 修改人:yanhuiqing | ||
| 13 | + * 修改时间:2025/12/25 16:40 | ||
| 14 | + * 修改备注: | ||
| 15 | + * | ||
| 16 | + * @author yanhuiqing | ||
| 17 | + * @version 1.0 | ||
| 18 | + */ | ||
| 19 | +public interface BpmAIService { | ||
| 20 | + | ||
| 21 | + /** | ||
| 22 | + * 全域督察员工单申请 app service 接口 | ||
| 23 | + * @param createRequestVo | ||
| 24 | + * @return | ||
| 25 | + */ | ||
| 26 | + Long createWorkOrder(@Valid AppGardenWorkOrderInspectorReqVO createRequestVo); | ||
| 27 | + | ||
| 28 | + /** | ||
| 29 | + * 全域督察员工单分配 | ||
| 30 | + * @param regionPassReqVO | ||
| 31 | + */ | ||
| 32 | + void approveTask2TeamLeader(AppGardenTaskRegionMgrApproveReqVO regionPassReqVO); | ||
| 33 | + | ||
| 34 | + /** | ||
| 35 | + * 养护组长退回 分情况 | ||
| 36 | + * @param returnApproveReqVO | ||
| 37 | + */ | ||
| 38 | + void approveTask(AppGardenTaskInspectorApproveReqVO returnApproveReqVO); | ||
| 39 | + | ||
| 40 | + /** | ||
| 41 | + * 判定是否三海地区 通过公司id | ||
| 42 | + * @param companyId | ||
| 43 | + * @return | ||
| 44 | + */ | ||
| 45 | + boolean isSanhai(Long companyId); | ||
| 46 | + | ||
| 47 | + /** | ||
| 48 | + * 判断是否三海地区通过 道路id | ||
| 49 | + * @param roadId | ||
| 50 | + * @return | ||
| 51 | + */ | ||
| 52 | + boolean isSanhaiByRoadId(Long roadId); | ||
| 53 | +} | ||
| 0 | \ No newline at end of file | 54 | \ No newline at end of file |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/service/garden/BpmAIServiceImpl.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.controller.admin.task.vo.task.BpmTaskApproveReqVO; | ||
| 11 | +import com.zteits.urbanops.module.bpm.enums.task.BpmTaskStatusEnum; | ||
| 12 | +import com.zteits.urbanops.module.bpm.framework.flowable.core.enums.BpmnVariableConstants; | ||
| 13 | +import com.zteits.urbanops.module.bpm.service.definition.BpmProcessDefinitionService; | ||
| 14 | +import com.zteits.urbanops.module.bpm.service.task.BpmProcessInstanceService; | ||
| 15 | +import com.zteits.urbanops.module.bpm.service.task.BpmTaskService; | ||
| 16 | +import com.zteits.urbanops.module.garden.api.road.RoadApi; | ||
| 17 | +import com.zteits.urbanops.module.garden.dto.road.RoadStreetRespDTO; | ||
| 18 | +import com.zteits.urbanops.module.system.api.permission.RoleApi; | ||
| 19 | +import com.zteits.urbanops.module.system.api.user.AdminUserApi; | ||
| 20 | +import com.zteits.urbanops.module.system.api.user.dto.AdminUserRespDTO; | ||
| 21 | +import com.zteits.urbanops.module.system.controller.admin.permission.vo.role.RoleRespVO; | ||
| 22 | +import com.zteits.urbanops.module.workorder.api.WorkOrderApi; | ||
| 23 | +import com.zteits.urbanops.module.workorder.api.constant.BpmCommonConstant; | ||
| 24 | +import com.zteits.urbanops.module.workorder.controller.app.garden.vo.task.AppGardenTaskInspectorApproveReqVO; | ||
| 25 | +import com.zteits.urbanops.module.workorder.controller.app.garden.vo.task.AppGardenTaskRegionMgrApproveReqVO; | ||
| 26 | +import com.zteits.urbanops.module.workorder.dal.dataobject.maininfo.MainInfoDO; | ||
| 27 | +import com.zteits.urbanops.module.workorder.dal.mysql.attachment.AttachmentMapper; | ||
| 28 | +import com.zteits.urbanops.module.workorder.dal.mysql.maininfo.MainInfoExtMapper; | ||
| 29 | +import com.zteits.urbanops.module.workorder.dal.mysql.maininfo.MainInfoMapper; | ||
| 30 | +import com.zteits.urbanops.module.workorder.dto.AppGardenWorkOrderInspectorReqVO; | ||
| 31 | +import com.zteits.urbanops.module.workorder.enums.BusiLineTeamLeaderRoleCodeEnum; | ||
| 32 | +import com.zteits.urbanops.module.workorder.util.RoleListUtils; | ||
| 33 | +import jakarta.annotation.Resource; | ||
| 34 | +import jodd.util.StringUtil; | ||
| 35 | +import org.flowable.engine.RuntimeService; | ||
| 36 | +import org.flowable.engine.runtime.ProcessInstance; | ||
| 37 | +import org.springframework.stereotype.Service; | ||
| 38 | +import org.springframework.validation.annotation.Validated; | ||
| 39 | + | ||
| 40 | +import java.time.LocalDateTime; | ||
| 41 | +import java.util.ArrayList; | ||
| 42 | +import java.util.HashMap; | ||
| 43 | +import java.util.List; | ||
| 44 | +import java.util.Map; | ||
| 45 | +import java.util.stream.Collectors; | ||
| 46 | + | ||
| 47 | +import static com.zteits.urbanops.framework.common.exception.util.ServiceExceptionUtil.exception; | ||
| 48 | +import static com.zteits.urbanops.module.workorder.api.constant.BpmCommonConstant.*; | ||
| 49 | +import static com.zteits.urbanops.module.workorder.enums.ErrorCodeConstants.*; | ||
| 50 | + | ||
| 51 | +/** | ||
| 52 | + * 类描述:AI 工单 app端工单服务实现类 | ||
| 53 | + * 创建人:yanhuiqing | ||
| 54 | + * 创建时间:2025/12/25 16:42 | ||
| 55 | + * 修改人:yanhuiqing | ||
| 56 | + * 修改时间:2025/12/25 16:42 | ||
| 57 | + * 修改备注: | ||
| 58 | + * | ||
| 59 | + * @author yanhuiqing | ||
| 60 | + * @version 1.0 | ||
| 61 | + */ | ||
| 62 | +@Service | ||
| 63 | +@Validated | ||
| 64 | +public class BpmAIServiceImpl implements BpmAIService{ | ||
| 65 | + | ||
| 66 | + @Resource | ||
| 67 | + private AttachmentMapper attachmentMapper; | ||
| 68 | + @Resource | ||
| 69 | + private MainInfoMapper workOrderMapper; | ||
| 70 | + | ||
| 71 | + @Resource | ||
| 72 | + private MainInfoExtMapper workOrderExtMapper; | ||
| 73 | + @Resource | ||
| 74 | + private BpmProcessInstanceApi processInstanceApi; | ||
| 75 | + | ||
| 76 | + @Resource | ||
| 77 | + private BpmProcessDefinitionService processDefinitionService; | ||
| 78 | + @Resource | ||
| 79 | + private WorkOrderApi workOrderApi; | ||
| 80 | + | ||
| 81 | + @Resource | ||
| 82 | + private RoadApi roadApi; | ||
| 83 | + | ||
| 84 | + @Resource | ||
| 85 | + private BpmTaskService taskService; | ||
| 86 | + | ||
| 87 | + @Resource | ||
| 88 | + private AdminUserApi adminUserApi; | ||
| 89 | + | ||
| 90 | + @Resource | ||
| 91 | + private RoleApi roleApi; | ||
| 92 | + | ||
| 93 | + @Resource | ||
| 94 | + private BpmGardenService bpmGardenService; | ||
| 95 | + | ||
| 96 | + @Resource | ||
| 97 | + private BpmProcessInstanceService processInstanceService; | ||
| 98 | + | ||
| 99 | + @Resource | ||
| 100 | + private RuntimeService runtimeService; | ||
| 101 | + | ||
| 102 | + @Resource | ||
| 103 | + private DictDataCommonApi dictDataCommonApi; | ||
| 104 | + @Override | ||
| 105 | + public Long createWorkOrder(AppGardenWorkOrderInspectorReqVO createRequestVo) { | ||
| 106 | + List<RoleRespVO> roleList = roleApi.getRoleListByUsrId(SecurityFrameworkUtils.getLoginUserId()); | ||
| 107 | + if(null == roleList || roleList.size()==0){ | ||
| 108 | + throw exception(APP_USER_ROLE_NOT_EXISTS); | ||
| 109 | + } | ||
| 110 | + | ||
| 111 | + if(!RoleListUtils.containsCode(roleList,INSPECTOR_GLOBAL)){ | ||
| 112 | + throw exception(APP_INSPECTOR_USER_ROLE_ERROR); | ||
| 113 | + } | ||
| 114 | + //校验人员不能有 双重角色 | ||
| 115 | + if(RoleListUtils.containsBothCodes(roleList, REGIONAL_MANAGER, INSPECTOR_GLOBAL)){ | ||
| 116 | + throw exception(APP_WORK_INSPECTOR_ROLE_ILLEGLE); | ||
| 117 | + } | ||
| 118 | + | ||
| 119 | + List<String> problemsImgsList = createRequestVo.getProblemsImgs(); | ||
| 120 | + MainInfoDO workOrder = BeanUtils.toBean(createRequestVo, MainInfoDO.class) | ||
| 121 | + .setStatus(BpmTaskStatusEnum.RUNNING.getStatus()); | ||
| 122 | + RoadStreetRespDTO roadStreetRespDTO = roadApi.getRoadInfoById(createRequestVo.getRoadId()); | ||
| 123 | + if(null == roadStreetRespDTO){ | ||
| 124 | + throw exception(APP_WORK_ROAD_NOT_EXISTS); | ||
| 125 | + } | ||
| 126 | + workOrder.setStreetId(roadStreetRespDTO.getStreetId()); | ||
| 127 | + workOrder.setStreetName(roadStreetRespDTO.getStreetName()); | ||
| 128 | + workOrder.setBuzStatus(ORDER_STATUS_INIT);//工单业务初始化状态 后续操作状态 见 OperateTypeEnum | ||
| 129 | + if(StringUtil.isEmpty(createRequestVo.getOrderType())){ | ||
| 130 | + workOrder.setOrderType(BpmCommonConstant.ORDER_TYPE_C); | ||
| 131 | + }else{ | ||
| 132 | + if(createRequestVo.getOrderType().equals(BpmCommonConstant.ORDER_TYPE_Q)){ | ||
| 133 | + throw exception(APP_WORK_ORADER_ERROR); | ||
| 134 | + } | ||
| 135 | + workOrder.setOrderType(createRequestVo.getOrderType()); | ||
| 136 | + } | ||
| 137 | + DictDataRespDTO dictData = dictDataCommonApi.getDictData(CONSERVE_LEVEL, roadStreetRespDTO.getLevelId().toString()); | ||
| 138 | + if(null == dictData){ | ||
| 139 | + throw exception(APP_WORKER_LEVEL_ID_NOT_EXISTS); | ||
| 140 | + } | ||
| 141 | + workOrder.setCuringLevelId(Integer.valueOf(dictData.getValue())); | ||
| 142 | + workOrder.setCuringLevelName(dictData.getLabel()); | ||
| 143 | + workOrder.setCommitDate(LocalDateTime.now()); | ||
| 144 | + workOrder.setCompanyId(SecurityFrameworkUtils.getCompanyId()); | ||
| 145 | + | ||
| 146 | + workOrder.setDeptId(SecurityFrameworkUtils.getDeptId()); | ||
| 147 | + workOrder.setWoSourceId(roleList.get(0).getCode()); | ||
| 148 | + workOrder.setWoSourceName(roleList.get(0).getName()); | ||
| 149 | + String busiLine = createRequestVo.getBusiLine(); | ||
| 150 | + if(StringUtil.isEmpty(busiLine)){ | ||
| 151 | + busiLine = SecurityFrameworkUtils.getBusiLine(); | ||
| 152 | + } | ||
| 153 | + workOrder.setBusiLine(busiLine); | ||
| 154 | + workOrder.setUserId(SecurityFrameworkUtils.getLoginUserId()); | ||
| 155 | + workOrder.setUserName(SecurityFrameworkUtils.getLoginUserNickname()); | ||
| 156 | + if(ObjectUtils.isNotAllEmpty(createRequestVo.getExpectedFinishDate())){ | ||
| 157 | + workOrder.setExpectedFinishDate(createRequestVo.getExpectedFinishDate()); | ||
| 158 | + } | ||
| 159 | + String workOrderNum = workOrderApi.generateWONum(BpmCommonConstant.WORK_ORDER_PREFFIX_AI); | ||
| 160 | + workOrder.setOrderNo(workOrderNum); | ||
| 161 | + | ||
| 162 | + workOrderMapper.insert(workOrder); | ||
| 163 | + if(ObjectUtils.isNotAllEmpty(problemsImgsList) && problemsImgsList.size()>0){ | ||
| 164 | + bpmGardenService.attachmentInsertOrUpdate(problemsImgsList,BpmCommonConstant.PROBLEM_IMG_GROUP,workOrder); | ||
| 165 | + } | ||
| 166 | + // 发起 BPM 流程 | ||
| 167 | + Long userId = SecurityFrameworkUtils.getLoginUserId(); | ||
| 168 | + Map<String, Object> processInstanceVariables = new HashMap<>(); | ||
| 169 | + //是否三海路段 | ||
| 170 | + boolean isSanhai = this.isSanhai(roadStreetRespDTO.getCompanyId()); | ||
| 171 | + processInstanceVariables.put(BPM_COMMON_PROD_ROADID, workOrder.getRoadId()); | ||
| 172 | + processInstanceVariables.put(BPM_COMMON_PROD_APPLYUSERID, userId); | ||
| 173 | + processInstanceVariables.put(BPM_COMMON_PROD_ISSANHAI,isSanhai); | ||
| 174 | + processInstanceVariables.put(BPM_COMMON_PROD_ISNEED,null); | ||
| 175 | + processInstanceVariables.put(BMP_COMMON_PROD_ISPASS,null); | ||
| 176 | + | ||
| 177 | + if(!isSanhai){//非三海初始化 业务线班组长信息 | ||
| 178 | + String roleCode = BusiLineTeamLeaderRoleCodeEnum.getByCode(busiLine).getRoleCode(); | ||
| 179 | + if(StringUtil.isEmpty(roleCode)){// 找不到 默认为园林组长的角色 | ||
| 180 | + roleCode = BpmCommonConstant.TEAM_LEADER_YL; | ||
| 181 | + } | ||
| 182 | + List<AdminUserRespDTO> userList = workOrderExtMapper.getUserByRoadIdAndRoleCode(workOrder.getRoadId(),roleCode,createRequestVo.getBusiLine()); | ||
| 183 | + if(org.springframework.util.ObjectUtils.isEmpty(userList)){ | ||
| 184 | + throw exception(TEAM_LEADER_YL_NOT_EXISTS); | ||
| 185 | + } | ||
| 186 | + // 提取id到List<Long> | ||
| 187 | + List<Long> idList = userList.stream() | ||
| 188 | + // 映射:将AdminUserRespDTO对象转为其id属性 | ||
| 189 | + .map(AdminUserRespDTO::getId) | ||
| 190 | + // 收集结果到List | ||
| 191 | + .collect(Collectors.toList()); | ||
| 192 | + processInstanceVariables.put(BPM_COMMON_PROD_LEADERID, idList.get(0)); | ||
| 193 | + } | ||
| 194 | + | ||
| 195 | + String processInstanceId = processInstanceApi.createProcessInstance(userId, | ||
| 196 | + new BpmProcessInstanceCreateReqDTO().setProcessDefinitionKey(BpmCommonConstant.BPM_AI_WO) | ||
| 197 | + .setVariables(processInstanceVariables).setBusinessKey(String.valueOf(workOrder.getId()))); | ||
| 198 | + | ||
| 199 | + // 将工作流的编号,更新到 工单中 | ||
| 200 | + workOrderMapper.updateById(new MainInfoDO().setId(workOrder.getId()).setProcessInstanceId(processInstanceId)); | ||
| 201 | + return workOrder.getId(); | ||
| 202 | + } | ||
| 203 | + | ||
| 204 | + @Override | ||
| 205 | + public void approveTask2TeamLeader(AppGardenTaskRegionMgrApproveReqVO reqVO) { | ||
| 206 | + BpmTaskApproveReqVO targetVO = BeanUtils.toBean(reqVO,BpmTaskApproveReqVO.class); | ||
| 207 | + Map<String, Object> variables = new HashMap<>(); | ||
| 208 | + //审批通过 | ||
| 209 | + variables.put(BpmnVariableConstants.PROCESS_INSTANCE_VARIABLE_STATUS,BpmTaskStatusEnum.APPROVE.getStatus()); | ||
| 210 | + Integer status = reqVO.getAgree(); | ||
| 211 | + if(status == null || status == 1){//status == null 此处是为了兼容老接口,防止前段少改造 | ||
| 212 | + variables.put(BMP_COMMON_PROD_ISPASS,false); | ||
| 213 | + variables.put(BPM_COMMON_PROD_ISREVOKE,null);//不通过后 初始化重新发起变量 | ||
| 214 | + }else { | ||
| 215 | + variables.put(BMP_COMMON_PROD_ISPASS,true); | ||
| 216 | + variables.put(BPM_COMMON_PROD_ISNEED,null); | ||
| 217 | + String instanceId = taskService.getTask(reqVO.getId()).getProcessInstanceId(); | ||
| 218 | + ProcessInstance processInstance = processInstanceService.getProcessInstance(instanceId); | ||
| 219 | + Map<String, Object> processInstanceVariables = processInstance.getProcessVariables(); | ||
| 220 | + //String busiLine = (String)processInstanceVariables.get(BPM_COMMON_PROD_BUSILINE); | ||
| 221 | + //Long roadId = (Long) processInstanceVariables.get(BPM_COMMON_PROD_ROADID); | ||
| 222 | + String busiLine = reqVO.getBusiLine(); | ||
| 223 | + Long roadId = reqVO.getRoadId(); | ||
| 224 | + String roleCode = BusiLineTeamLeaderRoleCodeEnum.getByCode(busiLine).getRoleCode(); | ||
| 225 | + | ||
| 226 | + if(StringUtil.isEmpty(roleCode)){// 找不到 默认为园林组长的角色 | ||
| 227 | + roleCode = BpmCommonConstant.TEAM_LEADER_YL; | ||
| 228 | + } | ||
| 229 | + List<AdminUserRespDTO> userList = workOrderExtMapper.getUserByRoadIdAndRoleCode(roadId,roleCode,busiLine); | ||
| 230 | + if(org.springframework.util.ObjectUtils.isEmpty(userList)){ | ||
| 231 | + throw exception(TEAM_LEADER_YL_NOT_EXISTS); | ||
| 232 | + } | ||
| 233 | + // 提取id到List<Long> | ||
| 234 | + List<Long> idList = userList.stream() | ||
| 235 | + // 映射:将AdminUserRespDTO对象转为其id属性 | ||
| 236 | + .map(AdminUserRespDTO::getId) | ||
| 237 | + // 收集结果到List | ||
| 238 | + .collect(Collectors.toList()); | ||
| 239 | + processInstanceVariables.put(BPM_COMMON_PROD_LEADERID, idList.get(0));//养护组长分配 | ||
| 240 | + //流程变量重新赋值 | ||
| 241 | + runtimeService.setVariables(instanceId,processInstanceVariables); | ||
| 242 | + | ||
| 243 | + } | ||
| 244 | + | ||
| 245 | + targetVO.setVariables(variables); | ||
| 246 | + //TODO 审批候选人需要赋值 | ||
| 247 | + Map<String, List<Long>> nextAssignees = new HashMap<>(); | ||
| 248 | + targetVO.setNextAssignees(nextAssignees); | ||
| 249 | + targetVO.setAttattmentUrls(reqVO.getReturnImgs()); | ||
| 250 | + taskService.approveTask(SecurityFrameworkUtils.getLoginUserId(),targetVO); | ||
| 251 | + } | ||
| 252 | + | ||
| 253 | + @Override | ||
| 254 | + public void approveTask(AppGardenTaskInspectorApproveReqVO reqVO) { | ||
| 255 | + BpmTaskApproveReqVO targetVO = BeanUtils.toBean(reqVO,BpmTaskApproveReqVO.class); | ||
| 256 | + Map<String, Object> variables = new HashMap<>(); | ||
| 257 | + //审批通过 | ||
| 258 | + variables.put(BpmnVariableConstants.PROCESS_INSTANCE_VARIABLE_STATUS,BpmTaskStatusEnum.APPROVE.getStatus()); | ||
| 259 | + Integer status = reqVO.getAgree(); | ||
| 260 | + if(status == null || status == 1){//status == null 此处是为了兼容老接口,防止前段少改造 | ||
| 261 | + variables.put(BPM_COMMON_PROD_ISNEED,false); | ||
| 262 | + variables.put(BPM_COMMON_PROD_ISREVOKE,false); | ||
| 263 | + variables.put(BPM_COMMON_PROD_ISVERIFY,false); | ||
| 264 | + //退回时判断 三海区域 | ||
| 265 | + boolean isSanhai = isSanhaiByRoadId(reqVO.getRoadId()); | ||
| 266 | + variables.put(BPM_COMMON_PROD_ISSANHAI,isSanhai); | ||
| 267 | + }else { | ||
| 268 | + variables.put(BPM_COMMON_PROD_ISNEED,true); | ||
| 269 | + variables.put(BPM_COMMON_PROD_ISREVOKE,true); | ||
| 270 | + variables.put(BPM_COMMON_PROD_ISVERIFY,true); | ||
| 271 | + } | ||
| 272 | + //TODO 重新发起需更新工单数据库 | ||
| 273 | + | ||
| 274 | + targetVO.setVariables(variables); | ||
| 275 | + //TODO 审批候选人需要赋值 | ||
| 276 | + Map<String, List<Long>> nextAssignees = new HashMap<>(); | ||
| 277 | + targetVO.setNextAssignees(nextAssignees); | ||
| 278 | + targetVO.setAttattmentUrls(reqVO.getReturnImgs()); | ||
| 279 | + taskService.approveTask(SecurityFrameworkUtils.getLoginUserId(),targetVO); | ||
| 280 | + } | ||
| 281 | + | ||
| 282 | + @Override | ||
| 283 | + public boolean isSanhai(Long companyId) { | ||
| 284 | + List<Long> sanHaiRoadId = new ArrayList<>(); | ||
| 285 | + sanHaiRoadId.add(115L); // TODO 目前写死 | ||
| 286 | + //是否三海路段 | ||
| 287 | + boolean isSanhai = sanHaiRoadId.contains(companyId); | ||
| 288 | + return isSanhai; | ||
| 289 | + } | ||
| 290 | + | ||
| 291 | + @Override | ||
| 292 | + public boolean isSanhaiByRoadId(Long roadId) { | ||
| 293 | + RoadStreetRespDTO roadStreetRespDTO = roadApi.getRoadInfoById(roadId); | ||
| 294 | + if(null == roadStreetRespDTO){ | ||
| 295 | + throw exception(APP_WORK_ROAD_NOT_EXISTS); | ||
| 296 | + } | ||
| 297 | + return isSanhai(roadStreetRespDTO.getCompanyId()); | ||
| 298 | + } | ||
| 299 | + | ||
| 300 | +} | ||
| 0 | \ No newline at end of file | 301 | \ No newline at end of file |