master
wangning 6 years ago
parent 9059101594
commit a84406f6c0

@ -1,5 +1,7 @@
package au.com.royalpay.payment.manage.application.core.impls;
import au.com.royalpay.payment.channels.wechat.config.WeChatPayConfig;
import au.com.royalpay.payment.channels.wechat.runtime.MpPaymentApi;
import au.com.royalpay.payment.core.mappers.PmtSubMerchantIdMapper;
import au.com.royalpay.payment.manage.application.core.SimpleClientApplyService;
import au.com.royalpay.payment.manage.mappers.preapply.SysClientPreMapperMapper;
@ -44,6 +46,7 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Random;
import java.util.Set;
import java.util.concurrent.TimeUnit;
@ -63,6 +66,8 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
@Value("${royalpay.sms.appkey:43390d81e20c5191c278fbf4cd275be2}")
private String appKey;
@Resource
private MpPaymentApi mpPaymentApi;
@Resource
private SysConfigManager sysConfigManager;
@Resource
private MailGunService mailGunService;
@ -257,7 +262,11 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
}
JSONObject apply = sysClientPreMapperMapper.findByUserName(username);
JSONObject subMerchantId = pmtSubMerchantIdMapper.randomOne();
JSONObject sysConfig = sysConfigManager.getSysConfig();
String arr [] = sysConfig.getString("temp_sub_mch_id").split(",");
String tempSubMerchantId = arr[new Random().nextInt(arr.length) + 1];
WeChatPayConfig.Merchant availableMerchant = mpPaymentApi.determineMerchant(tempSubMerchantId);
String clientMoniker = generateClientMoniker();
JSONObject sysClient = new JSONObject();
sysClient.put("company_name",apply.getString("company_name"));
@ -278,8 +287,8 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
sysClient.put("approve_result",2);
sysClient.put("creator",0);
sysClient.put("industry",331);
sysClient.put("merchant_id",subMerchantId.getString("merchant_id"));
sysClient.put("sub_merchant_id",subMerchantId.getString("sub_merchant_id"));
sysClient.put("merchant_id", availableMerchant.getMerchantId());
sysClient.put("sub_merchant_id",tempSubMerchantId);
sysClient.put("common_sub_merchant_id",1);
clientMapper.save(sysClient);
@ -316,12 +325,12 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
sysBank.put("branch",bankInfo.getString("branch"));
clientBankAccountMapper.save(sysBank);
JSONObject sysConfig = new JSONObject();
sysConfig.put("client_id",clientId);
sysConfig.put("client_moniker",clientMoniker);
sysConfig.put("clean_days",apply.getIntValue("clean_days"));
sysConfig.put("common_sub_merchant_id",1);
clientConfigMapper.save(sysConfig);
JSONObject clientConfig = new JSONObject();
clientConfig.put("client_id",clientId);
clientConfig.put("client_moniker",clientMoniker);
clientConfig.put("clean_days",apply.getIntValue("clean_days"));
clientConfig.put("common_sub_merchant_id",1);
clientConfigMapper.save(clientConfig);
JSONObject sysRate = new JSONObject();
sysRate.put("client_id",clientId);

Loading…
Cancel
Save