parent
931cc698f4
commit
4211df4a3b
@ -0,0 +1,21 @@ |
|||||||
|
package com.hai.order.service; |
||||||
|
|
||||||
|
import com.hai.entity.HighOrder; |
||||||
|
|
||||||
|
/** |
||||||
|
* @className: OrderPayBeforeService |
||||||
|
* @author: HuRui |
||||||
|
* @date: 2023/1/11 |
||||||
|
**/ |
||||||
|
public interface OrderPayBeforeService { |
||||||
|
|
||||||
|
/** |
||||||
|
* 支付订单前置校验校验 |
||||||
|
* @param order |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
void payOrderCheck(HighOrder order); |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} |
@ -1,4 +1,4 @@ |
|||||||
package com.hai.order.service.impl; |
package com.hai.order.service; |
||||||
|
|
||||||
import com.hai.entity.HighOrder; |
import com.hai.entity.HighOrder; |
||||||
import com.hai.entity.HighUserCard; |
import com.hai.entity.HighUserCard; |
@ -0,0 +1,81 @@ |
|||||||
|
package com.hai.order.service.impl; |
||||||
|
|
||||||
|
import com.hai.common.exception.ErrorCode; |
||||||
|
import com.hai.common.exception.ErrorHelp; |
||||||
|
import com.hai.common.exception.SysCode; |
||||||
|
import com.hai.config.WxOrderConfig; |
||||||
|
import com.hai.entity.HighChildOrder; |
||||||
|
import com.hai.entity.HighGasChannelConfig; |
||||||
|
import com.hai.entity.HighMerchantTripartitePlatform; |
||||||
|
import com.hai.entity.HighOrder; |
||||||
|
import com.hai.enum_type.GasChannel; |
||||||
|
import com.hai.enum_type.GasChannelPayPlatformType; |
||||||
|
import com.hai.enum_type.MerchantStoreSourceType; |
||||||
|
import com.hai.model.HighMerchantStoreModel; |
||||||
|
import com.hai.order.service.OrderPayBeforeService; |
||||||
|
import com.hai.order.type.OrderProductType; |
||||||
|
import com.hai.service.HighGasChannelConfigService; |
||||||
|
import com.hai.service.HighGasService; |
||||||
|
import com.hai.service.HighMerchantStoreService; |
||||||
|
import org.springframework.stereotype.Service; |
||||||
|
|
||||||
|
/** |
||||||
|
* @className: payOrderCheckImpl |
||||||
|
* @author: HuRui |
||||||
|
* @date: 2023/1/11 |
||||||
|
**/ |
||||||
|
@Service("orderPayBeforeService") |
||||||
|
public class OrderPayBeforeServiceImpl implements OrderPayBeforeService { |
||||||
|
|
||||||
|
private HighMerchantStoreService merchantStoreService; |
||||||
|
|
||||||
|
private HighGasService gasService; |
||||||
|
|
||||||
|
private HighGasChannelConfigService gasChannelConfigService; |
||||||
|
|
||||||
|
@Override |
||||||
|
public void payOrderCheck(HighOrder order) { |
||||||
|
if (order.getProductType().equals(OrderProductType.PRODUCT_TYPE6.getNumber())) { |
||||||
|
// 查询油站
|
||||||
|
HighMerchantStoreModel store = merchantStoreService.getMerchantStoreById(order.getHighChildOrderList().get(0).getGoodsId()); |
||||||
|
if (store == null) { |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的加油站"); |
||||||
|
} |
||||||
|
if (order.getTotalPrice().compareTo(gasService.getMerPriceByMerId(store.getMerchantId())) == 1) { |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "暂时无法进行支付,请联系平台客服"); |
||||||
|
} |
||||||
|
|
||||||
|
if (store.getSourceType().equals(MerchantStoreSourceType.type1.getNumber())) { |
||||||
|
// 查询支付配置
|
||||||
|
HighGasChannelConfig gasChannelConfig = gasChannelConfigService.getConfig(GasChannel.type1, GasChannelPayPlatformType.type1 ); |
||||||
|
if (gasChannelConfig == null) { |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未配置支付参数,请稍后重试!"); |
||||||
|
} |
||||||
|
|
||||||
|
} else if (store.getSourceType().equals(MerchantStoreSourceType.type2.getNumber())) { |
||||||
|
// 查询支付配置
|
||||||
|
HighGasChannelConfig gasChannelConfig = gasChannelConfigService.getConfig(GasChannel.type2,GasChannelPayPlatformType.type1 ); |
||||||
|
if (gasChannelConfig == null) { |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未配置支付参数,请稍后重试!"); |
||||||
|
} |
||||||
|
|
||||||
|
} else if (store.getSourceType().equals(MerchantStoreSourceType.type3.getNumber())) { |
||||||
|
// 查询支付配置
|
||||||
|
HighGasChannelConfig gasChannelConfig = gasChannelConfigService.getConfig(GasChannel.type3,GasChannelPayPlatformType.type1 ); |
||||||
|
if (gasChannelConfig == null) { |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未配置支付参数,请稍后重试!"); |
||||||
|
} |
||||||
|
|
||||||
|
} else if (store.getSourceType().equals(MerchantStoreSourceType.type4.getNumber())) { |
||||||
|
// 查询支付配置
|
||||||
|
HighGasChannelConfig gasChannelConfig = gasChannelConfigService.getConfig(GasChannel.type4,GasChannelPayPlatformType.type1 ); |
||||||
|
if (gasChannelConfig == null) { |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未配置支付参数,请稍后重试!"); |
||||||
|
} |
||||||
|
} else { |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未配置支付参数,请稍后重试!"); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue