From 39e44c076d88018a5ef55c1920eae71ecc63a7c8 Mon Sep 17 00:00:00 2001 From: yixian Date: Wed, 17 Oct 2018 14:25:44 +0800 Subject: [PATCH 1/4] ABAfile comment update --- .../clearing/core/impl/CleanServiceImpl.java | 4 ++-- .../payment/manage/support/abafile/ABAFile.java | 10 ++++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/management/clearing/core/impl/CleanServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/management/clearing/core/impl/CleanServiceImpl.java index 5c3cbaea3..e4e9e4e11 100644 --- a/src/main/java/au/com/royalpay/payment/manage/management/clearing/core/impl/CleanServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/management/clearing/core/impl/CleanServiceImpl.java @@ -515,7 +515,7 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider if (settle.getBigDecimal("clearing_amount").compareTo(BigDecimal.ZERO) == 0) { continue; } - aba.addSettleMerchant(settle.getString("bsb_no"), settle.getString("account_no"), settle.getString("account_name"), + aba.addSettleMerchant(settle.getString("client_moniker"), settle.getString("bsb_no"), settle.getString("account_no"), settle.getString("account_name"), settle.getBigDecimal("clearing_amount")); } return aba; @@ -1016,7 +1016,7 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider // String mailId = mailService.sendEmail(title, "164851225@qq.com", "1029811920@qq.com", content, // attachList); JSONObject config = sysConfigManager.getSysConfig(); - String mailId = mailService.sendEmail(title, config.getString("settle_mail_to"),config.getString("settle_mail_cc"), content, attachList); + String mailId = mailService.sendEmail(title, config.getString("settle_mail_to"), config.getString("settle_mail_cc"), content, attachList); if (settleMail == null) { JSONObject settleMailRecord = new JSONObject(); diff --git a/src/main/java/au/com/royalpay/payment/manage/support/abafile/ABAFile.java b/src/main/java/au/com/royalpay/payment/manage/support/abafile/ABAFile.java index 24ccab615..5e893936b 100644 --- a/src/main/java/au/com/royalpay/payment/manage/support/abafile/ABAFile.java +++ b/src/main/java/au/com/royalpay/payment/manage/support/abafile/ABAFile.java @@ -29,8 +29,8 @@ public class ABAFile { totalSettleAmount = BigDecimal.ZERO; } - public void addSettleMerchant(String bsbNo, String accountNo, String accountName, BigDecimal settleAmount) { - settlements.add(new SettleMerchantInfo(bsbNo, accountNo, accountName, settleAmount)); + public void addSettleMerchant(String clientMoniker, String bsbNo, String accountNo, String accountName, BigDecimal settleAmount) { + settlements.add(new SettleMerchantInfo(clientMoniker, bsbNo, accountNo, accountName, settleAmount)); totalSettleAmount = totalSettleAmount.add(settleAmount); } @@ -129,12 +129,14 @@ public class ABAFile { } private class SettleMerchantInfo { + private final String clientMoniker; private final String bsbNo; private final String accountNo; private final String accountName; private final BigDecimal settleAmount; - public SettleMerchantInfo(String bsbNo, String accountNo, String accountName, BigDecimal settleAmount) { + public SettleMerchantInfo(String clientMoniker, String bsbNo, String accountNo, String accountName, BigDecimal settleAmount) { + this.clientMoniker = clientMoniker; this.bsbNo = bsbNo; this.accountNo = accountNo.replaceAll("\\D", ""); this.accountName = accountName; @@ -149,7 +151,7 @@ public class ABAFile { lineBuilder.replace(18, 20, "50"); lineBuilder.replace(20, 30, getSettleAmount()); lineBuilder.replace(30, 62, getAccountName()); - lineBuilder.replace(62, 80, StringUtils.rightPad("RoyalPay" + DateFormatUtils.format(settleDate, "yyyyMMdd"), 18)); + lineBuilder.replace(62, 80, StringUtils.rightPad("RoyalPay" + DateFormatUtils.format(settleDate, "MMdd") + clientMoniker, 18)); lineBuilder.replace(80, 87, bsbNo(base.getBsb())); lineBuilder.replace(87, 96, StringUtils.leftPad(base.getAccountNo(), 9)); lineBuilder.replace(96, 112, StringUtils.left(StringUtils.rightPad(base.getAccountName(), 16), 16)); From 162f4a7ef4cb96d193e00e1b48712bea0d804ba2 Mon Sep 17 00:00:00 2001 From: luoyang Date: Wed, 17 Oct 2018 16:10:43 +0800 Subject: [PATCH 2/4] fix gatewayjs redirect --- .../templates/alipay/v1/gateway_jsapi.js | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/main/ui/static/templates/alipay/v1/gateway_jsapi.js b/src/main/ui/static/templates/alipay/v1/gateway_jsapi.js index 9f876394f..783ab09d6 100644 --- a/src/main/ui/static/templates/alipay/v1/gateway_jsapi.js +++ b/src/main/ui/static/templates/alipay/v1/gateway_jsapi.js @@ -10,12 +10,14 @@ $(document).ready(function () { alert('debug:origin redirect:' + window.redirect); } var redirect = window.redirect; - while (redirect.indexOf('://') < 0) { - redirect = decodeURIComponent(redirect); - if (redirect == window.redirect) { - break; - } - window.redirect = redirect; + if (window.redirect !=null) { + while (redirect.indexOf('://') < 0) { + redirect = decodeURIComponent(redirect); + if (redirect == window.redirect) { + break; + } + window.redirect = redirect; + } } } @@ -55,8 +57,9 @@ $(document).ready(function () { } else { // 如果没有注入则监听注入的事件 document.addEventListener('AlipayJSBridgeReady', function () { - callPayment(pay.trade_no); - }, false); + + }); + callPayment(pay.trade_no); } }, From dd34208113f6cc37220de6b7ad3b9ddc3d1b36f8 Mon Sep 17 00:00:00 2001 From: luoyang Date: Fri, 19 Oct 2018 16:10:38 +0800 Subject: [PATCH 3/4] fix servant --- .../manage/signin/core/impls/SignInAccountServiceImpl.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/signin/core/impls/SignInAccountServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/signin/core/impls/SignInAccountServiceImpl.java index 661e0b650..fd785877d 100644 --- a/src/main/java/au/com/royalpay/payment/manage/signin/core/impls/SignInAccountServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/signin/core/impls/SignInAccountServiceImpl.java @@ -120,7 +120,11 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati manager.put("module_names", modules.keySet()); if((manager.getIntValue("role")& ManagerRole.SERVANT.getMask())>0){ JSONObject cs = sysCustomerServiceMapper.findByManagerId(accountId); - manager.put("onoff",cs.getBoolean("onoff")); + if (cs != null) { + manager.put("onoff", cs.getBoolean("onoff")); + } else { + manager.put("onoff", false); + } } return manager; } From 8b813a0e516fccdc097188cc8e6a41c73b5266b0 Mon Sep 17 00:00:00 2001 From: "taylor.dang" Date: Tue, 23 Oct 2018 20:08:43 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E8=B4=B9=E7=8E=87=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=BB=B6=E6=9C=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mappers/system/ClientRateMapper.java | 4 ++ .../manage/merchants/core/ClientManager.java | 7 ++++ .../core/impls/ClientManagerImpl.java | 17 +++++++++ .../manage/task/PostponeClientTask.java | 19 +++++++++- .../mappers/system/ClientRateMapper.xml | 37 +++++++++++++++++++ 5 files changed, 83 insertions(+), 1 deletion(-) 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 b9e5ed634..3f245f99a 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 @@ -46,6 +46,10 @@ public interface ClientRateMapper { List getAllExpiry(@Param("expiry_date")Date expiry_date); + List getAllClientRateExpiryMerchants(); + + void postponeMerchantRateByClientId(int clientId); + JSONObject latestChannelCleanDays(@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 8bcca2a11..9589510d6 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 @@ -342,4 +342,11 @@ public interface ClientManager { void updateAllPartnerPassword(String clientMoniker, List emails); void postponeClientRate(Date now, Date yearTomorrow, String expireDate, JSONObject client); + + /** + * 根据商户之前的费率自动延期一年 + * + * @param clientId + */ + boolean postponeClientRate(int clientId, String clientMoniker,String nextYearExipryDate); } 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 f928885fd..fd3cd717d 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 @@ -4029,6 +4029,23 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid }); } + @Override + @Transactional + public boolean postponeClientRate(int clientId, String clientMoniker, String nextYearExipryDate) { + try { + clientRateMapper.postponeMerchantRateByClientId(clientId); + clientModifySupport.processClientConfigModify(new SwitchPermissionModify(null, clientMoniker, "tax_in_surcharge", false)); + List adminAccounts = clientAccountMapper.listAdminAccounts(clientId); + adminAccounts.forEach(o -> { + sendClientPostponeNotify(o, nextYearExipryDate); + }); + logger.error("[{}]费率自动延期成功", clientMoniker); + return true; + } catch (Exception e) { + logger.error("[{}]费率自动延期失败", clientMoniker); + return false; + } + } private TemplateMessage initClientMessage(JSONObject client, String newExpiryDate, String wechatOpenid, String templateId) { diff --git a/src/main/java/au/com/royalpay/payment/manage/task/PostponeClientTask.java b/src/main/java/au/com/royalpay/payment/manage/task/PostponeClientTask.java index c03a84d31..78bf834d3 100644 --- a/src/main/java/au/com/royalpay/payment/manage/task/PostponeClientTask.java +++ b/src/main/java/au/com/royalpay/payment/manage/task/PostponeClientTask.java @@ -69,6 +69,23 @@ public class PostponeClientTask { }); } + @Scheduled(cron = "0 30 6 * * ?") + private void postponeMerchantRate() { + synchronizedScheduler.executeProcess("manage_task:postponeMerchantRate", 120_000, () -> { + String nextYearExipryDate = DateFormatUtils.format(DateUtils.addYears(new Date(), 1), "yyyy-MM-dd"); + List expiryRateMerchants = clientRateMapper.getAllClientRateExpiryMerchants(); + StringBuilder merchantStrBuilder = new StringBuilder(); + expiryRateMerchants.forEach(merchant -> { + if (clientManager.postponeClientRate(merchant.getIntValue("client_id"), merchant.getString("client_moniker"),nextYearExipryDate)) { + merchantStrBuilder.append(merchant.getString("client_moniker")).append("、"); + } + }); + merchantStrBuilder.deleteCharAt(merchantStrBuilder.length() - 1); + sendComplianceNotify(merchantStrBuilder, nextYearExipryDate); + }); + } + + private void sendComplianceNotify(StringBuilder sb, String newExpireDate) { List compliance = managerMapper.listOpenIdsOfCompliances(); compliance.forEach(p -> { @@ -76,8 +93,8 @@ public class PostponeClientTask { TemplateMessage notice = initComplianceMessage(sb.toString(), newExpireDate, p, api.getTemplateId("client-postpone")); api.sendTemplateMessage(notice); }); - } + private TemplateMessage initComplianceMessage(String clients, String newExpiryDate, String wechatOpenid, String templateId) { TemplateMessage notice = new TemplateMessage(wechatOpenid, templateId, null); notice.put("first", "以下商户据合同费率已经自动延期1年", "#ff0000"); diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientRateMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientRateMapper.xml index 545d64bdc..27bd6b82e 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientRateMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientRateMapper.xml @@ -119,6 +119,43 @@ a.expiry_time < #{expiry_date} ]]> + + + INSERT sys_client_rates (manager_id, client_id, rate_name, rate_value, transaction_fee, active_time, expiry_time, create_time, update_time, manager_name, clean_days, remark) + SELECT CONCAT('System-', CURRENT_DATE()),r.client_id,r.rate_name,r.rate_value,r.transaction_fee,DATE_ADD(r.expiry_time, INTERVAL 1 day),DATE_ADD(r.expiry_time, INTERVAL 1 year),NOW(), NOW(), + CONCAT('System-', CURRENT_DATE()),r.clean_days,'费率自动延期一年' + FROM sys_clients c + LEFT JOIN sys_client_rates r ON r.client_id = c.client_id + WHERE c.client_id = #{clientId} AND c.skip_clearing = 0 AND (c.approve_result = 1 OR (c.approve_result = 2 AND (c.source = 1 OR c.source = 2))) + AND c.is_valid = 1 AND (r.expiry_time = (SELECT MAX(expiry_time)FROM sys_client_rates r3 + WHERE r3.client_id = c.client_id + AND r3.rate_name = r.rate_name) + AND CURRENT_DATE() >= r.expiry_time + OR r.client_rate_id IS NULL) +