Kaynağa Gözat

```
feat(pressure2): 完善预约确认订单状态更新和异常数据处理

- 在锅炉预约确认订单服务中设置订单状态为200
- 在管道预约确认订单服务中设置订单状态为200
- 添加锅炉订单异常服务依赖注入
- 实现订单状态为200时的数据转换和提交逻辑
- 集成锅炉订单异常数据查询和映射功能
- 实现团队用户数据分组和领导设置逻辑
- 添加管道订单异常数据处理和提交功能
```

xuzhancheng 2 gün önce
ebeveyn
işleme
0de83ceb15

+ 34 - 0
tz-module-pressure2/tz-module-pressure2-biz/src/main/java/cn/start/tz/module/pressure2/service/appointmentconfirmorder/AppointmentConfirmOrderServiceImpl.java

@@ -26,6 +26,7 @@ import cn.start.tz.module.member.api.user.dto.MemberUserReqVo;
 import cn.start.tz.module.member.api.user.dto.MemberUserRespDTO;
 import cn.start.tz.module.member.api.user.dto.SendAppMpMessageReqDTO;
 import cn.start.tz.module.member.api.user.dto.WxMpTemplateDataReqDto;
+import cn.start.tz.module.pressure2.controller.admin.boilerorderexception.vo.BoilerOrderExceptionSaveReqVO;
 import cn.start.tz.module.pressure2.dal.dataobject.acceptorder.AcceptOrderDO;
 import cn.start.tz.module.pressure2.enums.RedisKeyEnums;
 import cn.start.tz.module.pressure2.controller.admin.appointmentconfirmorder.vo.*;
@@ -55,6 +56,7 @@ import cn.start.tz.module.pressure2.dal.mysql.equipboiler.EquipBoilerMapper;
 import cn.start.tz.module.pressure2.dal.mysql.equipboilerschedulingitem.EquipBoilerSchedulingCheckMapper;
 import cn.start.tz.module.pressure2.dal.mysql.equipboilerschedulingitem.EquipBoilerSchedulingItemMapper;
 import cn.start.tz.module.pressure2.service.acceptorder.AcceptOrderService;
+import cn.start.tz.module.pressure2.service.boilerorderexception.BoilerOrderExceptionService;
 import cn.start.tz.module.pressure2.service.common.RedisService;
 import cn.start.tz.module.pressure2.service.equipboilerschedulingcheck.EquipBoilerSchedulingCheckService;
 import cn.start.tz.module.pressure2.service.member.MemberRemoteService;
@@ -722,6 +724,7 @@ public class AppointmentConfirmOrderServiceImpl implements AppointmentConfirmOrd
             AppointmentConfirmOrderDO updateObj = BeanUtils.toBean(submitVO, AppointmentConfirmOrderDO.class);
             // 设置已创建受理单标志为true
             updateObj.setCreateAcceptOrder(true);
+            updateObj.setStatus(200);
             // 执行更新操作
             appointmentConfirmOrderMapper.updateById(updateObj);
         } else {
@@ -1055,6 +1058,37 @@ public class AppointmentConfirmOrderServiceImpl implements AppointmentConfirmOrd
             updateObj.setRemark(confirmOrderVO.getRemark());
         }
         appointmentConfirmOrderMapper.updateById(updateObj);
+
+        if (confirmOrderVO.getStatus() == 200) {
+            List<BoilerAppointmentConfirmOrderItemDO> boilerAppointmentConfirmOrderItemDOS = appointmentConfirmOrderItemMapper.selectList(BoilerAppointmentConfirmOrderItemDO::getOrderId, confirmOrderVO.getId());
+            List<BoilerAppointmentConfirmOrderUserDO> boilerAppointmentConfirmOrderUserDOS = appointmentConfirmOrderUserMapper.selectList(BoilerAppointmentConfirmOrderUserDO::getOrderId, confirmOrderVO.getId());
+
+            AppointmentSubmitVO appointmentSubmitVO = BeanUtils.toBean(orderDO, AppointmentSubmitVO.class);
+            appointmentSubmitVO.setEquipIds(boilerAppointmentConfirmOrderItemDOS.stream().map(BoilerAppointmentConfirmOrderItemDO::getEquipId).toList());
+            // 将BoilerAppointmentConfirmOrderUserDO,转为groupTeamId:将BoilerAppointmentConfirmOrderUserDO的map
+            List<SubmitTeamItemVO> teamItemVOS = new ArrayList<>();
+            Map<String, List<BoilerAppointmentConfirmOrderUserDO>> groupTeamIdMap = boilerAppointmentConfirmOrderUserDOS.stream().collect(Collectors.groupingBy(BoilerAppointmentConfirmOrderUserDO::getGroupTeamId));
+            groupTeamIdMap.forEach((groupTeamId, userDOS) -> {
+                SubmitTeamItemVO teamItemVO = new SubmitTeamItemVO();
+                teamItemVO.setGroupTeamId(groupTeamId);
+                userDOS.stream().filter(boilerAppointmentConfirmOrderUserDO -> boilerAppointmentConfirmOrderUserDO.getType() == 100)
+                        .findFirst()
+                        .ifPresent(leader -> teamItemVO.setLeaderId(leader.getUserId()));
+                teamItemVO.setUserIds(userDOS.stream().filter(boilerAppointmentConfirmOrderUserDO -> boilerAppointmentConfirmOrderUserDO.getType() == 200).map(BoilerAppointmentConfirmOrderUserDO::getUserId).toList());
+                teamItemVOS.add(teamItemVO);
+            });
+            appointmentSubmitVO.setTeamList(teamItemVOS);
+            LambdaQueryWrapperX<BoilerOrderExceptionDO> queryOrderException = new LambdaQueryWrapperX<>();
+            queryOrderException.eq(BoilerOrderExceptionDO::getOrderType, 100);
+            queryOrderException.eq(BoilerOrderExceptionDO::getOrderId, appointmentSubmitVO.getId());
+            List<BoilerOrderExceptionDO> orderExceptionDOS = boilerOrderExceptionMapper.selectList(queryOrderException);
+            if (CollUtil.isNotEmpty(orderExceptionDOS)) {
+                BoilerOrderExceptionSaveReqVO orderExceptionRespVO = new BoilerOrderExceptionSaveReqVO();
+                BeanUtils.copyProperties(orderExceptionDOS.get(0), orderExceptionRespVO);
+                appointmentSubmitVO.setBoilerOrderExceptionSaveReqVO(orderExceptionRespVO);
+            }
+            submitBoiler(appointmentSubmitVO);
+        }
     }
 
     @Override

+ 34 - 0
tz-module-pressure2/tz-module-pressure2-biz/src/main/java/cn/start/tz/module/pressure2/service/appointmentconfirmorder/PipeAppointmentConfirmOrderServiceImpl.java

@@ -24,8 +24,11 @@ import cn.start.tz.module.member.api.user.dto.MemberUserReqVo;
 import cn.start.tz.module.member.api.user.dto.MemberUserRespDTO;
 import cn.start.tz.module.member.api.user.dto.SendAppMpMessageReqDTO;
 import cn.start.tz.module.member.api.user.dto.WxMpTemplateDataReqDto;
+import cn.start.tz.module.pressure2.controller.admin.boilerorderexception.vo.BoilerOrderExceptionSaveReqVO;
+import cn.start.tz.module.pressure2.controller.admin.pipeorderexception.vo.PipeOrderExceptionSaveReqVO;
 import cn.start.tz.module.pressure2.dal.dataobject.boileracceptorderuser.BoilerAcceptOrderUserDO;
 import cn.start.tz.module.pressure2.dal.dataobject.boilerappointmentconfirmorderuser.BoilerAppointmentConfirmOrderUserDO;
+import cn.start.tz.module.pressure2.dal.dataobject.boilerorderexception.BoilerOrderExceptionDO;
 import cn.start.tz.module.pressure2.enums.RedisKeyEnums;
 import cn.start.tz.module.pressure2.controller.admin.appointmentconfirmorder.vo.*;
 import cn.start.tz.module.pressure2.controller.app.appointmentconfirmorder.vo.AppAppointmentRefuseVO;
@@ -803,6 +806,7 @@ public class PipeAppointmentConfirmOrderServiceImpl implements PipeAppointmentCo
             AppointmentConfirmOrderDO updateObj = BeanUtils.toBean(submitVO, AppointmentConfirmOrderDO.class);
             // 设置已创建受理单标志为true
             updateObj.setCreateAcceptOrder(true);
+            updateObj.setStatus(200);
             // 执行更新操作
             appointmentConfirmOrderMapper.updateById(updateObj);
         } else {
@@ -1216,6 +1220,36 @@ public class PipeAppointmentConfirmOrderServiceImpl implements PipeAppointmentCo
             updateObj.setRemark(confirmOrderVO.getRemark());
         }
         appointmentConfirmOrderMapper.updateById(updateObj);
+        if (confirmOrderVO.getStatus() == 200) {
+            List<PipeAppointmentConfirmOrderItemDO> pipeAppointmentConfirmOrderItemDOS = appointmentConfirmOrderItemMapper.selectList(PipeAppointmentConfirmOrderItemDO::getOrderId, confirmOrderVO.getId());
+            List<PipeAppointmentConfirmOrderUserDO> pipeAppointmentConfirmOrderUserDOS = pipeAppointmentConfirmOrderUserMapper.selectList(PipeAppointmentConfirmOrderUserDO::getOrderId, confirmOrderVO.getId());
+
+            PipeAppointmentSubmitVO appointmentSubmitVO = BeanUtils.toBean(orderDO, PipeAppointmentSubmitVO.class);
+            appointmentSubmitVO.setEquipIds(pipeAppointmentConfirmOrderItemDOS.stream().map(PipeAppointmentConfirmOrderItemDO::getEquipId).toList());
+            // 将PipeAppointmentConfirmOrderUserDO,转为groupTeamId:将PipeAppointmentConfirmOrderUserDO的map
+            List<SubmitTeamItemVO> teamItemVOS = new ArrayList<>();
+            Map<String, List<PipeAppointmentConfirmOrderUserDO>> groupTeamIdMap = pipeAppointmentConfirmOrderUserDOS.stream().collect(Collectors.groupingBy(PipeAppointmentConfirmOrderUserDO::getGroupTeamId));
+            groupTeamIdMap.forEach((groupTeamId, userDOS) -> {
+                SubmitTeamItemVO teamItemVO = new SubmitTeamItemVO();
+                teamItemVO.setGroupTeamId(groupTeamId);
+                userDOS.stream().filter(pipeAppointmentConfirmOrderUserDO -> pipeAppointmentConfirmOrderUserDO.getType() == 100)
+                        .findFirst()
+                        .ifPresent(leader -> teamItemVO.setLeaderId(leader.getUserId()));
+                teamItemVO.setUserIds(userDOS.stream().filter(pipeAppointmentConfirmOrderUserDO -> pipeAppointmentConfirmOrderUserDO.getType() == 200).map(PipeAppointmentConfirmOrderUserDO::getUserId).toList());
+                teamItemVOS.add(teamItemVO);
+            });
+            appointmentSubmitVO.setTeamList(teamItemVOS);
+            LambdaQueryWrapperX<PipeOrderExceptionDO> queryOrderException = new LambdaQueryWrapperX<>();
+            queryOrderException.eq(PipeOrderExceptionDO::getOrderType, 100);
+            queryOrderException.eq(PipeOrderExceptionDO::getOrderId, appointmentSubmitVO.getId());
+            List<PipeOrderExceptionDO> orderExceptionDOS = pipeOrderExceptionMapper.selectList(queryOrderException);
+            if (CollUtil.isNotEmpty(orderExceptionDOS)) {
+                PipeOrderExceptionSaveReqVO orderExceptionRespVO = new PipeOrderExceptionSaveReqVO();
+                BeanUtils.copyProperties(orderExceptionDOS.get(0), orderExceptionRespVO);
+                appointmentSubmitVO.setBoilerOrderExceptionSaveReqVO(orderExceptionRespVO);
+            }
+            submitPipe(appointmentSubmitVO);
+        }
     }
 
     @Override