ShopMerchant缓存
This commit is contained in:
@@ -13,6 +13,7 @@ import com.czg.config.RedisCst;
|
||||
import com.czg.entity.req.*;
|
||||
import com.czg.entity.resp.*;
|
||||
import com.czg.enums.ShopUserFlowBizEnum;
|
||||
import com.czg.exception.CzgException;
|
||||
import com.czg.exception.PaySuccessException;
|
||||
import com.czg.order.dto.BigDecimalDTO;
|
||||
import com.czg.order.dto.CheckOrderPay;
|
||||
@@ -638,14 +639,14 @@ public class PayServiceImpl implements PayService {
|
||||
@Override
|
||||
@Transactional
|
||||
public CzgResult<CzgBaseResp> queryPayOrder(@NonNull Long shopId, String payOrderId, String mchOrderNo) {
|
||||
ShopMerchant shopMerchant = shopMerchantService.getById(shopId);
|
||||
ShopMerchant shopMerchant = getMerchant(shopId);
|
||||
return czgPayService.queryPayOrder(shopMerchant.getAppId(), shopMerchant.getAppSecret(), payOrderId, mchOrderNo);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public CzgResult<CzgRefundResp> queryRefund(@NonNull Long shopId, String mchRefundNo, String refundOrderId) {
|
||||
ShopMerchant shopMerchant = shopMerchantService.getById(shopId);
|
||||
ShopMerchant shopMerchant = getMerchant(shopId);
|
||||
return czgPayService.queryRefundOrder(shopMerchant.getAppId(), shopMerchant.getAppSecret(), mchRefundNo, refundOrderId);
|
||||
}
|
||||
|
||||
@@ -665,7 +666,7 @@ public class PayServiceImpl implements PayService {
|
||||
|
||||
|
||||
private CzgResult<Map<String, Object>> h5Pay(@NonNull Long shopId, CzgH5PayReq bizData) {
|
||||
ShopMerchant shopMerchant = shopMerchantService.getById(shopId);
|
||||
ShopMerchant shopMerchant = getMerchant(shopId);
|
||||
bizData.assignMerchant(shopMerchant.getStoreId(), shopMerchant.getMerchantName(),
|
||||
sysParamsService.getSysParamValue(SysParamCodeEnum.PAY_CZG_NOTIFY_URL.getCode()));
|
||||
CzgResult<CzgH5PayResp> h5PayRespCzgResult = czgPayService.h5Pay(shopMerchant.getAppId(), shopMerchant.getAppSecret(), bizData);
|
||||
@@ -673,7 +674,7 @@ public class PayServiceImpl implements PayService {
|
||||
}
|
||||
|
||||
private CzgResult<Map<String, Object>> jsPay(@NonNull Long shopId, @NonNull String payType, CzgJsPayReq bizData) {
|
||||
ShopMerchant shopMerchant = shopMerchantService.getById(shopId);
|
||||
ShopMerchant shopMerchant = getMerchant(shopId);
|
||||
bizData.setSubAppid("aliPay".equals(payType) ? shopMerchant.getAlipaySmallAppid() : shopMerchant.getWechatSmallAppid());
|
||||
AssertUtil.isBlank(bizData.getSubAppid(), "暂不可用,请联系商家配置" + ("aliPay".equals(payType) ? "支付宝" : "微信") + "小程序");
|
||||
bizData.assignMerchant(shopMerchant.getStoreId(), shopMerchant.getMerchantName(),
|
||||
@@ -684,7 +685,7 @@ public class PayServiceImpl implements PayService {
|
||||
}
|
||||
|
||||
private CzgResult<Map<String, Object>> ltPay(@NonNull Long shopId, String payType, CzgLtPayReq bizData) {
|
||||
ShopMerchant shopMerchant = shopMerchantService.getById(shopId);
|
||||
ShopMerchant shopMerchant = getMerchant(shopId);
|
||||
bizData.setSubAppid("aliPay".equals(payType) ? shopMerchant.getAlipaySmallAppid() : shopMerchant.getWechatSmallAppid());
|
||||
AssertUtil.isBlank(bizData.getSubAppid(), "暂不可用,请联系商家配置" + ("aliPay".equals(payType) ? "支付宝" : "微信") + "小程序");
|
||||
bizData.assignMerchant(shopMerchant.getStoreId(), shopMerchant.getMerchantName(),
|
||||
@@ -694,7 +695,7 @@ public class PayServiceImpl implements PayService {
|
||||
}
|
||||
|
||||
private CzgResult<Map<String, Object>> scanPay(@NonNull Long shopId, CzgScanPayReq bizData) {
|
||||
ShopMerchant shopMerchant = shopMerchantService.getById(shopId);
|
||||
ShopMerchant shopMerchant = getMerchant(shopId);
|
||||
bizData.assignMerchant(shopMerchant.getStoreId(), shopMerchant.getMerchantName(),
|
||||
sysParamsService.getSysParamValue(SysParamCodeEnum.PAY_CZG_NOTIFY_URL.getCode()));
|
||||
CzgResult<CzgScanPayResp> scanPayRespCzgResult = czgPayService.scanPay(shopMerchant.getAppId(), shopMerchant.getAppSecret(), bizData);
|
||||
@@ -703,7 +704,7 @@ public class PayServiceImpl implements PayService {
|
||||
|
||||
private CzgResult<Map<String, Object>> microPay(@NonNull Long shopId, CzgMicroPayReq bizData) {
|
||||
AssertUtil.isBlank(bizData.getAuthCode(), "扫码失败,请重试");
|
||||
ShopMerchant shopMerchant = shopMerchantService.getById(shopId);
|
||||
ShopMerchant shopMerchant = getMerchant(shopId);
|
||||
bizData.assignMerchant(shopMerchant.getStoreId(), shopMerchant.getMerchantName(),
|
||||
sysParamsService.getSysParamValue(SysParamCodeEnum.PAY_CZG_NOTIFY_URL.getCode()));
|
||||
String firstTwoDigitsStr = bizData.getAuthCode().substring(0, 2);
|
||||
@@ -727,11 +728,19 @@ public class PayServiceImpl implements PayService {
|
||||
}
|
||||
|
||||
private CzgResult<CzgRefundResp> refund(@NonNull Long shopId, CzgRefundReq bizData) {
|
||||
ShopMerchant shopMerchant = shopMerchantService.getById(shopId);
|
||||
ShopMerchant shopMerchant = getMerchant(shopId);
|
||||
bizData.setNotifyUrl(sysParamsService.getSysParamValue(SysParamCodeEnum.PAY_CZG_REFUND_NOTIFY_URL.getCode()));
|
||||
return czgPayService.refundOrder(shopMerchant.getAppId(), shopMerchant.getAppSecret(), bizData);
|
||||
}
|
||||
|
||||
private ShopMerchant getMerchant(Long shopId) {
|
||||
try {
|
||||
return shopMerchantService.getById(shopId);
|
||||
} catch (Exception e) {
|
||||
throw new CzgException(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private CzgResult<Map<String, Object>> execPayResult(CzgResult<? extends CzgBaseResp> res) {
|
||||
CzgResult<Map<String, Object>> result = CzgResult.success();
|
||||
if (res.getCode() != 200 || res.getData() == null) {
|
||||
|
||||
Reference in New Issue
Block a user