mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-07-03 21:48:13 +08:00
update订单逻辑改造工厂模式
This commit is contained in:
@@ -127,6 +127,7 @@ public class PayController extends BaseController {
|
|||||||
if (isLock) {
|
if (isLock) {
|
||||||
String appId = request.getHeader("appId");
|
String appId = request.getHeader("appId");
|
||||||
dto.setWechatAppId(appId);
|
dto.setWechatAppId(appId);
|
||||||
|
map = orderService.payOrderV2(dto);
|
||||||
map = orderService.payOrder(dto);
|
map = orderService.payOrder(dto);
|
||||||
}
|
}
|
||||||
response = new RestApiResponse<>(map);
|
response = new RestApiResponse<>(map);
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import com.jsowell.common.constant.Constants;
|
|||||||
import com.jsowell.common.core.page.PageResponse;
|
import com.jsowell.common.core.page.PageResponse;
|
||||||
import com.jsowell.common.core.redis.RedisCache;
|
import com.jsowell.common.core.redis.RedisCache;
|
||||||
import com.jsowell.common.enums.TitleTypeEnum;
|
import com.jsowell.common.enums.TitleTypeEnum;
|
||||||
|
import com.jsowell.common.enums.adapay.MerchantDelayModeEnum;
|
||||||
import com.jsowell.common.enums.uniapp.BalanceChangesEnum;
|
import com.jsowell.common.enums.uniapp.BalanceChangesEnum;
|
||||||
import com.jsowell.common.enums.ykc.OrderStatusEnum;
|
import com.jsowell.common.enums.ykc.OrderStatusEnum;
|
||||||
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
|
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
|
||||||
@@ -609,8 +610,8 @@ public class MemberService {
|
|||||||
log.info("使用汇付支付充值余额 支付配置参数:{}", JSON.toJSONString(config));
|
log.info("使用汇付支付充值余额 支付配置参数:{}", JSON.toJSONString(config));
|
||||||
|
|
||||||
// 查询延时支付模式,由一级运营商配置决定
|
// 查询延时支付模式,由一级运营商配置决定
|
||||||
String payMode = pileMerchantInfoService.getDelayModeByWechatAppId(dto.getWechatAppId());
|
String delayMode = pileMerchantInfoService.getDelayModeByWechatAppId(dto.getWechatAppId());
|
||||||
|
String payMode = MerchantDelayModeEnum.getAdapayPayMode(delayMode);
|
||||||
// 封装对象
|
// 封装对象
|
||||||
// String payMode = Constants.ADAPAY_PAY_MODE_DELAY; // 汇付延时分账
|
// String payMode = Constants.ADAPAY_PAY_MODE_DELAY; // 汇付延时分账
|
||||||
CreateAdaPaymentParam createAdaPaymentParam = new CreateAdaPaymentParam();
|
CreateAdaPaymentParam createAdaPaymentParam = new CreateAdaPaymentParam();
|
||||||
|
|||||||
@@ -120,6 +120,9 @@ public class OrderService {
|
|||||||
@Resource
|
@Resource
|
||||||
private OrderPileOccupyService orderPileOccupyService;
|
private OrderPileOccupyService orderPileOccupyService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IPileMerchantInfoService pileMerchantInfoService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private RedisCache redisCache;
|
private RedisCache redisCache;
|
||||||
|
|
||||||
@@ -1206,4 +1209,11 @@ public class OrderService {
|
|||||||
public Map<String, Object> payOccupyPileOrder(PayOrderDTO dto) {
|
public Map<String, Object> payOccupyPileOrder(PayOrderDTO dto) {
|
||||||
return orderPileOccupyService.payOccupyPileOrder(dto);
|
return orderPileOccupyService.payOccupyPileOrder(dto);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Map<String, Object> payOrderV2(PayOrderDTO dto) {
|
||||||
|
String mode = pileMerchantInfoService.getDelayModeByWechatAppId(dto.getWechatAppId());
|
||||||
|
// 获取处理逻辑
|
||||||
|
// OrderLogicFactory.getOrderLogic();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,58 @@
|
|||||||
|
package com.jsowell.common.enums.adapay;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 汇付支付 分账模式
|
||||||
|
*/
|
||||||
|
|
||||||
|
public enum MerchantDelayModeEnum {
|
||||||
|
DELAY("1", "延时分账", "delay"),
|
||||||
|
NOT_DELAY("0", "非延时分账", null),
|
||||||
|
;
|
||||||
|
private String value;
|
||||||
|
private String label;
|
||||||
|
private String mode;
|
||||||
|
|
||||||
|
public String getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValue(String value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLabel() {
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLabel(String label) {
|
||||||
|
this.label = label;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMode() {
|
||||||
|
return mode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMode(String mode) {
|
||||||
|
this.mode = mode;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 传入value获取 给汇付的payMode
|
||||||
|
* @param value
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String getAdapayPayMode(String value) {
|
||||||
|
for (MerchantDelayModeEnum merchantDelayModeEnum : MerchantDelayModeEnum.values()) {
|
||||||
|
if (merchantDelayModeEnum.getValue().equals(value)) {
|
||||||
|
return merchantDelayModeEnum.getMode();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
MerchantDelayModeEnum(String value, String label, String mode) {
|
||||||
|
this.value = value;
|
||||||
|
this.label = label;
|
||||||
|
this.mode = mode;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
package com.jsowell.common.enums.adapay;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 汇付支付 分账模式
|
|
||||||
*/
|
|
||||||
public enum MerchantDelayModelEnum {
|
|
||||||
DELAY("1", "延时分账"),
|
|
||||||
NOT_DELAY("0", "非延时分账"),
|
|
||||||
;
|
|
||||||
private String value;
|
|
||||||
private String label;
|
|
||||||
|
|
||||||
public String getValue() {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setValue(String value) {
|
|
||||||
this.value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getLabel() {
|
|
||||||
return label;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLabel(String label) {
|
|
||||||
this.label = label;
|
|
||||||
}
|
|
||||||
|
|
||||||
MerchantDelayModelEnum(String value, String label) {
|
|
||||||
this.value = value;
|
|
||||||
this.label = label;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -120,6 +120,8 @@ public enum ReturnCodeEnum {
|
|||||||
|
|
||||||
CODE_QUERY_PARKING_INFO_IS_NULL("00100057", "未查到停车平台信息"),
|
CODE_QUERY_PARKING_INFO_IS_NULL("00100057", "未查到停车平台信息"),
|
||||||
|
|
||||||
|
CODE_GET_FIRST_LEVEL_MERCHANT_BY_APP_ID("00100058", "根据小程序appId未查询到一级运营商信息"),
|
||||||
|
|
||||||
/* 个人桩 start */
|
/* 个人桩 start */
|
||||||
|
|
||||||
CODE_PILE_HAS_BEEN_BINDING_ERROR("00400001", "此桩已被绑定,请联系管理员!"),
|
CODE_PILE_HAS_BEEN_BINDING_ERROR("00400001", "此桩已被绑定,请联系管理员!"),
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ public class AdapayService {
|
|||||||
// 封装对象
|
// 封装对象
|
||||||
String amount = AdapayUtil.formatAmount(dto.getPayAmount()); // 用户支付金额
|
String amount = AdapayUtil.formatAmount(dto.getPayAmount()); // 用户支付金额
|
||||||
// String payMode = Constants.ADAPAY_PAY_MODE_DELAY; // 汇付延时分账
|
// String payMode = Constants.ADAPAY_PAY_MODE_DELAY; // 汇付延时分账
|
||||||
String payMode = pileMerchantInfoService.getDelayModeByWechatAppId(dto.getWechatAppId());
|
// String payMode = pileMerchantInfoService.getDelayModeByWechatAppId(dto.getWechatAppId());
|
||||||
CreateAdaPaymentParam createAdaPaymentParam = new CreateAdaPaymentParam();
|
CreateAdaPaymentParam createAdaPaymentParam = new CreateAdaPaymentParam();
|
||||||
createAdaPaymentParam.setOrder_no(dto.getOrderCode());
|
createAdaPaymentParam.setOrder_no(dto.getOrderCode());
|
||||||
createAdaPaymentParam.setPay_amt(amount);
|
createAdaPaymentParam.setPay_amt(amount);
|
||||||
|
|||||||
@@ -70,4 +70,9 @@ public class PayOrderDTO {
|
|||||||
* 这个字段是微信支付凭证的商品名
|
* 这个字段是微信支付凭证的商品名
|
||||||
*/
|
*/
|
||||||
private String goodsDesc;
|
private String goodsDesc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private String delayMode;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import com.jsowell.common.constant.Constants;
|
|||||||
import com.jsowell.common.core.domain.entity.SysDept;
|
import com.jsowell.common.core.domain.entity.SysDept;
|
||||||
import com.jsowell.common.core.domain.entity.SysUser;
|
import com.jsowell.common.core.domain.entity.SysUser;
|
||||||
import com.jsowell.common.core.domain.vo.AuthorizedDeptVO;
|
import com.jsowell.common.core.domain.vo.AuthorizedDeptVO;
|
||||||
|
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
|
||||||
import com.jsowell.common.exception.BusinessException;
|
import com.jsowell.common.exception.BusinessException;
|
||||||
import com.jsowell.common.util.DateUtils;
|
import com.jsowell.common.util.DateUtils;
|
||||||
import com.jsowell.common.util.DictUtils;
|
import com.jsowell.common.util.DictUtils;
|
||||||
@@ -395,16 +396,30 @@ public class PileMerchantInfoServiceImpl implements IPileMerchantInfoService {
|
|||||||
* @param wechatAppId 微信小程序id
|
* @param wechatAppId 微信小程序id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
// @Override
|
||||||
|
// public String getDelayModeByWechatAppId(String wechatAppId) {
|
||||||
|
// PileMerchantInfo merchant = getFirstLevelMerchantByAppId(wechatAppId);
|
||||||
|
// if (merchant != null) {
|
||||||
|
// String delayMode = merchant.getDelayMode();
|
||||||
|
// if (StringUtils.equals(delayMode, Constants.ONE)) {
|
||||||
|
// return Constants.ADAPAY_PAY_MODE_DELAY;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过wechatAppId查询一级运营商的延时支付模式配置
|
||||||
|
* @param wechatAppId 微信小程序id
|
||||||
|
* @return 延时分账模式(0-不延时;1-延时分账)
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String getDelayModeByWechatAppId(String wechatAppId) {
|
public String getDelayModeByWechatAppId(String wechatAppId) {
|
||||||
PileMerchantInfo merchant = getFirstLevelMerchantByAppId(wechatAppId);
|
PileMerchantInfo merchant = getFirstLevelMerchantByAppId(wechatAppId);
|
||||||
if (merchant != null) {
|
if (merchant == null) {
|
||||||
String delayMode = merchant.getDelayMode();
|
throw new BusinessException(ReturnCodeEnum.CODE_GET_FIRST_LEVEL_MERCHANT_BY_APP_ID);
|
||||||
if (StringUtils.equals(delayMode, Constants.ONE)) {
|
|
||||||
return Constants.ADAPAY_PAY_MODE_DELAY;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return null;
|
return merchant.getDelayMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -85,25 +85,21 @@ public abstract class AbstractOrderLogic implements InitializingBean {
|
|||||||
protected RedisCache redisCache;
|
protected RedisCache redisCache;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 余额支付订单
|
* 支付订单
|
||||||
|
* @param dto
|
||||||
|
* @return
|
||||||
*/
|
*/
|
||||||
public abstract void balancePayOrder(PayOrderDTO dto);
|
public abstract Map<String, Object> payOrder(PayOrderDTO dto);
|
||||||
|
|
||||||
/**
|
|
||||||
* 在线支付订单
|
|
||||||
*/
|
|
||||||
public abstract Map<String, Object> onlinePaymentOrder(PayOrderDTO dto);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 白名单支付订单
|
|
||||||
*/
|
|
||||||
public abstract void whitelistPaymentOrder(PayOrderDTO dto);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单结算
|
* 订单结算
|
||||||
*/
|
*/
|
||||||
public abstract void orderSettle(TransactionRecordsData data, OrderBasicInfo orderBasicInfo);
|
public abstract void orderSettle(TransactionRecordsData data, OrderBasicInfo orderBasicInfo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单退款
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 余额支付订单退款
|
* 余额支付订单退款
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.jsowell.pile.service.orderlogic;
|
|||||||
import com.alibaba.fastjson2.JSON;
|
import com.alibaba.fastjson2.JSON;
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
import com.jsowell.adapay.operation.PaymentReverseOperation;
|
import com.jsowell.adapay.operation.PaymentReverseOperation;
|
||||||
import com.jsowell.adapay.response.PaymentReverseResponse;
|
import com.jsowell.adapay.response.PaymentReverseResponse;
|
||||||
import com.jsowell.adapay.vo.OrderSettleResult;
|
import com.jsowell.adapay.vo.OrderSettleResult;
|
||||||
@@ -11,7 +12,7 @@ import com.jsowell.common.core.domain.ykc.TransactionRecordsData;
|
|||||||
import com.jsowell.common.enums.AcquirerEnum;
|
import com.jsowell.common.enums.AcquirerEnum;
|
||||||
import com.jsowell.common.enums.DelFlagEnum;
|
import com.jsowell.common.enums.DelFlagEnum;
|
||||||
import com.jsowell.common.enums.MemberWalletEnum;
|
import com.jsowell.common.enums.MemberWalletEnum;
|
||||||
import com.jsowell.common.enums.adapay.MerchantDelayModelEnum;
|
import com.jsowell.common.enums.adapay.MerchantDelayModeEnum;
|
||||||
import com.jsowell.common.enums.ykc.*;
|
import com.jsowell.common.enums.ykc.*;
|
||||||
import com.jsowell.common.exception.BusinessException;
|
import com.jsowell.common.exception.BusinessException;
|
||||||
import com.jsowell.common.util.StringUtils;
|
import com.jsowell.common.util.StringUtils;
|
||||||
@@ -42,13 +43,43 @@ public class DelayMerchantOrderLogic extends AbstractOrderLogic {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterPropertiesSet() throws Exception {
|
public void afterPropertiesSet() throws Exception {
|
||||||
OrderLogicFactory.register(MerchantDelayModelEnum.DELAY.getValue(), this);
|
OrderLogicFactory.register(MerchantDelayModeEnum.DELAY.getValue(), this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> payOrder(PayOrderDTO dto) {
|
||||||
|
OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByOrderCode(dto.getOrderCode());
|
||||||
|
if (orderInfo == null) {
|
||||||
|
throw new BusinessException(ReturnCodeEnum.CODE_QUERY_ORDER_INFO_IS_NULL);
|
||||||
|
}
|
||||||
|
if (!StringUtils.equals(orderInfo.getPayStatus(), OrderPayStatusEnum.unpaid.getValue())) {
|
||||||
|
// 订单已支付
|
||||||
|
throw new BusinessException(ReturnCodeEnum.CODE_ORDER_IS_NOT_TO_BE_PAID_ERROR);
|
||||||
|
}
|
||||||
|
Map<String, Object> resultMap = Maps.newHashMap();
|
||||||
|
if (StringUtils.equals(dto.getPayMode(), OrderPayModeEnum.PAYMENT_OF_BALANCE.getValue())) {
|
||||||
|
// 余额支付
|
||||||
|
balancePayOrder(dto);
|
||||||
|
} else if (StringUtils.equals(dto.getPayMode(), OrderPayModeEnum.PAYMENT_OF_WECHATPAY.getValue())) {
|
||||||
|
// 2023-07-11 全部改为汇付支付
|
||||||
|
dto.setGoodsTitle("充电费用");
|
||||||
|
dto.setGoodsDesc("充电桩预付款金额");
|
||||||
|
dto.setType(ScenarioEnum.ORDER.getValue());
|
||||||
|
Map<String, Object> weixinMap = onlinePaymentOrder(dto);
|
||||||
|
|
||||||
|
// 返回微信支付参数
|
||||||
|
resultMap.put("weixinMap", weixinMap);
|
||||||
|
} else if (StringUtils.equals(dto.getPayMode(), OrderPayModeEnum.PAYMENT_OF_WHITELIST.getValue())) { // 白名单支付
|
||||||
|
// 白名单支付可以直接调支付回调方法
|
||||||
|
dto.setPayAmount(new BigDecimal("500"));
|
||||||
|
whitelistPaymentOrder(dto);
|
||||||
|
}
|
||||||
|
return resultMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 余额支付订单
|
* 余额支付订单
|
||||||
*/
|
*/
|
||||||
@Override
|
|
||||||
public void balancePayOrder(PayOrderDTO dto) {
|
public void balancePayOrder(PayOrderDTO dto) {
|
||||||
String orderCode = dto.getOrderCode(); // 订单编号
|
String orderCode = dto.getOrderCode(); // 订单编号
|
||||||
BigDecimal chargeAmount = dto.getPayAmount(); // 支付金额
|
BigDecimal chargeAmount = dto.getPayAmount(); // 支付金额
|
||||||
@@ -132,11 +163,11 @@ public class DelayMerchantOrderLogic extends AbstractOrderLogic {
|
|||||||
/**
|
/**
|
||||||
* 在线支付订单
|
* 在线支付订单
|
||||||
*/
|
*/
|
||||||
@Override
|
|
||||||
public Map<String, Object> onlinePaymentOrder(PayOrderDTO dto) {
|
public Map<String, Object> onlinePaymentOrder(PayOrderDTO dto) {
|
||||||
|
|
||||||
// 2023-07-11 全部改为汇付支付
|
// 2023-07-11 全部改为汇付支付
|
||||||
dto.setGoodsTitle("充电费用");
|
// dto.setGoodsTitle("充电费用");
|
||||||
dto.setGoodsDesc("充电桩预付款金额");
|
// dto.setGoodsDesc("充电桩预付款金额");
|
||||||
Map<String, Object> weixinMap = adapayService.createPayment(dto);
|
Map<String, Object> weixinMap = adapayService.createPayment(dto);
|
||||||
return weixinMap;
|
return weixinMap;
|
||||||
}
|
}
|
||||||
@@ -144,7 +175,6 @@ public class DelayMerchantOrderLogic extends AbstractOrderLogic {
|
|||||||
/**
|
/**
|
||||||
* 白名单支付订单
|
* 白名单支付订单
|
||||||
*/
|
*/
|
||||||
@Override
|
|
||||||
public void whitelistPaymentOrder(PayOrderDTO dto) {
|
public void whitelistPaymentOrder(PayOrderDTO dto) {
|
||||||
String orderCode = dto.getOrderCode();
|
String orderCode = dto.getOrderCode();
|
||||||
BigDecimal payAmount = dto.getPayAmount();
|
BigDecimal payAmount = dto.getPayAmount();
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.jsowell.pile.service.orderlogic;
|
|||||||
import com.alibaba.fastjson2.JSON;
|
import com.alibaba.fastjson2.JSON;
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
import com.jsowell.adapay.response.RefundResponse;
|
import com.jsowell.adapay.response.RefundResponse;
|
||||||
import com.jsowell.adapay.vo.OrderSettleResult;
|
import com.jsowell.adapay.vo.OrderSettleResult;
|
||||||
import com.jsowell.common.constant.Constants;
|
import com.jsowell.common.constant.Constants;
|
||||||
@@ -10,7 +11,7 @@ import com.jsowell.common.core.domain.ykc.TransactionRecordsData;
|
|||||||
import com.jsowell.common.enums.AcquirerEnum;
|
import com.jsowell.common.enums.AcquirerEnum;
|
||||||
import com.jsowell.common.enums.DelFlagEnum;
|
import com.jsowell.common.enums.DelFlagEnum;
|
||||||
import com.jsowell.common.enums.MemberWalletEnum;
|
import com.jsowell.common.enums.MemberWalletEnum;
|
||||||
import com.jsowell.common.enums.adapay.MerchantDelayModelEnum;
|
import com.jsowell.common.enums.adapay.MerchantDelayModeEnum;
|
||||||
import com.jsowell.common.enums.ykc.*;
|
import com.jsowell.common.enums.ykc.*;
|
||||||
import com.jsowell.common.exception.BusinessException;
|
import com.jsowell.common.exception.BusinessException;
|
||||||
import com.jsowell.common.util.StringUtils;
|
import com.jsowell.common.util.StringUtils;
|
||||||
@@ -41,15 +42,46 @@ public class NotDelayMerchantOrderLogic extends AbstractOrderLogic{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterPropertiesSet() throws Exception {
|
public void afterPropertiesSet() throws Exception {
|
||||||
OrderLogicFactory.register(MerchantDelayModelEnum.NOT_DELAY.getValue(), this);
|
OrderLogicFactory.register(MerchantDelayModeEnum.NOT_DELAY.getValue(), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> payOrder(PayOrderDTO dto) {
|
||||||
|
OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByOrderCode(dto.getOrderCode());
|
||||||
|
if (orderInfo == null) {
|
||||||
|
throw new BusinessException(ReturnCodeEnum.CODE_QUERY_ORDER_INFO_IS_NULL);
|
||||||
|
}
|
||||||
|
if (!StringUtils.equals(orderInfo.getPayStatus(), OrderPayStatusEnum.unpaid.getValue())) {
|
||||||
|
// 订单已支付
|
||||||
|
throw new BusinessException(ReturnCodeEnum.CODE_ORDER_IS_NOT_TO_BE_PAID_ERROR);
|
||||||
|
}
|
||||||
|
Map<String, Object> resultMap = Maps.newHashMap();
|
||||||
|
if (StringUtils.equals(dto.getPayMode(), OrderPayModeEnum.PAYMENT_OF_BALANCE.getValue())) {
|
||||||
|
// 余额支付
|
||||||
|
balancePayOrder(dto);
|
||||||
|
} else if (StringUtils.equals(dto.getPayMode(), OrderPayModeEnum.PAYMENT_OF_WECHATPAY.getValue())) {
|
||||||
|
// 2023-07-11 全部改为汇付支付
|
||||||
|
dto.setGoodsTitle("充电费用");
|
||||||
|
dto.setGoodsDesc("充电桩预付款金额");
|
||||||
|
dto.setType(ScenarioEnum.ORDER.getValue());
|
||||||
|
Map<String, Object> weixinMap = onlinePaymentOrder(dto);
|
||||||
|
|
||||||
|
// 返回微信支付参数
|
||||||
|
resultMap.put("weixinMap", weixinMap);
|
||||||
|
} else if (StringUtils.equals(dto.getPayMode(), OrderPayModeEnum.PAYMENT_OF_WHITELIST.getValue())) { // 白名单支付
|
||||||
|
// 白名单支付可以直接调支付回调方法
|
||||||
|
dto.setPayAmount(new BigDecimal("500"));
|
||||||
|
whitelistPaymentOrder(dto);
|
||||||
|
}
|
||||||
|
return resultMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 余额支付订单
|
* 余额支付订单
|
||||||
*
|
*
|
||||||
* @param dto
|
* @param dto
|
||||||
*/
|
*/
|
||||||
@Override
|
|
||||||
public void balancePayOrder(PayOrderDTO dto) {
|
public void balancePayOrder(PayOrderDTO dto) {
|
||||||
String orderCode = dto.getOrderCode(); // 订单编号
|
String orderCode = dto.getOrderCode(); // 订单编号
|
||||||
BigDecimal chargeAmount = dto.getPayAmount(); // 支付金额
|
BigDecimal chargeAmount = dto.getPayAmount(); // 支付金额
|
||||||
@@ -135,7 +167,6 @@ public class NotDelayMerchantOrderLogic extends AbstractOrderLogic{
|
|||||||
*
|
*
|
||||||
* @param dto
|
* @param dto
|
||||||
*/
|
*/
|
||||||
@Override
|
|
||||||
public Map<String, Object> onlinePaymentOrder(PayOrderDTO dto) {
|
public Map<String, Object> onlinePaymentOrder(PayOrderDTO dto) {
|
||||||
// 2023-07-11 全部改为汇付支付
|
// 2023-07-11 全部改为汇付支付
|
||||||
dto.setGoodsTitle("充电费用");
|
dto.setGoodsTitle("充电费用");
|
||||||
@@ -149,7 +180,6 @@ public class NotDelayMerchantOrderLogic extends AbstractOrderLogic{
|
|||||||
*
|
*
|
||||||
* @param dto
|
* @param dto
|
||||||
*/
|
*/
|
||||||
@Override
|
|
||||||
public void whitelistPaymentOrder(PayOrderDTO dto) {
|
public void whitelistPaymentOrder(PayOrderDTO dto) {
|
||||||
String orderCode = dto.getOrderCode();
|
String orderCode = dto.getOrderCode();
|
||||||
BigDecimal payAmount = dto.getPayAmount();
|
BigDecimal payAmount = dto.getPayAmount();
|
||||||
|
|||||||
Reference in New Issue
Block a user