|
|
@@ -1301,6 +1301,17 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
|
|
|
storeOrder.setOrderType(param.getOrderType());
|
|
|
storeOrder.setOrderMedium(param.getOrderMedium());
|
|
|
}
|
|
|
+
|
|
|
+ // 商城订单归属绑定
|
|
|
+ if (hisStoreConfig != null && Boolean.TRUE.equals(hisStoreConfig.getEnableStoreOrderAttribution())
|
|
|
+ && storeOrder.getOrderType() == null ) {
|
|
|
+ try {
|
|
|
+ bindStoreOrderAttribution(storeOrder, userId);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("商城订单归属绑定异常,订单号:{},用户ID:{}", storeOrder.getOrderCode(), userId, e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
Integer flag = fsStoreOrderMapper.insertFsStoreOrder(storeOrder);
|
|
|
if (flag == 0) {
|
|
|
return R.error("订单创建失败");
|
|
|
@@ -1373,15 +1384,6 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
|
|
|
orderStatusService.create(storeOrder.getId(), OrderLogEnum.CREATE_ORDER.getValue(),
|
|
|
OrderLogEnum.CREATE_ORDER.getDesc());
|
|
|
|
|
|
- // 商城订单归属绑定
|
|
|
- if (Boolean.TRUE.equals(config.getEnableStoreOrderAttribution())
|
|
|
- && storeOrder.getOrderType() != null && storeOrder.getOrderType() == 0) {
|
|
|
- try {
|
|
|
- bindStoreOrderAttribution(storeOrder, userId);
|
|
|
- } catch (Exception e) {
|
|
|
- log.error("商城订单归属绑定异常,订单号:{},用户ID:{}", storeOrder.getOrderCode(), userId, e);
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
//加入redis,24小时自动取消
|
|
|
String redisKey = String.valueOf(StrUtil.format("{}{}",
|
|
|
@@ -2755,9 +2757,15 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
|
|
|
public R finishStoreOrder(Long orderId) {
|
|
|
FsStoreOrderScrm order = fsStoreOrderMapper.selectFsStoreOrderById(orderId);
|
|
|
if (order.getStatus() == OrderInfoEnum.STATUS_2.getValue()) {
|
|
|
- order.setFinishTime(new Date());
|
|
|
- order.setStatus(3);
|
|
|
- this.updateFsStoreOrder(order);
|
|
|
+ Date finishTime = new Date();
|
|
|
+ // 仅更新状态/完成时间,避免把支付时 addCompanyTuiMoney 写入的 tui_money 随全量对象再次落库
|
|
|
+ FsStoreOrderScrm statusUpdate = new FsStoreOrderScrm();
|
|
|
+ statusUpdate.setId(order.getId());
|
|
|
+ statusUpdate.setFinishTime(finishTime);
|
|
|
+ statusUpdate.setStatus(OrderInfoEnum.STATUS_3.getValue());
|
|
|
+ this.updateFsStoreOrder(statusUpdate);
|
|
|
+ order.setFinishTime(finishTime);
|
|
|
+ order.setStatus(OrderInfoEnum.STATUS_3.getValue());
|
|
|
orderStatusService.create(order.getId(), OrderLogEnum.FINISH_ORDER.getValue(),
|
|
|
OrderLogEnum.FINISH_ORDER.getDesc());
|
|
|
//写入公司余额 条件是只有全款订单才分,非全款后台导入
|
|
|
@@ -2955,6 +2963,7 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
|
|
|
}
|
|
|
//写入公司佣金 当有归属公司时只进行公司分佣
|
|
|
if (order.getCompanyId() != null && order.getCompanyId() > 0) {
|
|
|
+ attachNoCommissionProductFlag(order);
|
|
|
companyService.addCompanyTuiMoney(order);
|
|
|
} else if (order.getIsPackage() != 1 && order.getTuiUserId() != null && order.getTuiUserId() > 0) {
|
|
|
FsStoreOrderItemScrm orderItemMap = new FsStoreOrderItemScrm();
|