|
@@ -2,6 +2,8 @@ package com.fs.his.task;
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
import cn.hutool.core.date.DateTime;
|
|
import cn.hutool.core.date.DateTime;
|
|
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
import cn.hutool.json.JSONUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
@@ -56,8 +58,10 @@ import com.fs.his.utils.ConfigUtil;
|
|
|
import com.fs.his.vo.FsSubOrderResultVO;
|
|
import com.fs.his.vo.FsSubOrderResultVO;
|
|
|
import com.fs.hisStore.domain.FsStoreOrderScrm;
|
|
import com.fs.hisStore.domain.FsStoreOrderScrm;
|
|
|
import com.fs.hisStore.domain.FsStorePaymentScrm;
|
|
import com.fs.hisStore.domain.FsStorePaymentScrm;
|
|
|
|
|
+import com.fs.hisStore.enums.ShipperCodeEnum;
|
|
|
import com.fs.hisStore.mapper.FsStoreOrderScrmMapper;
|
|
import com.fs.hisStore.mapper.FsStoreOrderScrmMapper;
|
|
|
import com.fs.hisStore.mapper.FsStorePaymentScrmMapper;
|
|
import com.fs.hisStore.mapper.FsStorePaymentScrmMapper;
|
|
|
|
|
+import com.fs.hisStore.service.IFsExpressScrmService;
|
|
|
import com.fs.hisStore.service.IFsStoreOrderScrmService;
|
|
import com.fs.hisStore.service.IFsStoreOrderScrmService;
|
|
|
import com.fs.hisStore.service.IFsStorePaymentScrmService;
|
|
import com.fs.hisStore.service.IFsStorePaymentScrmService;
|
|
|
import com.fs.huifuPay.domain.HuiFuQueryOrderResult;
|
|
import com.fs.huifuPay.domain.HuiFuQueryOrderResult;
|
|
@@ -266,6 +270,73 @@ public class Task {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private ConversationSyncService syncService;
|
|
private ConversationSyncService syncService;
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private IFsExpressScrmService expressService;
|
|
|
|
|
+
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private IFsStoreOrderScrmService fsStoreOrderScrmService;
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 快递信息同步
|
|
|
|
|
+ */
|
|
|
|
|
+ public void expressInfoSync(){
|
|
|
|
|
+ FsStoreOrderScrm storeOrderScrm = new FsStoreOrderScrm();
|
|
|
|
|
+ storeOrderScrm.setIsAudit(1);
|
|
|
|
|
+ storeOrderScrm.setStatus(2);
|
|
|
|
|
+ storeOrderScrm.setDeliveryExceptionStatus(null);
|
|
|
|
|
+ List<FsStoreOrderScrm> orderList = fsStoreOrderScrmService.selectFsStoreOrderList(storeOrderScrm);
|
|
|
|
|
+ com.fs.hisStore.dto.ExpressInfoDTO expressInfoDTO = null;
|
|
|
|
|
+ String lastFourNumber = "";
|
|
|
|
|
+ for (FsStoreOrderScrm order : orderList) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ if (com.fs.common.utils.StringUtils.isNotEmpty(order.getDeliveryId()) &&ObjectUtil.isNotEmpty(lastFourNumber = order.getVirtualPhone())) {
|
|
|
|
|
+ if (order.getDeliverySn().equals(ShipperCodeEnum.SF.getValue()) || order.getDeliverySn().equals(ShipperCodeEnum.ZTO.getValue())) {
|
|
|
|
|
+ if(order.getDeliveryExceptionStatus() !=null){
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (lastFourNumber.contains("-")) {
|
|
|
|
|
+ String beforeDash = lastFourNumber.split("-")[0];
|
|
|
|
|
+ lastFourNumber = beforeDash.length() >= 4 ? beforeDash.substring(beforeDash.length() - 4) : beforeDash;
|
|
|
|
|
+ }else{
|
|
|
|
|
+ lastFourNumber = StrUtil.sub(lastFourNumber, lastFourNumber.length(), -4);
|
|
|
|
|
+ }
|
|
|
|
|
+ expressInfoDTO=expressService.getExpressInfo(order.getOrderCode(),order.getDeliverySn(),order.getDeliveryId(),lastFourNumber);
|
|
|
|
|
+ if (lastFourNumber.contains("-")) {
|
|
|
|
|
+ if (expressInfoDTO != null && !expressInfoDTO.isSuccess()) {
|
|
|
|
|
+ lastFourNumber = StrUtil.sub(order.getVirtualPhone(), order.getVirtualPhone().length(), -4);
|
|
|
|
|
+ expressInfoDTO = expressService.getExpressInfo(order.getOrderCode(), order.getDeliverySn(), order.getDeliveryId(), lastFourNumber);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if(expressInfoDTO!=null){
|
|
|
|
|
+ FsStoreOrderScrm map = new FsStoreOrderScrm();
|
|
|
|
|
+ map.setId(order.getId());
|
|
|
|
|
+ if(expressInfoDTO.isSuccess()){
|
|
|
|
|
+ map.setDeliveryType(expressInfoDTO.getStateEx());
|
|
|
|
|
+ map.setDeliveryStatus(Integer.parseInt(expressInfoDTO.getState()));
|
|
|
|
|
+ }else{
|
|
|
|
|
+ map.setDeliveryExceptionRemark(expressInfoDTO.getReason());
|
|
|
|
|
+ map.setDeliveryExceptionStatus(1);
|
|
|
|
|
+ }
|
|
|
|
|
+ fsStoreOrderScrmMapper.updateFsStoreOrder(map);
|
|
|
|
|
+ //如果是正常签收,更新订单状态
|
|
|
|
|
+ if (expressInfoDTO.getState().equals("3") && (expressInfoDTO.getStateEx().equals("301") || expressInfoDTO.getStateEx().equals("302") || expressInfoDTO.getStateEx().equals("304") || expressInfoDTO.getStateEx().equals("311"))) {
|
|
|
|
|
+ fsStoreOrderScrmService.finishOrder(order.getId());
|
|
|
|
|
+ }
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ }else if ((lastFourNumber = order.getUserPhone()).length() == 11) {
|
|
|
|
|
+ lastFourNumber = StrUtil.sub(lastFourNumber, lastFourNumber.length(), -4);
|
|
|
|
|
+ }
|
|
|
|
|
+ expressInfoDTO = expressService.getExpressInfo(order.getOrderCode(), order.getDeliverySn(), order.getDeliveryId(), lastFourNumber);
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ System.out.println(e);
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 定时任务,处理ai禁止回复之后的消息
|
|
* 定时任务,处理ai禁止回复之后的消息
|
|
|
*/
|
|
*/
|