Authored by mali

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

... ... @@ -558,7 +558,7 @@ public class BuyerOrderController {
@RequestMapping(value = "/orderQueryExpressCompanyId")
public ApiResponse orderQueryExpressCompanyId(BuyerOrderReq req) {
LOGGER.info("method orderQueryExpressCompanyId in req is {}", req);
ExpressCompany result = buyerOrderService.orderQueryExpressCompanyId(req);
ExpressCompany result = buyerOrderService.orderQueryExpressCompanyId(req.getOrderCode());
return new ApiResponse.ApiResponseBuilder().code(200).message("查询成功").data(result).build();
}
}
... ...
... ... @@ -123,7 +123,7 @@ public interface IBuyerOrderService {
* 根据订单号查询具体的物流公司
* @return
*/
ExpressCompany orderQueryExpressCompanyId(BuyerOrderReq req);
ExpressCompany orderQueryExpressCompanyId(String orderCode);
boolean queryIsExistCsCancleOrder(String sellerWaybillCode);
... ...
... ... @@ -1316,6 +1316,11 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService, ApplicationCon
if(CollectionUtils.isNotEmpty(sellerExpressRecordList)) {
throw new ServiceException(400,"错误:订单已存在物流信息["+sellerExpressRecordList.get(0).getWaybillCode()+"]");
}
Integer companyId = Optional.ofNullable(req.getOrderCode()).map(this::orderQueryExpressCompanyId).map(ExpressCompany::getId).orElse(17);
req.setExpressCompanyId(companyId);
return buyerOrder;
}
... ... @@ -3081,28 +3086,28 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService, ApplicationCon
* 根据订单号查询具体的物流公司
* @return
*/
public ExpressCompany orderQueryExpressCompanyId(BuyerOrderReq req) {
public ExpressCompany orderQueryExpressCompanyId(String orderCode) {
ExpressCompany expressCompany = new ExpressCompany();
expressCompany.setId(23);
expressCompany.setCompanyName("顺丰");
if (StringUtils.isEmpty(req.getOrderCode())) {
if (StringUtils.isEmpty(orderCode)) {
return expressCompany;
}
List<BuyerOrderGoods> buyerOrderGoodses = buyerOrderGoodsMapper.selectByOrderCode(Lists.newArrayList(req.getOrderCode()));
List<BuyerOrderGoods> buyerOrderGoodses = buyerOrderGoodsMapper.selectByOrderCode(Lists.newArrayList(orderCode));
if (CollectionUtils.isEmpty(buyerOrderGoodses)) {
LOGGER.error("buyerOrderGoodsMapper.selectByOrderCode is empty req is {}", req);
LOGGER.error("buyerOrderGoodsMapper.selectByOrderCode is empty orderCode is {}", orderCode);
return expressCompany;
}
Integer skup = buyerOrderGoodses.get(0).getSkup();
List<SellerOrderGoods> sellerOrderGoodses = sellerOrderGoodsMapper.selectByIds(Lists.newArrayList(skup));
if (CollectionUtils.isEmpty(sellerOrderGoodses)) {
LOGGER.error("sellerOrderGoodsMapper.selectByIds is empty req is {}", req);
LOGGER.error("sellerOrderGoodsMapper.selectByIds is empty orderCode is {}", orderCode);
return expressCompany;
}
Integer depotNo = sellerOrderGoodses.get(0).getDepotNo();
if (Integer.valueOf(2).equals(depotNo)) { // 香港仓的订单默认发中通 其他仓订单默认发顺丰
expressCompany.setId(47);
expressCompany.setCompanyName("中通");
expressCompany.setId(76);
expressCompany.setCompanyName("中通国际");
}
return expressCompany;
}
... ...