Authored by mali

根据订单货仓 查询物流公司信息

@@ -558,7 +558,7 @@ public class BuyerOrderController { @@ -558,7 +558,7 @@ public class BuyerOrderController {
558 @RequestMapping(value = "/orderQueryExpressCompanyId") 558 @RequestMapping(value = "/orderQueryExpressCompanyId")
559 public ApiResponse orderQueryExpressCompanyId(BuyerOrderReq req) { 559 public ApiResponse orderQueryExpressCompanyId(BuyerOrderReq req) {
560 LOGGER.info("method orderQueryExpressCompanyId in req is {}", req); 560 LOGGER.info("method orderQueryExpressCompanyId in req is {}", req);
561 - ExpressCompany result = buyerOrderService.orderQueryExpressCompanyId(req); 561 + ExpressCompany result = buyerOrderService.orderQueryExpressCompanyId(req.getOrderCode());
562 return new ApiResponse.ApiResponseBuilder().code(200).message("查询成功").data(result).build(); 562 return new ApiResponse.ApiResponseBuilder().code(200).message("查询成功").data(result).build();
563 } 563 }
564 } 564 }
@@ -123,7 +123,7 @@ public interface IBuyerOrderService { @@ -123,7 +123,7 @@ public interface IBuyerOrderService {
123 * 根据订单号查询具体的物流公司 123 * 根据订单号查询具体的物流公司
124 * @return 124 * @return
125 */ 125 */
126 - ExpressCompany orderQueryExpressCompanyId(BuyerOrderReq req); 126 + ExpressCompany orderQueryExpressCompanyId(String orderCode);
127 127
128 boolean queryIsExistCsCancleOrder(String sellerWaybillCode); 128 boolean queryIsExistCsCancleOrder(String sellerWaybillCode);
129 129
@@ -1316,6 +1316,11 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService, ApplicationCon @@ -1316,6 +1316,11 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService, ApplicationCon
1316 if(CollectionUtils.isNotEmpty(sellerExpressRecordList)) { 1316 if(CollectionUtils.isNotEmpty(sellerExpressRecordList)) {
1317 throw new ServiceException(400,"错误:订单已存在物流信息["+sellerExpressRecordList.get(0).getWaybillCode()+"]"); 1317 throw new ServiceException(400,"错误:订单已存在物流信息["+sellerExpressRecordList.get(0).getWaybillCode()+"]");
1318 } 1318 }
  1319 +
  1320 + Integer companyId = Optional.ofNullable(req.getOrderCode()).map(this::orderQueryExpressCompanyId).map(ExpressCompany::getId).orElse(17);
  1321 +
  1322 + req.setExpressCompanyId(companyId);
  1323 +
1319 return buyerOrder; 1324 return buyerOrder;
1320 } 1325 }
1321 1326
@@ -3081,28 +3086,28 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService, ApplicationCon @@ -3081,28 +3086,28 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService, ApplicationCon
3081 * 根据订单号查询具体的物流公司 3086 * 根据订单号查询具体的物流公司
3082 * @return 3087 * @return
3083 */ 3088 */
3084 - public ExpressCompany orderQueryExpressCompanyId(BuyerOrderReq req) { 3089 + public ExpressCompany orderQueryExpressCompanyId(String orderCode) {
3085 ExpressCompany expressCompany = new ExpressCompany(); 3090 ExpressCompany expressCompany = new ExpressCompany();
3086 expressCompany.setId(23); 3091 expressCompany.setId(23);
3087 expressCompany.setCompanyName("顺丰"); 3092 expressCompany.setCompanyName("顺丰");
3088 - if (StringUtils.isEmpty(req.getOrderCode())) { 3093 + if (StringUtils.isEmpty(orderCode)) {
3089 return expressCompany; 3094 return expressCompany;
3090 } 3095 }
3091 - List<BuyerOrderGoods> buyerOrderGoodses = buyerOrderGoodsMapper.selectByOrderCode(Lists.newArrayList(req.getOrderCode())); 3096 + List<BuyerOrderGoods> buyerOrderGoodses = buyerOrderGoodsMapper.selectByOrderCode(Lists.newArrayList(orderCode));
3092 if (CollectionUtils.isEmpty(buyerOrderGoodses)) { 3097 if (CollectionUtils.isEmpty(buyerOrderGoodses)) {
3093 - LOGGER.error("buyerOrderGoodsMapper.selectByOrderCode is empty req is {}", req); 3098 + LOGGER.error("buyerOrderGoodsMapper.selectByOrderCode is empty orderCode is {}", orderCode);
3094 return expressCompany; 3099 return expressCompany;
3095 } 3100 }
3096 Integer skup = buyerOrderGoodses.get(0).getSkup(); 3101 Integer skup = buyerOrderGoodses.get(0).getSkup();
3097 List<SellerOrderGoods> sellerOrderGoodses = sellerOrderGoodsMapper.selectByIds(Lists.newArrayList(skup)); 3102 List<SellerOrderGoods> sellerOrderGoodses = sellerOrderGoodsMapper.selectByIds(Lists.newArrayList(skup));
3098 if (CollectionUtils.isEmpty(sellerOrderGoodses)) { 3103 if (CollectionUtils.isEmpty(sellerOrderGoodses)) {
3099 - LOGGER.error("sellerOrderGoodsMapper.selectByIds is empty req is {}", req); 3104 + LOGGER.error("sellerOrderGoodsMapper.selectByIds is empty orderCode is {}", orderCode);
3100 return expressCompany; 3105 return expressCompany;
3101 } 3106 }
3102 Integer depotNo = sellerOrderGoodses.get(0).getDepotNo(); 3107 Integer depotNo = sellerOrderGoodses.get(0).getDepotNo();
3103 if (Integer.valueOf(2).equals(depotNo)) { // 香港仓的订单默认发中通 其他仓订单默认发顺丰 3108 if (Integer.valueOf(2).equals(depotNo)) { // 香港仓的订单默认发中通 其他仓订单默认发顺丰
3104 - expressCompany.setId(47);  
3105 - expressCompany.setCompanyName("中通"); 3109 + expressCompany.setId(76);
  3110 + expressCompany.setCompanyName("中通国际");
3106 } 3111 }
3107 return expressCompany; 3112 return expressCompany;
3108 } 3113 }