|
|
@ -37,6 +37,7 @@ import au.com.royalpay.payment.tools.exceptions.ServerErrorException;
|
|
|
|
import au.com.royalpay.payment.tools.http.HttpUtils;
|
|
|
|
import au.com.royalpay.payment.tools.http.HttpUtils;
|
|
|
|
import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider;
|
|
|
|
import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider;
|
|
|
|
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
|
|
|
|
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
|
|
|
|
|
|
|
|
import au.com.royalpay.payment.tools.scheduler.SynchronizedScheduler;
|
|
|
|
import au.com.royalpay.payment.tools.utils.PdfUtils;
|
|
|
|
import au.com.royalpay.payment.tools.utils.PdfUtils;
|
|
|
|
import au.com.royalpay.payment.tools.utils.TimeZoneUtils;
|
|
|
|
import au.com.royalpay.payment.tools.utils.TimeZoneUtils;
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
@ -77,6 +78,8 @@ import java.util.Optional;
|
|
|
|
public class TestController {
|
|
|
|
public class TestController {
|
|
|
|
private final Logger logger = LoggerFactory.getLogger(getClass());
|
|
|
|
private final Logger logger = LoggerFactory.getLogger(getClass());
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private SynchronizedScheduler synchronizedScheduler;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
private OrderMapper orderMapper;
|
|
|
|
private OrderMapper orderMapper;
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private RefundMapper refundMapper;
|
|
|
|
private RefundMapper refundMapper;
|
|
|
@ -178,7 +181,8 @@ public class TestController {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 第二个版本的合同
|
|
|
|
* 第二个版本的合同
|
|
|
|
|
|
|
|
*
|
|
|
|
* @param clientMoniker
|
|
|
|
* @param clientMoniker
|
|
|
|
* @param manager
|
|
|
|
* @param manager
|
|
|
|
* @param httpResponse
|
|
|
|
* @param httpResponse
|
|
|
@ -186,95 +190,95 @@ public class TestController {
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@ManagerMapping(value = "/{clientMoniker}/export/aggregate/agreepdf", method = RequestMethod.GET, role = {ManagerRole.ADMIN, ManagerRole.DIRECTOR, ManagerRole.OPERATOR})
|
|
|
|
@ManagerMapping(value = "/{clientMoniker}/export/aggregate/agreepdf", method = RequestMethod.GET, role = {ManagerRole.ADMIN, ManagerRole.DIRECTOR, ManagerRole.OPERATOR})
|
|
|
|
public void exportAggregateAgreeFile(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, HttpServletResponse httpResponse) {
|
|
|
|
public void exportAggregateAgreeFile(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, HttpServletResponse httpResponse) {
|
|
|
|
logger.info("===>exportAggregateAgreeFile:path:"+aggragatePdfPath);
|
|
|
|
logger.info("===>exportAggregateAgreeFile:path:" + aggragatePdfPath);
|
|
|
|
|
|
|
|
|
|
|
|
httpResponse.setContentType("application/pdf");
|
|
|
|
httpResponse.setContentType("application/pdf");
|
|
|
|
httpResponse.setHeader("content-disposition", "attachment;filename=" + clientMoniker + "_AGREEMENT_" + new Date() + ".pdf");
|
|
|
|
httpResponse.setHeader("content-disposition", "attachment;filename=" + clientMoniker + "_AGREEMENT_" + new Date() + ".pdf");
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
ServletOutputStream sos = httpResponse.getOutputStream();
|
|
|
|
ServletOutputStream sos = httpResponse.getOutputStream();
|
|
|
|
|
|
|
|
|
|
|
|
JSONObject client = clientMapper.findClientByMoniker(clientMoniker);
|
|
|
|
JSONObject client = clientMapper.findClientByMoniker(clientMoniker);
|
|
|
|
if (client == null) {
|
|
|
|
if (client == null) {
|
|
|
|
throw new InvalidShortIdException();
|
|
|
|
throw new InvalidShortIdException();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
String address = client.getString("address").trim();
|
|
|
|
String address = client.getString("address").trim();
|
|
|
|
if (address.contains(",")) {
|
|
|
|
if (address.contains(",")) {
|
|
|
|
client.put("address", address.substring(0, address.lastIndexOf(",")).trim());
|
|
|
|
client.put("address", address.substring(0, address.lastIndexOf(",")).trim());
|
|
|
|
client.put("address_sub", address.substring(address.lastIndexOf(",") + 1).trim());
|
|
|
|
client.put("address_sub", address.substring(address.lastIndexOf(",") + 1).trim());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (client.getString("acn") != null && !client.getString("acn").equals("")) {
|
|
|
|
if (client.getString("acn") != null && !client.getString("acn").equals("")) {
|
|
|
|
client.put("acn_type", "ACN: (" + client.getString("acn") + ")");
|
|
|
|
client.put("acn_type", "ACN: (" + client.getString("acn") + ")");
|
|
|
|
client.put("company_name_acn", client.getString("company_name") + " (ACN " + client.getString("acn") + ")");
|
|
|
|
client.put("company_name_acn", client.getString("company_name") + " (ACN " + client.getString("acn") + ")");
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
client.put("acn_type", "ABN: (" + client.getString("abn") + ")");
|
|
|
|
client.put("acn_type", "ABN: (" + client.getString("abn") + ")");
|
|
|
|
client.put("company_name_acn", client.getString("company_name") + " (ABN " + client.getString("abn") + ")");
|
|
|
|
client.put("company_name_acn", client.getString("company_name") + " (ABN " + client.getString("abn") + ")");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
JSONObject weChatRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "Wechat");
|
|
|
|
JSONObject weChatRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "Wechat");
|
|
|
|
if (weChatRate == null) {
|
|
|
|
if (weChatRate == null) {
|
|
|
|
throw new BadRequestException("The Partner's Rate is not config!");
|
|
|
|
throw new BadRequestException("The Partner's Rate is not config!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
client.put("wechat_rate", weChatRate.getBigDecimal("rate_value").setScale(2, RoundingMode.DOWN));
|
|
|
|
client.put("wechat_rate", weChatRate.getBigDecimal("rate_value").setScale(2, RoundingMode.DOWN));
|
|
|
|
client.put("clean", "T+"+weChatRate.getString("clean_days"));
|
|
|
|
client.put("clean", "T+" + weChatRate.getString("clean_days"));
|
|
|
|
client.put("clean_days", weChatRate.getString("clean_days"));
|
|
|
|
client.put("clean_days", weChatRate.getString("clean_days"));
|
|
|
|
client.put("located_country", "Australia");
|
|
|
|
client.put("located_country", "Australia");
|
|
|
|
if("1".equalsIgnoreCase(weChatRate.getString("clean_days"))){
|
|
|
|
if ("1".equalsIgnoreCase(weChatRate.getString("clean_days"))) {
|
|
|
|
// clean_1 clean_1_friday clean_1_saturday
|
|
|
|
// clean_1 clean_1_friday clean_1_saturday
|
|
|
|
// second, third or fourth
|
|
|
|
// second, third or fourth
|
|
|
|
client.put("clean_1", weChatRate.getString("clean_days"));
|
|
|
|
client.put("clean_1", weChatRate.getString("clean_days"));
|
|
|
|
client.put("clean_1_friday", "first");
|
|
|
|
client.put("clean_1_friday", "first");
|
|
|
|
client.put("clean_1_saturday", "second");
|
|
|
|
client.put("clean_1_saturday", "second");
|
|
|
|
}else if("2".equalsIgnoreCase(weChatRate.getString("clean_days"))){
|
|
|
|
} else if ("2".equalsIgnoreCase(weChatRate.getString("clean_days"))) {
|
|
|
|
client.put("clean_1", weChatRate.getString("clean_days"));
|
|
|
|
client.put("clean_1", weChatRate.getString("clean_days"));
|
|
|
|
client.put("clean_1_friday", "second");
|
|
|
|
client.put("clean_1_friday", "second");
|
|
|
|
client.put("clean_1_saturday", "third");
|
|
|
|
client.put("clean_1_saturday", "third");
|
|
|
|
|
|
|
|
|
|
|
|
}else if("3".equalsIgnoreCase(weChatRate.getString("clean_days"))){
|
|
|
|
} else if ("3".equalsIgnoreCase(weChatRate.getString("clean_days"))) {
|
|
|
|
client.put("clean_1", weChatRate.getString("clean_days"));
|
|
|
|
client.put("clean_1", weChatRate.getString("clean_days"));
|
|
|
|
client.put("clean_1_friday", "third");
|
|
|
|
client.put("clean_1_friday", "third");
|
|
|
|
client.put("clean_1_saturday", "fourth");
|
|
|
|
client.put("clean_1_saturday", "fourth");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
JSONObject alipayRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "Alipay");
|
|
|
|
|
|
|
|
if (alipayRate != null) {
|
|
|
|
|
|
|
|
client.put("alipay_rate", alipayRate.getBigDecimal("rate_value").setScale(2, RoundingMode.DOWN));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
JSONObject alipayOnlineRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "AlipayOnline");
|
|
|
|
|
|
|
|
if (alipayOnlineRate != null) {
|
|
|
|
try {
|
|
|
|
client.put("alipay_online_rate", alipayOnlineRate.getBigDecimal("rate_value").setScale(2, RoundingMode.DOWN));
|
|
|
|
JSONObject alipayRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "Alipay");
|
|
|
|
|
|
|
|
if (alipayRate != null) {
|
|
|
|
|
|
|
|
client.put("alipay_rate", alipayRate.getBigDecimal("rate_value").setScale(2, RoundingMode.DOWN));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
JSONObject alipayOnlineRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "AlipayOnline");
|
|
|
|
|
|
|
|
if (alipayOnlineRate != null) {
|
|
|
|
|
|
|
|
client.put("alipay_online_rate", alipayOnlineRate.getBigDecimal("rate_value").setScale(2, RoundingMode.DOWN));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} catch (Exception ignored) {
|
|
|
|
|
|
|
|
//do nothing
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (Exception ignored) {
|
|
|
|
|
|
|
|
//do nothing
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
JSONObject account = getBankAccountByClientId(client.getIntValue("client_id"));
|
|
|
|
JSONObject account = getBankAccountByClientId(client.getIntValue("client_id"));
|
|
|
|
if (account == null || account.size() <= 0) {
|
|
|
|
if (account == null || account.size() <= 0) {
|
|
|
|
throw new BadRequestException("The Partner's Account is not config!");
|
|
|
|
throw new BadRequestException("The Partner's Account is not config!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
client.put("bank", account.getString("bank"));
|
|
|
|
client.put("bank", account.getString("bank"));
|
|
|
|
client.put("bsb_no", account.getString("bsb_no"));
|
|
|
|
client.put("bsb_no", account.getString("bsb_no"));
|
|
|
|
client.put("account_no", account.getString("account_no"));
|
|
|
|
client.put("account_no", account.getString("account_no"));
|
|
|
|
client.put("account_name", account.getString("account_name"));
|
|
|
|
client.put("account_name", account.getString("account_name"));
|
|
|
|
String start_date = DateFormatUtils.format(new Date(), "dd/MM/yyyy");
|
|
|
|
String start_date = DateFormatUtils.format(new Date(), "dd/MM/yyyy");
|
|
|
|
client.put("start_date", start_date);
|
|
|
|
client.put("start_date", start_date);
|
|
|
|
Date endDate = TimeZoneUtils.nextYearByCurrDay();
|
|
|
|
Date endDate = TimeZoneUtils.nextYearByCurrDay();
|
|
|
|
String end_date = DateFormatUtils.format(endDate, "dd/MM/yyyy");
|
|
|
|
String end_date = DateFormatUtils.format(endDate, "dd/MM/yyyy");
|
|
|
|
client.put("end_date", end_date);
|
|
|
|
client.put("end_date", end_date);
|
|
|
|
JSONObject clientLegal = sysClientLegalPersonMapper.findRepresentativeInfo(client.getIntValue("client_id"));
|
|
|
|
JSONObject clientLegal = sysClientLegalPersonMapper.findRepresentativeInfo(client.getIntValue("client_id"));
|
|
|
|
if (clientLegal != null) {
|
|
|
|
if (clientLegal != null) {
|
|
|
|
client.put("legal_person", clientLegal.getString("representative_person"));
|
|
|
|
client.put("legal_person", clientLegal.getString("representative_person"));
|
|
|
|
client.put("legal_job_title", clientLegal.getString("job_title"));
|
|
|
|
client.put("legal_job_title", clientLegal.getString("job_title"));
|
|
|
|
client.put("legal_phone", clientLegal.getString("phone"));
|
|
|
|
client.put("legal_phone", clientLegal.getString("phone"));
|
|
|
|
client.put("legal_email", clientLegal.getString("email"));
|
|
|
|
client.put("legal_email", clientLegal.getString("email"));
|
|
|
|
client.put("client_contract_manager", clientLegal.getString("representative_person"));//client contract manager
|
|
|
|
client.put("client_contract_manager", clientLegal.getString("representative_person"));//client contract manager
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
PdfUtils pdu = new PdfUtils();
|
|
|
|
PdfUtils pdu = new PdfUtils();
|
|
|
|
pdu.setTemplatePdfPath(aggragatePdfPath);
|
|
|
|
pdu.setTemplatePdfPath(aggragatePdfPath);
|
|
|
|
pdu.setPdfTemplate(client);
|
|
|
|
pdu.setPdfTemplate(client);
|
|
|
|
File file = new File(clientMoniker + "_agreement.pdf");
|
|
|
|
File file = new File(clientMoniker + "_agreement.pdf");
|
|
|
|
|
|
|
|
|
|
|
|
ByteArrayOutputStream bos = pdu.templetPdfBos(file);
|
|
|
|
ByteArrayOutputStream bos = pdu.templetPdfBos(file);
|
|
|
|
|
|
|
|
|
|
|
@ -285,6 +289,7 @@ public class TestController {
|
|
|
|
e.printStackTrace();
|
|
|
|
e.printStackTrace();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 制作卡支付合同
|
|
|
|
* 制作卡支付合同
|
|
|
|
*
|
|
|
|
*
|
|
|
@ -464,8 +469,15 @@ public class TestController {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@GetMapping(value = "/task/analysisDashboard")
|
|
|
|
@GetMapping(value = "/task/analysisDashboard")
|
|
|
|
public void analysisDashboard(@RequestParam("date") String date) throws ParseException {
|
|
|
|
public void analysisDashboard(@RequestParam("date") String date) {
|
|
|
|
dashboardService.generateCustomersAndOrdersStatistics(DateUtils.parseDate(date, "yyyyMMdd"));
|
|
|
|
synchronizedScheduler.executeProcess("manage_task:dashboardTask", 120_000,
|
|
|
|
|
|
|
|
() -> {
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
dashboardService.generateCustomersAndOrdersStatistics(DateUtils.parseDate(date, "yyyyMMdd"));
|
|
|
|
|
|
|
|
} catch (ParseException e) {
|
|
|
|
|
|
|
|
logger.error("invalid input date:{}", date);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -567,70 +579,69 @@ public class TestController {
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 批量更新微信子商户号
|
|
|
|
* 批量更新微信子商户号
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@ManagerMapping(value = "/batch_update_wxsubmerchantId", method = RequestMethod.GET, role = {ManagerRole.ADMIN, ManagerRole.DIRECTOR, ManagerRole.OPERATOR, ManagerRole.DEVELOPER})
|
|
|
|
@ManagerMapping(value = "/batch_update_wxsubmerchantId", method = RequestMethod.GET, role = {ManagerRole.ADMIN, ManagerRole.DIRECTOR, ManagerRole.OPERATOR, ManagerRole.DEVELOPER})
|
|
|
|
public void batchUpdateWxSubmerchantId() {
|
|
|
|
public void batchUpdateWxSubmerchantId() {
|
|
|
|
List<JSONObject> findSubMerchantIdHistorys=sysWxMerchantApplyMapper.findSubMerchantIdHistorys();
|
|
|
|
List<JSONObject> findSubMerchantIdHistorys = sysWxMerchantApplyMapper.findSubMerchantIdHistorys();
|
|
|
|
if(findSubMerchantIdHistorys==null)return;
|
|
|
|
if (findSubMerchantIdHistorys == null) return;
|
|
|
|
logger.info("=========>batchUpdateWxSubmerchantId:"+findSubMerchantIdHistorys.size());
|
|
|
|
logger.info("=========>batchUpdateWxSubmerchantId:" + findSubMerchantIdHistorys.size());
|
|
|
|
findSubMerchantIdHistorys.parallelStream().forEach(jsonObject -> {
|
|
|
|
findSubMerchantIdHistorys.parallelStream().forEach(jsonObject -> {
|
|
|
|
JSONObject clientJson = clientMapper.findClient(jsonObject.getInteger("client_id"));
|
|
|
|
JSONObject clientJson = clientMapper.findClient(jsonObject.getInteger("client_id"));
|
|
|
|
JSONObject wechatMcc = paymentChannelMccGoodMapper.findWechatPayMccByClientId(jsonObject.getIntValue("client_id"));
|
|
|
|
JSONObject wechatMcc = paymentChannelMccGoodMapper.findWechatPayMccByClientId(jsonObject.getIntValue("client_id"));
|
|
|
|
JSONObject clientConfig = clientConfigMapper.find(jsonObject.getIntValue("client_id"));
|
|
|
|
JSONObject clientConfig = clientConfigMapper.find(jsonObject.getIntValue("client_id"));
|
|
|
|
if(clientJson==null){
|
|
|
|
if (clientJson == null) {
|
|
|
|
logger.info("=========>没有查询到client:"+jsonObject.getInteger("client_id"));
|
|
|
|
logger.info("=========>没有查询到client:" + jsonObject.getInteger("client_id"));
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(wechatMcc==null){
|
|
|
|
if (wechatMcc == null) {
|
|
|
|
logger.info("=========>没有查询到mcc:"+jsonObject.getInteger("client_id"));
|
|
|
|
logger.info("=========>没有查询到mcc:" + jsonObject.getInteger("client_id"));
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// company_name short_name industry company_phone contact_person contact_phone contact_email 这些字段不能为空
|
|
|
|
// company_name short_name industry company_phone contact_person contact_phone contact_email 这些字段不能为空
|
|
|
|
if(TextUtils.isEmpty(clientJson.getString("short_name"))||
|
|
|
|
if (TextUtils.isEmpty(clientJson.getString("short_name")) ||
|
|
|
|
TextUtils.isEmpty(clientJson.getString("industry"))||
|
|
|
|
TextUtils.isEmpty(clientJson.getString("industry")) ||
|
|
|
|
TextUtils.isEmpty(clientJson.getString("company_phone"))||
|
|
|
|
TextUtils.isEmpty(clientJson.getString("company_phone")) ||
|
|
|
|
TextUtils.isEmpty(clientJson.getString("contact_phone"))||
|
|
|
|
TextUtils.isEmpty(clientJson.getString("contact_phone")) ||
|
|
|
|
TextUtils.isEmpty(clientJson.getString("contact_person"))||
|
|
|
|
TextUtils.isEmpty(clientJson.getString("contact_person")) ||
|
|
|
|
TextUtils.isEmpty(clientJson.getString("contact_email"))||
|
|
|
|
TextUtils.isEmpty(clientJson.getString("contact_email")) ||
|
|
|
|
TextUtils.isEmpty(wechatMcc.getString("mc_code"))){
|
|
|
|
TextUtils.isEmpty(wechatMcc.getString("mc_code"))) {
|
|
|
|
logger.error("=======>数据不完整:clientid:"+jsonObject.getInteger("client_id")+"");
|
|
|
|
logger.error("=======>数据不完整:clientid:" + jsonObject.getInteger("client_id") + "");
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
NewSubMerchantIdApply newSubMerchantIdApply=new NewSubMerchantIdApply();
|
|
|
|
NewSubMerchantIdApply newSubMerchantIdApply = new NewSubMerchantIdApply();
|
|
|
|
newSubMerchantIdApply.setMerchant_id(jsonObject.getString("merchant_id"));
|
|
|
|
newSubMerchantIdApply.setMerchant_id(jsonObject.getString("merchant_id"));
|
|
|
|
newSubMerchantIdApply.setSub_mch_id(jsonObject.getString("sub_merchant_id"));
|
|
|
|
newSubMerchantIdApply.setSub_mch_id(jsonObject.getString("sub_merchant_id"));
|
|
|
|
newSubMerchantIdApply.setMerchantRemark(jsonObject.getString("merchant_remark"));
|
|
|
|
newSubMerchantIdApply.setMerchantRemark(jsonObject.getString("merchant_remark"));
|
|
|
|
newSubMerchantIdApply.setMerchant_name(cutLength(jsonObject.getString("merchant_name"),50));
|
|
|
|
newSubMerchantIdApply.setMerchant_name(cutLength(jsonObject.getString("merchant_name"), 50));
|
|
|
|
newSubMerchantIdApply.setAddress(cutLength(clientJson.getString("address"),128));
|
|
|
|
newSubMerchantIdApply.setAddress(cutLength(clientJson.getString("address"), 128));
|
|
|
|
newSubMerchantIdApply.setMerchant_shortname(cutLength(clientJson.getString("short_name"),64));
|
|
|
|
newSubMerchantIdApply.setMerchant_shortname(cutLength(clientJson.getString("short_name"), 64));
|
|
|
|
newSubMerchantIdApply.setBusiness_category(clientJson.getString("industry"));
|
|
|
|
newSubMerchantIdApply.setBusiness_category(clientJson.getString("industry"));
|
|
|
|
newSubMerchantIdApply.setWebsite(cutLength(clientJson.getString("company_website"),100));
|
|
|
|
newSubMerchantIdApply.setWebsite(cutLength(clientJson.getString("company_website"), 100));
|
|
|
|
newSubMerchantIdApply.setOffice_phone(cutLength(clientJson.getString("company_phone"),20));
|
|
|
|
newSubMerchantIdApply.setOffice_phone(cutLength(clientJson.getString("company_phone"), 20));
|
|
|
|
newSubMerchantIdApply.setContact_phone(cutLength(clientJson.getString("contact_phone"),16));
|
|
|
|
newSubMerchantIdApply.setContact_phone(cutLength(clientJson.getString("contact_phone"), 16));
|
|
|
|
newSubMerchantIdApply.setContact_name(cutLength(clientJson.getString("contact_person"),32));
|
|
|
|
newSubMerchantIdApply.setContact_name(cutLength(clientJson.getString("contact_person"), 32));
|
|
|
|
newSubMerchantIdApply.setContact_email(cutLength(clientJson.getString("contact_email"),50));
|
|
|
|
newSubMerchantIdApply.setContact_email(cutLength(clientJson.getString("contact_email"), 50));
|
|
|
|
newSubMerchantIdApply.setMcc_code(cutLength(wechatMcc.getString("mc_code"),10));
|
|
|
|
newSubMerchantIdApply.setMcc_code(cutLength(wechatMcc.getString("mc_code"), 10));
|
|
|
|
|
|
|
|
|
|
|
|
if(!TextUtils.isEmpty(clientConfig.getString("client_pay_type"))){
|
|
|
|
if (!TextUtils.isEmpty(clientConfig.getString("client_pay_type"))) {
|
|
|
|
if(clientConfig.getString("client_pay_type").indexOf("1")>=0
|
|
|
|
if (clientConfig.getString("client_pay_type").indexOf("1") >= 0
|
|
|
|
&&clientConfig.getString("client_pay_type").indexOf("2")>=0){
|
|
|
|
&& clientConfig.getString("client_pay_type").indexOf("2") >= 0) {
|
|
|
|
newSubMerchantIdApply.setBusiness_type("BOTH");
|
|
|
|
newSubMerchantIdApply.setBusiness_type("BOTH");
|
|
|
|
}else if(clientConfig.getString("client_pay_type").indexOf("1")>=0){
|
|
|
|
} else if (clientConfig.getString("client_pay_type").indexOf("1") >= 0) {
|
|
|
|
newSubMerchantIdApply.setBusiness_type("ONLINE");
|
|
|
|
newSubMerchantIdApply.setBusiness_type("ONLINE");
|
|
|
|
}
|
|
|
|
} else if (clientConfig.getString("client_pay_type").indexOf("2") >= 0) {
|
|
|
|
else if(clientConfig.getString("client_pay_type").indexOf("2")>=0){
|
|
|
|
|
|
|
|
newSubMerchantIdApply.setBusiness_type("OFFLINE");
|
|
|
|
newSubMerchantIdApply.setBusiness_type("OFFLINE");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
} else {
|
|
|
|
newSubMerchantIdApply.setBusiness_type("BOTH");
|
|
|
|
newSubMerchantIdApply.setBusiness_type("BOTH");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!TextUtils.isEmpty(clientJson.getString("business_structure"))) {
|
|
|
|
if (!TextUtils.isEmpty(clientJson.getString("business_structure"))) {
|
|
|
|
newSubMerchantIdApply.setMerchant_type(clientJson.getString("business_structure").equals("Registered body(Sole Trader)")?"INDIVIDUAL":"ENTERPRISE") ;
|
|
|
|
newSubMerchantIdApply.setMerchant_type(clientJson.getString("business_structure").equals("Registered body(Sole Trader)") ? "INDIVIDUAL" : "ENTERPRISE");
|
|
|
|
}else{
|
|
|
|
} else {
|
|
|
|
newSubMerchantIdApply.setMerchant_type("INDIVIDUAL") ;
|
|
|
|
newSubMerchantIdApply.setMerchant_type("INDIVIDUAL");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
newSubMerchantIdApply.setCompany_register_no(cutLength(TextUtils.isEmpty(clientJson.getString("acn"))?clientJson.getString("abn"):clientJson.getString("acn"),50));
|
|
|
|
newSubMerchantIdApply.setCompany_register_no(cutLength(TextUtils.isEmpty(clientJson.getString("acn")) ? clientJson.getString("abn") : clientJson.getString("acn"), 50));
|
|
|
|
if (!TextUtils.isEmpty(clientJson.getString("certificat_expire_date"))) {
|
|
|
|
if (!TextUtils.isEmpty(clientJson.getString("certificat_expire_date"))) {
|
|
|
|
newSubMerchantIdApply.setCertificat_expire_date(clientJson.getString("certificat_expire_date"));
|
|
|
|
newSubMerchantIdApply.setCertificat_expire_date(clientJson.getString("certificat_expire_date"));
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
@ -638,34 +649,32 @@ public class TestController {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if("ENTERPRISE".equalsIgnoreCase(newSubMerchantIdApply.getMerchant_type())&&TextUtils.isEmpty(newSubMerchantIdApply.getCompany_register_no())){
|
|
|
|
if ("ENTERPRISE".equalsIgnoreCase(newSubMerchantIdApply.getMerchant_type()) && TextUtils.isEmpty(newSubMerchantIdApply.getCompany_register_no())) {
|
|
|
|
logger.error("=======>公司注册号为空:clientid:"+clientJson.getInteger("client_id")+":"+clientJson.getString("client_moniker"));
|
|
|
|
logger.error("=======>公司注册号为空:clientid:" + clientJson.getInteger("client_id") + ":" + clientJson.getString("client_moniker"));
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if("BOTH".equalsIgnoreCase(newSubMerchantIdApply.getBusiness_type())&&(TextUtils.isEmpty(newSubMerchantIdApply.getAddress())||
|
|
|
|
if ("BOTH".equalsIgnoreCase(newSubMerchantIdApply.getBusiness_type()) && (TextUtils.isEmpty(newSubMerchantIdApply.getAddress()) ||
|
|
|
|
TextUtils.isEmpty(newSubMerchantIdApply.getWebsite()))){
|
|
|
|
TextUtils.isEmpty(newSubMerchantIdApply.getWebsite()))) {
|
|
|
|
logger.error("=======>公司类型为BOTH:网址或地址为空:clientid:"+clientJson.getInteger("client_id")+":"+clientJson.getString("client_moniker"));
|
|
|
|
logger.error("=======>公司类型为BOTH:网址或地址为空:clientid:" + clientJson.getInteger("client_id") + ":" + clientJson.getString("client_moniker"));
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
} else if ("OFFLINE".equalsIgnoreCase(newSubMerchantIdApply.getBusiness_type()) && (TextUtils.isEmpty(newSubMerchantIdApply.getAddress()))) {
|
|
|
|
else if("OFFLINE".equalsIgnoreCase(newSubMerchantIdApply.getBusiness_type())&&(TextUtils.isEmpty(newSubMerchantIdApply.getAddress()))){
|
|
|
|
logger.error("=======>公司类型为OFFLINE:地址为空:clientid:" + clientJson.getInteger("client_id") + ":" + clientJson.getString("client_moniker"));
|
|
|
|
logger.error("=======>公司类型为OFFLINE:地址为空:clientid:"+clientJson.getInteger("client_id")+":"+clientJson.getString("client_moniker"));
|
|
|
|
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
} else if ("ONLINE".equalsIgnoreCase(newSubMerchantIdApply.getBusiness_type()) &&
|
|
|
|
else if("ONLINE".equalsIgnoreCase(newSubMerchantIdApply.getBusiness_type())&&
|
|
|
|
TextUtils.isEmpty(newSubMerchantIdApply.getWebsite())) {
|
|
|
|
TextUtils.isEmpty(newSubMerchantIdApply.getWebsite())){
|
|
|
|
logger.error("=======>公司类型为ONLINE:网址为空:clientid:" + clientJson.getInteger("client_id") + ":" + clientJson.getString("client_moniker"));
|
|
|
|
logger.error("=======>公司类型为ONLINE:网址为空:clientid:"+clientJson.getInteger("client_id")+":"+clientJson.getString("client_moniker"));
|
|
|
|
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
JSONObject params = newSubMerchantIdApply.insertObject(clientJson);
|
|
|
|
JSONObject params = newSubMerchantIdApply.insertObject(clientJson);
|
|
|
|
params.put("merchant_app_id", jsonObject.getString("merchant_app_id"));
|
|
|
|
params.put("merchant_app_id", jsonObject.getString("merchant_app_id"));
|
|
|
|
SubMerchantInfoInheritance subMerchantInfo = JSON.toJavaObject(params, SubMerchantInfoInheritance.class);
|
|
|
|
SubMerchantInfoInheritance subMerchantInfo = JSON.toJavaObject(params, SubMerchantInfoInheritance.class);
|
|
|
|
params.put("operator","System");
|
|
|
|
params.put("operator", "System");
|
|
|
|
|
|
|
|
|
|
|
|
WxPayMerchantRegister register = Optional.ofNullable(merchantChannelApplicationManager.getRegister(WxPayMerchantRegister.class))
|
|
|
|
WxPayMerchantRegister register = Optional.ofNullable(merchantChannelApplicationManager.getRegister(WxPayMerchantRegister.class))
|
|
|
|
.orElseThrow(() -> new ServerErrorException("No Register found for wechat"));
|
|
|
|
.orElseThrow(() -> new ServerErrorException("No Register found for wechat"));
|
|
|
|
|
|
|
|
|
|
|
|
JSONObject manager=new JSONObject();
|
|
|
|
JSONObject manager = new JSONObject();
|
|
|
|
manager.put("display_name","System");
|
|
|
|
manager.put("display_name", "System");
|
|
|
|
register.modifyForBatch(jsonObject.getString("merchant_app_id"), clientJson, subMerchantInfo, manager);
|
|
|
|
register.modifyForBatch(jsonObject.getString("merchant_app_id"), clientJson, subMerchantInfo, manager);
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
Thread.sleep(500);
|
|
|
|
Thread.sleep(500);
|
|
|
@ -677,6 +686,7 @@ public class TestController {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 批量更新微信子商户号
|
|
|
|
* 批量更新微信子商户号
|
|
|
|
*/
|
|
|
|
*/
|
|
|
@ -784,12 +794,12 @@ public class TestController {
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
public String cutLength(String str,int maxlen){
|
|
|
|
public String cutLength(String str, int maxlen) {
|
|
|
|
if(TextUtils.isEmpty(str))return "";
|
|
|
|
if (TextUtils.isEmpty(str)) return "";
|
|
|
|
if(str.length()>maxlen){
|
|
|
|
if (str.length() > maxlen) {
|
|
|
|
return str.substring(0,maxlen);
|
|
|
|
return str.substring(0, maxlen);
|
|
|
|
}else{
|
|
|
|
} else {
|
|
|
|
return str;
|
|
|
|
return str;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|