|
@@ -24,7 +24,11 @@ import com.fs.hisStore.dto.ExpressInfoDTO;
|
|
|
import com.fs.hisStore.dto.TracesDTO;
|
|
import com.fs.hisStore.dto.TracesDTO;
|
|
|
import com.fs.hisStore.enums.ShipperCodeEnum;
|
|
import com.fs.hisStore.enums.ShipperCodeEnum;
|
|
|
import com.fs.hisStore.mapper.FsStoreOrderScrmMapper;
|
|
import com.fs.hisStore.mapper.FsStoreOrderScrmMapper;
|
|
|
|
|
+import com.fs.hisStore.param.FsStoreOrderExpressParam;
|
|
|
|
|
+import com.fs.live.domain.LiveOrder;
|
|
|
|
|
+import com.fs.live.mapper.LiveOrderMapper;
|
|
|
import com.fs.system.service.ISysConfigService;
|
|
import com.fs.system.service.ISysConfigService;
|
|
|
|
|
+import org.apache.commons.lang.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -51,6 +55,8 @@ public class FsExpressScrmServiceImpl implements IFsExpressScrmService
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private ISysConfigService configService;
|
|
private ISysConfigService configService;
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private LiveOrderMapper liveOrderMapper;
|
|
|
/**
|
|
/**
|
|
|
* 查询快递公司
|
|
* 查询快递公司
|
|
|
*
|
|
*
|
|
@@ -285,6 +291,51 @@ public class FsExpressScrmServiceImpl implements IFsExpressScrmService
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public R getLiveExpressByDeliverId(FsStoreOrderExpressParam param) {
|
|
|
|
|
+ // 添加日志 - 开始
|
|
|
|
|
+ Logger logger = LoggerFactory.getLogger(this.getClass());
|
|
|
|
|
+ logger.info("查询物流信息开始,参数:{}", param);
|
|
|
|
|
+ LiveOrder liveOrder = liveOrderMapper.selectLiveOrderByOrderId(String.valueOf(param.getOrderId()));
|
|
|
|
|
+ // 添加日志 - 订单信息
|
|
|
|
|
+ logger.info("查询到订单信息:{}", liveOrder);
|
|
|
|
|
+ if (liveOrder == null) {
|
|
|
|
|
+ return R.error("未查询到订单信息");
|
|
|
|
|
+ }
|
|
|
|
|
+ //顺丰轨迹查询处理
|
|
|
|
|
+ String lastFourNumber = "";
|
|
|
|
|
+ if (StringUtils.equals(liveOrder.getDeliveryCode(),ShipperCodeEnum.SF.getValue())) {
|
|
|
|
|
+ lastFourNumber = getLastFourNum(liveOrder.getUserPhone());
|
|
|
|
|
+ // 添加日志 - 顺丰单号
|
|
|
|
|
+ logger.info("顺丰单号处理,获取用户手机号后四位:{}", lastFourNumber);
|
|
|
|
|
+ }
|
|
|
|
|
+ ExpressInfoDTO dto = null;
|
|
|
|
|
+ try {
|
|
|
|
|
+ dto = this.getExpressInfo(liveOrder.getOrderCode(),
|
|
|
|
|
+ liveOrder.getDeliveryCode(),
|
|
|
|
|
+ liveOrder.getDeliverySn(),
|
|
|
|
|
+ lastFourNumber);
|
|
|
|
|
+ // 添加日志 - 成功获取物流信息
|
|
|
|
|
+ logger.info("成功获取物流信息,订单号:{},物流单号:{}, 快递公司ID:{}, 返回数据:{}", liveOrder.getOrderCode(), liveOrder.getDeliveryCode(),liveOrder.getDeliverySn(), dto);
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ // 添加日志 - 异常
|
|
|
|
|
+ logger.error("获取物流信息异常,订单号:{},物流单号:{},快递公司ID:{}", liveOrder.getOrderCode(), liveOrder.getDeliveryCode(), liveOrder.getDeliverySn(), e);
|
|
|
|
|
+ }
|
|
|
|
|
+ // 添加日志 - 结束
|
|
|
|
|
+ logger.info("查询物流信息结束,订单号:{}", param.getOrderId());
|
|
|
|
|
+
|
|
|
|
|
+ return R.ok().put("data",dto);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public static String getLastFourNum(String phone) {
|
|
|
|
|
+
|
|
|
|
|
+ String lastFourNumber = phone;
|
|
|
|
|
+ if (lastFourNumber.length() == 11) {
|
|
|
|
|
+ lastFourNumber = StrUtil.sub(lastFourNumber, lastFourNumber.length(), -4);
|
|
|
|
|
+ }
|
|
|
|
|
+ return lastFourNumber;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* Sign签名生成
|
|
* Sign签名生成
|
|
|
*
|
|
*
|