Commit e2b1b53bb6e1b3233adbe71e6b78623bfebedc80
1 parent
4cf824f0
工单管理代码提交
Showing
12 changed files
with
501 additions
and
3 deletions
urbanops-module-workorder/pom.xml
| @@ -126,6 +126,12 @@ | @@ -126,6 +126,12 @@ | ||
| 126 | <artifactId>urbanops-module-system</artifactId> | 126 | <artifactId>urbanops-module-system</artifactId> |
| 127 | <version>${revision}</version> | 127 | <version>${revision}</version> |
| 128 | </dependency> | 128 | </dependency> |
| 129 | + <dependency> | ||
| 130 | + <groupId>com.zteits.boot</groupId> | ||
| 131 | + <artifactId>urbanops-module-bpm</artifactId> | ||
| 132 | + <version>${revision}</version> | ||
| 133 | + </dependency> | ||
| 134 | + | ||
| 129 | </dependencies> | 135 | </dependencies> |
| 130 | 136 | ||
| 131 | </project> | 137 | </project> |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/api/constant/BpmCommonConstant.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.workorder.api.constant; | ||
| 2 | + | ||
| 3 | +/** | ||
| 4 | + * @author yanhuiqing | ||
| 5 | + * @version 1.0 | ||
| 6 | + * @description: 流程业务定义key | ||
| 7 | + * @date 2025/12/3 10:35 | ||
| 8 | + */ | ||
| 9 | +public class BpmCommonConstant { | ||
| 10 | + /** | ||
| 11 | + * 园林巡检工单 流程业务key | ||
| 12 | + */ | ||
| 13 | + public static final String BPM_GARDEN_INSPECT_WO = "garden_inspect_wo"; | ||
| 14 | + /** | ||
| 15 | + * 物业巡检工单 流程业务key | ||
| 16 | + */ | ||
| 17 | + public static final String BPM_PROPERTY_INSPECT_WO = "property_inspect_wo"; | ||
| 18 | + /** | ||
| 19 | + * 市政巡检工单 流程业务key | ||
| 20 | + */ | ||
| 21 | + public static final String BPM_MUNICIPAL_INSPECT_WO = "municipal_inspect_wo"; | ||
| 22 | + /** | ||
| 23 | + * 园林问题单图片类型 | ||
| 24 | + */ | ||
| 25 | + public static final String GARDEN_INSPECT_WO_ATTACH1 = "01"; | ||
| 26 | + /** | ||
| 27 | + * 园林街道图片类型 | ||
| 28 | + */ | ||
| 29 | + public static final String GARDEN_INSPECT_WO_ATTACH2 = "02"; | ||
| 30 | + /** | ||
| 31 | + * 园林远景图片类型 | ||
| 32 | + */ | ||
| 33 | + public static final String GARDEN_INSPECT_WO_ATTACH3 = "03"; | ||
| 34 | + | ||
| 35 | +} |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/controller/admin/garden/BpmGardenInspectController.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.workorder.controller.admin.garden; | ||
| 2 | + | ||
| 3 | +import com.zteits.urbanops.framework.common.pojo.CommonResult; | ||
| 4 | +import com.zteits.urbanops.framework.common.pojo.PageResult; | ||
| 5 | +import com.zteits.urbanops.framework.common.util.object.BeanUtils; | ||
| 6 | +import com.zteits.urbanops.module.bpm.controller.admin.oa.vo.BpmOALeaveCreateReqVO; | ||
| 7 | +import com.zteits.urbanops.module.bpm.controller.admin.oa.vo.BpmOALeavePageReqVO; | ||
| 8 | +import com.zteits.urbanops.module.bpm.controller.admin.oa.vo.BpmOALeaveRespVO; | ||
| 9 | +import com.zteits.urbanops.module.bpm.dal.dataobject.oa.BpmOALeaveDO; | ||
| 10 | +import com.zteits.urbanops.module.workorder.controller.admin.garden.vo.BpmGardenWorkOrderCreateReqVo; | ||
| 11 | +import com.zteits.urbanops.module.workorder.controller.admin.garden.vo.BpmGardenWorkOrderPageReqVO; | ||
| 12 | +import com.zteits.urbanops.module.workorder.controller.admin.garden.vo.BpmGardenWorkOrderRespVO; | ||
| 13 | +import com.zteits.urbanops.module.workorder.dal.dataobject.garden.BpmGardenWorkOrderDO; | ||
| 14 | +import com.zteits.urbanops.module.workorder.service.garden.BpmGardenService; | ||
| 15 | +import io.swagger.v3.oas.annotations.Operation; | ||
| 16 | +import io.swagger.v3.oas.annotations.Parameter; | ||
| 17 | +import io.swagger.v3.oas.annotations.tags.Tag; | ||
| 18 | +import jakarta.annotation.Resource; | ||
| 19 | +import jakarta.validation.Valid; | ||
| 20 | +import org.springframework.security.access.prepost.PreAuthorize; | ||
| 21 | +import org.springframework.validation.annotation.Validated; | ||
| 22 | +import org.springframework.web.bind.annotation.*; | ||
| 23 | + | ||
| 24 | +import static com.zteits.urbanops.framework.common.pojo.CommonResult.success; | ||
| 25 | +import static com.zteits.urbanops.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; | ||
| 26 | + | ||
| 27 | +/** | ||
| 28 | + * @author yanhuiqing | ||
| 29 | + * @version 1.0 | ||
| 30 | + * @description: 园林巡检工单 | ||
| 31 | + * @date 2025/12/3 11:03 | ||
| 32 | + */ | ||
| 33 | +@Tag(name = "管理后台 - 园林巡检工单") | ||
| 34 | +@RestController | ||
| 35 | +@RequestMapping("/bpm/garden/inspection") | ||
| 36 | +@Validated | ||
| 37 | +public class BpmGardenInspectController { | ||
| 38 | + @Resource | ||
| 39 | + private BpmGardenService gardenService; | ||
| 40 | + | ||
| 41 | + @PostMapping("/create") | ||
| 42 | + @PreAuthorize("@ss.hasPermission('bpm:garden-inspection:create')") | ||
| 43 | + @Operation(summary = "创建请求申请") | ||
| 44 | + public CommonResult<Long> createGardenInspection(@Valid @RequestBody BpmGardenWorkOrderCreateReqVo createReqVO) { | ||
| 45 | + return success(gardenService.createWorkOrder(getLoginUserId(), createReqVO)); | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + @GetMapping("/get") | ||
| 49 | + @PreAuthorize("@ss.hasPermission('bpm:garden-inspection:query')") | ||
| 50 | + @Operation(summary = "获得园林工单申请") | ||
| 51 | + @Parameter(name = "id", description = "编号", required = true, example = "1024") | ||
| 52 | + public CommonResult<BpmGardenWorkOrderRespVO> getGardenInspection(@RequestParam("id") Long id) { | ||
| 53 | + BpmGardenWorkOrderDO gardenInspection = gardenService.getWorkOrder(id); | ||
| 54 | + return success(BeanUtils.toBean(gardenInspection, BpmGardenWorkOrderRespVO.class)); | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + @GetMapping("/page") | ||
| 58 | + @PreAuthorize("@ss.hasPermission('bpm:garden-inspection:query')") | ||
| 59 | + @Operation(summary = "获得园林巡检工单申请分页") | ||
| 60 | + public CommonResult<PageResult<BpmGardenWorkOrderRespVO>> getGardenInspectionPage(@Valid BpmGardenWorkOrderPageReqVO pageVO) { | ||
| 61 | + PageResult<BpmGardenWorkOrderDO> pageResult = gardenService.getGardenInspectionPage(getLoginUserId(), pageVO); | ||
| 62 | + return success(BeanUtils.toBean(pageResult, BpmGardenWorkOrderRespVO.class)); | ||
| 63 | + } | ||
| 64 | +} |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/controller/admin/garden/vo/BpmGardenWorkOrderCreateReqVo.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.workorder.controller.admin.garden.vo; | ||
| 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 org.hibernate.validator.constraints.Length; | ||
| 8 | + | ||
| 9 | +import java.math.BigDecimal; | ||
| 10 | +import java.util.List; | ||
| 11 | +import java.util.Map; | ||
| 12 | + | ||
| 13 | +/** | ||
| 14 | + * @author yanhuiqing | ||
| 15 | + * @version 1.0 | ||
| 16 | + * @description: 园林工单请求创建 Request VO | ||
| 17 | + * @date 2025/12/1 11:17 | ||
| 18 | + */ | ||
| 19 | +@Schema(description = "园林工单请求创建 Request VO") | ||
| 20 | +@Data | ||
| 21 | +public class BpmGardenWorkOrderCreateReqVo { | ||
| 22 | + | ||
| 23 | + @Schema(description = "业务线:yl 园林,wy 物业,sz 市政 ", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 24 | + @NotEmpty(message = "业务线:yl 园林,wy 物业,sz 市政 不能为空") | ||
| 25 | + private String busiLine; | ||
| 26 | + | ||
| 27 | + @Schema(description = "道路ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "21128") | ||
| 28 | + @NotNull(message = "道路ID不能为空") | ||
| 29 | + private Long roadId; | ||
| 30 | + | ||
| 31 | + @Schema(description = "上传图片", example = "9184") | ||
| 32 | + private List<String> imgs; | ||
| 33 | + @Schema(description = "街道照片", example = "9184") | ||
| 34 | + private List<String> streetImgList; | ||
| 35 | + @Schema(description = "远景照片", example = "9184") | ||
| 36 | + private List<String> longRangeImgList; | ||
| 37 | + | ||
| 38 | + @Schema(description = "工单描述", requiredMode = Schema.RequiredMode.REQUIRED, example = "你说的对") | ||
| 39 | + @NotEmpty(message = "工单描述不能为空") | ||
| 40 | + @Length(max = 500) | ||
| 41 | + private String remark; | ||
| 42 | + | ||
| 43 | + @Schema(description = "经纬度类型: 1:国标; 2:百度;3:高德;4:腾讯", example = "2") | ||
| 44 | + private Integer latLonType; | ||
| 45 | + | ||
| 46 | + @Schema(description = "经度", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 47 | + @NotNull(message = "经度不能为空") | ||
| 48 | + private BigDecimal lat; | ||
| 49 | + | ||
| 50 | + @Schema(description = "维度", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 51 | + @NotNull(message = "维度不能为空") | ||
| 52 | + private BigDecimal lon; | ||
| 53 | + | ||
| 54 | + @Schema(description = "经纬度地址", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 55 | + @NotEmpty(message = "经纬度地址不能为空") | ||
| 56 | + private String lonLatAddress; | ||
| 57 | + | ||
| 58 | + @Schema(description = "紧急程度:1:特急;2:紧急;3:一般", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") | ||
| 59 | + @NotNull(message = "紧急程度:1:特急;2:紧急;3:一般不能为空") | ||
| 60 | + private Integer pressingType; | ||
| 61 | + | ||
| 62 | + @Schema(description = "来源ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 63 | + @NotNull(message = "来源ID不能为空") | ||
| 64 | + private Integer sourceId; | ||
| 65 | + | ||
| 66 | + @Schema(description = "来源名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "园林") | ||
| 67 | + @NotEmpty(message = "来源名称不能为空") | ||
| 68 | + private String sourceName; | ||
| 69 | + | ||
| 70 | + @Schema(description = "三方工单ID") | ||
| 71 | + private String thirdWorkNo; | ||
| 72 | + | ||
| 73 | + @Schema(description = "发起人自选审批人 Map", example = "{taskKey1: [1, 2]}") | ||
| 74 | + private Map<String, List<Long>> startUserSelectAssignees; | ||
| 75 | + | ||
| 76 | + @Schema(description = "是否需要养护人员修复,'0' 是,'1' 否") | ||
| 77 | + private String isYesOrNo; | ||
| 78 | + | ||
| 79 | + | ||
| 80 | +} |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/controller/admin/garden/vo/BpmGardenWorkOrderPageReqVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.workorder.controller.admin.garden.vo; | ||
| 2 | + | ||
| 3 | +import com.zteits.urbanops.framework.common.pojo.PageParam; | ||
| 4 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 5 | +import lombok.Data; | ||
| 6 | + | ||
| 7 | +/** | ||
| 8 | + * @author yanhuiqing | ||
| 9 | + * @version 1.0 | ||
| 10 | + * @description: 园林工单申请分页 Request VO | ||
| 11 | + * @date 2025/12/3 11:32 | ||
| 12 | + */ | ||
| 13 | +@Schema(description = "管理后台 - 园林工单申请分页 Request VO") | ||
| 14 | +@Data | ||
| 15 | +public class BpmGardenWorkOrderPageReqVO extends PageParam { | ||
| 16 | +} |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/controller/admin/garden/vo/BpmGardenWorkOrderRespVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.workorder.controller.admin.garden.vo; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +/** | ||
| 7 | + * @author yanhuiqing | ||
| 8 | + * @version 1.0 | ||
| 9 | + * @description: 园林工单流程 Response VO | ||
| 10 | + * @date 2025/12/3 11:31 | ||
| 11 | + */ | ||
| 12 | +@Schema(description = "管理后台 - 园林工单流程 Response VO") | ||
| 13 | +@Data | ||
| 14 | +public class BpmGardenWorkOrderRespVO { | ||
| 15 | +} |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/dal/dataobject/garden/BpmGardenWorkOrderDO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.workorder.dal.dataobject.garden; | ||
| 2 | + | ||
| 3 | +import com.zteits.urbanops.module.workorder.dal.dataobject.maininfo.MainInfoDO; | ||
| 4 | + | ||
| 5 | +/** | ||
| 6 | + * @author yanhuiqing | ||
| 7 | + * @version 1.0 | ||
| 8 | + * @description: TODO | ||
| 9 | + * @date 2025/12/1 11:34 | ||
| 10 | + */ | ||
| 11 | +public class BpmGardenWorkOrderDO extends MainInfoDO { | ||
| 12 | +} |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/dal/mysql/maininfo/MainInfoMapper.java
| @@ -49,4 +49,36 @@ public interface MainInfoMapper extends BaseMapperX<MainInfoDO> { | @@ -49,4 +49,36 @@ public interface MainInfoMapper extends BaseMapperX<MainInfoDO> { | ||
| 49 | .orderByDesc(MainInfoDO::getId)); | 49 | .orderByDesc(MainInfoDO::getId)); |
| 50 | } | 50 | } |
| 51 | 51 | ||
| 52 | + default PageResult<MainInfoDO> selectPage(Long loginUserId,MainInfoPageReqVO reqVO) { | ||
| 53 | + return selectPage(reqVO, new LambdaQueryWrapperX<MainInfoDO>() | ||
| 54 | + .eqIfPresent(MainInfoDO::getBusiLine, reqVO.getBusiLine()) | ||
| 55 | + .eqIfPresent(MainInfoDO::getOrderNo, reqVO.getOrderNo()) | ||
| 56 | + .likeIfPresent(MainInfoDO::getOrderName, reqVO.getOrderName()) | ||
| 57 | + .eqIfPresent(MainInfoDO::getSourceId, reqVO.getSourceId()) | ||
| 58 | + .likeIfPresent(MainInfoDO::getSourceName, reqVO.getSourceName()) | ||
| 59 | + .eqIfPresent(MainInfoDO::getRoadId, reqVO.getRoadId()) | ||
| 60 | + .likeIfPresent(MainInfoDO::getRoadName, reqVO.getRoadName()) | ||
| 61 | + .eqIfPresent(MainInfoDO::getStreetId, reqVO.getStreetId()) | ||
| 62 | + .likeIfPresent(MainInfoDO::getStreetName, reqVO.getStreetName()) | ||
| 63 | + .eqIfPresent(MainInfoDO::getCuringLevelId, reqVO.getCuringLevelId()) | ||
| 64 | + .likeIfPresent(MainInfoDO::getCuringLevelName, reqVO.getCuringLevelName()) | ||
| 65 | + .betweenIfPresent(MainInfoDO::getCommitDate, reqVO.getCommitDate()) | ||
| 66 | + .eqIfPresent(MainInfoDO::getPressingType, reqVO.getPressingType()) | ||
| 67 | + .eqIfPresent(MainInfoDO::getUserId, loginUserId) | ||
| 68 | + .likeIfPresent(MainInfoDO::getUserName, reqVO.getUserName()) | ||
| 69 | + .eqIfPresent(MainInfoDO::getCompanyId, reqVO.getCompanyId()) | ||
| 70 | + .eqIfPresent(MainInfoDO::getLatLonType, reqVO.getLatLonType()) | ||
| 71 | + .eqIfPresent(MainInfoDO::getLat, reqVO.getLat()) | ||
| 72 | + .eqIfPresent(MainInfoDO::getLon, reqVO.getLon()) | ||
| 73 | + .eqIfPresent(MainInfoDO::getLonLatAddress, reqVO.getLonLatAddress()) | ||
| 74 | + .eqIfPresent(MainInfoDO::getThirdWorkNo, reqVO.getThirdWorkNo()) | ||
| 75 | + .eqIfPresent(MainInfoDO::getThirdPushState, reqVO.getThirdPushState()) | ||
| 76 | + .eqIfPresent(MainInfoDO::getBuzStatus, reqVO.getBuzStatus()) | ||
| 77 | + .eqIfPresent(MainInfoDO::getStatus, reqVO.getStatus()) | ||
| 78 | + .eqIfPresent(MainInfoDO::getProcessInstanceId, reqVO.getProcessInstanceId()) | ||
| 79 | + .eqIfPresent(MainInfoDO::getRemark, reqVO.getRemark()) | ||
| 80 | + .betweenIfPresent(MainInfoDO::getCreateTime, reqVO.getCreateTime()) | ||
| 81 | + .orderByDesc(MainInfoDO::getId)); | ||
| 82 | + } | ||
| 83 | + | ||
| 52 | } | 84 | } |
| 53 | \ No newline at end of file | 85 | \ No newline at end of file |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/enums/ErrorCodeConstants.java
| @@ -11,9 +11,9 @@ import com.zteits.urbanops.framework.common.exception.ErrorCode; | @@ -11,9 +11,9 @@ import com.zteits.urbanops.framework.common.exception.ErrorCode; | ||
| 11 | public interface ErrorCodeConstants { | 11 | public interface ErrorCodeConstants { |
| 12 | 12 | ||
| 13 | // ========== server 工单 1-100-001-000 ========== | 13 | // ========== server 工单 1-100-001-000 ========== |
| 14 | - ErrorCode MAIN_INFO_NOT_EXISTS = new ErrorCode(1-100-001-000, "工单信息不存在"); | 14 | + ErrorCode MAIN_INFO_NOT_EXISTS = new ErrorCode(1-900-001-000, "工单信息不存在"); |
| 15 | 15 | ||
| 16 | - ErrorCode ATTACHMENT_NOT_EXISTS = new ErrorCode(1-100-002-000, "工单附件信息不存在"); | 16 | + ErrorCode ATTACHMENT_NOT_EXISTS = new ErrorCode(1-900-001-001, "工单附件信息不存在"); |
| 17 | 17 | ||
| 18 | - ErrorCode MATERIAL_DETAIL_NOT_EXISTS = new ErrorCode(1-100-003-000, "工单耗材明细不存在"); | 18 | + ErrorCode MATERIAL_DETAIL_NOT_EXISTS = new ErrorCode(1-900-001-002, "工单耗材明细不存在"); |
| 19 | } | 19 | } |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/service/garden/BpmGardenService.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.workorder.service.garden; | ||
| 2 | + | ||
| 3 | +import com.zteits.urbanops.framework.common.pojo.PageResult; | ||
| 4 | +import com.zteits.urbanops.module.workorder.controller.admin.garden.vo.BpmGardenWorkOrderCreateReqVo; | ||
| 5 | +import com.zteits.urbanops.module.workorder.controller.admin.garden.vo.BpmGardenWorkOrderPageReqVO; | ||
| 6 | +import com.zteits.urbanops.module.workorder.dal.dataobject.garden.BpmGardenWorkOrderDO; | ||
| 7 | +import jakarta.validation.Valid; | ||
| 8 | +/** | ||
| 9 | + * @author yanhuiqing | ||
| 10 | + * @version 1.0 | ||
| 11 | + * @description: 园林工作流 | ||
| 12 | + * @date 2025/12/1 11:13 | ||
| 13 | + */ | ||
| 14 | +public interface BpmGardenService { | ||
| 15 | + /** | ||
| 16 | + * 园林工单申请 Service 接口 | ||
| 17 | + * @param userId | ||
| 18 | + * @param createRequestVo | ||
| 19 | + * @return | ||
| 20 | + */ | ||
| 21 | + Long createWorkOrder(Long userId,@Valid BpmGardenWorkOrderCreateReqVo createRequestVo); | ||
| 22 | + | ||
| 23 | + /** | ||
| 24 | + * 更新工单申请的状态 | ||
| 25 | + * | ||
| 26 | + * @param id 编号 | ||
| 27 | + * @param status 结果 | ||
| 28 | + */ | ||
| 29 | + void updateWorkOrderStatus(Long id, Integer status); | ||
| 30 | + | ||
| 31 | + /** | ||
| 32 | + * 获得工单详情 | ||
| 33 | + * | ||
| 34 | + * @param id 编号 | ||
| 35 | + * @return 工单详情 | ||
| 36 | + */ | ||
| 37 | + BpmGardenWorkOrderDO getWorkOrder(Long id); | ||
| 38 | + | ||
| 39 | + /** | ||
| 40 | + * 获得工单分页数据 | ||
| 41 | + * @param loginUserId | ||
| 42 | + * @param pageVO | ||
| 43 | + * @return | ||
| 44 | + */ | ||
| 45 | + PageResult<BpmGardenWorkOrderDO> getGardenInspectionPage(Long loginUserId, BpmGardenWorkOrderPageReqVO pageVO); | ||
| 46 | +} |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/service/garden/BpmGardenServiceImpl.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.workorder.service.garden; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||
| 4 | +import com.zteits.urbanops.framework.common.pojo.PageResult; | ||
| 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.module.bpm.api.task.BpmProcessInstanceApi; | ||
| 8 | +import com.zteits.urbanops.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO; | ||
| 9 | +import com.zteits.urbanops.module.bpm.enums.task.BpmTaskStatusEnum; | ||
| 10 | +import com.zteits.urbanops.module.workorder.api.constant.BpmCommonConstant; | ||
| 11 | +import com.zteits.urbanops.module.workorder.controller.admin.garden.vo.BpmGardenWorkOrderCreateReqVo; | ||
| 12 | +import com.zteits.urbanops.module.workorder.controller.admin.garden.vo.BpmGardenWorkOrderPageReqVO; | ||
| 13 | +import com.zteits.urbanops.module.workorder.controller.admin.maininfo.vo.MainInfoPageReqVO; | ||
| 14 | +import com.zteits.urbanops.module.workorder.dal.dataobject.attachment.AttachmentDO; | ||
| 15 | +import com.zteits.urbanops.module.workorder.dal.dataobject.garden.BpmGardenWorkOrderDO; | ||
| 16 | +import com.zteits.urbanops.module.workorder.dal.dataobject.maininfo.MainInfoDO; | ||
| 17 | +import com.zteits.urbanops.module.workorder.dal.mysql.attachment.AttachmentMapper; | ||
| 18 | +import com.zteits.urbanops.module.workorder.dal.mysql.maininfo.MainInfoMapper; | ||
| 19 | +import jakarta.annotation.Resource; | ||
| 20 | +import org.springframework.stereotype.Service; | ||
| 21 | +import org.springframework.transaction.annotation.Transactional; | ||
| 22 | +import org.springframework.validation.annotation.Validated; | ||
| 23 | + | ||
| 24 | +import java.time.LocalDateTime; | ||
| 25 | +import java.util.HashMap; | ||
| 26 | +import java.util.List; | ||
| 27 | +import java.util.Map; | ||
| 28 | + | ||
| 29 | +import static com.zteits.urbanops.framework.common.exception.util.ServiceExceptionUtil.exception; | ||
| 30 | +import static com.zteits.urbanops.module.workorder.enums.ErrorCodeConstants.MAIN_INFO_NOT_EXISTS; | ||
| 31 | + | ||
| 32 | +/** | ||
| 33 | + * @author yanhuiqing | ||
| 34 | + * @version 1.0 | ||
| 35 | + * @description: 园林工作流实现类 | ||
| 36 | + * @date 2025/12/1 11:38 | ||
| 37 | + */ | ||
| 38 | +@Service | ||
| 39 | +@Validated | ||
| 40 | +public class BpmGardenServiceImpl implements BpmGardenService{ | ||
| 41 | + | ||
| 42 | + @Resource | ||
| 43 | + private AttachmentMapper attachmentMapper; | ||
| 44 | + @Resource | ||
| 45 | + private MainInfoMapper workOrderMapper; | ||
| 46 | + @Resource | ||
| 47 | + private BpmProcessInstanceApi processInstanceApi; | ||
| 48 | + @Override | ||
| 49 | + @Transactional(rollbackFor = Exception.class) | ||
| 50 | + public Long createWorkOrder(Long userId, BpmGardenWorkOrderCreateReqVo createRequestVo) { | ||
| 51 | + List<String> imgList = createRequestVo.getImgs(); | ||
| 52 | + List<String> streetImgList = createRequestVo.getStreetImgList(); | ||
| 53 | + List<String> longRangeImgList = createRequestVo.getLongRangeImgList(); | ||
| 54 | + String isYesOrNo = createRequestVo.getIsYesOrNo(); | ||
| 55 | + // 插入 工单 | ||
| 56 | + MainInfoDO workOrder = BeanUtils.toBean(createRequestVo, MainInfoDO.class) | ||
| 57 | + .setStatus(BpmTaskStatusEnum.RUNNING.getStatus()); | ||
| 58 | + //TODO 设置其它值 需从道路表获取 | ||
| 59 | + workOrder.setStreetId("test"); | ||
| 60 | + workOrder.setBuzStatus("t1");//需给出映射关系 | ||
| 61 | + workOrder.setCommitDate(LocalDateTime.now()); | ||
| 62 | + workOrderMapper.insert(workOrder); | ||
| 63 | + | ||
| 64 | + //附件插入 | ||
| 65 | + attachmentApend(imgList,streetImgList,longRangeImgList,workOrder); | ||
| 66 | + // 发起 BPM 流程 | ||
| 67 | + Map<String, Object> processInstanceVariables = new HashMap<>(); | ||
| 68 | + processInstanceVariables.put("isYesOrNo", isYesOrNo); | ||
| 69 | + String processInstanceId = processInstanceApi.createProcessInstance(userId, | ||
| 70 | + new BpmProcessInstanceCreateReqDTO().setProcessDefinitionKey(BpmCommonConstant.BPM_GARDEN_INSPECT_WO) | ||
| 71 | + .setVariables(processInstanceVariables).setBusinessKey(String.valueOf(workOrder.getId())) | ||
| 72 | + .setStartUserSelectAssignees(createRequestVo.getStartUserSelectAssignees())); | ||
| 73 | + | ||
| 74 | + // 将工作流的编号,更新到 工单中 | ||
| 75 | + workOrderMapper.updateById(new MainInfoDO().setId(workOrder.getId()).setProcessInstanceId(processInstanceId)); | ||
| 76 | + return workOrder.getId(); | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + /** | ||
| 80 | + * 附件插入 | ||
| 81 | + * @param imgList 问题照片 P1 | ||
| 82 | + * @param streetImgList 街道照片 P2 | ||
| 83 | + * @param longRangeImgList 远景照片 P3 | ||
| 84 | + * @param workOrder | ||
| 85 | + */ | ||
| 86 | + private void attachmentApend(List<String> imgList, List<String> streetImgList, List<String> longRangeImgList, MainInfoDO workOrder) { | ||
| 87 | + //问题图片 | ||
| 88 | + if(ObjectUtils.isNotAllEmpty(imgList)){ | ||
| 89 | + AttachmentDO saveDO = new AttachmentDO(); | ||
| 90 | + saveDO.setBusiLine(workOrder.getBusiLine()); | ||
| 91 | + saveDO.setBusiType(BpmCommonConstant.GARDEN_INSPECT_WO_ATTACH1); | ||
| 92 | + saveDO.setOrderNo(workOrder.getOrderNo()); | ||
| 93 | + String filePaths = String.join(",",imgList); | ||
| 94 | + saveDO.setFileNames(filePaths); | ||
| 95 | + LambdaQueryWrapper<AttachmentDO> deleteWrapper = new LambdaQueryWrapper<AttachmentDO>() | ||
| 96 | + .eq(AttachmentDO::getBusiLine, workOrder.getBusiLine()) | ||
| 97 | + .eq(AttachmentDO::getBusiType, BpmCommonConstant.GARDEN_INSPECT_WO_ATTACH1) | ||
| 98 | + .eq(AttachmentDO::getOrderNo, workOrder.getOrderNo()); | ||
| 99 | + attachmentMapper.delete(deleteWrapper); | ||
| 100 | + attachmentMapper.insert(saveDO); | ||
| 101 | + } | ||
| 102 | + //街道图片 | ||
| 103 | + if(ObjectUtils.isNotAllEmpty(streetImgList)){ | ||
| 104 | + AttachmentDO saveDO = new AttachmentDO(); | ||
| 105 | + saveDO.setBusiLine(workOrder.getBusiLine()); | ||
| 106 | + saveDO.setBusiType(BpmCommonConstant.GARDEN_INSPECT_WO_ATTACH2); | ||
| 107 | + saveDO.setOrderNo(workOrder.getOrderNo()); | ||
| 108 | + String filePaths = String.join(",",streetImgList); | ||
| 109 | + saveDO.setFileNames(filePaths); | ||
| 110 | + LambdaQueryWrapper<AttachmentDO> deleteWrapper = new LambdaQueryWrapper<AttachmentDO>() | ||
| 111 | + .eq(AttachmentDO::getBusiLine, workOrder.getBusiLine()) | ||
| 112 | + .eq(AttachmentDO::getBusiType, BpmCommonConstant.GARDEN_INSPECT_WO_ATTACH2) | ||
| 113 | + .eq(AttachmentDO::getOrderNo, workOrder.getOrderNo()); | ||
| 114 | + attachmentMapper.delete(deleteWrapper); | ||
| 115 | + attachmentMapper.insert(saveDO); | ||
| 116 | + } | ||
| 117 | + //远景图片 | ||
| 118 | + if(ObjectUtils.isNotAllEmpty(longRangeImgList)){ | ||
| 119 | + AttachmentDO saveDO = new AttachmentDO(); | ||
| 120 | + saveDO.setBusiLine(workOrder.getBusiLine()); | ||
| 121 | + saveDO.setBusiType(BpmCommonConstant.GARDEN_INSPECT_WO_ATTACH3); | ||
| 122 | + saveDO.setOrderNo(workOrder.getOrderNo()); | ||
| 123 | + String filePaths = String.join(",",longRangeImgList); | ||
| 124 | + saveDO.setFileNames(filePaths); | ||
| 125 | + LambdaQueryWrapper<AttachmentDO> deleteWrapper = new LambdaQueryWrapper<AttachmentDO>() | ||
| 126 | + .eq(AttachmentDO::getBusiLine, workOrder.getBusiLine()) | ||
| 127 | + .eq(AttachmentDO::getBusiType, BpmCommonConstant.GARDEN_INSPECT_WO_ATTACH3) | ||
| 128 | + .eq(AttachmentDO::getOrderNo, workOrder.getOrderNo()); | ||
| 129 | + attachmentMapper.delete(deleteWrapper); | ||
| 130 | + attachmentMapper.insert(saveDO); | ||
| 131 | + } | ||
| 132 | + | ||
| 133 | + | ||
| 134 | + } | ||
| 135 | + | ||
| 136 | + | ||
| 137 | + @Override | ||
| 138 | + public void updateWorkOrderStatus(Long id, Integer status) { | ||
| 139 | + validateExists(id); | ||
| 140 | + workOrderMapper.updateById(new MainInfoDO().setId(id).setStatus(status)); | ||
| 141 | + } | ||
| 142 | + private void validateExists(Long id) { | ||
| 143 | + if (workOrderMapper.selectById(id) == null) { | ||
| 144 | + throw exception(MAIN_INFO_NOT_EXISTS); | ||
| 145 | + } | ||
| 146 | + } | ||
| 147 | + | ||
| 148 | + @Override | ||
| 149 | + public BpmGardenWorkOrderDO getWorkOrder(Long id) { | ||
| 150 | + MainInfoDO workOrder = workOrderMapper.selectById(id); | ||
| 151 | + BpmGardenWorkOrderDO targetVo = BeanUtils.toBean(workOrder, BpmGardenWorkOrderDO.class); | ||
| 152 | + //TODO 定义页面展示字段在此扩展 | ||
| 153 | + return targetVo; | ||
| 154 | + } | ||
| 155 | + | ||
| 156 | + @Override | ||
| 157 | + public PageResult<BpmGardenWorkOrderDO> getGardenInspectionPage(Long loginUserId, BpmGardenWorkOrderPageReqVO pageVO) { | ||
| 158 | + MainInfoPageReqVO mainInfoPageReqVo = BeanUtils.toBean(pageVO,MainInfoPageReqVO.class); | ||
| 159 | + PageResult<MainInfoDO> pageList = workOrderMapper.selectPage(loginUserId, mainInfoPageReqVo); | ||
| 160 | + PageResult<BpmGardenWorkOrderDO> targetList = BeanUtils.toBean(pageList,BpmGardenWorkOrderDO.class); | ||
| 161 | + return targetList; | ||
| 162 | + } | ||
| 163 | +} |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/service/garden/listener/BomGardenWorkOrderStatusListener.java
0 → 100644
| 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.service.garden.BpmGardenService; | ||
| 6 | +import jakarta.annotation.Resource; | ||
| 7 | +import org.springframework.stereotype.Component; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * @author yanhuiqing | ||
| 11 | + * @version 1.0 | ||
| 12 | + * @description: 工作流状态监听类 | ||
| 13 | + * @date 2025/12/1 11:45 | ||
| 14 | + */ | ||
| 15 | +@Component | ||
| 16 | +public class BomGardenWorkOrderStatusListener extends BpmProcessInstanceStatusEventListener { | ||
| 17 | + @Resource | ||
| 18 | + private BpmGardenService gardenService; | ||
| 19 | + @Override | ||
| 20 | + protected String getProcessDefinitionKey() { | ||
| 21 | + | ||
| 22 | + return null; | ||
| 23 | + } | ||
| 24 | + | ||
| 25 | + @Override | ||
| 26 | + protected void onEvent(BpmProcessInstanceStatusEvent event) { | ||
| 27 | + gardenService.updateWorkOrderStatus(Long.parseLong(event.getBusinessKey()), event.getStatus()); | ||
| 28 | + } | ||
| 29 | +} |