From 1d5be4b7d9ce988114eda7fa72518d24ed4d4d1e Mon Sep 17 00:00:00 2001 From: wangqian <1406304305@qq.com> Date: Fri, 9 Jan 2026 07:46:52 +0800 Subject: [PATCH] app工单派单修改 --- urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/controller/admin/eventinfo/EventInfoController.java | 4 ++-- urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/service/eventinfo/EventInfoService.java | 4 ++-- urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/service/eventinfo/EventInfoServiceImpl.java | 31 ++++++++++++++++++++----------- 3 files changed, 24 insertions(+), 15 deletions(-) diff --git a/urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/controller/admin/eventinfo/EventInfoController.java b/urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/controller/admin/eventinfo/EventInfoController.java index c1a6dff..ed1e9ca 100644 --- a/urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/controller/admin/eventinfo/EventInfoController.java +++ b/urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/controller/admin/eventinfo/EventInfoController.java @@ -77,7 +77,7 @@ public class EventInfoController { @PostMapping("/order") @Operation(summary = "创建事件对应工单") @PreAuthorize("@ss.hasPermission('workorder:event-info:order')") - public CommonResult createEventOrderInfo(@Valid @RequestBody EventOrderInfoSaveReqVO createReqVO) { + public CommonResult createEventOrderInfo(@Valid @RequestBody List createReqVO) { eventInfoService.createEventOrderInfo(createReqVO); return success(true); } @@ -130,4 +130,4 @@ public class EventInfoController { BeanUtils.toBean(list, EventInfoRespVO.class)); } -} \ No newline at end of file +} diff --git a/urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/service/eventinfo/EventInfoService.java b/urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/service/eventinfo/EventInfoService.java index c934885..20abc2d 100644 --- a/urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/service/eventinfo/EventInfoService.java +++ b/urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/service/eventinfo/EventInfoService.java @@ -66,8 +66,8 @@ public interface EventInfoService { */ void endEventInfo(@Valid Long[] ids); - void createEventOrderInfo(@Valid EventOrderInfoSaveReqVO createReqVO); + void createEventOrderInfo(@Valid List createReqVO); boolean bpmAiCallBack(String orderId,Integer status); -} \ No newline at end of file +} diff --git a/urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/service/eventinfo/EventInfoServiceImpl.java b/urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/service/eventinfo/EventInfoServiceImpl.java index 5afd2db..2da28ca 100644 --- a/urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/service/eventinfo/EventInfoServiceImpl.java +++ b/urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/service/eventinfo/EventInfoServiceImpl.java @@ -22,6 +22,7 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; import org.springframework.util.ObjectUtils; import org.springframework.validation.annotation.Validated; @@ -30,7 +31,9 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import static com.zteits.urbanops.framework.common.exception.enums.GlobalErrorCodeConstants.BAD_REQUEST; import static com.zteits.urbanops.framework.common.exception.util.ServiceExceptionUtil.exception; +import static com.zteits.urbanops.framework.common.exception.util.ServiceExceptionUtil.exception0; import static com.zteits.urbanops.module.workorder.enums.ErrorCodeConstants.EVENT_INFO_NOT_EXISTS; import static com.zteits.urbanops.module.workorder.enums.ErrorCodeConstants.EVENT_WORK_ORDER_CREATE_FAILED; @@ -110,20 +113,26 @@ public class EventInfoServiceImpl implements EventInfoService { @Override @Transactional(rollbackFor = Exception.class) - public void createEventOrderInfo(EventOrderInfoSaveReqVO createReqVO) { + public void createEventOrderInfo(List createReqVO) { - EventInfoDO eventInfo = eventInfoMapper.selectById(createReqVO.getId()); - if (!ObjectUtils.isEmpty(eventInfo)) { - SecurityUserInfo userInfo = getCurrentUserInfo(); + if (CollectionUtils.isEmpty(createReqVO)) { + throw exception0(BAD_REQUEST.getCode(),"参数不能为空"); + } + + for (EventOrderInfoSaveReqVO reqVO : createReqVO){ + EventInfoDO eventInfo = eventInfoMapper.selectById(reqVO.getId()); + if (!ObjectUtils.isEmpty(eventInfo)) { + SecurityUserInfo userInfo = getCurrentUserInfo(); - // 创建AI工单 - Long orderId = createAIWorkOrder(eventInfo, createReqVO); + // 创建AI工单 + Long orderId = createAIWorkOrder(eventInfo, reqVO); - // 更新事件状态 - updateEventInfoStatus(eventInfo, userInfo.userId); + // 更新事件状态 + updateEventInfoStatus(eventInfo, userInfo.userId); - // 创建事件映射信息 - createEventMappingInfo(eventInfo, orderId, createReqVO, userInfo); + // 创建事件映射信息 + createEventMappingInfo(eventInfo, orderId, reqVO, userInfo); + } } } @@ -247,4 +256,4 @@ public class EventInfoServiceImpl implements EventInfoService { } } -} \ No newline at end of file +} -- libgit2 0.21.4