diff --git a/src/main/java/au/com/royalpay/payment/manage/application/beans/ClientPreApplyBean.java b/src/main/java/au/com/royalpay/payment/manage/application/beans/ClientPreApplyBean.java index d1d72e07b..6160a9211 100644 --- a/src/main/java/au/com/royalpay/payment/manage/application/beans/ClientPreApplyBean.java +++ b/src/main/java/au/com/royalpay/payment/manage/application/beans/ClientPreApplyBean.java @@ -72,6 +72,7 @@ public class ClientPreApplyBean { private String alipayindustry; private String wechatindustry; private String store_photo; + private String contract_url; public JSONObject insertObject() { JSONObject res = (JSONObject) JSON.toJSON(this); @@ -389,4 +390,12 @@ public class ClientPreApplyBean { public void setWechatindustry(String wechatindustry) { this.wechatindustry = wechatindustry; } + + public void setContract_url(String contract_url) { + this.contract_url = contract_url; + } + + public String getContract_url() { + return contract_url; + } } diff --git a/src/main/java/au/com/royalpay/payment/manage/application/core/SimpleClientApplyService.java b/src/main/java/au/com/royalpay/payment/manage/application/core/SimpleClientApplyService.java index 98cbc7b15..f2f05ad5a 100644 --- a/src/main/java/au/com/royalpay/payment/manage/application/core/SimpleClientApplyService.java +++ b/src/main/java/au/com/royalpay/payment/manage/application/core/SimpleClientApplyService.java @@ -42,7 +42,7 @@ public interface SimpleClientApplyService { JSONObject getSourceAggregateFile(String username ,String clean_days); - JSONObject getClientAggregateFile(String username, MultipartFile file,String clean_days) throws IOException; + JSONObject getClientAggregateFile(String username, MultipartFile file,String clean_days, JSONObject signInfo) throws IOException; JSONObject getPreApplyInfoForAggree(String username ,String clean_days); diff --git a/src/main/java/au/com/royalpay/payment/manage/application/core/impls/SimpleClientApplyServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/application/core/impls/SimpleClientApplyServiceImpl.java index ee991960c..947de6845 100644 --- a/src/main/java/au/com/royalpay/payment/manage/application/core/impls/SimpleClientApplyServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/application/core/impls/SimpleClientApplyServiceImpl.java @@ -49,6 +49,7 @@ import java.awt.image.BufferedImage; import java.io.*; import java.math.BigDecimal; import java.net.URISyntaxException; +import java.net.URLDecoder; import java.util.*; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.ThreadPoolExecutor; @@ -405,10 +406,7 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService { applyInfo.put("update_time", new Date()); sysClientPreMapperMapper.update(applyInfo); if (applyInfo.getBooleanValue("agree")) { - if(apply.getString("contract_url")==null|| !(StringUtils.equals(apply.getString("clean_days"),applyInfo.getString("clean_days"))) ) { - throw new BadRequestException("The date of liquidation has changed and the contract needs to be renewed"); - } - applyerToClient(username); + applyerToClient(username, null); } } } @@ -518,10 +516,7 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService { apply.put("clean_days", clean_days); JSONObject sysConfig = sysConfigManager.getSysConfig(); JSONObject test = JSONObject.parseObject(sysConfig.getString("sys_apply_rates")); - JSONObject rate = test.getJSONObject("t"+clean_days.trim()); - - apply.put("wechat_rate",rate.getString("Wechat")); apply.put("alipay_rate",rate.getString("Alipay")); apply.put("alipay_online_rate",rate.getString("AlipayOnline")); @@ -551,18 +546,18 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService { @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); - apply.put("full_name", file.getOriginalFilename()); + apply.put("full_name", URLDecoder.decode(file.getOriginalFilename(),"UTF-8")); BufferedImage img = ImageIO.read(file.getInputStream()); ByteArrayOutputStream out = new ByteArrayOutputStream(); ImageIO.write(img, "png", out); 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; JSONObject contractInfo = new JSONObject(); try { @@ -570,30 +565,36 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService { pdu.setTemplatePdfPath(IMG_AGGREGATE_FILE); pdu.setPdfTemplate(apply); File file = new File(username + "_agreement.pdf"); - ByteArrayOutputStream bos = pdu.templetPdfBos(file,"STSong-Light","UniGB-UCS2-H"); + ByteArrayOutputStream bos = pdu.templetPdfBos(file, "STSong-Light", "UniGB-UCS2-H"); stream = new ByteArrayInputStream(bos.toByteArray()); 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) { logger.error("合同制作出现问题:", e); throw new BadRequestException("合同制作出现问题:" + e.getMessage()); } finally { stream.close(); } + applyerToClient(apply.getString("username"), signInfo); return contractInfo; } //todo - private void applyerToClient(String username) { + private void applyerToClient(String username, JSONObject signInfo) { JSONObject sysConfig = sysConfigManager.getSysConfig(); String arr[] = sysConfig.getString("temp_sub_mch_id").split(","); List availableMerchants = WechatPayEnvironment.getEnv().getWechatMerchantConfigs().stream() - .filter(mch->StringUtils.equals(mch.getMpId(),"globalpay")) + .filter(mch -> StringUtils.equals(mch.getMpId(), "globalpay")) .map(WeChatPayConfig.Merchant::getMerchantId) .collect(Collectors.toList()); JSONObject subMerchant = pmtSubMerchantIdMapper.randomOne(availableMerchants); - if(subMerchant==null){ + if (subMerchant == null) { throw new BadRequestException("System is busy Please try again"); } Date now = new Date(); @@ -612,9 +613,7 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService { throw new ForbiddenException("The user name has been registered"); } String clientMoniker = generateClientMoniker(); - JSONObject sysClient = new JSONObject(); - JSONObject followBd = managerMapper.findByLoginId("customerservice"); sysClient.put("bd_user", followBd.getString("manager_id")); @@ -626,16 +625,17 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService { sysClient.put("suburb", apply.getString("suburb")); sysClient.put("state", apply.getString("state")); 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("industry", apply.getString("industry"));//微信支付行业 + sysClient.put("industry", apply.getString("wechatindustry")); sysClient.put("contact_person", apply.getString("contact_person")); sysClient.put("contact_job", apply.getString("contact_job")); sysClient.put("logo_url", apply.getString("logo_url")); sysClient.put("company_website", apply.getString("company_website")); 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_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("client_moniker", clientMoniker); sysClient.put("create_time", new Date()); @@ -654,19 +654,9 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService { sysClient.put("country", "AUS"); sysClient.put("credential_code", RandomStringUtils.random(32, true, true)); sysClient.put("ali_sub_merchant_id", clientMoniker); + sysClient.put("enable_wechat", 1); 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(); representativeInfo.put("client_id", sysClient.getIntValue("client_id")); representativeInfo.put("representative_person", apply.getString("representative_person")); @@ -684,7 +674,7 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService { clientBd.put("bd_id", followBd.getString("manager_id")); clientBd.put("bd_name", followBd.getString("display_name")); clientBd.put("create_time", new Date()); - clientBd.put("create_id","0"); + clientBd.put("create_id", "0"); clientBd.put("start_date", new Date()); clientBd.put("proportion", 1); clientBDMapper.saveBD(clientBd); @@ -706,6 +696,22 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService { sysAccount.put("nation_code", "+61"); 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(); sysBank.put("client_id", clientId); sysBank.put("account_no", apply.getString("bank_no")); @@ -724,6 +730,7 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService { JSONObject clientConfig = new JSONObject(); clientConfig.put("client_id", clientId); clientConfig.put("skip_clearing", 1); + clientConfig.put("enable_wechat", 1); clientConfig.put("client_moniker", clientMoniker); clientConfig.put("clean_days", apply.getIntValue("clean_days")); clientConfig.put("common_sub_merchant_id", 1); @@ -736,7 +743,7 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService { apply.put("client_moniker", clientMoniker); sysClientPreMapperMapper.update(apply); - permissionPartnerManager.permissionClientModuleSave(clientId,clientMoniker); + permissionPartnerManager.permissionClientModuleSave(clientId, clientMoniker); JSONObject sysRate = new JSONObject(); sysRate.put("client_id", clientId); @@ -765,10 +772,16 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService { configNewClientRate(sysRate, clientId, "AlipayOnline", "AlipayOnline"); configNewClientRate(sysRate, clientId, "Bestpay", "Bestpay"); configNewClientRate(sysRate, clientId, "jd", "JDpay"); + configNewClientRate(sysRate, clientId, "CB_BankPay", "CB_Bankpay"); Runnable task2 = () -> { try { - clientManager.getNewAggregateAgreeFile(clientMoniker, null, true); + if (signInfo != null) { + clientManager.registerClientApplyGMS(clientMoniker, sysAccount.getString("account_id")); + }else { + clientManager.getNewAggregateAgreeFile(clientMoniker, null, true); + } } catch (Exception ignore) { + logger.error("{}自助申请成功,支付宝报备失败:{}",clientMoniker,ignore); } }; pool.execute(task2); diff --git a/src/main/java/au/com/royalpay/payment/manage/application/web/ContentController.java b/src/main/java/au/com/royalpay/payment/manage/application/web/ContentController.java index 01108455f..e665acdd6 100644 --- a/src/main/java/au/com/royalpay/payment/manage/application/web/ContentController.java +++ b/src/main/java/au/com/royalpay/payment/manage/application/web/ContentController.java @@ -45,7 +45,6 @@ public class ContentController { model.addAttribute("bestpay_rate", contractInfo.getString("bestpay_rate")); model.addAttribute("alipay_rate", contractInfo.getString("alipay_rate")); model.addAttribute("jd_rate", contractInfo.getString("jd_rate")); - return "contract_for_compliance"; } diff --git a/src/main/java/au/com/royalpay/payment/manage/application/web/SimpleClientApplyController.java b/src/main/java/au/com/royalpay/payment/manage/application/web/SimpleClientApplyController.java index d4a50c43a..6b788af88 100644 --- a/src/main/java/au/com/royalpay/payment/manage/application/web/SimpleClientApplyController.java +++ b/src/main/java/au/com/royalpay/payment/manage/application/web/SimpleClientApplyController.java @@ -5,6 +5,7 @@ import au.com.royalpay.payment.manage.application.beans.ClientPreApplyStep1Bean; import au.com.royalpay.payment.manage.application.core.SimpleClientApplyService; import au.com.royalpay.payment.tools.CommonConsts; import au.com.royalpay.payment.tools.connections.attachment.core.AttachmentClient; +import au.com.royalpay.payment.tools.env.RequestEnvironment; import au.com.royalpay.payment.tools.env.SysConfigManager; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; @@ -82,9 +83,12 @@ public class SimpleClientApplyController { @PostMapping(value = "/clientCompliance/commit_aggregate_file") @ResponseBody - public JSONObject getClientArregateFile(@RequestParam MultipartFile file, @RequestParam String username, @RequestParam String clean_days) throws IOException { + public JSONObject getClientArregateFile(@RequestHeader("User-Agent") String userAgent,@RequestParam MultipartFile file, @RequestParam(value = "username") String username, @RequestParam(value = "clean_days") String clean_days) throws IOException { //这个是上传合同的接口,现在为了测试方便,返回一个带合同url的JSONObject,需要传入username,clean_days,签名图片 - return simpleClientApplyService.getClientAggregateFile(username, file, clean_days); + JSONObject signInfo = new JSONObject(); + signInfo.put("signature_ip", RequestEnvironment.getClientIp()); + signInfo.put("user_agent", userAgent); + return simpleClientApplyService.getClientAggregateFile(username, file, clean_days, signInfo); } @GetMapping("/client/source_aggregate_file") diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java b/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java index 67b4f3952..17bbd4737 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java @@ -370,6 +370,8 @@ public interface ClientManager { void registerAlipayOnlineGms(String clientMoniker, JSONObject manager); + void registerClientApplyGMS(String clientMoniker, String account_id); + String queryAlipayGmsStatus(String clientMoniker, JSONObject manager); JSONObject queryAlipayGmsJson(String clientMoniker, JSONObject manager); diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java index 55de0f83c..10f627a83 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java @@ -121,6 +121,7 @@ import java.math.BigDecimal; import java.math.RoundingMode; import java.net.URISyntaxException; import java.net.URL; +import java.net.URLDecoder; import java.security.*; import java.security.interfaces.RSAPrivateKey; import java.security.interfaces.RSAPublicKey; @@ -330,7 +331,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } @Override - @Cacheable(value = ":app_client_info:", key = "''+#clientId", unless="#result == null") + @Cacheable(value = ":app_client_info:", key = "''+#clientId", unless = "#result == null") public JSONObject getClientInfo(int clientId) { return clientMapper.findClient(clientId); } @@ -768,15 +769,15 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid try { JSONObject representativeInfo = new JSONObject(); - representativeInfo.put("client_id",partner.getIntValue("client_id")); - representativeInfo.put("representative_person",partner.getString("legal_representative_person")); - representativeInfo.put("phone",partner.getString("legal_representative_phone")); - representativeInfo.put("email",partner.getString("legal_representative_email")); - representativeInfo.put("job_title",partner.getString("legal_representative_job")); - representativeInfo.put("address",partner.getString("registered_address")); - representativeInfo.put("suburb",partner.getString("registered_suburb")); - representativeInfo.put("postcode",partner.getString("registered_postcode")); - representativeInfo.put("state",partner.getString("registered_state")); + representativeInfo.put("client_id", partner.getIntValue("client_id")); + representativeInfo.put("representative_person", partner.getString("legal_representative_person")); + representativeInfo.put("phone", partner.getString("legal_representative_phone")); + representativeInfo.put("email", partner.getString("legal_representative_email")); + representativeInfo.put("job_title", partner.getString("legal_representative_job")); + representativeInfo.put("address", partner.getString("registered_address")); + representativeInfo.put("suburb", partner.getString("registered_suburb")); + representativeInfo.put("postcode", partner.getString("registered_postcode")); + representativeInfo.put("state", partner.getString("registered_state")); sysClientLegalPersonMapper.save(representativeInfo); } catch (Exception e) { throw new BadRequestException("error.partner.valid.dumplicate_client_moniker"); @@ -833,19 +834,19 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid updateInfo.put("client_id", clientId); JSONObject representativeInfo = new JSONObject(); - representativeInfo.put("client_id",clientId); - representativeInfo.put("representative_person",info.getRepresentativePerson()); - representativeInfo.put("phone",info.getRepresentativePhone()); - representativeInfo.put("email",info.getRepresentativeEmail()); - representativeInfo.put("job_title",info.getRepresentativeJobTitle()); - representativeInfo.put("address",info.getRegisteredAddress()); - representativeInfo.put("suburb",info.getRegisteredSuburb()); - representativeInfo.put("postcode",info.getRegisteredPostcode()); - representativeInfo.put("state",info.getRegisteredState()); - - if(sysClientLegalPersonMapper.findRepresentativeInfo(clientId) != null){ + representativeInfo.put("client_id", clientId); + representativeInfo.put("representative_person", info.getRepresentativePerson()); + representativeInfo.put("phone", info.getRepresentativePhone()); + representativeInfo.put("email", info.getRepresentativeEmail()); + representativeInfo.put("job_title", info.getRepresentativeJobTitle()); + representativeInfo.put("address", info.getRegisteredAddress()); + representativeInfo.put("suburb", info.getRegisteredSuburb()); + representativeInfo.put("postcode", info.getRegisteredPostcode()); + representativeInfo.put("state", info.getRegisteredState()); + + if (sysClientLegalPersonMapper.findRepresentativeInfo(clientId) != null) { sysClientLegalPersonMapper.update(representativeInfo); - }else{ + } else { sysClientLegalPersonMapper.save(representativeInfo); } @@ -1231,7 +1232,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid @Override public void run() { try { - String emailId = mailService.sendEmail("Your RoyalPay Cross-border Payment has been set up", StringUtils.join(mailTos,","), "", content); + String emailId = mailService.sendEmail("Your RoyalPay Cross-border Payment has been set up", StringUtils.join(mailTos, ","), "", content); mailService.sendEmail("Your RoyalPay Cross-border Payment has been set up", emails.isEmpty() ? "" : StringUtils.join(emails, ","), "", contentBd); JSONObject clientUpdate = new JSONObject(); @@ -1296,7 +1297,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid @Override public void run() { try { - String emailId = mailService.sendEmail("Your RoyalPay Cross-border Payment has been set up", StringUtils.join(mailTos,","), "", content); + String emailId = mailService.sendEmail("Your RoyalPay Cross-border Payment has been set up", StringUtils.join(mailTos, ","), "", content); mailService.sendEmail("Your RoyalPay Cross-border Payment has been set up", emails.isEmpty() ? "" : StringUtils.join(emails, ","), "", contentBd); JSONObject clientUpdate = new JSONObject(); @@ -1563,10 +1564,11 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid return accountJson; } - private void checkPhoneAndWechatExist(NewAccountBean account){ - if(clientAccountMapper.findByPhone(account.getContactPhone(),"+"+account.getNation_code())!=null){ + private void checkPhoneAndWechatExist(NewAccountBean account) { + if (clientAccountMapper.findByPhone(account.getContactPhone(), "+" + account.getNation_code()) != null) { throw new BadRequestException("Mobile phone number has been bound to other accounts"); - }; + } + ; } @Override @@ -1637,7 +1639,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid if (account == null) { throw new BadRequestException("account not exists"); } - if(clientAccountMapper.findByWechatOpenId(user.getString("openid"))!=null || clientAccountMapper.findByWxUnioinId(user.getString("unioinid"))!=null){ + if (clientAccountMapper.findByWechatOpenId(user.getString("openid")) != null || clientAccountMapper.findByWxUnioinId(user.getString("unioinid")) != null) { throw new BadRequestException("The WeChat has been linked to other accounts"); } JSONObject res = new JSONObject(); @@ -3462,8 +3464,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid JSONObject client = getClientInfoByMoniker(clientMoniker); String clientPayType = ""; String companyPhoto = ""; - String storePhoto= ""; - String webSite= ""; + String storePhoto = ""; + String webSite = ""; int sourceEnum = 2; if (client == null) { throw new InvalidShortIdException(); @@ -3479,7 +3481,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid if (clientAllAuthFiles.stream().noneMatch(fileJson -> fileKey.equals(fileJson.getString("file_name")))) { if ("client_agree_file".equals(fileKey)) { throw new BadRequestException("Please check that the agreement has been signed"); - }else { + } else { throw new BadRequestException("Please check the " + fileNames[i] + " is uploaded completely"); } } @@ -3524,7 +3526,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } @Override - public JSONObject getClientAggregateFile(JSONObject account, MultipartFile file) throws IOException{ + public JSONObject getClientAggregateFile(JSONObject account, MultipartFile file) throws IOException { if (StringUtils.isBlank(file.getOriginalFilename())) { throw new BadRequestException("Please Enter Full Name"); } @@ -3600,11 +3602,11 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid Date endDate = TimeZoneUtils.nextYearByCurrDay(); String end_date = DateFormatUtils.format(endDate, "dd/MM/yyyy"); client.put("end_date", end_date); - client.put("full_name", file.getOriginalFilename()); + client.put("full_name", URLDecoder.decode(file.getOriginalFilename(),"UTF-8")); BufferedImage img = ImageIO.read(file.getInputStream()); ByteArrayOutputStream out = new ByteArrayOutputStream(); ImageIO.write(img, "png", out); - client.put("img","data:image/png;base64," + Base64.encodeBase64String(out.toByteArray())); + client.put("img", "data:image/png;base64," + Base64.encodeBase64String(out.toByteArray())); JSONObject clientLegal = sysClientLegalPersonMapper.findRepresentativeInfo(client.getIntValue("client_id")); if (clientLegal != null) { client.put("legal_person", clientLegal.getString("representative_person")); @@ -3699,7 +3701,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid if (aggregateFiles != null && aggregateFiles.size() > 0) { clientFilesMapper.deleteAggreeByClientId(clientId); } - String signatureAccountId = StringUtils.isNotBlank("account_id")?manager.getString("account_id"):manager.getString("manager_id"); + String signatureAccountId = StringUtils.isNotBlank("account_id") ? manager.getString("account_id") : manager.getString("manager_id"); JSONObject fileJson = new JSONObject(); fileJson.put("client_id", clientId); fileJson.put("last_update_date", new Date()); @@ -3713,7 +3715,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid fileJson.put("status", 0); fileJson.put("is_valid", 1); clientFilesMapper.save(fileJson); - logger.info("{}合同文件上传成功,IP:{},us-agent:{},signature_id:{}",clientId,manager.getString("signature_ip"),manager.getString("user_agent"),signatureAccountId); + logger.info("{}合同文件上传成功,IP:{},us-agent:{},signature_id:{}", clientId, manager.getString("signature_ip"), manager.getString("user_agent"), signatureAccountId); JSONObject file = new JSONObject(); file.put("file_id", fileJson.getString("file_id")); file.put("file_value", fileJson.getString("file_value")); @@ -4209,7 +4211,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid JSONObject oldClienetLegal = sysClientLegalPersonMapper.findRepresentativeInfo(client_id); if (oldClienetLegal == null) { sysClientLegalPersonMapper.save(clientLegal); - }else { + } else { sysClientLegalPersonMapper.update(clientLegal); } } @@ -4795,18 +4797,12 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid if (client == null) { throw new InvalidShortIdException(); } - checkOrgPermission(manager, client); if (!client.containsKey("store_photo") || !client.containsKey("company_photo")) { throw new InvalidParameterException("store photo cannot be empty "); } - JSONObject client_bank = getBankAccountByClientId(client.getIntValue("client_id")); - if (client_bank == null || client_bank.size() <= 0) { - throw new BadRequestException("The Partner's Account is not config!"); - } - client.put("bank_id", client_bank.getString("account_no")); if (StringUtils.isBlank(client.getString("business_structure"))) { - throw new BadRequestException("Business Structure can't be null"); + client.put("business_structure", "Registered body(Sole Trader)"); } if (StringUtils.isBlank(client.getString("alipayindustry"))) { @@ -4926,24 +4922,17 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid if (client == null) { throw new InvalidShortIdException(); } - checkOrgPermission(manager, client); if (!client.containsKey("company_website")) { throw new InvalidParameterException("Website cannot be empty "); } if (StringUtils.isBlank(client.getString("business_structure"))) { - throw new BadRequestException("Business Structure can't be null"); + client.put("business_structure", "Registered body(Sole Trader)"); } if (StringUtils.isBlank(client.getString("alipayindustry"))) { throw new BadRequestException("Alipay Industry can't be null"); } - JSONObject client_bank = getBankAccountByClientId(client.getIntValue("client_id")); - if (client_bank == null || client_bank.size() <= 0) { - throw new BadRequestException("The Partner's Account is not config!"); - } - client.put("bank_id", client_bank.getString("account_no")); - AlipayConfig.AlipayMerchant mch = AlipayEnvironment.getEnv().getAlipayOnlineMerchant(); Element resultElement = alipayClient.registerOnlineGmsPortal(mch.getPid(), client); if (!StringUtils.equalsIgnoreCase("T", resultElement.elementText("is_success"))) { @@ -4960,12 +4949,36 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } @Override + public void registerClientApplyGMS(String clientMoniker, String accountId) { + JSONObject client = getClientInfoByMoniker(clientMoniker); + if (client == null) { + throw new InvalidShortIdException(); + } + JSONObject clientConfig = merchantInfoProvider.getClientConfigInfoByMoniker(clientMoniker); + JSONObject account = clientAccountMapper.findById(accountId); + if (clientConfig == null) { + throw new InvalidShortIdException(); + } + if (StringUtils.isNotBlank(clientConfig.getString("client_pay_type"))) { + String[] payType = clientConfig.getString("client_pay_type").split(","); + if (Arrays.asList(payType).contains("1")) { + registerAlipayOnlineGms(clientMoniker, null); + switchChannelPermission(account, clientMoniker, "Alipay", true); + } + if (Arrays.asList(payType).contains("2")) { + registerAlipayGms(clientMoniker, null); + enableGatewayAlipayOnline(account, clientMoniker, true); + } + } + } + + @Override + public String queryAlipayOnlineGmsStatus(String clientMoniker, JSONObject manager) { JSONObject client = getClientInfoByMoniker(clientMoniker); if (client == null) { throw new InvalidShortIdException(); } - checkOrgPermission(manager, client); AlipayConfig.AlipayMerchant mch = AlipayEnvironment.getEnv().getAlipayOnlineMerchant(); Element resultElement = alipayClient.queryOnlineGmsPortalStatus(mch.getPid(), client); if (!StringUtils.equalsIgnoreCase("T", resultElement.elementText("is_success"))) { @@ -5758,7 +5771,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid clientMapper.update(updateClient); } - private JSONObject exportImgAggregateFile(JSONObject account, JSONObject client) throws IOException{ + private JSONObject exportImgAggregateFile(JSONObject account, JSONObject client) throws IOException { JSONObject result = new JSONObject(); InputStream stream = null; try { @@ -5766,7 +5779,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid pdu.setTemplatePdfPath(IMG_AGGREGATE_FILE); pdu.setPdfTemplate(client); File file = new File(client.getString("client_moniker") + "_agreement.pdf"); - ByteArrayOutputStream bos = pdu.templetPdfBos(file,"STSong-Light","UniGB-UCS2-H"); + ByteArrayOutputStream bos = pdu.templetPdfBos(file, "STSong-Light", "UniGB-UCS2-H"); stream = new ByteArrayInputStream(bos.toByteArray()); JSONObject fileInfo = attachmentClient.uploadFile(stream, client.getString("client_moniker") + "_" + System.currentTimeMillis() + "_agreement.pdf", false); ClientAuthFilesInfo clientAuthFilesInfo = new ClientAuthFilesInfo(); diff --git a/src/main/ui/merchant_application.html b/src/main/ui/merchant_application.html index 696291205..6bb2a5a08 100644 --- a/src/main/ui/merchant_application.html +++ b/src/main/ui/merchant_application.html @@ -370,22 +370,6 @@ placeholder="Company Name" required maxlength="80"> -
- -
-
- -
- - -
-
-
- -
- -
- -
-
Legal person information
-
-
- -
-
-
- {{partner.nation_code}} - -
-
-
- -
-

The mailbox is incorrect

-
-
-
- -
- -
-
- -
-
Registered Address
-
-
- -
-
- -
-
- -
-
- -
- -
-
-
@@ -933,7 +845,6 @@
-