Commit 1d5be4b7d9ce988114eda7fa72518d24ed4d4d1e

Authored by wangqian
1 parent 9bf5e48a

app工单派单修改

urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/controller/admin/eventinfo/EventInfoController.java
... ... @@ -77,7 +77,7 @@ public class EventInfoController {
77 77 @PostMapping("/order")
78 78 @Operation(summary = "创建事件对应工单")
79 79 @PreAuthorize("@ss.hasPermission('workorder:event-info:order')")
80   - public CommonResult<Boolean> createEventOrderInfo(@Valid @RequestBody EventOrderInfoSaveReqVO createReqVO) {
  80 + public CommonResult<Boolean> createEventOrderInfo(@Valid @RequestBody List<EventOrderInfoSaveReqVO> createReqVO) {
81 81 eventInfoService.createEventOrderInfo(createReqVO);
82 82 return success(true);
83 83 }
... ... @@ -130,4 +130,4 @@ public class EventInfoController {
130 130 BeanUtils.toBean(list, EventInfoRespVO.class));
131 131 }
132 132  
133   -}
134 133 \ No newline at end of file
  134 +}
... ...
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/service/eventinfo/EventInfoService.java
... ... @@ -66,8 +66,8 @@ public interface EventInfoService {
66 66 */
67 67 void endEventInfo(@Valid Long[] ids);
68 68  
69   - void createEventOrderInfo(@Valid EventOrderInfoSaveReqVO createReqVO);
  69 + void createEventOrderInfo(@Valid List<EventOrderInfoSaveReqVO> createReqVO);
70 70  
71 71 boolean bpmAiCallBack(String orderId,Integer status);
72 72  
73   -}
74 73 \ No newline at end of file
  74 +}
... ...
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/service/eventinfo/EventInfoServiceImpl.java
... ... @@ -22,6 +22,7 @@ import lombok.RequiredArgsConstructor;
22 22 import lombok.extern.slf4j.Slf4j;
23 23 import org.springframework.stereotype.Service;
24 24 import org.springframework.transaction.annotation.Transactional;
  25 +import org.springframework.util.CollectionUtils;
25 26 import org.springframework.util.ObjectUtils;
26 27 import org.springframework.validation.annotation.Validated;
27 28  
... ... @@ -30,7 +31,9 @@ import java.util.ArrayList;
30 31 import java.util.Arrays;
31 32 import java.util.List;
32 33  
  34 +import static com.zteits.urbanops.framework.common.exception.enums.GlobalErrorCodeConstants.BAD_REQUEST;
33 35 import static com.zteits.urbanops.framework.common.exception.util.ServiceExceptionUtil.exception;
  36 +import static com.zteits.urbanops.framework.common.exception.util.ServiceExceptionUtil.exception0;
34 37 import static com.zteits.urbanops.module.workorder.enums.ErrorCodeConstants.EVENT_INFO_NOT_EXISTS;
35 38 import static com.zteits.urbanops.module.workorder.enums.ErrorCodeConstants.EVENT_WORK_ORDER_CREATE_FAILED;
36 39  
... ... @@ -110,20 +113,26 @@ public class EventInfoServiceImpl implements EventInfoService {
110 113  
111 114 @Override
112 115 @Transactional(rollbackFor = Exception.class)
113   - public void createEventOrderInfo(EventOrderInfoSaveReqVO createReqVO) {
  116 + public void createEventOrderInfo(List<EventOrderInfoSaveReqVO> createReqVO) {
114 117  
115   - EventInfoDO eventInfo = eventInfoMapper.selectById(createReqVO.getId());
116   - if (!ObjectUtils.isEmpty(eventInfo)) {
117   - SecurityUserInfo userInfo = getCurrentUserInfo();
  118 + if (CollectionUtils.isEmpty(createReqVO)) {
  119 + throw exception0(BAD_REQUEST.getCode(),"参数不能为空");
  120 + }
  121 +
  122 + for (EventOrderInfoSaveReqVO reqVO : createReqVO){
  123 + EventInfoDO eventInfo = eventInfoMapper.selectById(reqVO.getId());
  124 + if (!ObjectUtils.isEmpty(eventInfo)) {
  125 + SecurityUserInfo userInfo = getCurrentUserInfo();
118 126  
119   - // 创建AI工单
120   - Long orderId = createAIWorkOrder(eventInfo, createReqVO);
  127 + // 创建AI工单
  128 + Long orderId = createAIWorkOrder(eventInfo, reqVO);
121 129  
122   - // 更新事件状态
123   - updateEventInfoStatus(eventInfo, userInfo.userId);
  130 + // 更新事件状态
  131 + updateEventInfoStatus(eventInfo, userInfo.userId);
124 132  
125   - // 创建事件映射信息
126   - createEventMappingInfo(eventInfo, orderId, createReqVO, userInfo);
  133 + // 创建事件映射信息
  134 + createEventMappingInfo(eventInfo, orderId, reqVO, userInfo);
  135 + }
127 136 }
128 137 }
129 138  
... ... @@ -247,4 +256,4 @@ public class EventInfoServiceImpl implements EventInfoService {
247 256 }
248 257 }
249 258  
250   -}
251 259 \ No newline at end of file
  260 +}
... ...