增加支付配置设置接口

This commit is contained in:
yuyang 2022-02-14 16:31:01 +08:00
parent aa43ef7e3a
commit 50e5af7b22
6 changed files with 514 additions and 1 deletions

View File

@ -726,7 +726,7 @@ public class XhpcRefundAuditController extends BaseController {
@Scheduled(cron = "0/20 * * * * ? ") @Scheduled(cron = "0/20 * * * * ? ")
@GetMapping("/moneyPage") @GetMapping("/moneyPage")
public void moneyPage(){ public void moneyPage(){
logger.info("++++++++++++每1分钟扫描一次退款订单金额小于每20秒,自动审核通过++++++++++++++++"); logger.info("++++++++++++每20秒扫描一次退款订单金额小于100,自动审核通过++++++++++++++++");
try { try {
List<Long> list = iXhpcRefundOrderService.moneyPage(); List<Long> list = iXhpcRefundOrderService.moneyPage();
if(list !=null && list.size()>0){ if(list !=null && list.size()>0){

View File

@ -0,0 +1,164 @@
package com.xhpc.payment.controller;
import com.xhpc.common.core.domain.R;
import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.domain.XhpcSettingConfig;
import com.xhpc.common.util.UserTypeUtil;
import com.xhpc.payment.service.IXhpcSettingConfigService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;
/**
* @author yuyang
* @date 2022/2/14 15:53
*/
@EnableScheduling
@RestController
@RequestMapping("/settingConfig")
@Api(value = "支付配置接口", tags = "支付配置接口")
public class XhpcSettingConfigController {
@Autowired
private IXhpcSettingConfigService xhpcSettingConfigService;
/**
* 支付配置详情
* @param
* @return
*/
@GetMapping("/info")
@ApiOperation(value = "充值订单详情")
public R info(HttpServletRequest request, @RequestParam Integer status) {
if(status ==null){
return R.fail("类型为空");
}
return R.ok(xhpcSettingConfigService.getXhpcSettingConfigStatus(request,status));
}
/**
* 支付配置修改
* @param
* @return
*/
@PostMapping("/updateXhpcSettingConfig")
@ApiOperation(value = "支付配置修改")
public R updateXhpcSettingConfig(HttpServletRequest request,XhpcSettingConfig xhpcSettingConfig) {
if(xhpcSettingConfig.getStatus() ==null){
return R.fail("类型为空");
}
if(xhpcSettingConfig.getStatus()== UserTypeUtil.RECHARGE_WX){
if(xhpcSettingConfig.getWxAppId()==null || "".equals(xhpcSettingConfig.getWxAppId())){
return R.fail("微信小程序AppId为空");
}
if(xhpcSettingConfig.getWxAppSecret()==null || "".equals(xhpcSettingConfig.getWxAppSecret())){
return R.fail("微信小程序密钥为空");
}
if(xhpcSettingConfig.getWxMchId()==null || "".equals(xhpcSettingConfig.getWxMchId())){
return R.fail("微信商户id为空");
}
if(xhpcSettingConfig.getWxMchKey()==null || "".equals(xhpcSettingConfig.getWxMchKey())){
return R.fail("微信商户平台Key为空");
}
if(xhpcSettingConfig.getWxPaymentUrl()==null || "".equals(xhpcSettingConfig.getWxPaymentUrl())){
return R.fail("微信小程序支付地址为空");
}
if(xhpcSettingConfig.getWxCallbackUrl()==null || "".equals(xhpcSettingConfig.getWxCallbackUrl())){
return R.fail("微信回调地址为空");
}
if(xhpcSettingConfig.getWxTransfersUrl()==null || "".equals(xhpcSettingConfig.getWxTransfersUrl())){
return R.fail("微信用户个人付款地址为空");
}
if(xhpcSettingConfig.getWxApiclientCertPem()==null || "".equals(xhpcSettingConfig.getWxApiclientCertPem())){
return R.fail("微信证书p12为空");
}
if(xhpcSettingConfig.getWxApiclientKeyPem()==null || "".equals(xhpcSettingConfig.getWxApiclientKeyPem())){
return R.fail("微信证书key.pem为空");
}else{
String[] split = xhpcSettingConfig.getWxApiclientKeyPem().split(".");
if(split.length>1){
if(!"pem".equals(split[1])){
return R.fail("请上传key.pem类型证书");
}
}else{
return R.fail("请上传key.pem类型证书");
}
}
if(xhpcSettingConfig.getWxAppCertPublicKey()==null || "".equals(xhpcSettingConfig.getWxAppCertPublicKey())){
return R.fail("微信证书cret.pem为空");
}else{
String[] split = xhpcSettingConfig.getWxApiclientKeyPem().split("\\.");
if(split.length>1){
if(!"pem".equals(split[1])){
return R.fail("请上传cret.pem类型证书");
}
}else{
return R.fail("请上传cret.pem类型证书");
}
}
}else{
if(xhpcSettingConfig.getZfbAppId()==null || "".equals(xhpcSettingConfig.getZfbAppId())){
return R.fail("支付宝小程序AppId为空");
}
if(xhpcSettingConfig.getZfbPrivateKey()==null || "".equals(xhpcSettingConfig.getZfbPrivateKey())){
return R.fail("支付宝应用私钥为空");
}
if(xhpcSettingConfig.getZfbCallbackUrl()==null || "".equals(xhpcSettingConfig.getZfbCallbackUrl())){
return R.fail("支付宝回调地址为空");
}
if(xhpcSettingConfig.getZfbAppCertPublicKey()==null || "".equals(xhpcSettingConfig.getZfbAppCertPublicKey())){
return R.fail("支付宝应用公钥证书路径为空");
}else{
String[] split = xhpcSettingConfig.getZfbAppCertPublicKey().split("\\.");
if(split.length>1){
if(!"crt".equals(split[1])){
return R.fail("请上传支付宝公钥.crt类型证书");
}
}else{
return R.fail("请上传支付宝应用公钥.crt类型证书");
}
}
if(xhpcSettingConfig.getZfbAlipayCertPublicKeyRsa()==null || "".equals(xhpcSettingConfig.getZfbAlipayCertPublicKeyRsa())){
return R.fail("支付宝公钥证书路径为空");
}else{
String[] split = xhpcSettingConfig.getZfbAlipayCertPublicKeyRsa().split("\\.");
if(split.length>1){
if(!"crt".equals(split[1])){
return R.fail("请上传支付宝公钥.crt类型证书");
}
}else{
return R.fail("请上传支付宝公钥.crt类型证书");
}
}
if(xhpcSettingConfig.getZfbAlipayRootCert()==null || "".equals(xhpcSettingConfig.getZfbAlipayRootCert())){
return R.fail("支付宝根证书路径为空");
}else{
String[] split = xhpcSettingConfig.getZfbAlipayRootCert().split("\\.");
if(split.length>1){
if(!"crt".equals(split[1])){
return R.fail("请上传支付宝根.crt类型证书");
}
}else{
return R.fail("请上传支付宝根.crt类型证书");
}
}
}
//查询
Map<String, Object> xhpcSettingConfigStatus = xhpcSettingConfigService.getXhpcSettingConfigStatus(request, xhpcSettingConfig.getStatus());
if(xhpcSettingConfigStatus !=null){
xhpcSettingConfig.setSettingConfigId(Long.valueOf(xhpcSettingConfigStatus.get("settingConfigId").toString()));
}
if(xhpcSettingConfig.getSettingConfigId() !=null){
return xhpcSettingConfigService.updateXhpcSettingConfig(xhpcSettingConfig);
}else{
return xhpcSettingConfigService.insertXhpcSettingConfig(xhpcSettingConfig);
}
}
}

View File

@ -0,0 +1,20 @@
package com.xhpc.payment.mapper;
import com.xhpc.common.domain.XhpcSettingConfig;
import org.apache.ibatis.annotations.Param;
import java.util.Map;
/**
* @author yuyang
* @date 2022/2/14 14:45
*/
public interface XhpcSettingConfigMapper {
int insertXhpcSettingConfig(XhpcSettingConfig xhpcSettingConfig);
int updateXhpcSettingConfig(XhpcSettingConfig xhpcSettingConfig);
Map<String,Object> getXhpcSettingConfigStatus(@Param("status") Integer status, @Param("tenantId")String tenantId);
}

View File

@ -0,0 +1,21 @@
package com.xhpc.payment.service;
import com.xhpc.common.core.domain.R;
import com.xhpc.common.domain.XhpcSettingConfig;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;
/**
* @author yuyang
* @date 2022/2/14 14:44
*/
public interface IXhpcSettingConfigService {
R insertXhpcSettingConfig(XhpcSettingConfig xhpcSettingConfig);
R updateXhpcSettingConfig(XhpcSettingConfig xhpcSettingConfig);
Map<String,Object> getXhpcSettingConfigStatus(HttpServletRequest request,Integer status);
}

View File

@ -0,0 +1,60 @@
package com.xhpc.payment.service.impl;
import com.xhpc.common.core.domain.R;
import com.xhpc.common.core.utils.SecurityUtils;
import com.xhpc.common.domain.XhpcSettingConfig;
import com.xhpc.common.util.LogUserUtils;
import com.xhpc.common.util.UserTypeUtil;
import com.xhpc.payment.mapper.XhpcSettingConfigMapper;
import com.xhpc.payment.service.IXhpcSettingConfigService;
import com.xhpc.system.api.model.LoginUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.security.DenyAll;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* @author yuyang
* @date 2022/2/14 14:44
*/
@Service
public class XhpcSettingConfigImpl implements IXhpcSettingConfigService {
@Autowired
private XhpcSettingConfigMapper xhpcSettingConfigMapper;
@Autowired
private LogUserUtils logUserUtils;
@Override
public R insertXhpcSettingConfig(XhpcSettingConfig xhpcSettingConfig) {
int i = xhpcSettingConfigMapper.insertXhpcSettingConfig(xhpcSettingConfig);
if(i>0){
return R.ok();
}
return R.fail("保存失败");
}
@Override
public R updateXhpcSettingConfig(XhpcSettingConfig xhpcSettingConfig) {
int i = xhpcSettingConfigMapper.updateXhpcSettingConfig(xhpcSettingConfig);
if(i>0){
return R.ok();
}
return R.fail("保存失败");
}
@Override
public Map<String,Object> getXhpcSettingConfigStatus(HttpServletRequest request, Integer status) {
//获取登陆用户
Long userId = SecurityUtils.getUserId();
//桩的统计该时段金额
LoginUser logUser = logUserUtils.getLogUser(request);
String tenantId = logUser.getSysUser().getTenantId();
return xhpcSettingConfigMapper.getXhpcSettingConfigStatus(status,tenantId);
}
}

View File

@ -0,0 +1,248 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xhpc.payment.mapper.XhpcSettingConfigMapper">
<resultMap type="com.xhpc.common.domain.XhpcSettingConfig" id="XhpcSettingConfigResult">
<result column="setting_config_id" property="settingConfigId"/>
<result column="wx_app_id" property="wxAppId"/>
<result column="wx_app_secret" property="wxAppSecret"/>
<result column="wx_mch_id" property="wxMchId"/>
<result column="wx_mch_key" property="wxMchKey"/>
<result column="wx_payment_url" property="wxPaymentUrl"/>
<result column="wx_callback_url" property="wxCallbackUrl"/>
<result column="wx_transfers_url" property="wxTransfersUrl"/>
<result column="wx_apiclient_cert_pem" property="wxApiclientCertPem"/>
<result column="wx_apiclient_key_pem" property="wxApiclientKeyPem"/>
<result column="wx_app_cert_public_key" property="wxAppCertPublicKey"/>
<result column="zfb_app_id" property="zfbAppId"/>
<result column="zfb_private_key" property="zfbPrivateKey"/>
<result column="zfb_callback_url" property="zfbCallbackUrl"/>
<result column="zfb_app_cert_public_key" property="zfbAppCertPublicKey"/>
<result column="zfb_alipay_cert_public_key_rsa" property="zfbAlipayCertPublicKeyRsa" />
<result column="zfb_alipay_root_cert" property="zfbAlipayRootCert" />
<result column="zhb_server_url" property="zhbServerUrl" />
<result column="status" property="status" />
<result column="del_flag" property="delFlag" />
<result column="tenant_id" property="tenantId" />
</resultMap>
<insert id="insertXhpcSettingConfig" parameterType="com.xhpc.common.domain.XhpcSettingConfig" useGeneratedKeys="true"
keyProperty="settingConfigId">
INSERT INTO xhpc_setting_config
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="null != wxAppId and '' != wxAppId">
wx_app_id,
</if>
<if test="null != wxAppSecret and '' != wxAppSecret">
wx_app_secret,
</if>
<if test="null != wxMchId and '' != wxMchId">
wx_mch_id,
</if>
<if test="null != wxMchKey and '' != wxMchKey">
wx_mch_key,
</if>
<if test="null != wxPaymentUrl and '' != wxPaymentUrl">
wx_payment_url,
</if>
<if test="null != wxCallbackUrl and '' != wxCallbackUrl">
wx_callback_url,
</if>
<if test="null != wxTransfersUrl and '' != wxTransfersUrl">
wx_transfers_url,
</if>
<if test="null != wxApiclientCertPem and '' != wxApiclientCertPem">
wx_apiclient_cert_pem,
</if>
<if test="null != wxApiclientKeyPem and '' != wxApiclientKeyPem">
wx_apiclient_key_pem,
</if>
<if test="null != wxAppCertPublicKey and ''!=wxAppCertPublicKey">
wx_app_cert_public_key,
</if>
<if test="null != zfbAppId and '' != zfbAppId">
zfb_app_id,
</if>
<if test="null != zfbPrivateKey and '' !=zfbPrivateKey">
zfb_private_key,
</if>
<if test="null != zfbCallbackUrl and '' != zfbCallbackUrl">
zfb_callback_url,
</if>
<if test="null != zfbAppCertPublicKey and '' != zfbAppCertPublicKey">
zfb_app_cert_public_key,
</if>
<if test="null != zfbAlipayCertPublicKeyRsa and ''!=zfbAlipayCertPublicKeyRsa">
zfb_alipay_cert_public_key_rsa,
</if>
<if test="null != zfbAlipayRootCert and ''!=zfbAlipayRootCert">
zfb_alipay_root_cert,
</if>
<if test="null != zhbServerUrl and ''!=zhbServerUrl">
zhb_server_url,
</if>
<if test="null != status">
status,
</if>
<if test="null != tenantId and ''!=tenantId">
tenant_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="null != wxAppId and '' != wxAppId">
#{wxAppId},
</if>
<if test="null != wxAppSecret and '' != wxAppSecret">
#{wxAppSecret},
</if>
<if test="null != wxMchId and '' != wxMchId">
#{wxMchId},
</if>
<if test="null != wxMchKey and '' != wxMchKey">
#{wxMchKey},
</if>
<if test="null != wxPaymentUrl and '' != wxPaymentUrl">
#{wxPaymentUrl},
</if>
<if test="null != wxCallbackUrl and '' != wxCallbackUrl">
#{wxCallbackUrl},
</if>
<if test="null != wxTransfersUrl and '' != wxTransfersUrl">
#{wxTransfersUrl},
</if>
<if test="null != wxApiclientCertPem and '' != wxApiclientCertPem">
#{wxApiclientCertPem},
</if>
<if test="null != wxApiclientKeyPem and '' != wxApiclientKeyPem">
#{wxApiclientKeyPem},
</if>
<if test="null != wxAppCertPublicKey and ''!=wxAppCertPublicKey">
#{wxAppCertPublicKey},
</if>
<if test="null != zfbAppId and '' != zfbAppId">
#{zfbAppId},
</if>
<if test="null != zfbPrivateKey and '' !=zfbPrivateKey">
#{zfbPrivateKey},
</if>
<if test="null != zfbCallbackUrl and '' != zfbCallbackUrl">
#{zfbCallbackUrl},
</if>
<if test="null != zfbAppCertPublicKey and '' != zfbAppCertPublicKey">
#{zfbAppCertPublicKey},
</if>
<if test="null != zfbAlipayCertPublicKeyRsa and ''!=zfbAlipayCertPublicKeyRsa">
#{zfbAlipayCertPublicKeyRsa},
</if>
<if test="null != zfbAlipayRootCert and ''!=zfbAlipayRootCert">
#{zfbAlipayRootCert},
</if>
<if test="null != zhbServerUrl and ''!=zhbServerUrl">
#{zhbServerUrl},
</if>
<if test="null != status">
#{status},
</if>
<if test="null != tenantId and ''!=tenantId">
#{tenantId},
</if>
</trim>
</insert>
<update id="updateXhpcSettingConfig" parameterType="com.xhpc.common.domain.XhpcSettingConfig">
UPDATE xhpc_setting_config
<set>
<if test="null != wxAppId and '' != wxAppId">
wx_app_id =#{wxAppId},
</if>
<if test="null != wxAppSecret and '' != wxAppSecret">
wx_app_secret =#{wxAppSecret},
</if>
<if test="null != wxMchId and '' != wxMchId">
wx_mch_id =#{wxMchId},
</if>
<if test="null != wxMchKey and '' != wxMchKey">
wx_mch_key =#{wxMchKey},
</if>
<if test="null != wxPaymentUrl and '' != wxPaymentUrl">
wx_payment_url =#{wxPaymentUrl},
</if>
<if test="null != wxCallbackUrl and '' != wxCallbackUrl">
wx_callback_url =#{wxCallbackUrl},
</if>
<if test="null != wxTransfersUrl and '' != wxTransfersUrl">
wx_transfers_url =#{wxTransfersUrl},
</if>
<if test="null != wxApiclientCertPem and '' != wxApiclientCertPem">
wx_apiclient_cert_pem =#{wxApiclientCertPem},
</if>
<if test="null != wxApiclientKeyPem and '' != wxApiclientKeyPem">
wx_apiclient_key_pem = #{wxApiclientKeyPem},
</if>
<if test="null != wxAppCertPublicKey and ''!=wxAppCertPublicKey">
wx_app_cert_public_key =#{wxAppCertPublicKey},
</if>
<if test="null != zfbAppId and '' != zfbAppId">
zfb_app_id =#{zfbAppId},
</if>
<if test="null != zfbPrivateKey and '' !=zfbPrivateKey">
zfb_private_key =#{zfbPrivateKey},
</if>
<if test="null != zfbCallbackUrl and '' != zfbCallbackUrl">
zfb_callback_url =#{zfbCallbackUrl},
</if>
<if test="null != zfbAppCertPublicKey and '' != zfbAppCertPublicKey">
zfb_app_cert_public_key =#{zfbAppCertPublicKey},
</if>
<if test="null != zfbAlipayCertPublicKeyRsa and ''!=zfbAlipayCertPublicKeyRsa">
zfb_alipay_cert_public_key_rsa =#{zfbAlipayCertPublicKeyRsa},
</if>
<if test="null != zfbAlipayRootCert and ''!=zfbAlipayRootCert">
zfb_alipay_root_cert =#{zfbAlipayRootCert},
</if>
<if test="null != zhbServerUrl and ''!=zhbServerUrl">
zhb_server_url =#{zhbServerUrl},
</if>
<if test="null != status">
status =#{status},
</if>
<if test="null != tenantId and ''!=tenantId">
tenant_id =#{tenantId},
</if>
</set>
WHERE setting_config_id = #{settingConfigId}
</update>
<select id="getXhpcSettingConfigStatus" parameterType="java.lang.Long" resultType="java.util.Map">
select
setting_config_id as settingConfigId,
wx_app_id as wxAppId,
wx_app_secret as wxAppSecret,
wx_mch_id as wxMchId,
wx_mch_key as wxMchKey,
wx_payment_url as wxPaymentUrl,
wx_callback_url as wxCallbackUrl,
wx_transfers_url as wxTransfersUrl,
concat("https://xhpc-bucket1.oss-cn-hangzhou.aliyuncs.com/avatar/logo.png") as wxApiclientCertPem,
concat("https://xhpc-bucket1.oss-cn-hangzhou.aliyuncs.com/avatar/logo.png") as wxApiclientKeyPem,
concat("https://xhpc-bucket1.oss-cn-hangzhou.aliyuncs.com/avatar/logo.png") as wxAppCertPublicKey,
zfb_app_id as zfbAppId,
zfb_private_key as zfbPrivateKey,
zfb_callback_url as zfbCallbackUrl,
concat("https://xhpc-bucket1.oss-cn-hangzhou.aliyuncs.com/avatar/logo.png") as zfbAppCertPublicKey,
concat("https://xhpc-bucket1.oss-cn-hangzhou.aliyuncs.com/avatar/logo.png") as zfbAlipayCertPublicKeyRsa,
concat("https://xhpc-bucket1.oss-cn-hangzhou.aliyuncs.com/avatar/logo.png") as zfbAlipayRootCert,
zhb_server_url as zhbServerUrl,
status as status,
del_flag as delFlag,
tenant_id as tenantId
from xhpc_setting_config
where del_flag = 0 and status = #{status} and tenant_id=#{tenantId}
</select>
</mapper>