|
|
|
@ -2,9 +2,13 @@ package cn.iocoder.yudao.module.trade.service.brokerage;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
|
import cn.hutool.core.date.LocalDateTimeUtil;
|
|
|
|
|
import cn.hutool.core.io.FileUtil;
|
|
|
|
|
import cn.hutool.core.io.resource.ResourceUtil;
|
|
|
|
|
import cn.hutool.core.map.MapUtil;
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
|
|
import cn.hutool.http.HttpUtil;
|
|
|
|
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
|
|
|
import cn.iocoder.yudao.framework.common.util.alipay.KeyContent;
|
|
|
|
|
import cn.iocoder.yudao.framework.common.util.number.MoneyUtils;
|
|
|
|
|
import cn.iocoder.yudao.framework.common.util.validation.ValidationUtils;
|
|
|
|
|
import cn.iocoder.yudao.module.pay.api.wallet.PayWalletApi;
|
|
|
|
@ -24,12 +28,19 @@ import cn.iocoder.yudao.module.trade.enums.brokerage.BrokerageWithdrawStatusEnum
|
|
|
|
|
import cn.iocoder.yudao.module.trade.enums.brokerage.BrokerageWithdrawTypeEnum;
|
|
|
|
|
import cn.iocoder.yudao.module.trade.service.brokerage.bo.BrokerageWithdrawSummaryRespBO;
|
|
|
|
|
import cn.iocoder.yudao.module.trade.service.config.TradeConfigService;
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import javax.validation.Validator;
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.io.InputStreamReader;
|
|
|
|
|
import java.net.HttpURLConnection;
|
|
|
|
|
import java.net.URL;
|
|
|
|
|
import java.time.LocalDateTime;
|
|
|
|
|
import java.util.Collection;
|
|
|
|
|
import java.util.Collections;
|
|
|
|
@ -66,6 +77,25 @@ public class BrokerageWithdrawServiceImpl implements BrokerageWithdrawService {
|
|
|
|
|
@Resource
|
|
|
|
|
private Validator validator;
|
|
|
|
|
|
|
|
|
|
@Value("${alipay.appId}")
|
|
|
|
|
private String appId;
|
|
|
|
|
|
|
|
|
|
@Value("${alipay.appPrivateKey}")
|
|
|
|
|
private String appPrivateKey;
|
|
|
|
|
|
|
|
|
|
@Value("${alipay.gateway}")
|
|
|
|
|
private String gateway;
|
|
|
|
|
|
|
|
|
|
@Value("${alipay.appCertPath}")
|
|
|
|
|
private String appCertPath;
|
|
|
|
|
|
|
|
|
|
@Value("${alipay.alipayCertPath}")
|
|
|
|
|
private String alipayCertPath;
|
|
|
|
|
|
|
|
|
|
@Value("${alipay.alipayRootCertPath}")
|
|
|
|
|
private String alipayRootCertPath;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public void auditBrokerageWithdraw(Integer id, BrokerageWithdrawStatusEnum status, String auditReason) {
|
|
|
|
@ -90,6 +120,28 @@ public class BrokerageWithdrawServiceImpl implements BrokerageWithdrawService {
|
|
|
|
|
if (BrokerageWithdrawTypeEnum.WALLET.getType().equals(withdraw.getType())) {
|
|
|
|
|
// todo 疯狂:
|
|
|
|
|
}
|
|
|
|
|
// 3.1 提现到支付宝---真正提现是到支付宝
|
|
|
|
|
if (BrokerageWithdrawTypeEnum.ALIPAY.getType().equals(withdraw.getType())) {
|
|
|
|
|
System.out.println();
|
|
|
|
|
// todo 疯狂:
|
|
|
|
|
//封装提现参数
|
|
|
|
|
JSONObject paramMap = new JSONObject();
|
|
|
|
|
paramMap.put("appid", appId);
|
|
|
|
|
paramMap.put("app_private_key", appPrivateKey);
|
|
|
|
|
String keyContent = KeyContent.getKeyContentByFileName(appCertPath);
|
|
|
|
|
String keyContent1 = KeyContent.getKeyContentByFileName(alipayCertPath);
|
|
|
|
|
String keyContent2 = KeyContent.getKeyContentByFileName(alipayRootCertPath);
|
|
|
|
|
paramMap.put("app_cert_path_string", keyContent);
|
|
|
|
|
paramMap.put("alipay_cert_path_string", keyContent1);
|
|
|
|
|
paramMap.put("alipay_root_cert_path_string", keyContent2);
|
|
|
|
|
paramMap.put("remark", "余额提现到支付宝");
|
|
|
|
|
paramMap.put("out_biz_no", "111222333");
|
|
|
|
|
paramMap.put("account", "13233904609");//账号
|
|
|
|
|
paramMap.put("name", "马腾达");
|
|
|
|
|
paramMap.put("amount", "0.1");
|
|
|
|
|
String result= HttpUtil.post(gateway, JSON.toJSONString(paramMap));
|
|
|
|
|
System.out.println(result);
|
|
|
|
|
}
|
|
|
|
|
// TODO 疯狂:调用转账接口
|
|
|
|
|
} else if (BrokerageWithdrawStatusEnum.AUDIT_FAIL.equals(status)) {
|
|
|
|
|
templateCode = MessageTemplateConstants.BROKERAGE_WITHDRAW_AUDIT_REJECT;
|
|
|
|
|