Commit 3a60ac746e540db562cc0b458c9d49003a93f59d
1 parent
48e696b0
创建工单API封装 升级接口
Showing
22 changed files
with
664 additions
and
296 deletions
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/api/constant/BpmCommonConstant.java
| @@ -15,6 +15,11 @@ public class BpmCommonConstant { | @@ -15,6 +15,11 @@ public class BpmCommonConstant { | ||
| 15 | * 园林巡检工单 流程业务key | 15 | * 园林巡检工单 流程业务key |
| 16 | */ | 16 | */ |
| 17 | public static final String BPM_GARDEN_INSPECT_WO = "garden_inspect_wo"; | 17 | public static final String BPM_GARDEN_INSPECT_WO = "garden_inspect_wo"; |
| 18 | + | ||
| 19 | + /** | ||
| 20 | + * 园林巡检工单 通用版本 | ||
| 21 | + */ | ||
| 22 | + public static final String BPM_WORKORDER_COMMON_PROD = "workorder_common_prod"; | ||
| 18 | /** | 23 | /** |
| 19 | * 物业巡检工单 流程业务key | 24 | * 物业巡检工单 流程业务key |
| 20 | */ | 25 | */ |
| @@ -23,22 +28,36 @@ public class BpmCommonConstant { | @@ -23,22 +28,36 @@ public class BpmCommonConstant { | ||
| 23 | * 市政巡检工单 流程业务key | 28 | * 市政巡检工单 流程业务key |
| 24 | */ | 29 | */ |
| 25 | public static final String BPM_MUNICIPAL_INSPECT_WO = "municipal_inspect_wo"; | 30 | public static final String BPM_MUNICIPAL_INSPECT_WO = "municipal_inspect_wo"; |
| 26 | - /** | 31 | + /** 01 问题图片,02 开始图片,03 进行中图片,04 已完成图片,05 人员图片:06 材料图片 |
| 32 | + * problemsImgs,startImgs,processingImgs,endImgs,personImgs,materialImgs | ||
| 27 | * 园林问题单处理前图片描述 | 33 | * 园林问题单处理前图片描述 |
| 28 | */ | 34 | */ |
| 29 | public static final String PROBLEM_IMG_GROUP = "01"; | 35 | public static final String PROBLEM_IMG_GROUP = "01"; |
| 30 | /** | 36 | /** |
| 31 | - * 园林问题单处理中图片类型 | 37 | + * 园林工单开始图片类型 |
| 38 | + */ | ||
| 39 | + public static final String START_IMG_GROUP = "02"; | ||
| 40 | + /** | ||
| 41 | + * 园林工单进行中图片类型 | ||
| 42 | + */ | ||
| 43 | + public static final String PROCESS_IMG_GROUP = "03"; | ||
| 44 | + | ||
| 45 | + /** | ||
| 46 | + * 园林工单结束图片类型 | ||
| 47 | + */ | ||
| 48 | + public static final String END_IMG_GROUP = "04"; | ||
| 49 | + /** | ||
| 50 | + * 园林工单人员图片类型 | ||
| 32 | */ | 51 | */ |
| 33 | - public static final String HANDLE_IMG_GROUP = "02"; | 52 | + public static final String PERSON_IMG_GROUP = "05"; |
| 34 | /** | 53 | /** |
| 35 | - * 园林处理结果图片类型 | 54 | + * 园林工单耗材图片类型 |
| 36 | */ | 55 | */ |
| 37 | - public static final String RESULT_IMG_GROUP = "03"; | 56 | + public static final String MATERIAL_IMG_GROUP = "06"; |
| 38 | /** | 57 | /** |
| 39 | * 园林工作流 组长退回的附件照片 | 58 | * 园林工作流 组长退回的附件照片 |
| 40 | */ | 59 | */ |
| 41 | - public static final String GARDEN_TEAMLEADER_RETURN_IMG = "04"; | 60 | + public static final String GARDEN_TEAMLEADER_RETURN_IMG = "09"; |
| 42 | /** | 61 | /** |
| 43 | * 园林工单编号前缀 | 62 | * 园林工单编号前缀 |
| 44 | */ | 63 | */ |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/controller/app/garden/AppGardenWorkOrderController.java
| 1 | package com.zteits.urbanops.module.workorder.controller.app.garden; | 1 | package com.zteits.urbanops.module.workorder.controller.app.garden; |
| 2 | 2 | ||
| 3 | -import cn.hutool.core.util.StrUtil; | ||
| 4 | import com.zteits.urbanops.framework.common.pojo.CommonResult; | 3 | import com.zteits.urbanops.framework.common.pojo.CommonResult; |
| 5 | -import com.zteits.urbanops.framework.common.pojo.PageParam; | ||
| 6 | import com.zteits.urbanops.framework.common.pojo.PageResult; | 4 | import com.zteits.urbanops.framework.common.pojo.PageResult; |
| 7 | -import com.zteits.urbanops.framework.common.util.json.JsonUtils; | ||
| 8 | import com.zteits.urbanops.framework.common.util.object.BeanUtils; | 5 | import com.zteits.urbanops.framework.common.util.object.BeanUtils; |
| 6 | +import com.zteits.urbanops.framework.common.util.object.ObjectUtils; | ||
| 9 | import com.zteits.urbanops.framework.security.core.util.SecurityFrameworkUtils; | 7 | import com.zteits.urbanops.framework.security.core.util.SecurityFrameworkUtils; |
| 10 | -import com.zteits.urbanops.framework.web.core.util.WebFrameworkUtils; | ||
| 11 | -import com.zteits.urbanops.module.bpm.controller.admin.task.vo.instance.BpmApprovalDetailReqVO; | ||
| 12 | -import com.zteits.urbanops.module.bpm.controller.admin.task.vo.instance.BpmApprovalDetailRespVO; | ||
| 13 | -import com.zteits.urbanops.module.bpm.controller.admin.task.vo.task.BpmTaskDelegateReqVO; | ||
| 14 | -import com.zteits.urbanops.module.bpm.controller.admin.task.vo.task.BpmTaskTransferReqVO; | ||
| 15 | import com.zteits.urbanops.module.garden.api.road.RoadApi; | 8 | import com.zteits.urbanops.module.garden.api.road.RoadApi; |
| 16 | import com.zteits.urbanops.module.garden.api.road.dto.RoadReqDTO; | 9 | import com.zteits.urbanops.module.garden.api.road.dto.RoadReqDTO; |
| 17 | import com.zteits.urbanops.module.garden.api.road.dto.RoadRespDTO; | 10 | import com.zteits.urbanops.module.garden.api.road.dto.RoadRespDTO; |
| 18 | import com.zteits.urbanops.module.system.api.user.dto.AdminUserRespDTO; | 11 | import com.zteits.urbanops.module.system.api.user.dto.AdminUserRespDTO; |
| 19 | -import com.zteits.urbanops.module.workorder.api.constant.BpmCommonConstant; | ||
| 20 | import com.zteits.urbanops.module.workorder.controller.app.garden.vo.*; | 12 | import com.zteits.urbanops.module.workorder.controller.app.garden.vo.*; |
| 13 | +import com.zteits.urbanops.module.workorder.controller.app.garden.vo.common.AppUniversalApprovalReqVO; | ||
| 21 | import com.zteits.urbanops.module.workorder.controller.app.garden.vo.common.UserInfoPageReqVO; | 14 | import com.zteits.urbanops.module.workorder.controller.app.garden.vo.common.UserInfoPageReqVO; |
| 15 | +import com.zteits.urbanops.module.workorder.controller.app.garden.vo.operator.AppGardenTaskRejectExtReqVO; | ||
| 22 | import com.zteits.urbanops.module.workorder.controller.app.garden.vo.operator.AppGardenTaskReturnExtReqVO; | 16 | import com.zteits.urbanops.module.workorder.controller.app.garden.vo.operator.AppGardenTaskReturnExtReqVO; |
| 23 | import com.zteits.urbanops.module.workorder.controller.app.garden.vo.operator.AppGardenTaskTeamLeaderAssignReqVO; | 17 | import com.zteits.urbanops.module.workorder.controller.app.garden.vo.operator.AppGardenTaskTeamLeaderAssignReqVO; |
| 24 | import com.zteits.urbanops.module.workorder.controller.app.garden.vo.operator.AppGardenTaskWorkerExcuteReqVO; | 18 | import com.zteits.urbanops.module.workorder.controller.app.garden.vo.operator.AppGardenTaskWorkerExcuteReqVO; |
| @@ -26,20 +20,22 @@ import com.zteits.urbanops.module.workorder.controller.app.garden.vo.process.App | @@ -26,20 +20,22 @@ import com.zteits.urbanops.module.workorder.controller.app.garden.vo.process.App | ||
| 26 | import com.zteits.urbanops.module.workorder.controller.app.garden.vo.process.AppGardenApprovalDetailRespVO; | 20 | import com.zteits.urbanops.module.workorder.controller.app.garden.vo.process.AppGardenApprovalDetailRespVO; |
| 27 | import com.zteits.urbanops.module.workorder.controller.app.garden.vo.task.*; | 21 | import com.zteits.urbanops.module.workorder.controller.app.garden.vo.task.*; |
| 28 | import com.zteits.urbanops.module.workorder.dal.dataobject.garden.BpmGardenWorkOrderDO; | 22 | import com.zteits.urbanops.module.workorder.dal.dataobject.garden.BpmGardenWorkOrderDO; |
| 23 | +import com.zteits.urbanops.module.workorder.enums.OperateTypeEnum; | ||
| 29 | import com.zteits.urbanops.module.workorder.service.garden.BpmGardenService; | 24 | import com.zteits.urbanops.module.workorder.service.garden.BpmGardenService; |
| 30 | import io.swagger.v3.oas.annotations.Operation; | 25 | import io.swagger.v3.oas.annotations.Operation; |
| 31 | import io.swagger.v3.oas.annotations.Parameter; | 26 | import io.swagger.v3.oas.annotations.Parameter; |
| 32 | import io.swagger.v3.oas.annotations.tags.Tag; | 27 | import io.swagger.v3.oas.annotations.tags.Tag; |
| 33 | import jakarta.annotation.Resource; | 28 | import jakarta.annotation.Resource; |
| 34 | import jakarta.validation.Valid; | 29 | import jakarta.validation.Valid; |
| 35 | -import org.springframework.security.access.prepost.PreAuthorize; | 30 | +import lombok.extern.slf4j.Slf4j; |
| 36 | import org.springframework.web.bind.annotation.*; | 31 | import org.springframework.web.bind.annotation.*; |
| 37 | 32 | ||
| 38 | import java.util.List; | 33 | import java.util.List; |
| 39 | -import java.util.Map; | ||
| 40 | 34 | ||
| 35 | +import static com.zteits.urbanops.framework.common.exception.util.ServiceExceptionUtil.exception; | ||
| 41 | import static com.zteits.urbanops.framework.common.pojo.CommonResult.success; | 36 | import static com.zteits.urbanops.framework.common.pojo.CommonResult.success; |
| 42 | import static com.zteits.urbanops.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; | 37 | import static com.zteits.urbanops.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; |
| 38 | +import static com.zteits.urbanops.module.workorder.enums.ErrorCodeConstants.*; | ||
| 43 | 39 | ||
| 44 | /** | 40 | /** |
| 45 | * @author yanhuiqing | 41 | * @author yanhuiqing |
| @@ -49,6 +45,7 @@ import static com.zteits.urbanops.framework.security.core.util.SecurityFramework | @@ -49,6 +45,7 @@ import static com.zteits.urbanops.framework.security.core.util.SecurityFramework | ||
| 49 | */ | 45 | */ |
| 50 | @Tag(name = "APP - 园林工单bpm") | 46 | @Tag(name = "APP - 园林工单bpm") |
| 51 | @RestController | 47 | @RestController |
| 48 | +@Slf4j | ||
| 52 | @RequestMapping("/bpm/garden/workorder") | 49 | @RequestMapping("/bpm/garden/workorder") |
| 53 | public class AppGardenWorkOrderController { | 50 | public class AppGardenWorkOrderController { |
| 54 | @Resource | 51 | @Resource |
| @@ -169,6 +166,13 @@ public class AppGardenWorkOrderController { | @@ -169,6 +166,13 @@ public class AppGardenWorkOrderController { | ||
| 169 | gardenService.returnPreviousNode(reqVO); | 166 | gardenService.returnPreviousNode(reqVO); |
| 170 | return success(true); | 167 | return success(true); |
| 171 | } | 168 | } |
| 169 | + @PutMapping("/reject") | ||
| 170 | + @Operation(summary = "app - 不通过任务-驳回") | ||
| 171 | + //@PreAuthorize("@ss.hasPermission('bpm:garden-workorder:update')") | ||
| 172 | + public CommonResult<Boolean> rejectTask(@Valid @RequestBody AppGardenTaskRejectExtReqVO reqVO) { | ||
| 173 | + gardenService.rejectTask(reqVO); | ||
| 174 | + return success(true); | ||
| 175 | + } | ||
| 172 | 176 | ||
| 173 | @PutMapping("/withdraw") | 177 | @PutMapping("/withdraw") |
| 174 | @Operation(summary = "app - 撤回任务") | 178 | @Operation(summary = "app - 撤回任务") |
| @@ -239,4 +243,124 @@ public class AppGardenWorkOrderController { | @@ -239,4 +243,124 @@ public class AppGardenWorkOrderController { | ||
| 239 | PageResult<AdminUserRespDTO> pageResult = gardenService.getUserByLoginIdAndRoleCode(pageVO, SecurityFrameworkUtils.getLoginUserId(),pageVO.getRoleCode(),pageVO.getBusiLine(),pageVO.isNotHas()); | 243 | PageResult<AdminUserRespDTO> pageResult = gardenService.getUserByLoginIdAndRoleCode(pageVO, SecurityFrameworkUtils.getLoginUserId(),pageVO.getRoleCode(),pageVO.getBusiLine(),pageVO.isNotHas()); |
| 240 | return success(pageResult); | 244 | return success(pageResult); |
| 241 | } | 245 | } |
| 246 | + | ||
| 247 | + @Operation(summary = "app-统一审批入口") | ||
| 248 | + @PostMapping("/universalApproval") | ||
| 249 | + //@PreAuthorize("@ss.hasPermission('bpm:garden-workorder:update')") | ||
| 250 | + public CommonResult<Boolean> universalApproval(@Valid @RequestBody AppUniversalApprovalReqVO reqVO) { | ||
| 251 | + | ||
| 252 | + log.info("【园林统一审批】接收前端请求,入参:curTaskKey={}, taskId={}, operateType={}, agree={}, reason={}", | ||
| 253 | + reqVO.getTaskKey(), reqVO.getTaskId(), reqVO.getOperateType(), reqVO.getAgree(), reqVO.getReason()); | ||
| 254 | + | ||
| 255 | + OperateTypeEnum operateType = OperateTypeEnum.getByCode(reqVO.getOperateType()); | ||
| 256 | + | ||
| 257 | + switch (operateType) { | ||
| 258 | + case YL_WORKER_RETURN:// 养护员退回 | ||
| 259 | + log.info("当前操作:"+OperateTypeEnum.YL_WORKER_RETURN.getDesc()+"开始,操作类型:"+OperateTypeEnum.YL_WORKER_RETURN.getCode()+"-->"); | ||
| 260 | + AppGardenTaskReturnExtReqVO retReqVO = new AppGardenTaskReturnExtReqVO(); | ||
| 261 | + retReqVO.setId(reqVO.getTaskId()); | ||
| 262 | + retReqVO.setCurTaskKey(reqVO.getTaskKey()); | ||
| 263 | + retReqVO.setReason(reqVO.getReason()); | ||
| 264 | + retReqVO.setWorkerDataId(reqVO.getWorkerDataId()); | ||
| 265 | + retReqVO.setReturnImgs(reqVO.getReturnImgs()); | ||
| 266 | + this.returnPreviousNode(retReqVO); | ||
| 267 | + log.info("当前操作:"+OperateTypeEnum.YL_WORKER_RETURN.getDesc()+"<--结束"); | ||
| 268 | + return success(true); | ||
| 269 | + case YL_WORKER_IMPLEMENT://养护员实施 | ||
| 270 | + log.info("当前操作:"+OperateTypeEnum.YL_WORKER_IMPLEMENT.getDesc()+"开始,操作类型:"+OperateTypeEnum.YL_WORKER_RETURN.getCode()+"-->"); | ||
| 271 | + AppGardenTaskWorkerExcuteReqVO workerExcuteReqVO = new AppGardenTaskWorkerExcuteReqVO(); | ||
| 272 | + workerExcuteReqVO.setWorkerDataId(reqVO.getWorkerDataId()); | ||
| 273 | + workerExcuteReqVO.setId(reqVO.getTaskId()); | ||
| 274 | + workerExcuteReqVO.setCoHandlers(reqVO.getCoHandlers()); | ||
| 275 | + workerExcuteReqVO.setHandleResult(reqVO.getHandleResult()); | ||
| 276 | + workerExcuteReqVO.setProblemsImgs(reqVO.getProblemsImgs()); | ||
| 277 | + workerExcuteReqVO.setStartImgs(reqVO.getStartImgs()); | ||
| 278 | + workerExcuteReqVO.setProcessingImgs(reqVO.getProcessingImgs()); | ||
| 279 | + workerExcuteReqVO.setEndImgs(reqVO.getEndImgs()); | ||
| 280 | + workerExcuteReqVO.setPersonImgs(reqVO.getPersonImgs()); | ||
| 281 | + workerExcuteReqVO.setMaterialImgs(reqVO.getMaterialImgs()); | ||
| 282 | + this.ylWorkerExcuteWOrder(workerExcuteReqVO); | ||
| 283 | + log.info("当前操作:"+OperateTypeEnum.YL_WORKER_IMPLEMENT.getDesc()+"<--结束"); | ||
| 284 | + return success(true); | ||
| 285 | + case YL_TEAM_LEADER_CONFIRM_PASS://养护组长验收通过 | ||
| 286 | + log.info("当前操作:"+OperateTypeEnum.YL_TEAM_LEADER_CONFIRM_PASS.getDesc()+"开始,操作类型:"+OperateTypeEnum.YL_WORKER_RETURN.getCode()+"-->"); | ||
| 287 | + AppGardenTaskApproveReqVO approveReqVO = new AppGardenTaskApproveReqVO(); | ||
| 288 | + approveReqVO.setReason(reqVO.getReason()); | ||
| 289 | + approveReqVO.setId(reqVO.getTaskId()); | ||
| 290 | + this.approveTask(approveReqVO); | ||
| 291 | + log.info("当前操作:"+OperateTypeEnum.YL_TEAM_LEADER_CONFIRM_PASS.getDesc()+"<--结束"); | ||
| 292 | + return success(true); | ||
| 293 | + case YL_TEAM_LEADER_CONFIRM_REJECT://养护组长验收不通过 | ||
| 294 | + log.info("当前操作:"+OperateTypeEnum.YL_TEAM_LEADER_CONFIRM_REJECT.getDesc()+"开始,操作类型:"+OperateTypeEnum.YL_WORKER_RETURN.getCode()+"-->"); | ||
| 295 | + AppGardenTaskReturnExtReqVO rejReqVO = new AppGardenTaskReturnExtReqVO(); | ||
| 296 | + rejReqVO.setId(reqVO.getTaskId()); | ||
| 297 | + rejReqVO.setCurTaskKey(reqVO.getTaskKey()); | ||
| 298 | + rejReqVO.setReason(reqVO.getReason()); | ||
| 299 | + rejReqVO.setWorkerDataId(reqVO.getWorkerDataId()); | ||
| 300 | + rejReqVO.setReturnImgs(reqVO.getReturnImgs()); | ||
| 301 | + this.returnPreviousNode(rejReqVO); | ||
| 302 | + log.info("当前操作:"+OperateTypeEnum.YL_TEAM_LEADER_CONFIRM_REJECT.getDesc()+"<--结束"); | ||
| 303 | + return success(true); | ||
| 304 | + case YL_TEAM_LEADER_ASSIGN: //养护组长分配 | ||
| 305 | + log.info("当前操作:"+OperateTypeEnum.YL_TEAM_LEADER_ASSIGN.getDesc()+"开始,操作类型:"+OperateTypeEnum.YL_WORKER_RETURN.getCode()+"-->"); | ||
| 306 | + AppGardenTaskTeamLeaderAssignReqVO assignReqVO = new AppGardenTaskTeamLeaderAssignReqVO(); | ||
| 307 | + assignReqVO.setId(reqVO.getTaskId()); | ||
| 308 | + assignReqVO.setReason(reqVO.getReason()); | ||
| 309 | + Long userId = reqVO.getNextAssignee(); | ||
| 310 | + if(!ObjectUtils.isNotAllEmpty(userId)){ | ||
| 311 | + throw exception(APP_WORKER_NOT_EXISTS); | ||
| 312 | + } | ||
| 313 | + assignReqVO.setNextAssignee(reqVO.getNextAssignee()); | ||
| 314 | + Integer status = reqVO.getAgree(); | ||
| 315 | + if (status == null || (status != 0 && status != 1)) { | ||
| 316 | + throw exception(APP_AGREE_CHOOSE); | ||
| 317 | + } | ||
| 318 | + assignReqVO.setAgree(status); | ||
| 319 | + this.ylTeamLeaderAssignWOrder(assignReqVO); | ||
| 320 | + log.info("当前操作:"+OperateTypeEnum.YL_TEAM_LEADER_ASSIGN.getDesc()+"<--结束"); | ||
| 321 | + return success(true); | ||
| 322 | + | ||
| 323 | + case YL_TEAM_LEADER_RETURN://养护组长退回 | ||
| 324 | + log.info("当前操作:"+OperateTypeEnum.YL_TEAM_LEADER_RETURN.getDesc()+"开始,操作类型:"+OperateTypeEnum.YL_WORKER_RETURN.getCode()+"-->"); | ||
| 325 | + AppGardenTaskApproveReqVO returnApproveReqVO = new AppGardenTaskApproveReqVO(); | ||
| 326 | + Integer approveStatus = reqVO.getAgree(); | ||
| 327 | + if (approveStatus == null || (approveStatus != 0 && approveStatus != 1)) { | ||
| 328 | + throw exception(APP_AGREE_CHOOSE); | ||
| 329 | + } | ||
| 330 | + returnApproveReqVO.setAgree(approveStatus); | ||
| 331 | + returnApproveReqVO.setReason(reqVO.getReason()); | ||
| 332 | + returnApproveReqVO.setId(reqVO.getTaskId()); | ||
| 333 | + this.approveTask(returnApproveReqVO); | ||
| 334 | + log.info("当前操作:"+OperateTypeEnum.YL_TEAM_LEADER_RETURN.getDesc()+"<--结束"); | ||
| 335 | + return success(true); | ||
| 336 | + case YL_INSPECTOR_START_FINISH , YL_INSPECTOR_START_RELAUNCH : //巡查员结束工单,巡查员重新发起 | ||
| 337 | + log.info("当前操作:养护组长结束工单(不同意)或巡查员重新发起(同意)开始,是否同意:"+reqVO.getAgree()+"-->"); | ||
| 338 | + AppGardenTaskApproveReqVO inspectStartReqVO = new AppGardenTaskApproveReqVO(); | ||
| 339 | + Integer revokeStatus = reqVO.getAgree(); | ||
| 340 | + if (revokeStatus == null || (revokeStatus != 0 && revokeStatus != 1)) { | ||
| 341 | + throw exception(APP_AGREE_CHOOSE); | ||
| 342 | + } | ||
| 343 | + inspectStartReqVO.setAgree(revokeStatus); | ||
| 344 | + inspectStartReqVO.setReason(reqVO.getReason()); | ||
| 345 | + inspectStartReqVO.setId(reqVO.getTaskId()); | ||
| 346 | + this.approveTask(inspectStartReqVO); | ||
| 347 | + log.info("当前操作:"+OperateTypeEnum.YL_INSPECTOR_START_FINISH.getDesc()+"<--结束"); | ||
| 348 | + return success(true); | ||
| 349 | + case YL_INSPECTOR_CHECK_PASS , YL_INSPECTOR_CHECK_REJECT ://巡查员验收通过,巡查员验收不通过 | ||
| 350 | + log.info("当前操作:巡查员验收通过 或巡查员验收不通过开始,是否同意:"+reqVO.getAgree()+"-->"); | ||
| 351 | + AppGardenTaskApproveReqVO inspectReqVO = new AppGardenTaskApproveReqVO(); | ||
| 352 | + Integer verifyStatus = reqVO.getAgree(); | ||
| 353 | + if (verifyStatus == null || (verifyStatus != 0 && verifyStatus != 1)) { | ||
| 354 | + throw exception(APP_AGREE_CHOOSE); | ||
| 355 | + } | ||
| 356 | + inspectReqVO.setAgree(verifyStatus); | ||
| 357 | + inspectReqVO.setReason(reqVO.getReason()); | ||
| 358 | + inspectReqVO.setId(reqVO.getTaskId()); | ||
| 359 | + this.approveTask(inspectReqVO); | ||
| 360 | + log.info("当前操作:"+OperateTypeEnum.YL_INSPECTOR_START_FINISH.getDesc()+"<--结束"); | ||
| 361 | + return success(true); | ||
| 362 | + default: | ||
| 363 | + throw exception(APP_OPERATOR_NOT_EXISTS); | ||
| 364 | + } | ||
| 365 | + } | ||
| 242 | } | 366 | } |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/controller/app/garden/vo/AppGardenWorkOrderRespVO.java
| @@ -17,12 +17,6 @@ import java.util.List; | @@ -17,12 +17,6 @@ import java.util.List; | ||
| 17 | @Data | 17 | @Data |
| 18 | public class AppGardenWorkOrderRespVO extends MainInfoRespVO { | 18 | public class AppGardenWorkOrderRespVO extends MainInfoRespVO { |
| 19 | 19 | ||
| 20 | - @Schema(description = "问题图片", example = "9184") | ||
| 21 | - private List<String> problemImgsList; | ||
| 22 | - | ||
| 23 | - @Schema(description = "处理完成照片", example = "9184") | ||
| 24 | - private List<String> completeImgsList; | ||
| 25 | - | ||
| 26 | @Schema(description = "任务id") | 20 | @Schema(description = "任务id") |
| 27 | private String taskId; | 21 | private String taskId; |
| 28 | 22 | ||
| @@ -43,4 +37,22 @@ public class AppGardenWorkOrderRespVO extends MainInfoRespVO { | @@ -43,4 +37,22 @@ public class AppGardenWorkOrderRespVO extends MainInfoRespVO { | ||
| 43 | 37 | ||
| 44 | @Schema(description = "流程定义key") | 38 | @Schema(description = "流程定义key") |
| 45 | private String key_; | 39 | private String key_; |
| 40 | + | ||
| 41 | + @Schema(description = "开始的问题拍照图片") | ||
| 42 | + private List<String> problemsImgs; | ||
| 43 | + | ||
| 44 | + @Schema(description = "实施开始的拍照图片") | ||
| 45 | + private List<String> startImgs; | ||
| 46 | + | ||
| 47 | + @Schema(description = "实施中的拍照图片") | ||
| 48 | + private List<String> processingImgs; | ||
| 49 | + | ||
| 50 | + @Schema(description = "实施结束的拍照图片") | ||
| 51 | + private List<String> endImgs; | ||
| 52 | + | ||
| 53 | + @Schema(description = "实施人员的拍照图片") | ||
| 54 | + private List<String> personImgs; | ||
| 55 | + | ||
| 56 | + @Schema(description = "实施耗材的拍照图片") | ||
| 57 | + private List<String> materialImgs; | ||
| 46 | } | 58 | } |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/controller/app/garden/vo/common/AppUniversalApprovalReqVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.workorder.controller.app.garden.vo.common; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import jakarta.validation.constraints.NotEmpty; | ||
| 5 | +import jakarta.validation.constraints.NotNull; | ||
| 6 | +import lombok.Data; | ||
| 7 | +import java.util.List; | ||
| 8 | +import java.util.Set; | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * 类描述:app端统一工作流审批入口 | ||
| 12 | + * 创建人:yanhuiqing | ||
| 13 | + * 创建时间:2025/12/20 10:26 | ||
| 14 | + * 修改人:yanhuiqing | ||
| 15 | + * 修改时间:2025/12/20 10:26 | ||
| 16 | + * 修改备注:优化字段类型,添加业务扩展参数,增加验证分组 | ||
| 17 | + * | ||
| 18 | + * @author yanhuiqing | ||
| 19 | + * @version 1.0 | ||
| 20 | + */ | ||
| 21 | +@Schema(description = "APP - 园林统一审批 通用Request VO") | ||
| 22 | +@Data | ||
| 23 | +public class AppUniversalApprovalReqVO { | ||
| 24 | + // -------------------------- 基础通用参数(所有操作必填) -------------------------- | ||
| 25 | + @Schema(description = "当前任务的taskKey", requiredMode = Schema.RequiredMode.REQUIRED, example = "ylTeamLeader") | ||
| 26 | + @NotEmpty(message = "当前任务的taskKey不能为空") | ||
| 27 | + private String taskKey; | ||
| 28 | + | ||
| 29 | + @Schema(description = "任务编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1234567890") | ||
| 30 | + @NotEmpty(message = "任务编号不能为空") | ||
| 31 | + private String taskId; | ||
| 32 | + | ||
| 33 | + @Schema(description = "操作类型(210:养护组长退回,110:养护组长分配,200:巡查员结束工单,100:巡查员重新发起,220:养护员退回,120:养护员实施,130:养护组长验收通过,230:养护组长验收不通过,140:巡查员验收通过,240:巡查员验收不通过)", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 34 | + @NotNull(message = "操作类型不能为空") | ||
| 35 | + private Integer operateType; // 原String改为Integer,适配数字类型 | ||
| 36 | + | ||
| 37 | + @Schema(description = "同意选择类型:0 同意,1 不同意", requiredMode = Schema.RequiredMode.REQUIRED, example = "0") | ||
| 38 | + //@NotNull(message = "同意选择类型不能为空") | ||
| 39 | + private Integer agree; | ||
| 40 | + | ||
| 41 | + @Schema(description = "操作理由(审批/退回理由)", requiredMode = Schema.RequiredMode.REQUIRED, example = "同意该工单处理结果") | ||
| 42 | + //@NotEmpty(message = "操作理由不能为空") | ||
| 43 | + private String reason; | ||
| 44 | + | ||
| 45 | + @Schema(description = "工单的数据id", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 46 | + //@NotEmpty(message = "工单的数据id不能为空") | ||
| 47 | + private Long workerDataId; | ||
| 48 | + | ||
| 49 | + @Schema(description = "退回时的拍照图片") | ||
| 50 | + private List<String> returnImgs; | ||
| 51 | + // -------------------------- 退回操作专属参数(分组:ReturnGroup) -------------------------- | ||
| 52 | + | ||
| 53 | + // -------------------------- 养护组长分配专属参数(分组:AssignMaintainerGroup) -------------------------- | ||
| 54 | + @Schema(description = "养护员用户ID(养护组长分配操作必填)", example = "user1001") | ||
| 55 | + //@NotEmpty(message = "养护员用户ID不能为空", groups = AssignMaintainerGroup.class) | ||
| 56 | + private Long nextAssignee; | ||
| 57 | + | ||
| 58 | + // -------------------------- 养护员实施专属参数(分组:MaintainerImplementGroup) -------------------------- | ||
| 59 | + @Schema(description = "共同处理人用户ID列表", example = "[111,222]") | ||
| 60 | + private Set<Long> coHandlers; | ||
| 61 | + | ||
| 62 | + @Schema(description = "处理意见(养护员实施操作必填)", example = "已完成绿植修剪,效果符合要求") | ||
| 63 | + //@NotEmpty(message = "处理意见不能为空", groups = MaintainerImplementGroup.class) | ||
| 64 | + private String handleResult; | ||
| 65 | + | ||
| 66 | + @Schema(description = "开始的问题拍照图片") | ||
| 67 | + private List<String> problemsImgs; | ||
| 68 | + | ||
| 69 | + @Schema(description = "实施开始的拍照图片") | ||
| 70 | + private List<String> startImgs; | ||
| 71 | + | ||
| 72 | + @Schema(description = "实施中的拍照图片") | ||
| 73 | + private List<String> processingImgs; | ||
| 74 | + | ||
| 75 | + @Schema(description = "实施结束的拍照图片") | ||
| 76 | + private List<String> endImgs; | ||
| 77 | + | ||
| 78 | + @Schema(description = "实施人员的拍照图片") | ||
| 79 | + private List<String> personImgs; | ||
| 80 | + | ||
| 81 | + @Schema(description = "实施耗材的拍照图片") | ||
| 82 | + private List<String> materialImgs; | ||
| 83 | +} | ||
| 0 | \ No newline at end of file | 84 | \ No newline at end of file |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/controller/app/garden/vo/operator/AppGardenTaskRejectExtReqVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.workorder.controller.app.garden.vo.operator; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import jakarta.validation.constraints.NotEmpty; | ||
| 5 | +import lombok.Data; | ||
| 6 | + | ||
| 7 | +import java.util.List; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * 类描述:园林app端拒绝任务的reqVO | ||
| 11 | + * 创建人:yanhuiqing | ||
| 12 | + * 创建时间:2025/12/19 10:55 | ||
| 13 | + * 修改人:yanhuiqing | ||
| 14 | + * 修改时间:2025/12/19 10:55 | ||
| 15 | + * 修改备注: | ||
| 16 | + * | ||
| 17 | + * @author yanhuiqing | ||
| 18 | + * @version 1.0 | ||
| 19 | + */ | ||
| 20 | +@Schema(description = "APP - 驳回的流程任务的 Request VO") | ||
| 21 | +@Data | ||
| 22 | +public class AppGardenTaskRejectExtReqVO { | ||
| 23 | + | ||
| 24 | + @Schema(description = "任务编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | ||
| 25 | + @NotEmpty(message = "任务编号不能为空") | ||
| 26 | + private String id; | ||
| 27 | + | ||
| 28 | + @Schema(description = "退回意见", requiredMode = Schema.RequiredMode.REQUIRED, example = "我就是想驳回") | ||
| 29 | + @NotEmpty(message = "退回意见不能为空") | ||
| 30 | + private String reason; | ||
| 31 | + | ||
| 32 | + @Schema(description = "工单的数据id", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 33 | + //@NotEmpty(message = "工单的数据id不能为空") | ||
| 34 | + private Long workerDataId; | ||
| 35 | + | ||
| 36 | + @Schema(description = "退回时的拍照图片") | ||
| 37 | + private List<String> returnImgs; | ||
| 38 | + | ||
| 39 | +} | ||
| 0 | \ No newline at end of file | 40 | \ No newline at end of file |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/controller/app/garden/vo/operator/AppGardenTaskTeamLeaderAssignReqVO.java
| @@ -29,4 +29,8 @@ public class AppGardenTaskTeamLeaderAssignReqVO { | @@ -29,4 +29,8 @@ public class AppGardenTaskTeamLeaderAssignReqVO { | ||
| 29 | @Schema(description = "养护员userId") | 29 | @Schema(description = "养护员userId") |
| 30 | @NotNull(message = "养护员不能为空") | 30 | @NotNull(message = "养护员不能为空") |
| 31 | private Long nextAssignee; | 31 | private Long nextAssignee; |
| 32 | + | ||
| 33 | + @Schema(description = "同意选择类型:0 同意,1 不同意", example = "0") | ||
| 34 | + //@NotNull(message = "同意选择类型不能为空") | ||
| 35 | + private Integer agree; | ||
| 32 | } | 36 | } |
| 33 | \ No newline at end of file | 37 | \ No newline at end of file |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/controller/app/garden/vo/operator/AppGardenTaskWorkerExcuteReqVO.java
| @@ -41,9 +41,18 @@ public class AppGardenTaskWorkerExcuteReqVO { | @@ -41,9 +41,18 @@ public class AppGardenTaskWorkerExcuteReqVO { | ||
| 41 | @Schema(description = "开始的问题拍照图片") | 41 | @Schema(description = "开始的问题拍照图片") |
| 42 | private List<String> problemsImgs; | 42 | private List<String> problemsImgs; |
| 43 | 43 | ||
| 44 | + @Schema(description = "实施开始的拍照图片") | ||
| 45 | + private List<String> startImgs; | ||
| 46 | + | ||
| 44 | @Schema(description = "实施中的拍照图片") | 47 | @Schema(description = "实施中的拍照图片") |
| 45 | - private List<String> handingImgs; | 48 | + private List<String> processingImgs; |
| 46 | 49 | ||
| 47 | @Schema(description = "实施结束的拍照图片") | 50 | @Schema(description = "实施结束的拍照图片") |
| 48 | - private List<String> handledImgs; | 51 | + private List<String> endImgs; |
| 52 | + | ||
| 53 | + @Schema(description = "实施人员的拍照图片") | ||
| 54 | + private List<String> personImgs; | ||
| 55 | + | ||
| 56 | + @Schema(description = "实施耗材的拍照图片") | ||
| 57 | + private List<String> materialImgs; | ||
| 49 | } | 58 | } |
| 50 | \ No newline at end of file | 59 | \ No newline at end of file |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/controller/app/garden/vo/task/AppGardenTaskApproveReqVO.java
| @@ -29,4 +29,8 @@ public class AppGardenTaskApproveReqVO { | @@ -29,4 +29,8 @@ public class AppGardenTaskApproveReqVO { | ||
| 29 | @Schema(description = "审批意见", example = "通过!") | 29 | @Schema(description = "审批意见", example = "通过!") |
| 30 | private String reason; | 30 | private String reason; |
| 31 | 31 | ||
| 32 | + @Schema(description = "同意选择类型:0 同意,1 不同意", example = "0") | ||
| 33 | + //@NotNull(message = "同意选择类型不能为空") | ||
| 34 | + private Integer agree; | ||
| 35 | + | ||
| 32 | } | 36 | } |
| 33 | \ No newline at end of file | 37 | \ No newline at end of file |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/convert/garden/AppGardenTaskConvert.java
| @@ -142,14 +142,44 @@ public interface AppGardenTaskConvert { | @@ -142,14 +142,44 @@ public interface AppGardenTaskConvert { | ||
| 142 | source.getOrderNo(), | 142 | source.getOrderNo(), |
| 143 | attachmentMapper | 143 | attachmentMapper |
| 144 | ); | 144 | ); |
| 145 | - List<String> completeImgsList = queryAttachment( | 145 | + List<String> startImgsList = queryAttachment( |
| 146 | source.getBusiLine(), | 146 | source.getBusiLine(), |
| 147 | - BpmCommonConstant.RESULT_IMG_GROUP, | 147 | + BpmCommonConstant.START_IMG_GROUP, |
| 148 | source.getOrderNo(), | 148 | source.getOrderNo(), |
| 149 | attachmentMapper | 149 | attachmentMapper |
| 150 | ); | 150 | ); |
| 151 | - target.setProblemImgsList(problemImgsList); | ||
| 152 | - target.setCompleteImgsList(completeImgsList); | 151 | + List<String> processImgsList = queryAttachment( |
| 152 | + source.getBusiLine(), | ||
| 153 | + BpmCommonConstant.PROCESS_IMG_GROUP, | ||
| 154 | + source.getOrderNo(), | ||
| 155 | + attachmentMapper | ||
| 156 | + ); | ||
| 157 | + | ||
| 158 | + List<String> endImgsList = queryAttachment( | ||
| 159 | + source.getBusiLine(), | ||
| 160 | + BpmCommonConstant.END_IMG_GROUP, | ||
| 161 | + source.getOrderNo(), | ||
| 162 | + attachmentMapper | ||
| 163 | + ); | ||
| 164 | + List<String> personImgsList = queryAttachment( | ||
| 165 | + source.getBusiLine(), | ||
| 166 | + BpmCommonConstant.PERSON_IMG_GROUP, | ||
| 167 | + source.getOrderNo(), | ||
| 168 | + attachmentMapper | ||
| 169 | + ); | ||
| 170 | + | ||
| 171 | + List<String> matirialImgsList = queryAttachment( | ||
| 172 | + source.getBusiLine(), | ||
| 173 | + BpmCommonConstant.MATERIAL_IMG_GROUP, | ||
| 174 | + source.getOrderNo(), | ||
| 175 | + attachmentMapper | ||
| 176 | + ); | ||
| 177 | + target.setProblemsImgs(problemImgsList); | ||
| 178 | + target.setStartImgs(startImgsList); | ||
| 179 | + target.setProcessingImgs(processImgsList); | ||
| 180 | + target.setEndImgs(endImgsList); | ||
| 181 | + target.setPersonImgs(personImgsList); | ||
| 182 | + target.setMaterialImgs(matirialImgsList); | ||
| 153 | 183 | ||
| 154 | return target; | 184 | return target; |
| 155 | } | 185 | } |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/convert/garden/BpmGardenWorkOrderConverter.java
| @@ -53,7 +53,7 @@ public class BpmGardenWorkOrderConverter { | @@ -53,7 +53,7 @@ public class BpmGardenWorkOrderConverter { | ||
| 53 | ); | 53 | ); |
| 54 | List<String> completeImgsList = queryAttachment( | 54 | List<String> completeImgsList = queryAttachment( |
| 55 | source.getBusiLine(), | 55 | source.getBusiLine(), |
| 56 | - BpmCommonConstant.RESULT_IMG_GROUP, | 56 | + BpmCommonConstant.PROCESS_IMG_GROUP, |
| 57 | source.getOrderNo(), | 57 | source.getOrderNo(), |
| 58 | attachmentMapper | 58 | attachmentMapper |
| 59 | ); | 59 | ); |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/dal/mysql/maininfo/MainInfoExtMapper.java
| @@ -36,8 +36,10 @@ public interface MainInfoExtMapper extends BaseMapperX<MainInfoDO> { | @@ -36,8 +36,10 @@ public interface MainInfoExtMapper extends BaseMapperX<MainInfoDO> { | ||
| 36 | "SELECT", | 36 | "SELECT", |
| 37 | " m.*,", | 37 | " m.*,", |
| 38 | " t.ID_ AS task_id,", | 38 | " t.ID_ AS task_id,", |
| 39 | - " t.NAME_ AS task_name,", | ||
| 40 | - " t.task_def_key_ as task_key,", | 39 | + /*"t.NAME_ AS task_name,", |
| 40 | + "t.task_def_key_ AS task_key,",*/ | ||
| 41 | + " '' AS task_name,", | ||
| 42 | + " '' AS task_key,", | ||
| 41 | " pd.NAME_ AS process_definition_name,", | 43 | " pd.NAME_ AS process_definition_name,", |
| 42 | " t.START_TIME_,", | 44 | " t.START_TIME_,", |
| 43 | " t.END_TIME_,", | 45 | " t.END_TIME_,", |
| @@ -249,8 +251,10 @@ public interface MainInfoExtMapper extends BaseMapperX<MainInfoDO> { | @@ -249,8 +251,10 @@ public interface MainInfoExtMapper extends BaseMapperX<MainInfoDO> { | ||
| 249 | "SELECT", | 251 | "SELECT", |
| 250 | "m.*,", | 252 | "m.*,", |
| 251 | "t.ID_ AS task_id,", | 253 | "t.ID_ AS task_id,", |
| 252 | - "t.NAME_ AS task_name,", | ||
| 253 | - "t.task_def_key_ AS task_key,", | 254 | + /*"t.NAME_ AS task_name,", |
| 255 | + "t.task_def_key_ AS task_key,",*/ | ||
| 256 | + "'' AS task_name,", | ||
| 257 | + "'' AS task_key,", | ||
| 254 | "pd.NAME_ AS process_definition_name,", | 258 | "pd.NAME_ AS process_definition_name,", |
| 255 | "t.START_TIME_ ,", | 259 | "t.START_TIME_ ,", |
| 256 | "t.END_TIME_,", | 260 | "t.END_TIME_,", |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/enums/AgreeTypeEnum.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 | + * 类描述:同意类型枚举(0:同意,1:不同意) | ||
| 11 | + * 创建人:yanhuiqing | ||
| 12 | + * 创建时间:2025/12/20 12:00 | ||
| 13 | + * 修改人:yanhuiqing | ||
| 14 | + * 修改时间:2025/12/20 12:00 | ||
| 15 | + * 修改备注: | ||
| 16 | + * | ||
| 17 | + * @author yanhuiqing | ||
| 18 | + * @version 1.0 | ||
| 19 | + */ | ||
| 20 | +@Schema(description = "同意类型枚举") | ||
| 21 | +@Getter | ||
| 22 | +public enum AgreeTypeEnum { | ||
| 23 | + AGREE(0, "同意"), | ||
| 24 | + DISAGREE(1, "不同意"); | ||
| 25 | + | ||
| 26 | + @JsonValue // 序列化时返回code(前端接收数字) | ||
| 27 | + private final Integer code; | ||
| 28 | + private final String desc; | ||
| 29 | + | ||
| 30 | + AgreeTypeEnum(Integer code, String desc) { | ||
| 31 | + this.code = code; | ||
| 32 | + this.desc = desc; | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + // 根据code获取枚举(业务层转换用) | ||
| 36 | + public static AgreeTypeEnum getByCode(Integer code) { | ||
| 37 | + return Arrays.stream(values()) | ||
| 38 | + .filter(e -> e.getCode().equals(code)) | ||
| 39 | + .findFirst() | ||
| 40 | + .orElseThrow(() -> new IllegalArgumentException("无效的同意类型:" + code)); | ||
| 41 | + } | ||
| 42 | +} | ||
| 0 | \ No newline at end of file | 43 | \ No newline at end of file |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/enums/ErrorCodeConstants.java
| @@ -18,4 +18,10 @@ public interface ErrorCodeConstants { | @@ -18,4 +18,10 @@ public interface ErrorCodeConstants { | ||
| 18 | ErrorCode MATERIAL_DETAIL_NOT_EXISTS = new ErrorCode(1-900-001-002, "工单耗材明细不存在"); | 18 | ErrorCode MATERIAL_DETAIL_NOT_EXISTS = new ErrorCode(1-900-001-002, "工单耗材明细不存在"); |
| 19 | 19 | ||
| 20 | ErrorCode TEAM_LEADER_YL_NOT_EXISTS = new ErrorCode(1-900-001-003, "养护班组长人员不存在"); | 20 | ErrorCode TEAM_LEADER_YL_NOT_EXISTS = new ErrorCode(1-900-001-003, "养护班组长人员不存在"); |
| 21 | + | ||
| 22 | + ErrorCode APP_AGREE_CHOOSE = new ErrorCode(1-900-001-004, "agree状态只能为0或1"); | ||
| 23 | + | ||
| 24 | + ErrorCode APP_OPERATOR_NOT_EXISTS = new ErrorCode(1-900-001-004, "无此操作类型!"); | ||
| 25 | + | ||
| 26 | + ErrorCode APP_WORKER_NOT_EXISTS = new ErrorCode(1-900-001-004, "养护员必须指派,不能为空!"); | ||
| 21 | } | 27 | } |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/enums/OperateTypeEnum.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 | +import java.util.Arrays; | ||
| 7 | +/** | ||
| 8 | + * 类描述:园林审批操作类型枚举(对应业务1-12的操作类型) | ||
| 9 | + * 创建人:yanhuiqing | ||
| 10 | + * 创建时间:2025/12/20 12:01 | ||
| 11 | + * 修改人:yanhuiqing | ||
| 12 | + * 修改时间:2025/12/20 12:01 | ||
| 13 | + * 修改备注: | ||
| 14 | + * | ||
| 15 | + * @author yanhuiqing | ||
| 16 | + * @version 1.0 | ||
| 17 | + */ | ||
| 18 | +@Schema(description = "园林审批操作类型枚举") | ||
| 19 | +@Getter | ||
| 20 | +public enum OperateTypeEnum { | ||
| 21 | + YL_TEAM_LEADER_ASSIGN(110, "养护组长分配"), | ||
| 22 | + YL_TEAM_LEADER_RETURN(210, "养护组长退回"), | ||
| 23 | + YL_WORKER_IMPLEMENT(120, "养护员实施"), | ||
| 24 | + YL_WORKER_RETURN(220, "养护员退回"), | ||
| 25 | + YL_TEAM_LEADER_CONFIRM_PASS(130, "养护组长验收通过"), | ||
| 26 | + YL_TEAM_LEADER_CONFIRM_REJECT(230, "养护组长验收不通过"), | ||
| 27 | + YL_INSPECTOR_CHECK_PASS(140, "巡查员验收通过"), | ||
| 28 | + YL_INSPECTOR_CHECK_REJECT(240, "巡查员验收不通过"), | ||
| 29 | + YL_INSPECTOR_START_FINISH(200, "巡查员结束工单(不同意)"), | ||
| 30 | + YL_INSPECTOR_START_RELAUNCH(100, "巡查员重新发起(同意)"); | ||
| 31 | + | ||
| 32 | + @JsonValue // 序列化时返回code(前端接收数字) | ||
| 33 | + private final Integer code; | ||
| 34 | + private final String desc; | ||
| 35 | + | ||
| 36 | + OperateTypeEnum(Integer code, String desc) { | ||
| 37 | + this.code = code; | ||
| 38 | + this.desc = desc; | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + // 根据code获取枚举(业务层转换用) | ||
| 42 | + public static OperateTypeEnum getByCode(Integer code) { | ||
| 43 | + return Arrays.stream(values()) | ||
| 44 | + .filter(e -> e.getCode().equals(code)) | ||
| 45 | + .findFirst() | ||
| 46 | + .orElseThrow(() -> new IllegalArgumentException("无效的操作类型:" + code)); | ||
| 47 | + } | ||
| 48 | +} | ||
| 0 | \ No newline at end of file | 49 | \ No newline at end of file |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/service/garden/BpmGardenService.java
| @@ -6,6 +6,7 @@ import com.zteits.urbanops.module.system.api.user.dto.AdminUserRespDTO; | @@ -6,6 +6,7 @@ import com.zteits.urbanops.module.system.api.user.dto.AdminUserRespDTO; | ||
| 6 | import com.zteits.urbanops.module.workorder.controller.admin.garden.vo.BpmGardenWorkOrderCreateReqVO; | 6 | import com.zteits.urbanops.module.workorder.controller.admin.garden.vo.BpmGardenWorkOrderCreateReqVO; |
| 7 | import com.zteits.urbanops.module.workorder.controller.admin.garden.vo.BpmGardenWorkOrderPageReqVO; | 7 | import com.zteits.urbanops.module.workorder.controller.admin.garden.vo.BpmGardenWorkOrderPageReqVO; |
| 8 | import com.zteits.urbanops.module.workorder.controller.app.garden.vo.*; | 8 | import com.zteits.urbanops.module.workorder.controller.app.garden.vo.*; |
| 9 | +import com.zteits.urbanops.module.workorder.controller.app.garden.vo.operator.AppGardenTaskRejectExtReqVO; | ||
| 9 | import com.zteits.urbanops.module.workorder.controller.app.garden.vo.operator.AppGardenTaskReturnExtReqVO; | 10 | import com.zteits.urbanops.module.workorder.controller.app.garden.vo.operator.AppGardenTaskReturnExtReqVO; |
| 10 | import com.zteits.urbanops.module.workorder.controller.app.garden.vo.operator.AppGardenTaskTeamLeaderAssignReqVO; | 11 | import com.zteits.urbanops.module.workorder.controller.app.garden.vo.operator.AppGardenTaskTeamLeaderAssignReqVO; |
| 11 | import com.zteits.urbanops.module.workorder.controller.app.garden.vo.operator.AppGardenTaskWorkerExcuteReqVO; | 12 | import com.zteits.urbanops.module.workorder.controller.app.garden.vo.operator.AppGardenTaskWorkerExcuteReqVO; |
| @@ -113,6 +114,12 @@ public interface BpmGardenService { | @@ -113,6 +114,12 @@ public interface BpmGardenService { | ||
| 113 | void returnPreviousNode(AppGardenTaskReturnExtReqVO reqVO); | 114 | void returnPreviousNode(AppGardenTaskReturnExtReqVO reqVO); |
| 114 | 115 | ||
| 115 | /** | 116 | /** |
| 117 | + * 驳回任务 -app端 | ||
| 118 | + * @param reqVO | ||
| 119 | + */ | ||
| 120 | + void rejectTask(AppGardenTaskRejectExtReqVO reqVO); | ||
| 121 | + | ||
| 122 | + /** | ||
| 116 | * 撤回任务 -app端 | 123 | * 撤回任务 -app端 |
| 117 | * @param taskId | 124 | * @param taskId |
| 118 | */ | 125 | */ |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/service/garden/BpmGardenServiceImpl.java
| @@ -2,12 +2,10 @@ package com.zteits.urbanops.module.workorder.service.garden; | @@ -2,12 +2,10 @@ package com.zteits.urbanops.module.workorder.service.garden; | ||
| 2 | 2 | ||
| 3 | import cn.hutool.core.collection.CollUtil; | 3 | import cn.hutool.core.collection.CollUtil; |
| 4 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 4 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| 5 | -import com.baomidou.mybatisplus.core.metadata.IPage; | ||
| 6 | import com.zteits.urbanops.framework.common.pojo.PageParam; | 5 | import com.zteits.urbanops.framework.common.pojo.PageParam; |
| 7 | import com.zteits.urbanops.framework.common.pojo.PageResult; | 6 | import com.zteits.urbanops.framework.common.pojo.PageResult; |
| 8 | import com.zteits.urbanops.framework.common.util.object.BeanUtils; | 7 | import com.zteits.urbanops.framework.common.util.object.BeanUtils; |
| 9 | import com.zteits.urbanops.framework.common.util.object.ObjectUtils; | 8 | import com.zteits.urbanops.framework.common.util.object.ObjectUtils; |
| 10 | -import com.zteits.urbanops.framework.mybatis.core.util.MyBatisUtils; | ||
| 11 | import com.zteits.urbanops.framework.security.core.util.SecurityFrameworkUtils; | 9 | import com.zteits.urbanops.framework.security.core.util.SecurityFrameworkUtils; |
| 12 | import com.zteits.urbanops.module.bpm.api.task.BpmProcessInstanceApi; | 10 | import com.zteits.urbanops.module.bpm.api.task.BpmProcessInstanceApi; |
| 13 | import com.zteits.urbanops.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO; | 11 | import com.zteits.urbanops.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO; |
| @@ -26,11 +24,11 @@ import com.zteits.urbanops.module.system.api.user.AdminUserApi; | @@ -26,11 +24,11 @@ import com.zteits.urbanops.module.system.api.user.AdminUserApi; | ||
| 26 | import com.zteits.urbanops.module.system.api.user.dto.AdminUserRespDTO; | 24 | import com.zteits.urbanops.module.system.api.user.dto.AdminUserRespDTO; |
| 27 | import com.zteits.urbanops.module.workorder.api.constant.BpmCommonConstant; | 25 | import com.zteits.urbanops.module.workorder.api.constant.BpmCommonConstant; |
| 28 | import com.zteits.urbanops.module.workorder.api.workorder.WorkOrderApi; | 26 | import com.zteits.urbanops.module.workorder.api.workorder.WorkOrderApi; |
| 29 | -import com.zteits.urbanops.module.workorder.controller.admin.garden.vo.BpmGardenWorkOrderCreateReqVO; | ||
| 30 | import com.zteits.urbanops.module.workorder.controller.admin.garden.vo.BpmGardenWorkOrderPageReqVO; | 27 | import com.zteits.urbanops.module.workorder.controller.admin.garden.vo.BpmGardenWorkOrderPageReqVO; |
| 31 | import com.zteits.urbanops.module.workorder.controller.admin.maininfo.vo.MainInfoHasTaskPageReqVO; | 28 | import com.zteits.urbanops.module.workorder.controller.admin.maininfo.vo.MainInfoHasTaskPageReqVO; |
| 32 | import com.zteits.urbanops.module.workorder.controller.admin.maininfo.vo.MainInfoPageReqVO; | 29 | import com.zteits.urbanops.module.workorder.controller.admin.maininfo.vo.MainInfoPageReqVO; |
| 33 | import com.zteits.urbanops.module.workorder.controller.app.garden.vo.*; | 30 | import com.zteits.urbanops.module.workorder.controller.app.garden.vo.*; |
| 31 | +import com.zteits.urbanops.module.workorder.controller.app.garden.vo.operator.AppGardenTaskRejectExtReqVO; | ||
| 34 | import com.zteits.urbanops.module.workorder.controller.app.garden.vo.operator.AppGardenTaskReturnExtReqVO; | 32 | import com.zteits.urbanops.module.workorder.controller.app.garden.vo.operator.AppGardenTaskReturnExtReqVO; |
| 35 | import com.zteits.urbanops.module.workorder.controller.app.garden.vo.operator.AppGardenTaskTeamLeaderAssignReqVO; | 33 | import com.zteits.urbanops.module.workorder.controller.app.garden.vo.operator.AppGardenTaskTeamLeaderAssignReqVO; |
| 36 | import com.zteits.urbanops.module.workorder.controller.app.garden.vo.operator.AppGardenTaskWorkerExcuteReqVO; | 34 | import com.zteits.urbanops.module.workorder.controller.app.garden.vo.operator.AppGardenTaskWorkerExcuteReqVO; |
| @@ -61,7 +59,6 @@ import java.time.LocalDateTime; | @@ -61,7 +59,6 @@ import java.time.LocalDateTime; | ||
| 61 | import java.util.HashMap; | 59 | import java.util.HashMap; |
| 62 | import java.util.List; | 60 | import java.util.List; |
| 63 | import java.util.Map; | 61 | import java.util.Map; |
| 64 | -import java.util.Set; | ||
| 65 | import java.util.stream.Collectors; | 62 | import java.util.stream.Collectors; |
| 66 | 63 | ||
| 67 | import static com.zteits.urbanops.framework.common.exception.enums.GlobalErrorCodeConstants.BAD_REQUEST; | 64 | import static com.zteits.urbanops.framework.common.exception.enums.GlobalErrorCodeConstants.BAD_REQUEST; |
| @@ -69,8 +66,7 @@ import static com.zteits.urbanops.framework.common.exception.util.ServiceExcepti | @@ -69,8 +66,7 @@ import static com.zteits.urbanops.framework.common.exception.util.ServiceExcepti | ||
| 69 | import static com.zteits.urbanops.framework.common.exception.util.ServiceExceptionUtil.exception0; | 66 | import static com.zteits.urbanops.framework.common.exception.util.ServiceExceptionUtil.exception0; |
| 70 | import static com.zteits.urbanops.framework.common.util.collection.CollectionUtils.convertSet; | 67 | import static com.zteits.urbanops.framework.common.util.collection.CollectionUtils.convertSet; |
| 71 | import static com.zteits.urbanops.framework.web.core.util.WebFrameworkUtils.getLoginUserId; | 68 | import static com.zteits.urbanops.framework.web.core.util.WebFrameworkUtils.getLoginUserId; |
| 72 | -import static com.zteits.urbanops.module.workorder.enums.ErrorCodeConstants.MAIN_INFO_NOT_EXISTS; | ||
| 73 | -import static com.zteits.urbanops.module.workorder.enums.ErrorCodeConstants.TEAM_LEADER_YL_NOT_EXISTS; | 69 | +import static com.zteits.urbanops.module.workorder.enums.ErrorCodeConstants.*; |
| 74 | 70 | ||
| 75 | /** | 71 | /** |
| 76 | * @author yanhuiqing | 72 | * @author yanhuiqing |
| @@ -148,9 +144,6 @@ public class BpmGardenServiceImpl implements BpmGardenService{ | @@ -148,9 +144,6 @@ public class BpmGardenServiceImpl implements BpmGardenService{ | ||
| 148 | attachmentApend(imgList,null,longRangeImgList,workOrder); | 144 | attachmentApend(imgList,null,longRangeImgList,workOrder); |
| 149 | // 发起 BPM 流程 | 145 | // 发起 BPM 流程 |
| 150 | Map<String, Object> processInstanceVariables = new HashMap<>(); | 146 | Map<String, Object> processInstanceVariables = new HashMap<>(); |
| 151 | - //processInstanceVariables.put("workOrder", workOrder); | ||
| 152 | - //processInstanceVariables.put("imgList", imgList); | ||
| 153 | - //processInstanceVariables.put("longRangeImgList", longRangeImgList); | ||
| 154 | processInstanceVariables.put("initiator", SecurityFrameworkUtils.getLoginUserId()); | 147 | processInstanceVariables.put("initiator", SecurityFrameworkUtils.getLoginUserId()); |
| 155 | 148 | ||
| 156 | String processInstanceId = processInstanceApi.createProcessInstance(SecurityFrameworkUtils.getLoginUserId(), | 149 | String processInstanceId = processInstanceApi.createProcessInstance(SecurityFrameworkUtils.getLoginUserId(), |
| @@ -183,6 +176,16 @@ public class BpmGardenServiceImpl implements BpmGardenService{ | @@ -183,6 +176,16 @@ public class BpmGardenServiceImpl implements BpmGardenService{ | ||
| 183 | Map<String, Object> variables = new HashMap<>(); | 176 | Map<String, Object> variables = new HashMap<>(); |
| 184 | //审批通过 | 177 | //审批通过 |
| 185 | variables.put(BpmnVariableConstants.PROCESS_INSTANCE_VARIABLE_STATUS,BpmTaskStatusEnum.APPROVE.getStatus()); | 178 | variables.put(BpmnVariableConstants.PROCESS_INSTANCE_VARIABLE_STATUS,BpmTaskStatusEnum.APPROVE.getStatus()); |
| 179 | + Integer status = reqVO.getAgree(); | ||
| 180 | + if(status == null || status == 1){//status == null 此处是为了兼容老接口,防止前段少改造 | ||
| 181 | + variables.put("isNeed",false); | ||
| 182 | + variables.put("isRevoke",false); | ||
| 183 | + variables.put("isVerify",false); | ||
| 184 | + }else { | ||
| 185 | + variables.put("isNeed",true); | ||
| 186 | + variables.put("isRevoke",true); | ||
| 187 | + variables.put("isVerify",true); | ||
| 188 | + } | ||
| 186 | targetVO.setVariables(variables); | 189 | targetVO.setVariables(variables); |
| 187 | //TODO 审批候选人需要赋值 | 190 | //TODO 审批候选人需要赋值 |
| 188 | Map<String, List<Long>> nextAssignees = new HashMap<>(); | 191 | Map<String, List<Long>> nextAssignees = new HashMap<>(); |
| @@ -197,6 +200,12 @@ public class BpmGardenServiceImpl implements BpmGardenService{ | @@ -197,6 +200,12 @@ public class BpmGardenServiceImpl implements BpmGardenService{ | ||
| 197 | //审批通过 | 200 | //审批通过 |
| 198 | variables.put(BpmnVariableConstants.PROCESS_INSTANCE_VARIABLE_STATUS,BpmTaskStatusEnum.APPROVE.getStatus()); | 201 | variables.put(BpmnVariableConstants.PROCESS_INSTANCE_VARIABLE_STATUS,BpmTaskStatusEnum.APPROVE.getStatus()); |
| 199 | variables.put("ylWorkerId",reqVO.getNextAssignee()); | 202 | variables.put("ylWorkerId",reqVO.getNextAssignee()); |
| 203 | + Integer status = reqVO.getAgree(); | ||
| 204 | + if(status == null || status == 0){//status == null 此处是为了兼容老接口,防止前段少改造 | ||
| 205 | + variables.put("isNeed",true); | ||
| 206 | + }else { | ||
| 207 | + variables.put("isNeed",false); | ||
| 208 | + } | ||
| 200 | targetVO.setVariables(variables); | 209 | targetVO.setVariables(variables); |
| 201 | Map<String, List<Long>> nextAssignees = new HashMap<>(); | 210 | Map<String, List<Long>> nextAssignees = new HashMap<>(); |
| 202 | targetVO.setNextAssignees(nextAssignees); | 211 | targetVO.setNextAssignees(nextAssignees); |
| @@ -214,22 +223,35 @@ public class BpmGardenServiceImpl implements BpmGardenService{ | @@ -214,22 +223,35 @@ public class BpmGardenServiceImpl implements BpmGardenService{ | ||
| 214 | targetVO.setVariables(variables); | 223 | targetVO.setVariables(variables); |
| 215 | 224 | ||
| 216 | Long id = reqVO.getWorkerDataId(); | 225 | Long id = reqVO.getWorkerDataId(); |
| 217 | - List<String> handingImgs = reqVO.getHandingImgs(); | ||
| 218 | - List<String> handledImgs = reqVO.getHandledImgs(); | ||
| 219 | List<String> problemsImgs = reqVO.getProblemsImgs(); | 226 | List<String> problemsImgs = reqVO.getProblemsImgs(); |
| 227 | + List<String> startImgs = reqVO.getStartImgs(); | ||
| 228 | + List<String> processingImgs = reqVO.getProcessingImgs(); | ||
| 229 | + List<String> endImgs = reqVO.getEndImgs(); | ||
| 230 | + List<String> personImgs = reqVO.getPersonImgs(); | ||
| 231 | + List<String> materialImgs = reqVO.getMaterialImgs(); | ||
| 220 | MainInfoDO workerOrder = workOrderMapper.selectById(id); | 232 | MainInfoDO workerOrder = workOrderMapper.selectById(id); |
| 221 | workerOrder.setHandleResult(reqVO.getHandleResult()); | 233 | workerOrder.setHandleResult(reqVO.getHandleResult()); |
| 222 | workerOrder.setCoHandlers(reqVO.getCoHandlers()); | 234 | workerOrder.setCoHandlers(reqVO.getCoHandlers()); |
| 223 | workOrderMapper.updateById(workerOrder); | 235 | workOrderMapper.updateById(workerOrder); |
| 224 | 236 | ||
| 225 | if(ObjectUtils.isNotAllEmpty(id) && ObjectUtils.isNotAllEmpty(problemsImgs) && problemsImgs.size()>0){ | 237 | if(ObjectUtils.isNotAllEmpty(id) && ObjectUtils.isNotAllEmpty(problemsImgs) && problemsImgs.size()>0){ |
| 226 | - attachmentInsertOrUpdate(problemsImgs,BpmCommonConstant.HANDLE_IMG_GROUP,workerOrder); | 238 | + attachmentInsertOrUpdate(problemsImgs,BpmCommonConstant.PROBLEM_IMG_GROUP,workerOrder); |
| 239 | + } | ||
| 240 | + if(ObjectUtils.isNotAllEmpty(id) && ObjectUtils.isNotAllEmpty(startImgs) && startImgs.size()>0){ | ||
| 241 | + attachmentInsertOrUpdate(startImgs,BpmCommonConstant.START_IMG_GROUP,workerOrder); | ||
| 242 | + } | ||
| 243 | + if(ObjectUtils.isNotAllEmpty(id) && ObjectUtils.isNotAllEmpty(processingImgs) && processingImgs.size()>0){ | ||
| 244 | + attachmentInsertOrUpdate(processingImgs,BpmCommonConstant.PROCESS_IMG_GROUP,workerOrder); | ||
| 245 | + } | ||
| 246 | + | ||
| 247 | + if(ObjectUtils.isNotAllEmpty(id) && ObjectUtils.isNotAllEmpty(endImgs) && endImgs.size()>0){ | ||
| 248 | + attachmentInsertOrUpdate(endImgs,BpmCommonConstant.END_IMG_GROUP,workerOrder); | ||
| 227 | } | 249 | } |
| 228 | - if(ObjectUtils.isNotAllEmpty(id) && ObjectUtils.isNotAllEmpty(handingImgs) && handingImgs.size()>0){ | ||
| 229 | - attachmentInsertOrUpdate(handingImgs,BpmCommonConstant.HANDLE_IMG_GROUP,workerOrder); | 250 | + if(ObjectUtils.isNotAllEmpty(id) && ObjectUtils.isNotAllEmpty(personImgs) && personImgs.size()>0){ |
| 251 | + attachmentInsertOrUpdate(personImgs,BpmCommonConstant.PERSON_IMG_GROUP,workerOrder); | ||
| 230 | } | 252 | } |
| 231 | - if(ObjectUtils.isNotAllEmpty(id) && ObjectUtils.isNotAllEmpty(handledImgs) && handledImgs.size()>0){ | ||
| 232 | - attachmentInsertOrUpdate(handledImgs,BpmCommonConstant.RESULT_IMG_GROUP,workerOrder); | 253 | + if(ObjectUtils.isNotAllEmpty(id) && ObjectUtils.isNotAllEmpty(materialImgs) && materialImgs.size()>0){ |
| 254 | + attachmentInsertOrUpdate(materialImgs,BpmCommonConstant.MATERIAL_IMG_GROUP,workerOrder); | ||
| 233 | } | 255 | } |
| 234 | taskService.approveTask(SecurityFrameworkUtils.getLoginUserId(),targetVO); | 256 | taskService.approveTask(SecurityFrameworkUtils.getLoginUserId(),targetVO); |
| 235 | 257 | ||
| @@ -247,9 +269,21 @@ public class BpmGardenServiceImpl implements BpmGardenService{ | @@ -247,9 +269,21 @@ public class BpmGardenServiceImpl implements BpmGardenService{ | ||
| 247 | @Transactional(rollbackFor = Exception.class) | 269 | @Transactional(rollbackFor = Exception.class) |
| 248 | public void returnPreviousNode(AppGardenTaskReturnExtReqVO reqVO) { | 270 | public void returnPreviousNode(AppGardenTaskReturnExtReqVO reqVO) { |
| 249 | BpmTaskReturnReqVO targetVO = BeanUtils.toBean(reqVO,BpmTaskReturnReqVO.class); | 271 | BpmTaskReturnReqVO targetVO = BeanUtils.toBean(reqVO,BpmTaskReturnReqVO.class); |
| 250 | - targetVO.setTargetTaskDefinitionKey(TaskNodeUtils.getPreviousNodeName(reqVO.getCurTaskKey())); | 272 | + String currentTaskey = reqVO.getCurTaskKey(); |
| 273 | + targetVO.setTargetTaskDefinitionKey(TaskNodeUtils.getPreviousNodeName(currentTaskey)); | ||
| 251 | Long userId = SecurityFrameworkUtils.getLoginUserId(); | 274 | Long userId = SecurityFrameworkUtils.getLoginUserId(); |
| 252 | taskService.returnTask(userId, targetVO); | 275 | taskService.returnTask(userId, targetVO); |
| 276 | + | ||
| 277 | + /*if(TaskNodeEnum.YL_TEAM_LEADER.getNodeName().equals(currentTaskey)){ | ||
| 278 | + Task task = taskService.getTask(reqVO.getId()); | ||
| 279 | + String processInstanceId = task.getProcessInstanceId(); | ||
| 280 | + | ||
| 281 | + Map<String, Object> variables = new HashMap<>(); | ||
| 282 | + variables.put("isReturnedToFirstApproval", true); | ||
| 283 | + variables.put("isFirstEnterFirstApproval", false); | ||
| 284 | + // 更新流程实例级别变量 | ||
| 285 | + runtimeService.setVariables(processInstanceId, variables); | ||
| 286 | + }*/ | ||
| 253 | Long id = reqVO.getWorkerDataId(); | 287 | Long id = reqVO.getWorkerDataId(); |
| 254 | List<String> returnImgs = reqVO.getReturnImgs(); | 288 | List<String> returnImgs = reqVO.getReturnImgs(); |
| 255 | if(ObjectUtils.isNotAllEmpty(id) && ObjectUtils.isNotAllEmpty(returnImgs) && returnImgs.size()>0){ | 289 | if(ObjectUtils.isNotAllEmpty(id) && ObjectUtils.isNotAllEmpty(returnImgs) && returnImgs.size()>0){ |
| @@ -260,6 +294,20 @@ public class BpmGardenServiceImpl implements BpmGardenService{ | @@ -260,6 +294,20 @@ public class BpmGardenServiceImpl implements BpmGardenService{ | ||
| 260 | } | 294 | } |
| 261 | 295 | ||
| 262 | @Override | 296 | @Override |
| 297 | + @Transactional(rollbackFor = Exception.class) | ||
| 298 | + public void rejectTask(AppGardenTaskRejectExtReqVO reqVO) { | ||
| 299 | + BpmTaskRejectReqVO targetVO = BeanUtils.toBean(reqVO,BpmTaskRejectReqVO.class); | ||
| 300 | + Long userId = SecurityFrameworkUtils.getLoginUserId(); | ||
| 301 | + taskService.rejectTask(userId, targetVO); | ||
| 302 | + Long id = reqVO.getWorkerDataId(); | ||
| 303 | + List<String> returnImgs = reqVO.getReturnImgs(); | ||
| 304 | + if(ObjectUtils.isNotAllEmpty(id) && ObjectUtils.isNotAllEmpty(returnImgs) && returnImgs.size()>0){ | ||
| 305 | + MainInfoDO workerOrder = workOrderMapper.selectById(id); | ||
| 306 | + attachmentInsertOrUpdate(returnImgs,BpmCommonConstant.GARDEN_TEAMLEADER_RETURN_IMG,workerOrder); | ||
| 307 | + } | ||
| 308 | + } | ||
| 309 | + | ||
| 310 | + @Override | ||
| 263 | public void withdrawTask(String taskId) { | 311 | public void withdrawTask(String taskId) { |
| 264 | Long userId = SecurityFrameworkUtils.getLoginUserId(); | 312 | Long userId = SecurityFrameworkUtils.getLoginUserId(); |
| 265 | taskService.withdrawTask(userId,taskId); | 313 | taskService.withdrawTask(userId,taskId); |
| @@ -357,7 +405,7 @@ public class BpmGardenServiceImpl implements BpmGardenService{ | @@ -357,7 +405,7 @@ public class BpmGardenServiceImpl implements BpmGardenService{ | ||
| 357 | } | 405 | } |
| 358 | taskBuzReqVO.setUserId(SecurityFrameworkUtils.getLoginUserId()); | 406 | taskBuzReqVO.setUserId(SecurityFrameworkUtils.getLoginUserId()); |
| 359 | //TODO 先写死 | 407 | //TODO 先写死 |
| 360 | - taskBuzReqVO.setKey(BpmCommonConstant.BPM_GARDEN_INSPECT_WO); | 408 | + //taskBuzReqVO.setKey(BpmCommonConstant.BPM_GARDEN_INSPECT_WO); |
| 361 | PageResult<MainInfoExtDO> pageResult = workOrderExtMapper.selectWorkOrderMyPage(pageVO,taskBuzReqVO); | 409 | PageResult<MainInfoExtDO> pageResult = workOrderExtMapper.selectWorkOrderMyPage(pageVO,taskBuzReqVO); |
| 362 | return AppGardenTaskConvert.INSTANCE.buildBuziTaskPage(pageResult,attachmentMapper); | 410 | return AppGardenTaskConvert.INSTANCE.buildBuziTaskPage(pageResult,attachmentMapper); |
| 363 | } | 411 | } |
| @@ -390,7 +438,7 @@ public class BpmGardenServiceImpl implements BpmGardenService{ | @@ -390,7 +438,7 @@ public class BpmGardenServiceImpl implements BpmGardenService{ | ||
| 390 | } | 438 | } |
| 391 | taskBuzReqVO.setUserId(SecurityFrameworkUtils.getLoginUserId()); | 439 | taskBuzReqVO.setUserId(SecurityFrameworkUtils.getLoginUserId()); |
| 392 | //TODO 先写死 | 440 | //TODO 先写死 |
| 393 | - taskBuzReqVO.setKey(BpmCommonConstant.BPM_GARDEN_INSPECT_WO); | 441 | + //taskBuzReqVO.setKey(BpmCommonConstant.BPM_GARDEN_INSPECT_WO); |
| 394 | PageResult<MainInfoExtDO> pageResult = workOrderExtMapper.selectWorkOrderDonePage(pageVO,taskBuzReqVO); | 442 | PageResult<MainInfoExtDO> pageResult = workOrderExtMapper.selectWorkOrderDonePage(pageVO,taskBuzReqVO); |
| 395 | return AppGardenTaskConvert.INSTANCE.buildBuziTaskPage(pageResult,attachmentMapper); | 443 | return AppGardenTaskConvert.INSTANCE.buildBuziTaskPage(pageResult,attachmentMapper); |
| 396 | } | 444 | } |
| @@ -424,7 +472,7 @@ public class BpmGardenServiceImpl implements BpmGardenService{ | @@ -424,7 +472,7 @@ public class BpmGardenServiceImpl implements BpmGardenService{ | ||
| 424 | } | 472 | } |
| 425 | taskBuzReqVO.setUserId(SecurityFrameworkUtils.getLoginUserId()); | 473 | taskBuzReqVO.setUserId(SecurityFrameworkUtils.getLoginUserId()); |
| 426 | //TODO 先写死 | 474 | //TODO 先写死 |
| 427 | - taskBuzReqVO.setKey(BpmCommonConstant.BPM_GARDEN_INSPECT_WO); | 475 | + //taskBuzReqVO.setKey(BpmCommonConstant.BPM_GARDEN_INSPECT_WO); |
| 428 | PageResult<MainInfoExtDO> pageResult = workOrderExtMapper.selectWorkOrderTodoPage(pageVO,taskBuzReqVO); | 476 | PageResult<MainInfoExtDO> pageResult = workOrderExtMapper.selectWorkOrderTodoPage(pageVO,taskBuzReqVO); |
| 429 | 477 | ||
| 430 | return AppGardenTaskConvert.INSTANCE.buildBuziTaskPage(pageResult,attachmentMapper); | 478 | return AppGardenTaskConvert.INSTANCE.buildBuziTaskPage(pageResult,attachmentMapper); |
| @@ -516,10 +564,10 @@ public class BpmGardenServiceImpl implements BpmGardenService{ | @@ -516,10 +564,10 @@ public class BpmGardenServiceImpl implements BpmGardenService{ | ||
| 516 | .map(AdminUserRespDTO::getId) | 564 | .map(AdminUserRespDTO::getId) |
| 517 | // 收集结果到List | 565 | // 收集结果到List |
| 518 | .collect(Collectors.toList()); | 566 | .collect(Collectors.toList()); |
| 519 | - //startUserSelectAssignees.put("",idList); | ||
| 520 | processInstanceVariables.put("ylTeamLeaderId", idList.get(0)); | 567 | processInstanceVariables.put("ylTeamLeaderId", idList.get(0)); |
| 521 | String processInstanceId = processInstanceApi.createProcessInstance(userId, | 568 | String processInstanceId = processInstanceApi.createProcessInstance(userId, |
| 522 | - new BpmProcessInstanceCreateReqDTO().setProcessDefinitionKey(BpmCommonConstant.BPM_GARDEN_INSPECT_WO) | 569 | + // new BpmProcessInstanceCreateReqDTO().setProcessDefinitionKey(BpmCommonConstant.BPM_GARDEN_INSPECT_WO) |
| 570 | + new BpmProcessInstanceCreateReqDTO().setProcessDefinitionKey(BpmCommonConstant.BPM_WORKORDER_COMMON_PROD) | ||
| 523 | .setVariables(processInstanceVariables).setBusinessKey(String.valueOf(workOrder.getId())) | 571 | .setVariables(processInstanceVariables).setBusinessKey(String.valueOf(workOrder.getId())) |
| 524 | .setStartUserSelectAssignees(startUserSelectAssignees)); | 572 | .setStartUserSelectAssignees(startUserSelectAssignees)); |
| 525 | 573 | ||
| @@ -578,13 +626,13 @@ public class BpmGardenServiceImpl implements BpmGardenService{ | @@ -578,13 +626,13 @@ public class BpmGardenServiceImpl implements BpmGardenService{ | ||
| 578 | if(ObjectUtils.isNotAllEmpty(streetImgList)){ | 626 | if(ObjectUtils.isNotAllEmpty(streetImgList)){ |
| 579 | AttachmentDO saveDO = new AttachmentDO(); | 627 | AttachmentDO saveDO = new AttachmentDO(); |
| 580 | saveDO.setBusiLine(workOrder.getBusiLine()); | 628 | saveDO.setBusiLine(workOrder.getBusiLine()); |
| 581 | - saveDO.setBusiType(BpmCommonConstant.HANDLE_IMG_GROUP); | 629 | + saveDO.setBusiType(BpmCommonConstant.START_IMG_GROUP); |
| 582 | saveDO.setOrderNo(workOrder.getOrderNo()); | 630 | saveDO.setOrderNo(workOrder.getOrderNo()); |
| 583 | String filePaths = String.join(",",streetImgList); | 631 | String filePaths = String.join(",",streetImgList); |
| 584 | saveDO.setFileNames(filePaths); | 632 | saveDO.setFileNames(filePaths); |
| 585 | LambdaQueryWrapper<AttachmentDO> deleteWrapper = new LambdaQueryWrapper<AttachmentDO>() | 633 | LambdaQueryWrapper<AttachmentDO> deleteWrapper = new LambdaQueryWrapper<AttachmentDO>() |
| 586 | .eq(AttachmentDO::getBusiLine, workOrder.getBusiLine()) | 634 | .eq(AttachmentDO::getBusiLine, workOrder.getBusiLine()) |
| 587 | - .eq(AttachmentDO::getBusiType, BpmCommonConstant.HANDLE_IMG_GROUP) | 635 | + .eq(AttachmentDO::getBusiType, BpmCommonConstant.START_IMG_GROUP) |
| 588 | .eq(AttachmentDO::getOrderNo, workOrder.getOrderNo()); | 636 | .eq(AttachmentDO::getOrderNo, workOrder.getOrderNo()); |
| 589 | attachmentMapper.delete(deleteWrapper); | 637 | attachmentMapper.delete(deleteWrapper); |
| 590 | attachmentMapper.insert(saveDO); | 638 | attachmentMapper.insert(saveDO); |
| @@ -593,13 +641,13 @@ public class BpmGardenServiceImpl implements BpmGardenService{ | @@ -593,13 +641,13 @@ public class BpmGardenServiceImpl implements BpmGardenService{ | ||
| 593 | if(ObjectUtils.isNotAllEmpty(longRangeImgList)){ | 641 | if(ObjectUtils.isNotAllEmpty(longRangeImgList)){ |
| 594 | AttachmentDO saveDO = new AttachmentDO(); | 642 | AttachmentDO saveDO = new AttachmentDO(); |
| 595 | saveDO.setBusiLine(workOrder.getBusiLine()); | 643 | saveDO.setBusiLine(workOrder.getBusiLine()); |
| 596 | - saveDO.setBusiType(BpmCommonConstant.RESULT_IMG_GROUP); | 644 | + saveDO.setBusiType(BpmCommonConstant.PROCESS_IMG_GROUP); |
| 597 | saveDO.setOrderNo(workOrder.getOrderNo()); | 645 | saveDO.setOrderNo(workOrder.getOrderNo()); |
| 598 | String filePaths = String.join(",",longRangeImgList); | 646 | String filePaths = String.join(",",longRangeImgList); |
| 599 | saveDO.setFileNames(filePaths); | 647 | saveDO.setFileNames(filePaths); |
| 600 | LambdaQueryWrapper<AttachmentDO> deleteWrapper = new LambdaQueryWrapper<AttachmentDO>() | 648 | LambdaQueryWrapper<AttachmentDO> deleteWrapper = new LambdaQueryWrapper<AttachmentDO>() |
| 601 | .eq(AttachmentDO::getBusiLine, workOrder.getBusiLine()) | 649 | .eq(AttachmentDO::getBusiLine, workOrder.getBusiLine()) |
| 602 | - .eq(AttachmentDO::getBusiType, BpmCommonConstant.RESULT_IMG_GROUP) | 650 | + .eq(AttachmentDO::getBusiType, BpmCommonConstant.PROCESS_IMG_GROUP) |
| 603 | .eq(AttachmentDO::getOrderNo, workOrder.getOrderNo()); | 651 | .eq(AttachmentDO::getOrderNo, workOrder.getOrderNo()); |
| 604 | attachmentMapper.delete(deleteWrapper); | 652 | attachmentMapper.delete(deleteWrapper); |
| 605 | attachmentMapper.insert(saveDO); | 653 | attachmentMapper.insert(saveDO); |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/service/garden/listener/AutoCompleteTaskListener.java deleted
| 1 | -package com.zteits.urbanops.module.workorder.service.garden.listener; | ||
| 2 | - | ||
| 3 | -import cn.hutool.core.util.StrUtil; | ||
| 4 | -import jakarta.annotation.Resource; | ||
| 5 | -import org.flowable.engine.HistoryService; | ||
| 6 | -import org.flowable.engine.ProcessEngine; | ||
| 7 | -import org.flowable.engine.RuntimeService; | ||
| 8 | -import org.flowable.engine.TaskService; | ||
| 9 | -import org.flowable.engine.delegate.TaskListener; // 配套的TaskListener也用核心包 | ||
| 10 | -import org.flowable.task.api.Task; | ||
| 11 | -import org.flowable.task.api.history.HistoricTaskInstanceQuery; | ||
| 12 | -import org.flowable.task.service.delegate.DelegateTask; | ||
| 13 | -import org.springframework.context.ApplicationContext; | ||
| 14 | -import org.springframework.stereotype.Component; | ||
| 15 | - | ||
| 16 | -import java.util.HashMap; | ||
| 17 | -import java.util.Map; | ||
| 18 | - | ||
| 19 | -/** | ||
| 20 | - * 自动完成任务的监听器(最终版:适配项目实际包路径 + 移除所有报错依赖) | ||
| 21 | - * Bean名称:autoCompleteTaskListener(与BPMN中的delegateExpression对应) | ||
| 22 | - */ | ||
| 23 | -@Component("autoCompleteTaskListener") | ||
| 24 | -public class AutoCompleteTaskListener implements TaskListener { | ||
| 25 | - | ||
| 26 | - // ========== 仅使用Flowable核心公开API,移除所有内部/拆分接口 ========== | ||
| 27 | - @Resource // 若项目习惯用@Autowired,可直接替换(@Resource按名称,@Autowired按类型,功能一致) | ||
| 28 | - private TaskService taskService; | ||
| 29 | - | ||
| 30 | - @Resource | ||
| 31 | - private RuntimeService runtimeService; | ||
| 32 | - | ||
| 33 | - // 核心:直接注入ProcessEngine(兼容所有Flowable版本,可获取任意服务) | ||
| 34 | - @Resource | ||
| 35 | - private ProcessEngine processEngine; | ||
| 36 | - | ||
| 37 | - @Resource | ||
| 38 | - private ApplicationContext applicationContext; | ||
| 39 | - | ||
| 40 | - // 统一流程状态值(与RuoYi的事件监听器预期值一致) | ||
| 41 | - private static final String FLOW_STATUS = "3"; // 对应“完成”状态 | ||
| 42 | - | ||
| 43 | - @Override | ||
| 44 | - public void notify(DelegateTask delegateTask) { // 此处DelegateTask为核心包的类,与项目一致 | ||
| 45 | - try { | ||
| 46 | - // 1. 获取核心变量 | ||
| 47 | - String taskId = delegateTask.getId(); | ||
| 48 | - String processInstanceId = delegateTask.getProcessInstanceId(); | ||
| 49 | - String assignee = delegateTask.getAssignee(); | ||
| 50 | - | ||
| 51 | - // 兜底:从流程变量获取发起人(initiator是Flowable启动节点的发起人变量) | ||
| 52 | - if (StrUtil.isBlank(assignee)) { | ||
| 53 | - assignee = (String) delegateTask.getVariable("initiator"); | ||
| 54 | - if (StrUtil.isBlank(assignee)) { | ||
| 55 | - assignee = (String) runtimeService.getVariable(processInstanceId, "initiator"); | ||
| 56 | - if (StrUtil.isBlank(assignee)) { | ||
| 57 | - throw new RuntimeException("发起人ID为空,无法完成任务"); | ||
| 58 | - } | ||
| 59 | - } | ||
| 60 | - // 修正:使用Flowable公开API更新办理人(彻底放弃内部类操作,无类型转换) | ||
| 61 | - taskService.setAssignee(taskId, assignee); | ||
| 62 | - } | ||
| 63 | - | ||
| 64 | - // 2. 关键:提前设置所有层级的status变量(解决RuoYi事件status为空) | ||
| 65 | - runtimeService.setVariable(processInstanceId, "status", FLOW_STATUS); // 流程全局变量 | ||
| 66 | - delegateTask.setVariable("status", FLOW_STATUS); // 任务局部变量 | ||
| 67 | - Map<String, Object> variables = new HashMap<>(); | ||
| 68 | - variables.put("status", FLOW_STATUS); | ||
| 69 | - variables.put("completeRemark", "系统自动完成,办理人:" + assignee); | ||
| 70 | - | ||
| 71 | - // 3. 完成任务(Flowable核心API,兼容所有版本) | ||
| 72 | - Task task = taskService.createTaskQuery().taskId(taskId).singleResult(); | ||
| 73 | - if (task != null) { | ||
| 74 | - taskService.complete(taskId, variables); | ||
| 75 | - } | ||
| 76 | - | ||
| 77 | - // 4. 兜底:确保历史任务归档(使用ProcessEngine获取HistoryService,无报错) | ||
| 78 | - ensureHistoricTaskCompleted(taskId, assignee); | ||
| 79 | - | ||
| 80 | - // 5. 手动发布事件补充status(解决RuoYi的事件校验问题) | ||
| 81 | - publishProcessEventWithStatus(processInstanceId); | ||
| 82 | - | ||
| 83 | - } catch (Exception e) { | ||
| 84 | - throw new RuntimeException("自动完成任务失败", e); | ||
| 85 | - } | ||
| 86 | - } | ||
| 87 | - | ||
| 88 | - /** | ||
| 89 | - * 修正:使用ProcessEngine获取HistoryService(兼容所有Flowable版本,无报错) | ||
| 90 | - * 彻底移除HistoryTaskService,改用核心HistoryService | ||
| 91 | - */ | ||
| 92 | - private void ensureHistoricTaskCompleted(String taskId, String assignee) { | ||
| 93 | - // 核心:从ProcessEngine获取HistoryService(Flowable 6.x/7.0通用) | ||
| 94 | - HistoryService historyService = processEngine.getHistoryService(); | ||
| 95 | - // 历史任务查询(Flowable核心API,无报错) | ||
| 96 | - //HistoricTaskInstanceQuery historicTask = historyService.createHistoricTaskInstanceQuery() | ||
| 97 | - // .taskId(taskId) | ||
| 98 | - // .singleResult(); | ||
| 99 | - | ||
| 100 | - /*if (historicTask != null) { | ||
| 101 | - if (historicTask.getEndTime() == null) { | ||
| 102 | - Task runtimeTask = taskService.createTaskQuery().taskId(taskId).singleResult(); | ||
| 103 | - if (runtimeTask != null) { | ||
| 104 | - taskService.complete(taskId); | ||
| 105 | - } else { | ||
| 106 | - // 手动更新历史任务表(通过MyBatis操作,避免Flowable API差异) | ||
| 107 | - // updateHistoricTask(taskId, assignee); // 若需要,自行实现Mapper | ||
| 108 | - } | ||
| 109 | - } | ||
| 110 | - }*/ | ||
| 111 | - } | ||
| 112 | - | ||
| 113 | - /** | ||
| 114 | - * 手动发布包含status的流程事件(适配RuoYi事件类,避免导入依赖) | ||
| 115 | - */ | ||
| 116 | - private void publishProcessEventWithStatus(String processInstanceId) { | ||
| 117 | - try { | ||
| 118 | - // 反射创建RuoYi的ProcessInstanceResultEvent(兼容无参/有参构造) | ||
| 119 | - Class<?> eventClass = Class.forName("com.ruoyi.flowable.event.ProcessInstanceResultEvent"); | ||
| 120 | - Object event = null; | ||
| 121 | - | ||
| 122 | - // 先尝试无参构造 | ||
| 123 | - try { | ||
| 124 | - event = eventClass.getDeclaredConstructor().newInstance(); | ||
| 125 | - } catch (Exception e) { | ||
| 126 | - // 无参失败,尝试单参构造(流程实例ID) | ||
| 127 | - try { | ||
| 128 | - event = eventClass.getConstructor(String.class).newInstance(processInstanceId); | ||
| 129 | - } catch (Exception e2) { | ||
| 130 | - // 单参失败,尝试双参构造(流程实例ID + status) | ||
| 131 | - event = eventClass.getConstructor(String.class, String.class).newInstance(processInstanceId, FLOW_STATUS); | ||
| 132 | - } | ||
| 133 | - } | ||
| 134 | - | ||
| 135 | - // 强制设置status属性(无论构造方式如何) | ||
| 136 | - eventClass.getMethod("setStatus", String.class).invoke(event, FLOW_STATUS); | ||
| 137 | - eventClass.getMethod("setProcessInstanceId", String.class).invoke(event, processInstanceId); | ||
| 138 | - | ||
| 139 | - // 发布事件(覆盖RuoYi的空status事件) | ||
| 140 | - applicationContext.publishEvent(event); | ||
| 141 | - } catch (Exception e) { | ||
| 142 | - // 反射失败时,提示用户修改RuoYi的事件校验逻辑(应急方案) | ||
| 143 | - e.printStackTrace(); | ||
| 144 | - System.out.println("★★★反射发布事件失败,请手动修改RuoYi的ProcessInstanceResultEvent校验逻辑,添加status默认值★★★"); | ||
| 145 | - } | ||
| 146 | - } | ||
| 147 | - | ||
| 148 | - // 若需要手动更新历史任务表,自行实现以下方法(需添加MyBatis Mapper) | ||
| 149 | - // private void updateHistoricTask(String taskId, String assignee) { | ||
| 150 | - // // historicTaskMapper.updateHistoricTask(taskId, assignee, new Date()); | ||
| 151 | - // } | ||
| 152 | -} | ||
| 153 | \ No newline at end of file | 0 | \ No newline at end of file |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/service/garden/listener/BpmGardenWorkOrderStatusListener.java deleted
| 1 | -package com.zteits.urbanops.module.workorder.service.garden.listener; | ||
| 2 | - | ||
| 3 | -import com.zteits.urbanops.module.bpm.api.event.BpmProcessInstanceStatusEvent; | ||
| 4 | -import com.zteits.urbanops.module.bpm.api.event.BpmProcessInstanceStatusEventListener; | ||
| 5 | -import com.zteits.urbanops.module.workorder.api.constant.BpmCommonConstant; | ||
| 6 | -import com.zteits.urbanops.module.workorder.service.garden.BpmGardenService; | ||
| 7 | -import jakarta.annotation.Resource; | ||
| 8 | -import org.springframework.stereotype.Component; | ||
| 9 | - | ||
| 10 | -/** | ||
| 11 | - * @author yanhuiqing | ||
| 12 | - * @version 1.0 | ||
| 13 | - * @description: 工作流状态监听类 | ||
| 14 | - * @date 2025/12/1 11:45 | ||
| 15 | - */ | ||
| 16 | -@Component | ||
| 17 | -public class BpmGardenWorkOrderStatusListener extends BpmProcessInstanceStatusEventListener { | ||
| 18 | - @Resource | ||
| 19 | - private BpmGardenService gardenService; | ||
| 20 | - @Override | ||
| 21 | - protected String getProcessDefinitionKey() { | ||
| 22 | - | ||
| 23 | - return BpmCommonConstant.BPM_GARDEN_INSPECT_WO; | ||
| 24 | - } | ||
| 25 | - | ||
| 26 | - @Override | ||
| 27 | - protected void onEvent(BpmProcessInstanceStatusEvent event) { | ||
| 28 | - gardenService.updateWorkOrderStatus(Long.parseLong(event.getBusinessKey()), event.getStatus()); | ||
| 29 | - } | ||
| 30 | -} |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/service/garden/listener/BpmProcessTaskAutoCompleteListener.java
| @@ -22,7 +22,8 @@ public class BpmProcessTaskAutoCompleteListener extends BpmProcessInstanceStatus | @@ -22,7 +22,8 @@ public class BpmProcessTaskAutoCompleteListener extends BpmProcessInstanceStatus | ||
| 22 | @Override | 22 | @Override |
| 23 | protected String getProcessDefinitionKey() { | 23 | protected String getProcessDefinitionKey() { |
| 24 | 24 | ||
| 25 | - return BpmCommonConstant.BPM_GARDEN_INSPECT_WO; | 25 | + //return BpmCommonConstant.BPM_GARDEN_INSPECT_WO; |
| 26 | + return BpmCommonConstant.BPM_WORKORDER_COMMON_PROD; | ||
| 26 | } | 27 | } |
| 27 | 28 | ||
| 28 | @Override | 29 | @Override |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/service/garden/listener/FirstApprovalAutoCompleteListener.java deleted
| 1 | -package com.zteits.urbanops.module.workorder.service.garden.listener; | ||
| 2 | - | ||
| 3 | -/** | ||
| 4 | - * 类描述:第一次跳过审批,第二次手动审批 | ||
| 5 | - * 创建人:yanhuiqing | ||
| 6 | - * 创建时间:2025/12/18 20:28 | ||
| 7 | - * 修改人:yanhuiqing | ||
| 8 | - * 修改时间:2025/12/18 20:28 | ||
| 9 | - * 修改备注: | ||
| 10 | - * | ||
| 11 | - * @author yanhuiqing | ||
| 12 | - * @version 1.0 | ||
| 13 | - */ | ||
| 14 | -import org.flowable.engine.TaskService; | ||
| 15 | -import org.flowable.engine.delegate.TaskListener; | ||
| 16 | -import org.flowable.task.service.delegate.DelegateTask; | ||
| 17 | -import org.springframework.beans.factory.annotation.Autowired; | ||
| 18 | -import org.springframework.stereotype.Component; | ||
| 19 | - | ||
| 20 | -/** | ||
| 21 | - * 初审节点自动通过监听器 | ||
| 22 | - */ | ||
| 23 | -@Component("firstApprovalAutoCompleteListener") // 组件名,供流程设计器调用 | ||
| 24 | -public class FirstApprovalAutoCompleteListener implements TaskListener { | ||
| 25 | - | ||
| 26 | - // 注入Flowable的TaskService,用于完成任务 | ||
| 27 | - @Autowired | ||
| 28 | - private TaskService taskService; | ||
| 29 | - | ||
| 30 | - @Override | ||
| 31 | - public void notify(DelegateTask delegateTask) { | ||
| 32 | - // 1. 获取流程变量 | ||
| 33 | - String starterId = (String) delegateTask.getVariable("starterId"); // 发起人ID | ||
| 34 | - Boolean isFirstEnter = (Boolean) delegateTask.getVariable("isFirstEnterFirstApproval"); // 是否首次进入 | ||
| 35 | - Boolean isReturned = (Boolean) delegateTask.getVariable("isReturnedToFirstApproval"); // 是否退回 | ||
| 36 | - | ||
| 37 | - // 2. 获取当前审批节点的审批人ID | ||
| 38 | - String assigneeId = delegateTask.getAssignee(); | ||
| 39 | - | ||
| 40 | - // 3. 核心逻辑:首次进入 + 发起人=审批人 → 自动完成任务 | ||
| 41 | - if (isFirstEnter != null && isFirstEnter | ||
| 42 | - && !Boolean.TRUE.equals(isReturned) | ||
| 43 | - && starterId != null && starterId.equals(assigneeId)) { | ||
| 44 | - | ||
| 45 | - // 标记:首次进入已处理,后续不再触发自动通过 | ||
| 46 | - delegateTask.setVariable("isFirstEnterFirstApproval", false); | ||
| 47 | - | ||
| 48 | - // 自动完成任务(流程继续向下) | ||
| 49 | - taskService.complete(delegateTask.getId()); | ||
| 50 | - } | ||
| 51 | - // 若为退回进入(isReturned=true),则不执行自动完成,等待手动处理 | ||
| 52 | - } | ||
| 53 | -} | ||
| 54 | \ No newline at end of file | 0 | \ No newline at end of file |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/service/garden/listener/start/FirstTaskParamValueListener.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.workorder.service.garden.listener.start; | ||
| 2 | + | ||
| 3 | +import lombok.extern.slf4j.Slf4j; | ||
| 4 | +import org.flowable.engine.delegate.DelegateExecution; | ||
| 5 | +import org.flowable.engine.delegate.ExecutionListener; | ||
| 6 | +import org.flowable.engine.impl.persistence.entity.ExecutionEntityImpl; | ||
| 7 | +import org.flowable.task.service.delegate.DelegateTask; | ||
| 8 | +import org.springframework.stereotype.Component; | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * 类描述:任务启动初始化属性值的监听类 | ||
| 12 | + * 创建人:yanhuiqing | ||
| 13 | + * 创建时间:2025/12/19 11:42 | ||
| 14 | + * 修改人:yanhuiqing | ||
| 15 | + * 修改时间:2025/12/19 11:42 | ||
| 16 | + * 修改备注: | ||
| 17 | + * | ||
| 18 | + * @author yanhuiqing | ||
| 19 | + * @version 1.0 | ||
| 20 | + */ | ||
| 21 | +@Slf4j | ||
| 22 | +@Component("firstTaskParamValueListener") // 组件名,供流程设计器调用 | ||
| 23 | +public class FirstTaskParamValueListener implements ExecutionListener { | ||
| 24 | + | ||
| 25 | + | ||
| 26 | + @Override | ||
| 27 | + public void notify(DelegateExecution execution) { | ||
| 28 | + | ||
| 29 | + // ========== 幂等性标记(核心:按流程实例+节点ID命名,避免冲突) ========== | ||
| 30 | + String flagKey = "listener_executed_" + execution.getProcessInstanceId() + "_ylInspectorStart"; | ||
| 31 | + if (Boolean.TRUE.equals(getBooleanVariable(execution, flagKey))) { | ||
| 32 | + log.info("监听器已执行,跳过:{}", execution.getId()); | ||
| 33 | + return; | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + log.info("===== 监听器触发 ====="); | ||
| 37 | + log.info("执行实例ID:{}", execution.getId()); | ||
| 38 | + log.info("父执行实例ID:{}", execution.getParentId()); | ||
| 39 | + log.info("当前活动ID:{}", execution.getCurrentActivityId()); | ||
| 40 | + log.info("流程实例ID:{}", execution.getProcessInstanceId()); | ||
| 41 | + log.info("流程实例ID:{}", execution.getProcessInstanceId()); | ||
| 42 | + log.info("流程事件名称:{}", execution.getEventName()); | ||
| 43 | + ; | ||
| 44 | + log.info("触发时的流程变量:isFirstEnter={}",execution.getVariable("isFirstEnterFirstApproval")); | ||
| 45 | + String targetActivityId = "ylInspectorStart"; | ||
| 46 | + if (!targetActivityId.equals(execution.getCurrentActivityId())) { | ||
| 47 | + log.info("非目标节点,跳过监听器逻辑"); | ||
| 48 | + return; | ||
| 49 | + } | ||
| 50 | + ExecutionEntityImpl parent = (ExecutionEntityImpl) execution.getParent(); | ||
| 51 | + String starterId = parent.getStartUserId(); | ||
| 52 | + | ||
| 53 | + Boolean isFirstEnter = getBooleanVariable(execution, "isFirstEnterFirstApproval"); | ||
| 54 | + | ||
| 55 | + //第一个节点的指派人 | ||
| 56 | + Long assigneeId = (Long) execution.getVariable("applyUserId"); | ||
| 57 | + if (Boolean.TRUE.equals(isFirstEnter) | ||
| 58 | + && starterId != null && starterId.equals(Long.toString(assigneeId))) { | ||
| 59 | + // 标记:首次进入跳过 | ||
| 60 | + execution.setVariable("skipFirstApproval", true); | ||
| 61 | + //首次进入改为false | ||
| 62 | + execution.setVariable("isFirstEnterFirstApproval", "false"); | ||
| 63 | + | ||
| 64 | + }else{ | ||
| 65 | + execution.setVariable("skipFirstApproval", false); | ||
| 66 | + | ||
| 67 | + } | ||
| 68 | + // ========== 标记为已执行 ========== | ||
| 69 | + execution.setVariable(flagKey, true); | ||
| 70 | + | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + private Boolean getBooleanVariable(DelegateExecution delegateTask, String variableName) { | ||
| 74 | + Object variable = delegateTask.getVariable(variableName); | ||
| 75 | + if (variable == null) { | ||
| 76 | + return false; | ||
| 77 | + } | ||
| 78 | + if (variable instanceof Boolean) { | ||
| 79 | + return (Boolean) variable; | ||
| 80 | + } | ||
| 81 | + if (variable instanceof String) { | ||
| 82 | + return Boolean.parseBoolean((String) variable); | ||
| 83 | + } | ||
| 84 | + return false; | ||
| 85 | + } | ||
| 86 | +} | ||
| 0 | \ No newline at end of file | 87 | \ No newline at end of file |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/service/garden/listener/start/StartInitParamValueListener.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.workorder.service.garden.listener.start; | ||
| 2 | + | ||
| 3 | +import org.flowable.engine.delegate.DelegateExecution; | ||
| 4 | +import org.flowable.engine.delegate.ExecutionListener; | ||
| 5 | +import org.flowable.engine.impl.persistence.entity.ExecutionEntityImpl; | ||
| 6 | +import org.springframework.stereotype.Component; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * 类描述:任务启动初始化属性值的监听类 | ||
| 10 | + * 创建人:yanhuiqing | ||
| 11 | + * 创建时间:2025/12/19 11:42 | ||
| 12 | + * 修改人:yanhuiqing | ||
| 13 | + * 修改时间:2025/12/19 11:42 | ||
| 14 | + * 修改备注: | ||
| 15 | + * | ||
| 16 | + * @author yanhuiqing | ||
| 17 | + * @version 1.0 | ||
| 18 | + */ | ||
| 19 | +@Component("startInitParamValueListener") // 组件名,供流程设计器调用 | ||
| 20 | +public class StartInitParamValueListener implements ExecutionListener { | ||
| 21 | + | ||
| 22 | + | ||
| 23 | + @Override | ||
| 24 | + public void notify(DelegateExecution execution) { | ||
| 25 | + | ||
| 26 | + ExecutionEntityImpl parent = (ExecutionEntityImpl) execution.getParent(); | ||
| 27 | + String starterId = parent.getStartUserId(); | ||
| 28 | + execution.setVariable("starterId",starterId); | ||
| 29 | + | ||
| 30 | + | ||
| 31 | + | ||
| 32 | + Boolean isFirstEnter = (Boolean) execution.getVariable("isFirstEnterFirstApproval"); // 是否首次进入 | ||
| 33 | + if(null == isFirstEnter){ | ||
| 34 | + execution.setVariable("isFirstEnterFirstApproval","true"); | ||
| 35 | + } | ||
| 36 | + } | ||
| 37 | +} | ||
| 0 | \ No newline at end of file | 38 | \ No newline at end of file |