123
This commit is contained in:
@@ -55,9 +55,11 @@ public class PayController {
|
||||
private PayTrdConfigService payTrdConfigService;
|
||||
private static final String NOTIFY_WX_URL = "/api/pay/wx/notify";
|
||||
private static final String NOTIFY_ALI_URL = "/api/pay/ali/notify";
|
||||
@Autowired
|
||||
private SystemConfigManager systemConfigManager;
|
||||
|
||||
|
||||
// @GetMapping(value = "/checkPay")
|
||||
// @GetMapping(value = "/checkPay")
|
||||
// @Operation(summary = "检查使用的支付方式")
|
||||
// @Log(title = "检查使用的支付方式", businessType = BusinessType.OTHER, isSaveDb = true)
|
||||
public R<UsePayResp> checkPayType(){
|
||||
@@ -88,14 +90,24 @@ public class PayController {
|
||||
boolean userTrdPay = trdPayManager.useTrdPay(userId);
|
||||
if(userTrdPay){
|
||||
try {
|
||||
boolean openAliPay = systemConfigManager.getSystemConfigOfBool(SystemConfigEnum.OPEN_ALI_PAY);
|
||||
if(!openAliPay){
|
||||
return R.fail(600,"支付宝支付失败!未开启支付宝通道!");
|
||||
}
|
||||
log.info("支付宝聚合支付 使用第三方支付 dto={}",JSON.toJSONString(dto));
|
||||
PayReturnResp orderAli = payTrdConfigService.createOrderAli(payOrderInfo);
|
||||
return R.ok(orderAli);
|
||||
}catch (Exception e){
|
||||
log.error("第三方支付宝支付失败!",e);
|
||||
return R.fail(600,"第三方支付宝支付失败!");
|
||||
log.error("支付宝聚合支付 使用第三方支付失败! dto={}",JSON.toJSONString(dto), e);
|
||||
return R.fail(600,"支付宝支付失败!");
|
||||
}
|
||||
}else{
|
||||
try {
|
||||
boolean openSourceAliPay = systemConfigManager.getSystemConfigOfBool(SystemConfigEnum.OPEN_SOURCE_ALI_PAY);
|
||||
if(!openSourceAliPay){
|
||||
return R.fail(600,"支付宝支付失败!未开启原生支付宝通道!");
|
||||
}
|
||||
log.info("支付宝聚合支付 使用原生支付 dto={}",JSON.toJSONString(dto));
|
||||
boolean b = payConfigManager.initAliPay();
|
||||
if(!b){
|
||||
log.error("支付失败,未找到可用的支付宝配置");
|
||||
@@ -111,7 +123,7 @@ public class PayController {
|
||||
String orderInfo = AliPayApi.appPayToResponse(model, notifyUrl+NOTIFY_ALI_URL).getBody();
|
||||
return R.ok(PayReturnResp.createApp(orderInfo));
|
||||
} catch (AlipayApiException e) {
|
||||
log.error("支付宝支付失败",e);
|
||||
log.error("支付宝聚合支付 使用原生支付失败! dto={}",JSON.toJSONString(dto),e);
|
||||
return R.fail("支付宝支付失败,请联系客服");
|
||||
}
|
||||
}
|
||||
@@ -126,6 +138,14 @@ public class PayController {
|
||||
if(payOrderInfo == null){
|
||||
return R.fail(600,"支付失败,未找到订单");
|
||||
}
|
||||
boolean openWx = systemConfigManager.getSystemConfigOfBool(SystemConfigEnum.OPEN_WX_PAY);
|
||||
if(!openWx){
|
||||
return R.fail(600,"微信支付失败,未开启微信通道");
|
||||
}
|
||||
boolean userTrdPay = trdPayManager.useTrdPay(LoginHelper.getUserId());
|
||||
if(userTrdPay){
|
||||
return R.fail(600,"微信支付失败,暂无微信通道");
|
||||
}
|
||||
PayConfig payConfig = payConfigManager.getWxConfig();
|
||||
if(payConfig == null){
|
||||
log.error("支付失败,未找到可用的微信支付配置");
|
||||
|
||||
@@ -61,7 +61,7 @@ public class SettingAppController {
|
||||
vo.setHasAlipayPay(systemConfigManager.getSystemConfigOfInt(SystemConfigEnum.OPEN_ALI_PAY));
|
||||
vo.setHasWechatPay(0);
|
||||
}else{
|
||||
vo.setHasAlipayPay(systemConfigManager.getSystemConfigOfInt(SystemConfigEnum.OPEN_ALI_PAY));
|
||||
vo.setHasAlipayPay(systemConfigManager.getSystemConfigOfInt(SystemConfigEnum.OPEN_SOURCE_ALI_PAY));
|
||||
vo.setHasWechatPay(systemConfigManager.getSystemConfigOfInt(SystemConfigEnum.OPEN_WX_PAY));
|
||||
}
|
||||
vo.setAlipayFirst(systemConfigManager.getSystemConfigOfInt(SystemConfigEnum.ALI_PAY_FIRST));
|
||||
|
||||
@@ -100,7 +100,7 @@ public class UserAppController {
|
||||
vo.setHasAlipayPay(systemConfigManager.getSystemConfigOfInt(SystemConfigEnum.OPEN_ALI_PAY));
|
||||
vo.setHasWechatPay(0);
|
||||
}else{
|
||||
vo.setHasAlipayPay(systemConfigManager.getSystemConfigOfInt(SystemConfigEnum.OPEN_ALI_PAY));
|
||||
vo.setHasAlipayPay(systemConfigManager.getSystemConfigOfInt(SystemConfigEnum.OPEN_SOURCE_ALI_PAY));
|
||||
vo.setHasWechatPay(systemConfigManager.getSystemConfigOfInt(SystemConfigEnum.OPEN_WX_PAY));
|
||||
}
|
||||
return R.ok(vo);
|
||||
|
||||
@@ -55,7 +55,8 @@ public enum SystemConfigEnum {
|
||||
TODAY_GREET_MAX("100", "每日主播群打招呼次数",SystemConfigGroupEnum.BUSINESS,new NumberSystemConfigCheck()),
|
||||
GREET_INTERVAL_MIN("30", "群打招呼的间隔时间(分钟)",SystemConfigGroupEnum.BUSINESS, new NumberSystemConfigCheck()),
|
||||
ANCHOR_TOP_MIN("30", "小火箭置顶间隔时间(分钟)",SystemConfigGroupEnum.BUSINESS, new NumberSystemConfigCheck()),
|
||||
OPEN_ALI_PAY("1", "是否开启支付宝支付",SystemConfigGroupEnum.BUSINESS,new BooleanSystemConfigCheck()),
|
||||
OPEN_ALI_PAY("1", "是否开启四方支付宝支付",SystemConfigGroupEnum.BUSINESS,new BooleanSystemConfigCheck()),
|
||||
OPEN_SOURCE_ALI_PAY("1", "是否开启原生支付宝支付",SystemConfigGroupEnum.BUSINESS,new BooleanSystemConfigCheck()),
|
||||
OPEN_WX_PAY("1", "是否开启微信支付",SystemConfigGroupEnum.BUSINESS,new BooleanSystemConfigCheck()),
|
||||
ALI_PAY_FIRST("1", "支付宝支付显示是否在前面",SystemConfigGroupEnum.BUSINESS,new BooleanSystemConfigCheck()),
|
||||
OPEN_WITHDRAW("1", "是否开启提现功能",SystemConfigGroupEnum.BUSINESS,new BooleanSystemConfigCheck()),
|
||||
|
||||
@@ -55,14 +55,14 @@ public class PayTrdConfigServiceImpl extends ServiceImpl<PayTrdConfigMapper, Pay
|
||||
}
|
||||
if(typeEnum == TrdPayTypeEnum.V1){ // V1
|
||||
if(!"SUCCESS".equals(jsonObject.getString("retCode"))){
|
||||
log.info("第三方支付失败 V1统一支付失败失败 dto={}, payTrdConfig={}, typeEnum={}", JSON.toJSONString(dto), JSON.toJSONString(payTrdConfig),JSON.toJSONString(typeEnum));
|
||||
log.info("第三方支付失败 V1统一支付失败失败 dto={}, payTrdConfig={}, typeEnum={}", JSON.toJSONString(dto), JSON.toJSONString(payTrdConfig),JSON.toJSONString(jsonObject));
|
||||
throw new ServiceException("调用支付失败");
|
||||
}
|
||||
String payUrl = jsonObject.getJSONObject("payParams").getString("payUrl");
|
||||
return PayReturnResp.createH5(payUrl);
|
||||
}else if(typeEnum == TrdPayTypeEnum.V2){
|
||||
if(!"0".equals(jsonObject.getString("retCode"))){
|
||||
log.info("第三方支付失败 V2统一支付失败失败 dto={}, payTrdConfig={}, typeEnum={}", JSON.toJSONString(dto), JSON.toJSONString(payTrdConfig),JSON.toJSONString(typeEnum));
|
||||
log.info("第三方支付失败 V2统一支付失败失败 dto={}, payTrdConfig={}, typeEnum={}", JSON.toJSONString(dto), JSON.toJSONString(payTrdConfig),JSON.toJSONString(jsonObject));
|
||||
throw new ServiceException("调用支付失败");
|
||||
}
|
||||
String payMethod = jsonObject.getString("payMethod");
|
||||
|
||||
Reference in New Issue
Block a user