From 50e5af7b22360cf5b19454b29154dbbc868ec9a2 Mon Sep 17 00:00:00 2001 From: yuyang Date: Mon, 14 Feb 2022 16:31:01 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=94=AF=E4=BB=98=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E8=AE=BE=E7=BD=AE=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/XhpcRefundAuditController.java | 2 +- .../XhpcSettingConfigController.java | 164 ++++++++++++ .../mapper/XhpcSettingConfigMapper.java | 20 ++ .../service/IXhpcSettingConfigService.java | 21 ++ .../service/impl/XhpcSettingConfigImpl.java | 60 +++++ .../mapper/XhpcSettingConfigMapper.xml | 248 ++++++++++++++++++ 6 files changed, 514 insertions(+), 1 deletion(-) create mode 100644 xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/controller/XhpcSettingConfigController.java create mode 100644 xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/mapper/XhpcSettingConfigMapper.java create mode 100644 xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/service/IXhpcSettingConfigService.java create mode 100644 xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/service/impl/XhpcSettingConfigImpl.java create mode 100644 xhpc-modules/xhpc-payment/src/main/resources/mapper/XhpcSettingConfigMapper.xml diff --git a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/controller/XhpcRefundAuditController.java b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/controller/XhpcRefundAuditController.java index d11205eb..afb2eb18 100644 --- a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/controller/XhpcRefundAuditController.java +++ b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/controller/XhpcRefundAuditController.java @@ -726,7 +726,7 @@ public class XhpcRefundAuditController extends BaseController { @Scheduled(cron = "0/20 * * * * ? ") @GetMapping("/moneyPage") public void moneyPage(){ - logger.info("++++++++++++每1分钟,扫描一次,退款订单金额小于每20秒,自动审核通过++++++++++++++++"); + logger.info("++++++++++++每20秒,扫描一次,退款订单金额小于100,自动审核通过++++++++++++++++"); try { List list = iXhpcRefundOrderService.moneyPage(); if(list !=null && list.size()>0){ diff --git a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/controller/XhpcSettingConfigController.java b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/controller/XhpcSettingConfigController.java new file mode 100644 index 00000000..66472522 --- /dev/null +++ b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/controller/XhpcSettingConfigController.java @@ -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 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); + } + } +} diff --git a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/mapper/XhpcSettingConfigMapper.java b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/mapper/XhpcSettingConfigMapper.java new file mode 100644 index 00000000..b376fb13 --- /dev/null +++ b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/mapper/XhpcSettingConfigMapper.java @@ -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 getXhpcSettingConfigStatus(@Param("status") Integer status, @Param("tenantId")String tenantId); +} diff --git a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/service/IXhpcSettingConfigService.java b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/service/IXhpcSettingConfigService.java new file mode 100644 index 00000000..034ad298 --- /dev/null +++ b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/service/IXhpcSettingConfigService.java @@ -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 getXhpcSettingConfigStatus(HttpServletRequest request,Integer status); + +} diff --git a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/service/impl/XhpcSettingConfigImpl.java b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/service/impl/XhpcSettingConfigImpl.java new file mode 100644 index 00000000..238977e1 --- /dev/null +++ b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/service/impl/XhpcSettingConfigImpl.java @@ -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 getXhpcSettingConfigStatus(HttpServletRequest request, Integer status) { + + //获取登陆用户 + Long userId = SecurityUtils.getUserId(); + //桩的统计、该时段金额 + LoginUser logUser = logUserUtils.getLogUser(request); + String tenantId = logUser.getSysUser().getTenantId(); + return xhpcSettingConfigMapper.getXhpcSettingConfigStatus(status,tenantId); + } +} diff --git a/xhpc-modules/xhpc-payment/src/main/resources/mapper/XhpcSettingConfigMapper.xml b/xhpc-modules/xhpc-payment/src/main/resources/mapper/XhpcSettingConfigMapper.xml new file mode 100644 index 00000000..c4088027 --- /dev/null +++ b/xhpc-modules/xhpc-payment/src/main/resources/mapper/XhpcSettingConfigMapper.xml @@ -0,0 +1,248 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + INSERT INTO xhpc_setting_config + + + wx_app_id, + + + wx_app_secret, + + + wx_mch_id, + + + wx_mch_key, + + + wx_payment_url, + + + wx_callback_url, + + + wx_transfers_url, + + + wx_apiclient_cert_pem, + + + wx_apiclient_key_pem, + + + wx_app_cert_public_key, + + + zfb_app_id, + + + zfb_private_key, + + + zfb_callback_url, + + + zfb_app_cert_public_key, + + + zfb_alipay_cert_public_key_rsa, + + + zfb_alipay_root_cert, + + + zhb_server_url, + + + status, + + + tenant_id, + + + + + + #{wxAppId}, + + + #{wxAppSecret}, + + + #{wxMchId}, + + + #{wxMchKey}, + + + #{wxPaymentUrl}, + + + #{wxCallbackUrl}, + + + #{wxTransfersUrl}, + + + #{wxApiclientCertPem}, + + + #{wxApiclientKeyPem}, + + + #{wxAppCertPublicKey}, + + + #{zfbAppId}, + + + #{zfbPrivateKey}, + + + #{zfbCallbackUrl}, + + + #{zfbAppCertPublicKey}, + + + #{zfbAlipayCertPublicKeyRsa}, + + + #{zfbAlipayRootCert}, + + + #{zhbServerUrl}, + + + #{status}, + + + #{tenantId}, + + + + + + UPDATE xhpc_setting_config + + + + wx_app_id =#{wxAppId}, + + + wx_app_secret =#{wxAppSecret}, + + + wx_mch_id =#{wxMchId}, + + + wx_mch_key =#{wxMchKey}, + + + wx_payment_url =#{wxPaymentUrl}, + + + wx_callback_url =#{wxCallbackUrl}, + + + wx_transfers_url =#{wxTransfersUrl}, + + + wx_apiclient_cert_pem =#{wxApiclientCertPem}, + + + wx_apiclient_key_pem = #{wxApiclientKeyPem}, + + + wx_app_cert_public_key =#{wxAppCertPublicKey}, + + + zfb_app_id =#{zfbAppId}, + + + zfb_private_key =#{zfbPrivateKey}, + + + zfb_callback_url =#{zfbCallbackUrl}, + + + zfb_app_cert_public_key =#{zfbAppCertPublicKey}, + + + zfb_alipay_cert_public_key_rsa =#{zfbAlipayCertPublicKeyRsa}, + + + zfb_alipay_root_cert =#{zfbAlipayRootCert}, + + + zhb_server_url =#{zhbServerUrl}, + + + status =#{status}, + + + tenant_id =#{tenantId}, + + + WHERE setting_config_id = #{settingConfigId} + + + + + + \ No newline at end of file