Adapay修改为多商户模式

This commit is contained in:
HH 2022-05-21 16:50:56 +08:00
parent e901ff18de
commit d0016e9d16
26 changed files with 777 additions and 100 deletions

View File

@ -0,0 +1,89 @@
package com.ghy.web.controller.customer;
import com.alibaba.fastjson.JSON;
import com.ghy.common.adapay.AdapayConfig;
import com.ghy.common.adapay.AdapayService;
import com.ghy.common.adapay.model.AdapayStatusEnum;
import com.ghy.common.adapay.model.Merchant;
import com.ghy.common.core.domain.AjaxResult;
import com.ghy.common.utils.AdapayUtils;
import com.ghy.customer.domain.CustomerBank;
import com.ghy.customer.request.BindBankCardRequest;
import com.ghy.customer.service.CustomerBankService;
import com.huifu.adapay.core.exception.BaseAdaPayException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.annotation.Resource;
import java.util.Map;
import java.util.Set;
/**
* @author HH 2022/5/20
*/
@Slf4j
@Controller
@RequestMapping("customer/bankcard")
public class CustomerBankController {
@Resource
private CustomerBankService customerBankService;
@Resource
private AdapayService adapayService;
/**
* 个人账户绑定银行卡接口
*/
@PostMapping("bind")
private AjaxResult bindBankCard(BindBankCardRequest request) throws BaseAdaPayException {
Set<Merchant> merchants = AdapayConfig.getMerchants();
for (Merchant merchant : merchants) {
String memberId = AdapayUtils.getMemberId(request.getCustomerId(), merchant.getDeptId());
// 先在Adapay创建实名用户
Map<String, Object> result1 = adapayService.createMember(merchant.getDeptId(), memberId, request.getPhone(),
request.getName(), request.getCertId(), null, null, null, null);
if (!AdapayStatusEnum.succeeded.code.equals(result1.get("status"))) {
log.warn("实名认证失败[{}]", JSON.toJSONString(result1));
return AjaxResult.error("个人信息不正确");
}
// 开始创建结算账户
Map<String, Object> result2 = adapayService.createSettleAccount(merchant.getDeptId(), memberId, request.getCertId(), request.getName(),
"2", request.getCertId(), request.getPhone(), null, null, null);
if (!AdapayStatusEnum.succeeded.code.equals(result2.get("status"))) {
log.warn("创建结算账户失败[{}]", JSON.toJSONString(result1));
return AjaxResult.error("个人信息与银行卡不匹配");
}
CustomerBank customerBank = new CustomerBank();
customerBank.setCustomerId(request.getCustomerId());
customerBank.setName(request.getName());
customerBank.setCertId(request.getCertId());
// TODO 入库
}
return AjaxResult.success();
}
}

View File

@ -45,7 +45,7 @@ public class AlipayController extends BaseController {
// TODO 订单里需要补充支付金额tittle简要描述分账信息description // TODO 订单里需要补充支付金额tittle简要描述分账信息description
PayParam payParam = new PayParam(orderMaster.getCode(), PayParam payParam = new PayParam(orderMaster.getCode(),
"orderMaster.get支付金额", "orderMaster.getTittle()", "orderMaster.get商品描述信息"); "orderMaster.get支付金额", "orderMaster.getTittle()", "orderMaster.get商品描述信息");
map = adapayService.alipayQrPay(payParam, payCallback, null, null, null); map = adapayService.alipayQrPay(orderMaster.getDeptId(), payParam, payCallback, null, null, null);
} catch (BaseAdaPayException e) { } catch (BaseAdaPayException e) {
logger.error("获取微信用户信息失败", e); logger.error("获取微信用户信息失败", e);
return AjaxResult.error(); return AjaxResult.error();

View File

@ -21,7 +21,6 @@ import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.Map; import java.util.Map;
@Controller @Controller
@ -65,7 +64,7 @@ public class WxPayController extends BaseController {
// TODO 订单里需要补充支付金额tittle简要描述分账信息description // TODO 订单里需要补充支付金额tittle简要描述分账信息description
PayParam payParam = new PayParam(orderMaster.getCode(), PayParam payParam = new PayParam(orderMaster.getCode(),
"0.01", "工圈子测试", "工圈子测试描述"); "0.01", "工圈子测试", "工圈子测试描述");
map = adapayService.wxLitePay(payParam, payCallback, expend, null, null); map = adapayService.wxLitePay(orderMaster.getDeptId(), payParam, payCallback, expend, null, null);
} catch (BaseAdaPayException e) { } catch (BaseAdaPayException e) {
logger.error("获取微信用户信息失败", e); logger.error("获取微信用户信息失败", e);
return AjaxResult.error(); return AjaxResult.error();
@ -99,7 +98,7 @@ public class WxPayController extends BaseController {
Map<String, Object> map; Map<String, Object> map;
// TODO 订单里需要补充支付金额tittle简要描述分账信息description // TODO 订单里需要补充支付金额tittle简要描述分账信息description
PayParam payParam = new PayParam("订单号", "支付金额", "商品标题", "商品描述信息"); PayParam payParam = new PayParam("订单号", "支付金额", "商品标题", "商品描述信息");
map = adapayService.wxPubPay(payParam, payCallback, expend, null, null); map = adapayService.wxPubPay(123456789L, payParam, payCallback, expend, null, null);
return AjaxResult.success(map); return AjaxResult.success(map);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();

View File

@ -25,6 +25,7 @@ public class AfterPay {
return new PayCallback() { return new PayCallback() {
@Override @Override
public void onReply(PayReply reply) { public void onReply(PayReply reply) {
reply.getStatus();
// TODO 修改 OrderMaster 订单状态 // TODO 修改 OrderMaster 订单状态
// TODO 修改 OrderDetail 订单状态 // TODO 修改 OrderDetail 订单状态
// TODO 保存支付结果到MySQL // TODO 保存支付结果到MySQL

View File

@ -0,0 +1,48 @@
package com.ghy.web.core;
import com.ghy.common.adapay.AdapayConfig;
import com.ghy.common.adapay.AdapayProperties;
import com.ghy.common.adapay.model.Merchant;
import com.ghy.system.domain.SysDeptConfig;
import com.ghy.system.service.ISysDeptConfigService;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
/**
* 初始化 Adapay
*
* @author HH 2022/5/21
*/
@Component
public class InitAdapay {
@Resource
AdapayProperties adapayProperties;
@Resource
ISysDeptConfigService deptConfigService;
@PostConstruct
public void initAdapay() throws Exception {
List<SysDeptConfig> deptConfigs = deptConfigService.selectAllMerchant();
Set<Merchant> merchants = deptConfigs.stream().map(x -> {
Merchant merchant = new Merchant();
merchant.setDeptId(x.getDeptId());
merchant.setAppId(x.getAdapayAppId());
merchant.setApiKey(x.getAdapayApiKey());
merchant.setMockApiKey(x.getAdapayMockApiKey());
merchant.setRsaPrivateKey(x.getAdapayRsaPrivateKey());
return merchant;
}).collect(Collectors.toSet());
AdapayConfig.setMerchants(merchants);
AdapayConfig.initAdapay(adapayProperties);
}
}

View File

@ -158,11 +158,7 @@ qiniu:
adapay: adapay:
debug: true debug: true
prod-mode: false prod-mode: false
appId: 'app_01af32e7-6173-414f-88e5-79cae64d5e24'
notifyUrl: 'http://www.opsoul.com/adapay/callback' notifyUrl: 'http://www.opsoul.com/adapay/callback'
apiKey: 'api_live_93a2fb4f-a74a-416f-967d-68557bcde43f'
mockApiKey: 'api_test_88bf2958-583d-41cd-a987-01fe767ff056'
rsaPrivateKey: 'MIICeAIBADANBgkqhkiG9w0BAQEFAASCAmIwggJeAgEAAoGBAMTk5xzz3KXA+waawr1DbU/SaSXZN8tY/22qHON7AAsp+yJ1/JCt+sD6/mpIUGittBS4n69t/9R5+2uHtD5/tVH7hYpJpVixLQw8/lonLPbeLFLgTMBHKJwSytBZXC2delnewHO/Zg6WlTWkdQB7gr73m7/wu2Ss+FDwGq6Q8sXdAgMBAAECgYEAtl8LTr72DjWsjdaFMEcnFftf12XWjyx1Ev+xWGcSiESvT6EXem8bxun1Az7N89eI6HSFvDlX8Fe4MEZ3BjjGGXSEXh3BYg5jI9YY/x4NdPvCxxVf9gGmBo2uBjkPoqYE8IGfpxnF+C4CBEyI5FPjhQRYB7aPKL7hImoCFkaFG4UCQQDojfLHd2ON2sgZdeAML9jxNzf1CBsGVfDrI7GOj+enWG+lWjG5tav/essfDOlZ6rZslyquLQZAGQqZz06cVCMzAkEA2L6WuCiEop9gsnGk03UcO8u54jFC68+2IA4bJeqicFmqMgs73PzsnNZ7t31q51iGsKxvCm3hziTGHGGH9TZyrwJATda1XG5ptCF2uI7r3yhkxNhmsm10HjrF2O6pj747G5hORlpaKn7Ugz7mng4ETURyqwYuEv6fCPVYxwLMnSbMYQJBAMggMkoYH1+IiWA6TlZw64DKuvd/RKs3PpKac7auzw2tvNg4Ry3k2xR1dgYWZ3703miCzoRysOwGSGYsJ7ziaUECQQC1RqZ0UBtEbKSr9fRYxo/lg28ioTlxoMjSL2OumEyJk+2t0S3gPQq5Wz+ylcwnK3Md0kGTyYs5kkTWPyPm9V1F'
jim: jim:
appKey: '' appKey: ''

View File

@ -1,38 +0,0 @@
package com.ghy.common.adapay;
import com.huifu.adapay.Adapay;
import com.huifu.adapay.model.MerConfig;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.util.Assert;
/**
* Adapay 自动装载
*
* @author HH 2022/3/25
*/
@Configuration
@EnableConfigurationProperties(AdapayProperties.class)
public class AdapayAutoConfiguration {
@Bean
public AdapayService adapayService(AdapayProperties adapayProperties) throws Exception {
Assert.hasText(adapayProperties.getAppId(), "Adapay.appId is blank!");
Assert.hasText(adapayProperties.getApiKey(), "Adapay.apiKey is blank!");
Assert.hasText(adapayProperties.getMockApiKey(), "Adapay.mockApiKey is blank!");
Assert.hasText(adapayProperties.getRsaPrivateKey(), "Adapay.rsaPrivateKey is blank!");
MerConfig merConfig = new MerConfig();
merConfig.setApiKey(adapayProperties.getApiKey());
merConfig.setApiMockKey(adapayProperties.getMockApiKey());
merConfig.setRSAPrivateKey(adapayProperties.getRsaPrivateKey());
Adapay.initWithMerConfig(merConfig);
AdapayService adapayService = new AdapayService();
adapayService.setAdapayProperties(adapayProperties);
return adapayService;
}
}

View File

@ -0,0 +1,73 @@
package com.ghy.common.adapay;
import com.ghy.common.adapay.model.Merchant;
import com.huifu.adapay.Adapay;
import com.huifu.adapay.model.MerConfig;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.util.Assert;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
/**
* Adapay 配置
*
* @author HH 2022/3/25
*/
@Configuration
@EnableConfigurationProperties(AdapayProperties.class)
public class AdapayConfig {
/**
* 商户配置
*/
private static Set<Merchant> merchants;
/**
* deptId -> Merchant
*/
private static Map<Long, Merchant> merchantMap;
public static void initAdapay(AdapayProperties properties) throws Exception {
Adapay.debug = properties.isDebug();
Adapay.prodMode = properties.isProdMode();
Assert.hasText(properties.getNotifyUrl(), "NotifyUrl is blank!");
Assert.notEmpty(merchants, "Merchants is empty!");
Map<String, MerConfig> configPathMap = new HashMap<>(merchants.size());
for (Merchant merchant : merchants) {
check(merchant);
MerConfig merConfig = new MerConfig();
merConfig.setApiKey(merchant.getApiKey());
merConfig.setApiMockKey(merchant.getMockApiKey());
merConfig.setRSAPrivateKey(merchant.getRsaPrivateKey());
configPathMap.put(merchant.getDeptId().toString(), merConfig);
}
Adapay.initWithMerConfigs(configPathMap);
}
private static void check(Merchant merchant) {
Assert.notNull(merchant.getDeptId(), "DeptId is null!");
Assert.hasText(merchant.getAppId(), "AppId is blank!");
Assert.hasText(merchant.getApiKey(), "ApiKey is blank!");
Assert.hasText(merchant.getMockApiKey(), "MockApiKey is blank!");
Assert.hasText(merchant.getRsaPrivateKey(), "RsaPrivateKey is blank!");
}
public static void setMerchants(Set<Merchant> merchants) {
AdapayConfig.merchants = merchants;
AdapayConfig.merchantMap = merchants.stream().collect(Collectors.toMap(Merchant::getDeptId, x -> x));
}
public static String getAppId(Long deptId) {
Merchant merchant = merchantMap.get(deptId);
Assert.notNull(merchant, String.format("Merchant[%s] notfound!", deptId));
return merchant.getAppId();
}
public static Set<Merchant> getMerchants() {
return merchants;
}
}

View File

@ -10,7 +10,6 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
* @author HH 2022/3/25 * @author HH 2022/3/25
*/ */
@Data @Data
@Slf4j
@ConfigurationProperties("adapay") @ConfigurationProperties("adapay")
public class AdapayProperties { public class AdapayProperties {
@ -24,17 +23,6 @@ public class AdapayProperties {
*/ */
private boolean prodMode = true; private boolean prodMode = true;
private String appId;
private String notifyUrl; private String notifyUrl;
/**
* 初始化商户配置服务器启动前必须通过该方式初始化商户配置完成
* apiKey为prod模式的API KEY
* mockApiKey为mock模式的API KEY
* rsaPrivateKey为商户发起请求时用于请求参数加签所需要的RSA私钥
*/
private String apiKey;
private String mockApiKey;
private String rsaPrivateKey;
} }

View File

@ -10,10 +10,10 @@ import com.ghy.common.adapay.callback.mapping.RefundReplyMapping;
import com.ghy.common.adapay.model.*; import com.ghy.common.adapay.model.*;
import com.huifu.adapay.core.exception.BaseAdaPayException; import com.huifu.adapay.core.exception.BaseAdaPayException;
import com.huifu.adapay.model.*; import com.huifu.adapay.model.*;
import lombok.Setter;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
@ -27,7 +27,7 @@ import java.util.Map;
/** /**
* @author HH 2022/3/25 * @author HH 2022/3/25
*/ */
@Setter @Service
public class AdapayService { public class AdapayService {
protected final Logger logger = LoggerFactory.getLogger(this.getClass()); protected final Logger logger = LoggerFactory.getLogger(this.getClass());
@ -78,6 +78,7 @@ public class AdapayService {
* 创建余额支付请求 * 创建余额支付请求
* 商户利用该接口进行余额支付支持同一商户下的商户-用户用户-商户用户-用户间的账户余额支付 * 商户利用该接口进行余额支付支持同一商户下的商户-用户用户-商户用户-用户间的账户余额支付
* *
* @param deptId [必填]商户ID
* @param orderNo [必填]请求订单号只能为英文数字或者下划线的一种或多种组合保证在app_id下唯一 * @param orderNo [必填]请求订单号只能为英文数字或者下划线的一种或多种组合保证在app_id下唯一
* @param outMemberId [必填]出账用户的member_id 若为商户本身时请传入0 * @param outMemberId [必填]出账用户的member_id 若为商户本身时请传入0
* @param inMemberId [必填]入账用户的member_id 若为商户本身时请传入0 * @param inMemberId [必填]入账用户的member_id 若为商户本身时请传入0
@ -90,11 +91,13 @@ public class AdapayService {
* @param divMembers 分账对象信息列表最多仅支持7个分账方 * @param divMembers 分账对象信息列表最多仅支持7个分账方
* @return 成功时同步返回交易结果的 JSON * @return 成功时同步返回交易结果的 JSON
*/ */
public Map<String, Object> balancePay(@NotNull String orderNo, @NotNull String outMemberId, @NotNull String inMemberId, public Map<String, Object> balancePay(@NotNull Long deptId, @NotNull String orderNo, @NotNull String outMemberId,
@NotNull String transAmt, @NotNull String goodsTitle, @NotNull String goodsDesc, @NotNull String inMemberId, @NotNull String transAmt, @NotNull String goodsTitle,
String payMode, Collection<DivMember> divMembers) throws BaseAdaPayException { @NotNull String goodsDesc, String payMode, Collection<DivMember> divMembers) throws BaseAdaPayException {
// 获取商户的appId
String appId = AdapayConfig.getAppId(deptId);
Map<String, Object> balanceParam = new HashMap<>(10); Map<String, Object> balanceParam = new HashMap<>(10);
balanceParam.put("app_id", adapayProperties.getAppId()); balanceParam.put("app_id", appId);
balanceParam.put("adapay_func_code", "settle_accounts.balancePay"); balanceParam.put("adapay_func_code", "settle_accounts.balancePay");
balanceParam.put("order_no", orderNo); balanceParam.put("order_no", orderNo);
balanceParam.put("out_member_id", outMemberId); balanceParam.put("out_member_id", outMemberId);
@ -115,6 +118,7 @@ public class AdapayService {
* 用户创建对私结算账户时会对银行卡号银行卡开户姓名身份证号三要素认证若认证失败则创建结算账户失败 * 用户创建对私结算账户时会对银行卡号银行卡开户姓名身份证号三要素认证若认证失败则创建结算账户失败
* 每个结算账户对象 Adapay 系统会生成一个唯一的 id可用于查询结算账户对象或者删除结算账户对象 * 每个结算账户对象 Adapay 系统会生成一个唯一的 id可用于查询结算账户对象或者删除结算账户对象
* *
* @param deptId [必填]商户ID
* @param memberId [必填]商户下的用户id只能为英文数字或者下划线的一种或多种组合保证在app_id下唯一 * @param memberId [必填]商户下的用户id只能为英文数字或者下划线的一种或多种组合保证在app_id下唯一
* @param cardId [必填]银行卡号 * @param cardId [必填]银行卡号
* @param cardName [必填]银行卡对应的户名 * @param cardName [必填]银行卡对应的户名
@ -126,10 +130,12 @@ public class AdapayService {
* @param areaCode 银行账户开户银行所在地区编码省市编码银行账户类型为对公时必填省市编码详见area.json * @param areaCode 银行账户开户银行所在地区编码省市编码银行账户类型为对公时必填省市编码详见area.json
* @return 成功时同步返回一个包含 SettleAccount对象 JSON * @return 成功时同步返回一个包含 SettleAccount对象 JSON
*/ */
public Map<String, Object> createSettleAccount(@NotNull String memberId, @NotNull String cardId, @NotNull String cardName, public Map<String, Object> createSettleAccount(@NotNull Long deptId, @NotNull String memberId, @NotNull String cardId,
@NotNull String bankAcctType, String certId, String telNo, @NotNull String cardName, @NotNull String bankAcctType, String certId, String telNo,
String bankCode, String provCode, String areaCode) throws BaseAdaPayException { String bankCode, String provCode, String areaCode) throws BaseAdaPayException {
// 获取商户的appId
String appId = AdapayConfig.getAppId(deptId);
// 结算账户信息 参见结算账户信息(AccountInfo)对象 https://docs.adapay.tech/api/appendix.html#accountinfo // 结算账户信息 参见结算账户信息(AccountInfo)对象 https://docs.adapay.tech/api/appendix.html#accountinfo
Map<String, Object> accountInfo = new HashMap<>(9); Map<String, Object> accountInfo = new HashMap<>(9);
@ -157,7 +163,7 @@ public class AdapayService {
Map<String, Object> settleCountParams = new HashMap<>(4); Map<String, Object> settleCountParams = new HashMap<>(4);
settleCountParams.put("member_id", memberId); settleCountParams.put("member_id", memberId);
settleCountParams.put("app_id", adapayProperties.getAppId()); settleCountParams.put("app_id", appId);
// 目前仅支持bank_account银行卡 // 目前仅支持bank_account银行卡
settleCountParams.put("channel", "bank_account"); settleCountParams.put("channel", "bank_account");
settleCountParams.put("account_info", accountInfo); settleCountParams.put("account_info", accountInfo);
@ -167,6 +173,7 @@ public class AdapayService {
/** /**
* 创建实名用户 https://docs.adapay.tech/api/trade.html#member-realname * 创建实名用户 https://docs.adapay.tech/api/trade.html#member-realname
* *
* @param deptId [必填]商户ID
* @param memberId [必填]商户下的用户id只能为英文数字或者下划线的一种或多种组合保证在app_id下唯一 * @param memberId [必填]商户下的用户id只能为英文数字或者下划线的一种或多种组合保证在app_id下唯一
* @param telNo [必填]用户手机号 * @param telNo [必填]用户手机号
* @param username [必填]用户姓名 * @param username [必填]用户姓名
@ -177,11 +184,14 @@ public class AdapayService {
* @param nickname 用户昵称 * @param nickname 用户昵称
* @return 成功时同步返回一个包含Member对象的JSON * @return 成功时同步返回一个包含Member对象的JSON
*/ */
public Map<String, Object> createMember(String memberId, String telNo, String username, String certId, public Map<String, Object> createMember(@NotNull Long deptId, @NotNull String memberId, @NotNull String telNo,
String location, String email, String gender, String nickname) throws BaseAdaPayException { @NotNull String username, @NotNull String certId, String location,
String email, String gender, String nickname) throws BaseAdaPayException {
// 获取商户的appId
String appId = AdapayConfig.getAppId(deptId);
Map<String, Object> memberParams = new HashMap<>(7); Map<String, Object> memberParams = new HashMap<>(7);
memberParams.put("member_id", memberId); memberParams.put("member_id", memberId);
memberParams.put("app_id", adapayProperties.getAppId()); memberParams.put("app_id", appId);
memberParams.put("location", location); memberParams.put("location", location);
memberParams.put("email", email); memberParams.put("email", email);
memberParams.put("gender", gender); memberParams.put("gender", gender);
@ -199,6 +209,7 @@ public class AdapayService {
/** /**
* 对指定商户或者商户下用户的结算账户可用余额发起主动取现操作金额从账户中提到绑定的结算银行卡中 * 对指定商户或者商户下用户的结算账户可用余额发起主动取现操作金额从账户中提到绑定的结算银行卡中
* *
* @param deptId [必填]商户ID
* @param callback [必填项]处理提现结果的接口 * @param callback [必填项]处理提现结果的接口
* @param orderNo [必填项]请求订单号只能为英文数字或者下划线的一种或多种组合保证在app_id下唯一 * @param orderNo [必填项]请求订单号只能为英文数字或者下划线的一种或多种组合保证在app_id下唯一
* @param cashType [必填项]取现类型T1-T+1取现D1-D+1取现D0-即时取现 * @param cashType [必填项]取现类型T1-T+1取现D1-D+1取现D0-即时取现
@ -208,8 +219,10 @@ public class AdapayService {
* @param feeMode 手续费收取模式O-商户手续费账户扣取手续费I-交易金额中扣取手续费值为空时默认值为I * @param feeMode 手续费收取模式O-商户手续费账户扣取手续费I-交易金额中扣取手续费值为空时默认值为I
* @return https://docs.adapay.tech/api/wallet.html#cash-response * @return https://docs.adapay.tech/api/wallet.html#cash-response
*/ */
public Map<String, Object> drawCash(DrawCashCallback callback, String orderNo, String cashType, String cashAmt, public Map<String, Object> drawCash(@NotNull Long deptId, DrawCashCallback callback, String orderNo, String cashType, String cashAmt,
String memberId, String remark, String feeMode) throws BaseAdaPayException { String memberId, String remark, String feeMode) throws BaseAdaPayException {
// 获取商户的appId
String appId = AdapayConfig.getAppId(deptId);
Assert.notNull(callback, "callback is null!"); Assert.notNull(callback, "callback is null!");
Assert.hasText(orderNo, "orderNo is blank!"); Assert.hasText(orderNo, "orderNo is blank!");
Assert.hasText(cashType, "cashType is blank!"); Assert.hasText(cashType, "cashType is blank!");
@ -217,7 +230,7 @@ public class AdapayService {
Assert.hasText(memberId, "memberId is blank!"); Assert.hasText(memberId, "memberId is blank!");
Map<String, Object> cashParam = new HashMap<>(5); Map<String, Object> cashParam = new HashMap<>(5);
cashParam.put("order_no", orderNo); cashParam.put("order_no", orderNo);
cashParam.put("app_id", adapayProperties.getAppId()); cashParam.put("app_id", appId);
cashParam.put("cash_type", cashType); cashParam.put("cash_type", cashType);
cashParam.put("cash_amt", cashAmt); cashParam.put("cash_amt", cashAmt);
cashParam.put("member_id", memberId); cashParam.put("member_id", memberId);
@ -231,28 +244,34 @@ public class AdapayService {
/** /**
* 支付宝正扫支付 * 支付宝正扫支付
*/ */
public Map<String, Object> alipayQrPay(PayParam payParam, PayCallback callback, AlipayExpend expend, DeviceInfo deviceInfo, public Map<String, Object> alipayQrPay(@NotNull Long deptId, PayParam payParam, PayCallback callback,
AlipayExpend expend, DeviceInfo deviceInfo,
Collection<DivMember> divMembers) throws BaseAdaPayException { Collection<DivMember> divMembers) throws BaseAdaPayException {
return pay("alipay_qr", payParam, callback, expend, deviceInfo, divMembers); return pay(deptId, "alipay_qr", payParam, callback, expend, deviceInfo, divMembers);
} }
/** /**
* 微信公众号支付 * 微信公众号支付
*/ */
public Map<String, Object> wxPubPay(PayParam payParam, PayCallback callback, WxpayExpend expend, DeviceInfo deviceInfo, public Map<String, Object> wxPubPay(@NotNull Long deptId, PayParam payParam, PayCallback callback,
WxpayExpend expend, DeviceInfo deviceInfo,
Collection<DivMember> divMembers) throws BaseAdaPayException { Collection<DivMember> divMembers) throws BaseAdaPayException {
return pay("wx_pub", payParam, callback, expend, deviceInfo, divMembers); return pay(deptId, "wx_pub", payParam, callback, expend, deviceInfo, divMembers);
} }
/** /**
* 微信小程序支付 * 微信小程序支付
*/ */
public Map<String, Object> wxLitePay(PayParam payParam, PayCallback callback, WxpayExpend expend, DeviceInfo deviceInfo, public Map<String, Object> wxLitePay(@NotNull Long deptId, PayParam payParam, PayCallback callback,
WxpayExpend expend, DeviceInfo deviceInfo,
Collection<DivMember> divMembers) throws BaseAdaPayException { Collection<DivMember> divMembers) throws BaseAdaPayException {
return pay("wx_lite", payParam, callback, expend, deviceInfo, divMembers); return pay(deptId, "wx_lite", payParam, callback, expend, deviceInfo, divMembers);
} }
/** /**
* 聚合支付
*
* @param deptId [必填]商户ID
* @param payChannel [必填项]支付渠道详见 https://docs.adapay.tech/api/appendix.html#id2 * @param payChannel [必填项]支付渠道详见 https://docs.adapay.tech/api/appendix.html#id2
* @param payParam [必填项]支付参数 * @param payParam [必填项]支付参数
* @param callback [必填项]处理支付结果的回调接口 * @param callback [必填项]处理支付结果的回调接口
@ -261,10 +280,13 @@ public class AdapayService {
* @param divMembers 分账对象信息列表 https://docs.adapay.tech/api/appendix.html#divmembers * @param divMembers 分账对象信息列表 https://docs.adapay.tech/api/appendix.html#divmembers
* @return 同步返回一个 支付对象详见 https://docs.adapay.tech/api/trade.html#id2 * @return 同步返回一个 支付对象详见 https://docs.adapay.tech/api/trade.html#id2
*/ */
public Map<String, Object> pay(String payChannel, PayParam payParam, PayCallback callback, Expend expend, public Map<String, Object> pay(@NotNull Long deptId, @NotNull String payChannel, @NotNull PayParam payParam,
DeviceInfo deviceInfo, Collection<DivMember> divMembers) throws BaseAdaPayException { @NotNull PayCallback callback, Expend expend, DeviceInfo deviceInfo,
Collection<DivMember> divMembers) throws BaseAdaPayException {
// 获取商户的appId
String appId = AdapayConfig.getAppId(deptId);
JSONObject paymentParams = payParam.toJSONObject(); JSONObject paymentParams = payParam.toJSONObject();
paymentParams.put("app_id", adapayProperties.getAppId()); paymentParams.put("app_id", appId);
paymentParams.put("notify_url", adapayProperties.getNotifyUrl()); paymentParams.put("notify_url", adapayProperties.getNotifyUrl());
paymentParams.put("pay_channel", payChannel); paymentParams.put("pay_channel", payChannel);
paymentParams.put("div_members", divMembers); paymentParams.put("div_members", divMembers);
@ -289,7 +311,8 @@ public class AdapayService {
* @param refundAmt [必填项]退款金额若退款金额小于原交易金额则认为是部分退款必须大于0保留两位小数点如0.10100.05等 * @param refundAmt [必填项]退款金额若退款金额小于原交易金额则认为是部分退款必须大于0保留两位小数点如0.10100.05等
* @return 同步返回一个 退款对象 https://docs.adapay.tech/api/trade.html#create-refund-params * @return 同步返回一个 退款对象 https://docs.adapay.tech/api/trade.html#create-refund-params
*/ */
public Map<String, Object> refund(RefundCallback callback, String paymentId, String refundOrderNo, String refundAmt) throws BaseAdaPayException { public Map<String, Object> refund(@NotNull RefundCallback callback, @NotNull String paymentId,
@NotNull String refundOrderNo, @NotNull String refundAmt) throws BaseAdaPayException {
Assert.notNull(callback, "callback is null!"); Assert.notNull(callback, "callback is null!");
Assert.hasText(paymentId, "paymentId is blank!"); Assert.hasText(paymentId, "paymentId is blank!");
Assert.hasText(refundOrderNo, "refundOrderNo is blank!"); Assert.hasText(refundOrderNo, "refundOrderNo is blank!");

View File

@ -0,0 +1,21 @@
package com.ghy.common.adapay.model;
/**
* Adapay 的接口中常用到 status 参数
*
* @author HH 2022/5/21
*/
public enum AdapayStatusEnum {
pending("pending", "处理中"),
succeeded("succeeded", "成功"),
failed("failed", "失败");
public String code;
public String description;
AdapayStatusEnum(String code, String description) {
this.code = code;
this.description = description;
}
}

View File

@ -0,0 +1,52 @@
package com.ghy.common.adapay.model;
import lombok.Getter;
import lombok.Setter;
import java.util.Objects;
/**
* Adapay商户配置
*
* @author HH 2022/5/20
*/
@Getter
@Setter
public class Merchant {
/**
* 商户唯一标识
*/
private Long deptId;
private String appId;
/**
* prod模式的 api_key
*/
private String apiKey;
/**
* mock模式的 api_key
*/
private String mockApiKey;
/**
* 商户发起请求时用于请求参数加签所需要的RSA私钥
*/
private String rsaPrivateKey;
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Merchant merchant = (Merchant) o;
// deptId appId 任何一个相同都视为同一个商户
return deptId.equals(merchant.deptId) || appId.equals(merchant.appId);
}
@Override
public int hashCode() {
return Objects.hash(deptId, appId);
}
}

View File

@ -0,0 +1,16 @@
package com.ghy.common.utils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.Assert;
/**
* @author HH 2022/5/21
*/
@Slf4j
public class AdapayUtils {
public static String getMemberId(Long memberId, Long deptId) {
Assert.isTrue(Math.min(memberId, deptId) > 0, "Invalid [memberId] or [deptId]");
return String.format("C%dD%d", memberId, deptId);
}
}

View File

@ -1,3 +1,3 @@
# Auto Configure # Auto Configure
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.ghy.common.adapay.AdapayAutoConfiguration com.ghy.common.adapay.AdapayConfig

View File

@ -6,6 +6,7 @@ import lombok.Data;
/** /**
* 消费者银行卡 * 消费者银行卡
*
* @author clunt * @author clunt
*/ */
@Data @Data
@ -20,6 +21,9 @@ public class CustomerBank extends BaseEntity {
@Excel(name = "用户真实姓名", cellType = Excel.ColumnType.STRING) @Excel(name = "用户真实姓名", cellType = Excel.ColumnType.STRING)
private String name; private String name;
@Excel(name = "身份证号", cellType = Excel.ColumnType.STRING)
private String certId;
@Excel(name = "银行名称", cellType = Excel.ColumnType.STRING) @Excel(name = "银行名称", cellType = Excel.ColumnType.STRING)
private String bankName; private String bankName;
@ -29,4 +33,12 @@ public class CustomerBank extends BaseEntity {
@Excel(name = "银行卡绑定手机号", cellType = Excel.ColumnType.STRING) @Excel(name = "银行卡绑定手机号", cellType = Excel.ColumnType.STRING)
private String phone; private String phone;
@Excel(name = "分公司id", cellType = Excel.ColumnType.NUMERIC)
private Long deptId;
@Excel(name = "adapay会员账号", cellType = Excel.ColumnType.STRING)
private String adapayMemberId;
@Excel(name = "是否为结算账户", cellType = Excel.ColumnType.STRING)
private Integer settleAccount;
} }

View File

@ -0,0 +1,66 @@
package com.ghy.customer.mapper;
import com.ghy.customer.domain.CustomerBank;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 消费者银行卡
*
* @author HH 2022/5/20
*/
@Mapper
public interface CustomerBankMapper {
/**
* @param customerBank 消费者银行卡筛选条件
* @return 符合结果消费者银行卡
*/
List<CustomerBank> getCustomerBankList(CustomerBank customerBank);
/**
* 用消费者ID查银行卡信息
*
* @param customerId 消费者ID
*/
List<CustomerBank> selectByCustomerId(Long customerId);
/**
* 用消费者ID和部门ID查银行卡信息
*
* @param customerId 消费者ID
* @param deptId 部门ID
*/
List<CustomerBank> selectByCustomerIdAndDeptId(Long customerId, Long deptId);
/**
* @param customerBankId 消费者银行卡id
* @return 消费者银行卡信息
*/
CustomerBank selectByCustomerBankId(Long customerBankId);
/**
* @param customerBankIds 消费者银行卡ids
* @return 删除成功条数
*/
int deleteByIds(Long[] customerBankIds);
/**
* @param customerBankId 消费者银行卡id
* @return 删除成功条数
*/
int deleteByCustomerBankId(Long customerBankId);
/**
* @param customerBank 消费者银行卡对象
* @return 入库成功条数
*/
int insertCustomerBank(CustomerBank customerBank);
/**
* @param customerBank 消费者银行卡对象
* @return 更新成功条数
*/
int updateCustomerBank(CustomerBank customerBank);
}

View File

@ -0,0 +1,37 @@
package com.ghy.customer.request;
import lombok.Data;
/**
* 个人账户绑定银行卡接口参数
*
* @author HH 2022/5/20
*/
@Data
public class BindBankCardRequest {
/**
* 消费者ID
*/
private Long customerId;
/**
* 用户真实姓名
*/
private String name;
/**
* 身份证号
*/
private String certId;
/**
* 银行卡号
*/
private String bankNum;
/**
* 银行卡绑定手机号
*/
private String phone;
}

View File

@ -0,0 +1,58 @@
package com.ghy.customer.service;
import com.ghy.customer.domain.CustomerBank;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 消费者银行卡
*
* @author HH 2022/5/20
*/
public interface CustomerBankService {
/**
* @param customerBank 消费者银行卡筛选条件
* @return 符合结果消费者银行卡
*/
List<CustomerBank> getCustomerBankList(CustomerBank customerBank);
/**
* 用消费者ID和部门ID查银行卡信息
*
* @param customerId 消费者ID
* @param deptId 部门ID
*/
List<CustomerBank> selectByCustomerIdAndDeptId(Long customerId, Long deptId);
/**
* @param customerBankId 消费者银行卡id
* @return 消费者银行卡信息
*/
CustomerBank selectByCustomerBankId(Long customerBankId);
/**
* @param customerBankIds 消费者银行卡ids
* @return 删除成功条数
*/
int deleteByIds(Long[] customerBankIds);
/**
* @param customerBankId 消费者银行卡id
* @return 删除成功条数
*/
int deleteByCustomerBankId(Long customerBankId);
/**
* @param customerBank 消费者银行卡对象
* @return 入库成功条数
*/
int insertCustomerBank(CustomerBank customerBank);
/**
* @param customerBank 消费者银行卡对象
* @return 更新成功条数
*/
int updateCustomerBank(CustomerBank customerBank);
}

View File

@ -0,0 +1,57 @@
package com.ghy.customer.service.impl;
import com.ghy.common.utils.AdapayUtils;
import com.ghy.customer.domain.CustomerBank;
import com.ghy.customer.mapper.CustomerBankMapper;
import com.ghy.customer.service.CustomerBankService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* @author HH 2022/5/20
*/
@Service
public class CustomerBankServiceImpl implements CustomerBankService {
@Resource
CustomerBankMapper customerBankMapper;
@Override
public List<CustomerBank> getCustomerBankList(CustomerBank customerBank) {
return customerBankMapper.getCustomerBankList(customerBank);
}
@Override
public List<CustomerBank> selectByCustomerIdAndDeptId(Long customerId, Long deptId) {
return customerBankMapper.selectByCustomerIdAndDeptId(customerId, deptId);
}
@Override
public CustomerBank selectByCustomerBankId(Long customerBankId) {
return customerBankMapper.selectByCustomerBankId(customerBankId);
}
@Override
public int deleteByIds(Long[] customerBankIds) {
return customerBankMapper.deleteByIds(customerBankIds);
}
@Override
public int deleteByCustomerBankId(Long customerBankId) {
return customerBankMapper.deleteByCustomerBankId(customerBankId);
}
@Override
public int insertCustomerBank(CustomerBank customerBank) {
customerBank.setAdapayMemberId(AdapayUtils.getMemberId(customerBank.getCustomerId(), customerBank.getDeptId()));
return customerBankMapper.insertCustomerBank(customerBank);
}
@Override
public int updateCustomerBank(CustomerBank customerBank) {
return customerBankMapper.updateCustomerBank(customerBank);
}
}

View File

@ -0,0 +1,133 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ghy.customer.mapper.CustomerBankMapper">
<resultMap id="CustomerBankResult" type="com.ghy.customer.domain.CustomerBank">
<result property="customerBankId" column="customer_bank_id"/>
<result property="customerId" column="customer_id"/>
<result property="name" column="name"/>
<result property="certId" column="cert_id"/>
<result property="bankName" column="bank_name"/>
<result property="bankNum" column="bank_num"/>
<result property="phone" column="phone"/>
<result property="deptId" column="dept_id"/>
<result property="adapayMemberId" column="adapay_member_id"/>
<result property="settleAccount" column="settle_account"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="remark" column="remark"/>
</resultMap>
<sql id="selectCustomerBank">
SELECT customer_bank_id,
customer_id,
name,
cert_id,
bank_name,
bank_num,
phone,
dept_id,
adapay_member_id,
settle_account,
create_by,
create_time,
remark
FROM customer_bank
</sql>
<update id="updateCustomerBank" parameterType="com.ghy.customer.domain.CustomerBank">
UPDATE customer_bank
<set>
<if test="customerId != null and customerId != 0">customer_id = #{customerId},</if>
<if test="name != null and name != ''">`name` = #{name},</if>
<if test="bankName != null and bankName != ''">bank_name = #{bankName},</if>
<if test="bankNum != null and bankNum != ''">bank_num = #{bankNum},</if>
<if test="phone != null and phone != ''">phone = #{phone},</if>
<if test="deptId != null and deptId != 0">dept_id = #{deptId},</if>
<if test="settleAccount != null">settle_account = #{settleAccount},</if>
<if test="remark != null and remark != ''">remark = #{remark},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
update_time = sysdate()
</set>
WHERE customer_bank_id = #{customerBankId}
</update>
<insert id="insertCustomerBank" parameterType="com.ghy.customer.domain.CustomerBank" useGeneratedKeys="true"
keyProperty="customerBankId">
INSERT INTO customer_bank(
<if test="customerId != null and customerId != 0">customer_id,</if>
<if test="name != null and name != ''">name,</if>
<if test="certId != null and certId != ''">cert_id,</if>
<if test="bankName != null and bankName != ''">bank_name,</if>
<if test="bankNum != null and bankNum != ''">bank_num,</if>
<if test="phone != null and phone != ''">phone,</if>
<if test="deptId != null and deptId != 0">dept_id,</if>
<if test="adapayMemberId != null and adapayMemberId != ''">adapay_member_id,</if>
<if test="settleAccount != null">settle_account,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="remark != null and remark != ''">remark,</if>
create_time
)VALUES(
<if test="customerId != null and customerId != 0">#{customerId},</if>
<if test="name != null and name != ''">#{name},</if>
<if test="certId != null and certId != ''">#{certId},</if>
<if test="bankName != null and bankName != ''">#{bankName},</if>
<if test="bankNum != null and bankNum != ''">#{bankNum},</if>
<if test="phone != null and phone != ''">#{phone},</if>
<if test="deptId != null and deptId != 0">#{deptId},</if>
<if test="adapayMemberId != null and adapayMemberId != ''">#{adapayMemberId},</if>
<if test="settleAccount != null">#{settleAccount},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="remark != null and remark != ''">#{remark},</if>
sysdate()
)
</insert>
<select id="getCustomerBankList" resultMap="CustomerBankResult">
<include refid="selectCustomerBank"/>
<where>
<if test="customerId != null and customerId != ''">
AND customer_id = #{customerId}
</if>
<if test="deptId != null and deptId != ''">
AND dept_id = #{deptId}
</if>
<if test="adapayMemberId != null and adapayMemberId != ''">
AND adapay_member_id = #{adapayMemberId}
</if>
<if test="settleAccount != null and settleAccount != ''">
AND settle_account = #{settleAccount}
</if>
</where>
</select>
<delete id="deleteByIds">
DELETE FROM customer_bank WHERE customer_bank_id IN
<foreach collection="array" item="customerBankId" open="(" separator="," close=")">
#{customerBankId}
</foreach>
</delete>
<delete id="deleteByCustomerBankId" parameterType="Long">
DELETE
FROM customer_bank
WHERE customer_bank_id = #{customerBankId}
</delete>
<select id="selectByCustomerIdAndDeptId" resultMap="CustomerBankResult">
<include refid="selectCustomerBank"/>
WHERE customer_id = #{customerId} AND dept_id = #{deptId}
</select>
<select id="selectByCustomerId" resultMap="CustomerBankResult">
<include refid="selectCustomerBank"/>
WHERE customer_id = #{customerId}
</select>
<select id="selectByCustomerBankId" resultMap="CustomerBankResult">
<include refid="selectCustomerBank"/> WHERE customer_bank_id = #{customerBankId}
</select>
</mapper>

View File

@ -16,6 +16,9 @@ public class OrderMaster extends BaseEntity {
@Excel(name = "序号", cellType = Excel.ColumnType.NUMERIC) @Excel(name = "序号", cellType = Excel.ColumnType.NUMERIC)
private Long id; private Long id;
@Excel(name = "商户ID", cellType = Excel.ColumnType.NUMERIC)
private Long deptId;
@Excel(name = "订单编码", cellType = Excel.ColumnType.STRING) @Excel(name = "订单编码", cellType = Excel.ColumnType.STRING)
private String code; private String code;

View File

@ -20,10 +20,17 @@ public class SysDeptConfig extends BaseEntity {
@Excel(name = "首页图片", cellType = Excel.ColumnType.STRING) @Excel(name = "首页图片", cellType = Excel.ColumnType.STRING)
private String bannerUrl; private String bannerUrl;
//通用支付/小程序配置 // Adapay支付
private String adapayAppKey; // apiKey为prod模式的API KEY
private String adapayMasterSecret; // mockApiKey为mock模式的API KEY
// rsaPrivateKey为商户发起请求时用于请求参数加签所需要的RSA私钥
private String adapayAppId;
private String adapayApiKey;
private String adapayMockApiKey;
private String adapayRsaPrivateKey;
private String adapayMaxRetryTimes; private String adapayMaxRetryTimes;
//微信配置
private String wxAppId; private String wxAppId;
private String wxSecret; private String wxSecret;

View File

@ -2,6 +2,8 @@ package com.ghy.system.mapper;
import com.ghy.system.domain.SysDeptConfig; import com.ghy.system.domain.SysDeptConfig;
import java.util.List;
/** /**
* @author clunt * @author clunt
* 部门配置Mapper层 * 部门配置Mapper层
@ -15,4 +17,9 @@ public interface SysDeptConfigMapper {
*/ */
public SysDeptConfig selectByDeptId(Long deptId); public SysDeptConfig selectByDeptId(Long deptId);
/**
* 获取所有商户的配置
*/
List<SysDeptConfig> selectAllMerchant();
} }

View File

@ -2,6 +2,8 @@ package com.ghy.system.service;
import com.ghy.system.domain.SysDeptConfig; import com.ghy.system.domain.SysDeptConfig;
import java.util.List;
/** /**
* @author clunt * @author clunt
* 部门配置Service层 * 部门配置Service层
@ -14,4 +16,9 @@ public interface ISysDeptConfigService {
*/ */
public SysDeptConfig selectByDeptId(Long deptId); public SysDeptConfig selectByDeptId(Long deptId);
/**
* 获取所有商户的配置
*/
List<SysDeptConfig> selectAllMerchant();
} }

View File

@ -10,6 +10,7 @@ import com.ghy.system.service.ISysDeptConfigService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List;
/** /**
* @author clunt * @author clunt
@ -36,4 +37,9 @@ public class SysDeptConfigServiceImpl implements ISysDeptConfigService {
} }
} }
@Override
public List<SysDeptConfig> selectAllMerchant() {
return sysDeptConfigMapper.selectAllMerchant();
}
} }

View File

@ -7,6 +7,14 @@
<result property="sysDeptConfigId" column="sys_dept_config_id"/> <result property="sysDeptConfigId" column="sys_dept_config_id"/>
<result property="deptId" column="dept_id"/> <result property="deptId" column="dept_id"/>
<result property="bannerUrl" column="banner_url"/> <result property="bannerUrl" column="banner_url"/>
<result property="adapayAppId" column="adapay_app_id"/>
<result property="adapayApiKey" column="adapay_api_key"/>
<result property="adapayMockApiKey" column="adapay_mock_key"/>
<result property="adapayRsaPrivateKey" column="adapay_rsa_private_key"/>
<result property="adapayMaxRetryTimes" column="adapay_max_retry_times"/>
<result property="wxAppId" column="wx_app_id"/>
<result property="wxSecret" column="wx_secret"/>
<result property="takeRate" column="take_rate"/>
<result property="createBy" column="create_by"/> <result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/> <result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/> <result property="updateBy" column="update_by"/>
@ -15,7 +23,9 @@
</resultMap> </resultMap>
<sql id="selectSysDeptConfig"> <sql id="selectSysDeptConfig">
SELECT sys_dept_config_id, dept_id, banner_url, create_by, create_time, remark SELECT sys_dept_config_id, dept_id, banner_url, adapay_app_id, adapay_api_key, adapay_mock_key,
adapay_rsa_private_key, adapay_max_retry_times, wx_app_id, wx_secret, take_rate,
create_by, create_time, update_by, update_time, remark
FROM sys_dept_config FROM sys_dept_config
</sql> </sql>
@ -29,4 +39,10 @@
</select> </select>
<select id="selectAllMerchant" resultMap="SysDeptConfigResult">
<include refid="selectSysDeptConfig"/>
WHERE adapay_app_id IS NOT NULL
AND adapay_api_key IS NOT NULL
</select>
</mapper> </mapper>