From e0a7b836464d6fcc037d46f845b8faf39cb5b13e Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期二, 07 四月 2026 14:58:02 +0800
Subject: [PATCH] Merge branch 'master' of http://139.186.142.91:10010/r/productDev/gtzxinglijicun
---
server/admin/pom.xml | 2
server/admin/src/main/java/com/doumee/GTAdminApplication.java | 6
server/services/src/main/java/com/doumee/config/wx/WxMiniConfig.java | 125 +----
server/.gitignore | 1
server/services/src/main/resources/application-dev.yml | 83 ---
/dev/null | 330 ----------------
server/services/src/main/java/com/doumee/config/wx/WxMiniUtilService.java | 55 +-
server/services/src/main/java/com/doumee/dao/vo/PayResponse.java | 31 +
server/web/src/main/java/com/doumee/api/web/UserApi.java | 23 -
server/services/src/main/resources/application-test.yml | 2
server/services/src/main/java/com/doumee/config/wx/WxPayProperties.java | 31 -
server/services/src/main/java/com/doumee/core/constants/Constants.java | 44 ++
server/web/src/main/java/com/doumee/GTWebApplication.java | 5
server/services/src/main/java/com/doumee/service/business/WithdrawalOrdersService.java | 4
server/services/src/main/resources/application-pro.yml | 4
server/web/pom.xml | 2
server/admin/src/main/java/com/doumee/api/business/PaymentCallback.java | 244 ------------
server/services/src/main/java/com/doumee/service/business/impl/OrdersServiceImpl.java | 58 +-
server/services/src/main/java/com/doumee/service/business/impl/WithdrawalOrdersServiceImpl.java | 125 ------
19 files changed, 183 insertions(+), 992 deletions(-)
diff --git a/server/.gitignore b/server/.gitignore
index 6bceb95..9c5e6bd 100644
--- a/server/.gitignore
+++ b/server/.gitignore
@@ -24,3 +24,4 @@
# Package Files #
*.jar
*.war
+/CLAUDE.md
diff --git a/server/admin/pom.xml b/server/admin/pom.xml
index 226bc1c..ae73a6a 100644
--- a/server/admin/pom.xml
+++ b/server/admin/pom.xml
@@ -52,7 +52,7 @@
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<fork>true</fork>
- <mainClass>com.doumee.JKAdminApplication</mainClass>
+ <mainClass>com.doumee.GTAdminApplication</mainClass>
<layout>ZIP</layout>
</configuration>
<executions>
diff --git a/server/admin/src/main/java/com/doumee/JKAdminApplication.java b/server/admin/src/main/java/com/doumee/GTAdminApplication.java
similarity index 82%
rename from server/admin/src/main/java/com/doumee/JKAdminApplication.java
rename to server/admin/src/main/java/com/doumee/GTAdminApplication.java
index 73cbe4e..15cb4c4 100644
--- a/server/admin/src/main/java/com/doumee/JKAdminApplication.java
+++ b/server/admin/src/main/java/com/doumee/GTAdminApplication.java
@@ -18,14 +18,14 @@
@SpringBootApplication
@MapperScan("com.doumee.dao")
@EnableAsync
-public class JKAdminApplication extends SpringBootServletInitializer {
+public class GTAdminApplication extends SpringBootServletInitializer {
public static void main(String[] args) {
- ApplicationContext context = SpringApplication.run(JKAdminApplication.class);
+ ApplicationContext context = SpringApplication.run(GTAdminApplication.class);
context.getEnvironment();
}
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
- return builder.sources(JKAdminApplication.class) ;
+ return builder.sources(GTAdminApplication.class) ;
}
}
diff --git a/server/admin/src/main/java/com/doumee/api/business/PaymentCallback.java b/server/admin/src/main/java/com/doumee/api/business/PaymentCallback.java
index 1c2656f..d719e4b 100644
--- a/server/admin/src/main/java/com/doumee/api/business/PaymentCallback.java
+++ b/server/admin/src/main/java/com/doumee/api/business/PaymentCallback.java
@@ -53,248 +53,4 @@
@Autowired
private WithdrawalOrdersService withdrawalOrdersService;
- /**
- * 銆愬井淇℃敮浠樸�戝紓姝ラ�氱煡
- *
- * @return
- */
- @PostMapping("/web/wxPayNotify")
- public ApiResponse wxPay_notify(HttpServletRequest request) {
- log.error("寰俊鏀粯鍥炶皟缁撴灉寮�濮�===========" );
- try {
- ServletInputStream inputStream = request.getInputStream();
- StringBuffer stringBuffer = new StringBuffer();
- BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
- String s;
- //璇诲彇鍥炶皟璇锋眰浣�
- while ((s = bufferedReader.readLine()) != null) {
- stringBuffer.append(s);
- }
- String body = stringBuffer.toString();
- String timestamp = request.getHeader("Wechatpay-Timestamp");
- String nonce = request.getHeader("Wechatpay-Nonce");
- String signType = request.getHeader("Wechatpay-Signature-Type");
- String serialNo = request.getHeader("wechatpay-Serial");
- String signature = request.getHeader("Wechatpay-Signature");
- RequestParam requestParam = new RequestParam.Builder()
- .serialNumber(serialNo)
- .nonce(nonce)
- .signType(signType)
- .signature(signature)
- .timestamp(String.valueOf(timestamp))
- .body(body)
- .build();
-
- NotificationConfig config = new RSAPublicKeyConfig.Builder()
- .merchantId(WxMiniConfig.wxProperties.getMchId())
- .privateKeyFromPath(WxMiniConfig.wxProperties.getPrivateKeyPath())
- .publicKeyFromPath(WxMiniConfig.wxProperties.getPubKeyPath())
- .publicKeyId(WxMiniConfig.wxProperties.getPayPublicKeyId())
- .merchantSerialNumber(WxMiniConfig.wxProperties.getSerialNumer())
- .apiV3Key(WxMiniConfig.wxProperties.getApiV3Key())
- .build();
-
-
- NotificationParser parser = new NotificationParser(config);
-
-
- Transaction result = parser.parse(requestParam, Transaction.class);
- log.error("鏀粯鍥炶皟淇℃伅锛歿}"+ JSONObject.toJSONString(result));
- //鑷畾涔夎鍗曞彿
- String outTradeNo = result.getOutTradeNo();
- //寰俊璁㈠崟鍙�
- String paymentNo = result.getTransactionId();
- if ("SUCCESS".equals(result.getTradeState().name())) {
- // 鏀粯鎴愬姛ge
- switch (result.getAttach()) {
- //鏀粯璁㈠崟鍥炶皟
- case "createOrder": {
- ordersService.payNotify(outTradeNo,paymentNo);
- break;
- }
- }
- } else {
- // 鏀粯澶辫触
- switch (result.getAttach()) {
- case "createOrder": {
- break;
- }
- }
- }
- log.error("寰俊鏀粯鍥炶皟缁撴灉缁撴潫===========" );
- return ApiResponse.success("澶勭悊鎴愬姛!");
- } catch (Exception e) {
- e.printStackTrace();
- log.error("寰俊鍥炶皟缁撴灉寮傚父,寮傚父鍘熷洜{}", e.getLocalizedMessage());
- return ApiResponse.failed("");
- }
- }
- @PostMapping("/web/wxRefundNotify")
- public ApiResponse wxRefundNotify(HttpServletRequest request) {
- log.error("寰俊閫�娆惧洖璋冪粨鏋滃紑濮�===========" );
- try {
- DefaultSecurityManager securityManager = new DefaultSecurityManager();
- SecurityUtils.setSecurityManager(securityManager);
- ServletInputStream inputStream = request.getInputStream();
- StringBuffer stringBuffer = new StringBuffer();
- BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
- String s;
- //璇诲彇鍥炶皟璇锋眰浣�
- while ((s = bufferedReader.readLine()) != null) {
- stringBuffer.append(s);
- }
- String body = stringBuffer.toString();
- String timestamp = request.getHeader("Wechatpay-Timestamp");
- String nonce = request.getHeader("Wechatpay-Nonce");
- String signType = request.getHeader("Wechatpay-Signature-Type");
- String serialNo = request.getHeader("wechatpay-Serial");
- String signature = request.getHeader("Wechatpay-Signature");
- RequestParam requestParam = new RequestParam.Builder()
- .serialNumber(serialNo)
- .nonce(nonce)
- .signType(signType)
- .signature(signature)
- .timestamp(String.valueOf(timestamp))
- .body(body)
- .build();
-
- NotificationConfig config = /*new RSAAutoCertificateConfig.Builder()
- .merchantId(WxMiniConfig.wxProperties.getMchId())
- .privateKeyFromPath(WxMiniConfig.wxProperties.getPrivateKeyPath())
- .merchantSerialNumber(WxMiniConfig.wxProperties.getSerialNumer())
- .apiV3Key(WxMiniConfig.wxProperties.getApiV3Key())
- .build();*/
- new RSAPublicKeyConfig.Builder()
- .merchantId(WxMiniConfig.wxProperties.getMchId())
- .privateKeyFromPath(WxMiniConfig.wxProperties.getPrivateKeyPath())
- .publicKeyFromPath(WxMiniConfig.wxProperties.getPubKeyPath())
- .publicKeyId(WxMiniConfig.wxProperties.getPayPublicKeyId())
- .merchantSerialNumber(WxMiniConfig.wxProperties.getSerialNumer())
- .apiV3Key(WxMiniConfig.wxProperties.getApiV3Key())
- .build();
-
- NotificationParser parser = new NotificationParser(config);
- RefundNotification result = parser.parse(requestParam, RefundNotification.class);
-// if ("SUCCESS".equals(result.getRefundStatus().name())) {
- // 鏀粯鎴愬姛ge
- ordersService.refundCallback(result);
-// }
- return ApiResponse.success("澶勭悊鎴愬姛");
- } catch (Exception e) {
- e.printStackTrace();
- log.error("寰俊鍥炶皟缁撴灉寮傚父,寮傚父鍘熷洜{}", e.getLocalizedMessage());
- return ApiResponse.failed("");
- }
- }
-
-
-
-
- /**
- * 寰俊鍟嗘埛闆剁嚎杞处 - 鍥炶皟閫氱煡
- * @Context娉ㄨВ 鎶奌TTP璇锋眰涓婁笅鏂囧璞℃敞鍏ヨ繘鏉ワ紝HttpServletRequest銆丠ttpServletResponse銆乁riInfo 绛�
- * @return
- */
- @PostMapping(value = "/web/wechat/transferNotify")
- public ApiResponse transferNotify( HttpServletRequest request) {
- Map<String,String> errMap = new HashMap<>();
- try {
- log.error("寰俊鍟嗘埛闆剁嚎杞处 - 鍥炶皟閫氱煡 /wxpay/callback");
-
- Config config = new RSAPublicKeyConfig.Builder()
- .merchantId(WxMiniConfig.wxProperties.getSubMchId()) //寰俊鏀粯鐨勫晢鎴峰彿
- .privateKeyFromPath(WxMiniConfig.wxProperties.getWechatPrivateKeyPath()) // 鍟嗘埛API璇佷功绉侀挜鐨勫瓨鏀捐矾寰�
- .publicKeyFromPath(WxMiniConfig.wxProperties.getWechatPubKeyPath()) //寰俊鏀粯鍏挜鐨勫瓨鏀捐矾寰�
- .publicKeyId(WxMiniConfig.wxProperties.getWechatPayPublicKeyId()) //寰俊鏀粯鍏挜ID
- .merchantSerialNumber(WxMiniConfig.wxProperties.getWechatSerialNumer()) //鍟嗘埛API璇佷功搴忓垪鍙�
- .apiV3Key(WxMiniConfig.wxProperties.getWechatApiV3Key()) //APIv3瀵嗛挜
- .build();
-
- TransferDetailEntityNew entity = wxSuccessCallback(request,config);
- log.error("transfer ok.{}",entity);
- //鍥炶皟鎴愬姛鍚庡鐞嗚嚜宸辩殑涓氬姟
- if(entity != null){
- if((entity.getState().equals(Constants.SUCCESS)
- || entity.getState().equals(Constants.CANCELLED)
- || entity.getState().equals(Constants.FAIL))
- && StringUtils.isNotBlank(entity.getOutBillNo())){
- withdrawalOrdersService.transferSuccess(entity.getOutBillNo(),entity.getState().equals(Constants.SUCCESS)?true:false);
- }
- }
- return ApiResponse.success("澶勭悊鎴愬姛");
- } catch (Exception e) {
- log.error("寰俊鍟嗘埛闆剁嚎杞处 - 鍥炶皟閫氱煡 /wxpay/callback锛氬紓甯革紒", e);
- errMap.put("code", "FAIL");
- errMap.put("message", "鏈嶅姟鍣ㄥ唴閮ㄩ敊璇�");
- return ApiResponse.failed("澶勭悊澶辫触");
- }
- }
-
- public TransferDetailEntityNew wxSuccessCallback(HttpServletRequest request,Config config) throws IOException {
- String requestBody = getBodyString(request, "UTF-8");
- //璇佷功搴忓垪鍙凤紙寰俊骞冲彴锛� 楠岀鐨勨�滃井淇℃敮浠樺钩鍙拌瘉涔︹�濇墍瀵瑰簲鐨勫钩鍙拌瘉涔﹀簭鍒楀彿
- String wechatPaySerial = request.getHeader("Wechatpay-Serial");
- //寰俊浼犻�掕繃鏉ョ殑绛惧悕 楠岀鐨勭鍚嶅��
- String wechatSignature = request.getHeader("Wechatpay-Signature");
- //楠岀鐨勬椂闂存埑
- String wechatTimestamp = request.getHeader("Wechatpay-Timestamp");
- //楠岀鐨勯殢鏈哄瓧绗︿覆
- String wechatpayNonce = request.getHeader("Wechatpay-Nonce");
- // 1. 鏋勯�� RequestParam
- RequestParam requestParam = new RequestParam.Builder()
- .serialNumber(wechatPaySerial)
- .nonce(wechatpayNonce)
- .signature(wechatSignature)
- .timestamp(wechatTimestamp)
- .body(requestBody)
- .build();
- // 2. 鏋勫缓Config RSAPublicKeyConfig
-// Config config = new RSAPublicKeyConfig.Builder()
-// .merchantId(WxMiniConfig.wxProperties.getMchId()) //寰俊鏀粯鐨勫晢鎴峰彿
-// .privateKeyFromPath(WxMiniConfig.wxProperties.getPrivateKeyPath()) // 鍟嗘埛API璇佷功绉侀挜鐨勫瓨鏀捐矾寰�
-// .publicKeyFromPath(WxMiniConfig.wxProperties.getWechatPubKeyPath()) //寰俊鏀粯鍏挜鐨勫瓨鏀捐矾寰�
-// .publicKeyId(WxMiniConfig.wxProperties.getWechatPayPublicKeyId()) //寰俊鏀粯鍏挜ID
-// .merchantSerialNumber(WxMiniConfig.wxProperties.getSerialNumer()) //鍟嗘埛API璇佷功搴忓垪鍙�
-// .apiV3Key("") //APIv3瀵嗛挜
-// .build();
- log.info("WxPayService.wxPaySuccessCallback request : wechatPaySerial is [{}] , wechatSignature is [{}] , wechatTimestamp is [{}] , wechatpayNonce is [{}] , requestBody is [{}]",wechatPaySerial,wechatSignature,wechatTimestamp,wechatpayNonce,requestBody);
- // 3. 鍒濆鍖� NotificationParser
- NotificationParser parser = new NotificationParser((NotificationConfig) config);
- try {
- TransferDetailEntityNew entity = parser.parse(requestParam, TransferDetailEntityNew.class);
- log.info("WxPayService.wxPaySuccessCallback responseBody: {}", entity != null ? JSON.toJSONString(entity) : null);
- return entity;
- } catch (Exception e) {
- log.error("Exception occurred while processing", e);
- throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"绯荤粺鍐呴儴閿欒");
- }
- }
-
- /**
- * 鑾峰彇post璇锋眰涓殑Body
- *
- * @param request httpRequest
- * @return body瀛楃涓�
- */
- public static String getBodyString(HttpServletRequest request, String charSet) throws IOException {
- StringBuilder sb = new StringBuilder();
- InputStream inputStream = null;
- BufferedReader reader = null;
- try {
- inputStream = request.getInputStream();
- //璇诲彇娴佸苟灏嗘祦鍐欏嚭鍘�,閬垮厤鏁版嵁娴佷腑鏂�;
- reader = new BufferedReader(new InputStreamReader(inputStream, charSet));
- String line;
- while ((line = reader.readLine()) != null) {
- sb.append(line);
- }
- } catch (IOException e) {
- log.error("鑾峰彇requestBody寮傚父", e);
- } finally {
- inputStream.close();
- reader.close();
- }
- return sb.toString();
- }
-
}
diff --git a/server/services/src/main/java/com/doumee/config/wx/TransferToUser.java b/server/services/src/main/java/com/doumee/config/wx/TransferToUser.java
deleted file mode 100644
index 2cf6e01..0000000
--- a/server/services/src/main/java/com/doumee/config/wx/TransferToUser.java
+++ /dev/null
@@ -1,330 +0,0 @@
-package com.doumee.config.wx;
-
-import com.alibaba.fastjson.JSONObject;
-import com.google.gson.annotations.Expose;
-import com.google.gson.annotations.SerializedName;
-import okhttp3.*;
-import org.springframework.beans.factory.annotation.Autowired;
-
-import java.io.IOException;
-import java.io.UncheckedIOException;
-import java.security.PrivateKey;
-import java.security.PublicKey;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Created by IntelliJ IDEA.
- *
- * @Author : Rk
- * @create 2025/7/17 9:19
- */
-public class TransferToUser {
-
- private static String HOST = "https://api.mch.weixin.qq.com";
- private static String METHOD = "POST";
- private static String PATH = "/v3/fund-app/mch-transfer/transfer-bills";
- private static String CANCEL_PATH = "/v3/fund-app/mch-transfer/transfer-bills/out-bill-no/{out_bill_no}/cancel";
-
-
- public TransferToUser(String mchid, String certificateSerialNo, String privateKeyFilePath, String wechatPayPublicKeyId, String wechatPayPublicKeyFilePath) {
- this.mchid = mchid;
- this.certificateSerialNo = certificateSerialNo;
- this.privateKey = WXPayUtility.loadPrivateKeyFromPath(privateKeyFilePath);
- this.wechatPayPublicKeyId = wechatPayPublicKeyId;
- this.wechatPayPublicKey = WXPayUtility.loadPublicKeyFromPath(wechatPayPublicKeyFilePath);
- }
-
- public static void main(String[] args) {
- // TODO: 璇峰噯澶囧晢鎴峰紑鍙戝繀瑕佸弬鏁帮紝鍙傝�冿細https://pay.weixin.qq.com/doc/v3/merchant/4013070756
-// TransferToUser client = new TransferToUser(
-// "1229817002", // 鍟嗘埛鍙凤紝鏄敱寰俊鏀粯绯荤粺鐢熸垚骞跺垎閰嶇粰姣忎釜鍟嗘埛鐨勫敮涓�鏍囪瘑绗︼紝鍟嗘埛鍙疯幏鍙栨柟寮忓弬鑰� https://pay.weixin.qq.com/doc/v3/merchant/4013070756
-// "3FE90C2F3D40A56E1C51926F31B8A8D22426CCE0", // 鍟嗘埛API璇佷功搴忓垪鍙凤紝濡備綍鑾峰彇璇峰弬鑰� https://pay.weixin.qq.com/doc/v3/merchant/4013053053
-// "d://wechatApiclient_key.pem", // 鍟嗘埛API璇佷功绉侀挜鏂囦欢璺緞锛屾湰鍦版枃浠惰矾寰�
-// "PUB_KEY_ID_0112298170022025071700291836000600", // 寰俊鏀粯鍏挜ID锛屽浣曡幏鍙栬鍙傝�� https://pay.weixin.qq.com/doc/v3/merchant/4013038816
-// "d://pub_key.pem" // 寰俊鏀粯鍏挜鏂囦欢璺緞锛屾湰鍦版枃浠惰矾寰�
-// );
-
- TransferToUser client = new TransferToUser(
- "1723326069", // 鍟嗘埛鍙凤紝鏄敱寰俊鏀粯绯荤粺鐢熸垚骞跺垎閰嶇粰姣忎釜鍟嗘埛鐨勫敮涓�鏍囪瘑绗︼紝鍟嗘埛鍙疯幏鍙栨柟寮忓弬鑰� https://pay.weixin.qq.com/doc/v3/merchant/4013070756
- "12C0F0DD0F3D2B565B45586D3FEA225EBF723BEC", // 鍟嗘埛API璇佷功搴忓垪鍙凤紝濡備綍鑾峰彇璇峰弬鑰� https://pay.weixin.qq.com/doc/v3/merchant/4013053053
- "d://jinkuai/shanghu/apiclient_key.pem", // 鍟嗘埛API璇佷功绉侀挜鏂囦欢璺緞锛屾湰鍦版枃浠惰矾寰�
- "PUB_KEY_ID_0117233260692025072500181939000603", // 寰俊鏀粯鍏挜ID锛屽浣曡幏鍙栬鍙傝�� https://pay.weixin.qq.com/doc/v3/merchant/4013038816
- "d://jinkuai/shanghu/pub_key.pem" // 寰俊鏀粯鍏挜鏂囦欢璺緞锛屾湰鍦版枃浠惰矾寰�
- );
-
- TransferToUserRequest request = new TransferToUserRequest();
- request.appid = "wx332441ae5b12be7d"; //灏忕▼搴廼d
- request.outBillNo = "plfk2020042016";
- request.transferSceneId = "1005";
- request.openid = "oFucG7Nu5teWNIZiWkAINfAE4glE";
-// request.userName = client.encrypt("鏂芥棴杈�");
- request.transferAmount = 10L;
- request.transferRemark = "~~~";
-// request.notifyUrl = "https://www.weixin.qq.com/wxpay/pay.php";
- request.userRecvPerception = "鍔冲姟鎶ラ叕";
- request.transferSceneReportInfos = new ArrayList<>();
- {
- TransferSceneReportInfo item0 = new TransferSceneReportInfo();
- item0.infoType = "宀椾綅绫诲瀷";
- item0.infoContent = "瀹屾垚璁㈠崟";
- request.transferSceneReportInfos.add(item0);
- TransferSceneReportInfo item1 = new TransferSceneReportInfo();
- item1.infoType = "鎶ラ叕璇存槑";
- item1.infoContent = "璁㈠崟鎶ラ叕";
- request.transferSceneReportInfos.add(item1);
- };
- try {
- TransferToUserResponse response = client.testRun(request);
- // TODO: 璇锋眰鎴愬姛锛岀户缁笟鍔¢�昏緫
- System.out.println(JSONObject.toJSONString(response));
- } catch (WXPayUtility.ApiException e) {
- // TODO: 璇锋眰澶辫触锛屾牴鎹姸鎬佺爜鎵ц涓嶅悓鐨勯�昏緫
- e.printStackTrace();
- }
- }
-
- private final String mchid;
- private final String certificateSerialNo;
- private final PrivateKey privateKey;
- private final String wechatPayPublicKeyId;
- private final PublicKey wechatPayPublicKey;
-
-
- public TransferToUserResponse testRun(TransferToUserRequest request) {
- String uri = PATH;
- String reqBody = WXPayUtility.toJson(request);
-
- Request.Builder reqBuilder = new Request.Builder().url(HOST + uri);
- reqBuilder.addHeader("Accept", "application/json");
- reqBuilder.addHeader("Wechatpay-Serial", wechatPayPublicKeyId);
- reqBuilder.addHeader("Authorization", WXPayUtility.buildAuthorization(mchid, certificateSerialNo,privateKey, METHOD, uri, reqBody));
- reqBuilder.addHeader("Content-Type", "application/json");
- RequestBody requestBody = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), reqBody);
- reqBuilder.method(METHOD, requestBody);
- Request httpRequest = reqBuilder.build();
-
- // 鍙戦�丠TTP璇锋眰
- OkHttpClient client = new OkHttpClient.Builder().build();
- try (Response httpResponse = client.newCall(httpRequest).execute()) {
- String respBody = WXPayUtility.extractBody(httpResponse);
- if (httpResponse.code() >= 200 && httpResponse.code() < 300) {
- // 2XX 鎴愬姛锛岄獙璇佸簲绛旂鍚�
- WXPayUtility.validateResponse(this.wechatPayPublicKeyId, this.wechatPayPublicKey,
- httpResponse.headers(), respBody);
-
- // 浠嶩TTP搴旂瓟鎶ユ枃鏋勫缓杩斿洖鏁版嵁
- return WXPayUtility.fromJson(respBody, TransferToUserResponse.class);
- } else {
- throw new WXPayUtility.ApiException(httpResponse.code(), respBody, httpResponse.headers());
- }
- } catch (IOException e) {
- throw new UncheckedIOException("Sending request to " + uri + " failed.", e);
- }
- }
-
- public TransferToUserResponse run(TransferToUserRequest request,String name) {
- String uri = PATH;
- request.appid = WxMiniConfig.wxProperties.getSubAppId();
- request.notifyUrl = WxMiniConfig.wxProperties.getWechatNotifyUrl();
- request.transferSceneId = "1005";
- request.userRecvPerception = "鍔冲姟鎶ラ叕";
- if(request.transferAmount >= 30){
- request.userName = this.encrypt(name);
- }
-
- request.transferSceneReportInfos = new ArrayList<>();
- {
- TransferSceneReportInfo item0 = new TransferSceneReportInfo();
- item0.infoType = "宀椾綅绫诲瀷";
- item0.infoContent = "瀹屾垚璁㈠崟";
- request.transferSceneReportInfos.add(item0);
- TransferSceneReportInfo item1 = new TransferSceneReportInfo();
- item1.infoType = "鎶ラ叕璇存槑";
- item1.infoContent = "璁㈠崟鎶ラ叕";
- request.transferSceneReportInfos.add(item1);
- };
- String reqBody = WXPayUtility.toJson(request);
-
- Request.Builder reqBuilder = new Request.Builder().url(HOST + uri);
- reqBuilder.addHeader("Accept", "application/json");
- reqBuilder.addHeader("Wechatpay-Serial", WxMiniConfig.wxProperties.getWechatPayPublicKeyId());
- reqBuilder.addHeader("Authorization", WXPayUtility.buildAuthorization(WxMiniConfig.wxProperties.getSubMchId(),
- WxMiniConfig.wxProperties.getWechatSerialNumer(),
- WXPayUtility.loadPrivateKeyFromPath(WxMiniConfig.wxProperties.getWechatPrivateKeyPath()),
- METHOD, uri, reqBody));
-
-// reqBuilder.addHeader("Authorization", WXPayUtility.buildAuthorization(mchid, certificateSerialNo,privateKey, METHOD, uri, reqBody));
- reqBuilder.addHeader("Content-Type", "application/json");
- RequestBody requestBody = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), reqBody);
- reqBuilder.method(METHOD, requestBody);
- Request httpRequest = reqBuilder.build();
-
- // 鍙戦�丠TTP璇锋眰
- OkHttpClient client = new OkHttpClient.Builder().build();
- try (Response httpResponse = client.newCall(httpRequest).execute()) {
- String respBody = WXPayUtility.extractBody(httpResponse);
- if (httpResponse.code() >= 200 && httpResponse.code() < 300) {
- // 2XX 鎴愬姛锛岄獙璇佸簲绛旂鍚�
- WXPayUtility.validateResponse(WxMiniConfig.wxProperties.getWechatPayPublicKeyId(), WXPayUtility.loadPublicKeyFromPath(WxMiniConfig.wxProperties.getWechatPubKeyPath()),
- httpResponse.headers(), respBody);
-
- // 浠嶩TTP搴旂瓟鎶ユ枃鏋勫缓杩斿洖鏁版嵁
- TransferToUser.TransferToUserResponse response = WXPayUtility.fromJson(respBody, TransferToUserResponse.class);
- response.appId = request.appid;
- response.mchId = WxMiniConfig.wxProperties.getSubMchId();
- return response;
- } else {
- throw new WXPayUtility.ApiException(httpResponse.code(), respBody, httpResponse.headers());
- }
- } catch (IOException e) {
- throw new UncheckedIOException("Sending request to " + uri + " failed.", e);
- }
- }
-
-
- public TransferToUser.CancelTransferResponse cancelRun(TransferToUser.CancelTransferRequest request) {
- String uri = CANCEL_PATH;
- uri = uri.replace("{out_bill_no}", WXPayUtility.urlEncode(request.outBillNo));
-
- Request.Builder reqBuilder = new Request.Builder().url(HOST + uri);
- reqBuilder.addHeader("Accept", "application/json");
- reqBuilder.addHeader("Wechatpay-Serial", wechatPayPublicKeyId);
- reqBuilder.addHeader("Authorization", WXPayUtility.buildAuthorization(WxMiniConfig.wxProperties.getSubMchId(),
- WxMiniConfig.wxProperties.getWechatSerialNumer(),
- WXPayUtility.loadPrivateKeyFromPath(WxMiniConfig.wxProperties.getWechatPrivateKeyPath()),
- METHOD, uri, null));
- reqBuilder.addHeader("Content-Type", "application/json");
- RequestBody emptyBody = RequestBody.create(null, "");
- reqBuilder.method(METHOD, emptyBody);
- Request httpRequest = reqBuilder.build();
-
- // 鍙戦�丠TTP璇锋眰
- OkHttpClient client = new OkHttpClient.Builder().build();
- try (Response httpResponse = client.newCall(httpRequest).execute()) {
- String respBody = WXPayUtility.extractBody(httpResponse);
- if (httpResponse.code() >= 200 && httpResponse.code() < 300) {
- // 2XX 鎴愬姛锛岄獙璇佸簲绛旂鍚�
- WXPayUtility.validateResponse(WxMiniConfig.wxProperties.getWechatPayPublicKeyId(), WXPayUtility.loadPublicKeyFromPath(WxMiniConfig.wxProperties.getWechatPubKeyPath()),
- httpResponse.headers(), respBody);
-
- // 浠嶩TTP搴旂瓟鎶ユ枃鏋勫缓杩斿洖鏁版嵁
- return WXPayUtility.fromJson(respBody, TransferToUser.CancelTransferResponse.class);
- } else {
- throw new WXPayUtility.ApiException(httpResponse.code(), respBody, httpResponse.headers());
- }
- } catch (IOException e) {
- throw new UncheckedIOException("Sending request to " + uri + " failed.", e);
- }
- }
-
-
-
- public String encrypt(String plainText) {
- return WXPayUtility.encrypt(this.wechatPayPublicKey, plainText);
- }
-
- public static class TransferToUserResponse {
- @SerializedName("out_bill_no")
- public String outBillNo;
-
- @SerializedName("transfer_bill_no")
- public String transferBillNo;
-
- @SerializedName("create_time")
- public String createTime;
-
- @SerializedName("state")
- public TransferBillStatus state;
-
- @SerializedName("package_info")
- public String packageInfo;
-
- @SerializedName("mch_id")
- public String mchId;
-
- @SerializedName("app_id")
- public String appId;
- }
-
- public enum TransferBillStatus {
- @SerializedName("ACCEPTED")
- ACCEPTED,
- @SerializedName("PROCESSING")
- PROCESSING,
- @SerializedName("WAIT_USER_CONFIRM")
- WAIT_USER_CONFIRM,
- @SerializedName("TRANSFERING")
- TRANSFERING,
- @SerializedName("SUCCESS")
- SUCCESS,
- @SerializedName("FAIL")
- FAIL,
- @SerializedName("CANCELING")
- CANCELING,
- @SerializedName("CANCELLED")
- CANCELLED
- }
-
- public static class TransferSceneReportInfo {
- @SerializedName("info_type")
- public String infoType;
-
- @SerializedName("info_content")
- public String infoContent;
- }
-
- public static class TransferToUserRequest {
-
- @SerializedName("appid")
- public String appid;
-
- @SerializedName("out_bill_no")
- public String outBillNo;
-
- @SerializedName("transfer_scene_id")
- public String transferSceneId;
-
- @SerializedName("openid")
- public String openid;
-
- @SerializedName("user_name")
- public String userName;
-
- @SerializedName("transfer_amount")
- public Long transferAmount;
-
- @SerializedName("transfer_remark")
- public String transferRemark;
-
- @SerializedName("notify_url")
- public String notifyUrl;
-
- @SerializedName("user_recv_perception")
- public String userRecvPerception;
-
- @SerializedName("transfer_scene_report_infos")
- public List<TransferSceneReportInfo> transferSceneReportInfos;
- }
-
- public static class CancelTransferResponse {
- @SerializedName("out_bill_no")
- public String outBillNo;
-
- @SerializedName("transfer_bill_no")
- public String transferBillNo;
-
- @SerializedName("state")
- public String state;
-
- @SerializedName("update_time")
- public String updateTime;
- }
-
- public static class CancelTransferRequest {
- @SerializedName("out_bill_no")
- @Expose(serialize = false)
- public String outBillNo;
- }
-
-}
diff --git a/server/services/src/main/java/com/doumee/config/wx/WxMiniConfig.java b/server/services/src/main/java/com/doumee/config/wx/WxMiniConfig.java
index e9edac5..de47dc8 100644
--- a/server/services/src/main/java/com/doumee/config/wx/WxMiniConfig.java
+++ b/server/services/src/main/java/com/doumee/config/wx/WxMiniConfig.java
@@ -33,13 +33,11 @@
/********寰俊灏忕▼搴忔湇鍔�**********/
public static WxMaService wxMaService;
/********寰俊灏忕▼搴忔敮浠�**********/
- public static JsapiService wxPayService;
-// public static WxPayService wxPayV2Service;
- public static RefundService refundService;
- public static JsapiServiceExtension jsapiExtService;
- public static BillDownloadService billDownloadService;
- public static WxPayProperties wxProperties;
- public static TransferToUser transferToUser;
+ public static WxPayService wxPayService;
+ /********寰俊APP鏀粯**********/
+ public static WxPayService wxAppPayService;
+
+
@Autowired
private WxPayProperties wxPayProperties;
@@ -51,23 +49,15 @@
void init() {
this.load_WxMaService();
this.load_wxPayService();
-// this.load_wxPayV2Service();
- this.load_transferToUser();
- this.wxProperties = wxPayProperties;
+// this.load_wxAppPayService();
}
/**
* 鍒濆鍖栧井淇″皬绋嬪簭
*/
public void load_WxMaService() {
WxMaDefaultConfigImpl config = new WxMaDefaultConfigImpl();
- if(wxPayProperties.getExistsSub() ==1){
- //濡傛灉鏄湇鍔″晢鏀粯,鍙栧瓙鍟嗘埛淇℃伅
- config.setAppid(StringUtils.trimToNull(wxPayProperties.getSubAppId()));
- config.setSecret(StringUtils.trimToNull(wxPayProperties.getSubAppSecret()));
- }else {
-// config.setAppid(StringUtils.trimToNull(wxPayProperties.getAppId()));
-// config.setSecret(StringUtils.trimToNull(wxPayProperties.getAppSecret()));
- }
+ config.setAppid(StringUtils.trimToNull(wxPayProperties.getAppId()));
+ config.setSecret(StringUtils.trimToNull(wxPayProperties.getAppSecret()));
config.setMsgDataFormat("JSON");
//config.setToken("");
//config.setAesKey("");
@@ -79,98 +69,37 @@
/**
* 鍒濆鍖栧井淇″皬绋嬪簭鏀粯
*/
- public void load_wxPayService() {
- try {
- Config config =
- new RSAPublicKeyConfig.Builder()
- .merchantId(wxPayProperties.getMchId())
- .privateKeyFromPath(wxPayProperties.getPrivateKeyPath())
- .publicKeyFromPath(wxPayProperties.getPubKeyPath())
- .publicKeyId(wxPayProperties.getPayPublicKeyId())
- .merchantSerialNumber(wxPayProperties.getSerialNumer())
- .apiV3Key(wxPayProperties.getApiV3Key())
- .build();
-
-
-// Config config =
-// new RSAAutoCertificateConfig.Builder()
-// .merchantId(wxPayProperties.getMchId())
-// .privateKeyFromPath(wxPayProperties.getPrivateKeyPath())
-//// .publicKeyFromPath(wxPayProperties.getPubKeyPath())
-//// .publicKeyId("PUB_KEY_ID_0117000719222024112700219100000508")
-// .merchantSerialNumber(wxPayProperties.getSerialNumer())
-// .apiV3Key(wxPayProperties.getApiV3Key())
-// .build();
-// this.wxPayService = new JsapiService.Builder().config(config).build();
-
- this.jsapiExtService = new JsapiServiceExtension.Builder().config(config).build();
- this.refundService = new RefundService.Builder().config(config).build();
- this.billDownloadService = new BillDownloadService.Builder().config(config).build();
- }catch (Exception e){
- e.printStackTrace();
-
- }
+ public void load_wxPayService() {
+ WxPayConfig payConfig = new WxPayConfig();
+ payConfig.setTradeType(WxPayConstants.TradeType.JSAPI);
+ payConfig.setSignType(WxPayConstants.SignType.MD5);
+ payConfig.setAppId(StringUtils.trimToNull(wxPayProperties.getAppId()));
+ payConfig.setMchId(StringUtils.trimToNull(wxPayProperties.getMchId()));
+ payConfig.setMchKey(StringUtils.trimToNull(wxPayProperties.getMchKey()));
+ payConfig.setKeyPath(StringUtils.trimToNull(wxPayProperties.getKeyPath()));
+ payConfig.setNotifyUrl(StringUtils.trimToNull(wxPayProperties.getNotifyUrl()));
+ WxPayService wxPayService = new WxPayServiceImpl();
+ wxPayService.setConfig(payConfig);
+ this.wxPayService = wxPayService;
}
- /**
- * 鍒濆鍖栧井淇″皬绋嬪簭鏀粯
- */
-// public void load_wxPayV2Service()
-// {
-// WxPayConfig payConfig = new WxPayConfig();
-// payConfig.setTradeType(WxPayConstants.TradeType.JSAPI);
-// payConfig.setSignType(WxPayConstants.SignType.MD5);
-// payConfig.setAppId(StringUtils.trimToNull(wxPayProperties.getAppId()));
-// payConfig.setSubAppId(StringUtils.trimToNull(wxPayProperties.getSubAppId()));
-// payConfig.setMchId(StringUtils.trimToNull(wxPayProperties.getMchId()));
-// payConfig.setSubMchId(StringUtils.trimToNull(wxPayProperties.getSubMchId()));
-// payConfig.setMchKey(StringUtils.trimToNull(wxPayProperties.getMchKey()));
-//// payConfig.setKeyPath(StringUtils.trimToNull(wxPayProperties.getKeyPath()));
-// payConfig.setNotifyUrl(StringUtils.trimToNull(wxPayProperties.getNotifyUrl()));
-// WxPayService wxPayService = new WxPayServiceImpl();
-// wxPayService.setConfig(payConfig);
-// this.wxPayV2Service = wxPayService;
-// }
- /**
- * 鍒濆鍖栧井淇″皬绋嬪簭鏀粯
- */
-// public void load_wxPayService() {
+// /**
+// * 鍒濆鍖朅pp鏀粯
+// */
+// public void load_wxAppPayService() {
// WxPayConfig payConfig = new WxPayConfig();
-// payConfig.setTradeType(WxPayConstants.TradeType.JSAPI);
+// payConfig.setTradeType(WxPayConstants.TradeType.APP);
// payConfig.setSignType(WxPayConstants.SignType.MD5);
-// payConfig.setAppId(StringUtils.trimToNull(sysDictService.getSysDictValue(SysDictEnum.WX_MINI_AppID.getCode())));
+// payConfig.setAppId("");
// payConfig.setMchId(StringUtils.trimToNull(sysDictService.getSysDictValue(SysDictEnum.WX_MINI_MchId.getCode())));
// payConfig.setMchKey(StringUtils.trimToNull(sysDictService.getSysDictValue(SysDictEnum.WX_MINI_MchKey.getCode())));
// payConfig.setKeyPath(StringUtils.trimToNull(sysDictService.getSysDictValue(SysDictEnum.WX_MINI_KeyPath.getCode())));
// payConfig.setNotifyUrl(StringUtils.trimToNull(sysDictService.getSysDictValue(SysDictEnum.WX_MINI_NotifyUrl.getCode())));
// WxPayService wxPayService = new WxPayServiceImpl();
// wxPayService.setConfig(payConfig);
-// this.wxPayService = wxPayService;
+// this.wxAppPayService = wxPayService;
// }
-
-
- //杞处涓氬姟
- public void load_transferToUser()
- {
- TransferToUser transferToUser = new TransferToUser(
- StringUtils.trimToNull(wxPayProperties.getSubMchId()), //鍟嗘埛id
- StringUtils.trimToNull(wxPayProperties.getWechatSerialNumer()), //鍟嗘埛API璇佷功搴忓垪鍙凤紝濡備綍鑾峰彇璇峰弬鑰� https://pay.weixin.qq.com/doc/v3/merchant/4013053053
- StringUtils.trimToNull(wxPayProperties.getWechatPrivateKeyPath()), // 鍟嗘埛API璇佷功绉侀挜鏂囦欢璺緞锛屾湰鍦版枃浠惰矾寰�
- StringUtils.trimToNull(wxPayProperties.getWechatPayPublicKeyId()), // 寰俊鏀粯鍏挜ID锛屽浣曡幏鍙栬鍙傝�� https://pay.weixin.qq.com/doc/v3/merchant/4013038816
- StringUtils.trimToNull(wxPayProperties.getWechatPubKeyPath()) // 寰俊鏀粯鍏挜鏂囦欢璺緞锛屾湰鍦版枃浠惰矾寰�
- );
-
-// TransferToUser client = new TransferToUser(
-// "1229817002", // 鍟嗘埛鍙凤紝鏄敱寰俊鏀粯绯荤粺鐢熸垚骞跺垎閰嶇粰姣忎釜鍟嗘埛鐨勫敮涓�鏍囪瘑绗︼紝鍟嗘埛鍙疯幏鍙栨柟寮忓弬鑰� https://pay.weixin.qq.com/doc/v3/merchant/4013070756
-// "3FE90C2F3D40A56E1C51926F31B8A8D22426CCE0", // 鍟嗘埛API璇佷功搴忓垪鍙凤紝濡備綍鑾峰彇璇峰弬鑰� https://pay.weixin.qq.com/doc/v3/merchant/4013053053
-// "d://wechatApiclient_key.pem", // 鍟嗘埛API璇佷功绉侀挜鏂囦欢璺緞锛屾湰鍦版枃浠惰矾寰�
-// "PUB_KEY_ID_0112298170022025071700291836000600", // 寰俊鏀粯鍏挜ID锛屽浣曡幏鍙栬鍙傝�� https://pay.weixin.qq.com/doc/v3/merchant/4013038816
-// "d://pub_key.pem" // 寰俊鏀粯鍏挜鏂囦欢璺緞锛屾湰鍦版枃浠惰矾寰�
-// );
- this.transferToUser = transferToUser;
- }
-
}
diff --git a/server/services/src/main/java/com/doumee/config/wx/WxMiniUtilService.java b/server/services/src/main/java/com/doumee/config/wx/WxMiniUtilService.java
index 7be564e..736d9f3 100644
--- a/server/services/src/main/java/com/doumee/config/wx/WxMiniUtilService.java
+++ b/server/services/src/main/java/com/doumee/config/wx/WxMiniUtilService.java
@@ -49,33 +49,34 @@
@Transactional(rollbackFor = {BusinessException.class,Exception.class})
public boolean wxRefund(WithdrawalOrders withdrawalOrders,Orders orders) {
- // 鍙戦�侀��娆捐姹�
- withdrawalOrders.setCreateTime(new Date());
- withdrawalOrdersMapper.insert(withdrawalOrders);
- CreateRequest request = new CreateRequest();
- request.setOutTradeNo(orders.getOutTradeNo());
- request.setOutRefundNo(withdrawalOrders.getId().toString());
- request.setSubMchid(WxMiniConfig.wxProperties.getSubMchId());
- request.setNotifyUrl(WxMiniConfig.wxProperties.getRefundNotifyUrl());
- AmountReq amountReq = new AmountReq();
- amountReq.setTotal(1L);//withdrawalOrders.getAmount());
- amountReq.setRefund(1L);//withdrawalOrders.getAmount());
- amountReq.setCurrency("CNY");
- request.setAmount(amountReq);
- try {
- log.error("=============="+JSONObject.toJSONString(request));
- com.wechat.pay.java.service.refund.model.Refund response = WxMiniConfig.refundService.create(request);
- log.error("=============="+JSONObject.toJSONString(response));
- if ("SUCCESS".equals(response.getStatus().name())
- || "PROCESSING".equals(response.getStatus().name()) ) {
- return true;
- }else{
- throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝閫�娆剧敵璇峰け璐ュ摝锛�");
- }
- }catch (Exception e){
- e.printStackTrace();
- throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝閫�娆剧敵璇峰け璐ワ紒");
- }
+// // 鍙戦�侀��娆捐姹�
+// withdrawalOrders.setCreateTime(new Date());
+// withdrawalOrdersMapper.insert(withdrawalOrders);
+// CreateRequest request = new CreateRequest();
+// request.setOutTradeNo(orders.getOutTradeNo());
+// request.setOutRefundNo(withdrawalOrders.getId().toString());
+// request.setSubMchid(WxMiniConfig.wxProperties.getSubMchId());
+// request.setNotifyUrl(WxMiniConfig.wxProperties.getRefundNotifyUrl());
+// AmountReq amountReq = new AmountReq();
+// amountReq.setTotal(1L);//withdrawalOrders.getAmount());
+// amountReq.setRefund(1L);//withdrawalOrders.getAmount());
+// amountReq.setCurrency("CNY");
+// request.setAmount(amountReq);
+// try {
+// log.error("=============="+JSONObject.toJSONString(request));
+// com.wechat.pay.java.service.refund.model.Refund response = WxMiniConfig.wxPayService.refund(request);
+// log.error("=============="+JSONObject.toJSONString(response));
+// if ("SUCCESS".equals(response.getStatus().name())
+// || "PROCESSING".equals(response.getStatus().name()) ) {
+// return true;
+// }else{
+// throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝閫�娆剧敵璇峰け璐ュ摝锛�");
+// }
+// }catch (Exception e){
+// e.printStackTrace();
+// throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝閫�娆剧敵璇峰け璐ワ紒");
+// }
+ return false;
}
diff --git a/server/services/src/main/java/com/doumee/config/wx/WxPayProperties.java b/server/services/src/main/java/com/doumee/config/wx/WxPayProperties.java
index 3bf1ecf..5c86de7 100644
--- a/server/services/src/main/java/com/doumee/config/wx/WxPayProperties.java
+++ b/server/services/src/main/java/com/doumee/config/wx/WxPayProperties.java
@@ -15,11 +15,11 @@
@Data
public class WxPayProperties {
+
/**
* AppID
*/
private String appId;
- private String apiV3Key;
/**
* AppSecret
@@ -35,44 +35,15 @@
* 鏀粯API瀵嗛挜
*/
private String mchKey;
- /**
- * 鏀粯API瀵嗛挜
- */
-// private String subMchKey;
/**
* 鏀粯鍥炶皟鍦板潃
*/
private String notifyUrl;
- /**
- * 閫�娆惧洖璋冨湴鍧�
- */
- private String refundNotifyUrl;
/**
* 鏀粯璇佷功(p12)
*/
private String keyPath;
- private String serialNumer;
-
- private int existsSub;// true
- private String subAppId;//wxcd2b89fd2ff065f8
- private String subMchId;// 1229817002
- private String subAppSecret;// 1229817002
- private String typeId;// gybike
- private String privateKeyPath ;
- private String privateCertPath;// gybike
- private String pubKeyPath;//
- private String payPublicKeyId;//
-
-
- private String wechatSerialNumer;
- private String wechatPayPublicKeyId; // 寰俊鏀粯鍏挜ID
- private String wechatPubKeyPath; //寰俊鏀粯鍏挜鏂囦欢璺緞
- private String wechatPrivateKeyPath;
- private String wechatNotifyUrl;
- private String wechatApiV3Key;
-// private String wechatPlatformPubKeyPath;
-
}
diff --git a/server/services/src/main/java/com/doumee/core/constants/Constants.java b/server/services/src/main/java/com/doumee/core/constants/Constants.java
index 49726e0..f415282 100644
--- a/server/services/src/main/java/com/doumee/core/constants/Constants.java
+++ b/server/services/src/main/java/com/doumee/core/constants/Constants.java
@@ -3,8 +3,13 @@
import com.doumee.dao.business.model.Orders;
import lombok.AllArgsConstructor;
import lombok.Getter;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
+import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
import java.util.*;
/**
@@ -753,5 +758,44 @@
}
+ public static String getIpAddr() {
+ HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
+ String ipAddress = null;
+ try {
+ ipAddress = request.getHeader("x-forwarded-for");
+ if (ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) {
+ ipAddress = request.getHeader("Proxy-Client-IP");
+ }
+ if (ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) {
+ ipAddress = request.getHeader("WL-Proxy-Client-IP");
+ }
+ if (ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) {
+ ipAddress = request.getRemoteAddr();
+ if (ipAddress.equals("127.0.0.1")) {
+ // 鏍规嵁缃戝崱鍙栨湰鏈洪厤缃殑IP
+ InetAddress inet = null;
+ try {
+ inet = InetAddress.getLocalHost();
+ } catch (UnknownHostException e) {
+ e.printStackTrace();
+ }
+ ipAddress = inet.getHostAddress();
+ }
+ }
+ // 瀵逛簬閫氳繃澶氫釜浠g悊鐨勬儏鍐碉紝绗竴涓狪P涓哄鎴风鐪熷疄IP,澶氫釜IP鎸夌収','鍒嗗壊
+ if (ipAddress != null && ipAddress.length() > 15) { // "***.***.***.***".length()
+ // = 15
+ if (ipAddress.indexOf(",") > 0) {
+ ipAddress = ipAddress.substring(0, ipAddress.indexOf(","));
+ }
+ }
+ } catch (Exception e) {
+ ipAddress = "127.0.0.1";
+ }
+ // ipAddress = this.getRequest().getRemoteAddr();
+
+ return ipAddress;
+ }
+
}
diff --git a/server/services/src/main/java/com/doumee/dao/vo/PayResponse.java b/server/services/src/main/java/com/doumee/dao/vo/PayResponse.java
new file mode 100644
index 0000000..38456ff
--- /dev/null
+++ b/server/services/src/main/java/com/doumee/dao/vo/PayResponse.java
@@ -0,0 +1,31 @@
+package com.doumee.dao.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * Created by IntelliJ IDEA.
+ *
+ * @Author : Rk
+ * @create 2023/3/23 9:50
+ */
+@Data
+@ApiModel("鏀粯鐩稿簲绫�")
+public class PayResponse implements Serializable {
+
+ @ApiModelProperty(value = "鏀粯璁㈠崟涓婚敭")
+ private Integer orderId;
+
+ @ApiModelProperty(value = "鏀粯绫诲瀷锛�0=鐜伴噾鏀粯锛�1=绾Н鍒嗘敮浠�")
+ private Integer payType;
+
+ @ApiModelProperty(value = "寰俊璋冭捣涓氬姟")
+ private Object response;
+
+ @ApiModelProperty(value = "閿佸畾缂栧彿",hidden = true)
+ private String lockKey;
+
+}
diff --git a/server/services/src/main/java/com/doumee/service/business/WithdrawalOrdersService.java b/server/services/src/main/java/com/doumee/service/business/WithdrawalOrdersService.java
index 8d00463..53ebbc0 100644
--- a/server/services/src/main/java/com/doumee/service/business/WithdrawalOrdersService.java
+++ b/server/services/src/main/java/com/doumee/service/business/WithdrawalOrdersService.java
@@ -1,6 +1,5 @@
package com.doumee.service.business;
-import com.doumee.config.wx.TransferToUser;
import com.doumee.core.model.PageData;
import com.doumee.core.model.PageWrap;
import com.doumee.dao.business.model.WithdrawalOrders;
@@ -98,9 +97,6 @@
*/
long count(WithdrawalOrders withdrawalOrders);
- TransferToUser.TransferToUserResponse applyWithdrawal(WithdrawalDTO withdrawalDTO);
-
- void cancelTransfer(TransferToUser.CancelTransferRequest request);
void transferSuccess(String outBillNo,Boolean isSuccess);
diff --git a/server/services/src/main/java/com/doumee/service/business/impl/OrdersServiceImpl.java b/server/services/src/main/java/com/doumee/service/business/impl/OrdersServiceImpl.java
index c89435b..68a4903 100644
--- a/server/services/src/main/java/com/doumee/service/business/impl/OrdersServiceImpl.java
+++ b/server/services/src/main/java/com/doumee/service/business/impl/OrdersServiceImpl.java
@@ -19,12 +19,16 @@
import com.doumee.dao.business.model.*;
import com.doumee.dao.dto.*;
import com.doumee.dao.vo.OrderReleaseVO;
+import com.doumee.dao.vo.PayResponse;
import com.doumee.service.business.AliSmsService;
import com.doumee.service.business.OrdersService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.github.binarywang.wxpay.bean.request.BaseWxPayRequest;
+import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderRequest;
+import com.github.binarywang.wxpay.exception.WxPayException;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.wechat.pay.java.service.partnerpayments.jsapi.model.Amount;
import com.wechat.pay.java.service.partnerpayments.jsapi.model.Payer;
@@ -44,10 +48,15 @@
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.math.RoundingMode;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
@@ -194,30 +203,32 @@
return orderReleaseVO;
}
- private Object getWxPayResponse(Orders orders,String openid){
- Object response = null;
- //璋冭捣鏀粯
- PrepayRequest request = new PrepayRequest();
- request.setAttach("createOrder");
- request.setDescription("杩戝揩璁㈠崟鏀粯");
- request.setSpMchid(WxMiniConfig.wxProperties.getMchId());
- request.setSpAppid(WxMiniConfig.wxProperties.getAppId());
- request.setSubMchid(WxMiniConfig.wxProperties.getSubMchId());
- request.setSubAppid(WxMiniConfig.wxProperties.getSubAppId());
+ private PayResponse getWxPayResponse(Orders orders,String openid){
+ try {
+ Object response = null;
+ //璋冭捣鏀粯
+ WxPayUnifiedOrderRequest request = new WxPayUnifiedOrderRequest();
+ request.setAttach("createOrder");
+ request.setAttach("璁㈠崟鏀粯");
+ request.setOutTradeNo(orders.getOutTradeNo());
+ request.setTotalFee(BaseWxPayRequest.yuanToFen(orders.getPrice().toString()));
- Payer payer = new Payer();
- payer.setSubOpenid(openid);
- request.setPayer(payer);
- request.setOutTradeNo(orders.getOutTradeNo());
- request.setNotifyUrl(WxMiniConfig.wxProperties.getNotifyUrl());//杩欎釜鍥炶皟url蹇呴』鏄痟ttps寮�澶寸殑
- Amount amount = new Amount();
- amount.setTotal(orders.getPayAccount().intValue());
- request.setAmount(amount);
-// PrepayResponse res = WxMiniConfig.wxPayService.prepay(request);
- // 璺熶箣鍓嶄笅鍗曠ず渚嬩竴鏍凤紝濉厖棰勪笅鍗曞弬鏁�
- PrepayWithRequestPaymentResponse resParam = WxMiniConfig.jsapiExtService.prepayWithRequestPayment(request,WxMiniConfig.wxProperties.getSubAppId());
- response =resParam;
- return response;
+
+ request.setTimeStart(DateUtil.DateToString(new Date(), "yyyyMMddHHmmss"));
+ request.setSpbillCreateIp(Constants.getIpAddr());
+ //寰俊灏忕▼搴�
+ request.setOpenid(openid);
+ response = WxMiniConfig.wxPayService.createOrder(request);
+ PayResponse payResponse = new PayResponse();
+ payResponse.setResponse(response);
+ payResponse.setOrderId(orders.getId());
+ payResponse.setPayType(Constants.ZERO);
+
+ return payResponse;
+ } catch (WxPayException e) {
+ e.printStackTrace();
+ }
+ throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"鏀粯澶辫触锛�");
}
/**
@@ -2089,7 +2100,6 @@
//鏇存柊缂撳瓨
redisTemplate.opsForValue().set(Constants.RedisKeys.ORDER_CODE,0);
}
-
}
diff --git a/server/services/src/main/java/com/doumee/service/business/impl/WithdrawalOrdersServiceImpl.java b/server/services/src/main/java/com/doumee/service/business/impl/WithdrawalOrdersServiceImpl.java
index 20bf1f1..b7d603d 100644
--- a/server/services/src/main/java/com/doumee/service/business/impl/WithdrawalOrdersServiceImpl.java
+++ b/server/services/src/main/java/com/doumee/service/business/impl/WithdrawalOrdersServiceImpl.java
@@ -2,7 +2,6 @@
import com.alibaba.fastjson.JSONObject;
import com.doumee.config.wx.SendWxMessage;
-import com.doumee.config.wx.TransferToUser;
import com.doumee.config.wx.WXPayUtility;
import com.doumee.config.wx.WxMiniConfig;
import com.doumee.core.constants.Constants;
@@ -179,77 +178,7 @@
/************************************绉诲姩绔帴鍙�*******************************************/
- /**
- * 鎻愮幇鐢宠
- * @param withdrawalDTO
- */
- @Override
- @Transactional(rollbackFor = {BusinessException.class,Exception.class})
- public TransferToUser.TransferToUserResponse applyWithdrawal(WithdrawalDTO withdrawalDTO){
- if(Objects.isNull(withdrawalDTO)
- || Objects.isNull(withdrawalDTO.getAmount())
- || org.apache.commons.lang3.StringUtils.isBlank(withdrawalDTO.getName())
- || withdrawalDTO.getAmount().compareTo(BigDecimal.ZERO)<=Constants.ZERO
- ){
- throw new BusinessException(ResponseStatus.BAD_REQUEST);
- }
- Member member = memberMapper.selectById(withdrawalDTO.getMember().getId());
- if(Objects.isNull(member)){
- throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鐢ㄦ埛淇℃伅寮傚父,璇疯仈绯荤鐞嗗憳");
- }
- if(member.getAmount() < withdrawalDTO.getAmount().multiply(new BigDecimal("100")).intValue()){
- throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝鍙彁鐜颁綑棰濅笉瓒炽��");
- }
- if(StringUtils.isEmpty(member.getName())){
- throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"璇峰厛鍘荤淮鎶ょ湡瀹炲鍚嶅悗杩涜鎻愮幇鐢宠");
- }
- WithdrawalOrders withdrawalOrders = new WithdrawalOrders();
- withdrawalOrders.setCreateTime(new Date());
- withdrawalOrders.setMemberId(member.getId());
- withdrawalOrders.setOutBillNo(UUID.randomUUID().toString().replace("-",""));
- withdrawalOrders.setAmount((withdrawalDTO.getAmount().multiply(new BigDecimal("100"))).longValue());
- withdrawalOrders.setStatus(Constants.ZERO);
- withdrawalOrders.setType(Constants.ZERO);
- withdrawalOrders.setDeleted(Constants.ZERO);
- //鍙戣捣鎻愮幇鐢宠
- TransferToUser.TransferToUserRequest transferToUserRequest = new TransferToUser.TransferToUserRequest();
- transferToUserRequest.openid = member.getOpenid();
- transferToUserRequest.outBillNo = withdrawalOrders.getOutBillNo();
- transferToUserRequest.transferAmount = withdrawalOrders.getAmount();
- transferToUserRequest.transferRemark = "鎻愮幇鐢宠";
- try {
- TransferToUser.TransferToUserResponse response = WxMiniConfig.transferToUser.run(transferToUserRequest,withdrawalDTO.getName());
- withdrawalOrders.setRemark(JSONObject.toJSONString(response));
- if(response.state.name().equals("WAIT_USER_CONFIRM") || response.state.name().equals("ACCEPTED")){
- withdrawalOrders.setWxExternalNo(response.transferBillNo);
- }
- withdrawalOrdersMapper.insert(withdrawalOrders);
- //鏇存柊鐢ㄦ埛浣欓
- memberMapper.update(new UpdateWrapper<Member>().lambda().setSql(" AMOUNT = AMOUNT - " + withdrawalOrders.getAmount() ).eq(Member::getId,member.getId()));
- //瀛樺偍娴佹按璁板綍
- MemberRevenue memberRevenue = new MemberRevenue();
- memberRevenue.setCreateTime(new Date());
- memberRevenue.setTransactionNo(withdrawalOrders.getOutBillNo());
- memberRevenue.setDeleted(Constants.ZERO);
- memberRevenue.setMemberId(member.getId());
- memberRevenue.setType(Constants.THREE);
- memberRevenue.setOptType(-Constants.ONE);
- memberRevenue.setBeforeAmount(member.getAmount());
- memberRevenue.setAmount(withdrawalOrders.getAmount());
- memberRevenue.setAfterAmount(member.getAmount() - withdrawalOrders.getAmount());
- memberRevenue.setObjId(withdrawalOrders.getId());
- memberRevenue.setRemark(Constants.RevenueType.getInfo(memberRevenue.getType()));
- memberRevenue.setObjType(Constants.ONE);
- memberRevenue.setDeleted(Constants.ZERO);
- memberRevenue.setStatus(Constants.TWO);
- memberRevenueMapper.insert(memberRevenue);
- return response;
- } catch (WXPayUtility.ApiException e) {
- String message = JSONObject.parseObject(e.getBody()).getString("message");
- throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),message);
- }
- }
@Override
@@ -305,60 +234,6 @@
memberRevenue.setStatus(Constants.ZERO);
memberRevenueMapper.insert(memberRevenue);
}
- }
-
- }
-
- @Override
- public void cancelTransfer(TransferToUser.CancelTransferRequest request){
- if(Objects.isNull(request)
- || StringUtils.isEmpty(request.outBillNo)){
- throw new BusinessException(ResponseStatus.BAD_REQUEST);
- }
- WithdrawalOrders withdrawalOrders = withdrawalOrdersMapper.selectOne(new QueryWrapper<WithdrawalOrders>().lambda().eq(WithdrawalOrders::getOutBillNo,request.outBillNo).last("limit 1"));
- if(Objects.isNull(withdrawalOrders)){
- throw new BusinessException(ResponseStatus.DATA_EMPTY);
- }
- Member member = memberMapper.selectById(withdrawalOrders.getMemberId());
- if(Objects.isNull(member)){
- throw new BusinessException(ResponseStatus.DATA_EMPTY);
- }
- try {
- TransferToUser.CancelTransferResponse response = WxMiniConfig.transferToUser.cancelRun(request);
- if(response.state.equals("CANCELING")){
- //鏍囪鎻愮幇澶辫触 鍔犲洖瀵瑰簲鐨勬彁鐜伴噾棰�
- withdrawalOrdersMapper.update(new UpdateWrapper<WithdrawalOrders>()
- .lambda().set(WithdrawalOrders::getStatus,Constants.TWO)
- .eq(WithdrawalOrders::getId,withdrawalOrders.getId()));
-
- memberRevenueMapper.update(new UpdateWrapper<MemberRevenue>().lambda().set(MemberRevenue::getStatus,Constants.ONE)
- .set(MemberRevenue::getUpdateTime,new Date())
- .eq(MemberRevenue::getObjId,withdrawalOrders.getId()))
- ;
-
- //鏇存柊鐢ㄦ埛浣欓
- memberMapper.update(new UpdateWrapper<Member>().lambda().setSql(" AMOUNT = AMOUNT + " + withdrawalOrders.getAmount() ).eq(Member::getId,withdrawalOrders.getMemberId()));
-
- //瀛樺偍娴佹按璁板綍
- MemberRevenue memberRevenue = new MemberRevenue();
- memberRevenue.setCreateTime(new Date());
- memberRevenue.setMemberId(withdrawalOrders.getMemberId());
- memberRevenue.setType(Constants.FOUR);
- memberRevenue.setOptType(Constants.ONE);
- memberRevenue.setBeforeAmount(member.getAmount());
- memberRevenue.setAmount(withdrawalOrders.getAmount());
- memberRevenue.setAfterAmount(member.getAmount() + withdrawalOrders.getAmount());
- memberRevenue.setObjId(withdrawalOrders.getId());
- memberRevenue.setObjType(Constants.ONE);
- memberRevenue.setDeleted(Constants.ZERO);
- memberRevenue.setStatus(Constants.ZERO);
- memberRevenueMapper.insert(memberRevenue);
-
- }
- System.out.println(JSONObject.toJSONString(response));
- } catch (WXPayUtility.ApiException e) {
- String message = JSONObject.parseObject(e.getBody()).getString("message");
- throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),message);
}
}
diff --git a/server/services/src/main/resources/application-dev.yml b/server/services/src/main/resources/application-dev.yml
index 50261af..2ce140d 100644
--- a/server/services/src/main/resources/application-dev.yml
+++ b/server/services/src/main/resources/application-dev.yml
@@ -1,7 +1,7 @@
spring:
# 鏁版嵁婧愰厤缃�
datasource:
- url: jdbc:mysql://192.168.0.211:3306/jinkuai?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai
+ url: jdbc:mysql://192.168.0.211:3306/gtzxinglijicun?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai
username: root
password: Doumee@168
driver-class-name: com.mysql.cj.jdbc.Driver
@@ -83,82 +83,13 @@
########################寰俊鏀粯鐩稿叧閰嶇疆########################
wx:
pay:
- #鏈嶅姟鍟�---------start------- 鍙傛暟璇﹁В鍦板潃 https://pay.weixin.qq.com/doc/v3/partner/4013080340
- mchId: 1700071922 #鏈嶅姟鍟嗗湪寰俊鏀粯渚х殑鍞竴韬唤鏍囪瘑
- appId: wx6cc1087ca79db7f6 #鏈嶅姟鍟嗗湪寰俊寮�鏀惧钩鍙帮紙绉诲姩搴旂敤锛夋垨鍏紬骞冲彴锛堝叕浼楀彿/灏忕▼搴忥級涓婄敵璇风殑涓�涓敮涓�鏍囪瘑
- apiV3Key: 0a056faa107c2b2944b9d6a9aa6d4142 #7tG4Vk9Zp2L8dXw5Jq0N3hR6yE1sF3cB
- serialNumer: 6696086F6EFB8D6A4F821BD47DDBAF75C3BC1209 #38495CE0137D90E4DC4F64F7ECDE035A35470BE3 #鏈嶅姟鍟嗚瘉涔﹀簭鍒楀彿
- payPublicKeyId: PUB_KEY_ID_0117000719222024112700219100000508 #鍟嗘埛/骞冲彴鏀粯鍏挜id
- #mchKey: W97N53Q71326D6JZ2E9HY5M4VT4BAC8S
- notifyUrl: https://test.doumee.cn/jinkuai_admin/web/wxPayNotify
- refundNotifyUrl: https://test.doumee.cn/jinkuai_admin/web/wxRefundNotify
- keyPath: D://jinkuaiPayFile/apiclient_cert.p12
- privateCertPath: D://jinkuaiPayFile/apiclient_cert.pem
- privateKeyPath: D://jinkuaiPayFile/apiclient_key.pem
- pubKeyPath: D://jinkuaiPayFile/pub_key.pem #鍟嗘埛鏀粯鍏挜
+ appId: wxcd2b89fd2ff065f8
+ appSecret: 3462fa186da7cb06c544df8d8664b63a
+ mchId: 1229817002
+ mchKey: u4TSNtv0wFP7WRfnxBgijYOtRhS9FvlM
+ notifyUrl: https://test.doumee.cn/dmmall_web_api/web/api/wxPayNotify
+ keyPath: D:\DouMee\dmkjWxcert\apiclient_cert.p12
- #鏈嶅姟鍟�-------------end---
-
- #鍟嗘埛淇℃伅
- wechatSerialNumer: 12C0F0DD0F3D2B565B45586D3FEA225EBF723BEC
- wechatPayPublicKeyId: PUB_KEY_ID_0117233260692025072500181939000603 #鍟嗘埛/骞冲彴鏀粯鍏挜id
- wechatPubKeyPath: D://jinkuaiPayFile/shanghu/pub_key.pem #鍟嗘埛鏀粯鍏挜
- wechatPrivateKeyPath: D://jinkuaiPayFile/shanghu/apiclient_key.pem #鍟嗘埛绉侀挜
- wechatNotifyUrl: https://test.doumee.cn/jinkuai_admin/web/wechat/transferNotify #鍟嗘埛杞处鍥炶皟鍦板潃
- wechatApiV3Key: 7tG4Vk9Zp2L8dXw5Jq0N3hR6yE1sF3cB
-
- existsSub: 1
- appSecret:
- #瀛愬晢鎴�------------start----
- subMchId: 1723326069 #瀛愬晢鎴峰彿
- subAppId: wx332441ae5b12be7d #灏忕▼搴廼d
- subAppSecret: add86d6406f5c14501ac5bbb1a60e004 #灏忕▼搴忕閽�
- #瀛愬晢鎴�------------end----
- # mchKey: u4TSNtv0wFP7WRfnxBgijYOtRhS9FvlM
- typeId: jinkuai
-
-
-#wx:
-# pay:
-# #鏈嶅姟鍟�---------start-------
-# appId: wx48fd8faa35cc8277
-# mchId: 1661770902
-# apiV3Key: iF3kC8pL8dZ9iU3hN5fX9zI6eF4xQ6fT
-# serialNumer: 368B835A194384FD583B83B77977B84127D2F655
-# mchKey: W97N53Q71326D6JZ2E9HY5M4VT4BAC8S
-# notifyUrl: https://test.doumee.cn/jinkuai_admin/web/wxPayNotify
-# refundNotifyUrl: https://test.doumee.cn/jinkuai_admin/web/wxRefundNotify
-## notifyUrl: https://dmtest.ahapp.net/bike_h5_api/api/wxPayNotify
-## refundNotifyUrl: https://dmtest.ahapp.net/bike_h5_api/api/wxRefundNotify
-# #keyPath: /usr/local/aliConfig/bike/apiclient_cert.p12
-# #privateCertPath: /usr/local/aliConfig/bike/apiclient_cert.pem
-# #privateKeyPath: /usr/local/aliConfig/bike/apiclient_key.pem
-# keyPath: /usr/local/zhengshu/apiclient_cert.p12 #d://apiclient_cert.p12
-# privateCertPath: /usr/local/zhengshu/apiclient_cert.pem #d://apiclient_cert.pem
-# privateKeyPath: /usr/local/zhengshu/apiclient_key.pem #d://apiclient_key.pem
-#
-#
-# #鍟嗘埛淇℃伅
-# wechatSerialNumer: 3C9A32FB6CD453FAAAF97F9737ECAEA9D6625727
-# wechatPayPublicKeyId: 47E172124E73E8098A565E971064C20ACDE7C911 # PUB_KEY_ID_0116617720032025071800291849000801 #鍟嗘埛/骞冲彴鏀粯鍏挜id
-# wechatPubKeyPath: /usr/local/zhengshu/pub_key.pem #d://pub_key.pem #鍟嗘埛鏀粯鍏挜
-# #wechatPlatformPubKeyPath: d:/wechatpay_47E172124E73E8098A565E971064C20ACDE7C911.pem #骞冲彴鏀粯鍏挜
-# wechatPrivateKeyPath: /usr/local/zhengshu/wechatApiclient_key.pem #d://wechatApiclient_key.pem #鍟嗘埛绉侀挜
-# wechatNotifyUrl: https://test.doumee.cn/jinkuai_admin/web/wechat/transferNotify #鍟嗘埛杞处鍥炶皟鍦板潃
-# #wechatApiV3Key: V4PRKUBTK2BKNKJAD9NSI9YFG2Q0EOT1 #鍟嗘埛APIV3Key
-#
-#
-# #鏈嶅姟鍟�-------------end---
-# existsSub: 1
-# appSecret: 1ceb7c9dff3c4330d653adc3ca55ea24
-# #瀛愬晢鎴�------------start----
-# subAppId: wxcd2b89fd2ff065f8 #wxcd2b89fd2ff065f8
-# subAppSecret: 3462fa186da7cb06c544df8d8664b63a #3336812504c830b1c3c5243f9ece407a
-# subMchId: 1661772003
-# subMchKey: EVM8E15TKXE0OEMJFC0V6UFVIOZ5CSQS
-# #瀛愬晢鎴�------------end----
-# # mchKey: u4TSNtv0wFP7WRfnxBgijYOtRhS9FvlM
-# typeId: gybike
upload:
type: ftp
diff --git a/server/services/src/main/resources/application-pro.yml b/server/services/src/main/resources/application-pro.yml
index 1e4659f..08d1c6c 100644
--- a/server/services/src/main/resources/application-pro.yml
+++ b/server/services/src/main/resources/application-pro.yml
@@ -1,9 +1,9 @@
spring:
# 鏁版嵁婧愰厤缃�
datasource:
- url: jdbc:mysql://b66cc1a382964a6a9d46a522f2dfe672in01.internal.cn-south-1.mysql.rds.myhuaweicloud.com:3306/jinkuai?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai
+ url: jdbc:mysql://192.168.0.211:3306/gtzxinglijicun?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai
username: root
- password: Jinkuai!@#$%^
+ password: Doumee@168
driver-class-name: com.mysql.cj.jdbc.Driver
type: com.alibaba.druid.pool.DruidDataSource
redis:
diff --git a/server/services/src/main/resources/application-test.yml b/server/services/src/main/resources/application-test.yml
index c7019de..d9c588f 100644
--- a/server/services/src/main/resources/application-test.yml
+++ b/server/services/src/main/resources/application-test.yml
@@ -1,7 +1,7 @@
spring:
# 鏁版嵁婧愰厤缃�
datasource:
- url: jdbc:mysql://192.168.0.211:3306/jinkuai?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai
+ url: jdbc:mysql://192.168.0.211:3306/gtzxinglijicun?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai
username: root
password: Doumee@168
driver-class-name: com.mysql.cj.jdbc.Driver
diff --git a/server/web/pom.xml b/server/web/pom.xml
index fe21ce9..696c49f 100644
--- a/server/web/pom.xml
+++ b/server/web/pom.xml
@@ -52,7 +52,7 @@
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<fork>true</fork>
- <mainClass>com.doumee.JKWebApplication</mainClass>
+ <mainClass>com.doumee.GTWebApplication</mainClass>
<layout>ZIP</layout>
</configuration>
<executions>
diff --git a/server/web/src/main/java/com/doumee/JKWebApplication.java b/server/web/src/main/java/com/doumee/GTWebApplication.java
similarity index 81%
rename from server/web/src/main/java/com/doumee/JKWebApplication.java
rename to server/web/src/main/java/com/doumee/GTWebApplication.java
index f9add5a..b36a798 100644
--- a/server/web/src/main/java/com/doumee/JKWebApplication.java
+++ b/server/web/src/main/java/com/doumee/GTWebApplication.java
@@ -4,7 +4,6 @@
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.ApplicationContext;
import org.springframework.scheduling.annotation.EnableAsync;
@@ -18,9 +17,9 @@
@SpringBootApplication
@MapperScan("com.doumee.dao")
@EnableAsync
-public class JKWebApplication extends SpringBootServletInitializer {
+public class GTWebApplication extends SpringBootServletInitializer {
public static void main(String[] args) {
- ApplicationContext context = SpringApplication.run(JKWebApplication.class);
+ ApplicationContext context = SpringApplication.run(GTWebApplication.class);
context.getEnvironment();
}
diff --git a/server/web/src/main/java/com/doumee/api/web/UserApi.java b/server/web/src/main/java/com/doumee/api/web/UserApi.java
index 30cac74..eecd373 100644
--- a/server/web/src/main/java/com/doumee/api/web/UserApi.java
+++ b/server/web/src/main/java/com/doumee/api/web/UserApi.java
@@ -1,6 +1,5 @@
package com.doumee.api.web;
-import com.doumee.config.wx.TransferToUser;
import com.doumee.core.annotation.LoginRequired;
import com.doumee.core.annotation.trace.Trace;
import com.doumee.core.model.ApiResponse;
@@ -159,29 +158,7 @@
return ApiResponse.success(memberRevenueService.findPage(pageWrap));
}
- @LoginRequired
- @ApiOperation("鎻愮幇鐢宠")
- @PostMapping("/applyWithdrawal")
- @ApiImplicitParams({
- @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "鐢ㄦ埛token鍊�", required = true),
- })
- public ApiResponse<TransferToUser.TransferToUserResponse> applyWithdrawal (@RequestBody WithdrawalDTO withdrawalDTO) {
- withdrawalDTO.setMember(this.getMemberResponse());
- return ApiResponse.success("鎿嶄綔鎴愬姛",withdrawalOrdersService.applyWithdrawal(withdrawalDTO));
- }
-
-
- @LoginRequired
- @ApiOperation("鎾ら攢鎻愮幇鐢宠")
- @PostMapping("/cancelTransfer")
- @ApiImplicitParams({
- @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "鐢ㄦ埛token鍊�", required = true),
- })
- public ApiResponse cancelTransfer (@RequestBody TransferToUser.CancelTransferRequest request) {
- withdrawalOrdersService.cancelTransfer(request);
- return ApiResponse.success("鎿嶄綔鎴愬姛");
- }
}
--
Gitblit v1.9.3