|
@@ -5,17 +5,12 @@ import cn.hutool.core.collection.CollUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
+import com.yiqi.app.domain.*;
|
|
|
+import com.yiqi.app.service.*;
|
|
|
+import com.yiqi.common.core.domain.AuthHolder;
|
|
|
import com.yiqi.common.exception.ServiceException;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
-import com.yiqi.app.domain.AppDeliveryMan;
|
|
|
-import com.yiqi.app.domain.AppDeliveryRelation;
|
|
|
-import com.yiqi.app.domain.AppUser;
|
|
|
-import com.yiqi.app.domain.AppUserBillMstr;
|
|
|
import com.yiqi.app.domain.vo.AppUserInfoVO;
|
|
|
-import com.yiqi.app.service.IAppDeliveryManService;
|
|
|
-import com.yiqi.app.service.IAppDeliveryRelationService;
|
|
|
-import com.yiqi.app.service.IAppUserBillMstrService;
|
|
|
-import com.yiqi.app.service.IAppUserService;
|
|
|
import com.yiqi.common.annotation.Log;
|
|
|
import com.yiqi.common.constant.UrlConstants;
|
|
|
import com.yiqi.common.core.controller.BaseController;
|
|
@@ -29,6 +24,7 @@ import com.yiqi.common.utils.poi.ExcelUtil;
|
|
|
import com.yiqi.core.domain.dto.wx.IntracityExpressAddOrderRequest;
|
|
|
import com.yiqi.core.domain.vo.ClothHangerOrderRelationVO;
|
|
|
import com.yiqi.core.domain.vo.wx.IntracityExpressBaseResult;
|
|
|
+import com.yiqi.core.domain.vo.wx.IntracityExpressCreateOrderResult;
|
|
|
import com.yiqi.core.service.ISysStoreIntracityExpressService;
|
|
|
import com.yiqi.order.domain.OrderCloth;
|
|
|
import com.yiqi.order.domain.OrderClothItem;
|
|
@@ -100,6 +96,8 @@ public class OrderClothController extends BaseController {
|
|
|
private IThirdDeliveryService thirdDeliveryService;
|
|
|
@Autowired
|
|
|
private IManageFactoryService manageFactoryService;
|
|
|
+ @Autowired
|
|
|
+ private IAppUserAddressService appUserAddressService;
|
|
|
|
|
|
@PreAuthorize("@ss.hasPermi('order:cloth:selectOrg')")
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@@ -305,19 +303,29 @@ public class OrderClothController extends BaseController {
|
|
|
if (orderDelivery == null) {
|
|
|
throw new ServiceException("未查询到配送信息");
|
|
|
}
|
|
|
- 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
|
|
|
+ IntracityExpressCreateOrderResult result = sysStoreIntracityExpressService
|
|
|
.addOrder(IntracityExpressAddOrderRequest
|
|
|
.build(orderCloth, orderDelivery, sysStore, appUser.getWxOpenId()));
|
|
|
+ // 更新订单状态
|
|
|
orderClothService.update(new UpdateWrapper<OrderCloth>().lambda()
|
|
|
.eq(OrderCloth::getId, orderCloth.getId())
|
|
|
.set(OrderCloth::getOrderStatus, ClothOrderStatusType.SENDING.getCode()));
|
|
|
+ // 更新配送单状态
|
|
|
+ orderDelivery.setDistance(String.valueOf(result.getDistance()));
|
|
|
+ // 金额 分 -> 元
|
|
|
+ orderDelivery.setFee(BigDecimal.valueOf(result.getFee()).divide(BigDecimal.valueOf(100), 2));
|
|
|
+ orderDelivery.setFetchCode(result.getFetch_code());
|
|
|
+ orderDelivery.setServiceTransId(result.getService_trans_id());
|
|
|
+ orderDelivery.setTransOrderId(result.getTrans_order_id());
|
|
|
+ orderDeliveryService.updateById(orderDelivery);
|
|
|
+
|
|
|
if (result.getErrcode() != 0) {
|
|
|
throw new ServiceException("errorCode:" + result.getErrcode() + ";errorMsg:" + result.getErrmsg());
|
|
|
}
|