From 4d4ad058b1b79324065e41dc3a92e453e2852cea Mon Sep 17 00:00:00 2001 From: dulingling Date: Tue, 28 Apr 2020 14:04:23 +0800 Subject: [PATCH] =?UTF-8?q?Upd:=E4=BF=A1=E7=94=A8=E5=8D=A1=E5=90=88?= =?UTF-8?q?=E8=A7=84=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mappers/system/ClientFilesMapper.java | 2 + .../mappers/system/ClientRateMapper.java | 2 + .../manage/merchants/core/ClientManager.java | 16 +- .../core/impls/ClientManagerImpl.java | 231 ++++++++-- .../web/PartnerManageController.java | 84 ++-- src/main/resources/application.yml | 11 + .../mappers/system/ClientFilesMapper.xml | 8 + .../mappers/system/ClientRateMapper.xml | 10 + .../templates/pdf/letter_of_offer.pdf | Bin 168390 -> 187904 bytes .../static/payment/partner/partner-manage.js | 137 +++++- .../partner/templates/partner_detail.html | 418 +++++++++--------- .../templates/partner_payment_info.html | 2 +- .../payment/partner/templates/partners.html | 4 +- 13 files changed, 642 insertions(+), 283 deletions(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientFilesMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientFilesMapper.java index 1d036096e..d7169064e 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientFilesMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientFilesMapper.java @@ -52,6 +52,8 @@ public interface ClientFilesMapper { JSONObject getSourceAgreeFilesByClientId(@Param("client_id") int clientId); + JSONObject getSourceCardAgreeFilesByClientId(@Param("client_id") int clientId,@Param("file_name")String file_name); + void deleteByClientAndFileId(@Param("file_id") String file_id); void deleteAggreeByClientId(@Param("client_id") int file_id); diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientRateMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientRateMapper.java index 98ecbd655..a6972d809 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientRateMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientRateMapper.java @@ -53,6 +53,8 @@ public interface ClientRateMapper { JSONObject latestChannelCleanDays(@Param("rate_name")String rate_name, @Param("client_id")int client_id); + JSONObject latestCardChannelCleanDays(@Param("rate_name")String rate_name, @Param("client_id")int client_id); + JSONObject latestExpiryConfig(@Param("client_id")int client_id,@Param("rate_name") String rate_name); 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 d95488795..46267d2f2 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 @@ -272,6 +272,8 @@ public interface ClientManager { JSONObject getSourceAgreeFiles(JSONObject manage, String clientMoniker); + JSONObject getSourceCardAgreeFiles(String clientMoniker, JSONObject manager, String fileName); + void deleteAuthFiles(String fileId); void deleteAuthFilesByAdmin(String fileId); @@ -300,6 +302,8 @@ public interface ClientManager { void commitToCompliance(String clientMoniker, JSONObject manager); + void commitToCardCompliance(String clientMoniker, JSONObject manager); + void commitToDoAgreeFile(String clientMoniker, JSONObject manager); /** @@ -387,6 +391,10 @@ public interface ClientManager { void getAggregateAgreeFile(String clientMoniker, JSONObject manager, boolean renewal) throws Exception; + void getAggregateCardAgreeFile(String clientMoniker, JSONObject manager, boolean renewal) throws Exception; + + void getAggregateCardPromotionaAgreeFile(String clientMoniker, JSONObject manager, boolean renewal,Date promotionalEffectiveDate,int promotionalPeriod) throws Exception; + void getNewAggregateAgreeFile(String clientMoniker, JSONObject manager, boolean renewal) throws Exception; void temporaryExportPdf(String clientMoniker, JSONObject manager, HttpServletResponse httpResponse) throws Exception; @@ -395,6 +403,8 @@ public interface ClientManager { void completeAgree(String clientMoniker, JSONObject manager); + void cardCompleteAgree(String clientMoniker, JSONObject manager); + void downloadComplianceZip(@PathVariable String clientMoniker, HttpServletResponse response) throws Exception; void downloadMWComplianceZip(@PathVariable String clientMoniker, HttpServletResponse response) throws Exception; @@ -596,10 +606,4 @@ public interface ClientManager { void selectBillCodeVersion(JSONObject manager, String clientMoniker, String version); - void exportLetterOfferPDF(String clientMoniker,HttpServletResponse response); - - void exportPromotionalOfferPDF(String moniker, String date, HttpServletResponse response); - - void exportTermsConditionsPDF(String clientMoniker,HttpServletResponse response); - } 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 f44f84a20..1a557da70 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 @@ -183,6 +183,11 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid @Resource private ClientIncrementalMapper clientIncrementalMapper; + @Value("${client_card.account_reserve}") + private String cardAccountReserve; + @Value("${client_card.annual_rate}") + private String cardAnnualRate; + @Value("${app.redis.prefix}") private String redisPrefix; private ApplicationEventPublisher publisher; @@ -340,6 +345,13 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid private static final String CLIENT_AGREE_FILE = "client_agree_file"; private static final String CLIENT_COMPANY_FILE = "client_company_file"; private static final String CLIENT_APPLY_FILE = "client_apply_file"; + + //卡支付合同文件 + private static final String LETTER_OF_OFFER_FILE="letter_of_offer_file"; + private static final String PROMOTIONAL_OFFER_FILE="promotional_offer_file"; + private static final String TERMS_AND_CONDITIONS_FILE="terms_and_conditions_file"; + + private static final List tags = new ArrayList<>(); private static final String KYC_UTILITY_BILL_FILE = "kyc_utility_bill_file"; @@ -1642,7 +1654,9 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid if (client == null) { throw new InvalidShortIdException(); } - clientModifySupport.processClientConfigModify(new SwitchPermissionModify(manager, clientMoniker, permissionKey, allow)); + JSONObject upayProfileInfo = sysClientUpayProfileMapper.findInfo(client.getInteger("client_id")); + upayProfileInfo.put(permissionKey,allow); + sysClientUpayProfileMapper.update(upayProfileInfo); } @Override @@ -3157,6 +3171,35 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } } + @Override + @Transactional + public void getAggregateCardAgreeFile(String clientMoniker, JSONObject manager, boolean renewal){ + JSONObject client = clientMapper.findClientByMoniker(clientMoniker); + if (client == null) { + throw new InvalidShortIdException(); + } + exportLetterOfferPDF(clientMoniker,manager); + exportTermsConditionsPDF(clientMoniker,manager); + + if (!renewal) { + JSONObject cardFlow = clientCardFlowMapper.findClient(client.getInteger("client_id")); + cardFlow.put("open_status",2); + clientCardFlowMapper.update(cardFlow); + } + if (manager != null) { + saveClientAuditProcess(client.getIntValue("client_id"), 1, 2, "Compliance合同制作中", manager,2); + } + } + @Override + @Transactional + public void getAggregateCardPromotionaAgreeFile(String clientMoniker, JSONObject manager, boolean renewal,Date promotionalEffectiveDate,int promotionalPeriod){ + JSONObject client = clientMapper.findClientByMoniker(clientMoniker); + if (client == null) { + throw new InvalidShortIdException(); + } + exportPromotionalOfferPDF(clientMoniker,manager,promotionalEffectiveDate,promotionalPeriod); + } + @Override public void getNewAggregateAgreeFile(String clientMoniker, JSONObject manager, boolean renewal) throws Exception { JSONObject client = getClientInfoByMoniker(clientMoniker); @@ -3376,6 +3419,24 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid sendCommissionWechatMessage(client); } + @Override + public void cardCompleteAgree(String clientMoniker, JSONObject manager) { + JSONObject client = getClientInfoByMoniker(clientMoniker); + if (client == null) { + throw new InvalidShortIdException(); + } + List existLeffterFiles = clientFilesMapper.findFileByClientAndType(client.getIntValue("client_id"), LETTER_OF_OFFER_FILE); + List existConditionsFiles = clientFilesMapper.findFileByClientAndType(client.getIntValue("client_id"), TERMS_AND_CONDITIONS_FILE); + if (CollectionUtils.isEmpty(existLeffterFiles) && CollectionUtils.isEmpty(existConditionsFiles)) { + throw new BadRequestException("The Agree File is not Complete!"); + } + JSONObject cardFlowInfo = clientCardFlowMapper.findClient(client.getInteger("client_id")); + cardFlowInfo.put("open_status", 3); + clientCardFlowMapper.update(cardFlowInfo); + saveClientAuditProcess(client.getIntValue("client_id"), 2, 3, "合同制作完成,等待BD处理", manager,2); + sendCardCommissionWechatMessage(client); + } + @Override public void downloadComplianceZip(String clientMoniker, HttpServletResponse response) throws Exception { JSONObject client = getClientInfoByMoniker(clientMoniker); @@ -3711,6 +3772,19 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid return sourceFile; } + @Override + public JSONObject getSourceCardAgreeFiles(String clientMoniker, JSONObject manager, String fileName){ + JSONObject client = getClientInfoByMoniker(clientMoniker); + if (client == null) { + throw new InvalidShortIdException(); + } + JSONObject sourceFile = clientFilesMapper.getSourceCardAgreeFilesByClientId(client.getIntValue("client_id"),fileName); + if (sourceFile != null) { + sourceFile.put(sourceFile.getString("file_name"), sourceFile.getString("file_value")); + } + return sourceFile; + } + @Override public JSONObject getAllAuthFiles(JSONObject manager, String clientMoniker) { JSONObject client = getClientInfoByMoniker(clientMoniker); @@ -4588,6 +4662,45 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } } + @Override + @Transactional + public void commitToCardCompliance(String clientMoniker, JSONObject manager) { + JSONObject client = getClientInfoByMoniker(clientMoniker); + if (client == null) { + throw new InvalidShortIdException(); + } + client.putAll(clientConfigService.find(client.getIntValue("client_id"))); + if (manager != null && ManagerRole.BD_USER.hasRole(manager.getIntValue("role"))) { + int bdOperatClientRole = clientBDMapper.checkBDPermission(client.getIntValue("client_id"), manager.getString("manager_id")); + if (bdOperatClientRole <= 0) { + throw new ForbiddenException(); + } + } + // 提交合规启用银行、费率验证 add by Tayl0r 2017/06/13 + JSONObject rate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "rpaypmt_card"); + if (rate == null) { + throw new BadRequestException("The Partner's Rate is not config!"); + } + List clientFiles = clientFilesMapper.findClientFile(client.getIntValue("client_id")); + if (clientFiles == null || clientFiles.equals("")) { + throw new BadRequestException("The Compliance File Must Be Uploaded!"); + } + JSONObject account = getBankAccountByClientId(client.getIntValue("client_id")); + if (account == null) { + throw new BadRequestException("The Partner's Bank Account is not config!"); + } + JSONObject cardFlowInfo = clientCardFlowMapper.findClient(client.getInteger("client_id")); + int open_status_from = cardFlowInfo.getIntValue("open_status"); + cardFlowInfo.put("approve_time",new Date()); + cardFlowInfo.put("approve_result",4); + cardFlowInfo.put("open_status", 4); + clientCardFlowMapper.update(cardFlowInfo); + saveClientAuditProcess(client.getIntValue("client_id"), open_status_from, 4, "BD完成签字提交compliance审核", manager,2); + if (manager != null) { + sendCardCommissionWechatMessage(client); + } + } + private void saveClientAuditProcess(int client_id, Integer open_status_form, Integer open_status_to, String remark, JSONObject manager,int type) { JSONObject log = new JSONObject(); try { @@ -4640,6 +4753,11 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid client.putAll(clientConfigService.find(clientId)); beforeCommitToDoAgreeValid(client, manager); + JSONObject surCharge = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "rpaypmt_card"); + if (surCharge == null || surCharge.size() <= 0) { + throw new BadRequestException("The Partner's Rpaypmt Card Rate is not config!"); + } + JSONObject cardFlowInfo = clientCardFlowMapper.findClient(clientId); if(null != cardFlowInfo){ JSONObject cardFlow = new JSONObject(){{ @@ -5606,7 +5724,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid String wxopenid = compliance.getString("wx_openid"); try { MpWechatApi paymentApi = mpWechatApiProvider.getNewPaymentApi(); - TemplateMessage msg = initSendCommissionTemplate(wxopenid, paymentApi.getTemplateId("commission"), "BD申请制作卡支付合同" + client_moniker, + TemplateMessage msg = initSendCommissionTemplate(wxopenid, paymentApi.getTemplateId("commission"), "BD申请制作信用卡支付合同" + client_moniker, bd_user_name, "制作卡支付合同申请", "BD申请制作" + short_name + "的卡支付合同"); paymentApi.sendTemplateMessage(msg); } catch (WechatException e) { @@ -5624,7 +5742,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid if (wxopenid != null) { try { MpWechatApi paymentApi = mpWechatApiProvider.getNewPaymentApi(); - TemplateMessage msg = initSendCommissionTemplate(wxopenid, paymentApi.getTemplateId("commission"), client_moniker + "卡支付合同制作完成", + TemplateMessage msg = initSendCommissionTemplate(wxopenid, paymentApi.getTemplateId("commission"), client_moniker + "信用卡支付合同制作完成", "Compliance", "合规材料", "上传完整合规材料,商户:" + short_name); paymentApi.sendTemplateMessage(msg); } catch (WechatException e) { @@ -5647,7 +5765,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid String wxopenid = compliance.getString("wx_openid"); try { MpWechatApi paymentApi = mpWechatApiProvider.getNewPaymentApi(); - TemplateMessage msg = initSendCommissionTemplate(wxopenid, paymentApi.getTemplateId("commission"), client_moniker + "卡支付合规材料已提交", + TemplateMessage msg = initSendCommissionTemplate(wxopenid, paymentApi.getTemplateId("commission"), client_moniker + "信用卡卡支付合规材料已提交", bd_user_name, "审核材料", "已提交合规材料,等待审核"); paymentApi.sendTemplateMessage(msg); } catch (WechatException e) { @@ -7217,12 +7335,11 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid clientInfoCacheSupport.clearClientCache(client.getIntValue("client_id")); } - @Override - public void exportLetterOfferPDF(String clientMoniker, HttpServletResponse response) { + private void exportLetterOfferPDF(String clientMoniker,JSONObject manage) { JSONObject info = convertClientLetterOfferInfo(clientMoniker); String pdfPath = this.getClass().getClassLoader().getResource("").getPath() + "/templates/pdf/letter_of_offer.pdf"; String fileName = clientMoniker + "_Letter_of_Offer.pdf"; - publishExcelCardPDFFile(fileName, pdfPath, info, response); + publishExcelCardPDFFile(clientMoniker,manage,fileName, pdfPath, info,LETTER_OF_OFFER_FILE); } private JSONObject convertClientLetterOfferInfo(String clientMoniker) { @@ -7236,46 +7353,45 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } //获取数据源 int clientId = client.getInteger("client_id"); - JSONObject clientRate = clientRateMapper.latestChannelCleanDays("rpaypmt_card", clientId); + JSONObject clientRate = clientRateMapper.latestCardChannelCleanDays("rpaypmt_card", clientId); if (clientRate == null) { throw new BadRequestException("rpaypmt_card rate Not configured"); } JSONObject cardRate = clientRate.getJSONObject("ext_rates"); JSONObject bankAccountInfo = clientBankAccountMapper.clientBankAccounts(clientId).get(0); - + JSONObject upayProfileInfo = sysClientUpayProfileMapper.findInfo(clientId); //装在数据 JSONObject info = new JSONObject(); info.put("down_date", convertDateEnglish(new Date()));//下载文件日期 - info.put("bussiness_name", client.getString("business_name") + " ABN");//商圈类型 + info.put("bussiness_name", (client.containsKey("business_name")?client.getString("business_name"):client.getString("contact_person")) + " ABN");//商圈类型 info.put("partner_address", client.getString("address"));//商家店铺地址 info.put("partner_country", client.getString("country"));//国家 info.put("partner_state", client.getString("state"));//洲 info.put("partner_bussiness_name", client.getString("business_name"));//商户商用名称 info.put("clean_days", client.getInteger("clean_days"));//T+规则清算天数 - info.put("partner_industry_mcc", client.getInteger("industry"));//商户行业编码 - info.put("legal_bussiness", client.getString("contact_person") + " AS " + client.getString("business_name") + " ABN " + client.getString("abn"));//拼接规则:法人名 AS 商用名称 ABD 编码 - info.put("annual_rate", "0");//年费率 + info.put("partner_industry_mcc", upayProfileInfo.getString("mv_industy"));//信用卡注册商户行业编码 + info.put("legal_bussiness", client.getString("contact_person") + " AS " + (client.containsKey("business_name")?client.getString("business_name"):client.getString("contact_person")) + " ABN " + client.getString("abn"));//拼接规则:法人名 AS 商用名称 ABD 编码 + info.put("annual_rate",cardAnnualRate);//年费率 info.put("cost_per_transaction", clientRate.getString("transaction_fee"));//每次交易成本 info.put("domestic_fee", cardRate.getString("domestic_rate_value"));//国内服务费 info.put("international_fee", cardRate.getString("overseas_rate_value"));//国际服务费 - info.put("account_reserve", "1000");//账户储备金 + info.put("account_reserve", cardAccountReserve);//账户储备金 //银行账号信息 info.put("account_name", bankAccountInfo.getString("account_name"));// info.put("bsb", bankAccountInfo.getString("bsb_no")); info.put("account_no", bankAccountInfo.getString("account_no")); - info.put("card_acceptor_name", "xxxxxxxxxxxxx"); + info.put("card_acceptor_name", upayProfileInfo.getString("acceptor_name")); return info; } - @Override - public void exportPromotionalOfferPDF(String clientMoniker, String date, HttpServletResponse response) { - JSONObject info = convertPromotionalOfferInfo(clientMoniker, date); + private void exportPromotionalOfferPDF(String clientMoniker,JSONObject manager,Date promotionalEffectiveDate,int promotionalPeriod) { + JSONObject info = convertPromotionalOfferInfo(clientMoniker,convertDateEnglish(promotionalEffectiveDate),promotionalPeriod); String pdfPath = this.getClass().getClassLoader().getResource("").getPath() + "/templates/pdf/promotional_offer.pdf"; String fileName = clientMoniker + "_Promotional_Offer.pdf"; - publishExcelCardPDFFile(fileName, pdfPath, info, response); + publishExcelCardPDFFile(clientMoniker,manager,fileName, pdfPath, info,PROMOTIONAL_OFFER_FILE); } - private JSONObject convertPromotionalOfferInfo(String clientMoniker, String date) { + private JSONObject convertPromotionalOfferInfo(String clientMoniker,String promotionalEffectiveDate,int promotionalPeriod) { JSONObject client = getClientInfoByMoniker(clientMoniker); if (client == null) { throw new InvalidShortIdException(); @@ -7285,7 +7401,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid throw new BadRequestException("The merchant failed the audit!"); } int clientId = client.getInteger("client_id"); - JSONObject clientRate = clientRateMapper.latestChannelCleanDays("rpaypmt_card", clientId); + JSONObject clientRate = clientRateMapper.latestCardChannelCleanDays("rpaypmt_card", clientId); if (clientRate == null) { throw new BadRequestException("rpaypmt_card rate Not configured"); } @@ -7294,22 +7410,20 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid JSONObject info = new JSONObject(); info.put("down_date", convertDateEnglish(new Date()));//下载文件日期 - info.put("bussiness_name", client.getString("business_name") + " ABN");//商圈类型 + info.put("bussiness_name", (client.containsKey("business_name")?client.getString("business_name"):client.getString("contact_person")) + " ABN");//商圈类型 info.put("partner_address", client.getString("address"));//商家店铺地址 info.put("partner_country", client.getString("country"));//国家 info.put("partner_state", client.getString("state"));//洲 info.put("partner_bussiness_name", client.getString("business_name"));//商户商用名称 - info.put("letter_offer_sub_time", date); - info.put("legal_bussiness", client.getString("contact_person") + " AS " + client.getString("business_name") + " ABN " + client.getString("abn"));//拼接规则:法人名 AS 商用名称 ABD 编码 + info.put("legal_bussiness", client.getString("contact_person") + " AS " + (client.containsKey("business_name")?client.getString("business_name"):client.getString("contact_person")) + " ABN " + client.getString("abn"));//拼接规则:法人名 AS 商用名称 ABD 编码 info.put("domestic_fee", cardRate.getString("domestic_rate_value"));//国内服务费 info.put("international_fee", cardRate.getString("overseas_rate_value"));//国际服务费 - info.put("promotional_effective_date", "xxxxxxxxx"); - info.put("promotional_period", "xxxxxxxxx"); + info.put("promotional_effective_date", promotionalEffectiveDate); + info.put("promotional_period", promotionalPeriod); return info; } - @Override - public void exportTermsConditionsPDF(String clientMoniker, HttpServletResponse response) { + private void exportTermsConditionsPDF(String clientMoniker,JSONObject manage) { JSONObject client = getClientInfoByMoniker(clientMoniker); if (client == null) { throw new InvalidShortIdException(); @@ -7319,24 +7433,26 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } String pdfPath = this.getClass().getClassLoader().getResource("").getPath() + "/templates/pdf/terms_and_conditions.pdf"; String fileName = clientMoniker + "_Terms_And_Conditions.pdf"; - publishExcelCardPDFFile(fileName, pdfPath, new JSONObject(), response); + publishExcelCardPDFFile(clientMoniker,manage,fileName, pdfPath, new JSONObject(),TERMS_AND_CONDITIONS_FILE); } - private void publishExcelCardPDFFile(String fileName, String pdfPath, JSONObject info, HttpServletResponse response) { - response.setContentType("application/pdf"); - response.setHeader("Content-Disposition", "attachment;fileName=" + fileName + ".pdf"); + private void publishExcelCardPDFFile(String clientMoniker,JSONObject manager, String fileName, String pdfPath, JSONObject info, String fileLabel) { try { - OutputStream outs = response.getOutputStream(); PdfUtils pdu = new PdfUtils(); pdu.setTemplatePdfPath(pdfPath); pdu.setPdfTemplate(info); - File file = new File(fileName); - ByteArrayOutputStream bos = pdu.templetPdfBos(file, "", ""); - outs.write(bos.toByteArray(), 0, bos.toByteArray().length); - outs.flush(); - outs.close(); - } catch (IOException e) { - e.printStackTrace(); + try { + File file = new File(fileName); + ByteArrayOutputStream bos = pdu.templetPdfBos(file); + InputStream stream = new ByteArrayInputStream(bos.toByteArray()); + JSONObject fileRes = attachmentClient.uploadFile(stream, fileName, false); + if (fileRes != null) { + importCardAgreeFile(clientMoniker, manager, fileRes.getString("url"), fileLabel); + } + stream.close(); + } catch (Exception e) { + logger.error("合同制作出现问题:", e); + } } catch (Exception e) { e.printStackTrace(); } @@ -7352,6 +7468,41 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid return day + " " + months[month] + " " + year; } + private void importCardAgreeFile(String clientMoniker, JSONObject manager, String sourceFile, String fileLabel) { + JSONObject client = getClientInfoByMoniker(clientMoniker); + if (client == null) { + throw new InvalidShortIdException(); + } + if (sourceFile != null) { + List existFiles = clientFilesMapper.findFileByClientAndType(client.getIntValue("client_id"), fileLabel); + JSONObject existFile = null; + if (!CollectionUtils.isEmpty(existFiles)) { + existFile = existFiles.get(0); + } + Date now = new Date(); + JSONObject file = new JSONObject(); + file.put("file_name", fileLabel); + file.put("file_value", sourceFile); + file.put("client_id", client.getIntValue("client_id")); + file.put("last_update_date", now); + file.put("status", 1); + file.put("is_valid", 1); + if (manager == null) { + file.put("last_update_by", "System Import"); + } else { + file.put("last_update_by", manager.getString("display_name")); + } + JSONObject contract = clientsContractMapper.findByClientId(client.getIntValue("client_id")); + if (contract == null || now.compareTo(contract.getDate("expiry_date")) > 0 || !contract.getBoolean("has_sign") || existFile == null + || existFile.isEmpty()) { + clientFilesMapper.save(file); + } else { + file.put("file_id", existFile.getString("file_id")); + clientFilesMapper.update(file); + } + } + } + public void saveLegalAndMarketingInfo(JSONObject partner) { JSONObject representativeInfo = new JSONObject(); representativeInfo.put("client_id", partner.getIntValue("client_id")); diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java b/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java index 8fc8d8cce..d89fc146a 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java @@ -595,6 +595,17 @@ public class PartnerManageController { return clientManager.getSourceAgreeFiles(manager, clientMoniker); } + /** + * 下载商户卡支付合规文件 + * + * @param clientMoniker + */ + @ManagerMapping(value = "/{clientMoniker}/file/source_card_agree_file", method = RequestMethod.GET, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR, ManagerRole.BD_USER, ManagerRole.SERVANT}) + public JSONObject getSourceCardAgreeAuthFiles(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, + @RequestParam("fileName") String fileName){ + return clientManager.getSourceCardAgreeFiles(clientMoniker,manager,fileName); + } + @ManagerMapping(value = "/auth_file/{fileId}/delete", method = RequestMethod.PUT, role = {ManagerRole.OPERATOR, ManagerRole.BD_USER}) public void deleteAuthFiles(@PathVariable String fileId, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { clientManager.deleteAuthFilesByAdmin(fileId); @@ -634,12 +645,21 @@ public class PartnerManageController { clientManager.commitToCompliance(clientMoniker, manager); } + /** + * 提交资料,BD提交卡支付最终审核 + * @param clientMoniker + * @param manager + */ + @ManagerMapping(value = "/{clientMoniker}/to_card_compliance", method = RequestMethod.PUT, role = {ManagerRole.ADMIN, ManagerRole.BD_USER}) + public void commitToCardCompliance(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { + clientManager.commitToCardCompliance(clientMoniker, manager); + } + @ManagerMapping(value = "/{clientMoniker}/make_agree_file", method = RequestMethod.GET, role = {ManagerRole.ADMIN, ManagerRole.BD_USER}) public void commitToDoAgreeFile(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { clientManager.commitToDoAgreeFile(clientMoniker, manager); } - //TODO BD提交申请卡合规 /** * 提交资料,申请卡支付 * @param clientMoniker @@ -665,6 +685,29 @@ public class PartnerManageController { clientManager.getAggregateAgreeFile(clientMoniker, manager, false); } + /** + * 制作卡支付合同 + * @param clientMoniker + * @param manager + * @throws Exception + */ + @ManagerMapping(value = "/{clientMoniker}/export/aggregate/card_agree_pdf", method = RequestMethod.GET, role = {ManagerRole.ADMIN, ManagerRole.DIRECTOR, ManagerRole.OPERATOR}) + public void exportAggregateCardAgreeFile(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) throws Exception { + clientManager.getAggregateCardAgreeFile(clientMoniker, manager, false); + } + + /** + * 制作促销合同 + * @param clientMoniker + * @param manager + * @throws Exception + */ + @ManagerMapping(value = "/{clientMoniker}/export/aggregate/card_promotiona_agree_pdf", method = RequestMethod.GET, role = {ManagerRole.ADMIN, ManagerRole.DIRECTOR, ManagerRole.OPERATOR}) + public void exportAggregateCardPromotionaAgreeFile(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, + @RequestParam("date") Date promotionalEffectiveDate,@RequestParam("period") int promotionalPeriod) throws Exception { + clientManager.getAggregateCardPromotionaAgreeFile(clientMoniker, manager, false,promotionalEffectiveDate,promotionalPeriod); + } + @ManagerMapping(value = "/{clientMoniker}/temp/export/pdf", method = RequestMethod.GET, role = {ManagerRole.ADMIN, ManagerRole.BD_USER, ManagerRole.DIRECTOR, ManagerRole.OPERATOR}) public void temporaryExportPDF(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, HttpServletResponse httpResponse) throws Exception { clientManager.temporaryExportPdf(clientMoniker, manager, httpResponse); @@ -680,6 +723,16 @@ public class PartnerManageController { clientManager.completeAgree(clientMoniker, manager); } + /** + * 信用卡合同生成完毕通知BD + * @param clientMoniker + * @param manager + */ + @ManagerMapping(value = "/{clientMoniker}/notify/cardCompleteAgree", method = RequestMethod.GET, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR}) + public void cardCompleteAgree(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { + clientManager.cardCompleteAgree(clientMoniker, manager); + } + @ManagerMapping(value = "/{clientMoniker}/download/complianceAsZIP", method = RequestMethod.GET, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR}) public void downloadComplianceZip(@PathVariable String clientMoniker, HttpServletResponse response) throws Exception { clientManager.downloadComplianceZip(clientMoniker, response); @@ -961,33 +1014,4 @@ public class PartnerManageController { clientManager.switchPermission(manager, clientMoniker, "enable_international_card", pass.getBooleanValue("allow")); } - /** - * 下载商户Letter of Offer pdf文件 - * - * @param clientMoniker - */ - @ManagerMapping(value = "/{clientMoniker}/export/letter_of_offer_pdf", method = RequestMethod.GET, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR}) - public void exportLetterOfferPDF(@PathVariable String clientMoniker,HttpServletResponse response){ - clientManager.exportLetterOfferPDF(clientMoniker,response); - } - - /** - * 下载商户Promotional Offer pdf文件 - * - * @param clientMoniker - */ - @ManagerMapping(value = "/{clientMoniker}/export/promotional_offer_pdf", method = RequestMethod.GET, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR}) - public void exportPromotionalOfferPDF(@PathVariable String clientMoniker, @RequestParam("date")String date, HttpServletResponse response){ - clientManager.exportPromotionalOfferPDF(clientMoniker,date,response); - } - - /** - * 下载Terms Conditions pdf文件 - * - * @param clientMoniker - */ - @ManagerMapping(value = "/{clientMoniker}/export/terms_conditions_pdf", method = RequestMethod.GET, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR}) - public void exportTermsConditionsPDF(@PathVariable String clientMoniker,HttpServletResponse response){ - clientManager.exportTermsConditionsPDF(clientMoniker,response); - } } diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 0bde059ef..b57b9f590 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -68,6 +68,11 @@ app: tax: type: GST +client_card: + account_reserve: 1000 + annual_rate: 0 + + apple: message: apns: @@ -153,6 +158,12 @@ spring: port: 6379 thymeleaf: mode: HTML +logging: + level: + au: + com: + royalpay: + payment: debug diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientFilesMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientFilesMapper.xml index 2fec0585a..e2914bf54 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientFilesMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientFilesMapper.xml @@ -19,6 +19,14 @@ and file_name = 'source_agree_file' order by last_update_date desc limit 1 + + + + +
' + + ' 请输入活动周期: '); + var choises = [{label: '取消', className: 'btn-danger', key: '2', dismiss: true}, + {label: '确认提交', className: 'btn-success', key: '1'}]; + var content = ''; + $scope.showCardPromotionaBg = true; + commonDialog.confirm({ + title: title, + content: content, + choises: choises, + contentHtml: contentHtml + }).then(function (res) { + if(params != null){ + $http.get('/sys/partners/' + $scope.partner.client_moniker + '/export/aggregate/card_promotiona_agree_pdf').then(function () { + commonDialog.alert({ + title: 'Success', + content: 'Agreement File Generate Succeed! Please notify BD!', + type: 'success' + }); + $scope.showCardPromotionaBg = false; + $state.reload(); + }, function (resp) { + $scope.showCardPromotionaBg = false; + $state.reload(); + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); + }); + } + }); + + } + $scope.Export = function () { var url = '/dev/' + $scope.partner.client_moniker + '/export/aggregate/agreepdf'; return url; @@ -681,6 +750,33 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter } } }; + + $scope.uploadCardAgreeFile = function (file) { + if (file != null) { + if (file.size > 2 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB,请压缩后重试', type: 'error'}) + } else { + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + $scope.agree_file_import = resp.data.url; + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/import/agreepdf', {source_agree_file: $scope.agree_file_import}).then(function () { + commonDialog.alert({ + title: 'Success', + content: 'Succeed Imported! Please notify BD', + type: 'success' + }); + $state.reload(); + }, function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); + }) + }, function (resp) { + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }) + } + } + }; $scope.notifyBD = function () { $http.get('/sys/partners/' + $scope.partner.client_moniker + '/notify/completeAgree').then(function () { commonDialog.alert({ @@ -694,6 +790,19 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter }); }; + $scope.cardNotifyBD = function () { + $http.get('/sys/partners/' + $scope.partner.client_moniker + '/notify/cardCompleteAgree').then(function () { + commonDialog.alert({ + title: 'Success', + content: 'Notify BD Successed!.', + type: 'success' + }); + $state.reload(); + }, function (resp) { + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}); + }); + }; + $scope.downTempPdf = function () { var url = '/sys/partners/' + $scope.partner.client_moniker + '/temp/export/pdf'; return url; @@ -779,6 +888,30 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter } }) }; + + $scope.commitToCardCompliance = function(){ + commonDialog.confirm({ + title: 'Commit to Compliance', + content: 'Are you sure to commit ' + $scope.partner.company_name + ' to compliance?', + choises: [ + {label: 'Submit', className: 'btn-success', key: 1}, + {label: 'Cancel', className: 'btn-warning', key: 0, dismiss: true} + ] + }).then(function (choice) { + if (choice == 1) { + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/to_card_compliance', {}).then(function () { + commonDialog.alert({ + title: 'Success', + content: 'Commit to Compliance successfully', + type: 'success' + }); + $state.reload(); + }, function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); + }) + } + }) + } $scope.apply2makeAgreeFile = function () { $http.get('/sys/partners/' + $scope.partner.client_moniker + '/make_agree_file').then(function () { commonDialog.alert({ diff --git a/src/main/ui/static/payment/partner/templates/partner_detail.html b/src/main/ui/static/payment/partner/templates/partner_detail.html index c043063a9..7c83452cd 100644 --- a/src/main/ui/static/payment/partner/templates/partner_detail.html +++ b/src/main/ui/static/payment/partner/templates/partner_detail.html @@ -60,188 +60,178 @@
-
-
-

Compliance (Refused - :{{partner.refuse_remark}}) - (The Partner Using Green Channel Now!) - 【目前状态】- - - (自助申请)资料完善中 - (自助申请)已开通 - (自助申请)快速开通等待提交合规材料 - (自助申请)待审核(材料已提交) - - - 资料完善中 - 待审核(合同制作中) - 合同制作完成 - BD处理中 - 待审核(合规文件已提交) - 通过 - 不通过 - 绿色通道申请中 - - (已禁用) -

- -
-
-
- - - - 制作临时合同 - - 制作全支付合同 - - 上传合同 (通用合同请选择制作合同,非通用合同模板请人工制作合同后上传) -
-
- - -
-
- -
- 下载合同 - - - Notify BD - -
-
- - - - - - -
- -
- -
-
- - -
- - -
-
-
-
-
-
-
-
-

- - RP Operation - (Refused - :{{partner.refuse_remark}} - )(The Partner Using Green Channel Now!) - 【目前状态】- - 资料完善中 - 待审核(合同制作中) - 合同制作完成 - BD处理中 - 待审核(合规文件已提交) - 通过 - 不通过 - 绿色通道申请中 -

-
-
- - 下载合同 -
- -
-
- -
-
- -
-
-
- - - - - - -
- -
- -
-
- - -
- - -
-
-
-
-
-
-
-
-

Solved

-
-
-
Make sure you have send the email to client.
-
- -
-
-
+
+
+

Compliance (Refused + :{{partner.refuse_remark}}) + (The Partner Using Green Channel Now!) + 【目前状态】- + + (自助申请)资料完善中 + (自助申请)已开通 + (自助申请)快速开通等待提交合规材料 + (自助申请)待审核(材料已提交) + + + 资料完善中 + 待审核(合同制作中) + 合同制作完成 + BD处理中 + 待审核(合规文件已提交) + 通过 + 不通过 + 绿色通道申请中 + + (已禁用) +

+ +
+
+
+ + + + 制作临时合同 + + 制作全支付合同 + + 上传合同 (通用合同请选择制作合同,非通用合同模板请人工制作合同后上传) +
+
+ + + +
+
+ +
+ 下载合同 + + + Notify BD + +
+
+ + + + + + +
+ +
+ +
+
+ + +
+ + +
+
+
+
+
+
+
+
+

+ + Operation + (Refused + :{{partner.refuse_remark}} + )(The Partner Using Green Channel Now!) + 【目前状态】- + 资料完善中 + 待审核(合同制作中) + 合同制作完成 + BD处理中 + 待审核(合规文件已提交) + 通过 + 不通过 + 绿色通道申请中 +

+
+
+ + 下载合同 +
+ +
+
+ +
+
+ +
+
+
+ + + + + + +
+ +
+ +
+
+ + +
+ + +
+
+
+
+
+
@@ -277,29 +267,35 @@
-
+
- - 制作全支付合同 - - 上传合同 (通用合同请选择制作合同,非通用合同模板请人工制作合同后上传) + + 制作卡支付合同 + + 制作促销合同
+
-
- 下载合同 + 下载Letter Of Offer合同 + 下载Terms And Conditions合同 + 下载Promotional Offer合同 + ng-click="cardNotifyBD()"> Notify BD
@@ -329,9 +325,9 @@
+ ng-class="{'box-warning':partner.card_flow_info.approve_result!=5,'box-danger':partner.card_flow_info.approve_result==5}">
-

Card Payment Operation +

Operation (Refused :{{partner.card_flow_info.refuse_remark}} )

- - 下载合同 + 下载Letter Of Offer合同 + 下载Terms And Conditions合同 + 下载Promotional Offer合同
-
+
- -
+ + +

Solved

@@ -1293,7 +1307,7 @@
diff --git a/src/main/ui/static/payment/partner/templates/partner_payment_info.html b/src/main/ui/static/payment/partner/templates/partner_payment_info.html index aff94a22e..6d9aff34c 100644 --- a/src/main/ui/static/payment/partner/templates/partner_payment_info.html +++ b/src/main/ui/static/payment/partner/templates/partner_payment_info.html @@ -490,7 +490,7 @@
-
+
Card Payment Config
diff --git a/src/main/ui/static/payment/partner/templates/partners.html b/src/main/ui/static/payment/partner/templates/partners.html index c6ca05969..cd0e03ebc 100644 --- a/src/main/ui/static/payment/partner/templates/partners.html +++ b/src/main/ui/static/payment/partner/templates/partners.html @@ -503,7 +503,7 @@ 等待合规
- 等待BD上传材料审核 + 资料完善中
@@ -511,7 +511,7 @@ 资料完善中 (自助开通)资料完善中 不通过({{partner.card_approve_flow_info.approve_time}}) - 申请打回({{partner.card_approve_flow_info.refuse_remark|limitTo:15}}) + 申请打回({{partner.card_approve_flow_info.refuse_remark|limitTo:15}}) 等待合规 合同制作完成 等待BD上传材料审核