xuhaifeng 9 months ago
parent
commit
3c8aba11af

+ 40 - 0
yiqi-api/src/main/java/com/yiqi/api/controller/order/WeAppOrderClothDeliveryManController.java

@@ -20,6 +20,7 @@ import com.yiqi.order.domain.dto.weapp.AppOrderClothDeliveryManQueryDTO;
 import com.yiqi.order.domain.vo.OrderClothVO;
 import com.yiqi.order.domain.vo.OrderDeliveryVO;
 import com.yiqi.order.domain.vo.weapp.WeAppOrderClothAppointmentVO;
+import com.yiqi.order.service.IOrderClothItemService;
 import com.yiqi.order.service.IOrderClothService;
 import com.yiqi.order.service.IOrderClothStatusRecordService;
 import com.yiqi.order.service.IOrderDeliveryService;
@@ -63,6 +64,9 @@ public class WeAppOrderClothDeliveryManController {
     @Autowired
     private IOrderClothService orderClothService;
 
+    @Autowired
+    private IOrderClothItemService orderClothItemService;
+
     @Autowired
     private IOrderClothStatusRecordService orderClothStatusRecordService;
 
@@ -105,6 +109,42 @@ public class WeAppOrderClothDeliveryManController {
         return R.ok(orderDeliveryVOList);
     }
 
+
+    @ApiOperation("配送员查询洗衣订单明细")
+    @GetMapping(value = "getInfoById")
+    public R<OrderClothVO> getInfoById(@RequestParam @ApiParam("订单ID") Long orderId) throws Exception {
+        OrderCloth orderCloth = orderClothService.getOne(new QueryWrapper<OrderCloth>().lambda()
+                .eq(OrderCloth::getId, orderId));
+        if (orderCloth == null) {
+            throw new ServiceException("未查询到订单信息");
+        }
+        OrderClothVO orderClothVO = new OrderClothVO();
+        BeanUtils.copyProperties(orderCloth, orderClothVO);
+        orderClothVO.setSysOrg(sysOrgService.getOne(new QueryWrapper<SysOrg>().lambda().eq(SysOrg::getId, orderCloth.getOrgId())
+                .eq(SysOrg::getSourceType, orderCloth.getSourceType())));
+
+        orderClothVO.setOrderClothItemVOS(
+                orderClothItemService.buildWeAppOrderClothItemDetail(
+                        orderClothItemService.list(new QueryWrapper<OrderClothItem>().lambda()
+                                .eq(OrderClothItem::getOrderId, orderCloth.getId()))));
+
+        if (TakeOrSendClothWay.DELIVERY.getCode().equals(orderCloth.getTakeClothWay())
+                || TakeOrSendClothWay.DELIVERY.getCode().equals(orderCloth.getSendClothWay())) {
+            Map<String, OrderDelivery> orderDeliveryMap = orderDeliveryService.list(
+                            new QueryWrapper<OrderDelivery>().lambda()
+                                    .eq(OrderDelivery::getOrderSn, orderCloth.getOrderNo()))
+                    .stream().collect(Collectors.toMap(OrderDelivery::getClothOrderType
+                            , OrderDelivery -> OrderDelivery));
+            if (TakeOrSendClothWay.DELIVERY.getCode().equals(orderCloth.getTakeClothWay())) {
+                orderClothVO.setCollectClothDeliverInfo(orderDeliveryMap.get(ClothOrderDeliveryType.collectCloth.getCode()));
+            }
+            if (TakeOrSendClothWay.DELIVERY.getCode().equals(orderCloth.getSendClothWay())) {
+                orderClothVO.setTakeClothDeliverInfo(orderDeliveryMap.get(ClothOrderDeliveryType.takeCloth.getCode()));
+            }
+        }
+        return R.ok(orderClothVO);
+    }
+
     @Transactional(rollbackFor = Exception.class)
     @ApiOperation("上门取衣")
     @PostMapping(value = "toDoor")