|
|
@ -49,6 +49,7 @@ import java.awt.image.BufferedImage;
|
|
|
|
import java.io.*;
|
|
|
|
import java.io.*;
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
import java.net.URISyntaxException;
|
|
|
|
import java.net.URISyntaxException;
|
|
|
|
|
|
|
|
import java.net.URLDecoder;
|
|
|
|
import java.util.*;
|
|
|
|
import java.util.*;
|
|
|
|
import java.util.concurrent.LinkedBlockingQueue;
|
|
|
|
import java.util.concurrent.LinkedBlockingQueue;
|
|
|
|
import java.util.concurrent.ThreadPoolExecutor;
|
|
|
|
import java.util.concurrent.ThreadPoolExecutor;
|
|
|
@ -405,10 +406,7 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
|
|
|
|
applyInfo.put("update_time", new Date());
|
|
|
|
applyInfo.put("update_time", new Date());
|
|
|
|
sysClientPreMapperMapper.update(applyInfo);
|
|
|
|
sysClientPreMapperMapper.update(applyInfo);
|
|
|
|
if (applyInfo.getBooleanValue("agree")) {
|
|
|
|
if (applyInfo.getBooleanValue("agree")) {
|
|
|
|
if(apply.getString("contract_url")==null|| !(StringUtils.equals(apply.getString("clean_days"),applyInfo.getString("clean_days"))) ) {
|
|
|
|
applyerToClient(username, null);
|
|
|
|
throw new BadRequestException("The date of liquidation has changed and the contract needs to be renewed");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
applyerToClient(username);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -518,10 +516,7 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
|
|
|
|
apply.put("clean_days", clean_days);
|
|
|
|
apply.put("clean_days", clean_days);
|
|
|
|
JSONObject sysConfig = sysConfigManager.getSysConfig();
|
|
|
|
JSONObject sysConfig = sysConfigManager.getSysConfig();
|
|
|
|
JSONObject test = JSONObject.parseObject(sysConfig.getString("sys_apply_rates"));
|
|
|
|
JSONObject test = JSONObject.parseObject(sysConfig.getString("sys_apply_rates"));
|
|
|
|
|
|
|
|
|
|
|
|
JSONObject rate = test.getJSONObject("t"+clean_days.trim());
|
|
|
|
JSONObject rate = test.getJSONObject("t"+clean_days.trim());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
apply.put("wechat_rate",rate.getString("Wechat"));
|
|
|
|
apply.put("wechat_rate",rate.getString("Wechat"));
|
|
|
|
apply.put("alipay_rate",rate.getString("Alipay"));
|
|
|
|
apply.put("alipay_rate",rate.getString("Alipay"));
|
|
|
|
apply.put("alipay_online_rate",rate.getString("AlipayOnline"));
|
|
|
|
apply.put("alipay_online_rate",rate.getString("AlipayOnline"));
|
|
|
@ -551,18 +546,18 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public JSONObject getClientAggregateFile(String username, MultipartFile file ,String clean_days) throws IOException{
|
|
|
|
public JSONObject getClientAggregateFile(String username, MultipartFile file ,String clean_days, JSONObject signInfo) throws IOException{
|
|
|
|
JSONObject apply = getPreApplyInfoForAggree(username ,clean_days);
|
|
|
|
JSONObject apply = getPreApplyInfoForAggree(username ,clean_days);
|
|
|
|
apply.put("full_name", file.getOriginalFilename());
|
|
|
|
apply.put("full_name", URLDecoder.decode(file.getOriginalFilename(),"UTF-8"));
|
|
|
|
BufferedImage img = ImageIO.read(file.getInputStream());
|
|
|
|
BufferedImage img = ImageIO.read(file.getInputStream());
|
|
|
|
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
|
|
|
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
|
|
|
ImageIO.write(img, "png", out);
|
|
|
|
ImageIO.write(img, "png", out);
|
|
|
|
apply.put("img","data:image/png;base64," + Base64.encodeBase64String(out.toByteArray()));
|
|
|
|
apply.put("img","data:image/png;base64," + Base64.encodeBase64String(out.toByteArray()));
|
|
|
|
|
|
|
|
|
|
|
|
return exportImgAggregateFile(username, apply);
|
|
|
|
return exportImgAggregateFile(username, apply, signInfo);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private JSONObject exportImgAggregateFile(String username, JSONObject apply) throws IOException{
|
|
|
|
private JSONObject exportImgAggregateFile(String username, JSONObject apply, JSONObject signInfo) throws IOException {
|
|
|
|
InputStream stream = null;
|
|
|
|
InputStream stream = null;
|
|
|
|
JSONObject contractInfo = new JSONObject();
|
|
|
|
JSONObject contractInfo = new JSONObject();
|
|
|
|
try {
|
|
|
|
try {
|
|
|
@ -575,17 +570,23 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
|
|
|
|
JSONObject fileInfo = attachmentClient.uploadFile(stream, username + "_" + System.currentTimeMillis() + "_agreement.pdf", false);
|
|
|
|
JSONObject fileInfo = attachmentClient.uploadFile(stream, username + "_" + System.currentTimeMillis() + "_agreement.pdf", false);
|
|
|
|
|
|
|
|
|
|
|
|
contractInfo.put("contract_url", fileInfo.getString("url"));
|
|
|
|
contractInfo.put("contract_url", fileInfo.getString("url"));
|
|
|
|
|
|
|
|
apply.put("contract_url", contractInfo.getString("contract_url"));
|
|
|
|
|
|
|
|
signInfo.put("contract_url", contractInfo.getString("contract_url"));
|
|
|
|
|
|
|
|
apply.put("agree", true);
|
|
|
|
|
|
|
|
apply.put("update_time", new Date());
|
|
|
|
|
|
|
|
sysClientPreMapperMapper.update(apply);
|
|
|
|
} catch (Exception e) {
|
|
|
|
} catch (Exception e) {
|
|
|
|
logger.error("合同制作出现问题:", e);
|
|
|
|
logger.error("合同制作出现问题:", e);
|
|
|
|
throw new BadRequestException("合同制作出现问题:" + e.getMessage());
|
|
|
|
throw new BadRequestException("合同制作出现问题:" + e.getMessage());
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
|
stream.close();
|
|
|
|
stream.close();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
applyerToClient(apply.getString("username"), signInfo);
|
|
|
|
return contractInfo;
|
|
|
|
return contractInfo;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//todo
|
|
|
|
//todo
|
|
|
|
private void applyerToClient(String username) {
|
|
|
|
private void applyerToClient(String username, JSONObject signInfo) {
|
|
|
|
JSONObject sysConfig = sysConfigManager.getSysConfig();
|
|
|
|
JSONObject sysConfig = sysConfigManager.getSysConfig();
|
|
|
|
String arr[] = sysConfig.getString("temp_sub_mch_id").split(",");
|
|
|
|
String arr[] = sysConfig.getString("temp_sub_mch_id").split(",");
|
|
|
|
List<String> availableMerchants = WechatPayEnvironment.getEnv().getWechatMerchantConfigs().stream()
|
|
|
|
List<String> availableMerchants = WechatPayEnvironment.getEnv().getWechatMerchantConfigs().stream()
|
|
|
@ -612,9 +613,7 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
|
|
|
|
throw new ForbiddenException("The user name has been registered");
|
|
|
|
throw new ForbiddenException("The user name has been registered");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
String clientMoniker = generateClientMoniker();
|
|
|
|
String clientMoniker = generateClientMoniker();
|
|
|
|
|
|
|
|
|
|
|
|
JSONObject sysClient = new JSONObject();
|
|
|
|
JSONObject sysClient = new JSONObject();
|
|
|
|
|
|
|
|
|
|
|
|
JSONObject followBd = managerMapper.findByLoginId("customerservice");
|
|
|
|
JSONObject followBd = managerMapper.findByLoginId("customerservice");
|
|
|
|
|
|
|
|
|
|
|
|
sysClient.put("bd_user", followBd.getString("manager_id"));
|
|
|
|
sysClient.put("bd_user", followBd.getString("manager_id"));
|
|
|
@ -626,14 +625,15 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
|
|
|
|
sysClient.put("suburb", apply.getString("suburb"));
|
|
|
|
sysClient.put("suburb", apply.getString("suburb"));
|
|
|
|
sysClient.put("state", apply.getString("state"));
|
|
|
|
sysClient.put("state", apply.getString("state"));
|
|
|
|
sysClient.put("postcode", apply.getString("postcode"));
|
|
|
|
sysClient.put("postcode", apply.getString("postcode"));
|
|
|
|
sysClient.put("royalpayindustry", apply.getString("royalpayindustry"));
|
|
|
|
sysClient.put("royalpayindustry", apply.getString("industry"));
|
|
|
|
sysClient.put("alipayindustry", apply.getString("alipayindustry"));
|
|
|
|
sysClient.put("alipayindustry", apply.getString("alipayindustry"));
|
|
|
|
sysClient.put("industry", apply.getString("industry"));//微信支付行业
|
|
|
|
sysClient.put("industry", apply.getString("wechatindustry"));
|
|
|
|
sysClient.put("contact_person", apply.getString("contact_person"));
|
|
|
|
sysClient.put("contact_person", apply.getString("contact_person"));
|
|
|
|
sysClient.put("contact_job", apply.getString("contact_job"));
|
|
|
|
sysClient.put("contact_job", apply.getString("contact_job"));
|
|
|
|
sysClient.put("logo_url", apply.getString("logo_url"));
|
|
|
|
sysClient.put("logo_url", apply.getString("logo_url"));
|
|
|
|
sysClient.put("company_website", apply.getString("company_website"));
|
|
|
|
sysClient.put("company_website", apply.getString("company_website"));
|
|
|
|
sysClient.put("company_photo", apply.getString("company_photo"));
|
|
|
|
sysClient.put("company_photo", apply.getString("company_photo"));
|
|
|
|
|
|
|
|
sysClient.put("store_photo", apply.getString("store_photo"));
|
|
|
|
sysClient.put("contact_email", apply.getString("contact_email"));
|
|
|
|
sysClient.put("contact_email", apply.getString("contact_email"));
|
|
|
|
sysClient.put("contact_phone", "+61" + apply.getString("contact_phone"));
|
|
|
|
sysClient.put("contact_phone", "+61" + apply.getString("contact_phone"));
|
|
|
|
sysClient.put("company_phone", apply.getString("company_phone"));
|
|
|
|
sysClient.put("company_phone", apply.getString("company_phone"));
|
|
|
@ -654,19 +654,9 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
|
|
|
|
sysClient.put("country", "AUS");
|
|
|
|
sysClient.put("country", "AUS");
|
|
|
|
sysClient.put("credential_code", RandomStringUtils.random(32, true, true));
|
|
|
|
sysClient.put("credential_code", RandomStringUtils.random(32, true, true));
|
|
|
|
sysClient.put("ali_sub_merchant_id", clientMoniker);
|
|
|
|
sysClient.put("ali_sub_merchant_id", clientMoniker);
|
|
|
|
|
|
|
|
sysClient.put("enable_wechat", 1);
|
|
|
|
clientMapper.save(sysClient);
|
|
|
|
clientMapper.save(sysClient);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
JSONObject fileJson = new JSONObject();
|
|
|
|
|
|
|
|
fileJson.put("client_id", sysClient.getString("client_id"));
|
|
|
|
|
|
|
|
fileJson.put("last_update_date", new Date());
|
|
|
|
|
|
|
|
//fileJson.put("last_update_by", manager.getString("display_name"));
|
|
|
|
|
|
|
|
fileJson.put("file_name", CLIENT_AGREE_FILE);
|
|
|
|
|
|
|
|
fileJson.put("file_value", apply.getString("contract_url"));
|
|
|
|
|
|
|
|
fileJson.put("status", 0);
|
|
|
|
|
|
|
|
fileJson.put("is_valid", 1);
|
|
|
|
|
|
|
|
clientFilesMapper.save(fileJson);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
JSONObject representativeInfo = new JSONObject();
|
|
|
|
JSONObject representativeInfo = new JSONObject();
|
|
|
|
representativeInfo.put("client_id", sysClient.getIntValue("client_id"));
|
|
|
|
representativeInfo.put("client_id", sysClient.getIntValue("client_id"));
|
|
|
|
representativeInfo.put("representative_person", apply.getString("representative_person"));
|
|
|
|
representativeInfo.put("representative_person", apply.getString("representative_person"));
|
|
|
@ -706,6 +696,22 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
|
|
|
|
sysAccount.put("nation_code", "+61");
|
|
|
|
sysAccount.put("nation_code", "+61");
|
|
|
|
clientAccountMapper.save(sysAccount);
|
|
|
|
clientAccountMapper.save(sysAccount);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (signInfo != null) {
|
|
|
|
|
|
|
|
JSONObject fileJson = new JSONObject();
|
|
|
|
|
|
|
|
fileJson.put("client_id", sysClient.getString("client_id"));
|
|
|
|
|
|
|
|
fileJson.put("last_update_date", new Date());
|
|
|
|
|
|
|
|
//fileJson.put("last_update_by", manager.getString("display_name"));
|
|
|
|
|
|
|
|
fileJson.put("file_name", CLIENT_AGREE_FILE);
|
|
|
|
|
|
|
|
fileJson.put("file_value", signInfo.getString("contract_url"));
|
|
|
|
|
|
|
|
fileJson.put("status", 1);
|
|
|
|
|
|
|
|
fileJson.put("signature_time", new Date());
|
|
|
|
|
|
|
|
fileJson.put("signature_ip", signInfo.getString("signature_ip"));
|
|
|
|
|
|
|
|
fileJson.put("user_agent", signInfo.getString("user_agent"));
|
|
|
|
|
|
|
|
fileJson.put("signature_account_id", sysAccount.getString("account_id"));
|
|
|
|
|
|
|
|
fileJson.put("is_valid", 1);
|
|
|
|
|
|
|
|
clientFilesMapper.save(fileJson);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
JSONObject sysBank = new JSONObject();
|
|
|
|
JSONObject sysBank = new JSONObject();
|
|
|
|
sysBank.put("client_id", clientId);
|
|
|
|
sysBank.put("client_id", clientId);
|
|
|
|
sysBank.put("account_no", apply.getString("bank_no"));
|
|
|
|
sysBank.put("account_no", apply.getString("bank_no"));
|
|
|
@ -724,6 +730,7 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
|
|
|
|
JSONObject clientConfig = new JSONObject();
|
|
|
|
JSONObject clientConfig = new JSONObject();
|
|
|
|
clientConfig.put("client_id", clientId);
|
|
|
|
clientConfig.put("client_id", clientId);
|
|
|
|
clientConfig.put("skip_clearing", 1);
|
|
|
|
clientConfig.put("skip_clearing", 1);
|
|
|
|
|
|
|
|
clientConfig.put("enable_wechat", 1);
|
|
|
|
clientConfig.put("client_moniker", clientMoniker);
|
|
|
|
clientConfig.put("client_moniker", clientMoniker);
|
|
|
|
clientConfig.put("clean_days", apply.getIntValue("clean_days"));
|
|
|
|
clientConfig.put("clean_days", apply.getIntValue("clean_days"));
|
|
|
|
clientConfig.put("common_sub_merchant_id", 1);
|
|
|
|
clientConfig.put("common_sub_merchant_id", 1);
|
|
|
@ -765,10 +772,16 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
|
|
|
|
configNewClientRate(sysRate, clientId, "AlipayOnline", "AlipayOnline");
|
|
|
|
configNewClientRate(sysRate, clientId, "AlipayOnline", "AlipayOnline");
|
|
|
|
configNewClientRate(sysRate, clientId, "Bestpay", "Bestpay");
|
|
|
|
configNewClientRate(sysRate, clientId, "Bestpay", "Bestpay");
|
|
|
|
configNewClientRate(sysRate, clientId, "jd", "JDpay");
|
|
|
|
configNewClientRate(sysRate, clientId, "jd", "JDpay");
|
|
|
|
|
|
|
|
configNewClientRate(sysRate, clientId, "CB_BankPay", "CB_Bankpay");
|
|
|
|
Runnable task2 = () -> {
|
|
|
|
Runnable task2 = () -> {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
|
|
|
|
if (signInfo != null) {
|
|
|
|
|
|
|
|
clientManager.registerClientApplyGMS(clientMoniker, sysAccount.getString("account_id"));
|
|
|
|
|
|
|
|
}else {
|
|
|
|
clientManager.getNewAggregateAgreeFile(clientMoniker, null, true);
|
|
|
|
clientManager.getNewAggregateAgreeFile(clientMoniker, null, true);
|
|
|
|
|
|
|
|
}
|
|
|
|
} catch (Exception ignore) {
|
|
|
|
} catch (Exception ignore) {
|
|
|
|
|
|
|
|
logger.error("{}自助申请成功,支付宝报备失败:{}",clientMoniker,ignore);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
pool.execute(task2);
|
|
|
|
pool.execute(task2);
|
|
|
|