update 订单逻辑改造工厂模式

This commit is contained in:
2023-09-01 15:45:04 +08:00
parent fbe05c8c6b
commit fbe64887f5
6 changed files with 39 additions and 12 deletions

View File

@@ -110,7 +110,9 @@ public interface IPileMerchantInfoService {
String getDelayModeByWechatAppId(String wechatAppId);
/**
String getDelayModeByMerchantId(String merchantId);
/**
* 通过merchantId获取一级运营商信息
*/
PileMerchantInfo getFirstLevelMerchantByMerchantId(String merchantId);

View File

@@ -38,6 +38,8 @@ import com.jsowell.pile.domain.*;
import com.jsowell.pile.dto.*;
import com.jsowell.pile.mapper.OrderBasicInfoMapper;
import com.jsowell.pile.service.*;
import com.jsowell.pile.service.orderlogic.AbstractOrderLogic;
import com.jsowell.pile.service.orderlogic.OrderLogicFactory;
import com.jsowell.pile.transaction.dto.ClearingBillTransactionDTO;
import com.jsowell.pile.transaction.dto.OrderTransactionDTO;
import com.jsowell.pile.transaction.service.TransactionService;
@@ -445,7 +447,12 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
.flatUsedElectricity(Constants.ZERO)
.valleyUsedElectricity(Constants.ZERO)
.build();
settleOrder(data, orderInfo);
// settleOrder(data, orderInfo);
// 新逻辑
String mode = pileMerchantInfoService.getDelayModeByMerchantId(orderInfo.getMerchantId());
AbstractOrderLogic orderLogic = OrderLogicFactory.getOrderLogic(mode);
orderLogic.settleOrder(data, orderInfo);
}
/**

View File

@@ -422,6 +422,20 @@ public class PileMerchantInfoServiceImpl implements IPileMerchantInfoService {
return merchant.getDelayMode();
}
/**
* 通过运营商id查询一级运营商配置的delayMode
* @param merchantId
* @return
*/
@Override
public String getDelayModeByMerchantId(String merchantId) {
PileMerchantInfo merchant = getFirstLevelMerchantByMerchantId(merchantId);
if (merchant == null) {
return null;
}
return merchant.getAppId();
}
@Override
public PileMerchantInfo getFirstLevelMerchantByMerchantId(String merchantId) {
if (StringUtils.isBlank(merchantId)) {