...
|
...
|
@@ -27,6 +27,7 @@ import com.yohoufo.order.constants.MetaKey; |
|
|
import com.yohoufo.order.event.BuyerOrderSellerDeliveryCheckEvent;
|
|
|
import com.yohoufo.order.event.ErpBuyerOrderEvent;
|
|
|
import com.yohoufo.order.model.response.AppraiseAddressResp;
|
|
|
import com.yohoufo.order.service.IBuyerOrderMetaService;
|
|
|
import com.yohoufo.order.service.IExpressCompanyService;
|
|
|
import com.yohoufo.order.service.IExpressInfoService;
|
|
|
import com.yohoufo.order.service.cache.CacheCleaner;
|
...
|
...
|
@@ -106,6 +107,9 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { |
|
|
@Autowired
|
|
|
UfoServiceCaller ufoServiceCaller;
|
|
|
|
|
|
@Autowired
|
|
|
private IBuyerOrderMetaService buyerOrderMetaService;
|
|
|
|
|
|
private static String EXPRESS_MQ_SEND = "third.logistics.logistics_data";
|
|
|
|
|
|
//物流文案设置
|
...
|
...
|
@@ -142,6 +146,12 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { |
|
|
LOGGER.warn("deliverToDepot getOrderInfo order not exist, orderCode is {}", orderCode);
|
|
|
throw new ServiceException(ServiceError.ORDER_NULL);
|
|
|
}
|
|
|
Integer orderStatus = buyerOrder.getStatus();
|
|
|
if ( orderStatus != targetOrderStatus.getCode()){
|
|
|
LOGGER.warn("deliverToDepot order status changed , orderCode {} orderStatus {}", orderCode, orderStatus);
|
|
|
throw new UfoServiceException(400, "订单状态已变更,不能发货");
|
|
|
}
|
|
|
|
|
|
int buyerUid;
|
|
|
//获取skup
|
|
|
BuyerOrderGoods buyerOrderGoods= buyerOrderGoodsMapper.selectByOrderCode(buyerUid=buyerOrder.getUid(),orderCode);
|
...
|
...
|
@@ -150,6 +160,7 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { |
|
|
throw new ServiceException(ServiceError.ORDER_NULL);
|
|
|
}
|
|
|
|
|
|
|
|
|
//根据skup ,更新鉴定中心
|
|
|
int skup;
|
|
|
SellerOrderGoods sellerOrderGoods=new SellerOrderGoods();
|
...
|
...
|
@@ -173,8 +184,8 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { |
|
|
mobile = appraiseAddressResp.getMobile();
|
|
|
}
|
|
|
|
|
|
LOGGER.info("deliverToDepot saveExpress expressCompanyId = {}, orderCode = {}, wayBillCode = {} " +
|
|
|
",expressType = {},depotNum={},mobile={},expressDataType={},operateTransferCode={}",
|
|
|
LOGGER.info("deliverToDepot saveExpress expressCompanyId {}, orderCode {}, wayBillCode {} " +
|
|
|
",expressType {},depotNum {},mobile {},expressDataType {},operateTransferCode {}",
|
|
|
new Object[]{expressCompanyId, orderCode, wayBillCode,expressType,depotNum,mobile,expressDataType,operateTransferCode});
|
|
|
saveExpressRecordAndOperateTransferExpressInfo(sellerUid,expressCompanyId,orderCode,wayBillCode,expressType,expressDataType,operateTransferCode,depotNum);
|
|
|
|
...
|
...
|
@@ -207,8 +218,10 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { |
|
|
|
|
|
ErpBuyerOrderEvent event = new ErpBuyerOrderEvent(buyerUid);
|
|
|
EventBusPublisher.publishEvent(event);
|
|
|
}else{
|
|
|
LOGGER.warn("deliverToDepot can not update order, orderCode {}", orderCode);
|
|
|
}
|
|
|
LOGGER.info("deliverToDepot update buyer order status result {} ",updateBuyerCnt);
|
|
|
LOGGER.info("deliverToDepot update buyer order status, orderCode {} result {} ", orderCode, updateBuyerCnt);
|
|
|
}
|
|
|
|
|
|
@Override
|
...
|
...
|
@@ -947,27 +960,61 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { |
|
|
}
|
|
|
}
|
|
|
|
|
|
private BuyerOrder findOrderCodeBySkup(int skup){
|
|
|
List<Integer> skups = new ArrayList<>(1);
|
|
|
skups.add(skup);
|
|
|
List<BuyerOrderGoods> buyerOrderGoodsList = buyerOrderGoodsMapper.selectBySkups(skups);
|
|
|
List<BuyerOrder> buyerOrderList = null;
|
|
|
if (CollectionUtils.isNotEmpty(buyerOrderGoodsList)){
|
|
|
List<Long> orderCodeList = buyerOrderGoodsList.parallelStream()
|
|
|
.map(BuyerOrderGoods::getOrderCode).collect(Collectors.toList());
|
|
|
buyerOrderList = buyerOrderMapper.selectByOrderCodes(orderCodeList, Arrays.asList(OrderStatus.HAS_PAYED.getCode()));
|
|
|
}
|
|
|
int pboSize = 0;
|
|
|
boolean noPaidOrder;
|
|
|
if (noPaidOrder = (buyerOrderList == null) || (pboSize =buyerOrderList.size()) > 1){
|
|
|
LOGGER.warn("findOrderCodeBySkup skup {} noPaidOrder {} pboSize {}", skup, noPaidOrder, pboSize);
|
|
|
throw new UfoServiceException(400, "订单状态已变更,请刷新后操作");
|
|
|
}
|
|
|
|
|
|
return buyerOrderList.get(0);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 根据用户默认地址的省份定位到鉴定中心的地址返回
|
|
|
*
|
|
|
* 根据用户默认地址的省份定位到鉴定中心的地址返回 *
|
|
|
*
|
|
|
* @param uid
|
|
|
* @param orderCode from version 6.9.3
|
|
|
* @param skup
|
|
|
* @return
|
|
|
*/
|
|
|
public AppraiseAddressResp queryAppraiseAddress(Integer uid, Integer skup) {
|
|
|
if (null == skup) {
|
|
|
@Override
|
|
|
public AppraiseAddressResp queryAppraiseAddress(Integer uid, Long orderCode, Integer skup) {
|
|
|
boolean skupIsNull = (null == skup);
|
|
|
boolean orderCodeIsNull = (null == orderCode);
|
|
|
if (skupIsNull && orderCodeIsNull) {
|
|
|
LOGGER.warn("queryAppraiseAddress can not save back, all key info are null, uid {}", uid);
|
|
|
return appraiseAddressService.queryInitAddress();
|
|
|
}
|
|
|
|
|
|
|
|
|
BuyerOrder buyerOrder = null;
|
|
|
if (orderCodeIsNull){
|
|
|
//4 compatible before version 6.9.3(exclude), client transfer without order code
|
|
|
buyerOrder = findOrderCodeBySkup(skup);
|
|
|
orderCode = buyerOrder.getOrderCode();
|
|
|
LOGGER.info("in queryAppraiseAddress find buyer OrderCode By Skup , orderCode {} skup {}", orderCode, skup);
|
|
|
}
|
|
|
buyerOrder = buyerOrderMapper.selectOnlyByOrderCode(orderCode);
|
|
|
AddressInfo buyerAddress = buyerOrderMetaService.getAddressInfo(buyerOrder.getUid(), orderCode);
|
|
|
LOGGER.info("in queryAppraiseAddress get buyerAddress orderCode {}, skup {}", orderCode, skup);
|
|
|
|
|
|
// 根据用户id查询默认地址的省份
|
|
|
SellerOrderMeta addressMeta = sellerOrderMetaMapper.selectByMetaKey(uid, skup, MetaKey.BACK_2_SELLER_DELIVERY_ADDRESS);
|
|
|
if (null != addressMeta) {
|
|
|
LOGGER.info("addressMeta is not null uid is {}, skup is {}", uid, skup);
|
|
|
AddressInfo addressInfo = JSONObject.parseObject(addressMeta.getMetaValue(), AddressInfo.class);
|
|
|
AppraiseAddressResp resp = null;
|
|
|
if (null != buyerAddress ) {
|
|
|
// 根据产品给的哪些用户的省份匹配到对应的鉴定中心地址
|
|
|
return null == addressInfo ? appraiseAddressService.queryInitAddress() : appraiseAddressService.queryAddressByAreaCode(addressInfo.getAreaCode());
|
|
|
resp = appraiseAddressService.queryAddressByAreaCode(buyerAddress.getAreaCode());
|
|
|
}
|
|
|
// 匹配不了,给个娄底的
|
|
|
return appraiseAddressService.queryInitAddress();
|
|
|
return resp==null ? appraiseAddressService.queryInitAddress() : resp;
|
|
|
}
|
|
|
} |
...
|
...
|
|