全量开通CBPAY

master
taylor.dang 6 years ago
parent ebcac47ea0
commit 288bf599c7

@ -13,7 +13,7 @@
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jib-maven-plugin.version>1.1.2</jib-maven-plugin.version> <jib-maven-plugin.version>1.1.2</jib-maven-plugin.version>
<docker-image.version>1.1.12</docker-image.version> <docker-image.version>1.1.13</docker-image.version>
</properties> </properties>
<dependencies> <dependencies>

@ -27,7 +27,10 @@ import au.com.royalpay.payment.manage.permission.manager.ManagerMapping;
import au.com.royalpay.payment.manage.system.core.TradeSecureService; import au.com.royalpay.payment.manage.system.core.TradeSecureService;
import au.com.royalpay.payment.manage.tradelog.core.TradeLogService; import au.com.royalpay.payment.manage.tradelog.core.TradeLogService;
import au.com.royalpay.payment.tools.CommonConsts; import au.com.royalpay.payment.tools.CommonConsts;
import au.com.royalpay.payment.tools.connections.mpsupport.MpWechatApi;
import au.com.royalpay.payment.tools.connections.mpsupport.MpWechatApiProvider;
import au.com.royalpay.payment.tools.defines.TradeType; import au.com.royalpay.payment.tools.defines.TradeType;
import au.com.royalpay.payment.tools.env.PlatformEnvironment;
import au.com.royalpay.payment.tools.env.SysConfigManager; import au.com.royalpay.payment.tools.env.SysConfigManager;
import au.com.royalpay.payment.tools.exceptions.BadRequestException; import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.http.HttpUtils; import au.com.royalpay.payment.tools.http.HttpUtils;
@ -125,6 +128,8 @@ public class TestController implements ApplicationEventPublisherAware {
@Resource @Resource
private SysConfigManager sysConfigManager; private SysConfigManager sysConfigManager;
@Resource @Resource
private MpWechatApiProvider mpWechatApiProvider;
@Resource
private TradeSecureService tradeSecureService; private TradeSecureService tradeSecureService;
private final static String EMAIL = "lily.tao@royalpay.com.au,bella.sun@royalpay.com.au,astro.dai@royalpay.com.au,taylor.dang@royalpay.com.au"; private final static String EMAIL = "lily.tao@royalpay.com.au,bella.sun@royalpay.com.au,astro.dai@royalpay.com.au,taylor.dang@royalpay.com.au";
@ -466,4 +471,33 @@ public class TestController implements ApplicationEventPublisherAware {
public void initClientPayType(@RequestParam int begin,@RequestParam int end) { public void initClientPayType(@RequestParam int begin,@RequestParam int end) {
aliforexcelService.initClientPayType(begin,end); aliforexcelService.initClientPayType(begin,end);
} }
@PutMapping(value = "/open/cb_bankpay")
public void switchCBBankPayLinkPermission() {
List<JSONObject> merchants = clientMapper.listNeedOpenCbpayMerchant();
merchants.forEach(mch -> {
JSONObject client = clientMapper.findClientByMonikerAll(mch.getString("client_moniker"));
if (client == null) {
throw new InvalidShortIdException();
}
if (StringUtils.isEmpty(client.getString("cb_bankpay_url"))) {
String longUrl = PlatformEnvironment.getEnv().concatUrl("/sys/partners/" + client.getString("client_moniker") + "/cb_bankpay/link/pc");
String cb_bankpay_url = getCBBankShortLink(longUrl);
client.put("cb_bankpay_url", cb_bankpay_url);
client.put("enable_cb_bankpay_link", true);
client.put("enable_cb_bankpay", true);
clientMapper.update(client);
} else {
client.put("enable_cb_bankpay_link", true);
clientMapper.update(client);
}
});
}
private String getCBBankShortLink(String longUrl) {
MpWechatApi api = mpWechatApiProvider.getNewPaymentApi();
return api.registerShortUrl(longUrl);
}
} }

@ -38,6 +38,8 @@ public interface ClientMapper {
@AutoSql(type = SqlType.SELECT) @AutoSql(type = SqlType.SELECT)
JSONObject findClientByMonikerAll(@Param("client_moniker") String clientMoniker); JSONObject findClientByMonikerAll(@Param("client_moniker") String clientMoniker);
List<JSONObject> listNeedOpenCbpayMerchant();
@AutoSql(type = SqlType.SELECT) @AutoSql(type = SqlType.SELECT)
@AdvanceSelect(addonWhereClause = "is_valid=1") @AdvanceSelect(addonWhereClause = "is_valid=1")
List<JSONObject> getClientBySubMerchantId(@Param("sub_merchant_id") String subMerchantId); List<JSONObject> getClientBySubMerchantId(@Param("sub_merchant_id") String subMerchantId);

@ -103,7 +103,6 @@ import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.thymeleaf.context.Context; import org.thymeleaf.context.Context;
import org.thymeleaf.spring4.SpringTemplateEngine; import org.thymeleaf.spring4.SpringTemplateEngine;
import sun.misc.BASE64Encoder;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -5173,8 +5172,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
KeyPair keyPairGen = RSACrypt.generateKeyPairs(); KeyPair keyPairGen = RSACrypt.generateKeyPairs();
RSAPublicKey publicKey = (RSAPublicKey) keyPairGen.getPublic(); RSAPublicKey publicKey = (RSAPublicKey) keyPairGen.getPublic();
RSAPrivateKey privateKey = (RSAPrivateKey) keyPairGen.getPrivate(); RSAPrivateKey privateKey = (RSAPrivateKey) keyPairGen.getPrivate();
key.put("public_key", new BASE64Encoder().encode(publicKey.getEncoded())); key.put("public_key", Base64.encodeBase64String(publicKey.getEncoded()));
key.put("private_key", new BASE64Encoder().encode(privateKey.getEncoded())); key.put("private_key", Base64.encodeBase64String(privateKey.getEncoded()));
return key; return key;
} }

@ -555,11 +555,11 @@
fbc.bd_type, fbc.bd_type,
sum( a.proportion ) clients_month sum( a.proportion ) clients_month
FROM FROM
( sys_client_bd a
INNER JOIN (
SELECT SELECT
bd_id, bd_id,
max( create_time ) create_time, max( create_time ) create_time
proportion
FROM FROM
sys_client_bd sys_client_bd
WHERE WHERE
@ -581,9 +581,12 @@
GROUP BY GROUP BY
bd_id, bd_id,
client_id client_id
) a ) b ON a.bd_id = b.bd_id
AND a.create_time = b.create_time
INNER JOIN financial_bd_config c ON a.bd_id = c.manager_id INNER JOIN financial_bd_config c ON a.bd_id = c.manager_id
INNER JOIN financial_bd_config fbc ON fbc.manager_id = c.bd_group INNER JOIN financial_bd_config fbc ON fbc.manager_id = c.bd_group
WHERE
a.is_valid = 1
GROUP BY GROUP BY
fbc.bd_group fbc.bd_group
ORDER BY ORDER BY
@ -596,11 +599,11 @@
fbc.bd_type, fbc.bd_type,
sum( a.proportion ) clients_yesterday sum( a.proportion ) clients_yesterday
FROM FROM
( sys_client_bd a
INNER JOIN (
SELECT SELECT
bd_id, bd_id,
max( create_time ) create_time, max( create_time ) create_time
proportion
FROM FROM
sys_client_bd sys_client_bd
WHERE WHERE
@ -622,9 +625,12 @@
GROUP BY GROUP BY
bd_id, bd_id,
client_id client_id
) a ) b ON a.bd_id = b.bd_id
AND a.create_time = b.create_time
INNER JOIN financial_bd_config c ON a.bd_id = c.manager_id INNER JOIN financial_bd_config c ON a.bd_id = c.manager_id
INNER JOIN financial_bd_config fbc ON fbc.manager_id = c.bd_group INNER JOIN financial_bd_config fbc ON fbc.manager_id = c.bd_group
WHERE
a.is_valid = 1
GROUP BY GROUP BY
fbc.bd_group fbc.bd_group
ORDER BY ORDER BY
@ -643,4 +649,16 @@
<select id="getPartnercode" resultType="int"> <select id="getPartnercode" resultType="int">
SELECT count(1) FROM sys_clients where client_moniker=#{codes}; SELECT count(1) FROM sys_clients where client_moniker=#{codes};
</select> </select>
<select id="listNeedOpenCbpayMerchant" resultType="com.alibaba.fastjson.JSONObject">
SELECT sc.client_moniker,
sc.client_id
FROM sys_clients sc
WHERE sc.client_id IN (SELECT scr.client_id
FROM sys_client_rates scr
WHERE scr.rate_name = 'CB_BankPay'
AND (scr.expiry_time IS NULL
OR scr.expiry_time >= NOW()));
</select>
</mapper> </mapper>

Loading…
Cancel
Save