|
@@ -56,6 +56,9 @@ import com.fs.erp.dto.*;
|
|
|
import com.fs.erp.dto.df.*;
|
|
import com.fs.erp.dto.df.*;
|
|
|
import com.fs.erp.mapper.FsErpFinishPushMapper;
|
|
import com.fs.erp.mapper.FsErpFinishPushMapper;
|
|
|
import com.fs.erp.service.IErpOrderService;
|
|
import com.fs.erp.service.IErpOrderService;
|
|
|
|
|
+import com.fs.fastGpt.domain.FastGptRole;
|
|
|
|
|
+import com.fs.fastGpt.mapper.FastGptRoleMapper;
|
|
|
|
|
+import com.fs.fastGpt.service.IFastGptRoleService;
|
|
|
import com.fs.his.config.AppConfig;
|
|
import com.fs.his.config.AppConfig;
|
|
|
import com.fs.his.config.FsSysConfig;
|
|
import com.fs.his.config.FsSysConfig;
|
|
|
import com.fs.his.domain.*;
|
|
import com.fs.his.domain.*;
|
|
@@ -63,10 +66,7 @@ import com.fs.his.dto.*;
|
|
|
import com.fs.his.enums.*;
|
|
import com.fs.his.enums.*;
|
|
|
import com.fs.his.mapper.*;
|
|
import com.fs.his.mapper.*;
|
|
|
import com.fs.his.param.*;
|
|
import com.fs.his.param.*;
|
|
|
-import com.fs.his.service.IFsPrescribeService;
|
|
|
|
|
-import com.fs.his.service.IFsStoreOrderService;
|
|
|
|
|
-import com.fs.his.service.IFsUserIntegralLogsService;
|
|
|
|
|
-import com.fs.his.service.IFsUserWatchService;
|
|
|
|
|
|
|
+import com.fs.his.service.*;
|
|
|
import com.fs.his.utils.ConfigUtil;
|
|
import com.fs.his.utils.ConfigUtil;
|
|
|
import com.fs.his.vo.*;
|
|
import com.fs.his.vo.*;
|
|
|
import com.fs.his.vo.FsPrescribeVO;
|
|
import com.fs.his.vo.FsPrescribeVO;
|
|
@@ -82,6 +82,7 @@ import com.fs.hisStore.dto.FsStoreCartDTO;
|
|
|
import com.fs.hisStore.dto.StoreOrderExpressExportDTO;
|
|
import com.fs.hisStore.dto.StoreOrderExpressExportDTO;
|
|
|
import com.fs.hisStore.dto.StorePackageProductDTO;
|
|
import com.fs.hisStore.dto.StorePackageProductDTO;
|
|
|
import com.fs.hisStore.dto.StoreProductGroupDTO;
|
|
import com.fs.hisStore.dto.StoreProductGroupDTO;
|
|
|
|
|
+import com.fs.hisStore.dto.TracesDTO;
|
|
|
import com.fs.hisStore.enums.ShipperCodeEnum;
|
|
import com.fs.hisStore.enums.ShipperCodeEnum;
|
|
|
import com.fs.hisStore.mapper.*;
|
|
import com.fs.hisStore.mapper.*;
|
|
|
import com.fs.hisStore.param.*;
|
|
import com.fs.hisStore.param.*;
|
|
@@ -115,6 +116,11 @@ import com.fs.hisStore.constants.StoreConstants;
|
|
|
import com.fs.hisStore.domain.*;
|
|
import com.fs.hisStore.domain.*;
|
|
|
import com.fs.hisStore.enums.*;
|
|
import com.fs.hisStore.enums.*;
|
|
|
import com.fs.hisStore.service.*;
|
|
import com.fs.hisStore.service.*;
|
|
|
|
|
+import com.fs.qw.domain.QwExternalContact;
|
|
|
|
|
+import com.fs.qw.domain.QwUser;
|
|
|
|
|
+import com.fs.qw.mapper.QwExternalContactMapper;
|
|
|
|
|
+import com.fs.qw.mapper.QwUserMapper;
|
|
|
|
|
+import com.fs.qw.service.IQwExternalContactService;
|
|
|
import com.fs.store.domain.FsStoreDelivers;
|
|
import com.fs.store.domain.FsStoreDelivers;
|
|
|
import com.fs.system.domain.SysConfig;
|
|
import com.fs.system.domain.SysConfig;
|
|
|
import com.fs.system.service.ISysConfigService;
|
|
import com.fs.system.service.ISysConfigService;
|
|
@@ -131,6 +137,11 @@ import com.fs.wx.order.mapper.FsWxExpressTaskMapper;
|
|
|
import com.fs.wx.order.service.ExpressToWxHolder;
|
|
import com.fs.wx.order.service.ExpressToWxHolder;
|
|
|
import com.fs.wx.order.service.ExpressToWxService;
|
|
import com.fs.wx.order.service.ExpressToWxService;
|
|
|
import com.fs.wx.order.service.ShippingService;
|
|
import com.fs.wx.order.service.ShippingService;
|
|
|
|
|
+import com.fs.wxwork.dto.WxWorkResponseDTO;
|
|
|
|
|
+import com.fs.wxwork.dto.WxWorkSendTextMsgDTO;
|
|
|
|
|
+import com.fs.wxwork.dto.WxWorkUserId2VidDTO;
|
|
|
|
|
+import com.fs.wxwork.dto.WxWorkVid2UserIdRespDTO;
|
|
|
|
|
+import com.fs.wxwork.service.WxWorkService;
|
|
|
import com.fs.ybPay.domain.OrderResult;
|
|
import com.fs.ybPay.domain.OrderResult;
|
|
|
import com.fs.ybPay.domain.RefundResult;
|
|
import com.fs.ybPay.domain.RefundResult;
|
|
|
import com.github.binarywang.wxpay.bean.order.WxPayMpOrderResult;
|
|
import com.github.binarywang.wxpay.bean.order.WxPayMpOrderResult;
|
|
@@ -168,6 +179,8 @@ import org.redisson.api.RedissonClient;
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
|
|
+import org.springframework.web.bind.annotation.PathVariable;
|
|
|
|
|
+
|
|
|
import javax.annotation.PostConstruct;
|
|
import javax.annotation.PostConstruct;
|
|
|
import java.lang.reflect.Field;
|
|
import java.lang.reflect.Field;
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
@@ -473,6 +486,15 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private FsStoreProductActivityMapper activityMapper;
|
|
private FsStoreProductActivityMapper activityMapper;
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private QwExternalContactMapper qwExternalContactMapper;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private QwUserMapper qwUserMapper;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private FastGptRoleMapper fastGptRoleMapper;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private WxWorkService wxWorkService;
|
|
|
|
|
+
|
|
|
@Value("${cloud_host.company_name}")
|
|
@Value("${cloud_host.company_name}")
|
|
|
private String companyName;
|
|
private String companyName;
|
|
|
@PostConstruct
|
|
@PostConstruct
|
|
@@ -612,9 +634,41 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
|
|
|
log.error("修改商城订单地址推送到聚水潭ERP失败,orderId: {}", fsStoreOrder.getId(), e);
|
|
log.error("修改商城订单地址推送到聚水潭ERP失败,orderId: {}", fsStoreOrder.getId(), e);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ if ("北京卓美".equals(cloudHostProper.getCompanyName())) {
|
|
|
|
|
+ Integer newStatus = fsStoreOrder.getStatus();
|
|
|
|
|
+ Integer oldStatus = null;
|
|
|
|
|
+ Long orderId = fsStoreOrder.getId();
|
|
|
|
|
+ if (orderId != null && newStatus != null && (newStatus == 2 || newStatus == 3)) {
|
|
|
|
|
+ FsStoreOrderScrm existing = fsStoreOrderMapper.selectStatusById(orderId);
|
|
|
|
|
+ if (existing != null) {
|
|
|
|
|
+ oldStatus = existing.getStatus();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ int rows = fsStoreOrderMapper.updateFsStoreOrder(fsStoreOrder);
|
|
|
|
|
+ if (rows > 0 && orderId != null && newStatus != null && (newStatus == 2 || newStatus == 3)
|
|
|
|
|
+ && (oldStatus == null || !oldStatus.equals(newStatus))) {
|
|
|
|
|
+ safeSendExpressInfoToWx(orderId);
|
|
|
|
|
+ }
|
|
|
|
|
+ return rows;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
return fsStoreOrderMapper.updateFsStoreOrder(fsStoreOrder);
|
|
return fsStoreOrderMapper.updateFsStoreOrder(fsStoreOrder);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 订单状态变为待收货(2)或已完成(3)时推送企微物流消息;异常仅记录日志,不影响主流程。
|
|
|
|
|
+ */
|
|
|
|
|
+ private void safeSendExpressInfoToWx(Long orderId) {
|
|
|
|
|
+ if (orderId == null) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ try {
|
|
|
|
|
+ sendExpressInfoToWx(orderId);
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.error("推送企微物流消息失败,orderId:{},{}", orderId, e.getMessage(), e);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
public R updateUnpaidOrderPayPostage(FsStoreOrderPayPostageEditDTO param) {
|
|
public R updateUnpaidOrderPayPostage(FsStoreOrderPayPostageEditDTO param) {
|
|
|
if (param == null || param.getId() == null) {
|
|
if (param == null || param.getId() == null) {
|
|
@@ -2124,16 +2178,59 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * his.config 开启「单号识别」时按运单号调用快递鸟 2002;成功则按 ShipperCode 匹配本地快递公司。
|
|
|
|
|
+ * 失败或未开启返回 null,由调用方继续 {@link #selectExpressByOmsDeliverCode(String)}。
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param deliverNameBuf 识别成功且返回快递名称时写入展示名(非空即表示需覆盖 OMS 传入名称)
|
|
|
|
|
+ */
|
|
|
|
|
+ private FsExpressScrm tryResolveExpressByLogisticCode(String deliveryId, String orderCodeForLog, StringBuilder deliverNameBuf) {
|
|
|
|
|
+ if (StringUtils.isBlank(deliveryId) || deliverNameBuf == null) {
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ try {
|
|
|
|
|
+ FsSysConfig hisCfg = configUtil.generateStructConfigByKey("his.config", FsSysConfig.class);
|
|
|
|
|
+ if (hisCfg == null || !Boolean.TRUE.equals(hisCfg.getEnableLogisticCodeRecognition())) {
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ ExpressCompanyInfoDTO info = expressService.getExpressCompanyInfo(deliveryId.trim());
|
|
|
|
|
+ if (info == null || !info.isSuccess() || !"100".equals(info.getCode())
|
|
|
|
|
+ || info.getShippers() == null || info.getShippers().isEmpty()) {
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ ExpressCompanyDTO shipper = info.getShippers().get(0);
|
|
|
|
|
+ if (shipper == null || StringUtils.isBlank(shipper.getShipperCode())) {
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ String shipperCode = shipper.getShipperCode().trim();
|
|
|
|
|
+ FsExpressScrm resolved = new FsExpressScrm();
|
|
|
|
|
+ resolved.setCode(shipperCode);
|
|
|
|
|
+ resolved.setName(shipper.getShipperName());
|
|
|
|
|
+ deliverNameBuf.append(shipper.getShipperName().trim());
|
|
|
|
|
+ return resolved;
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.warn("快递单号识别异常,回退 OMS 承运商编码,订单号:{},deliveryId:{},{}", orderCodeForLog, deliveryId, e.getMessage());
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
public void deliveryOrder(String orderCode, String deliveryId, String deliverCode, String deliverName) {
|
|
public void deliveryOrder(String orderCode, String deliveryId, String deliverCode, String deliverName) {
|
|
|
FsStoreOrderScrm order = fsStoreOrderMapper.selectFsStoreOrderByOrderCode(orderCode);
|
|
FsStoreOrderScrm order = fsStoreOrderMapper.selectFsStoreOrderByOrderCode(orderCode);
|
|
|
if (order != null && order.getStatus() == OrderInfoEnum.STATUS_1.getValue()) {
|
|
if (order != null && order.getStatus() == OrderInfoEnum.STATUS_1.getValue()) {
|
|
|
- FsExpressScrm express = selectExpressByOmsDeliverCode(deliverCode);
|
|
|
|
|
|
|
+ StringBuilder kdnDeliverName = new StringBuilder();
|
|
|
|
|
+ FsExpressScrm express = tryResolveExpressByLogisticCode(deliveryId, orderCode, kdnDeliverName);
|
|
|
|
|
+ if (express == null) {
|
|
|
|
|
+ express = selectExpressByOmsDeliverCode(deliverCode);
|
|
|
|
|
+ }
|
|
|
if (express == null) {
|
|
if (express == null) {
|
|
|
// 这里输出订单号 还有相关的物流信息,
|
|
// 这里输出订单号 还有相关的物流信息,
|
|
|
log.error("发货失败:未找到快递公司,订单号:{},deliveryId:{},deliverCode:{},deliverName:{}", orderCode, deliveryId, deliverCode, deliverName);
|
|
log.error("发货失败:未找到快递公司,订单号:{},deliveryId:{},deliverCode:{},deliverName:{}", orderCode, deliveryId, deliverCode, deliverName);
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
+ if (kdnDeliverName.length() > 0) {
|
|
|
|
|
+ deliverName = kdnDeliverName.toString();
|
|
|
|
|
+ }
|
|
|
if (express != null) {
|
|
if (express != null) {
|
|
|
order.setDeliveryName(deliverName);
|
|
order.setDeliveryName(deliverName);
|
|
|
order.setDeliverySn(express.getCode());
|
|
order.setDeliverySn(express.getCode());
|
|
@@ -2144,7 +2241,7 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
|
|
|
//发货时间待定
|
|
//发货时间待定
|
|
|
order.setDeliverySendTime(new Date());
|
|
order.setDeliverySendTime(new Date());
|
|
|
|
|
|
|
|
- fsStoreOrderMapper.updateFsStoreOrder(order);
|
|
|
|
|
|
|
+ this.updateFsStoreOrder(order);
|
|
|
orderStatusService.create(order.getId(), OrderLogEnum.DELIVERY_GOODS.getValue(),
|
|
orderStatusService.create(order.getId(), OrderLogEnum.DELIVERY_GOODS.getValue(),
|
|
|
OrderLogEnum.DELIVERY_GOODS.getDesc());
|
|
OrderLogEnum.DELIVERY_GOODS.getDesc());
|
|
|
//订阅物流回调
|
|
//订阅物流回调
|
|
@@ -2188,8 +2285,15 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
|
|
|
public void updateDeliveryOrder(Long id, String deliveryId, String deliverCode, String deliverName) {
|
|
public void updateDeliveryOrder(Long id, String deliveryId, String deliverCode, String deliverName) {
|
|
|
FsStoreOrderScrm order = fsStoreOrderMapper.selectFsStoreOrderById(id);
|
|
FsStoreOrderScrm order = fsStoreOrderMapper.selectFsStoreOrderById(id);
|
|
|
if (order != null) {
|
|
if (order != null) {
|
|
|
- FsExpressScrm express = selectExpressByOmsDeliverCode(deliverCode);
|
|
|
|
|
|
|
+ StringBuilder kdnDeliverName = new StringBuilder();
|
|
|
|
|
+ FsExpressScrm express = tryResolveExpressByLogisticCode(deliveryId, order.getOrderCode(), kdnDeliverName);
|
|
|
|
|
+ if (express == null) {
|
|
|
|
|
+ express = selectExpressByOmsDeliverCode(deliverCode);
|
|
|
|
|
+ }
|
|
|
if (express != null) {
|
|
if (express != null) {
|
|
|
|
|
+ if (kdnDeliverName.length() > 0) {
|
|
|
|
|
+ deliverName = kdnDeliverName.toString();
|
|
|
|
|
+ }
|
|
|
order.setDeliveryName(deliverName);
|
|
order.setDeliveryName(deliverName);
|
|
|
order.setDeliverySn(express.getCode());
|
|
order.setDeliverySn(express.getCode());
|
|
|
order.setDeliveryId(deliveryId);
|
|
order.setDeliveryId(deliveryId);
|
|
@@ -2653,39 +2757,14 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
|
|
|
if (order.getStatus() == OrderInfoEnum.STATUS_2.getValue()) {
|
|
if (order.getStatus() == OrderInfoEnum.STATUS_2.getValue()) {
|
|
|
order.setFinishTime(new Date());
|
|
order.setFinishTime(new Date());
|
|
|
order.setStatus(3);
|
|
order.setStatus(3);
|
|
|
- fsStoreOrderMapper.updateFsStoreOrder(order);
|
|
|
|
|
|
|
+ this.updateFsStoreOrder(order);
|
|
|
orderStatusService.create(order.getId(), OrderLogEnum.FINISH_ORDER.getValue(),
|
|
orderStatusService.create(order.getId(), OrderLogEnum.FINISH_ORDER.getValue(),
|
|
|
OrderLogEnum.FINISH_ORDER.getDesc());
|
|
OrderLogEnum.FINISH_ORDER.getDesc());
|
|
|
//写入公司余额 条件是只有全款订单才分,非全款后台导入
|
|
//写入公司余额 条件是只有全款订单才分,非全款后台导入
|
|
|
if (order.getCompanyId() != null && order.getCompanyId() > 0 && order.getPayDelivery().compareTo(new BigDecimal(0)) == 0) {
|
|
if (order.getCompanyId() != null && order.getCompanyId() > 0 && order.getPayDelivery().compareTo(new BigDecimal(0)) == 0) {
|
|
|
if (order.getTuiMoneyStatus() == null || order.getTuiMoneyStatus() != 1) {
|
|
if (order.getTuiMoneyStatus() == null || order.getTuiMoneyStatus() != 1) {
|
|
|
- // 检查商品是否有"不分润"标签,有则不增加公司余额
|
|
|
|
|
- boolean noCommission = false;
|
|
|
|
|
- try {
|
|
|
|
|
- if (StringUtils.isNotBlank(order.getItemJson())) {
|
|
|
|
|
- com.alibaba.fastjson.JSONArray itemArray = JSON.parseArray(order.getItemJson());
|
|
|
|
|
- if (itemArray != null && !itemArray.isEmpty()) {
|
|
|
|
|
- Long productId = itemArray.getJSONObject(0).getLong("productId");
|
|
|
|
|
- if (productId != null) {
|
|
|
|
|
- FsStoreProductScrm product = productService.selectFsStoreProductById(productId);
|
|
|
|
|
- if (product != null && StringUtils.isNotBlank(product.getTagInfo())) {
|
|
|
|
|
- JSONObject tagObj = JSON.parseObject(product.getTagInfo());
|
|
|
|
|
- Object typeObj = tagObj.get("type");
|
|
|
|
|
- if (typeObj instanceof com.alibaba.fastjson.JSONArray) {
|
|
|
|
|
- noCommission = ((com.alibaba.fastjson.JSONArray) typeObj).contains("no_commission");
|
|
|
|
|
- } else if (typeObj instanceof String) {
|
|
|
|
|
- noCommission = "no_commission".equals(typeObj);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- } catch (Exception e) {
|
|
|
|
|
- log.error("检查商品不分润标签失败:{},订单号:{}", e.getMessage(), order.getOrderCode());
|
|
|
|
|
- }
|
|
|
|
|
- if (!noCommission) {
|
|
|
|
|
- companyService.addCompanyMoney(order);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ attachNoCommissionProductFlag(order);
|
|
|
|
|
+ companyService.addCompanyMoney(order);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
//套餐包赠送积分
|
|
//套餐包赠送积分
|
|
@@ -2734,6 +2813,40 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 根据订单首个商品的 tagInfo 设置不分润标记;分佣仍走 {@link ICompanyService#addCompanyMoney(FsStoreOrderScrm)},
|
|
|
|
|
+ * 佣金按 0 入账并写入公司资金流水。
|
|
|
|
|
+ */
|
|
|
|
|
+ private void attachNoCommissionProductFlag(FsStoreOrderScrm order) {
|
|
|
|
|
+ order.setNoCommission(Boolean.FALSE);
|
|
|
|
|
+ try {
|
|
|
|
|
+ if (StringUtils.isNotBlank(order.getItemJson())) {
|
|
|
|
|
+ com.alibaba.fastjson.JSONArray itemArray = JSON.parseArray(order.getItemJson());
|
|
|
|
|
+ if (itemArray != null && !itemArray.isEmpty()) {
|
|
|
|
|
+ Long productId = itemArray.getJSONObject(0).getLong("productId");
|
|
|
|
|
+ if (productId != null) {
|
|
|
|
|
+ FsStoreProductScrm product = productService.selectFsStoreProductById(productId);
|
|
|
|
|
+ if (product != null && StringUtils.isNotBlank(product.getTagInfo())) {
|
|
|
|
|
+ JSONObject tagObj = JSON.parseObject(product.getTagInfo());
|
|
|
|
|
+ Object typeObj = tagObj.get("type");
|
|
|
|
|
+ if (typeObj instanceof com.alibaba.fastjson.JSONArray) {
|
|
|
|
|
+ if (((com.alibaba.fastjson.JSONArray) typeObj).contains("no_commission")) {
|
|
|
|
|
+ order.setNoCommission(Boolean.TRUE);
|
|
|
|
|
+ }
|
|
|
|
|
+ } else if (typeObj instanceof String) {
|
|
|
|
|
+ if ("no_commission".equals(typeObj)) {
|
|
|
|
|
+ order.setNoCommission(Boolean.TRUE);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.error("检查商品不分润标签失败:{},订单号:{}", e.getMessage(), order.getOrderCode());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 套餐包赠送积分
|
|
* 套餐包赠送积分
|
|
|
* @param order
|
|
* @param order
|
|
@@ -3570,7 +3683,7 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
|
|
|
map.setDeliverySn(response.getOrders().get(0).getDeliverys().get(0).getExpress_code());
|
|
map.setDeliverySn(response.getOrders().get(0).getDeliverys().get(0).getExpress_code());
|
|
|
map.setDeliveryName(response.getOrders().get(0).getDeliverys().get(0).getExpress_name());
|
|
map.setDeliveryName(response.getOrders().get(0).getDeliverys().get(0).getExpress_name());
|
|
|
map.setDeliveryId(response.getOrders().get(0).getDeliverys().get(0).getMail_no());
|
|
map.setDeliveryId(response.getOrders().get(0).getDeliverys().get(0).getMail_no());
|
|
|
- fsStoreOrderMapper.updateFsStoreOrder(map);
|
|
|
|
|
|
|
+ this.updateFsStoreOrder(map);
|
|
|
orderStatusService.create(order.getId(), OrderLogEnum.DELIVERY_GOODS.getValue(),
|
|
orderStatusService.create(order.getId(), OrderLogEnum.DELIVERY_GOODS.getValue(),
|
|
|
OrderLogEnum.DELIVERY_GOODS.getDesc());
|
|
OrderLogEnum.DELIVERY_GOODS.getDesc());
|
|
|
TemplateBean templateBean = TemplateBean.builder()
|
|
TemplateBean templateBean = TemplateBean.builder()
|
|
@@ -3636,6 +3749,7 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
|
|
|
}
|
|
}
|
|
|
if (order.getCompanyId() != null && order.getCompanyId() > 0 && order.getPayDelivery().compareTo(new BigDecimal(0)) == 0) {
|
|
if (order.getCompanyId() != null && order.getCompanyId() > 0 && order.getPayDelivery().compareTo(new BigDecimal(0)) == 0) {
|
|
|
if (order.getTuiMoneyStatus() == null || order.getTuiMoneyStatus() != 1) {
|
|
if (order.getTuiMoneyStatus() == null || order.getTuiMoneyStatus() != 1) {
|
|
|
|
|
+ attachNoCommissionProductFlag(order);
|
|
|
companyService.addCompanyMoney(order);
|
|
companyService.addCompanyMoney(order);
|
|
|
return R.ok();
|
|
return R.ok();
|
|
|
} else {
|
|
} else {
|
|
@@ -3965,6 +4079,7 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
|
|
|
this.updateFsStoreOrder(orderMap);
|
|
this.updateFsStoreOrder(orderMap);
|
|
|
//未分佣写入分佣
|
|
//未分佣写入分佣
|
|
|
if (order.getCompanyId() != null && order.getCompanyId() > 0) {
|
|
if (order.getCompanyId() != null && order.getCompanyId() > 0) {
|
|
|
|
|
+ attachNoCommissionProductFlag(order);
|
|
|
companyService.addCompanyMoney(order);
|
|
companyService.addCompanyMoney(order);
|
|
|
}
|
|
}
|
|
|
successNum++;
|
|
successNum++;
|
|
@@ -4920,6 +5035,9 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
|
|
|
}
|
|
}
|
|
|
FsStoreScrm store = fsStoreMapper.selectFsStoreByStoreId(o.getStoreId());
|
|
FsStoreScrm store = fsStoreMapper.selectFsStoreByStoreId(o.getStoreId());
|
|
|
int i = fsStoreOrderMapper.updateFsStoreOrderByOrderCode(fsStoreOrder);
|
|
int i = fsStoreOrderMapper.updateFsStoreOrderByOrderCode(fsStoreOrder);
|
|
|
|
|
+ if (i > 0) {
|
|
|
|
|
+ safeSendExpressInfoToWx(o.getId());
|
|
|
|
|
+ }
|
|
|
String lastFourNumber = "";
|
|
String lastFourNumber = "";
|
|
|
if (fsStoreOrder.getDeliveryCode().equals(com.fs.his.enums.ShipperCodeEnum.SF.getValue()) || fsStoreOrder.getDeliveryCode().equals(ShipperCodeEnum.ZTO.getValue())) {
|
|
if (fsStoreOrder.getDeliveryCode().equals(com.fs.his.enums.ShipperCodeEnum.SF.getValue()) || fsStoreOrder.getDeliveryCode().equals(ShipperCodeEnum.ZTO.getValue())) {
|
|
|
if (store.getSendPhone() != null) {
|
|
if (store.getSendPhone() != null) {
|
|
@@ -5009,7 +5127,7 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
|
|
|
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
String dateString = formatter.format(new Date());
|
|
String dateString = formatter.format(new Date());
|
|
|
o1.setDeliveryTime(dateString);
|
|
o1.setDeliveryTime(dateString);
|
|
|
- int i = fsStoreOrderMapper.updateFsStoreOrder(o1);
|
|
|
|
|
|
|
+ int i = this.updateFsStoreOrder(o1);
|
|
|
if (order.getCompanyId() != null) {
|
|
if (order.getCompanyId() != null) {
|
|
|
companyService.subtractCompanyMoneyScrm(order);
|
|
companyService.subtractCompanyMoneyScrm(order);
|
|
|
}
|
|
}
|
|
@@ -5044,6 +5162,7 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
|
|
|
log.info("确认收货:" + orderId);
|
|
log.info("确认收货:" + orderId);
|
|
|
if (order.getCompanyId() != null && order.getTuiMoneyStatus() == 0 && "1".equals(order.getPayType())) {
|
|
if (order.getCompanyId() != null && order.getTuiMoneyStatus() == 0 && "1".equals(order.getPayType())) {
|
|
|
log.info("分佣:" + orderId);
|
|
log.info("分佣:" + orderId);
|
|
|
|
|
+ attachNoCommissionProductFlag(order);
|
|
|
companyService.addCompanyMoney(order);
|
|
companyService.addCompanyMoney(order);
|
|
|
o1.setTuiMoneyTime(new Date());
|
|
o1.setTuiMoneyTime(new Date());
|
|
|
}
|
|
}
|
|
@@ -7287,4 +7406,98 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public R sendExpressInfoToWx(@PathVariable Long orderId) {
|
|
|
|
|
+ boolean isSend = redisCache.setIfAbsent("fs:express:info:send:" + orderId, "1", 2, TimeUnit.MINUTES);
|
|
|
|
|
+ if (isSend) {
|
|
|
|
|
+ FsStoreOrderScrm order = fsStoreOrderMapper.selectFsStoreOrderById(orderId);
|
|
|
|
|
+ if (order != null && order.getUserId() != null) {
|
|
|
|
|
+ List<QwExternalContact> qwExternalContact = qwExternalContactMapper.selectQwExternalContactByFsUserIdAndCompany(order.getUserId(), order.getCompanyUserId());
|
|
|
|
|
+ if (qwExternalContact != null && !qwExternalContact.isEmpty()) {
|
|
|
|
|
+ for (QwExternalContact externalContact : qwExternalContact) {
|
|
|
|
|
+ Long qwUserId = externalContact.getQwUserId();
|
|
|
|
|
+ if (qwUserId != null) {
|
|
|
|
|
+ QwUser qwUser = qwUserMapper.selectQwUserById(qwUserId);
|
|
|
|
|
+ if (qwUser != null && qwUser.getUid() != null && qwUser.getFastGptRoleId() != null && qwUser.getServerId() != null && qwUser.getServerStatus() == 1 && qwUser.getIpadStatus() == 1) {
|
|
|
|
|
+ FastGptRole fastGptRole = fastGptRoleMapper.selectFastGptRoleByRoleId(qwUser.getFastGptRoleId());
|
|
|
|
|
+ if (fastGptRole.getLogistics() == 0) {
|
|
|
|
|
+ log.error("物流功能未开启,roleId:" + qwUser.getFastGptRoleId() + "订单号:" + orderId);
|
|
|
|
|
+ return R.ok();
|
|
|
|
|
+ }
|
|
|
|
|
+ WxWorkUserId2VidDTO wxWorkUserId2VidDTO = new WxWorkUserId2VidDTO();
|
|
|
|
|
+ wxWorkUserId2VidDTO.setOpenid(Collections.singletonList(externalContact.getExternalUserId()));
|
|
|
|
|
+ wxWorkUserId2VidDTO.setUuid(qwUser.getUid());
|
|
|
|
|
+ WxWorkResponseDTO<List<WxWorkVid2UserIdRespDTO>> WxWorkVid2UserIdRespDTO = wxWorkService.UserId2Vid(wxWorkUserId2VidDTO, qwUser.getServerId());
|
|
|
|
|
+ List<WxWorkVid2UserIdRespDTO> data = WxWorkVid2UserIdRespDTO.getData();
|
|
|
|
|
+ StringBuilder sBuilder = new StringBuilder();
|
|
|
|
|
+ if (data != null && !data.isEmpty()) {
|
|
|
|
|
+ Long sendId = data.get(0).getUser_id();
|
|
|
|
|
+ switch (order.getStatus()) {
|
|
|
|
|
+ case -1:
|
|
|
|
|
+ case -2:
|
|
|
|
|
+ case 1:
|
|
|
|
|
+ break;
|
|
|
|
|
+ case 2:
|
|
|
|
|
+ sBuilder.append("您好,您有一个包裹正在准备发货,请耐心等待;\n");
|
|
|
|
|
+ if (order.getDeliveryId() != null && !order.getDeliveryId().isEmpty()) {
|
|
|
|
|
+ sBuilder.append(" 物流单号为:").append(order.getDeliveryId()).append("\n");
|
|
|
|
|
+ }
|
|
|
|
|
+ sBuilder.append("\uD83C\uDF39\uD83C\uDF39\uD83C\uDF39");
|
|
|
|
|
+ break;
|
|
|
|
|
+ case 3:
|
|
|
|
|
+ String lastFourNumber = "";
|
|
|
|
|
+ if (order.getDeliverySn().equals(ShipperCodeEnum.SF.getValue()) || order.getDeliverySn().equals(ShipperCodeEnum.ZTO.getValue())) {
|
|
|
|
|
+ if("恒春来".equals(cloudHostProper.getCompanyName())
|
|
|
|
|
+ && ObjectUtil.isNotEmpty(lastFourNumber = order.getVirtualPhone())){
|
|
|
|
|
+ if (lastFourNumber.contains("-")) {
|
|
|
|
|
+ lastFourNumber = lastFourNumber.length() >= 4 ? lastFourNumber.substring(lastFourNumber.length() - 4) : lastFourNumber;
|
|
|
|
|
+ }else{
|
|
|
|
|
+ lastFourNumber = StrUtil.sub(lastFourNumber, lastFourNumber.length(), -4);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ // 原逻辑
|
|
|
|
|
+ else if ((lastFourNumber = order.getUserPhone()).length() == 11) {
|
|
|
|
|
+ lastFourNumber = StrUtil.sub(lastFourNumber, lastFourNumber.length(), -4);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ ExpressInfoDTO express = expressService.getExpressInfo(order.getOrderCode(), order.getDeliverySn(), order.getDeliveryId(), lastFourNumber);
|
|
|
|
|
+ if (express != null && "211".equals(express.getStateEx())) {
|
|
|
|
|
+ sBuilder.append("这边查询到您有一个包裹 ");
|
|
|
|
|
+ if (express.getTraces() != null && !express.getTraces().isEmpty()) {
|
|
|
|
|
+ List<com.fs.hisStore.dto.TracesDTO> traces = express.getTraces();
|
|
|
|
|
+ TracesDTO tracesDTO = traces.get(traces.size() - 1);
|
|
|
|
|
+ sBuilder.append(" 在").append(tracesDTO.getAcceptTime()).append("已经送到了\n");
|
|
|
|
|
+ sBuilder.append(" 物流单号为:").append(order.getDeliveryId()).append("\n");
|
|
|
|
|
+ sBuilder.append("物流信息:").append(tracesDTO.getAcceptStation()).append("\n");
|
|
|
|
|
+ } else {
|
|
|
|
|
+ sBuilder.append(" 已经送到了\n");
|
|
|
|
|
+ }
|
|
|
|
|
+ sBuilder.append("\uD83C\uDF39\uD83C\uDF39\uD83C\uDF39");
|
|
|
|
|
+ }
|
|
|
|
|
+ break;
|
|
|
|
|
+ case 4:
|
|
|
|
|
+ case 5:
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!"".contentEquals(sBuilder)) {
|
|
|
|
|
+ String content = sBuilder.toString();
|
|
|
|
|
+ content = content.replace("(有事呼叫我,勿找平台,少一次投诉,多一份感恩)", "");
|
|
|
|
|
+ WxWorkSendTextMsgDTO wxWorkSendTextMsgDTO = new WxWorkSendTextMsgDTO();
|
|
|
|
|
+ wxWorkSendTextMsgDTO.setSend_userid(sendId);
|
|
|
|
|
+ wxWorkSendTextMsgDTO.setUuid(qwUser.getUid());
|
|
|
|
|
+ wxWorkSendTextMsgDTO.setContent(content);
|
|
|
|
|
+ wxWorkSendTextMsgDTO.setIsRoom(false);
|
|
|
|
|
+ wxWorkService.SendTextMsg(wxWorkSendTextMsgDTO, qwUser.getServerId());
|
|
|
|
|
+ }
|
|
|
|
|
+ return R.ok();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return R.ok();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|