Commit 9f88780a904091b9297f2215d880c2c9cd51022f

Authored by wangqian
2 parents 131ad9be 1dfc0b51

Merge remote-tracking branch 'origin/dev' into dev

Showing 43 changed files with 459 additions and 89 deletions
urbanops-module-api/urbanops-module-garden-api/src/main/java/com/zteits/urbanops/module/garden/api/road/RoadApi.java
... ... @@ -10,5 +10,5 @@ import java.util.List;
10 10 public interface RoadApi {
11 11 List<RoadRespDTO> getRoadInfoBy(RoadReqDTO reqDTO);
12 12  
13   - RoadStreetRespDTO getRoadInfoById(Long id);
  13 + RoadStreetRespDTO getRoadInfoById(String id);
14 14 }
... ...
urbanops-module-api/urbanops-module-garden-api/src/main/java/com/zteits/urbanops/module/garden/dto/road/RoadStreetRespDTO.java
... ... @@ -12,7 +12,7 @@ import lombok.Data;
12 12 @Data
13 13 public class RoadStreetRespDTO {
14 14  
15   - private Long id;
  15 + private String id;
16 16  
17 17 private String roadName;
18 18  
... ... @@ -28,4 +28,8 @@ public class RoadStreetRespDTO {
28 28 private Integer levelId;
29 29  
30 30 private Long companyId;
  31 + /**
  32 + * 道路负责部门
  33 + */
  34 + private Long deptId;
31 35 }
... ...
urbanops-module-api/urbanops-module-workorder-api/src/main/java/com/zteits/urbanops/module/workorder/api/WorkOrderApi.java
... ... @@ -33,7 +33,7 @@ public interface WorkOrderApi {
33 33 * @param busiLine
34 34 * @return
35 35 */
36   - public List<AdminUserRespVO> getUserByRoadIdAndRoleCode(Long roadId, String roleCode, String busiLine);
  36 + public List<AdminUserRespVO> getUserByRoadIdAndRoleCode(String roadId, String roleCode, String busiLine);
37 37  
38 38 /**
39 39 * 创建工单API
... ...
urbanops-module-api/urbanops-module-workorder-api/src/main/java/com/zteits/urbanops/module/workorder/dto/AppGardenWorkOrderAIReqVO.java
... ... @@ -23,7 +23,7 @@ public class AppGardenWorkOrderAIReqVO {
23 23  
24 24 @Schema(description = "道路ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "21128")
25 25 @NotNull(message = "道路ID不能为空")
26   - private Long roadId;
  26 + private String roadId;
27 27  
28 28 /**
29 29 * 工单类型 Q:快速工单,C:普通工单,O:其他工单
... ... @@ -63,7 +63,7 @@ public class AppGardenWorkOrderAIReqVO {
63 63 @Schema(description = "工单名称", example = "绿地卫生")
64 64 private String orderName;
65 65  
66   - @Schema(description = "来源ID 工单来源 1、巡查,2、游客居民,3、12345,4、网格", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
  66 + @Schema(description = "来源ID 工单来源 1、巡查,2、游客居民,3、12345,4、网格,5 大区经理,6 AI", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
67 67 //@NotNull(message = "来源ID不能为空")
68 68 private Integer sourceId;
69 69  
... ... @@ -81,6 +81,12 @@ public class AppGardenWorkOrderAIReqVO {
81 81 @Schema(description = "工单业务线", example = "yl")
82 82 private String busiLine;
83 83  
  84 + @Schema(description = "工单来源编码", example = "axcbng")
  85 + private String woSourceId;
  86 +
  87 + @Schema(description = "工单来源名称", example = "摄像头")
  88 + private String woSourceName;
  89 +
84 90  
85 91  
86 92 }
... ...
urbanops-module-api/urbanops-module-workorder-api/src/main/java/com/zteits/urbanops/module/workorder/dto/AppGardenWorkOrderInspectorReqVO.java
... ... @@ -23,7 +23,7 @@ public class AppGardenWorkOrderInspectorReqVO {
23 23  
24 24 @Schema(description = "道路ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "21128")
25 25 @NotNull(message = "道路ID不能为空")
26   - private Long roadId;
  26 + private String roadId;
27 27  
28 28 /**
29 29 * 工单类型 Q:快速工单,C:普通工单,O:其他工单
... ...
urbanops-module-api/urbanops-module-workorder-api/src/main/java/com/zteits/urbanops/module/workorder/dto/AppGardenWorkOrderReqVO.java
... ... @@ -24,7 +24,7 @@ public class AppGardenWorkOrderReqVO {
24 24  
25 25 @Schema(description = "道路ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "21128")
26 26 @NotNull(message = "道路ID不能为空")
27   - private Long roadId;
  27 + private String roadId;
28 28  
29 29 /**
30 30 * 工单类型 Q:快速工单,C:普通工单,O:其他工单
... ...
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/api/road/RoadApiImpl.java
... ... @@ -62,8 +62,10 @@ public class RoadApiImpl implements RoadApi {
62 62 }
63 63  
64 64 @Override
65   - public RoadStreetRespDTO getRoadInfoById(Long id) {
66   - RoadRespVO roadRespVO = roadService.getUniqueRoad(id);
67   - return BeanUtils.toBean(roadRespVO, RoadStreetRespDTO.class);
  65 + public RoadStreetRespDTO getRoadInfoById(String id) {
  66 + RoadRespVO roadRespVO = roadService.getUniqueRoad(Long.parseLong(id));
  67 + RoadStreetRespDTO targetVO = BeanUtils.toBean(roadRespVO, RoadStreetRespDTO.class);
  68 + targetVO.setId(roadRespVO.getId().toString());
  69 + return targetVO;
68 70 }
69 71 }
... ...
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/convert/AppGardenWorkOrderConvert.java
... ... @@ -17,7 +17,7 @@ public interface AppGardenWorkOrderConvert {
17 17  
18 18 default AppGardenWorkOrderReqVO buildAppGardenWorkOrderReqVO(AppInspectionPlanCommitSaveReqVO createReqVO, InspectionPlanDO inspectionPlanDO, RoadDO roadDO, String planNo ) {
19 19 AppGardenWorkOrderReqVO orderReqVO = new AppGardenWorkOrderReqVO();
20   - orderReqVO.setRoadId(inspectionPlanDO.getRoadId());
  20 + orderReqVO.setRoadId(inspectionPlanDO.getRoadId().toString());
21 21 orderReqVO.setRoadName(inspectionPlanDO.getRoadName());
22 22 orderReqVO.setProblemsImgs(createReqVO.getImgList());
23 23 orderReqVO.setRemark(createReqVO.getRemark());
... ...
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/api/constant/BpmCommonConstant.java
... ... @@ -171,9 +171,14 @@ public class BpmCommonConstant {
171 171 * 大区经理 角色编码
172 172 */
173 173 public static final String REGIONAL_MANAGER = "regional_manager";
174   -
  174 + /**
  175 + * 督察员 角色编码
  176 + */
175 177 public static final String INSPECTOR_GLOBAL = "Inspector_global";
176   -
  178 + /**
  179 + * ai 工单派发人
  180 + */
  181 + public static final String AI_DISPATCHER = "AI_dispatcher";
177 182 /*养护级别-字典key*/
178 183 public static final String CONSERVE_LEVEL = "conserve_level";
179 184 //---------------------------------------------------------------------------------
... ...
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/api/workorder/WorkOrderApiImpl.java
... ... @@ -67,7 +67,7 @@ public class WorkOrderApiImpl implements WorkOrderApi {
67 67 }
68 68  
69 69 @Override
70   - public List<AdminUserRespVO> getUserByRoadIdAndRoleCode(Long roadId, String roleCode, String busiLine) {
  70 + public List<AdminUserRespVO> getUserByRoadIdAndRoleCode(String roadId, String roleCode, String busiLine) {
71 71 if(ObjectUtils.isEmpty(roadId) || ObjectUtils.isEmpty(roleCode) || ObjectUtils.isEmpty(busiLine)){
72 72 throw exception0(BAD_REQUEST.getCode(),"param:roadId,roleCode,busiLine 不能为空!");
73 73 }
... ...
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/config/StringArrayTypeHandler.java 0 → 100644
  1 +package com.zteits.urbanops.module.workorder.config;
  2 +
  3 +/**
  4 + * @Classname StringArrayTypeHandler
  5 + * @Description
  6 + * @Date 2025/6/11 14:47
  7 + * @Created by wangqian
  8 + */
  9 +
  10 +import com.fasterxml.jackson.databind.ObjectMapper;
  11 +import org.apache.ibatis.type.BaseTypeHandler;
  12 +import org.apache.ibatis.type.JdbcType;
  13 +import org.apache.ibatis.type.MappedJdbcTypes;
  14 +import org.apache.ibatis.type.MappedTypes;
  15 +
  16 +import java.sql.CallableStatement;
  17 +import java.sql.PreparedStatement;
  18 +import java.sql.ResultSet;
  19 +import java.sql.SQLException;
  20 +
  21 +/**
  22 + * MyBatis 类型处理器,用于处理 JSON 格式的字符串数组与 Java String[] 之间的转换
  23 + */
  24 +@MappedTypes(String[].class)
  25 +@MappedJdbcTypes({JdbcType.VARCHAR, JdbcType.LONGVARCHAR, JdbcType.OTHER})
  26 +public class StringArrayTypeHandler extends BaseTypeHandler<String[]> {
  27 +
  28 + private static final ObjectMapper objectMapper = new ObjectMapper();
  29 +
  30 + @Override
  31 + public void setNonNullParameter(PreparedStatement ps, int i, String[] parameter, JdbcType jdbcType) throws SQLException {
  32 + try {
  33 + // 将 String[] 转换为 JSON 字符串
  34 + String json = objectMapper.writeValueAsString(parameter);
  35 + ps.setString(i, json);
  36 + } catch (Exception e) {
  37 + throw new SQLException("Error converting String[] to JSON: " + e.getMessage(), e);
  38 + }
  39 + }
  40 +
  41 + @Override
  42 + public String[] getNullableResult(ResultSet rs, String columnName) throws SQLException {
  43 + return parseJson(rs.getString(columnName));
  44 + }
  45 +
  46 + @Override
  47 + public String[] getNullableResult(ResultSet rs, int columnIndex) throws SQLException {
  48 + return parseJson(rs.getString(columnIndex));
  49 + }
  50 +
  51 + @Override
  52 + public String[] getNullableResult(CallableStatement cs, int columnIndex) throws SQLException {
  53 + return parseJson(cs.getString(columnIndex));
  54 + }
  55 +
  56 + /**
  57 + * 将 JSON 字符串解析为 String[]
  58 + */
  59 + private String[] parseJson(String json) {
  60 + if (json == null || json.isEmpty()) {
  61 + return new String[0];
  62 + }
  63 + try {
  64 + // 将 JSON 字符串转换为 String[]
  65 + return objectMapper.readValue(json, String[].class);
  66 + } catch (Exception e) {
  67 + throw new RuntimeException("Error converting JSON to String[]: " + e.getMessage(), e);
  68 + }
  69 + }
  70 +}
... ...
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/controller/admin/eventinfo/EventInfoController.java
... ... @@ -69,8 +69,8 @@ public class EventInfoController {
69 69 @PutMapping("/end")
70 70 @Operation(summary = "结束工单事件")
71 71 @PreAuthorize("@ss.hasPermission('workorder:event-info:end')")
72   - public CommonResult<Boolean> endEventInfo(@Valid @RequestParam("id") Long id) {
73   - eventInfoService.endEventInfo(id);
  72 + public CommonResult<Boolean> endEventInfo(@Valid @RequestParam("id") Long[] ids) {
  73 + eventInfoService.endEventInfo(ids);
74 74 return success(true);
75 75 }
76 76  
... ...
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/controller/admin/eventinfo/vo/EventInfoPageReqVO.java
... ... @@ -50,7 +50,7 @@ public class EventInfoPageReqVO extends PageParam {
50 50 private String lonLatAddress;
51 51  
52 52 @Schema(description = "用户提交照片")
53   - private String confrimImgs;
  53 + private String[] confrimImgs;
54 54  
55 55 @Schema(description = "事件状态", example = "1")
56 56 private Integer eventStatus;
... ...
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/controller/admin/eventinfo/vo/EventInfoRespVO.java
... ... @@ -63,7 +63,7 @@ public class EventInfoRespVO {
63 63  
64 64 @Schema(description = "用户提交照片", requiredMode = Schema.RequiredMode.REQUIRED)
65 65 @ExcelProperty("用户提交照片")
66   - private String confrimImgs;
  66 + private String[] confrimImgs;
67 67  
68 68 @Schema(description = "事件状态", example = "1")
69 69 @ExcelProperty("事件状态")
... ... @@ -81,6 +81,8 @@ public class EventInfoRespVO {
81 81 @ExcelProperty("创建人")
82 82 private String creator;
83 83  
  84 + private String ender;
  85 +
84 86  
85 87  
86 88 }
87 89 \ No newline at end of file
... ...
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/controller/admin/eventinfo/vo/EventInfoSaveReqVO.java
... ... @@ -33,6 +33,16 @@ public class EventInfoSaveReqVO {
33 33 @Schema(description = "提交时间")
34 34 private LocalDateTime commitDate;
35 35  
  36 + /**
  37 + * 事件设备
  38 + */
  39 + private String eventDevice;
  40 +
  41 + /**
  42 + * 事件设备编码
  43 + */
  44 + private String eventDeviceCode;
  45 +
36 46 @Schema(description = "完成时间")
37 47 private LocalDateTime finishDate;
38 48  
... ...
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/controller/admin/garden/vo/BpmGardenTaskAssignReqVO.java
... ... @@ -28,7 +28,7 @@ public class BpmGardenTaskAssignReqVO {
28 28  
29 29 @Schema(description = "道路ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "21128")
30 30 @NotNull(message = "道路ID不能为空")
31   - private Long roadId;
  31 + private String roadId;
32 32  
33 33 @Schema(description = "道路名称", example = "测试道路")
34 34 private String roadName;
... ...
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/controller/app/eventinfo/AppEventInfoController.java
... ... @@ -73,8 +73,10 @@ public class AppEventInfoController {
73 73 vo.setConfrimImgs(createReqVO.getUserConfrimImgs());
74 74 vo.setCommitDate(LocalDateTime.now());
75 75 vo.setEvetName(createReqVO.getProblemName());
  76 + vo.setEventDeviceCode(createReqVO.getDeviceCode());
  77 + vo.setEventDevice(createReqVO.getDevice());
76 78 vo.setLatLonType(3);
77   - vo.setCreator("设备");
  79 + vo.setCreator(createReqVO.getDeviceCode());
78 80 vo.setRemark(createReqVO.getUserConfrimRemark());
79 81 // 调用高德API根据经纬度查询地址
80 82 if (createReqVO.getUserConfrimLat() != null && createReqVO.getUserConfrimLon() != null) {
... ...
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/controller/app/garden/aop/AIBuzStatusUpdateAspect.java
... ... @@ -132,6 +132,7 @@ public class AIBuzStatusUpdateAspect {
132 132 if(null == roadStreetRespDTO){
133 133 throw exception(APP_WORK_ROAD_NOT_EXISTS);
134 134 }
  135 + targeVO.setWorkerCompanyId(roadStreetRespDTO.getDeptId());//道路负责部门id
135 136 targeVO.setStreetId(roadStreetRespDTO.getStreetId());
136 137 targeVO.setStreetName(roadStreetRespDTO.getStreetName());
137 138 targeVO.setBuzStatus(ORDER_STATUS_INIT);//工单业务初始化状态 后续操作状态 见 OperateTypeEnum
... ...
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/controller/app/garden/aop/BuzStatusUpdateAspect.java
... ... @@ -33,6 +33,7 @@ import static com.zteits.urbanops.framework.common.exception.util.ServiceExcepti
33 33 import static com.zteits.urbanops.module.workorder.api.constant.BpmCommonConstant.CONSERVE_LEVEL;
34 34 import static com.zteits.urbanops.module.workorder.api.constant.BpmCommonConstant.ORDER_STATUS_INIT;
35 35 import static com.zteits.urbanops.module.workorder.enums.ErrorCodeConstants.APP_WORKER_LEVEL_ID_NOT_EXISTS;
  36 +import static com.zteits.urbanops.module.workorder.enums.ErrorCodeConstants.APP_WORK_ROAD_NOT_EXISTS;
36 37  
37 38 /**
38 39 * 类描述:切面更新工单表业务状态
... ... @@ -122,6 +123,9 @@ public class BuzStatusUpdateAspect {
122 123 //重新发起需更新表单数据
123 124 if(OperateTypeEnum.YL_INSPECTOR_START_RELAUNCH.getCode().equals(operateType.getCode())){
124 125 RoadStreetRespDTO roadStreetRespDTO = roadApi.getRoadInfoById(reqVO.getRoadId());
  126 + if(null == roadStreetRespDTO){
  127 + throw exception(APP_WORK_ROAD_NOT_EXISTS);
  128 + }
125 129 targeVO = BeanUtils.toBean(reqVO,MainInfoDO.class);
126 130 targeVO.setId(reqVO.getWorkerDataId());
127 131  
... ... @@ -131,6 +135,7 @@ public class BuzStatusUpdateAspect {
131 135 targeVO.setOrderNo(dbData.getOrderNo());
132 136 targeVO.setStreetId(roadStreetRespDTO.getStreetId());
133 137 targeVO.setStreetName(roadStreetRespDTO.getStreetName());
  138 + targeVO.setWorkerCompanyId(roadStreetRespDTO.getDeptId());//道路负责部门id
134 139 DictDataRespDTO dictData = dictDataCommonApi.getDictData(CONSERVE_LEVEL, roadStreetRespDTO.getLevelId().toString());
135 140 if(null == dictData){
136 141 throw exception(APP_WORKER_LEVEL_ID_NOT_EXISTS);
... ...
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/controller/app/garden/aop/InspectorBuzStatusUpdateAspect.java
... ... @@ -104,6 +104,7 @@ public class InspectorBuzStatusUpdateAspect {
104 104 }
105 105 targeVO.setStreetId(roadStreetRespDTO.getStreetId());
106 106 targeVO.setStreetName(roadStreetRespDTO.getStreetName());
  107 + targeVO.setWorkerCompanyId(roadStreetRespDTO.getDeptId());//道路负责部门id
107 108 DictDataRespDTO dictData = dictDataCommonApi.getDictData(CONSERVE_LEVEL, roadStreetRespDTO.getLevelId().toString());
108 109 if(null == dictData){
109 110 throw exception(APP_WORKER_LEVEL_ID_NOT_EXISTS);
... ... @@ -116,6 +117,14 @@ public class InspectorBuzStatusUpdateAspect {
116 117 targeVO.setRoadId(reqVO.getRoadId());
117 118 targeVO.setPressingType(reqVO.getPressingType());
118 119 targeVO.setExpectedFinishDate(reqVO.getExpectedFinishDate());
  120 + if(!dbData.getBusiLine().equals(reqVO.getBusiLine())){//如果前端业务线和数据库不一致
  121 + //删除原来的
  122 + gardenService.deleteAttachement(BpmCommonConstant.PROBLEM_IMG_GROUP,targeVO.getOrderNo(),dbData.getBusiLine());
  123 + }
  124 + List<String> problemsImgs = reqVO.getProblemsImgs();
  125 + if(ObjectUtils.isNotAllEmpty(problemsImgs) && problemsImgs.size()>0){
  126 + gardenService.attachmentInsertOrUpdate(problemsImgs,BpmCommonConstant.PROBLEM_IMG_GROUP,targeVO);
  127 + }
119 128 }
120 129  
121 130 //大区经理退回
... ... @@ -131,6 +140,7 @@ public class InspectorBuzStatusUpdateAspect {
131 140 if(null == roadStreetRespDTO){
132 141 throw exception(APP_WORK_ROAD_NOT_EXISTS);
133 142 }
  143 + targeVO.setWorkerCompanyId(roadStreetRespDTO.getDeptId());//道路负责部门id
134 144 targeVO.setStreetId(roadStreetRespDTO.getStreetId());
135 145 targeVO.setStreetName(roadStreetRespDTO.getStreetName());
136 146 targeVO.setBuzStatus(ORDER_STATUS_INIT);//工单业务初始化状态 后续操作状态 见 OperateTypeEnum
... ... @@ -150,7 +160,7 @@ public class InspectorBuzStatusUpdateAspect {
150 160 targeVO.setWoSourceName(roleList.get(0).getName());
151 161 String busiLine = reqVO.getBusiLine();
152 162 if(StringUtil.isEmpty(busiLine)){
153   - busiLine = SecurityFrameworkUtils.getBusiLine();
  163 + busiLine = dbData.getBusiLine();
154 164 }
155 165 targeVO.setBusiLine(busiLine);
156 166 targeVO.setUserId(SecurityFrameworkUtils.getLoginUserId());
... ...
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/controller/app/garden/aop/UniversalBuzStatusUpdateAspect.java
... ... @@ -98,6 +98,7 @@ public class UniversalBuzStatusUpdateAspect {
98 98 if(null == roadStreetRespDTO){
99 99 throw exception(APP_WORK_ROAD_NOT_EXISTS);
100 100 }
  101 + targeVO.setWorkerCompanyId(roadStreetRespDTO.getDeptId());//道路负责部门id
101 102 targeVO.setStreetId(roadStreetRespDTO.getStreetId());
102 103 targeVO.setStreetName(roadStreetRespDTO.getStreetName());
103 104 DictDataRespDTO dictData = dictDataCommonApi.getDictData(CONSERVE_LEVEL, roadStreetRespDTO.getLevelId().toString());
... ...
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/controller/app/garden/vo/common/AppUniversalApprovalReqVO.java
... ... @@ -90,7 +90,7 @@ public class AppUniversalApprovalReqVO {
90 90 //-------------------------重新发起需提交表单数据------------------------
91 91 @Schema(description = "道路ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "21128")
92 92 @NotNull(message = "道路ID不能为空", groups = RelaunchGroup.class)
93   - private Long roadId;
  93 + private String roadId;
94 94  
95 95 @Schema(description = "道路名称", example = "测试道路")
96 96 private String roadName;
... ...
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/controller/app/garden/vo/task/AppGardenTaskInspectorApproveReqVO.java
... ... @@ -40,7 +40,7 @@ public class AppGardenTaskInspectorApproveReqVO {
40 40  
41 41 @Schema(description = "道路ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "21128")
42 42 @NotNull(message = "道路ID不能为空", groups = RelaunchGroup.class)
43   - private Long roadId;
  43 + private String roadId;
44 44  
45 45 @Schema(description = "道路名称", example = "测试道路")
46 46 private String roadName;
... ...
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/controller/app/garden/vo/task/AppGardenTaskRegionMgrApproveReqVO.java
... ... @@ -40,7 +40,7 @@ public class AppGardenTaskRegionMgrApproveReqVO {
40 40  
41 41 @Schema(description = "道路ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "21128")
42 42 @NotNull(message = "道路ID不能为空")
43   - private Long roadId;
  43 + private String roadId;
44 44  
45 45 @Schema(description = "道路名称", example = "测试道路")
46 46 private String roadName;
... ...
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/dal/dataobject/eventinfo/EventInfoDO.java
1 1 package com.zteits.urbanops.module.workorder.dal.dataobject.eventinfo;
2 2  
  3 +import com.zteits.urbanops.module.workorder.config.StringArrayTypeHandler;
3 4 import lombok.*;
4 5 import java.util.*;
5 6 import java.time.LocalDateTime;
... ... @@ -16,7 +17,7 @@ import com.zteits.urbanops.framework.mybatis.core.dataobject.BaseDO;
16 17 *
17 18 * @author 超级管理员
18 19 */
19   -@TableName("workorder_event_info")
  20 +@TableName(value = "workorder_event_info", autoResultMap = true)
20 21 @KeySequence("workorder_event_info_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
21 22 @Data
22 23 @EqualsAndHashCode(callSuper = true)
... ... @@ -80,7 +81,8 @@ public class EventInfoDO extends BaseDO {
80 81 /**
81 82 * 用户提交照片
82 83 */
83   - private String confrimImgs;
  84 + @TableField(typeHandler = StringArrayTypeHandler.class)
  85 + private String[] confrimImgs;
84 86 /**
85 87 * 事件状态
86 88 */
... ... @@ -90,5 +92,7 @@ public class EventInfoDO extends BaseDO {
90 92 */
91 93 private String remark;
92 94  
  95 + private String ender;
  96 +
93 97  
94 98 }
95 99 \ No newline at end of file
... ...
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/dal/dataobject/maininfo/MainInfoDO.java
... ... @@ -64,7 +64,7 @@ public class MainInfoDO extends BaseDO {
64 64 /**
65 65 * 道路ID
66 66 */
67   - private Long roadId;
  67 + private String roadId;
68 68 /**
69 69 * 道路名称
70 70 */
... ...
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/dal/dataobject/maininfo/MainInfoExtDO.java
... ... @@ -58,7 +58,7 @@ public class MainInfoExtDO extends BaseDO {
58 58 /**
59 59 * 道路ID
60 60 */
61   - private Long roadId;
  61 + private String roadId;
62 62 /**
63 63 * 道路名称
64 64 */
... ...
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/dal/mysql/eventinfo/EventInfoMapper.java
1 1 package com.zteits.urbanops.module.workorder.dal.mysql.eventinfo;
2 2  
3   -import java.util.*;
4   -
5 3 import com.zteits.urbanops.framework.common.pojo.PageResult;
6   -import com.zteits.urbanops.framework.mybatis.core.query.LambdaQueryWrapperX;
7 4 import com.zteits.urbanops.framework.mybatis.core.mapper.BaseMapperX;
  5 +import com.zteits.urbanops.framework.mybatis.core.query.LambdaQueryWrapperX;
  6 +import com.zteits.urbanops.framework.security.core.util.SecurityFrameworkUtils;
  7 +import com.zteits.urbanops.module.workorder.controller.admin.eventinfo.vo.EventInfoPageReqVO;
8 8 import com.zteits.urbanops.module.workorder.dal.dataobject.eventinfo.EventInfoDO;
  9 +import com.zteits.urbanops.module.workorder.enums.EventStatusEnum;
9 10 import org.apache.ibatis.annotations.Mapper;
10   -import com.zteits.urbanops.module.workorder.controller.admin.eventinfo.vo.*;
  11 +
  12 +import java.time.LocalDateTime;
11 13  
12 14 /**
13 15 * 工单事件 Mapper
... ... @@ -37,4 +39,10 @@ public interface EventInfoMapper extends BaseMapperX&lt;EventInfoDO&gt; {
37 39 .orderByDesc(EventInfoDO::getId));
38 40 }
39 41  
  42 + default void updateByIds(Long[] ids) {
  43 + update(new EventInfoDO()
  44 + .setEnder(SecurityFrameworkUtils.getLoginUserNickname())
  45 + .setFinishDate(LocalDateTime.now())
  46 + .setEventStatus(EventStatusEnum.FINISHED.getCode()), new LambdaQueryWrapperX<EventInfoDO>().in(EventInfoDO::getId, ids));
  47 + }
40 48 }
41 49 \ No newline at end of file
... ...
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/dal/mysql/maininfo/MainInfoExtMapper.java
... ... @@ -725,11 +725,11 @@ public interface MainInfoExtMapper extends BaseMapperX&lt;MainInfoDO&gt; {
725 725 @Result(column = "avatar", property = "avatar")
726 726 })
727 727 @DataPermission(enable = false)
728   - IPage<AdminUserRespDTO> getUserByRoadIdAndRoleCodeIPage(IPage<AdminUserRespDTO> page,@NonNull @Param("roadId") Long roadId,
  728 + IPage<AdminUserRespDTO> getUserByRoadIdAndRoleCodeIPage(IPage<AdminUserRespDTO> page,@NonNull @Param("roadId") String roadId,
729 729 @NonNull @Param("roleCode") String roleCode,
730 730 @NonNull @Param("busiLine") String busiLine);
731 731 @DataPermission(enable = false)
732   - default PageResult<AdminUserRespDTO> getUserByRoadIdAndRoleCodePage(PageParam pageParam,@NonNull @Param("roadId") Long roadId,
  732 + default PageResult<AdminUserRespDTO> getUserByRoadIdAndRoleCodePage(PageParam pageParam,@NonNull @Param("roadId") String roadId,
733 733 @NonNull @Param("roleCode") String roleCode,
734 734 @NonNull @Param("busiLine") String busiLine){
735 735 IPage<AdminUserRespDTO> mpPage = MyBatisUtils.buildPage(pageParam);
... ... @@ -739,7 +739,7 @@ public interface MainInfoExtMapper extends BaseMapperX&lt;MainInfoDO&gt; {
739 739 }
740 740  
741 741 @DataPermission(enable = false)
742   - default List<AdminUserRespDTO> getUserByRoadIdAndRoleCode(@NonNull @Param("roadId") Long roadId,
  742 + default List<AdminUserRespDTO> getUserByRoadIdAndRoleCode(@NonNull @Param("roadId") String roadId,
743 743 @NonNull @Param("roleCode") String roleCode,
744 744 @NonNull @Param("busiLine") String busiLine){
745 745 // 创建一个“不分页”的Page对象(size=Integer.MAX_VALUE,查询所有数据)
... ...
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/enums/ErrorCodeConstants.java
... ... @@ -44,13 +44,18 @@ public interface ErrorCodeConstants {
44 44 ErrorCode APP_REGIONMGR_USER_ROLE_ERROR = new ErrorCode(1-900-002-007, "该登录人不是 大区经理,无法发起流程!");
45 45  
46 46 ErrorCode EVENT_INFO_NOT_EXISTS = new ErrorCode(1-900-003-001, "工单事件不存在");
  47 + ErrorCode EVENT_WORK_ORDER_CREATE_FAILED = new ErrorCode(1-900-003-002, "事件工单创建失败:{}");
47 48  
48 49 ErrorCode EVENT_MAPPING_INFO_NOT_EXISTS = new ErrorCode(1-900-004-001, "工单事件映射不存在");
49 50  
50 51 ErrorCode APP_INSPECTOR_USER_ROLE_ERROR = new ErrorCode(1-900-004-001, "该登录人不是 全域督查员,无法发起流程!");
51 52  
52   - ErrorCode APP_WORK_INSPECTOR_ROLE_ILLEGLE = new ErrorCode(1-900-004-00, "该登录人即是 大区经理 角色,又是 全域督察员,无法发起流程!");
  53 + ErrorCode APP_WORK_INSPECTOR_ROLE_ILLEGLE = new ErrorCode(1-900-004-003, "该登录人即是 大区经理 角色,又是 全域督察员,无法发起流程!");
53 54  
54   - ErrorCode APP_WORK_ROAD_NOT_EXISTS = new ErrorCode(1-900-004-001, "道路信息不存在");
  55 + ErrorCode APP_WORK_ROAD_NOT_EXISTS = new ErrorCode(1-900-004-002, "道路信息不存在");
  56 +
  57 + ErrorCode APP_AI_USER_ROLE_ERROR = new ErrorCode(1-900-004-004, "该登录人不是 AI工单派发人员,无法发起流程!");
  58 +
  59 + ErrorCode APP_WORK_AI_ROLE_ILLEGLE = new ErrorCode(1-900-004-005, "该登录人即是 大区经理 角色,又是 AI工单派发人员,无法发起流程!");
55 60 }
56 61  
... ...
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/framework/datapermission/config/OrderDataPermissionConfiguration.java
... ... @@ -9,7 +9,7 @@ import org.springframework.context.annotation.Configuration;
9 9 * 订单模块的数据权限配置
10 10 * 每个模块独立配置,互不影响
11 11 */
12   -@Configuration(proxyBeanMethods = false)
  12 +//@Configuration(proxyBeanMethods = false)
13 13 public class OrderDataPermissionConfiguration {
14 14  
15 15 /**
... ...
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/service/eventinfo/EventInfoService.java
... ... @@ -64,8 +64,10 @@ public interface EventInfoService {
64 64 *
65 65 * @param id 工单事件编号
66 66 */
67   - void endEventInfo(@Valid Long id);
  67 + void endEventInfo(@Valid Long[] ids);
68 68  
69 69 void createEventOrderInfo(@Valid EventOrderInfoSaveReqVO createReqVO);
70 70  
  71 + boolean bpmAiCallBack(String orderId,Integer status);
  72 +
71 73 }
72 74 \ No newline at end of file
... ...
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/service/eventinfo/EventInfoServiceImpl.java
1 1 package com.zteits.urbanops.module.workorder.service.eventinfo;
2 2  
3   -import cn.hutool.core.collection.CollUtil;
  3 +import com.alibaba.fastjson.JSON;
  4 +import com.zteits.urbanops.framework.common.exception.ErrorCode;
  5 +import com.zteits.urbanops.framework.common.pojo.PageResult;
  6 +import com.zteits.urbanops.framework.common.util.object.BeanUtils;
  7 +import com.zteits.urbanops.framework.security.core.util.SecurityFrameworkUtils;
  8 +import com.zteits.urbanops.module.bpm.enums.task.BpmTaskStatusEnum;
  9 +import com.zteits.urbanops.module.workorder.api.constant.BpmCommonConstant;
  10 +import com.zteits.urbanops.module.workorder.controller.admin.eventinfo.vo.EventInfoPageReqVO;
  11 +import com.zteits.urbanops.module.workorder.controller.admin.eventinfo.vo.EventInfoSaveReqVO;
  12 +import com.zteits.urbanops.module.workorder.controller.admin.eventinfo.vo.EventOrderInfoSaveReqVO;
  13 +import com.zteits.urbanops.module.workorder.dal.dataobject.eventinfo.EventInfoDO;
  14 +import com.zteits.urbanops.module.workorder.dal.dataobject.eventmappinginfo.EventMappingInfoDO;
  15 +import com.zteits.urbanops.module.workorder.dal.mysql.eventinfo.EventInfoMapper;
  16 +import com.zteits.urbanops.module.workorder.dal.mysql.eventmappinginfo.EventMappingInfoMapper;
  17 +import com.zteits.urbanops.module.workorder.dto.AppGardenWorkOrderAIReqVO;
  18 +import com.zteits.urbanops.module.workorder.enums.EventSourceEnum;
4 19 import com.zteits.urbanops.module.workorder.enums.EventStatusEnum;
  20 +import com.zteits.urbanops.module.workorder.service.garden.BpmAIService;
  21 +import lombok.RequiredArgsConstructor;
  22 +import lombok.extern.slf4j.Slf4j;
5 23 import org.springframework.stereotype.Service;
6   -import jakarta.annotation.Resource;
7   -import org.springframework.validation.annotation.Validated;
8 24 import org.springframework.transaction.annotation.Transactional;
  25 +import org.springframework.util.ObjectUtils;
  26 +import org.springframework.validation.annotation.Validated;
9 27  
10   -import java.util.*;
11   -import com.zteits.urbanops.module.workorder.controller.admin.eventinfo.vo.*;
12   -import com.zteits.urbanops.module.workorder.dal.dataobject.eventinfo.EventInfoDO;
13   -import com.zteits.urbanops.framework.common.pojo.PageResult;
14   -import com.zteits.urbanops.framework.common.pojo.PageParam;
15   -import com.zteits.urbanops.framework.common.util.object.BeanUtils;
16   -
17   -import com.zteits.urbanops.module.workorder.dal.mysql.eventinfo.EventInfoMapper;
  28 +import java.time.LocalDateTime;
  29 +import java.util.ArrayList;
  30 +import java.util.Arrays;
  31 +import java.util.List;
18 32  
19 33 import static com.zteits.urbanops.framework.common.exception.util.ServiceExceptionUtil.exception;
20   -import static com.zteits.urbanops.framework.common.util.collection.CollectionUtils.convertList;
21   -import static com.zteits.urbanops.framework.common.util.collection.CollectionUtils.diffList;
22   -import static com.zteits.urbanops.module.workorder.enums.ErrorCodeConstants.*;
  34 +import static com.zteits.urbanops.module.workorder.enums.ErrorCodeConstants.EVENT_INFO_NOT_EXISTS;
  35 +import static com.zteits.urbanops.module.workorder.enums.ErrorCodeConstants.EVENT_WORK_ORDER_CREATE_FAILED;
23 36  
24 37 /**
25 38 * 工单事件 Service 实现类
... ... @@ -28,10 +41,16 @@ import static com.zteits.urbanops.module.workorder.enums.ErrorCodeConstants.*;
28 41 */
29 42 @Service
30 43 @Validated
  44 +@RequiredArgsConstructor
  45 +@Slf4j
31 46 public class EventInfoServiceImpl implements EventInfoService {
32 47  
33   - @Resource
34   - private EventInfoMapper eventInfoMapper;
  48 + private final EventInfoMapper eventInfoMapper;
  49 +
  50 + private final BpmAIService bpmAIService;
  51 +
  52 + private final EventMappingInfoMapper eventMappingInfoMapper;
  53 +
35 54  
36 55 @Override
37 56 public Long createEventInfo(EventInfoSaveReqVO createReqVO) {
... ... @@ -61,10 +80,10 @@ public class EventInfoServiceImpl implements EventInfoService {
61 80 }
62 81  
63 82 @Override
64   - public void deleteEventInfoListByIds(List<Long> ids) {
  83 + public void deleteEventInfoListByIds(List<Long> ids) {
65 84 // 删除
66 85 eventInfoMapper.deleteByIds(ids);
67   - }
  86 + }
68 87  
69 88  
70 89 private void validateEventInfoExists(Long id) {
... ... @@ -84,19 +103,148 @@ public class EventInfoServiceImpl implements EventInfoService {
84 103 }
85 104  
86 105 @Override
87   - public void endEventInfo(Long id) {
88   - // 校验存在
89   - validateEventInfoExists(id);
90   - // 更新
91   - EventInfoDO updateObj = new EventInfoDO();
92   - updateObj.setId(id);
93   - updateObj.setEventStatus(EventStatusEnum.FINISHED.getCode());
94   - eventInfoMapper.updateById(updateObj);
  106 + public void endEventInfo(Long[] ids) {
  107 +
  108 + eventInfoMapper.updateByIds(ids);
95 109 }
96 110  
97 111 @Override
  112 + @Transactional(rollbackFor = Exception.class)
98 113 public void createEventOrderInfo(EventOrderInfoSaveReqVO createReqVO) {
99   - //TODO @lesan:工单事件工单创建
  114 +
  115 + EventInfoDO eventInfo = eventInfoMapper.selectById(createReqVO.getId());
  116 + if (!ObjectUtils.isEmpty(eventInfo)) {
  117 + SecurityUserInfo userInfo = getCurrentUserInfo();
  118 +
  119 + // 创建AI工单
  120 + Long orderId = createAIWorkOrder(eventInfo, createReqVO);
  121 +
  122 + // 更新事件状态
  123 + updateEventInfoStatus(eventInfo, userInfo.userId);
  124 +
  125 + // 创建事件映射信息
  126 + createEventMappingInfo(eventInfo, orderId, createReqVO, userInfo);
  127 + }
  128 + }
  129 +
  130 + @Override
  131 + public boolean bpmAiCallBack(String orderId, Integer status) {
  132 + EventMappingInfoDO mappingInfoDO = eventMappingInfoMapper.selectOne(EventMappingInfoDO::getOrderNo, orderId);
  133 + if (ObjectUtils.isEmpty(mappingInfoDO)) {
  134 + throw exception(EVENT_INFO_NOT_EXISTS);
  135 + }
  136 + mappingInfoDO.setStatus(status);
  137 + mappingInfoDO.setUpdateTime(LocalDateTime.now());
  138 + mappingInfoDO.setUpdater(String.valueOf(SecurityFrameworkUtils.getLoginUserId()));
  139 + mappingInfoDO.setFinishDate(LocalDateTime.now());
  140 + eventMappingInfoMapper.updateById(mappingInfoDO);
  141 + return true;
  142 + }
  143 +
  144 + /**
  145 + * 获取当前用户信息
  146 + */
  147 + private SecurityUserInfo getCurrentUserInfo() {
  148 + Long currentUserId = SecurityFrameworkUtils.getLoginUserId();
  149 + Long companyId = SecurityFrameworkUtils.getCompanyId();
  150 + Long deptId = SecurityFrameworkUtils.getDeptId();
  151 + String userNickname = SecurityFrameworkUtils.getLoginUserNickname();
  152 +
  153 + // 检查用户信息是否获取成功
  154 + if (currentUserId == null) {
  155 + throw exception(new ErrorCode(1_004_001_000, "用户不存在"));
  156 + }
  157 +
  158 + return new SecurityUserInfo(currentUserId, companyId, deptId, userNickname);
  159 + }
  160 +
  161 + /**
  162 + * 创建AI工单
  163 + */
  164 + private Long createAIWorkOrder(EventInfoDO eventInfo, EventOrderInfoSaveReqVO createReqVO) {
  165 + AppGardenWorkOrderAIReqVO aiReqVO = new AppGardenWorkOrderAIReqVO();
  166 + aiReqVO.setBusiLine(createReqVO.getBusiLine())
  167 + .setLon(eventInfo.getLon())
  168 + .setLat(eventInfo.getLat())
  169 + .setOrderName(eventInfo.getEvetName())
  170 + .setOrderType(BpmCommonConstant.ORDER_TYPE_C)
  171 + .setExpectedFinishDate(createReqVO.getExpectedFinishDate())
  172 + .setLatLonType(3)
  173 + .setLonLatAddress(eventInfo.getLonLatAddress())
  174 + .setPressingType(createReqVO.getPressingType())
  175 + // 处理可能为null的数组,避免Arrays.asList抛出异常
  176 + .setProblemsImgs(eventInfo.getConfrimImgs() != null ? Arrays.asList(eventInfo.getConfrimImgs()) : new ArrayList<>())
  177 + .setRemark(eventInfo.getRemark())
  178 + .setRoadId(createReqVO.getRoadId())
  179 + .setRoadName(createReqVO.getRoadName())
  180 + .setSourceId(EventSourceEnum.AI.getCode())
  181 + .setWoSourceId(eventInfo.getEventDeviceCode())
  182 + .setWoSourceName(eventInfo.getEventDevice())
  183 + .setThirdWorkNo(eventInfo.getEventNo())
  184 + .setSourceName(eventInfo.getEventDevice());
  185 +
  186 + Long orderId;
  187 + try {
  188 + log.info("[createAIWorkOrder][创建AI工单]:{}", JSON.toJSONString(aiReqVO));
  189 + orderId = bpmAIService.createWorkOrder(aiReqVO);
  190 + log.info("[createAIWorkOrder][创建AI工单结果]:{}", orderId);
  191 + } catch (Exception e) {
  192 + log.error("[createAIWorkOrder][创建AI工单时发生异常]", e);
  193 + throw exception(EVENT_WORK_ORDER_CREATE_FAILED, e.getMessage());
  194 + }
  195 +
  196 + return orderId;
  197 + }
  198 +
  199 + /**
  200 + * 更新事件状态
  201 + */
  202 + private void updateEventInfoStatus(EventInfoDO eventInfo, Long userId) {
  203 + eventInfo.setEventStatus(EventStatusEnum.ORDER.getCode());
  204 + eventInfo.setUpdater(String.valueOf(userId))
  205 + .setUpdateTime(LocalDateTime.now());
  206 + eventInfoMapper.updateById(eventInfo);
  207 + }
  208 +
  209 + /**
  210 + * 创建事件映射信息
  211 + */
  212 + private void createEventMappingInfo(EventInfoDO eventInfo, Long orderId, EventOrderInfoSaveReqVO createReqVO, SecurityUserInfo userInfo) {
  213 + EventMappingInfoDO mappingInfoDO = new EventMappingInfoDO();
  214 + mappingInfoDO.setEventNo(eventInfo.getEventNo())
  215 + .setOrderNo(String.valueOf(orderId))
  216 + .setBusiLine(createReqVO.getBusiLine())
  217 + .setCommitDate(LocalDateTime.now())
  218 + .setCompanyId(userInfo.companyId)
  219 + .setDeptId(userInfo.deptId)
  220 + .setExpectedFinishDate(createReqVO.getExpectedFinishDate())
  221 + .setPressingType(createReqVO.getPressingType())
  222 + .setRoadId(createReqVO.getRoadId())
  223 + .setRoadName(createReqVO.getRoadName())
  224 + .setUserId(userInfo.userId)
  225 + .setUserName(userInfo.userNickname)
  226 + .setStatus(BpmTaskStatusEnum.RUNNING.getStatus())
  227 + .setCreator(String.valueOf(userInfo.userId))
  228 + .setCreateTime(LocalDateTime.now());
  229 +
  230 + eventMappingInfoMapper.insert(mappingInfoDO);
  231 + }
  232 +
  233 + /**
  234 + * 安全用户信息封装类
  235 + */
  236 + private static class SecurityUserInfo {
  237 + final Long userId;
  238 + final Long companyId;
  239 + final Long deptId;
  240 + final String userNickname;
  241 +
  242 + SecurityUserInfo(Long userId, Long companyId, Long deptId, String userNickname) {
  243 + this.userId = userId;
  244 + this.companyId = companyId;
  245 + this.deptId = deptId;
  246 + this.userNickname = userNickname;
  247 + }
100 248 }
101 249  
102 250 }
103 251 \ No newline at end of file
... ...
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/service/garden/BpmAIService.java
... ... @@ -20,7 +20,7 @@ import jakarta.validation.Valid;
20 20 public interface BpmAIService {
21 21  
22 22 /**
23   - * 全域督察员工单申请 app service 接口
  23 + * AI工单申请 app service 接口
24 24 * @param createRequestVo
25 25 * @return
26 26 */
... ... @@ -50,5 +50,5 @@ public interface BpmAIService {
50 50 * @param roadId
51 51 * @return
52 52 */
53   - boolean isSanhaiByRoadId(Long roadId);
  53 + boolean isSanhaiByRoadId(String roadId);
54 54 }
55 55 \ No newline at end of file
... ...
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/service/garden/BpmAIServiceImpl.java
... ... @@ -110,12 +110,12 @@ public class BpmAIServiceImpl implements BpmAIService{
110 110 throw exception(APP_USER_ROLE_NOT_EXISTS);
111 111 }
112 112  
113   - if(!RoleListUtils.containsCode(roleList,INSPECTOR_GLOBAL)){
114   - throw exception(APP_INSPECTOR_USER_ROLE_ERROR);
  113 + if(!RoleListUtils.containsCode(roleList,AI_DISPATCHER)){
  114 + throw exception(APP_AI_USER_ROLE_ERROR);
115 115 }
116 116 //校验人员不能有 双重角色
117   - if(RoleListUtils.containsBothCodes(roleList, REGIONAL_MANAGER, INSPECTOR_GLOBAL)){
118   - throw exception(APP_WORK_INSPECTOR_ROLE_ILLEGLE);
  117 + if(RoleListUtils.containsBothCodes(roleList, REGIONAL_MANAGER, AI_DISPATCHER)){
  118 + throw exception(APP_WORK_AI_ROLE_ILLEGLE);
119 119 }
120 120  
121 121 List<String> problemsImgsList = createRequestVo.getProblemsImgs();
... ... @@ -125,6 +125,7 @@ public class BpmAIServiceImpl implements BpmAIService{
125 125 if(null == roadStreetRespDTO){
126 126 throw exception(APP_WORK_ROAD_NOT_EXISTS);
127 127 }
  128 + workOrder.setWorkerCompanyId(roadStreetRespDTO.getDeptId());//道路负责部门id
128 129 workOrder.setStreetId(roadStreetRespDTO.getStreetId());
129 130 workOrder.setStreetName(roadStreetRespDTO.getStreetName());
130 131 workOrder.setBuzStatus(ORDER_STATUS_INIT);//工单业务初始化状态 后续操作状态 见 OperateTypeEnum
... ... @@ -146,10 +147,27 @@ public class BpmAIServiceImpl implements BpmAIService{
146 147 workOrder.setCompanyId(SecurityFrameworkUtils.getCompanyId());
147 148  
148 149 workOrder.setDeptId(SecurityFrameworkUtils.getDeptId());
149   - workOrder.setSourceId(EventSourceEnum.AI.getCode());
150   - workOrder.setSourceName(EventSourceEnum.AI.getDesc());
151   - workOrder.setWoSourceId(roleList.get(0).getCode());
152   - workOrder.setWoSourceName(roleList.get(0).getName());
  150 +
  151 + Integer sourceId = createRequestVo.getSourceId();
  152 + String sourceName = createRequestVo.getSourceName();
  153 + if(!ObjectUtils.isNotAllEmpty(sourceId)){
  154 + sourceId = EventSourceEnum.AI.getCode();
  155 + }
  156 + if(StringUtil.isEmpty(sourceName)){
  157 + sourceName = EventSourceEnum.AI.getDesc();
  158 + }
  159 + workOrder.setSourceId(sourceId);
  160 + workOrder.setSourceName(sourceName);
  161 + String wsourceId = createRequestVo.getWoSourceId();
  162 + String wsourceName = createRequestVo.getWoSourceName();
  163 + if(StringUtil.isEmpty(wsourceId)){
  164 + wsourceId = roleList.get(0).getCode();
  165 + }
  166 + if(StringUtil.isEmpty(wsourceName)){
  167 + wsourceName = roleList.get(0).getCode();
  168 + }
  169 + workOrder.setWoSourceId(wsourceId);
  170 + workOrder.setWoSourceName(wsourceName);
153 171 String busiLine = createRequestVo.getBusiLine();
154 172 if(StringUtil.isEmpty(busiLine)){
155 173 busiLine = SecurityFrameworkUtils.getBusiLine();
... ... @@ -224,7 +242,7 @@ public class BpmAIServiceImpl implements BpmAIService{
224 242 //String busiLine = (String)processInstanceVariables.get(BPM_COMMON_PROD_BUSILINE);
225 243 //Long roadId = (Long) processInstanceVariables.get(BPM_COMMON_PROD_ROADID);
226 244 String busiLine = reqVO.getBusiLine();
227   - Long roadId = reqVO.getRoadId();
  245 + String roadId = reqVO.getRoadId();
228 246 String roleCode = BusiLineTeamLeaderRoleCodeEnum.getByCode(busiLine).getRoleCode();
229 247  
230 248 if(StringUtil.isEmpty(roleCode)){// 找不到 默认为园林组长的角色
... ... @@ -293,7 +311,7 @@ public class BpmAIServiceImpl implements BpmAIService{
293 311 }
294 312  
295 313 @Override
296   - public boolean isSanhaiByRoadId(Long roadId) {
  314 + public boolean isSanhaiByRoadId(String roadId) {
297 315 RoadStreetRespDTO roadStreetRespDTO = roadApi.getRoadInfoById(roadId);
298 316 if(null == roadStreetRespDTO){
299 317 throw exception(APP_WORK_ROAD_NOT_EXISTS);
... ...
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/service/garden/BpmGardenService.java
... ... @@ -208,7 +208,7 @@ public interface BpmGardenService {
208 208 * @param busiLine
209 209 * @return
210 210 */
211   - public PageResult<AdminUserRespDTO> getUserByRoadIdAndRoleCode(PageParam param,Long roadId,String roleCode,String busiLine);
  211 + public PageResult<AdminUserRespDTO> getUserByRoadIdAndRoleCode(PageParam param,String roadId,String roleCode,String busiLine);
212 212  
213 213 /**
214 214 * 附件更新通用方法
... ... @@ -218,4 +218,11 @@ public interface BpmGardenService {
218 218 */
219 219 public void attachmentInsertOrUpdate(List<String> imgList, String type, MainInfoDO workOrder);
220 220  
  221 + /**
  222 + * 删除附件表
  223 + * @param type
  224 + * @param orderNo
  225 + * @param busiLine
  226 + */
  227 + public void deleteAttachement(String type,String orderNo,String busiLine);
221 228 }
... ...
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/service/garden/BpmGardenServiceImpl.java
... ... @@ -52,6 +52,7 @@ import com.zteits.urbanops.module.workorder.dto.AppGardenWorkOrderReqVO;
52 52 import com.zteits.urbanops.module.workorder.dto.AppGardenWorkOrderRespVO;
53 53 import com.zteits.urbanops.module.workorder.enums.BusiLineTeamLeaderRoleCodeEnum;
54 54 import com.zteits.urbanops.module.workorder.enums.BusiLineWorkerRoleCodeEnum;
  55 +import com.zteits.urbanops.module.workorder.enums.EventSourceEnum;
55 56 import com.zteits.urbanops.module.workorder.util.TaskNodeUtils;
56 57 import jakarta.annotation.Resource;
57 58 import jodd.util.StringUtil;
... ... @@ -279,7 +280,8 @@ public class BpmGardenServiceImpl implements BpmGardenService{
279 280 workerOrder.setCoHandlers(reqVO.getCoHandlers());
280 281 workerOrder.setWorkerId(SecurityFrameworkUtils.getLoginUserId());
281 282 workerOrder.setWorkerName(SecurityFrameworkUtils.getLoginUserNickname());
282   - workerOrder.setWorkerCompanyId(SecurityFrameworkUtils.getCompanyId());
  283 + //取消登录人 改为创建或分配时的道路负责人部门
  284 + //workerOrder.setWorkerCompanyId(SecurityFrameworkUtils.getCompanyId());
283 285 workOrderMapper.updateById(workerOrder);
284 286  
285 287 if(ObjectUtils.isNotAllEmpty(id) && ObjectUtils.isNotAllEmpty(problemsImgs) && problemsImgs.size()>0){
... ... @@ -569,7 +571,7 @@ public class BpmGardenServiceImpl implements BpmGardenService{
569 571 MainInfoDO workOrder = BeanUtils.toBean(createRequestVo, MainInfoDO.class)
570 572 .setStatus(BpmTaskStatusEnum.RUNNING.getStatus());
571 573 RoadStreetRespDTO roadStreetRespDTO = roadApi.getRoadInfoById(createRequestVo.getRoadId());
572   -
  574 + workOrder.setWorkerCompanyId(roadStreetRespDTO.getDeptId());//道路负责部门id
573 575 workOrder.setStreetId(roadStreetRespDTO.getStreetId());
574 576 workOrder.setStreetName(roadStreetRespDTO.getStreetName());
575 577 workOrder.setBuzStatus(ORDER_STATUS_INIT);//工单业务初始化状态 后续操作状态 见 OperateTypeEnum
... ... @@ -595,6 +597,16 @@ public class BpmGardenServiceImpl implements BpmGardenService{
595 597 if(null == roleList || roleList.size()==0){
596 598 throw exception(APP_USER_ROLE_NOT_EXISTS);
597 599 }
  600 + Integer sourceId = createRequestVo.getSourceId();
  601 + String sourceName = createRequestVo.getSourceName();
  602 + if(!ObjectUtils.isNotAllEmpty(sourceId)){
  603 + sourceId = EventSourceEnum.PATROL.getCode();
  604 + }
  605 + if(StringUtil.isEmpty(sourceName)){
  606 + sourceName = EventSourceEnum.PATROL.getDesc();
  607 + }
  608 + workOrder.setSourceId(sourceId);
  609 + workOrder.setSourceName(sourceName);
598 610 workOrder.setWoSourceId(roleList.get(0).getCode());
599 611 workOrder.setWoSourceName(roleList.get(0).getName());
600 612 String busiLine = createRequestVo.getBusiLine();
... ... @@ -677,6 +689,16 @@ public class BpmGardenServiceImpl implements BpmGardenService{
677 689 }
678 690 }
679 691  
  692 + public void deleteAttachement(String type,String orderNo,String busiLine){
  693 + LambdaQueryWrapper<AttachmentDO> deleteWrapper = new LambdaQueryWrapper<AttachmentDO>()
  694 + .eq(AttachmentDO::getBusiType, type)
  695 + .eq(AttachmentDO::getOrderNo, orderNo);
  696 + if(StringUtil.isNotEmpty(busiLine)){// 全域巡查员 发起的工单 业务线有可能为空
  697 + deleteWrapper.eq(AttachmentDO::getBusiLine, busiLine);
  698 + }
  699 + attachmentMapper.delete(deleteWrapper);
  700 + }
  701 +
680 702  
681 703 @Override
682 704 public void updateWorkOrderStatus(Long id, Integer status) {
... ... @@ -751,7 +773,7 @@ public class BpmGardenServiceImpl implements BpmGardenService{
751 773 }
752 774  
753 775 @Override
754   - public PageResult<AdminUserRespDTO> getUserByRoadIdAndRoleCode(PageParam param,Long roadId, String roleCode, String busiLine) {
  776 + public PageResult<AdminUserRespDTO> getUserByRoadIdAndRoleCode(PageParam param,String roadId, String roleCode, String busiLine) {
755 777 if(org.springframework.util.ObjectUtils.isEmpty(roadId) || org.springframework.util.ObjectUtils.isEmpty(roleCode) || org.springframework.util.ObjectUtils.isEmpty(busiLine)){
756 778 throw exception0(BAD_REQUEST.getCode(),"param:roadId,roleCode,busiLine 不能为空!");
757 779 }
... ...
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/service/garden/BpmInspectorService.java
... ... @@ -51,5 +51,5 @@ public interface BpmInspectorService {
51 51 * @param roadId
52 52 * @return
53 53 */
54   - boolean isSanhaiByRoadId(Long roadId);
  54 + boolean isSanhaiByRoadId(String roadId);
55 55 }
56 56 \ No newline at end of file
... ...
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/service/garden/BpmInspectorServiceImpl.java
... ... @@ -31,6 +31,7 @@ import com.zteits.urbanops.module.workorder.dal.mysql.maininfo.MainInfoMapper;
31 31 import com.zteits.urbanops.module.workorder.dto.AppGardenWorkOrderInspectorReqVO;
32 32 import com.zteits.urbanops.module.workorder.dto.AppGardenWorkOrderUniversalReqVO;
33 33 import com.zteits.urbanops.module.workorder.enums.BusiLineTeamLeaderRoleCodeEnum;
  34 +import com.zteits.urbanops.module.workorder.enums.EventSourceEnum;
34 35 import com.zteits.urbanops.module.workorder.util.RoleListUtils;
35 36 import jakarta.annotation.Resource;
36 37 import jodd.util.StringUtil;
... ... @@ -125,6 +126,7 @@ public class BpmInspectorServiceImpl implements BpmInspectorService{
125 126 if(null == roadStreetRespDTO){
126 127 throw exception(APP_WORK_ROAD_NOT_EXISTS);
127 128 }
  129 + workOrder.setWorkerCompanyId(roadStreetRespDTO.getDeptId());//道路负责部门id
128 130 workOrder.setStreetId(roadStreetRespDTO.getStreetId());
129 131 workOrder.setStreetName(roadStreetRespDTO.getStreetName());
130 132 workOrder.setBuzStatus(ORDER_STATUS_INIT);//工单业务初始化状态 后续操作状态 见 OperateTypeEnum
... ... @@ -146,6 +148,16 @@ public class BpmInspectorServiceImpl implements BpmInspectorService{
146 148 workOrder.setCompanyId(SecurityFrameworkUtils.getCompanyId());
147 149  
148 150 workOrder.setDeptId(SecurityFrameworkUtils.getDeptId());
  151 + Integer sourceId = createRequestVo.getSourceId();
  152 + String sourceName = createRequestVo.getSourceName();
  153 + if(!ObjectUtils.isNotAllEmpty(sourceId)){
  154 + sourceId = EventSourceEnum.PATROL.getCode();
  155 + }
  156 + if(StringUtil.isEmpty(sourceName)){
  157 + sourceName = EventSourceEnum.PATROL.getDesc();
  158 + }
  159 + workOrder.setSourceId(sourceId);
  160 + workOrder.setSourceName(sourceName);
149 161 workOrder.setWoSourceId(roleList.get(0).getCode());
150 162 workOrder.setWoSourceName(roleList.get(0).getName());
151 163 String busiLine = createRequestVo.getBusiLine();
... ... @@ -222,7 +234,7 @@ public class BpmInspectorServiceImpl implements BpmInspectorService{
222 234 //String busiLine = (String)processInstanceVariables.get(BPM_COMMON_PROD_BUSILINE);
223 235 //Long roadId = (Long) processInstanceVariables.get(BPM_COMMON_PROD_ROADID);
224 236 String busiLine = reqVO.getBusiLine();
225   - Long roadId = reqVO.getRoadId();
  237 + String roadId = reqVO.getRoadId();
226 238 String roleCode = BusiLineTeamLeaderRoleCodeEnum.getByCode(busiLine).getRoleCode();
227 239  
228 240 if(StringUtil.isEmpty(roleCode)){// 找不到 默认为园林组长的角色
... ... @@ -291,7 +303,7 @@ public class BpmInspectorServiceImpl implements BpmInspectorService{
291 303 }
292 304  
293 305 @Override
294   - public boolean isSanhaiByRoadId(Long roadId) {
  306 + public boolean isSanhaiByRoadId(String roadId) {
295 307 RoadStreetRespDTO roadStreetRespDTO = roadApi.getRoadInfoById(roadId);
296 308 if(null == roadStreetRespDTO){
297 309 throw exception(APP_WORK_ROAD_NOT_EXISTS);
... ...
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/service/garden/BpmRegionMgrServiceImpl.java
... ... @@ -25,6 +25,7 @@ import com.zteits.urbanops.module.workorder.dal.mysql.maininfo.MainInfoExtMapper
25 25 import com.zteits.urbanops.module.workorder.dal.mysql.maininfo.MainInfoMapper;
26 26 import com.zteits.urbanops.module.workorder.dto.AppGardenWorkOrderReqVO;
27 27 import com.zteits.urbanops.module.workorder.enums.BusiLineTeamLeaderRoleCodeEnum;
  28 +import com.zteits.urbanops.module.workorder.enums.EventSourceEnum;
28 29 import com.zteits.urbanops.module.workorder.util.RoleListUtils;
29 30 import jakarta.annotation.Resource;
30 31 import jodd.util.StringUtil;
... ... @@ -108,6 +109,7 @@ public class BpmRegionMgrServiceImpl implements BpmRegionMgrService{
108 109 if(null == roadStreetRespDTO){
109 110 throw exception(APP_WORK_ROAD_NOT_EXISTS);
110 111 }
  112 + workOrder.setWorkerCompanyId(roadStreetRespDTO.getDeptId());//道路负责部门id
111 113 workOrder.setStreetId(roadStreetRespDTO.getStreetId());
112 114 workOrder.setStreetName(roadStreetRespDTO.getStreetName());
113 115 workOrder.setBuzStatus(ORDER_STATUS_INIT);//工单业务初始化状态 后续操作状态 见 OperateTypeEnum
... ... @@ -136,6 +138,16 @@ public class BpmRegionMgrServiceImpl implements BpmRegionMgrService{
136 138 if(!RoleListUtils.containsCode(roleList,REGIONAL_MANAGER)){
137 139 throw exception(APP_REGIONMGR_USER_ROLE_ERROR);
138 140 }
  141 + Integer sourceId = createRequestVo.getSourceId();
  142 + String sourceName = createRequestVo.getSourceName();
  143 + if(!ObjectUtils.isNotAllEmpty(sourceId)){
  144 + sourceId = EventSourceEnum.REGION.getCode();
  145 + }
  146 + if(StringUtil.isEmpty(sourceName)){
  147 + sourceName = EventSourceEnum.REGION.getDesc();
  148 + }
  149 + workOrder.setSourceId(sourceId);
  150 + workOrder.setSourceName(sourceName);
139 151 workOrder.setWoSourceId(roleList.get(0).getCode());
140 152 workOrder.setWoSourceName(roleList.get(0).getName());
141 153 String busiLine = createRequestVo.getBusiLine();
... ...
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/service/garden/BpmUniversalServiceImpl.java
... ... @@ -31,6 +31,7 @@ import com.zteits.urbanops.module.workorder.dal.mysql.maininfo.MainInfoMapper;
31 31 import com.zteits.urbanops.module.workorder.dto.AppGardenWorkOrderReqVO;
32 32 import com.zteits.urbanops.module.workorder.dto.AppGardenWorkOrderUniversalReqVO;
33 33 import com.zteits.urbanops.module.workorder.enums.BusiLineTeamLeaderRoleCodeEnum;
  34 +import com.zteits.urbanops.module.workorder.enums.EventSourceEnum;
34 35 import com.zteits.urbanops.module.workorder.util.RoleListUtils;
35 36 import jakarta.annotation.Resource;
36 37 import jodd.util.StringUtil;
... ... @@ -135,7 +136,16 @@ public class BpmUniversalServiceImpl implements BpmUniversalService{
135 136 if(RoleListUtils.containsBothCodes(roleList, REGIONAL_MANAGER, PARTROL_GLOBAL)){
136 137 throw exception(APP_WORK_ORADER_ROLE_ILLEGLE);
137 138 }
138   -
  139 + Integer sourceId = createRequestVo.getSourceId();
  140 + String sourceName = createRequestVo.getSourceName();
  141 + if(!ObjectUtils.isNotAllEmpty(sourceId)){
  142 + sourceId = EventSourceEnum.PATROL.getCode();
  143 + }
  144 + if(StringUtil.isEmpty(sourceName)){
  145 + sourceName = EventSourceEnum.PATROL.getDesc();
  146 + }
  147 + workOrder.setSourceId(sourceId);
  148 + workOrder.setSourceName(sourceName);
139 149 workOrder.setWoSourceId(roleList.get(0).getCode());
140 150 workOrder.setWoSourceName(roleList.get(0).getName());
141 151 workOrder.setUserId(SecurityFrameworkUtils.getLoginUserId());
... ... @@ -186,7 +196,7 @@ public class BpmUniversalServiceImpl implements BpmUniversalService{
186 196 //String busiLine = (String)processInstanceVariables.get(BPM_COMMON_PROD_BUSILINE);
187 197 //Long roadId = (Long) processInstanceVariables.get(BPM_COMMON_PROD_ROADID);
188 198 String busiLine = reqVO.getBusiLine();
189   - Long roadId = reqVO.getRoadId();
  199 + String roadId = reqVO.getRoadId();
190 200 String roleCode = BusiLineTeamLeaderRoleCodeEnum.getByCode(busiLine).getRoleCode();
191 201  
192 202 if(StringUtil.isEmpty(roleCode)){// 找不到 默认为园林组长的角色
... ...
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/service/garden/el/YlTaskAssignService.java
... ... @@ -29,7 +29,7 @@ public class YlTaskAssignService {
29 29  
30 30 @Resource
31 31 private MainInfoExtMapper workOrderExtMapper;
32   - public Long getInitiatorApproverByBusiness(Long roadId,String roleCode,String busiLine) {
  32 + public Long getInitiatorApproverByBusiness(String roadId,String roleCode,String busiLine) {
33 33 List<AdminUserRespDTO> userList = workOrderExtMapper.getUserByRoadIdAndRoleCode(roadId,roleCode,busiLine);
34 34 if(null != userList && userList.size() > 0){
35 35 return userList.get(0).getId();
... ...
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/service/garden/listener/BpmProcessTaskAutoCompleteAIListener.java
... ... @@ -3,6 +3,7 @@ package com.zteits.urbanops.module.workorder.service.garden.listener;
3 3 import com.zteits.urbanops.module.bpm.api.event.BpmProcessInstanceStatusEvent;
4 4 import com.zteits.urbanops.module.bpm.api.event.BpmProcessInstanceStatusEventListener;
5 5 import com.zteits.urbanops.module.workorder.api.constant.BpmCommonConstant;
  6 +import com.zteits.urbanops.module.workorder.service.eventinfo.EventInfoService;
6 7 import com.zteits.urbanops.module.workorder.service.garden.BpmGardenService;
7 8 import jakarta.annotation.Resource;
8 9 import lombok.extern.slf4j.Slf4j;
... ... @@ -19,6 +20,8 @@ import org.springframework.stereotype.Component;
19 20 public class BpmProcessTaskAutoCompleteAIListener extends BpmProcessInstanceStatusEventListener {
20 21 @Resource
21 22 private BpmGardenService gardenService;
  23 + @Resource
  24 + private EventInfoService eventService;
22 25 @Override
23 26 protected String getProcessDefinitionKey() {
24 27  
... ... @@ -30,6 +33,7 @@ public class BpmProcessTaskAutoCompleteAIListener extends BpmProcessInstanceStat
30 33 protected void onEvent(BpmProcessInstanceStatusEvent event) {
31 34 log.info("业务ID:"+event.getBusinessKey()+",业务状态"+event.getStatus());
32 35 gardenService.updateWorkOrderStatus(Long.parseLong(event.getBusinessKey()), event.getStatus());
33   -
  36 + log.info("更新事件表状态,业务ID:"+event.getBusinessKey()+",业务状态"+event.getStatus());
  37 + eventService.bpmAiCallBack(event.getBusinessKey(),event.getStatus());
34 38 }
35 39 }
... ...