Răsfoiți Sursa

[add] 同城配送逻辑修改

BKGin 6 luni în urmă
părinte
comite
2d35e8ceeb

+ 35 - 61
yiqi-admin/src/main/java/com/yiqi/admin/controller/core/SysStoreIntracityExpressController.java

@@ -3,6 +3,8 @@ package com.yiqi.admin.controller.core;
 import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import com.yiqi.app.domain.AppUser;
+import com.yiqi.app.service.IAppUserService;
 import com.yiqi.common.exception.ServiceException;
 import com.yiqi.common.config.SystemEnvConfig;
 import com.yiqi.common.constant.UrlConstants;
@@ -19,9 +21,9 @@ import com.yiqi.core.domain.dto.wx.*;
 import com.yiqi.core.domain.vo.wx.*;
 import com.yiqi.core.service.ISysStoreIntracityExpressService;
 import com.yiqi.order.domain.OrderCloth;
-import com.yiqi.order.domain.OrderClothDeliveryAddress;
-import com.yiqi.order.service.IOrderClothDeliveryAddressService;
+import com.yiqi.order.domain.OrderDelivery;
 import com.yiqi.order.service.IOrderClothService;
+import com.yiqi.order.service.IOrderDeliveryService;
 import com.yiqi.system.domain.SysStore;
 import com.yiqi.system.service.ISysStoreService;
 import io.swagger.annotations.ApiOperation;
@@ -44,7 +46,9 @@ public class SysStoreIntracityExpressController extends BaseController {
     @Autowired
     private IOrderClothService orderClothService;
     @Autowired
-    private IOrderClothDeliveryAddressService orderClothDeliveryAddressService;
+    private IOrderDeliveryService orderDeliveryService;
+    @Autowired
+    private IAppUserService appUserService;
 
     /**
      * 创建微信同城配送门店
@@ -179,43 +183,24 @@ public class SysStoreIntracityExpressController extends BaseController {
         request.setUser_sandbox(SystemEnv.PROD.getCode().equals(SystemEnvConfig.env) ? 0 : 1);
 
         if (orderCloth.getOrderStatus().equals(ClothOrderStatusType.APPOINTMENT.getCode())) {
-            //同城配送订单只能由商家地址发货,所以如果是上门收衣的话,先把门店地址改为客户地址,查询完后再改回来
-            OrderClothDeliveryAddress orderClothDeliveryAddress
-                    = orderClothDeliveryAddressService.getOne(new QueryWrapper<OrderClothDeliveryAddress>().lambda()
-                    .eq(OrderClothDeliveryAddress::getOrderNo, orderNo)
-                    .eq(OrderClothDeliveryAddress::getClothOrderType, ClothOrderDeliveryType.collectCloth.getCode()));
-            if (orderClothDeliveryAddress == null) {
-                throw new ServiceException("未查询到收衣配送信息");
-            }
-            sysStoreIntracityExpressService.updateStoreInfo(sysStore, orderClothDeliveryAddress);
-            request.setWx_store_id(sysStore.getWxStoreId());
-            request.setUser_name(sysStore.getContactName());
-            request.setUser_phone(sysStore.getContactPhone());
-            request.setUser_address(sysStore.getAddress()
-                    + sysStore.getAddressDetail());
-            request.setUser_lat(sysStore.getLatitude().doubleValue());
-            request.setUser_lng(sysStore.getLongitude().doubleValue());
-
-            IntracityExpressPreAddOrderResult result = sysStoreIntracityExpressService.preAddOrder(request);
-            sysStoreIntracityExpressService.updateStoreInfo(sysStore);
-            return R.ok(result);
-
+            throw new ServiceException("同城配送暂不支持上门取件");
         } else if (orderCloth.getOrderStatus().equals(ClothOrderStatusType.WAITING_TO_SEND.getCode())) {
             //同城配送订单只能由商家地址发货,所以如果是上门收衣的话,先把门店地址改为客户地址,查询完后再改回来
-            OrderClothDeliveryAddress orderClothDeliveryAddress
-                    = orderClothDeliveryAddressService.getOne(new QueryWrapper<OrderClothDeliveryAddress>().lambda()
-                    .eq(OrderClothDeliveryAddress::getOrderNo, orderNo)
-                    .eq(OrderClothDeliveryAddress::getClothOrderType, ClothOrderDeliveryType.collectCloth.getCode()));
-            if (orderClothDeliveryAddress == null) {
+            OrderDelivery orderDelivery
+                    = orderDeliveryService.getOne(new QueryWrapper<OrderDelivery>().lambda()
+                    .eq(OrderDelivery::getOrderSn, orderNo)
+                    .eq(OrderDelivery::getClothOrderType, ClothOrderDeliveryType.collectCloth.getCode()));
+            if (orderDelivery == null) {
                 throw new ServiceException("未查询到收衣配送信息");
             }
             request.setWx_store_id(sysStore.getWxStoreId());
-            request.setUser_name(orderClothDeliveryAddress.getContactName());
-            request.setUser_phone(orderClothDeliveryAddress.getContactPhone());
-            request.setUser_address(orderClothDeliveryAddress.getAddress()
-                    + orderClothDeliveryAddress.getAddressDetail());
-            request.setUser_lat(orderClothDeliveryAddress.getLatitude().doubleValue());
-            request.setUser_lng(orderClothDeliveryAddress.getLongitude().doubleValue());
+            // 查询顾客信息
+            AppUser appUser = appUserService.getOne(new QueryWrapper<AppUser>().lambda().eq(AppUser::getId, orderDelivery.getAppUserId()));
+            request.setUser_name(appUser.getNickName());
+            request.setUser_phone(orderDelivery.getUserPhone());
+            request.setUser_address(orderDelivery.getUserAddress());
+            request.setUser_lat(Double.parseDouble(orderDelivery.getUserLat()));
+            request.setUser_lng(Double.parseDouble(orderDelivery.getUserLng()));
             return R.ok(sysStoreIntracityExpressService.preAddOrder(request));
         } else {
             throw new ServiceException("订单状态不正确");
@@ -257,19 +242,19 @@ public class SysStoreIntracityExpressController extends BaseController {
             throw new ServiceException("未查询到订单");
         }
 
-        OrderClothDeliveryAddress orderClothDeliveryAddress = orderClothDeliveryAddressService.getOne(
-                new QueryWrapper<OrderClothDeliveryAddress>().lambda()
-                        .eq(OrderClothDeliveryAddress::getOrderId, orderCloth.getId())
-                        .eq(OrderClothDeliveryAddress::getClothOrderType, deliveryType));
-        if (orderClothDeliveryAddress == null) {
+        OrderDelivery orderDelivery = orderDeliveryService.getOne(
+                new QueryWrapper<OrderDelivery>().lambda()
+                        .eq(OrderDelivery::getOrderSn, orderCloth.getOrderNo())
+                        .eq(OrderDelivery::getClothOrderType, deliveryType));
+        if (orderDelivery == null) {
             throw new ServiceException("未查询到配送订单");
         }
-        if (!orderClothDeliveryAddress.getDeliveryWay().equals(ClothOrderDeliveryWay.intracityExpress.getCode())) {
+        if (!orderDelivery.getDeliveryWay().equals(ClothOrderDeliveryWay.intracityExpress.getCode())) {
             throw new ServiceException("该配送不是同城配送,无法查询");
         }
         IntracityExpressOrderInfoRequest request = new IntracityExpressOrderInfoRequest();
         request.setWx_store_id(sysStore.getWxStoreId());
-        request.setStore_order_id(orderClothDeliveryAddress.getThirdDeliveryOrderNo());
+        request.setStore_order_id(orderDelivery.getDeliverySn());
         IntracityExpressOrderInfoResult result = sysStoreIntracityExpressService.getOrderInfo(request);
         return R.ok(result);
     }
@@ -286,14 +271,14 @@ public class SysStoreIntracityExpressController extends BaseController {
             @RequestBody IntracityExpressOrderStatusChangeDTO intracityExpressOrderStatusChangeDTO) throws Exception {
         logger.info("api statusChange");
         logger.info("params:" + JSON.toJSONString(intracityExpressOrderStatusChangeDTO));
-        OrderClothDeliveryAddress orderClothDeliveryAddress = orderClothDeliveryAddressService.getOne(
-                new QueryWrapper<OrderClothDeliveryAddress>().lambda()
-                        .eq(OrderClothDeliveryAddress::getThirdDeliveryOrderNo, intracityExpressOrderStatusChangeDTO.getStore_order_id()));
-        if (orderClothDeliveryAddress == null) {
+        OrderDelivery orderDelivery = orderDeliveryService.getOne(
+                new QueryWrapper<OrderDelivery>().lambda()
+                        .eq(OrderDelivery::getTransOrderId, intracityExpressOrderStatusChangeDTO.getStore_order_id()));
+        if (orderDelivery == null) {
             throw new ServiceException("未查询到配送信息");
         }
         OrderCloth orderCloth = orderClothService.getOne(
-                new QueryWrapper<OrderCloth>().lambda().eq(OrderCloth::getId, orderClothDeliveryAddress.getOrderId()));
+                new QueryWrapper<OrderCloth>().lambda().eq(OrderCloth::getOrderNo, orderDelivery.getOrderSn()));
         if (orderCloth == null) {
             throw new ServiceException("未查询到洗衣订单");
         }
@@ -302,12 +287,6 @@ public class SysStoreIntracityExpressController extends BaseController {
 //            case 20000:
             case 20001://配送方取消订单
             {
-                if (orderCloth.getOrderStatus().equals(ClothOrderStatusType.WAITING_TO_DOOR.getCode())
-                        || orderCloth.getOrderStatus().equals(ClothOrderStatusType.HAS_TO_DOOR.getCode())) {
-                    orderClothService.update(new UpdateWrapper<OrderCloth>().lambda()
-                            .set(OrderCloth::getOrderStatus, ClothOrderStatusType.APPOINTMENT.getCode())
-                            .eq(OrderCloth::getId, orderCloth.getId()));
-                }
                 if (orderCloth.getOrderStatus().equals(ClothOrderStatusType.SENDING.getCode())) {
                     orderClothService.update(new UpdateWrapper<OrderCloth>().lambda()
                             .set(OrderCloth::getOrderStatus, ClothOrderStatusType.WAITING_TO_SEND.getCode())
@@ -317,14 +296,7 @@ public class SysStoreIntracityExpressController extends BaseController {
             }
             case 70000://配送完成
             {
-                if (orderClothDeliveryAddress.getClothOrderType().equals(ClothOrderDeliveryType.collectCloth.getCode())
-                        && (orderCloth.getOrderStatus().equals(ClothOrderStatusType.WAITING_TO_DOOR.getCode())
-                        || orderCloth.getOrderStatus().equals(ClothOrderStatusType.HAS_TO_DOOR.getCode()))) {
-                    orderClothService.update(new UpdateWrapper<OrderCloth>().lambda()
-                            .set(OrderCloth::getOrderStatus, ClothOrderStatusType.HAS_TAKING.getCode())
-                            .eq(OrderCloth::getId, orderCloth.getId()));
-                }
-                if (orderClothDeliveryAddress.getClothOrderType().equals(ClothOrderDeliveryType.takeCloth.getCode())
+                if (orderDelivery.getClothOrderType().equals(ClothOrderDeliveryType.takeCloth.getCode())
                         && (orderCloth.getOrderStatus().equals(ClothOrderStatusType.WAITING_TO_SEND.getCode())
                         || orderCloth.getOrderStatus().equals(ClothOrderStatusType.SENDING.getCode()))) {
                     orderClothService.update(new UpdateWrapper<OrderCloth>().lambda()
@@ -334,6 +306,8 @@ public class SysStoreIntracityExpressController extends BaseController {
                 break;
             }
         }
+        orderDelivery.setDeliveryStatus(String.valueOf(intracityExpressOrderStatusChangeDTO.getOrder_status()));
+        orderDeliveryService.updateById(orderDelivery);
         return new IntracityExpressOrderStatusChangeVO();
     }
 

+ 103 - 123
yiqi-admin/src/main/java/com/yiqi/admin/controller/order/OrderClothController.java

@@ -31,8 +31,8 @@ import com.yiqi.core.domain.vo.ClothHangerOrderRelationVO;
 import com.yiqi.core.domain.vo.wx.IntracityExpressBaseResult;
 import com.yiqi.core.service.ISysStoreIntracityExpressService;
 import com.yiqi.order.domain.OrderCloth;
-import com.yiqi.order.domain.OrderClothDeliveryAddress;
 import com.yiqi.order.domain.OrderClothItem;
+import com.yiqi.order.domain.OrderDelivery;
 import com.yiqi.order.domain.dto.*;
 import com.yiqi.order.domain.vo.*;
 import com.yiqi.order.service.*;
@@ -87,7 +87,7 @@ public class OrderClothController extends BaseController {
     @Autowired
     private ISysOrgService sysOrgService;
     @Autowired
-    private IOrderClothDeliveryAddressService orderClothDeliveryAddressService;
+    private IOrderDeliveryService orderDeliveryService;
     @Autowired
     private IAppUserBillMstrService appUserBillMstrService;
     @Autowired
@@ -169,88 +169,89 @@ public class OrderClothController extends BaseController {
     @ApiOperation("第三方快递配送")
     @PostMapping(value = "setThirdDelivery")
     public R setThirdDelivery(@RequestBody @Valid OrderClothThirdDeliverySendDTO orderClothThirdDeliverySendDTO) throws Exception {
-        OrderCloth orderCloth = orderClothService.getOne(new QueryWrapper<OrderCloth>().lambda()
-                .eq(OrderCloth::getOrderNo, orderClothThirdDeliverySendDTO.getOrderNo())
-                .eq(OrderCloth::getOrgId, SecurityUtils.getLoginUser().getOrgId())
-                .eq(OrderCloth::getSourceType, SecurityUtils.getLoginUser().getSourceType()));
-        if (orderCloth == null) {
-            throw new ServiceException("未查询到订单信息");
-        }
-        if (!orderCloth.getSourceType().equals(SourceType.FACTORY.getCode())) {
-            throw new ServiceException("该订单不是云洗订单,无法快递配送派单");
-        }
-//        ManageFactory factory = manageFactoryService.getOne(new QueryWrapper<ManageFactory>().lambda().eq(ManageFactory::getId,orderCloth.getOrgId()));
-//        if(factory == null){
-//            throw new ServiceException("未查询到工厂");
+//        OrderCloth orderCloth = orderClothService.getOne(new QueryWrapper<OrderCloth>().lambda()
+//                .eq(OrderCloth::getOrderNo, orderClothThirdDeliverySendDTO.getOrderNo())
+//                .eq(OrderCloth::getOrgId, SecurityUtils.getLoginUser().getOrgId())
+//                .eq(OrderCloth::getSourceType, SecurityUtils.getLoginUser().getSourceType()));
+//        if (orderCloth == null) {
+//            throw new ServiceException("未查询到订单信息");
 //        }
-        switch (EnumUtils.getEnumByType(orderCloth.getOrderStatus(), ClothOrderStatusType.class)) {
-            case APPOINTMENT: {
-                OrderClothDeliveryAddress orderClothDeliveryAddress = orderClothDeliveryAddressService
-                        .getOne(new QueryWrapper<OrderClothDeliveryAddress>().lambda()
-                                .eq(OrderClothDeliveryAddress::getOrderNo, orderClothThirdDeliverySendDTO.getOrderNo())
-                                .eq(OrderClothDeliveryAddress::getClothOrderType, ClothOrderDeliveryType.collectCloth.getCode()));
-                if (orderClothDeliveryAddress == null) {
-                    throw new ServiceException("未查询到配送信息");
-                }
-                orderClothDeliveryAddress.setThirdDeliveryOrderNo(orderNoUtils.getDeliveryOrderNo());
-                orderClothDeliveryAddress.setDeliveryWay(ClothOrderDeliveryWay.thirdExpress.getCode());
-                orderClothDeliveryAddress.setDeliveryId(orderClothThirdDeliverySendDTO.getDeliveryId());
-                orderClothDeliveryAddress.setDeliveryName(orderClothThirdDeliverySendDTO.getDeliveryCompany());
-                orderClothDeliveryAddress.setServiceType(orderClothThirdDeliverySendDTO.getServiceType());
-                orderClothDeliveryAddress.setServiceName(orderClothThirdDeliverySendDTO.getServiceName());
-                orderClothDeliveryAddressService.updateById(orderClothDeliveryAddress);
-                if (!ClothTakeWay.DELIVERY.getCode().equals(orderCloth.getTakeClothWay())) {
-                    throw new ServiceException("该订单客户未选择上门取衣,无法分配配送员");
-                }
-                //这里进行快递下单
-                AppUserInfoVO appUserInfo = appUserService.getAppUserInfoById(orderCloth.getAppUserId());
-                OrderThirdDeliveryAddDTO orderThirdDeliveryAddDTO = OrderThirdDeliveryAddDTO
-                        .buildDeliveryOrderByClothOrder(orderCloth, orderClothDeliveryAddress, orderClothThirdDeliverySendDTO
-                                , getDeliveryInfoByOrg(SecurityUtils.getLoginUser().getOrgId(), SecurityUtils.getLoginUser().getSourceType()), appUserInfo);
-                WxMaExpressOrderInfoResult result = thirdDeliveryService.addDeliveryOrder(orderThirdDeliveryAddDTO);
-                orderClothDeliveryAddress.setWaybillNo(result.getWaybillId());
-                orderClothDeliveryAddressService.updateById(orderClothDeliveryAddress);
-                orderClothService.update(new UpdateWrapper<OrderCloth>().lambda()
-                        .eq(OrderCloth::getId, orderCloth.getId())
-                        .set(OrderCloth::getOrderStatus, ClothOrderStatusType.WAITING_TO_DOOR.getCode()));
-
-                return R.ok();
-            }
-            case WAITING_TO_SEND: {
-                OrderClothDeliveryAddress orderClothDeliveryAddress = orderClothDeliveryAddressService
-                        .getOne(new QueryWrapper<OrderClothDeliveryAddress>().lambda()
-                                .eq(OrderClothDeliveryAddress::getOrderNo, orderClothThirdDeliverySendDTO.getOrderNo())
-                                .eq(OrderClothDeliveryAddress::getClothOrderType, ClothOrderDeliveryType.takeCloth.getCode()));
-                if (orderClothDeliveryAddress == null) {
-                    throw new ServiceException("未查询到配送信息");
-                }
-                orderClothDeliveryAddress.setThirdDeliveryOrderNo(orderNoUtils.getDeliveryOrderNo());
-                orderClothDeliveryAddress.setDeliveryWay(ClothOrderDeliveryWay.thirdExpress.getCode());
-                orderClothDeliveryAddress.setDeliveryId(orderClothThirdDeliverySendDTO.getDeliveryId());
-                orderClothDeliveryAddress.setDeliveryName(orderClothThirdDeliverySendDTO.getDeliveryCompany());
-                orderClothDeliveryAddress.setServiceType(orderClothThirdDeliverySendDTO.getServiceType());
-                orderClothDeliveryAddress.setServiceName(orderClothThirdDeliverySendDTO.getServiceName());
-                orderClothDeliveryAddressService.updateById(orderClothDeliveryAddress);
-                if (!ClothTakeWay.DELIVERY.getCode().equals(orderCloth.getSendClothWay())) {
-                    throw new ServiceException("该订单客户未选择送货上门,无法分配配送员");
-                }
-                //这里进行快递下单
-                AppUserInfoVO appUserInfo = appUserService.getAppUserInfoById(orderCloth.getAppUserId());
-                OrderThirdDeliveryAddDTO orderThirdDeliveryAddDTO = OrderThirdDeliveryAddDTO
-                        .buildDeliveryOrderByClothOrder(orderCloth, orderClothDeliveryAddress, orderClothThirdDeliverySendDTO
-                                , getDeliveryInfoByOrg(SecurityUtils.getLoginUser().getOrgId(), SecurityUtils.getLoginUser().getSourceType()), appUserInfo);
-                WxMaExpressOrderInfoResult result = thirdDeliveryService.addDeliveryOrder(orderThirdDeliveryAddDTO);
-                orderClothDeliveryAddress.setWaybillNo(result.getWaybillId());
-                orderClothDeliveryAddressService.updateById(orderClothDeliveryAddress);
-                orderClothService.update(new UpdateWrapper<OrderCloth>().lambda()
-                        .eq(OrderCloth::getId, orderCloth.getId())
-                        .set(OrderCloth::getOrderStatus, ClothOrderStatusType.SENDING.getCode()));
-                return R.ok();
-            }
-            default: {
-                throw new ServiceException("订单状态不正确,无法派单");
-            }
-        }
+//        if (!orderCloth.getSourceType().equals(SourceType.FACTORY.getCode())) {
+//            throw new ServiceException("该订单不是云洗订单,无法快递配送派单");
+//        }
+////        ManageFactory factory = manageFactoryService.getOne(new QueryWrapper<ManageFactory>().lambda().eq(ManageFactory::getId,orderCloth.getOrgId()));
+////        if(factory == null){
+////            throw new ServiceException("未查询到工厂");
+////        }
+//        switch (EnumUtils.getEnumByType(orderCloth.getOrderStatus(), ClothOrderStatusType.class)) {
+//            case APPOINTMENT: {
+//                OrderClothDeliveryAddress orderClothDeliveryAddress = orderClothDeliveryAddressService
+//                        .getOne(new QueryWrapper<OrderClothDeliveryAddress>().lambda()
+//                                .eq(OrderClothDeliveryAddress::getOrderNo, orderClothThirdDeliverySendDTO.getOrderNo())
+//                                .eq(OrderClothDeliveryAddress::getClothOrderType, ClothOrderDeliveryType.collectCloth.getCode()));
+//                if (orderClothDeliveryAddress == null) {
+//                    throw new ServiceException("未查询到配送信息");
+//                }
+//                orderClothDeliveryAddress.setThirdDeliveryOrderNo(orderNoUtils.getDeliveryOrderNo());
+//                orderClothDeliveryAddress.setDeliveryWay(ClothOrderDeliveryWay.thirdExpress.getCode());
+//                orderClothDeliveryAddress.setDeliveryId(orderClothThirdDeliverySendDTO.getDeliveryId());
+//                orderClothDeliveryAddress.setDeliveryName(orderClothThirdDeliverySendDTO.getDeliveryCompany());
+//                orderClothDeliveryAddress.setServiceType(orderClothThirdDeliverySendDTO.getServiceType());
+//                orderClothDeliveryAddress.setServiceName(orderClothThirdDeliverySendDTO.getServiceName());
+//                orderClothDeliveryAddressService.updateById(orderClothDeliveryAddress);
+//                if (!ClothTakeWay.DELIVERY.getCode().equals(orderCloth.getTakeClothWay())) {
+//                    throw new ServiceException("该订单客户未选择上门取衣,无法分配配送员");
+//                }
+//                //这里进行快递下单
+//                AppUserInfoVO appUserInfo = appUserService.getAppUserInfoById(orderCloth.getAppUserId());
+//                OrderThirdDeliveryAddDTO orderThirdDeliveryAddDTO = OrderThirdDeliveryAddDTO
+//                        .buildDeliveryOrderByClothOrder(orderCloth, orderClothDeliveryAddress, orderClothThirdDeliverySendDTO
+//                                , getDeliveryInfoByOrg(SecurityUtils.getLoginUser().getOrgId(), SecurityUtils.getLoginUser().getSourceType()), appUserInfo);
+//                WxMaExpressOrderInfoResult result = thirdDeliveryService.addDeliveryOrder(orderThirdDeliveryAddDTO);
+//                orderClothDeliveryAddress.setWaybillNo(result.getWaybillId());
+//                orderClothDeliveryAddressService.updateById(orderClothDeliveryAddress);
+//                orderClothService.update(new UpdateWrapper<OrderCloth>().lambda()
+//                        .eq(OrderCloth::getId, orderCloth.getId())
+//                        .set(OrderCloth::getOrderStatus, ClothOrderStatusType.WAITING_TO_DOOR.getCode()));
+//
+//                return R.ok();
+//            }
+//            case WAITING_TO_SEND: {
+//                OrderClothDeliveryAddress orderClothDeliveryAddress = orderClothDeliveryAddressService
+//                        .getOne(new QueryWrapper<OrderClothDeliveryAddress>().lambda()
+//                                .eq(OrderClothDeliveryAddress::getOrderNo, orderClothThirdDeliverySendDTO.getOrderNo())
+//                                .eq(OrderClothDeliveryAddress::getClothOrderType, ClothOrderDeliveryType.takeCloth.getCode()));
+//                if (orderClothDeliveryAddress == null) {
+//                    throw new ServiceException("未查询到配送信息");
+//                }
+//                orderClothDeliveryAddress.setThirdDeliveryOrderNo(orderNoUtils.getDeliveryOrderNo());
+//                orderClothDeliveryAddress.setDeliveryWay(ClothOrderDeliveryWay.thirdExpress.getCode());
+//                orderClothDeliveryAddress.setDeliveryId(orderClothThirdDeliverySendDTO.getDeliveryId());
+//                orderClothDeliveryAddress.setDeliveryName(orderClothThirdDeliverySendDTO.getDeliveryCompany());
+//                orderClothDeliveryAddress.setServiceType(orderClothThirdDeliverySendDTO.getServiceType());
+//                orderClothDeliveryAddress.setServiceName(orderClothThirdDeliverySendDTO.getServiceName());
+//                orderClothDeliveryAddressService.updateById(orderClothDeliveryAddress);
+//                if (!ClothTakeWay.DELIVERY.getCode().equals(orderCloth.getSendClothWay())) {
+//                    throw new ServiceException("该订单客户未选择送货上门,无法分配配送员");
+//                }
+//                //这里进行快递下单
+//                AppUserInfoVO appUserInfo = appUserService.getAppUserInfoById(orderCloth.getAppUserId());
+//                OrderThirdDeliveryAddDTO orderThirdDeliveryAddDTO = OrderThirdDeliveryAddDTO
+//                        .buildDeliveryOrderByClothOrder(orderCloth, orderClothDeliveryAddress, orderClothThirdDeliverySendDTO
+//                                , getDeliveryInfoByOrg(SecurityUtils.getLoginUser().getOrgId(), SecurityUtils.getLoginUser().getSourceType()), appUserInfo);
+//                WxMaExpressOrderInfoResult result = thirdDeliveryService.addDeliveryOrder(orderThirdDeliveryAddDTO);
+//                orderClothDeliveryAddress.setWaybillNo(result.getWaybillId());
+//                orderClothDeliveryAddressService.updateById(orderClothDeliveryAddress);
+//                orderClothService.update(new UpdateWrapper<OrderCloth>().lambda()
+//                        .eq(OrderCloth::getId, orderCloth.getId())
+//                        .set(OrderCloth::getOrderStatus, ClothOrderStatusType.SENDING.getCode()));
+//                return R.ok();
+//            }
+//            default: {
+//                throw new ServiceException("订单状态不正确,无法派单");
+//            }
+//        }
+        return R.ok("三方配送已弃用");
     }
 
     private DeliveryOrgInfoDTO getDeliveryInfoByOrg(Long orgId, String sourceType) {
@@ -290,49 +291,28 @@ public class OrderClothController extends BaseController {
 
         switch (EnumUtils.getEnumByType(orderCloth.getOrderStatus(), ClothOrderStatusType.class)) {
             case APPOINTMENT: {
-                OrderClothDeliveryAddress orderClothDeliveryAddress = orderClothDeliveryAddressService
-                        .getOne(new QueryWrapper<OrderClothDeliveryAddress>().lambda()
-                                .eq(OrderClothDeliveryAddress::getOrderNo, orderNo)
-                                .eq(OrderClothDeliveryAddress::getClothOrderType, ClothOrderDeliveryType.collectCloth.getCode()));
-                if (orderClothDeliveryAddress == null) {
-                    throw new ServiceException("未查询到配送信息");
-                }
-                orderClothDeliveryAddress.setThirdDeliveryOrderNo(orderNoUtils.getDeliveryOrderNo());
-                orderClothDeliveryAddress.setDeliveryWay(ClothOrderDeliveryWay.intracityExpress.getCode());
-                orderClothDeliveryAddressService.updateById(orderClothDeliveryAddress);
-                if (!ClothTakeWay.DELIVERY.getCode().equals(orderCloth.getTakeClothWay())) {
-                    throw new ServiceException("该订单客户未选择上门取衣,无法分配配送员");
-                }
-                sysStoreIntracityExpressService.updateStoreInfo(sysStore, orderClothDeliveryAddress);
-                AppUser appUser = appUserService.getOne(new QueryWrapper<AppUser>().lambda().eq(AppUser::getId, orderCloth.getAppUserId()));
-                IntracityExpressBaseResult result = sysStoreIntracityExpressService.addOrder(IntracityExpressAddOrderRequest.build(orderCloth, orderClothDeliveryAddress, sysStore, appUser.getWxOpenId()));
-                sysStoreIntracityExpressService.updateStoreInfo(sysStore);
-                orderClothService.update(new UpdateWrapper<OrderCloth>().lambda()
-                        .eq(OrderCloth::getId, orderCloth.getId())
-                        .set(OrderCloth::getOrderStatus, ClothOrderStatusType.WAITING_TO_DOOR.getCode()));
-                if (result.getErrcode() != 0) {
-                    throw new ServiceException("errorCode:" + result.getErrcode() + ";errorMsg:" + result.getErrmsg());
-                }
-                return R.ok(result);
+                // 预约待取,进行取件发单
+                throw new ServiceException("同城配送暂不支持上门取件");
             }
             case WAITING_TO_SEND: {
-                OrderClothDeliveryAddress orderClothDeliveryAddress = orderClothDeliveryAddressService
-                        .getOne(new QueryWrapper<OrderClothDeliveryAddress>().lambda()
-                                .eq(OrderClothDeliveryAddress::getOrderNo, orderNo)
-                                .eq(OrderClothDeliveryAddress::getClothOrderType, ClothOrderDeliveryType.takeCloth.getCode()));
-                if (orderClothDeliveryAddress == null) {
+                // 待送衣-送衣发单
+                OrderDelivery orderDelivery = orderDeliveryService
+                        .getOne(new QueryWrapper<OrderDelivery>().lambda()
+                                .eq(OrderDelivery::getOrderSn, orderNo)
+                                .eq(OrderDelivery::getClothOrderType, ClothOrderDeliveryType.takeCloth.getCode()));
+                if (orderDelivery == null) {
                     throw new ServiceException("未查询到配送信息");
                 }
-                orderClothDeliveryAddress.setThirdDeliveryOrderNo(orderNoUtils.getDeliveryOrderNo());
-                orderClothDeliveryAddress.setDeliveryWay(ClothOrderDeliveryWay.intracityExpress.getCode());
-                orderClothDeliveryAddressService.updateById(orderClothDeliveryAddress);
+                orderDelivery.setDeliverySn(orderNoUtils.getDeliveryOrderNo());
+                orderDelivery.setDeliveryWay(ClothOrderDeliveryWay.intracityExpress.getCode());
+                orderDeliveryService.updateById(orderDelivery);
                 if (!ClothTakeWay.DELIVERY.getCode().equals(orderCloth.getSendClothWay())) {
                     throw new ServiceException("该订单客户未选择送货上门,无法分配配送员");
                 }
                 AppUser appUser = appUserService.getOne(new QueryWrapper<AppUser>().lambda().eq(AppUser::getId, orderCloth.getAppUserId()));
                 IntracityExpressBaseResult result = sysStoreIntracityExpressService
                         .addOrder(IntracityExpressAddOrderRequest
-                                .build(orderCloth, orderClothDeliveryAddress, sysStore, appUser.getWxOpenId()));
+                                .build(orderCloth, orderDelivery, sysStore, appUser.getWxOpenId()));
                 orderClothService.update(new UpdateWrapper<OrderCloth>().lambda()
                         .eq(OrderCloth::getId, orderCloth.getId())
                         .set(OrderCloth::getOrderStatus, ClothOrderStatusType.SENDING.getCode()));
@@ -447,16 +427,16 @@ public class OrderClothController extends BaseController {
 
         if (TakeOrSendClothWay.DELIVERY.getCode().equals(orderCloth.getTakeClothWay())
                 || TakeOrSendClothWay.DELIVERY.getCode().equals(orderCloth.getSendClothWay())) {
-            Map<String, OrderClothDeliveryAddress> orderClothDeliveryAddressMap = orderClothDeliveryAddressService.list(
-                            new QueryWrapper<OrderClothDeliveryAddress>().lambda()
-                                    .eq(OrderClothDeliveryAddress::getOrderId, orderCloth.getId()))
-                    .stream().collect(Collectors.toMap(OrderClothDeliveryAddress::getClothOrderType
-                            , OrderClothDeliveryAddress -> OrderClothDeliveryAddress));
+            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(orderClothDeliveryAddressMap.get(ClothOrderDeliveryType.collectCloth.getCode()));
+                orderClothVO.setCollectClothDeliverInfo(orderDeliveryMap.get(ClothOrderDeliveryType.collectCloth.getCode()));
             }
             if (TakeOrSendClothWay.DELIVERY.getCode().equals(orderCloth.getSendClothWay())) {
-                orderClothVO.setCollectClothDeliverInfo(orderClothDeliveryAddressMap.get(ClothOrderDeliveryType.takeCloth.getCode()));
+                orderClothVO.setCollectClothDeliverInfo(orderDeliveryMap.get(ClothOrderDeliveryType.takeCloth.getCode()));
             }
         }
         return R.ok(orderClothVO);

+ 8 - 8
yiqi-admin/src/main/java/com/yiqi/admin/controller/order/ThirdDeliveryController.java

@@ -3,13 +3,13 @@ package com.yiqi.admin.controller.order;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.yiqi.common.constant.UrlConstants;
 import com.yiqi.common.core.domain.R;
-import com.yiqi.order.domain.OrderClothDeliveryAddress;
+import com.yiqi.order.domain.OrderDelivery;
 import com.yiqi.order.domain.dto.OrderThirdDeliveryCancelDTO;
 import com.yiqi.order.domain.dto.OrderThirdDeliveryPathDTO;
 import com.yiqi.order.domain.dto.OrderThirdDeliveryTestUpdateStatusDTO;
 import com.yiqi.order.domain.vo.ExpressDeliveryVO;
-import com.yiqi.order.service.IOrderClothDeliveryAddressService;
 import com.yiqi.order.service.IOrderClothService;
+import com.yiqi.order.service.IOrderDeliveryService;
 import com.yiqi.order.service.IThirdDeliveryService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -37,7 +37,7 @@ public class ThirdDeliveryController {
 
     @Lazy
     @Autowired
-    private IOrderClothDeliveryAddressService orderClothDeliveryAddressService;
+    private IOrderDeliveryService orderDeliveryService;
 
     @ApiOperation("获取所有可支持的快递公司")
     @GetMapping(value = "all")
@@ -54,12 +54,12 @@ public class ThirdDeliveryController {
     @ApiOperation("根据洗衣订单号获取运单的运行轨迹")
     @GetMapping(value = "getPathByClothOrderNo")
     public R getPathByClothOrderNo(String orderNo,String deliveryType) throws Exception{
-        OrderClothDeliveryAddress orderClothDeliveryAddress = orderClothDeliveryAddressService.getOne(new QueryWrapper<OrderClothDeliveryAddress>().lambda()
-                .eq(OrderClothDeliveryAddress::getOrderNo,orderNo)
-                .eq(OrderClothDeliveryAddress::getClothOrderType,deliveryType));
+        OrderDelivery orderDelivery = orderDeliveryService.getOne(new QueryWrapper<OrderDelivery>().lambda()
+                .eq(OrderDelivery::getOrderSn,orderNo)
+                .eq(OrderDelivery::getClothOrderType,deliveryType));
         OrderThirdDeliveryPathDTO orderThirdDeliveryPathDTO = new OrderThirdDeliveryPathDTO();
-        orderThirdDeliveryPathDTO.setDeliveryId(orderClothDeliveryAddress.getDeliveryId());
-        orderThirdDeliveryPathDTO.setWaybillId(orderClothDeliveryAddress.getWaybillNo());
+        orderThirdDeliveryPathDTO.setDeliveryId(orderDelivery.getServiceTransId());
+        orderThirdDeliveryPathDTO.setWaybillId(orderDelivery.getTransOrderId());
         return R.ok(thirdDeliveryService.getDeliveryPath(orderThirdDeliveryPathDTO));
     }
 

+ 135 - 138
yiqi-api/src/main/java/com/yiqi/api/controller/order/WeAppOrderClothController.java

@@ -18,19 +18,15 @@ import com.yiqi.common.core.domain.R;
 import com.yiqi.common.enums.*;
 import com.yiqi.common.utils.*;
 import com.yiqi.order.domain.OrderCloth;
-import com.yiqi.order.domain.OrderClothDeliveryAddress;
 import com.yiqi.order.domain.OrderClothItem;
+import com.yiqi.order.domain.OrderDelivery;
 import com.yiqi.order.domain.dto.OrderClothAppointmentDTO;
-import com.yiqi.order.domain.dto.PayOrderAppDTO;
 import com.yiqi.order.domain.dto.weapp.OrderClothAppQueryDTO;
 import com.yiqi.order.domain.dto.weapp.UpdateOrderClothTakeClothWayDTO;
 import com.yiqi.order.domain.dto.weapp.WeAppOrderClothAppointmentQueryDTO;
 import com.yiqi.order.domain.vo.OrderClothVO;
-import com.yiqi.order.domain.vo.weapp.AppPayRespVO;
-import com.yiqi.order.domain.vo.weapp.UpdateOrderClothTakeClothWayRespVO;
 import com.yiqi.order.domain.vo.weapp.WeAppOrderClothAppointmentVO;
 import com.yiqi.order.service.*;
-import com.yiqi.recharge.domain.dto.ConsumeOrderDTO;
 import com.yiqi.system.domain.SysOrg;
 import com.yiqi.system.domain.SysStore;
 import com.yiqi.system.service.ISysConfigService;
@@ -74,7 +70,7 @@ public class WeAppOrderClothController {
     @Autowired
     private IOrderClothItemFlowRecordService orderClothItemFlowRecordService;
     @Autowired
-    private IOrderClothDeliveryAddressService orderClothDeliveryAddressService;
+    private IOrderDeliveryService orderDeliveryService;
     @Autowired
     private OrderNoUtils orderNoUtils;
     @Autowired
@@ -123,15 +119,15 @@ public class WeAppOrderClothController {
             return R.ok(new ArrayList<>());
         }
 
-        List<OrderClothDeliveryAddress> list = orderClothDeliveryAddressService.list(new QueryWrapper<OrderClothDeliveryAddress>().lambda()
-                .in(OrderClothDeliveryAddress::getOrderId
-                        ,orderCloths.stream().map(OrderCloth::getId).collect(Collectors.toSet())));
-        Map<Long,OrderClothDeliveryAddress> collectAddressMap = list.stream().filter(orderClothDeliveryAddress -> ClothOrderDeliveryType.collectCloth.getCode()
-                .equals(orderClothDeliveryAddress.getClothOrderType()))
-                .collect(Collectors.toMap(OrderClothDeliveryAddress::getOrderId,OrderClothDeliveryAddress -> OrderClothDeliveryAddress));
-        Map<Long,OrderClothDeliveryAddress> takeAddressMap = list.stream().filter(orderClothDeliveryAddress -> ClothOrderDeliveryType.takeCloth.getCode()
-                .equals(orderClothDeliveryAddress.getClothOrderType()))
-                .collect(Collectors.toMap(OrderClothDeliveryAddress::getOrderId,OrderClothDeliveryAddress -> OrderClothDeliveryAddress));
+        List<OrderDelivery> list = orderDeliveryService.list(new QueryWrapper<OrderDelivery>().lambda()
+                .in(OrderDelivery::getOrderSn
+                        ,orderCloths.stream().map(OrderCloth::getOrderNo).collect(Collectors.toSet())));
+        Map<String,OrderDelivery> collectAddressMap = list.stream().filter(orderDelivery -> ClothOrderDeliveryType.collectCloth.getCode()
+                .equals(orderDelivery.getClothOrderType()))
+                .collect(Collectors.toMap(OrderDelivery::getOrderSn,OrderDelivery -> OrderDelivery));
+        Map<String,OrderDelivery> takeAddressMap = list.stream().filter(orderDelivery -> ClothOrderDeliveryType.takeCloth.getCode()
+                .equals(orderDelivery.getClothOrderType()))
+                .collect(Collectors.toMap(OrderDelivery::getOrderSn,OrderDelivery -> OrderDelivery));
         Map<Long,SysOrg> storeOrgMap = new HashMap<>();
         Map<Long,SysOrg> factoryOrgMap = new HashMap<>();
         if(orderCloths.stream().filter(orderCloth -> SourceType.STORE.getCode().equals(orderCloth.getSourceType())).collect(Collectors.toList()).size() > 0){
@@ -190,15 +186,16 @@ public class WeAppOrderClothController {
                 || ClothOrderType.thirdPart.getCode().equals(orderCloth.getOrderType())){
         }
 
+        // 获取配送费 todo
+
         orderClothService.save(orderCloth);
-        OrderClothDeliveryAddress orderClothDeliveryAddress = new OrderClothDeliveryAddress(appUserAddress);
-        orderClothDeliveryAddress.setDeliveryOrderNo(orderNoUtils.getDeliveryOrderNo());
-        orderClothDeliveryAddress.setOrderId(orderCloth.getId());
-        orderClothDeliveryAddress.setOrderNo(orderCloth.getOrderNo());
-        orderClothDeliveryAddress.setClothOrderType(ClothOrderDeliveryType.collectCloth.getCode());
-        orderClothDeliveryAddress.setPayStatus(PayStatus.WAITING_TO_PAY.getCode());
-        orderClothDeliveryAddress.setCreateTime(DateUtils.getNowDate());
-        orderClothDeliveryAddressService.save(orderClothDeliveryAddress);
+        // 配送记录保存
+        OrderDelivery orderDelivery = new OrderDelivery(appUserAddress);
+        orderDelivery.setDeliverySn(orderNoUtils.getDeliveryOrderNo());
+        orderDelivery.setOrderSn(orderCloth.getOrderNo());
+        orderDelivery.setClothOrderType(ClothOrderDeliveryType.collectCloth.getCode());
+        orderDelivery.setCreateTime(DateUtils.getNowDate());
+        orderDeliveryService.save(orderDelivery);
         return R.ok();
     }
 
@@ -339,16 +336,16 @@ public class WeAppOrderClothController {
 
         if(TakeOrSendClothWay.DELIVERY.getCode().equals(orderCloth.getTakeClothWay())
                 || TakeOrSendClothWay.DELIVERY.getCode().equals(orderCloth.getSendClothWay())){
-            Map<String,OrderClothDeliveryAddress> orderClothDeliveryAddressMap = orderClothDeliveryAddressService.list(
-                    new QueryWrapper<OrderClothDeliveryAddress>().lambda()
-                            .eq(OrderClothDeliveryAddress::getOrderId,orderCloth.getId()))
-                    .stream().collect(Collectors.toMap(OrderClothDeliveryAddress::getClothOrderType
-                            ,OrderClothDeliveryAddress -> OrderClothDeliveryAddress));
+            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(orderClothDeliveryAddressMap.get(ClothOrderDeliveryType.collectCloth.getCode()));
+                orderClothVO.setCollectClothDeliverInfo(orderDeliveryMap.get(ClothOrderDeliveryType.collectCloth.getCode()));
             }
             if(TakeOrSendClothWay.DELIVERY.getCode().equals(orderCloth.getSendClothWay())){
-                orderClothVO.setTakeClothDeliverInfo(orderClothDeliveryAddressMap.get(ClothOrderDeliveryType.takeCloth.getCode()));
+                orderClothVO.setTakeClothDeliverInfo(orderDeliveryMap.get(ClothOrderDeliveryType.takeCloth.getCode()));
             }
         }
         return R.ok(orderClothVO);
@@ -357,114 +354,114 @@ public class WeAppOrderClothController {
     @Transactional(rollbackFor = Exception.class)
     @ApiOperation("洗衣订单配送订单下单")
     @PostMapping(value = "addSendClothDeliveryOrder")
-    public R<UpdateOrderClothTakeClothWayRespVO> addSendClothDeliveryOrder(@RequestBody @Valid UpdateOrderClothTakeClothWayDTO updateOrderClothTakeClothWayDTO) throws Exception{
-        if(updateOrderClothTakeClothWayDTO.getAddressId() == null){
-            throw new ServiceException("请先选择地址");
-        }
-
-        OrderCloth orderCloth = orderClothService.getOne(new QueryWrapper<OrderCloth>().lambda()
-                .eq(OrderCloth::getId,updateOrderClothTakeClothWayDTO.getOrderId())
-                .eq(OrderCloth::getAppUserId,AuthHolder.userId()));
-        if(orderCloth == null){
-            throw new ServiceException("未查询到订单");
-        }
-        if(!orderCloth.getOrderStatus().equals(ClothOrderStatusType.HAS_WASH.getCode())){
-            throw new ServiceException("订单状态不正确,无法设置配送方式");
-        }
-        if(StringUtils.isNotEmpty(orderCloth.getSendClothWay())){
-            throw new ServiceException("您已经设置好配送方式了");
-        }
-        orderCloth.setSendClothWay(ClothTakeWay.DELIVERY.getCode());
-        if(ClothTakeWay.TOSTORE.getCode().equals(orderCloth.getSendClothWay())){//到店自取,不需要管配送费
-            orderClothService.update(new UpdateWrapper<OrderCloth>().lambda()
-                    .set(OrderCloth::getSendClothWay,orderCloth.getSendClothWay())
-                    .eq(OrderCloth::getId,updateOrderClothTakeClothWayDTO.getOrderId()));
-            UpdateOrderClothTakeClothWayRespVO updateOrderClothTakeClothWayRespVO = new UpdateOrderClothTakeClothWayRespVO();
-            updateOrderClothTakeClothWayRespVO.setIsNeedPay(SysBoolType.NO.getCode());
-            return R.ok(updateOrderClothTakeClothWayRespVO);
-        }
-
-        int freeDeliveryNum = 0;
-        if(orderCloth.getOrderClothPrice().doubleValue() >= 100){
-            freeDeliveryNum++;
-        }
-        if(orderCloth.getOrderClothPrice().doubleValue() >= 200){
-            freeDeliveryNum++;
-        }
-        if(ClothTakeWay.DELIVERY.getCode().equals(orderCloth.getTakeClothWay())){
-            freeDeliveryNum--;
-        }
-        /**
-         * 1.添加配送信息
-         * 2.此处需要知道配送费是否免费
-         */
-        AppUserAddress appUserAddress = appUserAddressService.getOne(new QueryWrapper<AppUserAddress>().lambda()
-                .eq(AppUserAddress::getId,updateOrderClothTakeClothWayDTO.getAddressId()));
-        OrderClothDeliveryAddress orderClothDeliveryAddress = orderClothDeliveryAddressService
-                .getOne(new QueryWrapper<OrderClothDeliveryAddress>().lambda()
-                        .eq(OrderClothDeliveryAddress::getOrderId,orderCloth.getId())
-                        .eq(OrderClothDeliveryAddress::getClothOrderType,ClothOrderDeliveryType.takeCloth.getCode()));
-        OrderClothDeliveryAddress newAddress = new OrderClothDeliveryAddress(appUserAddress);
-        if(orderClothDeliveryAddress == null){
-            orderClothDeliveryAddress = newAddress;
-        }else{
-            BeanUtils.copyProperties(newAddress,orderClothDeliveryAddress,"id");
-        }
-        orderClothDeliveryAddress.setOrderId(orderCloth.getId());
-        orderClothDeliveryAddress.setOrderNo(orderCloth.getOrderNo());
-        orderClothDeliveryAddress.setClothOrderType(ClothOrderDeliveryType.takeCloth.getCode());
-        orderClothDeliveryAddress.setDeliveryOrderNo(orderNoUtils.getDeliveryOrderNo());
-
-        //判断是否需要配送,不需要配送费
-        if(freeDeliveryNum > 0){
-            orderClothDeliveryAddress.setIsNeedPay(SysBoolType.NO.getCode());
-            orderClothDeliveryAddress.setDeliveryAmount(BigDecimal.ZERO);
-            orderClothDeliveryAddress.setPayType(PayType.CASH.getCode());
-            //不需要配送直接修改订单状态为待配送状态
-            orderClothService.update(new UpdateWrapper<OrderCloth>().lambda()
-                    .set(OrderCloth::getSendClothWay,ClothTakeWay.DELIVERY.getCode())
-                    .set(OrderCloth::getOrderStatus,ClothOrderStatusType.WAITING_TO_SEND.getCode())
-                    .eq(OrderCloth::getId,updateOrderClothTakeClothWayDTO.getOrderId()));
-        }else{
-            orderClothDeliveryAddress.setIsNeedPay(SysBoolType.YES.getCode());
-            orderClothDeliveryAddress.setPayStatus(PayStatus.WAITING_TO_PAY.getCode());
-            String deliveryPrice = sysConfigService.selectConfigByKey(SysConfigKey.OrderClothDeliveryPrice.getCode());
-            if(StringUtils.isEmpty(deliveryPrice)){
-                throw new ServiceException("系统未设置配送价格,请联系客服进行处理");
-            }
-            orderClothDeliveryAddress.setDeliveryAmount(new BigDecimal(deliveryPrice));
-            if(StringUtils.isEmpty(updateOrderClothTakeClothWayDTO.getPayType())){
-                throw new ServiceException("请先选择支付方式");
-            }
-            orderClothDeliveryAddress.setPayType(updateOrderClothTakeClothWayDTO.getPayType());
-            switch (EnumUtils.getEnumByType(orderClothDeliveryAddress.getPayType(),PayType.class)){
-                case ALIPAY:
-                case WECHAT:
-                {
-                    AppPayRespVO appPayRespVO = payService.appPay(
-                            PayOrderAppDTO.buildDeliveryOrderPayData(orderClothDeliveryAddress, updateOrderClothTakeClothWayDTO.getPlatform()));
-                    UpdateOrderClothTakeClothWayRespVO updateOrderClothTakeClothWayRespVO = new UpdateOrderClothTakeClothWayRespVO();
-                    updateOrderClothTakeClothWayRespVO.setOrderStr(appPayRespVO.getOrderStr());
-                    updateOrderClothTakeClothWayRespVO.setIsNeedPay(orderClothDeliveryAddress.getIsNeedPay());
-                    updateOrderClothTakeClothWayRespVO.setDeliveryOrderNo(orderClothDeliveryAddress.getDeliveryOrderNo());
-                    //保存配送订单
-                    orderClothDeliveryAddressService.saveOrUpdate(orderClothDeliveryAddress);
-                    return R.ok(updateOrderClothTakeClothWayRespVO);
-                }
-                case BALANCE:
-                {
-                    //余额扣款,扣减余额
-                    appUserBillMstrService.consumeRecord(ConsumeOrderDTO.buildOrderDeliveryData(orderClothDeliveryAddress,orderCloth.getOrgId(),orderCloth.getSourceType()));
-                    break;
-                }
-            }
-        }
-        //保存配送订单
-        orderClothDeliveryAddressService.saveOrUpdate(orderClothDeliveryAddress);
-        UpdateOrderClothTakeClothWayRespVO updateOrderClothTakeClothWayRespVO = new UpdateOrderClothTakeClothWayRespVO();
-        updateOrderClothTakeClothWayRespVO.setIsNeedPay(orderClothDeliveryAddress.getIsNeedPay());
-        updateOrderClothTakeClothWayRespVO.setDeliveryOrderNo(orderClothDeliveryAddress.getDeliveryOrderNo());
-        return R.ok(updateOrderClothTakeClothWayRespVO);
+    public R addSendClothDeliveryOrder(@RequestBody @Valid UpdateOrderClothTakeClothWayDTO updateOrderClothTakeClothWayDTO) throws Exception{
+//        if(updateOrderClothTakeClothWayDTO.getAddressId() == null){
+//            throw new ServiceException("请先选择地址");
+//        }
+//
+//        OrderCloth orderCloth = orderClothService.getOne(new QueryWrapper<OrderCloth>().lambda()
+//                .eq(OrderCloth::getId,updateOrderClothTakeClothWayDTO.getOrderId())
+//                .eq(OrderCloth::getAppUserId,AuthHolder.userId()));
+//        if(orderCloth == null){
+//            throw new ServiceException("未查询到订单");
+//        }
+//        if(!orderCloth.getOrderStatus().equals(ClothOrderStatusType.HAS_WASH.getCode())){
+//            throw new ServiceException("订单状态不正确,无法设置配送方式");
+//        }
+//        if(StringUtils.isNotEmpty(orderCloth.getSendClothWay())){
+//            throw new ServiceException("您已经设置好配送方式了");
+//        }
+//        orderCloth.setSendClothWay(ClothTakeWay.DELIVERY.getCode());
+//        if(ClothTakeWay.TOSTORE.getCode().equals(orderCloth.getSendClothWay())){//到店自取,不需要管配送费
+//            orderClothService.update(new UpdateWrapper<OrderCloth>().lambda()
+//                    .set(OrderCloth::getSendClothWay,orderCloth.getSendClothWay())
+//                    .eq(OrderCloth::getId,updateOrderClothTakeClothWayDTO.getOrderId()));
+//            UpdateOrderClothTakeClothWayRespVO updateOrderClothTakeClothWayRespVO = new UpdateOrderClothTakeClothWayRespVO();
+//            updateOrderClothTakeClothWayRespVO.setIsNeedPay(SysBoolType.NO.getCode());
+//            return R.ok(updateOrderClothTakeClothWayRespVO);
+//        }
+//
+//        int freeDeliveryNum = 0;
+//        if(orderCloth.getOrderClothPrice().doubleValue() >= 100){
+//            freeDeliveryNum++;
+//        }
+//        if(orderCloth.getOrderClothPrice().doubleValue() >= 200){
+//            freeDeliveryNum++;
+//        }
+//        if(ClothTakeWay.DELIVERY.getCode().equals(orderCloth.getTakeClothWay())){
+//            freeDeliveryNum--;
+//        }
+//        /**
+//         * 1.添加配送信息
+//         * 2.此处需要知道配送费是否免费
+//         */
+//        AppUserAddress appUserAddress = appUserAddressService.getOne(new QueryWrapper<AppUserAddress>().lambda()
+//                .eq(AppUserAddress::getId,updateOrderClothTakeClothWayDTO.getAddressId()));
+//        OrderDelivery orderDelivery = orderDeliveryService
+//                .getOne(new QueryWrapper<OrderDelivery>().lambda()
+//                        .eq(OrderDelivery::getOrderSn,orderCloth.getOrderNo())
+//                        .eq(OrderDelivery::getClothOrderType,ClothOrderDeliveryType.takeCloth.getCode()));
+//        OrderDelivery newAddress = new OrderDelivery(appUserAddress);
+//        if(orderDelivery == null){
+//            orderDelivery = newAddress;
+//        }else{
+//            BeanUtils.copyProperties(newAddress,orderDelivery,"id");
+//        }
+//        orderDelivery.setOrderSn(orderCloth.getOrderNo());
+//        orderDelivery.setClothOrderType(ClothOrderDeliveryType.takeCloth.getCode());
+//        orderDelivery.setDeliverySn(orderNoUtils.getDeliveryOrderNo());
+//
+//        //判断是否需要配送,不需要配送费
+//        if(freeDeliveryNum > 0){
+//            orderDelivery.setIsNeedPay(SysBoolType.NO.getCode());
+//            orderDelivery.setDeliveryAmount(BigDecimal.ZERO);
+//            orderDelivery.setPayType(PayType.CASH.getCode());
+//            //不需要配送直接修改订单状态为待配送状态
+//            orderClothService.update(new UpdateWrapper<OrderCloth>().lambda()
+//                    .set(OrderCloth::getSendClothWay,ClothTakeWay.DELIVERY.getCode())
+//                    .set(OrderCloth::getOrderStatus,ClothOrderStatusType.WAITING_TO_SEND.getCode())
+//                    .eq(OrderCloth::getId,updateOrderClothTakeClothWayDTO.getOrderId()));
+//        }else{
+//            orderDelivery.setIsNeedPay(SysBoolType.YES.getCode());
+//            orderDelivery.setPayStatus(PayStatus.WAITING_TO_PAY.getCode());
+//            String deliveryPrice = sysConfigService.selectConfigByKey(SysConfigKey.OrderClothDeliveryPrice.getCode());
+//            if(StringUtils.isEmpty(deliveryPrice)){
+//                throw new ServiceException("系统未设置配送价格,请联系客服进行处理");
+//            }
+//            orderDelivery.setDeliveryAmount(new BigDecimal(deliveryPrice));
+//            if(StringUtils.isEmpty(updateOrderClothTakeClothWayDTO.getPayType())){
+//                throw new ServiceException("请先选择支付方式");
+//            }
+//            orderDelivery.setPayType(updateOrderClothTakeClothWayDTO.getPayType());
+//            switch (EnumUtils.getEnumByType(orderClothDeliveryAddress.getPayType(),PayType.class)){
+//                case ALIPAY:
+//                case WECHAT:
+//                {
+//                    AppPayRespVO appPayRespVO = payService.appPay(
+//                            PayOrderAppDTO.buildDeliveryOrderPayData(orderDelivery, updateOrderClothTakeClothWayDTO.getPlatform()));
+//                    UpdateOrderClothTakeClothWayRespVO updateOrderClothTakeClothWayRespVO = new UpdateOrderClothTakeClothWayRespVO();
+//                    updateOrderClothTakeClothWayRespVO.setOrderStr(appPayRespVO.getOrderStr());
+//                    updateOrderClothTakeClothWayRespVO.setIsNeedPay(orderDelivery.getIsNeedPay());
+//                    updateOrderClothTakeClothWayRespVO.setDeliveryOrderNo(orderDelivery.getDeliveryOrderNo());
+//                    //保存配送订单
+//                    orderDeliveryService.saveOrUpdate(orderDelivery);
+//                    return R.ok(updateOrderClothTakeClothWayRespVO);
+//                }
+//                case BALANCE:
+//                {
+//                    //余额扣款,扣减余额
+//                    appUserBillMstrService.consumeRecord(ConsumeOrderDTO.buildOrderDeliveryData(orderDelivery,orderCloth.getOrgId(),orderCloth.getSourceType()));
+//                    break;
+//                }
+//            }
+//        }
+//        //保存配送订单
+//        orderDeliveryService.saveOrUpdate(orderDelivery);
+//        UpdateOrderClothTakeClothWayRespVO updateOrderClothTakeClothWayRespVO = new UpdateOrderClothTakeClothWayRespVO();
+//        updateOrderClothTakeClothWayRespVO.setIsNeedPay(orderDelivery.getIsNeedPay());
+//        updateOrderClothTakeClothWayRespVO.setDeliveryOrderNo(orderDelivery.getDeliveryOrderNo());
+//        return R.ok(updateOrderClothTakeClothWayRespVO);
+        return R.ok("配送订单单独支付已弃用");
     }
 
     @Transactional(rollbackFor = Exception.class)

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

@@ -17,15 +17,15 @@ import com.yiqi.common.enums.SourceType;
 import com.yiqi.common.exception.ServiceException;
 import com.yiqi.common.utils.StringUtils;
 import com.yiqi.order.domain.OrderCloth;
-import com.yiqi.order.domain.OrderClothDeliveryAddress;
 import com.yiqi.order.domain.OrderClothStatusRecord;
+import com.yiqi.order.domain.OrderDelivery;
 import com.yiqi.order.domain.dto.weapp.AppOrderClothDeliveryChangeStatusDTO;
 import com.yiqi.order.domain.dto.weapp.AppOrderClothDeliveryManQueryDTO;
 import com.yiqi.order.domain.vo.OrderClothVO;
 import com.yiqi.order.domain.vo.weapp.WeAppOrderClothAppointmentVO;
-import com.yiqi.order.service.IOrderClothDeliveryAddressService;
 import com.yiqi.order.service.IOrderClothService;
 import com.yiqi.order.service.IOrderClothStatusRecordService;
+import com.yiqi.order.service.IOrderDeliveryService;
 import com.yiqi.system.domain.SysOrg;
 import com.yiqi.system.service.ISysOrgService;
 import io.swagger.annotations.Api;
@@ -53,7 +53,7 @@ import java.util.stream.Collectors;
 public class WeAppOrderClothDeliveryManController {
 
     @Autowired
-    private IOrderClothDeliveryAddressService orderClothDeliveryAddressService;
+    private IOrderDeliveryService orderDeliveryService;
 
     @Autowired
     private ISysOrgService sysOrgService;
@@ -99,15 +99,15 @@ public class WeAppOrderClothDeliveryManController {
             return R.ok(new ArrayList<>());
         }
 
-        List<OrderClothDeliveryAddress> list = orderClothDeliveryAddressService.list(new QueryWrapper<OrderClothDeliveryAddress>().lambda()
-                .in(OrderClothDeliveryAddress::getOrderId
-                        ,orderCloths.stream().map(OrderCloth::getId).collect(Collectors.toSet())));
-        Map<Long,OrderClothDeliveryAddress> collectAddressMap = list.stream().filter(orderClothDeliveryAddress -> ClothOrderDeliveryType.collectCloth.getCode()
-                .equals(orderClothDeliveryAddress.getClothOrderType()))
-                .collect(Collectors.toMap(OrderClothDeliveryAddress::getOrderId,OrderClothDeliveryAddress -> OrderClothDeliveryAddress));
-        Map<Long,OrderClothDeliveryAddress> takeAddressMap = list.stream().filter(orderClothDeliveryAddress -> ClothOrderDeliveryType.takeCloth.getCode()
-                .equals(orderClothDeliveryAddress.getClothOrderType()))
-                .collect(Collectors.toMap(OrderClothDeliveryAddress::getOrderId,OrderClothDeliveryAddress -> OrderClothDeliveryAddress));
+        List<OrderDelivery> list = orderDeliveryService.list(new QueryWrapper<OrderDelivery>().lambda()
+                .in(OrderDelivery::getOrderSn
+                        ,orderCloths.stream().map(OrderCloth::getOrderNo).collect(Collectors.toSet())));
+        Map<String,OrderDelivery> collectAddressMap = list.stream().filter(orderDelivery -> ClothOrderDeliveryType.collectCloth.getCode()
+                .equals(orderDelivery.getClothOrderType()))
+                .collect(Collectors.toMap(OrderDelivery::getOrderSn,OrderDelivery -> OrderDelivery));
+        Map<String,OrderDelivery> takeAddressMap = list.stream().filter(orderDelivery -> ClothOrderDeliveryType.takeCloth.getCode()
+                .equals(orderDelivery.getClothOrderType()))
+                .collect(Collectors.toMap(OrderDelivery::getOrderSn,OrderDelivery -> OrderDelivery));
         Map<Long, SysOrg> storeOrgMap = new HashMap<>();
         Map<Long,SysOrg> factoryOrgMap = new HashMap<>();
         if(orderCloths.stream().filter(orderCloth -> SourceType.STORE.getCode().equals(orderCloth.getSourceType())).collect(Collectors.toList()).size() > 0){
@@ -124,8 +124,8 @@ public class WeAppOrderClothDeliveryManController {
         for (OrderCloth orderCloth : orderCloths) {
             OrderClothVO orderClothVO = new OrderClothVO();
             BeanUtils.copyProperties(orderCloth,orderClothVO);
-            orderClothVO.setCollectClothDeliverInfo(collectAddressMap.get(orderCloth.getId()));
-            orderClothVO.setTakeClothDeliverInfo(takeAddressMap.get(orderCloth.getId()));
+            orderClothVO.setCollectClothDeliverInfo(collectAddressMap.get(orderCloth.getOrderNo()));
+            orderClothVO.setTakeClothDeliverInfo(takeAddressMap.get(orderCloth.getOrderNo()));
             if(SourceType.FACTORY.getCode().equals(orderCloth.getSourceType())){
                 orderClothVO.setSysOrg(factoryOrgMap.get(orderCloth.getOrgId()));
             }else if(SourceType.STORE.getCode().equals(orderCloth.getSourceType())){

+ 11 - 22
yiqi-common/src/main/java/com/yiqi/core/domain/dto/wx/IntracityExpressAddOrderRequest.java

@@ -7,9 +7,10 @@ import com.yiqi.common.constant.UrlConstants;
 import com.yiqi.common.enums.ClothOrderDeliveryType;
 import com.yiqi.common.enums.ClothOrderStatusType;
 import com.yiqi.common.enums.SystemEnv;
+import com.yiqi.common.exception.ServiceException;
 import com.yiqi.core.domain.vo.wx.IntracityExpressPreAddOrderResult;
 import com.yiqi.order.domain.OrderCloth;
-import com.yiqi.order.domain.OrderClothDeliveryAddress;
+import com.yiqi.order.domain.OrderDelivery;
 import com.yiqi.system.domain.SysStore;
 import io.swagger.annotations.ApiModelProperty;
 import io.swagger.models.auth.In;
@@ -123,13 +124,13 @@ public class IntracityExpressAddOrderRequest {
         }
     }
 
-    public static IntracityExpressAddOrderRequest build(OrderCloth orderCloth, OrderClothDeliveryAddress orderClothDeliveryAddress, SysStore sysStore, String user_openid) {
+    public static IntracityExpressAddOrderRequest build(OrderCloth orderCloth, OrderDelivery orderDelivery, SysStore sysStore, String user_openid) {
         IntracityExpressAddOrderRequest request = new IntracityExpressAddOrderRequest();
-        request.setStore_order_id(orderClothDeliveryAddress.getThirdDeliveryOrderNo());
+        request.setStore_order_id(orderDelivery.getDeliverySn());
         CargoInfo cargoInfo = new CargoInfo();
         cargoInfo.setCargo_name("服装");
 
-        if (orderClothDeliveryAddress.getClothOrderType().equals(ClothOrderDeliveryType.collectCloth.getCode())) {
+        if (orderDelivery.getClothOrderType().equals(ClothOrderDeliveryType.collectCloth.getCode())) {
             cargoInfo.setCargo_num(orderCloth.getAppointmentCount());
             cargoInfo.setCargo_weight(orderCloth.getAppointmentCount() / 5 + 1);
             cargoInfo.getItem_list().add(new ItemDetail("待洗衣物", sysStore.getCompanyPic(), orderCloth.getAppointmentCount()));
@@ -147,32 +148,20 @@ public class IntracityExpressAddOrderRequest {
         request.setUse_sandbox(SystemEnvConfig.env.equals(SystemEnv.PROD.getCode()) ? 0 : 1);
         request.setUser_openid(user_openid);
         if (orderCloth.getOrderStatus().equals(ClothOrderStatusType.APPOINTMENT.getCode())) {
-            if (SystemEnvConfig.env.equals(SystemEnv.PROD.getCode())) {
-                request.setUser_name(sysStore.getContactName());
-                request.setUser_phone(sysStore.getContactPhone());
-                request.setUser_address(sysStore.getAddress()
-                        + sysStore.getAddressDetail());
-            } else {
-                request.setUser_name("顺丰同城");
-                request.setUser_phone("13881979410");
-                request.setUser_address("北京市海淀区学清嘉创大厦A座15层");
-            }
-            request.setUser_lat(sysStore.getLatitude().doubleValue());
-            request.setUser_lng(sysStore.getLongitude().doubleValue());
+            throw new ServiceException("同城配送暂不支持上门取件");
         } else {
             if (SystemEnvConfig.env.equals(SystemEnv.PROD.getCode())) {
-                request.setUser_name(orderClothDeliveryAddress.getContactName());
-                request.setUser_phone(orderClothDeliveryAddress.getContactPhone());
-                request.setUser_address(orderClothDeliveryAddress.getAddress()
-                        + orderClothDeliveryAddress.getAddressDetail());
+                request.setUser_name(orderDelivery.getUserName());
+                request.setUser_phone(orderDelivery.getUserPhone());
+                request.setUser_address(orderDelivery.getUserAddress());
             } else {
                 request.setUser_name("顺丰同城");
                 request.setUser_phone("13881979410");
                 request.setUser_address("北京市海淀区学清嘉创大厦A座15层");
             }
 
-            request.setUser_lat(orderClothDeliveryAddress.getLatitude().doubleValue());
-            request.setUser_lng(orderClothDeliveryAddress.getLongitude().doubleValue());
+            request.setUser_lat(Double.parseDouble(orderDelivery.getUserLat()));
+            request.setUser_lng(Double.parseDouble(orderDelivery.getUserLng()));
         }
         return request;
     }

+ 35 - 7
yiqi-common/src/main/java/com/yiqi/order/domain/OrderDelivery.java

@@ -7,7 +7,9 @@ import com.fasterxml.jackson.annotation.JsonFormat;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
+import com.yiqi.app.domain.AppUserAddress;
 import com.yiqi.common.annotation.Excel;
+import com.yiqi.common.utils.DateUtils;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import com.yiqi.common.core.domain.BaseEntity;
@@ -49,10 +51,10 @@ public class OrderDelivery extends BaseEntity {
     private String orderSn;
 
     /**
-     * 组织ID
+     * 门店ID
      */
-    @Excel(name = "组织ID")
-    @ApiModelProperty("组织ID")
+    @Excel(name = "门店ID")
+    @ApiModelProperty("门店ID")
     @JsonSerialize(using = ToStringSerializer.class)
     private Long storeId;
 
@@ -113,6 +115,13 @@ public class OrderDelivery extends BaseEntity {
     @ApiModelProperty("用户手机号")
     private String userPhone;
 
+    /**
+     * 用户姓名
+     */
+    @Excel(name = "用户姓名")
+    @ApiModelProperty("用户姓名")
+    private String userName;
+
     /**
      * 配送距离(整数单位:米)
      */
@@ -142,12 +151,12 @@ public class OrderDelivery extends BaseEntity {
     private String recvCode;
 
     /**
-     * 外部订单id
+     * 运力订单号
      */
-    @Excel(name = "外部订单id")
-    @ApiModelProperty("外部订单id")
+    @Excel(name = "运力订单号")
+    @ApiModelProperty("运力订单号")
     @JsonSerialize(using = ToStringSerializer.class)
-    private Long transOrderId;
+    private String transOrderId;
 
     /**
      * 配送状态,枚举值
@@ -209,5 +218,24 @@ public class OrderDelivery extends BaseEntity {
     @ApiModelProperty("配送员电话")
     private String transporterPhone;
 
+    /**
+     * 配送方式 {@link com.yiqi.common.enums.ClothOrderDeliveryWay}
+     */
+    @Excel(name = "配送方式")
+    @ApiModelProperty("配送方式 ")
+    private String deliveryWay;
+
+    public OrderDelivery() {
+    }
+
+    public OrderDelivery(AppUserAddress appUserAddress) {
+        this.appUserId = appUserAddress.getAppUserId();
+        this.userAddress = appUserAddress.getAddress() + appUserAddress.getAddressDetail();
+        this.userLat = String.valueOf(appUserAddress.getLongitude());
+        this.userLng = String.valueOf(appUserAddress.getLatitude());
+        this.userPhone = appUserAddress.getContactPhone();
+        this.userName = appUserAddress.getContactName();
+        setCreateTime(DateUtils.getNowDate());
+    }
 
 }

+ 3 - 3
yiqi-common/src/main/java/com/yiqi/order/domain/vo/OrderClothVO.java

@@ -9,7 +9,7 @@ import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import com.yiqi.app.domain.vo.AppUserVO;
 import com.yiqi.common.annotation.Excel;
 import com.yiqi.common.core.domain.BaseEntity;
-import com.yiqi.order.domain.OrderClothDeliveryAddress;
+import com.yiqi.order.domain.OrderDelivery;
 import com.yiqi.system.domain.SysOrg;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
@@ -335,10 +335,10 @@ public class OrderClothVO extends BaseEntity
     private List<OrderClothItemVO> orderClothItemVOS;
 
     @ApiModelProperty("收衣配送信息")
-    private OrderClothDeliveryAddress collectClothDeliverInfo;
+    private OrderDelivery collectClothDeliverInfo;
 
     @ApiModelProperty("送回配送信息")
-    private OrderClothDeliveryAddress takeClothDeliverInfo;
+    private OrderDelivery takeClothDeliverInfo;
 
     @ApiModelProperty("收衣人明细")
     private AppUserVO takeClothUserVO;

+ 3 - 3
yiqi-common/src/main/java/com/yiqi/order/domain/vo/weapp/WeAppOrderClothAppointmentVO.java

@@ -4,7 +4,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import com.yiqi.common.annotation.Excel;
-import com.yiqi.order.domain.OrderClothDeliveryAddress;
+import com.yiqi.order.domain.OrderDelivery;
 import com.yiqi.system.domain.SysOrg;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
@@ -49,10 +49,10 @@ public class WeAppOrderClothAppointmentVO {
     private Integer appointmentCount;
 
     @ApiModelProperty("收衣配送信息")
-    private OrderClothDeliveryAddress collectClothDeliverInfo;
+    private OrderDelivery collectClothDeliverInfo;
 
     @ApiModelProperty("送回配送信息")
-    private OrderClothDeliveryAddress takeClothDeliverInfo;
+    private OrderDelivery takeClothDeliverInfo;
 
     @ApiModelProperty("组织信息")
     private SysOrg sysOrg;

+ 8 - 8
yiqi-core/src/main/java/com/yiqi/order/service/impl/OrderClothServiceImpl.java

@@ -119,7 +119,7 @@ public class OrderClothServiceImpl extends ServiceImpl<OrderClothMapper, OrderCl
     @Autowired
     private ISysConfigService configService;
     @Autowired
-    private IOrderClothDeliveryAddressService orderClothDeliveryAddressService;
+    private IOrderDeliveryService orderDeliveryService;
     @Autowired
     private IOrderClothAddressService orderClothAddressService;
     @Autowired
@@ -129,25 +129,25 @@ public class OrderClothServiceImpl extends ServiceImpl<OrderClothMapper, OrderCl
 
     @Override
     public void handleDeliverySuccessUpdateOrderStatus(String orderNo) {
-        OrderClothDeliveryAddress orderClothDeliveryAddress = orderClothDeliveryAddressService.getOne(
-                new QueryWrapper<OrderClothDeliveryAddress>().lambda()
-                        .eq(OrderClothDeliveryAddress::getThirdDeliveryOrderNo, orderNo));
-        if (orderClothDeliveryAddress == null) {
+        OrderDelivery orderDelivery = orderDeliveryService.getOne(
+                new QueryWrapper<OrderDelivery>().lambda()
+                        .eq(OrderDelivery::getTransOrderId, orderNo));
+        if (orderDelivery == null) {
             throw new ServiceException("未查询到配送信息");
         }
         OrderCloth orderCloth = getOne(
-                new QueryWrapper<OrderCloth>().lambda().eq(OrderCloth::getId, orderClothDeliveryAddress.getOrderId()));
+                new QueryWrapper<OrderCloth>().lambda().eq(OrderCloth::getOrderNo, orderDelivery.getOrderSn()));
         if (orderCloth == null) {
             throw new ServiceException("未查询到洗衣订单");
         }
-        if (orderClothDeliveryAddress.getClothOrderType().equals(ClothOrderDeliveryType.collectCloth.getCode())
+        if (orderDelivery.getClothOrderType().equals(ClothOrderDeliveryType.collectCloth.getCode())
                 && (orderCloth.getOrderStatus().equals(ClothOrderStatusType.WAITING_TO_DOOR.getCode())
                 || orderCloth.getOrderStatus().equals(ClothOrderStatusType.HAS_TO_DOOR.getCode()))) {
             update(new UpdateWrapper<OrderCloth>().lambda()
                     .set(OrderCloth::getOrderStatus, ClothOrderStatusType.HAS_TAKING.getCode())
                     .eq(OrderCloth::getId, orderCloth.getId()));
         }
-        if (orderClothDeliveryAddress.getClothOrderType().equals(ClothOrderDeliveryType.takeCloth.getCode())
+        if (orderDelivery.getClothOrderType().equals(ClothOrderDeliveryType.takeCloth.getCode())
                 && (orderCloth.getOrderStatus().equals(ClothOrderStatusType.WAITING_TO_SEND.getCode())
                 || orderCloth.getOrderStatus().equals(ClothOrderStatusType.SENDING.getCode()))) {
             update(new UpdateWrapper<OrderCloth>().lambda()