Browse Source

修复提现功能

master
主管理员 1 month ago
parent
commit
41266200b7
3 changed files with 103 additions and 82 deletions
  1. +5
    -5
      .idea/compiler.xml
  2. +1
    -0
      .idea/encodings.xml
  3. +97
    -77
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/transferTest/TransferToUser.java

+ 5
- 5
.idea/compiler.xml View File

@ -7,12 +7,12 @@
<sourceOutputDir name="target/generated-sources/annotations" /> <sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" /> <sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" /> <outputRelativeToContentRoot value="true" />
<module name="jeecg-system-local-api" />
<module name="jeecg-boot-module-system" />
<module name="jeecg-boot-base-tools" />
<module name="jeecg-boot-base-core" /> <module name="jeecg-boot-base-core" />
<module name="jeecg-boot-base-tools" />
<module name="han-hai-module-pay" /> <module name="han-hai-module-pay" />
<module name="jeecg-boot-module-system" />
<module name="jeecg-system-cloud-api" /> <module name="jeecg-system-cloud-api" />
<module name="jeecg-system-local-api" />
</profile> </profile>
</annotationProcessing> </annotationProcessing>
<bytecodeTargetLevel> <bytecodeTargetLevel>
@ -23,8 +23,8 @@
<option name="ADDITIONAL_OPTIONS_OVERRIDE"> <option name="ADDITIONAL_OPTIONS_OVERRIDE">
<module name="han-hai-module-pay" options="-parameters" /> <module name="han-hai-module-pay" options="-parameters" />
<module name="han-hai-parent" options="-parameters" /> <module name="han-hai-parent" options="-parameters" />
<module name="jeecg-boot-base" options="" />
<module name="jeecg-boot-base-api" options="" />
<module name="jeecg-boot-base" options="-parameters" />
<module name="jeecg-boot-base-api" options="-parameters" />
<module name="jeecg-boot-base-core" options="-parameters" /> <module name="jeecg-boot-base-core" options="-parameters" />
<module name="jeecg-boot-base-tools" options="-parameters" /> <module name="jeecg-boot-base-tools" options="-parameters" />
<module name="jeecg-boot-module-system" options="-parameters" /> <module name="jeecg-boot-module-system" options="-parameters" />


+ 1
- 0
.idea/encodings.xml View File

@ -7,5 +7,6 @@
<file url="file://$PROJECT_DIR$/jeecg-boot-base/jeecg-boot-base-core/src/main/java" charset="UTF-8" /> <file url="file://$PROJECT_DIR$/jeecg-boot-base/jeecg-boot-base-core/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/jeecg-boot-base/jeecg-boot-base-tools/src/main/java" charset="UTF-8" /> <file url="file://$PROJECT_DIR$/jeecg-boot-base/jeecg-boot-base-tools/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/jeecg-boot-module-system/src/main/java" charset="UTF-8" /> <file url="file://$PROJECT_DIR$/jeecg-boot-module-system/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
</component> </component>
</project> </project>

+ 97
- 77
jeecg-boot-module-system/src/main/java/org/jeecg/modules/transferTest/TransferToUser.java View File

@ -1,6 +1,8 @@
package org.jeecg.modules.transferTest; package org.jeecg.modules.transferTest;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.google.gson.annotations.SerializedName; import com.google.gson.annotations.SerializedName;
import io.swagger.util.Json;
import okhttp3.*; import okhttp3.*;
import java.io.IOException; import java.io.IOException;
@ -17,64 +19,64 @@ public class TransferToUser {
private static String HOST = "https://api.mch.weixin.qq.com"; private static String HOST = "https://api.mch.weixin.qq.com";
private static String METHOD = "POST"; private static String METHOD = "POST";
private static String PATH = "/v3/fund-app/mch-transfer/transfer-bills"; private static String PATH = "/v3/fund-app/mch-transfer/transfer-bills";
public static void main(String[] args) {
// TODO: 请准备商户开发必要参数参考https://pay.weixin.qq.com/doc/v3/merchant/4013070756
// String mchid = "1712378227";
// String certiticateSerialNo ="33E9FE8076531A7C7AD401DC34E053DBD7C28E22";
// String privateKeyFilePath = "jeecg-boot-module-system/src/main/resources/apiclient_key.pem";
// String wechatPayPublicKeyId = "PUB_KEY_ID_0117123782272025033100396400002931";
// String wechatPayPublicKeyFilePaht = "jeecg-boot-module-system/src/main/resources/pub_key.pem";
String mchid = "1673516176";
String certiticateSerialNo ="525CDBD76E640EFB008288572C97D2715F3F18B2";
String privateKeyFilePath = "jeecg-boot-module-system/src/main/resources/apiclient_key_yaodu.pem";
String wechatPayPublicKeyId = "PUB_KEY_ID_0116735161762025040100448900000949";
String wechatPayPublicKeyFilePaht = "jeecg-boot-module-system/src/main/resources/pub_key_yaodu.pem";
TransferToUser client = new TransferToUser(
mchid, // 商户号是由微信支付系统生成并分配给每个商户的唯一标识符商户号获取方式参考 https://pay.weixin.qq.com/doc/v3/merchant/4013070756
certiticateSerialNo, // 商户API证书序列号如何获取请参考 https://pay.weixin.qq.com/doc/v3/merchant/4013053053
privateKeyFilePath, // 商户API证书私钥文件路径本地文件路径
wechatPayPublicKeyId, // 微信支付公钥ID如何获取请参考 https://pay.weixin.qq.com/doc/v3/merchant/4013038816
wechatPayPublicKeyFilePaht // 微信支付公钥文件路径本地文件路径
);
String appid = "wxa4d29e67e8a58d38";
String openid = "oFzrW4migndUepy7zYgYO2YoZ5to";
String notifyUrl = "https://admin.hhlm1688.com/api/hello/";
TransferToUserRequest request = new TransferToUserRequest();
request.appid = appid;
request.outBillNo = "plfk2020042013";
request.transferSceneId = "1000";
request.openid = openid;
request.userName = client.encrypt("唐斌");
request.transferAmount = 400L;
request.transferRemark = "新会员开通有礼";
request.notifyUrl = notifyUrl;
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.run(request);
// TODO: 请求成功继续业务逻辑
System.out.println(response);
} catch (WXPayUtility.ApiException e) {
// TODO: 请求失败根据状态码执行不同的逻辑
e.printStackTrace();
}
}
//
// public static void main(String[] args) {
// // TODO: 请准备商户开发必要参数参考https://pay.weixin.qq.com/doc/v3/merchant/4013070756
//// String mchid = "1712378227";
//// String certiticateSerialNo ="33E9FE8076531A7C7AD401DC34E053DBD7C28E22";
//// String privateKeyFilePath = "jeecg-boot-module-system/src/main/resources/apiclient_key.pem";
//// String wechatPayPublicKeyId = "PUB_KEY_ID_0117123782272025033100396400002931";
//// String wechatPayPublicKeyFilePaht = "jeecg-boot-module-system/src/main/resources/pub_key.pem";
// String mchid = "1673516176";
// String certiticateSerialNo ="525CDBD76E640EFB008288572C97D2715F3F18B2";
// String privateKeyFilePath = "jeecg-boot-module-system/src/main/resources/apiclient_key_yaodu.pem";
// String wechatPayPublicKeyId = "PUB_KEY_ID_0116735161762025040100448900000949";
// String wechatPayPublicKeyFilePaht = "jeecg-boot-module-system/src/main/resources/pub_key_yaodu.pem";
// TransferToUser client = new TransferToUser(
// mchid, // 商户号是由微信支付系统生成并分配给每个商户的唯一标识符商户号获取方式参考 https://pay.weixin.qq.com/doc/v3/merchant/4013070756
// certiticateSerialNo, // 商户API证书序列号如何获取请参考 https://pay.weixin.qq.com/doc/v3/merchant/4013053053
// privateKeyFilePath, // 商户API证书私钥文件路径本地文件路径
// wechatPayPublicKeyId, // 微信支付公钥ID如何获取请参考 https://pay.weixin.qq.com/doc/v3/merchant/4013038816
// wechatPayPublicKeyFilePaht // 微信支付公钥文件路径本地文件路径
// );
//
// String appid = "wxa4d29e67e8a58d38";
// String openid = "oFzrW4migndUepy7zYgYO2YoZ5to";
// String notifyUrl = "https://admin.hhlm1688.com/api/hello/";
// TransferToUserRequest request = new TransferToUserRequest();
// request.appid = appid;
// request.out_bill_no = "plfk2020042013";
// request.transfer_scene_id = "1000";
// request.openid = openid;
// request.user_name = client.encrypt("唐斌");
// request.transfer_amount = 400L;
// request.transfer_remark = "新会员开通有礼";
// request.notify_url = notifyUrl;
// request.user_recv_perception = "现金奖励";
// request.transferSceneReportInfos = new ArrayList<>();
// {
// TransferSceneReportInfo item0 = new TransferSceneReportInfo();
// item0.info_type = "活动名称";
// item0.info_content = "新会员有礼";
// request.transferSceneReportInfos.add(item0);
// TransferSceneReportInfo item1 = new TransferSceneReportInfo();
// item1.info_type = "奖励说明";
// item1.info_content = "注册会员抽奖一等奖";
// request.transferSceneReportInfos.add(item1);
//
//
//
// };
// try {
// TransferToUserResponse response = client.run(request);
//
// // TODO: 请求成功继续业务逻辑
// System.out.println(response);
// } catch (WXPayUtility.ApiException e) {
// // TODO: 请求失败根据状态码执行不同的逻辑
// e.printStackTrace();
// }
// }
public void run(){ public void run(){
String mchid = "1673516176"; String mchid = "1673516176";
@ -91,27 +93,28 @@ public class TransferToUser {
); );
String appid = "wxa4d29e67e8a58d38"; String appid = "wxa4d29e67e8a58d38";
String openid = "oFzrW4migndUepy7zYgYO2YoZ5to";
String openid = "oFzrW4tqZUvN9T0RQzWPdCT1St68";
String notifyUrl = "https://admin.hhlm1688.com/api/cashout/cashout/"; String notifyUrl = "https://admin.hhlm1688.com/api/cashout/cashout/";
TransferToUserRequest request = new TransferToUserRequest(); TransferToUserRequest request = new TransferToUserRequest();
request.appid = appid; request.appid = appid;
request.outBillNo = "plfk2020042013";
request.transferSceneId = "1000";
String idStr = "H" + IdWorker.getIdStr();
request.out_bill_no = idStr;
request.transfer_scene_id = "1005";//只开通了佣金报酬
request.openid = openid; request.openid = openid;
request.userName = client.encrypt("唐斌");
request.transferAmount = 400L;
request.transferRemark = "新会员开通有礼";
request.notifyUrl = notifyUrl;
request.userRecvPerception = "现金奖励";
request.user_name = client.encrypt("廖志翔");
request.transfer_amount = 100L;
request.transfer_remark = "佣金报酬";
request.notify_url = notifyUrl;
request.userRecvPerception = "劳务报酬"; // 修改用户收款感知描述
request.transferSceneReportInfos = new ArrayList<>(); request.transferSceneReportInfos = new ArrayList<>();
{ {
TransferSceneReportInfo item0 = new TransferSceneReportInfo(); TransferSceneReportInfo item0 = new TransferSceneReportInfo();
item0.infoType = "活动名称";
item0.infoContent = "新会员有礼";
item0.infoType = "岗位类型";//固定
item0.infoContent = "外卖员";//只开通了佣金报酬
request.transferSceneReportInfos.add(item0); request.transferSceneReportInfos.add(item0);
TransferSceneReportInfo item1 = new TransferSceneReportInfo(); TransferSceneReportInfo item1 = new TransferSceneReportInfo();
item1.infoType = "奖励说明";
item1.infoContent = "注册会员抽奖一等奖";
item1.infoType = "报酬说明";//固定
item1.infoContent = "高温补贴";//只开通了佣金报酬
request.transferSceneReportInfos.add(item1); request.transferSceneReportInfos.add(item1);
@ -128,9 +131,13 @@ public class TransferToUser {
} }
} }
public TransferToUserResponse run(TransferToUserRequest request) { public TransferToUserResponse run(TransferToUserRequest request) {
String uri = PATH; String uri = PATH;
String reqBody = WXPayUtility.toJson(request); String reqBody = WXPayUtility.toJson(request);
// String reqBody = Json.pretty(request);
System.out.println("reqBody=========================");
System.out.println(reqBody);
Request.Builder reqBuilder = new Request.Builder().url(HOST + uri); Request.Builder reqBuilder = new Request.Builder().url(HOST + uri);
reqBuilder.addHeader("Accept", "application/json"); reqBuilder.addHeader("Accept", "application/json");
@ -151,7 +158,10 @@ public class TransferToUser {
httpResponse.headers(), respBody); httpResponse.headers(), respBody);
// 从HTTP应答报文构建返回数据 // 从HTTP应答报文构建返回数据
return WXPayUtility.fromJson(respBody, TransferToUserResponse.class);
TransferToUserResponse transferToUserResponse = WXPayUtility.fromJson(respBody, TransferToUserResponse.class);
System.out.println("transferToUserResponse=========================");
System.out.println(Json.pretty(transferToUserResponse));
return transferToUserResponse;
} else { } else {
throw new WXPayUtility.ApiException(httpResponse.code(), respBody, httpResponse.headers()); throw new WXPayUtility.ApiException(httpResponse.code(), respBody, httpResponse.headers());
} }
@ -227,31 +237,41 @@ public class TransferToUser {
public String appid; public String appid;
@SerializedName("out_bill_no") @SerializedName("out_bill_no")
public String outBillNo;
// public String outBillNo;
public String out_bill_no;
@SerializedName("transfer_scene_id") @SerializedName("transfer_scene_id")
public String transferSceneId;
// public String transferSceneId;
public String transfer_scene_id;
@SerializedName("openid") @SerializedName("openid")
public String openid; public String openid;
@SerializedName("user_name") @SerializedName("user_name")
public String userName;
// public String userName;
public String user_name;
@SerializedName("transfer_amount") @SerializedName("transfer_amount")
public Long transferAmount;
// public Long transferAmount;
public Long transfer_amount;
@SerializedName("transfer_remark") @SerializedName("transfer_remark")
public String transferRemark;
// public String transferRemark;
public String transfer_remark;
@SerializedName("notify_url") @SerializedName("notify_url")
public String notifyUrl;
// public String notifyUrl;
public String notify_url;
@SerializedName("user_recv_perception") @SerializedName("user_recv_perception")
public String userRecvPerception; public String userRecvPerception;
@SerializedName("transfer_scene_report_infos") @SerializedName("transfer_scene_report_infos")
public List<TransferSceneReportInfo> transferSceneReportInfos; public List<TransferSceneReportInfo> transferSceneReportInfos;
} }
} }

Loading…
Cancel
Save