From 69bd35bb1b38b7928f8aa70a0aef45c74641de29 Mon Sep 17 00:00:00 2001 From: eason Date: Fri, 22 Jun 2018 15:56:35 +0800 Subject: [PATCH 01/23] fix color --- .../analysis/core/impls/AreaMerchantTradeAnalysisImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/AreaMerchantTradeAnalysisImpl.java b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/AreaMerchantTradeAnalysisImpl.java index 704a82249..22f4b26be 100644 --- a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/AreaMerchantTradeAnalysisImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/AreaMerchantTradeAnalysisImpl.java @@ -136,7 +136,7 @@ public class AreaMerchantTradeAnalysisImpl implements AreaMerchantTradeAnalysis{ HSSFFont font3 = workbook.createFont(); font3.setFontHeightInPoints((short) 12); font3.setBoldweight(HSSFFont.BOLDWEIGHT_NORMAL); - font3.setColor(HSSFColor.RED.index); + font3.setColor(HSSFColor.GREEN.index); style3.setFont(font3); HSSFCellStyle style4 = workbook.createCellStyle(); style4.setFillForegroundColor(HSSFColor.WHITE.index); @@ -149,7 +149,7 @@ public class AreaMerchantTradeAnalysisImpl implements AreaMerchantTradeAnalysis{ HSSFFont font4 = workbook.createFont(); font4.setFontHeightInPoints((short) 12); font4.setBoldweight(HSSFFont.BOLDWEIGHT_NORMAL); - font4.setColor(HSSFColor.GREEN.index); + font4.setColor(HSSFColor.RED.index); style4.setFont(font4); HSSFRow row0 = sheet.createRow(0); HSSFCell cell00 = row0.createCell(0); From 440cacb1943c041590f1e935b775570f5528e49d Mon Sep 17 00:00:00 2001 From: yuan <1551130722@qq.com> Date: Fri, 22 Jun 2018 17:15:57 +0800 Subject: [PATCH 02/23] fix bug --- .../core/impls/DashboardServiceImpl.java | 2 +- .../CustomerAndOrdersStatisticsMapper.java | 2 ++ .../CustomerAndOrdersStatisticsMapper.xml | 32 +++++++++++++++++++ 3 files changed, 35 insertions(+), 1 deletion(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/DashboardServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/DashboardServiceImpl.java index f6e07eeba..e5b6bb77a 100644 --- a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/DashboardServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/DashboardServiceImpl.java @@ -130,7 +130,7 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT } private JSONObject getYesOrLasMonth(JSONObject params){ JSONObject res = new JSONObject(); - res.put("traded_partners", clientCustomersMapper.countTradedClients(params)); + res.put("traded_partners", customerAndOrdersStatisticsMapper.countTradedClients(params)); res.put("total_customers", clientCustomersMapper.countTotalCustomers(params)); res.put("old_customers", clientCustomersMapper.countTotalOldCustomers(params)); return res; diff --git a/src/main/java/au/com/royalpay/payment/manage/analysis/mappers/CustomerAndOrdersStatisticsMapper.java b/src/main/java/au/com/royalpay/payment/manage/analysis/mappers/CustomerAndOrdersStatisticsMapper.java index 752d8a4f0..a88d66264 100644 --- a/src/main/java/au/com/royalpay/payment/manage/analysis/mappers/CustomerAndOrdersStatisticsMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/analysis/mappers/CustomerAndOrdersStatisticsMapper.java @@ -55,4 +55,6 @@ public interface CustomerAndOrdersStatisticsMapper { List countTradedClientsByDate(JSONObject parasm); List getAreaMerchantTradeByLastCycle(JSONObject parasm); + + int countTradedClients(JSONObject params); } diff --git a/src/main/resources/au/com/royalpay/payment/manage/analysis/mappers/CustomerAndOrdersStatisticsMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/analysis/mappers/CustomerAndOrdersStatisticsMapper.xml index d97efacef..41964808b 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/analysis/mappers/CustomerAndOrdersStatisticsMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/analysis/mappers/CustomerAndOrdersStatisticsMapper.xml @@ -456,4 +456,36 @@ GROUP BY datelist ORDER BY datelist + + \ No newline at end of file From 6c5680f78e7895b88f1aad77cb46ecd8c7395401 Mon Sep 17 00:00:00 2001 From: yuan <1551130722@qq.com> Date: Mon, 25 Jun 2018 10:22:28 +0800 Subject: [PATCH 03/23] fix dashboard --- .../core/impls/DashboardServiceImpl.java | 4 +- .../CustomerAndOrdersStatisticsMapper.java | 4 ++ .../mappers/client/ClientCustomersMapper.java | 5 -- .../CustomerAndOrdersStatisticsMapper.xml | 66 ++++++++++++++++++- .../mappers/client/ClientCustomersMapper.xml | 38 ----------- 5 files changed, 71 insertions(+), 46 deletions(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/DashboardServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/DashboardServiceImpl.java index e5b6bb77a..04a1322c1 100644 --- a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/DashboardServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/DashboardServiceImpl.java @@ -131,8 +131,8 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT private JSONObject getYesOrLasMonth(JSONObject params){ JSONObject res = new JSONObject(); res.put("traded_partners", customerAndOrdersStatisticsMapper.countTradedClients(params)); - res.put("total_customers", clientCustomersMapper.countTotalCustomers(params)); - res.put("old_customers", clientCustomersMapper.countTotalOldCustomers(params)); + res.put("total_customers", customerAndOrdersStatisticsMapper.countTotalCustomers(params)); + res.put("old_customers", customerAndOrdersStatisticsMapper.countTotalOldCustomers(params)); return res; } diff --git a/src/main/java/au/com/royalpay/payment/manage/analysis/mappers/CustomerAndOrdersStatisticsMapper.java b/src/main/java/au/com/royalpay/payment/manage/analysis/mappers/CustomerAndOrdersStatisticsMapper.java index a88d66264..fdb90019a 100644 --- a/src/main/java/au/com/royalpay/payment/manage/analysis/mappers/CustomerAndOrdersStatisticsMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/analysis/mappers/CustomerAndOrdersStatisticsMapper.java @@ -57,4 +57,8 @@ public interface CustomerAndOrdersStatisticsMapper { List getAreaMerchantTradeByLastCycle(JSONObject parasm); int countTradedClients(JSONObject params); + + int countTotalCustomers(JSONObject params); + + int countTotalOldCustomers(JSONObject params); } diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/client/ClientCustomersMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/client/ClientCustomersMapper.java index a14fa2289..4fad42598 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/client/ClientCustomersMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/client/ClientCustomersMapper.java @@ -30,10 +30,5 @@ public interface ClientCustomersMapper { PageList listCustomerInfo(JSONObject params, PageBounds pageBounds); - int countTradedClients(JSONObject params); - - int countTotalCustomers(JSONObject params); - - int countTotalOldCustomers(JSONObject params); } diff --git a/src/main/resources/au/com/royalpay/payment/manage/analysis/mappers/CustomerAndOrdersStatisticsMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/analysis/mappers/CustomerAndOrdersStatisticsMapper.xml index 41964808b..8364cc935 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/analysis/mappers/CustomerAndOrdersStatisticsMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/analysis/mappers/CustomerAndOrdersStatisticsMapper.xml @@ -458,7 +458,7 @@ + + + + \ No newline at end of file diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/client/ClientCustomersMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/client/ClientCustomersMapper.xml index a7b8534b1..497e19d7a 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/mappers/client/ClientCustomersMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/client/ClientCustomersMapper.xml @@ -44,42 +44,4 @@ - - - - - \ No newline at end of file From a8e4f6ef33fdd0e62953d4803461c4f8682b8d03 Mon Sep 17 00:00:00 2001 From: eason Date: Mon, 25 Jun 2018 18:39:01 +0800 Subject: [PATCH 04/23] fix hf css --- src/main/ui/static/css/hf_gateway.css | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/ui/static/css/hf_gateway.css b/src/main/ui/static/css/hf_gateway.css index d366bda2f..3d39f2bfa 100644 --- a/src/main/ui/static/css/hf_gateway.css +++ b/src/main/ui/static/css/hf_gateway.css @@ -84,7 +84,7 @@ color: #434343; letter-spacing: 0px; padding-bottom: 10px; - padding-top: 20px; + padding-top: 15px; } .footer-bottom{ font-family: PingFangSC-Regular; @@ -97,6 +97,11 @@ margin-top: 100px; color: #444444; } + +.hf-warning{ + font-size: x-small; + color: #FF6600; +} /*成功页*/ .order-box .success-logo{ text-align: center; From c557a7f93982867a1a23ef50f9627aa0d121b193 Mon Sep 17 00:00:00 2001 From: eason Date: Mon, 25 Jun 2018 20:10:40 +0800 Subject: [PATCH 05/23] fix hf css --- src/main/ui/static/css/hf_gateway.css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/ui/static/css/hf_gateway.css b/src/main/ui/static/css/hf_gateway.css index 3d39f2bfa..ebc34860d 100644 --- a/src/main/ui/static/css/hf_gateway.css +++ b/src/main/ui/static/css/hf_gateway.css @@ -84,7 +84,7 @@ color: #434343; letter-spacing: 0px; padding-bottom: 10px; - padding-top: 15px; + padding-top: 20px; } .footer-bottom{ font-family: PingFangSC-Regular; @@ -94,7 +94,7 @@ } .footer-bottom-success{ - margin-top: 100px; + margin-top: 60px; color: #444444; } From 20addb778a9f1545fb190ef2fd02359f4d04888c Mon Sep 17 00:00:00 2001 From: yixian Date: Mon, 25 Jun 2018 20:23:18 +0800 Subject: [PATCH 06/23] display multi banks --- .../impls/AreaMerchantTradeAnalysisImpl.java | 7 +- .../core/impls/DashboardServiceImpl.java | 6 +- .../beans/AgentCommissionAnalysis.java | 19 +- .../beans/CityPartnerCommissionAnalysis.java | 18 +- .../beans/ReferrerCommissionAnalysis.java | 2 +- .../impls/XPlanFundConfigServiceImpl.java | 2 +- .../clearing/core/CleanService.java | 3 +- .../clearing/core/impl/CleanServiceImpl.java | 223 +++++++++--------- .../core/impl/SettleDelayConfigurerImpl.java | 2 +- .../core/impls/ActRedPackServiceImpl.java | 2 +- .../manage/support/abafile/ABAConfig.java | 111 +++++++++ .../manage/support/abafile/ABAFile.java | 68 ++++-- .../manage/support/abafile/ABATemplate.java | 27 +++ src/main/resources/application.properties | 17 ++ 14 files changed, 348 insertions(+), 159 deletions(-) create mode 100644 src/main/java/au/com/royalpay/payment/manage/support/abafile/ABAConfig.java create mode 100644 src/main/java/au/com/royalpay/payment/manage/support/abafile/ABATemplate.java diff --git a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/AreaMerchantTradeAnalysisImpl.java b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/AreaMerchantTradeAnalysisImpl.java index 22f4b26be..5f62099df 100644 --- a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/AreaMerchantTradeAnalysisImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/AreaMerchantTradeAnalysisImpl.java @@ -24,6 +24,7 @@ import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.io.OutputStream; import java.math.BigDecimal; +import java.math.RoundingMode; import java.text.NumberFormat; import java.util.Date; import java.util.List; @@ -259,7 +260,7 @@ public class AreaMerchantTradeAnalysisImpl implements AreaMerchantTradeAnalysis{ } } if(thisAmount.getBigDecimal("total").compareTo(BigDecimal.ZERO)>0 && thisAmount.getBigDecimal("old_total").compareTo(BigDecimal.ZERO)>0) { - lastTotal = (thisAmount.getBigDecimal("total").subtract(thisAmount.getBigDecimal("old_total"))).divide(thisAmount.getBigDecimal("old_total"), 4, BigDecimal.ROUND_HALF_UP); + lastTotal = (thisAmount.getBigDecimal("total").subtract(thisAmount.getBigDecimal("old_total"))).divide(thisAmount.getBigDecimal("old_total"), 4, RoundingMode.HALF_UP); } }else { if(thisAmount.getBigDecimal("total").compareTo(BigDecimal.ZERO) == 0){ @@ -274,7 +275,7 @@ public class AreaMerchantTradeAnalysisImpl implements AreaMerchantTradeAnalysis{ } } if(thisAmount.getBigDecimal("alipay_total").compareTo(BigDecimal.ZERO)>0 && thisAmount.getBigDecimal("old_alipay_total").compareTo(BigDecimal.ZERO)>0){ - alipayTotal = (thisAmount.getBigDecimal("alipay_total").subtract(thisAmount.getBigDecimal("old_alipay_total"))).divide(thisAmount.getBigDecimal("old_alipay_total"),4,BigDecimal.ROUND_HALF_UP); + alipayTotal = (thisAmount.getBigDecimal("alipay_total").subtract(thisAmount.getBigDecimal("old_alipay_total"))).divide(thisAmount.getBigDecimal("old_alipay_total"),4,RoundingMode.HALF_UP); } }else { if(thisAmount.getBigDecimal("alipay_total").compareTo(BigDecimal.ZERO) == 0){ @@ -290,7 +291,7 @@ public class AreaMerchantTradeAnalysisImpl implements AreaMerchantTradeAnalysis{ } } if(thisAmount.getBigDecimal("wechat_toatl").compareTo(BigDecimal.ZERO)>0 && thisAmount.getBigDecimal("old_wechat_toatl").compareTo(BigDecimal.ZERO)>0){ - wechatToatl = (thisAmount.getBigDecimal("wechat_toatl").subtract(thisAmount.getBigDecimal("old_wechat_toatl"))).divide(thisAmount.getBigDecimal("old_wechat_toatl"),4,BigDecimal.ROUND_HALF_UP); + wechatToatl = (thisAmount.getBigDecimal("wechat_toatl").subtract(thisAmount.getBigDecimal("old_wechat_toatl"))).divide(thisAmount.getBigDecimal("old_wechat_toatl"),4,RoundingMode.HALF_UP); } }else { if(thisAmount.getBigDecimal("wechat_toatl").compareTo(BigDecimal.ZERO) == 0){ diff --git a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/DashboardServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/DashboardServiceImpl.java index 04a1322c1..ce393d720 100644 --- a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/DashboardServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/DashboardServiceImpl.java @@ -303,9 +303,9 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT res.put("today",today); res.put("yes",yes); res.put("not_settled", new BigDecimal(transactionAnalysisMapper.analysisNotSettled(params))); - res.put("trade_amount_rise",yes.getBigDecimal("trade_amount").compareTo(BigDecimal.ZERO)>0 ? (today.getBigDecimal("trade_amount").subtract(yes.getBigDecimal("trade_amount"))).divide(yes.getBigDecimal("trade_amount"), 4, BigDecimal.ROUND_HALF_UP):BigDecimal.ZERO); - res.put("trade_count_rise", yes.getIntValue("trade_count") > 0 ? (today.getBigDecimal("trade_count").subtract(yes.getBigDecimal("trade_count"))).divide(yes.getBigDecimal("trade_count"), 4, BigDecimal.ROUND_HALF_UP) : 0); - res.put("customers_rise", yes.getIntValue("customers") > 0 ? (today.getBigDecimal("customers").subtract(yes.getBigDecimal("customers"))).divide(yes.getBigDecimal("customers"), 4, BigDecimal.ROUND_HALF_UP) : 0); + res.put("trade_amount_rise",yes.getBigDecimal("trade_amount").compareTo(BigDecimal.ZERO)>0 ? (today.getBigDecimal("trade_amount").subtract(yes.getBigDecimal("trade_amount"))).divide(yes.getBigDecimal("trade_amount"), 4, RoundingMode.HALF_UP):BigDecimal.ZERO); + res.put("trade_count_rise", yes.getIntValue("trade_count") > 0 ? (today.getBigDecimal("trade_count").subtract(yes.getBigDecimal("trade_count"))).divide(yes.getBigDecimal("trade_count"), 4, RoundingMode.HALF_UP) : 0); + res.put("customers_rise", yes.getIntValue("customers") > 0 ? (today.getBigDecimal("customers").subtract(yes.getBigDecimal("customers"))).divide(yes.getBigDecimal("customers"), 4, RoundingMode.HALF_UP) : 0); params.remove("begin"); params.remove("end"); List logs = transactionMapper.listSettlementLogTotal(params); diff --git a/src/main/java/au/com/royalpay/payment/manage/citypartner/beans/AgentCommissionAnalysis.java b/src/main/java/au/com/royalpay/payment/manage/citypartner/beans/AgentCommissionAnalysis.java index d6d98fc9c..353c549cf 100644 --- a/src/main/java/au/com/royalpay/payment/manage/citypartner/beans/AgentCommissionAnalysis.java +++ b/src/main/java/au/com/royalpay/payment/manage/citypartner/beans/AgentCommissionAnalysis.java @@ -5,6 +5,7 @@ import au.com.royalpay.payment.tools.CommonConsts; import com.alibaba.fastjson.JSONObject; import java.math.BigDecimal; +import java.math.RoundingMode; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; @@ -49,25 +50,25 @@ public class AgentCommissionAnalysis { Date tradeDate = dayAnalysis.getDate("trade_date"); BigDecimal grossAmount = dayAnalysis.getBigDecimal("total"); BigDecimal dayRate = dayAnalysis.getBigDecimal(channel+"_rate_value"); - BigDecimal agentCharge = grossAmount.multiply(dayRate.divide(CommonConsts.HUNDRED, 2, BigDecimal.ROUND_HALF_UP)); + BigDecimal agentCharge = grossAmount.multiply(dayRate.divide(CommonConsts.HUNDRED, 2, RoundingMode.HALF_UP)); BigDecimal orgCharge = BigDecimal.ZERO; BigDecimal orgNetCharge = BigDecimal.ZERO; switch (channel){ case "alipay": - orgCharge = grossAmount.multiply(org.getBigDecimal("alipay_rate_value").divide(CommonConsts.HUNDRED, 2, BigDecimal.ROUND_HALF_UP)); - orgNetCharge = orgCharge.subtract(grossAmount.multiply(parentOrg.getBigDecimal("alipay_rate_value").divide(CommonConsts.HUNDRED, 2, BigDecimal.ROUND_HALF_UP))); + orgCharge = grossAmount.multiply(org.getBigDecimal("alipay_rate_value").divide(CommonConsts.HUNDRED, 2, RoundingMode.HALF_UP)); + orgNetCharge = orgCharge.subtract(grossAmount.multiply(parentOrg.getBigDecimal("alipay_rate_value").divide(CommonConsts.HUNDRED, 2, RoundingMode.HALF_UP))); break; case "wechat": - orgCharge = grossAmount.multiply(org.getBigDecimal("wechat_rate_value").divide(CommonConsts.HUNDRED, 2, BigDecimal.ROUND_HALF_UP)); - orgNetCharge = orgCharge.subtract(grossAmount.multiply(parentOrg.getBigDecimal("wechat_rate_value").divide(CommonConsts.HUNDRED, 2, BigDecimal.ROUND_HALF_UP))); + orgCharge = grossAmount.multiply(org.getBigDecimal("wechat_rate_value").divide(CommonConsts.HUNDRED, 2, RoundingMode.HALF_UP)); + orgNetCharge = orgCharge.subtract(grossAmount.multiply(parentOrg.getBigDecimal("wechat_rate_value").divide(CommonConsts.HUNDRED, 2, RoundingMode.HALF_UP))); break; case "jd": - orgCharge = grossAmount.multiply(org.getBigDecimal("jd_rate_value").divide(CommonConsts.HUNDRED, 2, BigDecimal.ROUND_HALF_UP)); - orgNetCharge = orgCharge.subtract(grossAmount.multiply(parentOrg.getBigDecimal("jd_rate_value").divide(CommonConsts.HUNDRED, 2, BigDecimal.ROUND_HALF_UP))); + orgCharge = grossAmount.multiply(org.getBigDecimal("jd_rate_value").divide(CommonConsts.HUNDRED, 2, RoundingMode.HALF_UP)); + orgNetCharge = orgCharge.subtract(grossAmount.multiply(parentOrg.getBigDecimal("jd_rate_value").divide(CommonConsts.HUNDRED, 2, RoundingMode.HALF_UP))); break; case "alipayonline": - orgCharge = grossAmount.multiply(org.getBigDecimal("alipayonline_rate_value").divide(CommonConsts.HUNDRED, 2, BigDecimal.ROUND_HALF_UP)); - orgNetCharge = orgCharge.subtract(grossAmount.multiply(parentOrg.getBigDecimal("alipayonline_rate_value").divide(CommonConsts.HUNDRED, 2, BigDecimal.ROUND_HALF_UP))); + orgCharge = grossAmount.multiply(org.getBigDecimal("alipayonline_rate_value").divide(CommonConsts.HUNDRED, 2, RoundingMode.HALF_UP)); + orgNetCharge = orgCharge.subtract(grossAmount.multiply(parentOrg.getBigDecimal("alipayonline_rate_value").divide(CommonConsts.HUNDRED, 2, RoundingMode.HALF_UP))); break; default: break; diff --git a/src/main/java/au/com/royalpay/payment/manage/citypartner/beans/CityPartnerCommissionAnalysis.java b/src/main/java/au/com/royalpay/payment/manage/citypartner/beans/CityPartnerCommissionAnalysis.java index b026765bc..0f0a9133b 100644 --- a/src/main/java/au/com/royalpay/payment/manage/citypartner/beans/CityPartnerCommissionAnalysis.java +++ b/src/main/java/au/com/royalpay/payment/manage/citypartner/beans/CityPartnerCommissionAnalysis.java @@ -67,9 +67,9 @@ public class CityPartnerCommissionAnalysis { Date tradeDate = dayAnalysis.getDate("trade_date"); BigDecimal total = dayAnalysis.getBigDecimal("total"); BigDecimal dayRate = dayAnalysis.getBigDecimal(channel + "_rate_value"); - BigDecimal dayCharge = total.multiply(dayRate).divide(CommonConsts.HUNDRED, 2, BigDecimal.ROUND_HALF_UP); + BigDecimal dayCharge = total.multiply(dayRate).divide(CommonConsts.HUNDRED, 2, RoundingMode.HALF_UP); - BigDecimal royalpayCharge = total.multiply(rate).divide(CommonConsts.HUNDRED, 2, BigDecimal.ROUND_HALF_UP); + BigDecimal royalpayCharge = total.multiply(rate).divide(CommonConsts.HUNDRED, 2, RoundingMode.HALF_UP); BigDecimal thirdPartyPaymentCharge = getThirdPartyCharge(channel, total); BigDecimal netCharge = royalpayCharge.subtract(thirdPartyPaymentCharge); @@ -161,13 +161,13 @@ public class CityPartnerCommissionAnalysis { Date tradeDate = dayAnalysis.getDate("trade_date"); BigDecimal total = dayAnalysis.getBigDecimal("total"); BigDecimal dayRate = dayAnalysis.getBigDecimal(channel + "_rate_value"); - BigDecimal dayCharge = total.multiply(dayRate).divide(CommonConsts.HUNDRED, 2, BigDecimal.ROUND_HALF_UP); + BigDecimal dayCharge = total.multiply(dayRate).divide(CommonConsts.HUNDRED, 2, RoundingMode.HALF_UP); - BigDecimal royalpayCharge = total.multiply(rate).divide(CommonConsts.HUNDRED, 2, BigDecimal.ROUND_HALF_UP); + BigDecimal royalpayCharge = total.multiply(rate).divide(CommonConsts.HUNDRED, 2, RoundingMode.HALF_UP); BigDecimal thirdPartyPaymentCharge = getThirdPartyCharge(channel, total); BigDecimal netCharge = royalpayCharge.subtract(thirdPartyPaymentCharge); - BigDecimal orgCharge = netCharge.multiply(orgRate).divide(CommonConsts.HUNDRED, 2, BigDecimal.ROUND_HALF_UP); + BigDecimal orgCharge = netCharge.multiply(orgRate).divide(CommonConsts.HUNDRED, 2, RoundingMode.HALF_UP); totalGrossAmount = totalGrossAmount.add(total); totalChargeSum = totalChargeSum.add(dayCharge); totalRoyalPayCharge = totalRoyalPayCharge.add(royalpayCharge); @@ -216,16 +216,16 @@ public class CityPartnerCommissionAnalysis { BigDecimal thirdPartyPaymentCharge = BigDecimal.ZERO; switch (channel) { case "alipay": - thirdPartyPaymentCharge = total.multiply(alipayChargeRate).divide(CommonConsts.HUNDRED, 2, BigDecimal.ROUND_HALF_UP); + thirdPartyPaymentCharge = total.multiply(alipayChargeRate).divide(CommonConsts.HUNDRED, 2, RoundingMode.HALF_UP); break; case "wechat": - thirdPartyPaymentCharge = total.multiply(wechatChargeRate).divide(CommonConsts.HUNDRED, 2, BigDecimal.ROUND_HALF_UP); + thirdPartyPaymentCharge = total.multiply(wechatChargeRate).divide(CommonConsts.HUNDRED, 2, RoundingMode.HALF_UP); break; case "jd": - thirdPartyPaymentCharge = total.multiply(jdChargeRate).divide(CommonConsts.HUNDRED, 2, BigDecimal.ROUND_HALF_UP); + thirdPartyPaymentCharge = total.multiply(jdChargeRate).divide(CommonConsts.HUNDRED, 2, RoundingMode.HALF_UP); break; case "alipayonline": - thirdPartyPaymentCharge = total.multiply(alipayonlineChargeRate).divide(CommonConsts.HUNDRED, 2, BigDecimal.ROUND_HALF_UP); + thirdPartyPaymentCharge = total.multiply(alipayonlineChargeRate).divide(CommonConsts.HUNDRED, 2, RoundingMode.HALF_UP); break; default: break; diff --git a/src/main/java/au/com/royalpay/payment/manage/citypartner/beans/ReferrerCommissionAnalysis.java b/src/main/java/au/com/royalpay/payment/manage/citypartner/beans/ReferrerCommissionAnalysis.java index f3c71e8b6..af2bc0ea4 100644 --- a/src/main/java/au/com/royalpay/payment/manage/citypartner/beans/ReferrerCommissionAnalysis.java +++ b/src/main/java/au/com/royalpay/payment/manage/citypartner/beans/ReferrerCommissionAnalysis.java @@ -34,7 +34,7 @@ public class ReferrerCommissionAnalysis { } BigDecimal total = dayAnalysis.getBigDecimal("total"); - BigDecimal orgCharge = total.multiply(referrerRate).divide(CommonConsts.HUNDRED, 2, BigDecimal.ROUND_HALF_UP); + BigDecimal orgCharge = total.multiply(referrerRate).divide(CommonConsts.HUNDRED, 2, RoundingMode.HALF_UP); Date tradeDate = dayAnalysis.getDate("trade_date"); totalGrossAmount = totalGrossAmount.add(total); diff --git a/src/main/java/au/com/royalpay/payment/manage/fund/core/impls/XPlanFundConfigServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/fund/core/impls/XPlanFundConfigServiceImpl.java index 0b9453fac..826c05081 100644 --- a/src/main/java/au/com/royalpay/payment/manage/fund/core/impls/XPlanFundConfigServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/fund/core/impls/XPlanFundConfigServiceImpl.java @@ -113,7 +113,7 @@ public class XPlanFundConfigServiceImpl implements XPlanFundConfigService { } public static BigDecimal calculateInterest(BigDecimal interestRate, BigDecimal amount) { - return amount.multiply(interestRate.divide(CommonConsts.HUNDRED, 4, BigDecimal.ROUND_DOWN)).divide(BigDecimal.valueOf(365), 2, BigDecimal.ROUND_HALF_UP); + return amount.multiply(interestRate.divide(CommonConsts.HUNDRED, 4, BigDecimal.ROUND_DOWN)).divide(BigDecimal.valueOf(365), 2, RoundingMode.HALF_UP); } private JSONObject getClient(String clientMoniker) { diff --git a/src/main/java/au/com/royalpay/payment/manage/management/clearing/core/CleanService.java b/src/main/java/au/com/royalpay/payment/manage/management/clearing/core/CleanService.java index f4d0e7a41..097b8668a 100644 --- a/src/main/java/au/com/royalpay/payment/manage/management/clearing/core/CleanService.java +++ b/src/main/java/au/com/royalpay/payment/manage/management/clearing/core/CleanService.java @@ -1,5 +1,6 @@ package au.com.royalpay.payment.manage.management.clearing.core; +import au.com.royalpay.payment.manage.support.abafile.ABAFile; import au.com.royalpay.payment.manage.tradelog.beans.ClearingLogQuery; import com.alibaba.fastjson.JSONObject; import org.springframework.transaction.annotation.Transactional; @@ -44,7 +45,7 @@ public interface CleanService { List getXlsx(Date date) throws IOException; - List getAba(Date dt) throws IOException; + List getAba(Date dt, String bank) throws IOException; void settlementAba(Date date, HttpServletResponse response) throws IOException; 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 e5ee243f2..fd8336fd0 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 @@ -4,11 +4,7 @@ import au.com.royalpay.payment.core.PaymentApi; import au.com.royalpay.payment.core.exceptions.InvalidShortIdException; import au.com.royalpay.payment.core.tasksupport.SettlementSupport; import au.com.royalpay.payment.manage.management.clearing.core.CleanService; -import au.com.royalpay.payment.manage.mappers.log.ClearingDetailAnalysisMapper; -import au.com.royalpay.payment.manage.mappers.log.ClearingDetailMapper; -import au.com.royalpay.payment.manage.mappers.log.ClearingLogMapper; -import au.com.royalpay.payment.manage.mappers.log.LogSettleMailMapper; -import au.com.royalpay.payment.manage.mappers.log.ValidationLogMapper; +import au.com.royalpay.payment.manage.mappers.log.*; import au.com.royalpay.payment.manage.mappers.payment.TransactionMapper; import au.com.royalpay.payment.manage.mappers.system.CalendarMapper; import au.com.royalpay.payment.manage.mappers.system.ClientRateMapper; @@ -20,6 +16,7 @@ import au.com.royalpay.payment.manage.notice.core.MailService; import au.com.royalpay.payment.manage.signin.beans.TodoNotice; import au.com.royalpay.payment.manage.signin.core.ManagerTodoNoticeProvider; import au.com.royalpay.payment.manage.support.abafile.ABAFile; +import au.com.royalpay.payment.manage.support.abafile.ABATemplate; import au.com.royalpay.payment.manage.tradelog.beans.ClearingLogQuery; import au.com.royalpay.payment.tools.connections.mpsupport.MpWechatApi; import au.com.royalpay.payment.tools.connections.mpsupport.MpWechatApiProvider; @@ -34,14 +31,12 @@ import au.com.royalpay.payment.tools.permission.enums.ManagerRole; import au.com.royalpay.payment.tools.tasksupport.TaskFinishNotifyEvent; import au.com.royalpay.payment.tools.utils.PageListUtils; import au.com.royalpay.payment.tools.utils.TimeZoneUtils; - import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.github.miemiedev.mybatis.paginator.domain.Order; import com.github.miemiedev.mybatis.paginator.domain.PageBounds; import com.github.miemiedev.mybatis.paginator.domain.PageList; - import org.apache.commons.codec.binary.Base64; import org.apache.commons.csv.CSVFormat; import org.apache.commons.csv.CSVPrinter; @@ -50,12 +45,7 @@ import org.apache.commons.lang3.RandomStringUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.time.DateFormatUtils; import org.apache.commons.lang3.time.DateUtils; -import org.apache.poi.ss.usermodel.Cell; -import org.apache.poi.ss.usermodel.CellStyle; -import org.apache.poi.ss.usermodel.Font; -import org.apache.poi.ss.usermodel.Row; -import org.apache.poi.ss.usermodel.Sheet; -import org.apache.poi.ss.usermodel.Workbook; +import org.apache.poi.ss.usermodel.*; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.joda.time.DateTime; import org.joda.time.Days; @@ -72,13 +62,9 @@ import org.springframework.util.CollectionUtils; import org.thymeleaf.context.Context; import org.thymeleaf.spring4.SpringTemplateEngine; -import java.io.BufferedWriter; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.OutputStream; -import java.io.OutputStreamWriter; -import java.io.PrintWriter; -import java.io.Writer; +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.io.*; import java.math.BigDecimal; import java.math.RoundingMode; import java.net.URISyntaxException; @@ -90,9 +76,6 @@ import java.util.stream.Collectors; import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; -import javax.annotation.Resource; -import javax.servlet.http.HttpServletResponse; - import static au.com.royalpay.payment.manage.permission.utils.OrgCheckUtils.checkOrgPermission; /** @@ -145,7 +128,7 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider @Value("${app.redis.settle.check-code.prefix}") private String reidsCheckCodeKey; - private final String[] open_ids = { "o32MzuEeb5ZT_DJQYbzZf6VCu1HQ", "o32MzuIsa3OBOkvC9pL90h9pgHPg", "o32MzuCpqGQJTlvTK7VQ7m_LVXiQ" }; + private final String[] open_ids = {"o32MzuEeb5ZT_DJQYbzZf6VCu1HQ", "o32MzuIsa3OBOkvC9pL90h9pgHPg", "o32MzuCpqGQJTlvTK7VQ7m_LVXiQ"}; private ApplicationEventPublisher publisher; // private final String[] open_ids = { "o32MzuO4s8c7iFOVxnxejkbhMoEc" }; @@ -226,8 +209,22 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider addBigDecimal(total, log, "wechat_charge"); addBigDecimal(total, log, "royalpay_charge"); addBigDecimal(total, log, "net_amount"); - details.addAll(clearingDetailMapper.listReportsOfSettlement(log.getIntValue("clearing_id"))); + List logDetails = clearingDetailMapper.listReportsOfSettlement(log.getIntValue("clearing_id")); + details.addAll(logDetails); + List banks = logDetails.stream().map(detail -> detail.getString("settle_bank")).distinct().collect(Collectors.toList()); + List bankStatistics = banks.stream().map(bank -> { + JSONObject data = new JSONObject(); + data.put("bank", bank); + data.put("total_settle", logDetails.stream() + .filter(detail -> bank.equals(detail.getString("settle_bank"))) + .map(detail -> detail.getBigDecimal("net_amount")) + .reduce(BigDecimal::add) + ); + return data; + }).collect(Collectors.toList()); + log.put("bank_statistics", bankStatistics); } + total.put("logs", logs); total.put("details", details); List channels = clearingDetailAnalysisMapper.analysisChannelReportDaily(settleDate); total.put("channel_analysis", channels); @@ -260,7 +257,7 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider } @Override - public Map getDayAndChannelOfAnalysisMap(int detailId,String channel,JSONObject manager) { + public Map getDayAndChannelOfAnalysisMap(int detailId, String channel, JSONObject manager) { JSONObject cleanLog = clearingDetailMapper.findByDetailId(detailId); if (cleanLog == null) { throw new NotFoundException(); @@ -269,7 +266,7 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider Assert.notNull(client, "Client ID invalid"); checkOrgPermission(manager, client); - return getDayAnalysisMap(String.valueOf(detailId),channel,client); + return getDayAnalysisMap(String.valueOf(detailId), channel, client); } @Override @@ -378,34 +375,17 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider } @Override - public List getAba(Date dt) throws IOException { + public List getAba(Date dt, String bank) { List logs = clearingLogMapper.findByDate(dt); if (logs.isEmpty()) { throw new NotFoundException(); } - List result = new ArrayList<>(); - int index = 1; - if (logs.size() > 1) { - // todo email edit - for (JSONObject log : logs) { - JSONObject file = new JSONObject(); - List details = clearingDetailMapper.listReportsOfSettlement(log.getIntValue("clearing_id")); - String filename = "Merchant_Settlement_Info_" + DateFormatUtils.format(dt, "yyyyMMdd") + "_" + index + ".aba"; - file.put("name", filename); - file.put("byteArr", generateSettleAbaFile(dt, details, index++)); - result.add(file); - } - } else { - for (JSONObject log : logs) { - List details = clearingDetailMapper.listReportsOfSettlement(log.getIntValue("clearing_id")); - String filename = "Merchant_Settlement_Info_" + DateFormatUtils.format(dt, "yyyyMMdd") + ".aba"; - JSONObject file = new JSONObject(); - file.put("name", filename); - file.put("byteArr", generateSettleAbaFile(dt, details, index++)); - result.add(file); - } + List files = new ArrayList<>(); + for (JSONObject log : logs) { + List details = clearingDetailMapper.listReportsOfSettlement(log.getIntValue("clearing_id")); + files.addAll(generateSettleAbaFiles(dt, details, log.getDate("operate_time"))); } - return result; + return files.stream().filter(file -> bank.equals(file.bank())).collect(Collectors.toList()); } private byte[] generateSettleXlsxFile(Date dt, List settlements) throws IOException { @@ -434,34 +414,56 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider if (logs.isEmpty()) { throw new NotFoundException(); } - String zipName = "Merchant_Settlement_Info_" + DateFormatUtils.format(dt, "yyyyMMdd") + RandomStringUtils.random(8, false, true) + "_aba.zip"; - resp.setContentType("application/octet-stream;"); - resp.addHeader("Content-Disposition", "attachment; filename=" + zipName); - OutputStream ous = resp.getOutputStream(); - ZipOutputStream zos = new ZipOutputStream(ous); - int index = 1; + List files = new ArrayList<>(); + for (JSONObject log : logs) { - String dateString = DateFormatUtils.format(log.getDate("operate_time"), "yyyyMMddHHmmss"); - String filename = "Merchant_Settlement_Info_" + dateString + RandomStringUtils.random(8, false, true) + ".aba"; - zos.putNextEntry(new ZipEntry(filename)); List details = clearingDetailMapper.listReportsOfSettlement(log.getIntValue("clearing_id")); - byte[] file = generateSettleAbaFile(dt, details, index++); - IOUtils.write(file, zos); + files.addAll(generateSettleAbaFiles(dt, details, log.getDate("operate_time"))); } - zos.flush(); - IOUtils.closeQuietly(zos); + OutputStream ous = resp.getOutputStream(); + if (files.size() == 1) { + ABAFile file = files.get(0); + resp.setContentType("application/octet-stream;"); + resp.addHeader("Content-Disposition", "attachment; filename=" + file.filename()); + ous.write(file.output(1)); + ous.flush(); + IOUtils.closeQuietly(ous); + } else { + String zipName = "Merchant_Settlement_Info_" + DateFormatUtils.format(dt, "yyyyMMdd") + RandomStringUtils.random(8, false, true) + "_aba.zip"; + resp.setContentType("application/octet-stream;"); + resp.addHeader("Content-Disposition", "attachment; filename=" + zipName); + ZipOutputStream zos = new ZipOutputStream(ous); + Map bankCounts = new HashMap<>(); + for (ABAFile file : files) { + String filename = file.filename(); + zos.putNextEntry(new ZipEntry(filename)); + int serializeNo = bankCounts.get(file.bank()) == null ? 1 : bankCounts.get(file.bank()) + 1; + bankCounts.put(file.bank(), serializeNo); + IOUtils.write(file.output(serializeNo), zos); + } + zos.flush(); + IOUtils.closeQuietly(zos); + } + } + + private List generateSettleAbaFiles(Date dt, List settlements, Date operateTime) { + List banks = settlements.stream().map(detail -> detail.getString("settle_bank")).distinct().collect(Collectors.toList()); + return banks.stream().map(bank -> generateSettleAbaFile(bank, dt, settlements)).peek(file -> file.setOperateTime(operateTime)).collect(Collectors.toList()); } - private byte[] generateSettleAbaFile(Date dt, List settlements, int index) { - ABAFile aba = new ABAFile(dt, index); + private ABAFile generateSettleAbaFile(String bank, Date dt, List settlements) { + ABAFile aba = ABATemplate.getConfig().initFile(bank, dt); for (JSONObject settle : settlements) { + if (!bank.equals(settle.getString("settle_bank"))) { + continue; + } if (settle.getBigDecimal("clearing_amount").compareTo(BigDecimal.ZERO) == 0) { continue; } aba.addSettleMerchant(settle.getString("bsb_no"), settle.getString("account_no"), settle.getString("account_name"), settle.getBigDecimal("clearing_amount")); } - return aba.output(); + return aba; } private byte[] generateSettleCSVFile(Date settleDate, List details) throws IOException { @@ -474,12 +476,12 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider if (detail.getDoubleValue("clearing_amount") == 0) { continue; } - String grossAmount = detail.getBigDecimal("gross_amount").setScale(2, BigDecimal.ROUND_HALF_UP).toPlainString() + " @ " - + detail.getBigDecimal("rate").setScale(2, BigDecimal.ROUND_HALF_UP).toPlainString() + "%"; - String totalCharge = detail.getBigDecimal("total_charge").setScale(2, BigDecimal.ROUND_HALF_UP).toPlainString(); - String clearingAmount = detail.getBigDecimal("clearing_amount").setScale(2, BigDecimal.ROUND_HALF_UP).toPlainString(); - String[] values = { detail.getString("client_moniker"), "AUD", grossAmount, totalCharge, clearingAmount, detail.getString("bsb_no"), - detail.getString("account_no"), detail.getString("account_name"), settlementDate }; + String grossAmount = detail.getBigDecimal("gross_amount").setScale(2, RoundingMode.HALF_UP).toPlainString() + " @ " + + detail.getBigDecimal("rate").setScale(2, RoundingMode.HALF_UP).toPlainString() + "%"; + String totalCharge = detail.getBigDecimal("total_charge").setScale(2, RoundingMode.HALF_UP).toPlainString(); + String clearingAmount = detail.getBigDecimal("clearing_amount").setScale(2, RoundingMode.HALF_UP).toPlainString(); + String[] values = {detail.getString("client_moniker"), "AUD", grossAmount, totalCharge, clearingAmount, detail.getString("bsb_no"), + detail.getString("account_no"), detail.getString("account_name"), settlementDate}; csv.printRecord((Object[]) values); } csv.flush(); @@ -500,9 +502,9 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider BigDecimal.ROUND_HALF_DOWN); BigDecimal clearingAmount = transaction.getBigDecimal("clearing_amount").multiply(BigDecimal.valueOf(multiply)).setScale(2, BigDecimal.ROUND_HALF_DOWN); - String[] values = { transaction.getString("system_transaction_id"), transaction.getString("order_id"), transaction.getString("client_id"), + String[] values = {transaction.getString("system_transaction_id"), transaction.getString("order_id"), transaction.getString("client_id"), transaction.getString("device_id"), transaction.getString("transaction_currency"), transactionAmount.toPlainString(), - transaction.getString("clearing_currency"), clearingAmount.toPlainString(), transaction.getString("channel"), transactionTime, "0" }; + transaction.getString("clearing_currency"), clearingAmount.toPlainString(), transaction.getString("channel"), transactionTime, "0"}; csv.printRecord((Object[]) values); } csv.flush(); @@ -650,7 +652,7 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider String timezone_client = client.getString("timezone"); if (timezone_client != null) { transactions.parallelStream().forEach(p -> { - TimeZoneUtils.switchTimeZone(p, timezone_client, "transaction_time"); + TimeZoneUtils.switchTimeZone(p, timezone_client, "transaction_time"); }); } clearClient.put("report", transactions); @@ -665,7 +667,7 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider } @Override - public Map channelAndDayOfAnalysis(int client_id, String clearingDetailId,String channel,JSONObject partner) { + public Map channelAndDayOfAnalysis(int client_id, String clearingDetailId, String channel, JSONObject partner) { JSONObject client = clientManager.getClientInfo(client_id); Assert.notNull(client, "Client not exists"); int parent_client_id = client.getIntValue("parent_client_id"); @@ -673,15 +675,15 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider if (client_id != partner.getIntValue("client_id") && parent_client_id != partner.getIntValue("client_id")) { throw new ForbiddenException("No Permission"); } - return getDayAnalysisMap(clearingDetailId,channel,client); + return getDayAnalysisMap(clearingDetailId, channel, client); } - private Map getDayAnalysisMap(String clearingDetailId,String channel,JSONObject client){ + private Map getDayAnalysisMap(String clearingDetailId, String channel, JSONObject client) { List transactions = transactionMapper.listTransactionsOfClearingOrder(Integer.parseInt(clearingDetailId), new PageBounds(Order.formString("order_id.asc"))); String timezone_client = client.getString("timezone"); - if(!channel.equals("null")){ - transactions = transactions.stream().filter(t->t.getString("channel").equals(channel)).collect(Collectors.toList()); + if (!channel.equals("null")) { + transactions = transactions.stream().filter(t -> t.getString("channel").equals(channel)).collect(Collectors.toList()); } List dateKeysList = new ArrayList<>(); dateKeysList.add("transaction_time"); @@ -689,35 +691,36 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider transactions.parallelStream().forEach(p -> { TimeZoneUtils.switchTimeZone(p, timezone_client, "transaction_time"); }); - TimeZoneUtils.switchTimeZoneToString(transactions,timezone_client,TimeZoneUtils.PATTERN_DATE,dateKeysList); + TimeZoneUtils.switchTimeZoneToString(transactions, timezone_client, TimeZoneUtils.PATTERN_DATE, dateKeysList); } - Map> dayTransactionsMap = transactions.stream().collect(Collectors.groupingBy(x -> x.getString("transaction_time").substring(0,10))); - Map dayAnalysisMap = new TreeMap<>(); - for (Map.Entry> entry : dayTransactionsMap.entrySet()){ + Map> dayTransactionsMap = transactions.stream().collect(Collectors.groupingBy(x -> x.getString("transaction_time").substring(0, 10))); + Map dayAnalysisMap = new TreeMap<>(); + for (Map.Entry> entry : dayTransactionsMap.entrySet()) { JSONObject analysis = new JSONObject(); List transactionsOfDay = entry.getValue(); - BigDecimal total_credit = transactionsOfDay.stream().filter(t->t.getString("transaction_type").equals("Credit")).filter(t->t.containsKey("clearing_amount")).map(t-> t.getBigDecimal("clearing_amount")).reduce(BigDecimal.ZERO, BigDecimal::add); - BigDecimal total_debit = transactionsOfDay.stream().filter(t->t.getString("transaction_type").equals("Debit")).filter(t->t.containsKey("clearing_amount")).map(t-> t.getBigDecimal("clearing_amount")).reduce(BigDecimal.ZERO, BigDecimal::add); - BigDecimal total_charge_credit = transactionsOfDay.stream().filter(t->t.getString("transaction_type").equals("Credit")).filter(t->t.containsKey("total_surcharge")).map(t-> t.getBigDecimal("total_surcharge")).reduce(BigDecimal.ZERO, BigDecimal::add); - BigDecimal total_charge_debit = transactionsOfDay.stream().filter(t->t.getString("transaction_type").equals("Debit")).filter(t->t.containsKey("total_surcharge")).map(t-> t.getBigDecimal("total_surcharge")).reduce(BigDecimal.ZERO, BigDecimal::add); - BigDecimal net_amount_credit = transactionsOfDay.stream().filter(t->t.getString("transaction_type").equals("Credit")).filter(t->t.containsKey("settle_amount")).map(t-> t.getBigDecimal("settle_amount")).reduce(BigDecimal.ZERO, BigDecimal::add); - BigDecimal net_amount_debit = transactionsOfDay.stream().filter(t->t.getString("transaction_type").equals("Debit")).filter(t->t.containsKey("settle_amount")).map(t-> t.getBigDecimal("settle_amount")).reduce(BigDecimal.ZERO, BigDecimal::add); - BigDecimal tax_amount_credit = transactionsOfDay.stream().filter(t->t.getString("transaction_type").equals("Credit")).filter(t->t.containsKey("tax_amount")).map(t-> t.getBigDecimal("tax_amount")).reduce(BigDecimal.ZERO, BigDecimal::add); - BigDecimal tax_amount_debit = transactionsOfDay.stream().filter(t->t.getString("transaction_type").equals("Debit")).filter(t->t.containsKey("tax_amount")).map(t-> t.getBigDecimal("tax_amount")).reduce(BigDecimal.ZERO, BigDecimal::add); + BigDecimal total_credit = transactionsOfDay.stream().filter(t -> t.getString("transaction_type").equals("Credit")).filter(t -> t.containsKey("clearing_amount")).map(t -> t.getBigDecimal("clearing_amount")).reduce(BigDecimal.ZERO, BigDecimal::add); + BigDecimal total_debit = transactionsOfDay.stream().filter(t -> t.getString("transaction_type").equals("Debit")).filter(t -> t.containsKey("clearing_amount")).map(t -> t.getBigDecimal("clearing_amount")).reduce(BigDecimal.ZERO, BigDecimal::add); + BigDecimal total_charge_credit = transactionsOfDay.stream().filter(t -> t.getString("transaction_type").equals("Credit")).filter(t -> t.containsKey("total_surcharge")).map(t -> t.getBigDecimal("total_surcharge")).reduce(BigDecimal.ZERO, BigDecimal::add); + BigDecimal total_charge_debit = transactionsOfDay.stream().filter(t -> t.getString("transaction_type").equals("Debit")).filter(t -> t.containsKey("total_surcharge")).map(t -> t.getBigDecimal("total_surcharge")).reduce(BigDecimal.ZERO, BigDecimal::add); + BigDecimal net_amount_credit = transactionsOfDay.stream().filter(t -> t.getString("transaction_type").equals("Credit")).filter(t -> t.containsKey("settle_amount")).map(t -> t.getBigDecimal("settle_amount")).reduce(BigDecimal.ZERO, BigDecimal::add); + BigDecimal net_amount_debit = transactionsOfDay.stream().filter(t -> t.getString("transaction_type").equals("Debit")).filter(t -> t.containsKey("settle_amount")).map(t -> t.getBigDecimal("settle_amount")).reduce(BigDecimal.ZERO, BigDecimal::add); + BigDecimal tax_amount_credit = transactionsOfDay.stream().filter(t -> t.getString("transaction_type").equals("Credit")).filter(t -> t.containsKey("tax_amount")).map(t -> t.getBigDecimal("tax_amount")).reduce(BigDecimal.ZERO, BigDecimal::add); + BigDecimal tax_amount_debit = transactionsOfDay.stream().filter(t -> t.getString("transaction_type").equals("Debit")).filter(t -> t.containsKey("tax_amount")).map(t -> t.getBigDecimal("tax_amount")).reduce(BigDecimal.ZERO, BigDecimal::add); BigDecimal tax_amount = tax_amount_credit.subtract(tax_amount_debit); - analysis.put("total_credit",total_credit.setScale(2,BigDecimal.ROUND_HALF_UP)); - analysis.put("total_debit",total_debit.setScale(2,BigDecimal.ROUND_HALF_UP)); - analysis.put("net_amount",net_amount_credit.subtract(net_amount_debit).setScale(2,BigDecimal.ROUND_HALF_UP)); - analysis.put("tax_amount",tax_amount.setScale(2,BigDecimal.ROUND_HALF_UP)); - analysis.put("total_charge",total_charge_credit.subtract(total_charge_debit).add(tax_amount).setScale(2,BigDecimal.ROUND_HALF_UP)); - analysis.put("gross_amount",total_credit.subtract(total_debit).setScale(2,BigDecimal.ROUND_HALF_UP)); - dayAnalysisMap.put(entry.getKey(),analysis); + analysis.put("total_credit", total_credit.setScale(2, RoundingMode.HALF_UP)); + analysis.put("total_debit", total_debit.setScale(2, RoundingMode.HALF_UP)); + analysis.put("net_amount", net_amount_credit.subtract(net_amount_debit).setScale(2, RoundingMode.HALF_UP)); + analysis.put("tax_amount", tax_amount.setScale(2, RoundingMode.HALF_UP)); + analysis.put("total_charge", total_charge_credit.subtract(total_charge_debit).add(tax_amount).setScale(2, RoundingMode.HALF_UP)); + analysis.put("gross_amount", total_credit.subtract(total_debit).setScale(2, RoundingMode.HALF_UP)); + dayAnalysisMap.put(entry.getKey(), analysis); } return dayAnalysisMap; } + @Override public void exportListClearingTransactions(int client_id, String clearingDetailId, JSONObject partner, HttpServletResponse resp) { OutputStream ous = null; @@ -738,9 +741,9 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider Sheet sheet = wb.createSheet("Merchant_Settlement_Info_" + DateFormatUtils.format(reportDate, "yyyyMMdd")); int rowNum = 0; Row row = sheet.createRow(rowNum); - String[] title = { "order Id", "Client Order Id", "Transaction Time", "Channel", "Gateway", "Exchange Rate", "Transaction Type", "Currency", - "Input Amount", "Total Amount", "Clearing Amount", "Sruchange Rate", "Settle Amount", "Remark" }; - String[] analysis = { "Total Credit", "Total Debit", "Gross Amount", "Total Charge", "Net Amount" }; + String[] title = {"order Id", "Client Order Id", "Transaction Time", "Channel", "Gateway", "Exchange Rate", "Transaction Type", "Currency", + "Input Amount", "Total Amount", "Clearing Amount", "Sruchange Rate", "Settle Amount", "Remark"}; + String[] analysis = {"Total Credit", "Total Debit", "Gross Amount", "Total Charge", "Net Amount"}; for (int i = 0; i < title.length; i++) { row.createCell(i, Cell.CELL_TYPE_STRING).setCellValue(title[i]); } @@ -755,7 +758,7 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider row.createCell(0, Cell.CELL_TYPE_STRING).setCellValue(settle.getString("order_id")); row.createCell(1, Cell.CELL_TYPE_STRING).setCellValue(settle.getString("client_order_id")); Calendar calendar = (Calendar) settle.get("transaction_time"); - row.createCell(2, Cell.CELL_TYPE_STRING).setCellValue(DateFormatUtils.format(calendar, "yyyy-MM-dd HH:mm:ss",calendar.getTimeZone())); + row.createCell(2, Cell.CELL_TYPE_STRING).setCellValue(DateFormatUtils.format(calendar, "yyyy-MM-dd HH:mm:ss", calendar.getTimeZone())); row.createCell(3, Cell.CELL_TYPE_STRING).setCellValue(settle.getString("channel")); if (settle.getInteger("gateway") != null) { row.createCell(4, Cell.CELL_TYPE_STRING).setCellValue(TradeType.fromGatewayNumber(settle.getIntValue("gateway")).getTradeType()); @@ -937,15 +940,23 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider attachList.add(attach1); JSONObject attach2 = new JSONObject(); - List abaFileList = getAba(date); + List abaFileList = getAba(date, "CBA"); String fileName2 = "Merchant_Settlement_Info_aba_" + DateFormatUtils.format(date, "yyyyMMdd"); if (abaFileList.size() > 1) { fileName2 += ".zip"; - attach2.put("content", Base64.encodeBase64String(getZipByteArr(abaFileList))); + List entities = new ArrayList<>(); + int index = 0; + for (ABAFile file : abaFileList) { + JSONObject entity = new JSONObject(); + entity.put("name", file.filename()); + entity.put("byteArr", file.output(index++)); + entities.add(entity); + } + attach2.put("content", Base64.encodeBase64String(getZipByteArr(entities))); } else { fileName2 += ".aba"; - attach2.put("content", Base64.encodeBase64String((byte[]) abaFileList.get(0).get("byteArr"))); + attach2.put("content", Base64.encodeBase64String(abaFileList.get(0).output(1))); } attach2.put("name", fileName2); attachList.add(attach2); diff --git a/src/main/java/au/com/royalpay/payment/manage/management/clearing/core/impl/SettleDelayConfigurerImpl.java b/src/main/java/au/com/royalpay/payment/manage/management/clearing/core/impl/SettleDelayConfigurerImpl.java index 253071598..f791d1d1f 100644 --- a/src/main/java/au/com/royalpay/payment/manage/management/clearing/core/impl/SettleDelayConfigurerImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/management/clearing/core/impl/SettleDelayConfigurerImpl.java @@ -258,7 +258,7 @@ public class SettleDelayConfigurerImpl implements SettleDelayConfigurer { } totalSurcharge = totalSurcharge.add(surcharge); } - BigDecimal cashbackAmount = CurrencyAmountUtils.scale(totalSurcharge.multiply(attend.getBigDecimal("surcharge_discount")).divide(CommonConsts.HUNDRED, 2, BigDecimal.ROUND_HALF_UP), PlatformEnvironment.getEnv().getForeignCurrency()); + BigDecimal cashbackAmount = CurrencyAmountUtils.scale(totalSurcharge.multiply(attend.getBigDecimal("surcharge_discount")).divide(CommonConsts.HUNDRED, 2, RoundingMode.HALF_UP), PlatformEnvironment.getEnv().getForeignCurrency()); String remark = "Surcharge cashback for " + saturday.toString("dd/MMM/yyyy", Locale.ENGLISH) + " ~ " + sunday.toString("dd/MMM/yyyy", Locale.ENGLISH); if (cashbackAmount.compareTo(BigDecimal.ZERO) > 0) { cashbackService.saveSurchargeDiscountCashback(clientId, clientMoniker, transactionOrderId, cashbackAmount, date, remark); diff --git a/src/main/java/au/com/royalpay/payment/manage/redpack/core/impls/ActRedPackServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/redpack/core/impls/ActRedPackServiceImpl.java index c56780750..8b93b74b1 100644 --- a/src/main/java/au/com/royalpay/payment/manage/redpack/core/impls/ActRedPackServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/redpack/core/impls/ActRedPackServiceImpl.java @@ -119,7 +119,7 @@ public class ActRedPackServiceImpl implements ActRedPackService { if ("CNY".equals(currency)) { JSONObject income = transactionService.findIncomeByOrderId(orderId); BigDecimal exchange = income.getBigDecimal("exchange_rate"); - currencyAmount = exchange.multiply(currencyAmount).setScale(2, BigDecimal.ROUND_HALF_UP); + currencyAmount = exchange.multiply(currencyAmount).setScale(2, RoundingMode.HALF_UP); } if (ruleOrderTotal != null) { if (!(currencyAmount.compareTo(ruleOrderTotal) >= 0)) { diff --git a/src/main/java/au/com/royalpay/payment/manage/support/abafile/ABAConfig.java b/src/main/java/au/com/royalpay/payment/manage/support/abafile/ABAConfig.java new file mode 100644 index 000000000..37fff489b --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/support/abafile/ABAConfig.java @@ -0,0 +1,111 @@ +package au.com.royalpay.payment.manage.support.abafile; + +import au.com.royalpay.payment.tools.exceptions.BadRequestException; +import org.springframework.boot.context.properties.ConfigurationProperties; + +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +/** + * Create by yixian at 2018-06-25 17:39 + */ +@ConfigurationProperties("settle.abafile") +public class ABAConfig { + + private Map bank = new HashMap<>(); + private String defaultBank; + + public ABAFile initFile(String bank, Date settleDate) { + ABABase base = this.bank.get(bank); + if (base == null) { + throw new BadRequestException("Invalid bank:" + bank); + } + return base.initFile(settleDate); + } + + public String getDefaultBank() { + return defaultBank; + } + + public ABAConfig setDefaultBank(String defaultBank) { + this.defaultBank = defaultBank; + return this; + } + + public Map getBank() { + return bank; + } + + public ABAConfig setBank(Map bank) { + this.bank = bank; + return this; + } + + public static class ABABase { + private boolean manualSending = false; + private String bank; + private String apca; + private String bsb; + private String accountNo; + private String accountName; + + public ABAFile initFile(Date settleDate) { + return new ABAFile(this, settleDate); + } + + public boolean isManualSending() { + return manualSending; + } + + public ABABase setManualSending(boolean manualSending) { + this.manualSending = manualSending; + return this; + } + + public String getBank() { + return bank; + } + + public ABABase setBank(String bank) { + this.bank = bank; + return this; + } + + public String getApca() { + return apca; + } + + public ABABase setApca(String apca) { + this.apca = apca; + return this; + } + + public String getBsb() { + return bsb; + } + + public ABABase setBsb(String bsb) { + this.bsb = bsb; + return this; + } + + public String getAccountNo() { + return accountNo; + } + + public ABABase setAccountNo(String accountNo) { + this.accountNo = accountNo; + return this; + } + + public String getAccountName() { + return accountName; + } + + public ABABase setAccountName(String accountName) { + this.accountName = accountName; + return this; + } + } +} 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 e84458bb1..7c55303b1 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 @@ -15,21 +15,17 @@ import java.util.List; public class ABAFile { private final String baseLine = StringUtils.repeat(" ", 120); - private int sequenceNo = 1; - private String bank = "CBA"; - private String company = "Tunnel Show Pty Ltd"; - private String selfBSB = "063109"; - private String selfAccountNo = "11655861"; - private String apca = "301500"; + private final ABAConfig.ABABase base; private final Date settleDate; private List settlements; private BigDecimal totalSettleAmount; + private Date operateTime; - public ABAFile(Date settleDate, int index) { + public ABAFile(ABAConfig.ABABase base, Date settleDate) { + this.base = base; this.settleDate = settleDate; settlements = new ArrayList<>(); totalSettleAmount = BigDecimal.ZERO; - sequenceNo = index; } public void addSettleMerchant(String bsbNo, String accountNo, String accountName, BigDecimal settleAmount) { @@ -37,11 +33,19 @@ public class ABAFile { totalSettleAmount = totalSettleAmount.add(settleAmount); } - public byte[] output() { + public boolean manualSending() { + return base.isManualSending(); + } + + public String bank() { + return base.getBank(); + } + + public byte[] output(int serializeNo) { StringWriter out = new StringWriter(); PrintWriter writer = new PrintWriter(out); - writer.print(generateTopLine() + "\r\n"); + writer.print(generateTopLine(serializeNo) + "\r\n"); for (SettleMerchantInfo info : settlements) { String line = info.settleLine(); writer.print(line + "\r\n"); @@ -66,27 +70,27 @@ public class ABAFile { private String generateBalanceLine() { StringBuilder lineBuilder = new StringBuilder(baseLine); lineBuilder.replace(0, 1, "1"); - lineBuilder.replace(1, 8, bsbNo(selfBSB)); - lineBuilder.replace(8, 17, StringUtils.leftPad(selfAccountNo, 9)); + lineBuilder.replace(1, 8, bsbNo(base.getBsb())); + lineBuilder.replace(8, 17, StringUtils.leftPad(base.getAccountNo(), 9)); lineBuilder.replace(18, 20, "13"); lineBuilder.replace(20, 30, amountString(totalSettleAmount, 10)); - lineBuilder.replace(30, 62, StringUtils.rightPad(StringUtils.substring(company, 0, 32), 32)); + lineBuilder.replace(30, 62, StringUtils.rightPad(StringUtils.substring(base.getAccountName(), 0, 32), 32)); lineBuilder.replace(62, 80, StringUtils.rightPad(DateFormatUtils.format(settleDate, "yyyyMMdd"), 18)); - lineBuilder.replace(80, 87, bsbNo(selfBSB)); - lineBuilder.replace(87, 96, StringUtils.leftPad(selfAccountNo, 9)); - lineBuilder.replace(96, 112, StringUtils.left(StringUtils.rightPad(company, 16), 16)); + 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)); lineBuilder.replace(112, 120, StringUtils.leftPad("0", 8, "0")); return lineBuilder.toString(); } - private String generateTopLine() { + private String generateTopLine(int serializeNo) { StringBuilder topLineBuilder = new StringBuilder(baseLine); topLineBuilder.replace(0, 1, "0"); topLineBuilder.replace(18, 20, StringUtils.leftPad("1", 2, "0")); - Assert.isTrue(bank.length() == 3, "Invalid Bank Code:" + bank); - topLineBuilder.replace(20, 23, bank); - topLineBuilder.replace(30, 56, StringUtils.rightPad(company, 26)); - topLineBuilder.replace(56, 62, StringUtils.leftPad(apca, 6, "0")); + Assert.isTrue(base.getBank().length() == 3, "Invalid Bank Code:" + base.getBank()); + topLineBuilder.replace(20, 23, base.getBank()); + topLineBuilder.replace(30, 56, StringUtils.rightPad(base.getAccountName(), 26)); + topLineBuilder.replace(56, 62, StringUtils.leftPad(base.getApca(), 6, "0")); topLineBuilder.replace(62, 74, StringUtils.rightPad(DateFormatUtils.format(settleDate, "yyyyMMdd"), 12)); topLineBuilder.replace(74, 80, DateFormatUtils.format(settleDate, "ddMMyy")); return topLineBuilder.toString(); @@ -102,6 +106,22 @@ public class ABAFile { return StringUtils.leftPad("" + amount, size, "0"); } + public void setOperateTime(Date operateTime) { + this.operateTime = operateTime; + } + + public String getOperateTimeString() { + return operateTime == null ? "" : DateFormatUtils.format(operateTime, "yyyyMMddHHmmss"); + } + + public Date getOperateTime() { + return operateTime; + } + + public String filename() { + return "Merchant_Settlement_Info_" + bank() + "_" + getOperateTimeString() + ".aba"; + } + private class SettleMerchantInfo { private final String bsbNo; private final String accountNo; @@ -124,9 +144,9 @@ public class ABAFile { lineBuilder.replace(20, 30, getSettleAmount()); lineBuilder.replace(30, 62, getAccountName()); lineBuilder.replace(62, 80, StringUtils.rightPad("RoyalPay" + DateFormatUtils.format(settleDate, "yyyyMMdd"), 18)); - lineBuilder.replace(80, 87, bsbNo(selfBSB)); - lineBuilder.replace(87, 96, StringUtils.leftPad(selfAccountNo, 9)); - lineBuilder.replace(96, 112, StringUtils.left(StringUtils.rightPad(company, 16), 16)); + 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)); lineBuilder.replace(112, 120, StringUtils.leftPad("0", 8, "0")); return lineBuilder.toString(); } diff --git a/src/main/java/au/com/royalpay/payment/manage/support/abafile/ABATemplate.java b/src/main/java/au/com/royalpay/payment/manage/support/abafile/ABATemplate.java new file mode 100644 index 000000000..0a82a12bf --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/support/abafile/ABATemplate.java @@ -0,0 +1,27 @@ +package au.com.royalpay.payment.manage.support.abafile; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.stereotype.Component; + +import javax.annotation.PostConstruct; + +/** + * Create by yixian at 2018-06-25 17:16 + */ +@Component +@EnableConfigurationProperties(ABAConfig.class) +public class ABATemplate { + private static ABATemplate tpl; + @Autowired + private ABAConfig config; + + @PostConstruct + public void init() { + tpl = this; + } + + public static ABAConfig getConfig() { + return tpl.config; + } +} diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 456d70c5e..055ba877d 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -111,3 +111,20 @@ mail.mailgun.default.merchantlist=merchants@mail.royalpay.com.au ############## royalpay.sms.appid=1400094878 royalpay.sms.appkey=43390d81e20c5191c278fbf4cd275be2 + + +#清算银行配置 +settle.abafile.default-bank=CBA + +settle.abafile.bank.CBA.bank=CBA +settle.abafile.bank.CBA.apca=301500 +settle.abafile.bank.CBA.bsb=063109 +settle.abafile.bank.CBA.account-no=11655861 +settle.abafile.bank.CBA.account-name=Tunnel Show Pty Ltd + +settle.abafile.bank.ANZ.manual-sending=true +settle.abafile.bank.ANZ.bank=ANZ +settle.abafile.bank.ANZ.apca=514624 +settle.abafile.bank.ANZ.bsb=013006 +settle.abafile.bank.ANZ.account-no=837022519 +settle.abafile.bank.ANZ.account-name=Tunnel Show Pty Ltd \ No newline at end of file From 418a84b7bde39bd6aff7b060461fee4bde294cbd Mon Sep 17 00:00:00 2001 From: yuan <1551130722@qq.com> Date: Tue, 26 Jun 2018 10:42:55 +0800 Subject: [PATCH 07/23] fix invoice bug --- .../web/PartnerInvoiceController.java | 21 +++++++++++++++++-- .../ui/static/invoice/invoice_assistant.js | 6 ++++-- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/partnerinvoice/web/PartnerInvoiceController.java b/src/main/java/au/com/royalpay/payment/manage/partnerinvoice/web/PartnerInvoiceController.java index 24698d698..83d792f9c 100644 --- a/src/main/java/au/com/royalpay/payment/manage/partnerinvoice/web/PartnerInvoiceController.java +++ b/src/main/java/au/com/royalpay/payment/manage/partnerinvoice/web/PartnerInvoiceController.java @@ -1,9 +1,11 @@ package au.com.royalpay.payment.manage.partnerinvoice.web; +import au.com.royalpay.payment.manage.merchants.core.ClientManager; import au.com.royalpay.payment.manage.permission.manager.PartnerMapping; import au.com.royalpay.payment.manage.tradelog.beans.TradeLogQuery; import au.com.royalpay.payment.manage.tradelog.core.TradeLogService; import au.com.royalpay.payment.tools.CommonConsts; +import au.com.royalpay.payment.tools.exceptions.NotFoundException; import au.com.royalpay.payment.tools.permission.enums.PartnerRole; import com.alibaba.fastjson.JSONObject; import org.springframework.web.bind.annotation.*; @@ -21,13 +23,28 @@ public class PartnerInvoiceController { @Resource private TradeLogService tradeLogService; + @Resource + private ClientManager clientManager; + @PartnerMapping(value = "/trans_flow",method = RequestMethod.GET,roles = PartnerRole.ADMIN) public JSONObject listTransFlow(TradeLogQuery query,@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject partner) throws Exception { return tradeLogService.listPartnerTransFlowPage(query,partner); } @PartnerMapping(value = "/trans_flow/pdf", method = RequestMethod.GET,roles = PartnerRole.ADMIN) - public void exportTransFlowPDF(TradeLogQuery query,@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject partner, HttpServletResponse httpResponse) throws Exception { - tradeLogService.exportTransFlow(query,partner,httpResponse); + public void exportTransFlowPDF(TradeLogQuery query,HttpServletResponse httpResponse) throws Exception { + tradeLogService.exportTransFlow(query,getPartnerParams(query.getClient_ids()[0]),httpResponse); + } + + private JSONObject getPartnerParams(String client_id){ + JSONObject client = clientManager.getClientInfo(Integer.parseInt(client_id)); + if(client==null){ + throw new NotFoundException("Client Not Exists"); + } + JSONObject params = new JSONObject(); + params.put("client_id",client.getIntValue("client_id")); + params.put("client",client); + params.put("client_moniker",client.getString("client_moniker")); + return params; } } diff --git a/src/main/ui/static/invoice/invoice_assistant.js b/src/main/ui/static/invoice/invoice_assistant.js index b8332ca1a..239828ae3 100644 --- a/src/main/ui/static/invoice/invoice_assistant.js +++ b/src/main/ui/static/invoice/invoice_assistant.js @@ -12,13 +12,12 @@ define(['angular','decimal'], function (angular,decimal) { }) }]); app.controller('partnerInvoiceApp', ['$scope', '$http','$filter', 'commonDialog', function ($scope, $http,$filter, commonDialog) { - $scope.params = {channel:'ALL',clearing_status:-1}; + $scope.params = {channel:'ALL',clearing_status:-1,client_ids:[$scope.currentUser.client.client_id]}; $scope.today = new Date(); $scope.pagination = {}; $scope.today = new Date(); $scope.clients = [$scope.currentUser.client]; if ($scope.currentUser.client.has_children) { - $scope.params.client_ids = [$scope.currentUser.client.client_id]; $http.get('/client/partner_info/sub_partners').then(function (resp) { var clientList = resp.data; clientList.forEach(function (client) { @@ -126,6 +125,9 @@ define(['angular','decimal'], function (angular,decimal) { params.page = page || $scope.pagination.page || 1; url += connectSymbol + 'page=' + params.page; url+="&channel=ALL&clearing_status=-1"; + if(params.client_ids){ + url+=connectSymbol +'client_ids='+params.client_ids; + } return url; } From 0de03e2364ed25df938934c5a716d509548295ea Mon Sep 17 00:00:00 2001 From: yixian Date: Tue, 26 Jun 2018 10:48:47 +0800 Subject: [PATCH 08/23] distribute bank --- .../clearing/core/CleanService.java | 4 ++ .../clearing/core/impl/CleanServiceImpl.java | 58 +++++++++++++++++++ .../clearing/web/SettlementDevController.java | 42 ++++++++++++-- .../mappers/log/ClearingDetailMapper.java | 5 ++ .../manage/mappers/log/ClearingLogMapper.java | 10 +++- .../manage/support/abafile/ABAConfig.java | 22 ++++++- src/main/resources/application.properties | 1 + .../mappers/log/ClearingDetailMapper.xml | 3 + .../manage/mappers/log/ClearingLogMapper.xml | 3 + 9 files changed, 138 insertions(+), 10 deletions(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/management/clearing/core/CleanService.java b/src/main/java/au/com/royalpay/payment/manage/management/clearing/core/CleanService.java index 097b8668a..36a053966 100644 --- a/src/main/java/au/com/royalpay/payment/manage/management/clearing/core/CleanService.java +++ b/src/main/java/au/com/royalpay/payment/manage/management/clearing/core/CleanService.java @@ -84,4 +84,8 @@ public interface CleanService { JSONObject findLogSettleByDate(Date date); JSONObject validTransactions(Date dt, boolean fix, boolean b, boolean b1); + + void distributeBank(Date dt, int clearingId, JSONObject bankDistribution); + + void lockClearingLog(Date dt, int clearingId); } 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 fd8336fd0..0779043c8 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 @@ -15,6 +15,7 @@ import au.com.royalpay.payment.manage.merchants.core.ClientManager; import au.com.royalpay.payment.manage.notice.core.MailService; import au.com.royalpay.payment.manage.signin.beans.TodoNotice; import au.com.royalpay.payment.manage.signin.core.ManagerTodoNoticeProvider; +import au.com.royalpay.payment.manage.support.abafile.ABAConfig; import au.com.royalpay.payment.manage.support.abafile.ABAFile; import au.com.royalpay.payment.manage.support.abafile.ABATemplate; import au.com.royalpay.payment.manage.tradelog.beans.ClearingLogQuery; @@ -57,6 +58,7 @@ import org.springframework.context.ApplicationEventPublisherAware; import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.format.number.CurrencyStyleFormatter; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import org.springframework.util.Assert; import org.springframework.util.CollectionUtils; import org.thymeleaf.context.Context; @@ -223,6 +225,7 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider return data; }).collect(Collectors.toList()); log.put("bank_statistics", bankStatistics); + log.put("editable", DateUtils.isSameDay(log.getDate("settle_date"), new Date()) && log.getBooleanValue("editable")); } total.put("logs", logs); total.put("details", details); @@ -998,6 +1001,7 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider } } sendTaskFinishMessages(ManagerRole.FINANCIAL_STAFF, "清算文件已发送清算方", "发送清算通知"); + clearingLogMapper.lockSettlements(date); } catch (IOException e) { logger.error("生成excel字节数组发生错误"); } catch (URISyntaxException e) { @@ -1070,6 +1074,60 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider return report; } + @Override + @Transactional + public void distributeBank(Date date, int clearingId, JSONObject bankDistribution) { + if (!DateUtils.isSameDay(date, new Date())) { + throw new ForbiddenException("Only today's settlement file can be modified"); + } + JSONObject log = clearingLogMapper.findById(clearingId); + if (log == null || !DateUtils.isSameDay(log.getDate("settle_date"), date)) { + throw new NotFoundException("Settlement log not found"); + } + if (!log.getBooleanValue("editable")) { + throw new ForbiddenException("Settlement log has been sent and unable to edit"); + } + ABAConfig config = ABATemplate.getConfig(); + String defaultBank = config.getRemainsTo(); + clearingDetailMapper.updateAllBanks(defaultBank, clearingId); + List details = clearingDetailMapper.listReportsOfSettlement(clearingId); + details.sort((log1, log2) -> log2.getBigDecimal("clearing_amount").compareTo(log1.getBigDecimal("clearing_amount"))); + bankDistribution.remove(defaultBank); + for (String bank : bankDistribution.keySet()) { + List detailIds = new ArrayList<>(); + ABAConfig.ABABase base = config.getBankBase(bank); + if (base == null) { + throw new BadRequestException("Invalid bank code:" + bank); + } + BigDecimal bankAmount = bankDistribution.getBigDecimal(bank); + for (JSONObject detail : details) { + String detailBank = detail.getString("settle_bank"); + if (defaultBank.equals(detailBank)) { + BigDecimal amount = detail.getBigDecimal("clearing_amount"); + if (amount.compareTo(BigDecimal.ZERO) > 0 && bankAmount.compareTo(amount) > 0) { + detailIds.add(detail.getString("clear_detail_id")); + bankAmount = bankAmount.subtract(amount); + detail.put("settle_bank", bank); + } + } + } + clearingDetailMapper.updateBanks(bank, detailIds); + + } + } + + @Override + public void lockClearingLog(Date date, int clearingId) { + if (!DateUtils.isSameDay(date, new Date())) { + throw new ForbiddenException("Only today's settlement file can be modified"); + } + JSONObject log = clearingLogMapper.findById(clearingId); + if (log == null || !DateUtils.isSameDay(log.getDate("settle_date"), date)) { + throw new NotFoundException("Settlement log not found"); + } + clearingLogMapper.setLogEditable(false, clearingId); + } + private byte[] getZipByteArr(List fileByteArrWithName) throws IOException { ByteArrayOutputStream bos = new ByteArrayOutputStream(); ZipOutputStream zos = new ZipOutputStream(bos); diff --git a/src/main/java/au/com/royalpay/payment/manage/management/clearing/web/SettlementDevController.java b/src/main/java/au/com/royalpay/payment/manage/management/clearing/web/SettlementDevController.java index d07bb5ea7..74f00e973 100644 --- a/src/main/java/au/com/royalpay/payment/manage/management/clearing/web/SettlementDevController.java +++ b/src/main/java/au/com/royalpay/payment/manage/management/clearing/web/SettlementDevController.java @@ -2,6 +2,7 @@ package au.com.royalpay.payment.manage.management.clearing.web; import au.com.royalpay.payment.manage.management.clearing.core.CleanService; import au.com.royalpay.payment.manage.permission.manager.ManagerMapping; +import au.com.royalpay.payment.manage.support.abafile.ABATemplate; import au.com.royalpay.payment.tools.permission.enums.ManagerRole; import au.com.royalpay.payment.tools.CommonConsts; import au.com.royalpay.payment.tools.exceptions.BadRequestException; @@ -49,6 +50,35 @@ public class SettlementDevController { } } + @GetMapping("/available_banks") + public JSONObject getAvailableBanks() { + List banks = ABATemplate.getConfig().availableBanks(); + JSONObject res = new JSONObject(); + res.put("remains_to", ABATemplate.getConfig().getRemainsTo()); + res.put("banks", banks); + return res; + } + + @PutMapping("/reports/{date}/clearings/{clearingId}/bank_distribution") + public void modifyClearingBank(@PathVariable String date, @PathVariable int clearingId, @RequestBody JSONObject bankDistribution) { + try { + Date dt = dateFormat.parse(date); + cleanService.distributeBank(dt, clearingId, bankDistribution); + } catch (ParseException e) { + throw new BadRequestException("error.payment.valid.invalid_date_format"); + } + } + + @PutMapping("/reports/{date}/clearings/{clearingId}/lock") + public void lockClearingLog(@PathVariable String date,@PathVariable int clearingId){ + try { + Date dt = dateFormat.parse(date); + cleanService.lockClearingLog(dt, clearingId); + } catch (ParseException e) { + throw new BadRequestException("error.payment.valid.invalid_date_format"); + } + } + @RequestMapping("/reports/{date}/settlement_csv") public void getSettlementCsv(@PathVariable String date, HttpServletResponse resp) throws IOException { try { @@ -79,23 +109,23 @@ public class SettlementDevController { } } - @ManagerMapping(value = "/reports/{date}/send_settlement_xlsx/{checkCode}",role = {ManagerRole.FINANCIAL_STAFF}) + @ManagerMapping(value = "/reports/{date}/send_settlement_xlsx/{checkCode}", role = {ManagerRole.FINANCIAL_STAFF}) public JSONObject sendSettlementMail(@PathVariable("date") String date, @PathVariable("checkCode") String checkCode) { Date dt = null; try { dt = dateFormat.parse(date); } catch (ParseException e) { } - return cleanService.sendSettlementMail(dt,checkCode); + return cleanService.sendSettlementMail(dt, checkCode); } - @ManagerMapping(value = "/reports/send_checkcode",role = {ManagerRole.FINANCIAL_STAFF}) - public void sendCheckCode(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager){ - cleanService.sendCheckCode(new Date(),manager); + @ManagerMapping(value = "/reports/send_checkcode", role = {ManagerRole.FINANCIAL_STAFF}) + public void sendCheckCode(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { + cleanService.sendCheckCode(new Date(), manager); } @RequestMapping(value = "/reports/{date}/send_status") - public JSONObject sendStatus(@PathVariable String date){ + public JSONObject sendStatus(@PathVariable String date) { Date dt = null; try { dt = dateFormat.parse(date); diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/log/ClearingDetailMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/log/ClearingDetailMapper.java index b4542d52c..e37ac76e9 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/log/ClearingDetailMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/log/ClearingDetailMapper.java @@ -40,4 +40,9 @@ public interface ClearingDetailMapper { JSONObject listReportByDate(@Param("report_date") Date date, @Param("client_id") int clientId); PageList listClientSettlementLog(JSONObject params, PageBounds pagination); + + void updateAllBanks(@Param("settle_bank") String bank, @Param("clearing_id") int clearingId); + + @AutoSql(type = SqlType.UPDATE) + void updateBanks(@Param("settle_bank") String bank,@Param("clear_detail_id") List clearingDetailIds); } diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/log/ClearingLogMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/log/ClearingLogMapper.java index fa7395a18..ca402dab9 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/log/ClearingLogMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/log/ClearingLogMapper.java @@ -31,11 +31,19 @@ public interface ClearingLogMapper { @AutoSql(type = SqlType.UPDATE) void update(JSONObject update); - List getSettlementChannelsMonthReport(@Param("year") int year, @Param("month") int month); + List getSettlementChannelsMonthReport(@Param("year") int year, @Param("month") int month); List getMondayClearing(@Param("begin") Date begin, @Param("end") Date end); List getSettlementChannelsDailyReport(@Param("date") Date date); JSONObject getSettleDataDailyReport(@Param("date") Date date); + + void lockSettlements(@Param("date") Date date); + + @AutoSql(type = SqlType.SELECT) + JSONObject findById(@Param("clearing_id") int clearingId); + + @AutoSql(type = SqlType.UPDATE) + void setLogEditable(@Param("editable") boolean editable, @Param("clearing_id") int clearingId); } diff --git a/src/main/java/au/com/royalpay/payment/manage/support/abafile/ABAConfig.java b/src/main/java/au/com/royalpay/payment/manage/support/abafile/ABAConfig.java index 37fff489b..a7b70591f 100644 --- a/src/main/java/au/com/royalpay/payment/manage/support/abafile/ABAConfig.java +++ b/src/main/java/au/com/royalpay/payment/manage/support/abafile/ABAConfig.java @@ -3,9 +3,7 @@ package au.com.royalpay.payment.manage.support.abafile; import au.com.royalpay.payment.tools.exceptions.BadRequestException; import org.springframework.boot.context.properties.ConfigurationProperties; -import java.util.Date; -import java.util.HashMap; -import java.util.Map; +import java.util.*; /** * Create by yixian at 2018-06-25 17:39 @@ -15,6 +13,7 @@ public class ABAConfig { private Map bank = new HashMap<>(); private String defaultBank; + private String remainsTo; public ABAFile initFile(String bank, Date settleDate) { ABABase base = this.bank.get(bank); @@ -37,11 +36,28 @@ public class ABAConfig { return bank; } + public ABABase getBankBase(String bank) { + return this.bank.get(bank); + } + public ABAConfig setBank(Map bank) { this.bank = bank; return this; } + public String getRemainsTo() { + return remainsTo; + } + + public ABAConfig setRemainsTo(String remainsTo) { + this.remainsTo = remainsTo; + return this; + } + + public List availableBanks() { + return new ArrayList<>(bank.keySet()); + } + public static class ABABase { private boolean manualSending = false; private String bank; diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 055ba877d..4c7992c26 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -115,6 +115,7 @@ royalpay.sms.appkey=43390d81e20c5191c278fbf4cd275be2 #清算银行配置 settle.abafile.default-bank=CBA +settle.abafile.remains-to=ANZ settle.abafile.bank.CBA.bank=CBA settle.abafile.bank.CBA.apca=301500 diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/log/ClearingDetailMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/log/ClearingDetailMapper.xml index ef0029c88..76f5845c9 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/mappers/log/ClearingDetailMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/log/ClearingDetailMapper.xml @@ -1,6 +1,9 @@ + + update log_clearing_detail set settle_bank=#{bank} where clearing_id=#{clearing_id} + Date: Tue, 26 Jun 2018 12:37:02 +0800 Subject: [PATCH 09/23] settle log view edit --- .../core/impls/DashboardServiceImpl.java | 1 + .../beans/CityPartnerCommissionAnalysis.java | 1 + .../beans/ReferrerCommissionAnalysis.java | 1 + .../impls/XPlanFundConfigServiceImpl.java | 3 +- .../clearing/core/CleanService.java | 2 +- .../clearing/core/impl/CleanServiceImpl.java | 21 ++- .../core/impl/SettleDelayConfigurerImpl.java | 1 + .../core/impls/ActRedPackServiceImpl.java | 1 + src/main/ui/static/analysis/clearing-log.js | 176 ++++++++++++------ .../analysis/templates/settlement_detail.html | 93 +++++++-- 10 files changed, 210 insertions(+), 90 deletions(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/DashboardServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/DashboardServiceImpl.java index ce393d720..c9937503d 100644 --- a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/DashboardServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/DashboardServiceImpl.java @@ -27,6 +27,7 @@ import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.stereotype.Service; import java.math.BigDecimal; +import java.math.RoundingMode; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; diff --git a/src/main/java/au/com/royalpay/payment/manage/citypartner/beans/CityPartnerCommissionAnalysis.java b/src/main/java/au/com/royalpay/payment/manage/citypartner/beans/CityPartnerCommissionAnalysis.java index 0f0a9133b..ff589afc3 100644 --- a/src/main/java/au/com/royalpay/payment/manage/citypartner/beans/CityPartnerCommissionAnalysis.java +++ b/src/main/java/au/com/royalpay/payment/manage/citypartner/beans/CityPartnerCommissionAnalysis.java @@ -6,6 +6,7 @@ import au.com.royalpay.payment.tools.exceptions.ServerErrorException; import com.alibaba.fastjson.JSONObject; import java.math.BigDecimal; +import java.math.RoundingMode; import java.util.*; /** diff --git a/src/main/java/au/com/royalpay/payment/manage/citypartner/beans/ReferrerCommissionAnalysis.java b/src/main/java/au/com/royalpay/payment/manage/citypartner/beans/ReferrerCommissionAnalysis.java index af2bc0ea4..611b090a8 100644 --- a/src/main/java/au/com/royalpay/payment/manage/citypartner/beans/ReferrerCommissionAnalysis.java +++ b/src/main/java/au/com/royalpay/payment/manage/citypartner/beans/ReferrerCommissionAnalysis.java @@ -4,6 +4,7 @@ import au.com.royalpay.payment.tools.CommonConsts; import com.alibaba.fastjson.JSONObject; import java.math.BigDecimal; +import java.math.RoundingMode; import java.util.*; /** diff --git a/src/main/java/au/com/royalpay/payment/manage/fund/core/impls/XPlanFundConfigServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/fund/core/impls/XPlanFundConfigServiceImpl.java index 826c05081..56ee61c21 100644 --- a/src/main/java/au/com/royalpay/payment/manage/fund/core/impls/XPlanFundConfigServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/fund/core/impls/XPlanFundConfigServiceImpl.java @@ -24,6 +24,7 @@ import com.github.miemiedev.mybatis.paginator.domain.PageList; import org.springframework.stereotype.Service; import java.math.BigDecimal; +import java.math.RoundingMode; import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -118,10 +119,10 @@ public class XPlanFundConfigServiceImpl implements XPlanFundConfigService { private JSONObject getClient(String clientMoniker) { JSONObject client = clientManager.getClientInfoByMoniker(clientMoniker); - client.putAll(clientConfigService.find(client.getIntValue("client_id"))); if (client == null) { throw new InvalidShortIdException(); } + client.putAll(clientConfigService.find(client.getIntValue("client_id"))); return client; } diff --git a/src/main/java/au/com/royalpay/payment/manage/management/clearing/core/CleanService.java b/src/main/java/au/com/royalpay/payment/manage/management/clearing/core/CleanService.java index 36a053966..3fbe1e9ac 100644 --- a/src/main/java/au/com/royalpay/payment/manage/management/clearing/core/CleanService.java +++ b/src/main/java/au/com/royalpay/payment/manage/management/clearing/core/CleanService.java @@ -43,7 +43,7 @@ public interface CleanService { void settlementXlsx(Date date, HttpServletResponse response) throws IOException; - List getXlsx(Date date) throws IOException; + List getXlsx(Date dt, String bank) throws IOException; List getAba(Date dt, String bank) throws IOException; 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 0779043c8..4b2e53e46 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 @@ -211,7 +211,8 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider addBigDecimal(total, log, "wechat_charge"); addBigDecimal(total, log, "royalpay_charge"); addBigDecimal(total, log, "net_amount"); - List logDetails = clearingDetailMapper.listReportsOfSettlement(log.getIntValue("clearing_id")); + int clearingId = log.getIntValue("clearing_id"); + List logDetails = clearingDetailMapper.listReportsOfSettlement(clearingId); details.addAll(logDetails); List banks = logDetails.stream().map(detail -> detail.getString("settle_bank")).distinct().collect(Collectors.toList()); List bankStatistics = banks.stream().map(bank -> { @@ -219,13 +220,14 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider data.put("bank", bank); data.put("total_settle", logDetails.stream() .filter(detail -> bank.equals(detail.getString("settle_bank"))) - .map(detail -> detail.getBigDecimal("net_amount")) + .map(detail -> detail.getBigDecimal("clearing_amount")) .reduce(BigDecimal::add) ); return data; }).collect(Collectors.toList()); log.put("bank_statistics", bankStatistics); log.put("editable", DateUtils.isSameDay(log.getDate("settle_date"), new Date()) && log.getBooleanValue("editable")); + log.put("channel_analysis", clearingDetailAnalysisMapper.analysisChannelReport(clearingId)); } total.put("logs", logs); total.put("details", details); @@ -340,7 +342,7 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider String filename = "Merchant_Settlement_Info_" + dateString + RandomStringUtils.random(8, false, true) + ".xlsx"; zos.putNextEntry(new ZipEntry(filename)); List details = clearingDetailMapper.listReportsOfSettlement(log.getIntValue("clearing_id")); - byte[] xlsx = generateSettleXlsxFile(dt, details); + byte[] xlsx = generateSettleXlsxFile(dt, details, null); IOUtils.write(xlsx, zos); } zos.flush(); @@ -348,7 +350,7 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider } @Override - public List getXlsx(Date dt) throws IOException { + public List getXlsx(Date dt, String bank) throws IOException { List logs = clearingLogMapper.findByDate(dt); if (logs.isEmpty()) { throw new NotFoundException(); @@ -360,7 +362,7 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider String filename = "Merchant_Settlement_Info_" + DateFormatUtils.format(dt, "yyyyMMdd") + "_" + fileIndex + ".xlsx"; JSONObject file = new JSONObject(); file.put("name", filename); - file.put("byteArr", generateSettleXlsxFile(dt, clearingDetailMapper.listReportsOfSettlement(log.getIntValue("clearing_id")))); + file.put("byteArr", generateSettleXlsxFile(dt, clearingDetailMapper.listReportsOfSettlement(log.getIntValue("clearing_id")), bank)); result.add(file); fileIndex++; } @@ -369,7 +371,7 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider String filename = "Merchant_Settlement_Info_" + DateFormatUtils.format(dt, "yyyyMMdd") + ".xlsx"; JSONObject file = new JSONObject(); file.put("name", filename); - file.put("byteArr", generateSettleXlsxFile(dt, clearingDetailMapper.listReportsOfSettlement(log.getIntValue("clearing_id")))); + file.put("byteArr", generateSettleXlsxFile(dt, clearingDetailMapper.listReportsOfSettlement(log.getIntValue("clearing_id")), bank)); result.add(file); } } @@ -391,7 +393,7 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider return files.stream().filter(file -> bank.equals(file.bank())).collect(Collectors.toList()); } - private byte[] generateSettleXlsxFile(Date dt, List settlements) throws IOException { + private byte[] generateSettleXlsxFile(Date dt, List settlements, String bank) throws IOException { Workbook wb = new XSSFWorkbook(); Sheet sheet = wb.createSheet("Merchant_Settlement_Info_" + DateFormatUtils.format(dt, "yyyyMM")); int rowNum = 0; @@ -399,6 +401,9 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider if (settle.getBigDecimal("clearing_amount").compareTo(BigDecimal.ZERO) == 0) { continue; } + if (bank != null && Objects.equals(settle.getString("settle_bank"), bank)) { + continue; + } Row row = sheet.createRow(rowNum++); row.createCell(0, Cell.CELL_TYPE_STRING).setCellValue(settle.getString("bsb_no")); row.createCell(1, Cell.CELL_TYPE_STRING).setCellValue(settle.getString("account_no")); @@ -931,7 +936,7 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider String fileName1 = "Merchant_Settlement_Info_xlsx_" + DateFormatUtils.format(date, "yyyyMMdd"); List attachList = new ArrayList<>(); JSONObject attach1 = new JSONObject(); - List xlsxFileList = getXlsx(date); + List xlsxFileList = getXlsx(date, "CBA"); if (xlsxFileList.size() > 1) { fileName1 += ".zip"; attach1.put("content", Base64.encodeBase64String(getZipByteArr(xlsxFileList))); diff --git a/src/main/java/au/com/royalpay/payment/manage/management/clearing/core/impl/SettleDelayConfigurerImpl.java b/src/main/java/au/com/royalpay/payment/manage/management/clearing/core/impl/SettleDelayConfigurerImpl.java index f791d1d1f..d5eb104f7 100644 --- a/src/main/java/au/com/royalpay/payment/manage/management/clearing/core/impl/SettleDelayConfigurerImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/management/clearing/core/impl/SettleDelayConfigurerImpl.java @@ -34,6 +34,7 @@ import org.springframework.transaction.annotation.Transactional; import org.springframework.util.Assert; import java.math.BigDecimal; +import java.math.RoundingMode; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; diff --git a/src/main/java/au/com/royalpay/payment/manage/redpack/core/impls/ActRedPackServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/redpack/core/impls/ActRedPackServiceImpl.java index 8b93b74b1..231fb5f48 100644 --- a/src/main/java/au/com/royalpay/payment/manage/redpack/core/impls/ActRedPackServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/redpack/core/impls/ActRedPackServiceImpl.java @@ -34,6 +34,7 @@ import org.springframework.stereotype.Service; import org.springframework.util.Assert; import java.math.BigDecimal; +import java.math.RoundingMode; import java.util.Collections; import java.util.Date; import java.util.List; diff --git a/src/main/ui/static/analysis/clearing-log.js b/src/main/ui/static/analysis/clearing-log.js index 4067e4606..5ff29eb1a 100644 --- a/src/main/ui/static/analysis/clearing-log.js +++ b/src/main/ui/static/analysis/clearing-log.js @@ -241,65 +241,119 @@ define(['angular', 'decimal', 'uiBootstrap', 'uiRouter', 'angularEcharts'], func }) } }]); - app.controller('settlementDetailCtrl', ['$scope', '$stateParams', '$http','$uibModal','$filter','detail','commonDialog', function ($scope, $stateParams,$http,$uibModal,$filter, detail,commonDialog) { - $scope.detail = detail.data; - $scope.hasSentMail = false; - $scope.sendNotice = false; - $scope.noticeResend = false; + app.controller('settlementDetailCtrl', ['$scope', '$stateParams', '$http', '$uibModal', '$filter', '$state', 'detail', 'commonDialog', + function ($scope, $stateParams, $http, $uibModal, $filter, $state, detail, commonDialog) { + $scope.detail = detail.data; + $scope.hasSentMail = false; + $scope.sendNotice = false; + $scope.noticeResend = false; + $scope.analysisFilter = {}; + $scope.currentAnalysis = $scope.detail; - $scope.settleAnalysis = [ - {settleDays: 1, clients: 0, settleAmount: 0, settles: []}, - {settleDays: 2, clients: 0, settleAmount: 0, settles: []}, - {settleDays: 3, clients: 0, settleAmount: 0, settles: []} - ]; - angular.forEach($scope.detail.details, function (settleItem) { - var settleDays = settleItem.clear_days; - var analysisItem = $scope.settleAnalysis[Math.min(settleDays - 1, 2)]; - analysisItem.settles.push(settleItem); - analysisItem.clients++; - analysisItem.settleAmount = Decimal.add(analysisItem.settleAmount, settleItem.clearing_amount).toFixed(2, Decimal.ROUND_FLOOR) - }); - var nowStr = $filter('date')(new Date(), "yyyy-MM-dd"); - $scope.datePattern = $stateParams.date; - if($scope.datePattern == nowStr){ - $scope.sendNotice = true; - } - $scope.displaySendCheckCode = function () { - $uibModal.open({ - templateUrl: '/static/analysis/templates/settlement_send_check_code.html', - controller: 'settlementSendCheckCodeCtrl', - size: 'sm' - }); - }; + function getAnalysisTemplate() { + return [ + {settleDays: 1, clients: 0, settleAmount: 0, settles: []}, + {settleDays: 2, clients: 0, settleAmount: 0, settles: []}, + {settleDays: 3, clients: 0, settleAmount: 0, settles: []} + ]; + } - $http.get('/sys/settlement/reports/'+$stateParams.date+'/send_status/').then(function (resp) { - if(resp.data!=null && resp.data.mail_status ==1){ - $scope.hasSentMail = true; + $scope.settleAnalysis = getAnalysisTemplate(); + + $scope.batchAnalysis = { + 'All': $scope.settleAnalysis + }; + angular.forEach($scope.detail.logs, function (batch) { + $scope.batchAnalysis[batch.clearing_id+''] = getAnalysisTemplate(); + }); + + angular.forEach($scope.detail.details, function (settleItem) { + var settleDays = settleItem.clear_days; + attachAnalysis($scope.settleAnalysis[Math.min(settleDays - 1, 2)]); + attachAnalysis($scope.batchAnalysis[settleItem.clearing_id+''][Math.min(settleDays - 1, 2)]); + function attachAnalysis(analysisItem) { + analysisItem.settles.push(settleItem); + analysisItem.clients++; + analysisItem.settleAmount = Decimal.add(analysisItem.settleAmount, settleItem.clearing_amount).toFixed(2, Decimal.ROUND_FLOOR); + } + }); + var nowStr = $filter('date')(new Date(), "yyyy-MM-dd"); + $scope.datePattern = $stateParams.date; + if ($scope.datePattern == nowStr) { + $scope.sendNotice = true; } - }) - $scope.$on("sendMailSuccess", - function (event, msg) { - $scope.hasSentMail = true; - }); + $scope.displaySendCheckCode = function () { + $uibModal.open({ + templateUrl: '/static/analysis/templates/settlement_send_check_code.html', + controller: 'settlementSendCheckCodeCtrl', + size: 'sm' + }); + }; + + $scope.switchSettleBatch = function (batch) { + if (batch == null) { + $scope.currentAnalysis = $scope.detail; + $scope.analysisFilter.clearing_id = null; + } else { + $scope.analysisFilter.clearing_id = batch.clearing_id; + $scope.currentAnalysis = batch; + } + + }; - $scope.confirmSendSettlementMail = function () { - commonDialog.confirm({ - title: 'Confirm to send notice', - content: '请确认账户已扣款后再发送清算通知', - choises : [{label: 'Send', className: 'btn-success', key: '1'}, - {label: 'Cancel', className: 'btn-danger', key: '2', dismiss: true}] - }).then(function () { - $scope.noticeResend=true; - $http.post('/sys/settlement/settlement_notice').then(function () { - commonDialog.alert({title: 'Success', content: '发送成功', type: 'success'}); - $scope.noticeResend=false; - },function (resp) { - commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); - $scope.noticeResend=false; + $scope.getCurrentLog = function () { + return $scope.detail.logs.filter(function (log) { + return log.clearing_id === $scope.analysisFilter.clearing_id + })[0]; + }; + + $http.get('/sys/settlement/reports/' + $stateParams.date + '/send_status/').then(function (resp) { + if (resp.data != null && resp.data.mail_status == 1) { + $scope.hasSentMail = true; + } + }); + $scope.$on("sendMailSuccess", + function (event, msg) { + $scope.hasSentMail = true; }); - }) - }; - }]); + + $scope.confirmSendSettlementMail = function () { + commonDialog.confirm({ + title: 'Confirm to send notice', + content: '请确认账户已扣款后再发送清算通知', + choises: [{label: 'Send', className: 'btn-success', key: '1'}, + {label: 'Cancel', className: 'btn-danger', key: '2', dismiss: true}] + }).then(function () { + $scope.noticeResend = true; + $http.post('/sys/settlement/settlement_notice').then(function () { + commonDialog.alert({title: 'Success', content: '发送成功', type: 'success'}); + $scope.noticeResend = false; + }, function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); + $scope.noticeResend = false; + }); + }) + }; + + $scope.lockSettleLog = function (clearingId) { + commonDialog.confirm({title: '确认操作', content: '当前操作将标记本批次清算已发送,无法撤回,确认操作?'}).then(function () { + $http.put('/sys/settlement/reports/' + $stateParams.date + '/clearings/' + clearingId + '/lock').then(function () { + $scope.detail.logs.filter(function (log) { + return log.clearing_id === clearingId + }).forEach(function (log) { + log.editable = 0 + }); + commonDialog.alert({title: 'Success', content: 'Operation success', type: 'success'}); + }, function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); + }) + }) + }; + + $scope.distributeBankDialog = function () { + var log = $scope.getCurrentLog(); + } + }]); app.controller('settlementTransactionsCtrl', ['$scope', '$stateParams', 'detail', function ($scope, $stateParams, detail) { $scope.ctrl = {channel: null}; $scope.report = detail.data; @@ -341,7 +395,7 @@ define(['angular', 'decimal', 'uiBootstrap', 'uiRouter', 'angularEcharts'], func }; }]); - app.controller('settlementSendCheckCodeCtrl',['$scope', '$http','$rootScope','$stateParams', function ($scope, $http,$rootScope,$stateParams) { + app.controller('settlementSendCheckCodeCtrl', ['$scope', '$http', '$rootScope', '$stateParams', function ($scope, $http, $rootScope, $stateParams) { $scope.sendCheckCodeButton = false; $scope.sendMailButton = false; $scope.check_code = ''; @@ -354,15 +408,15 @@ define(['angular', 'decimal', 'uiBootstrap', 'uiRouter', 'angularEcharts'], func $scope.sendSettlementMail = function () { $scope.error_msg = '正在发送,请稍后。'; - if($scope.check_code =='' || $scope.check_code == null){ + if ($scope.check_code == '' || $scope.check_code == null) { $scope.error_msg = '请输入验证码'; return; } - $scope.sendMailButton= true; - $http.get('/sys/settlement/reports/'+$stateParams.date+'/send_settlement_xlsx/'+$scope.check_code).then(function (resp) { - $scope.error_msg =resp.data.msg; - $scope.sendMailButton= false; - if(resp.data.result==0){ + $scope.sendMailButton = true; + $http.get('/sys/settlement/reports/' + $stateParams.date + '/send_settlement_xlsx/' + $scope.check_code).then(function (resp) { + $scope.error_msg = resp.data.msg; + $scope.sendMailButton = false; + if (resp.data.result == 0) { $scope.sendMailButton = true; $rootScope.$broadcast("sendMailSuccess", '123'); } diff --git a/src/main/ui/static/analysis/templates/settlement_detail.html b/src/main/ui/static/analysis/templates/settlement_detail.html index 216373876..3d71c89be 100644 --- a/src/main/ui/static/analysis/templates/settlement_detail.html +++ b/src/main/ui/static/analysis/templates/settlement_detail.html @@ -28,69 +28,118 @@ class="btn btn-primary"> Settlement.aba - - - - +
+
Settlement Batches [{{datePattern}}]
+
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+
+
    +
  • + Bank Statistics +
  • +
  • +
    + + +
    +
  • +
+
+
-
Settlement analysis at {{datePattern}}
+
Settlement analysis
Total Credit - +
Total Debit - +
Gross Amount - +
Net Amount - +
Total Charge + ng-bind="(currentAnalysis.wechat_charge+currentAnalysis.royalpay_charge)|currency:''">
Channel Charge - +
RoyalPay Charge - +
Operate Time - +
+ +
    -
  • +
  • T+{{group.settleDays}} @@ -104,9 +153,11 @@
      -
    • +
    • - + Gross Amount:{{ channel.gross_amount|currency:''}} RoyalPay Charge:{{channel.royalpay_charge|currency:''}} @@ -115,8 +166,12 @@
    -
    -
    T+{{group.settleDays}}: Clients:{{group.clients}} Amount:{{group.settleAmount|currency:''}}
    + +
    +
    T+{{group.settleDays}}: Clients:{{group.clients}} + Amount:{{group.settleAmount|currency:''}} +
    From 4fa475fbb1cdc4a4239fd58f6449d63fb6081ebd Mon Sep 17 00:00:00 2001 From: yuan <1551130722@qq.com> Date: Tue, 26 Jun 2018 13:49:28 +0800 Subject: [PATCH 10/23] fix invoice bug --- .../partnerinvoice/web/PartnerInvoiceController.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/partnerinvoice/web/PartnerInvoiceController.java b/src/main/java/au/com/royalpay/payment/manage/partnerinvoice/web/PartnerInvoiceController.java index 83d792f9c..9e18eaa75 100644 --- a/src/main/java/au/com/royalpay/payment/manage/partnerinvoice/web/PartnerInvoiceController.java +++ b/src/main/java/au/com/royalpay/payment/manage/partnerinvoice/web/PartnerInvoiceController.java @@ -32,17 +32,17 @@ public class PartnerInvoiceController { } @PartnerMapping(value = "/trans_flow/pdf", method = RequestMethod.GET,roles = PartnerRole.ADMIN) - public void exportTransFlowPDF(TradeLogQuery query,HttpServletResponse httpResponse) throws Exception { - tradeLogService.exportTransFlow(query,getPartnerParams(query.getClient_ids()[0]),httpResponse); + public void exportTransFlowPDF(TradeLogQuery query,@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject partner,HttpServletResponse httpResponse) throws Exception { + tradeLogService.exportTransFlow(query,getPartnerParams(partner,query.getClient_ids()[0]),httpResponse); } - private JSONObject getPartnerParams(String client_id){ + private JSONObject getPartnerParams(JSONObject partner,String client_id){ JSONObject client = clientManager.getClientInfo(Integer.parseInt(client_id)); if(client==null){ throw new NotFoundException("Client Not Exists"); } JSONObject params = new JSONObject(); - params.put("client_id",client.getIntValue("client_id")); + params.put("client_id",partner.getIntValue("client_id")); params.put("client",client); params.put("client_moniker",client.getString("client_moniker")); return params; From 0d48030501ea9526b46b1f39b1fa6332e1d3d8eb Mon Sep 17 00:00:00 2001 From: yixian Date: Tue, 26 Jun 2018 15:35:47 +0800 Subject: [PATCH 11/23] distribute bank ui --- .../clearing/core/CleanService.java | 8 ++- .../clearing/core/impl/CleanServiceImpl.java | 24 +++++++ .../clearing/web/SettlementDevController.java | 14 +++- .../log/ClearingDetailAnalysisMapper.java | 2 + .../mappers/log/ClearingDetailMapper.java | 3 + .../manage/mappers/log/ClearingLogMapper.java | 3 + .../payment/TaskManualSettleMapper.java | 2 + .../mappers/payment/TransactionMapper.java | 3 + .../log/ClearingDetailAnalysisMapper.xml | 5 ++ .../payment/TaskManualSettleMapper.xml | 24 +++++-- .../mappers/payment/TransactionMapper.xml | 11 ++++ src/main/ui/static/analysis/clearing-log.js | 64 ++++++++++++++++++- .../settlement_bank_distribution_dialog.html | 24 +++++++ .../analysis/templates/settlement_detail.html | 23 ++++--- .../CustomerImpressionServiceImplTest.java | 27 -------- 15 files changed, 187 insertions(+), 50 deletions(-) create mode 100644 src/main/ui/static/analysis/templates/settlement_bank_distribution_dialog.html delete mode 100644 src/test/au/com/royalpay/payment/manage/apps/core/impls/CustomerImpressionServiceImplTest.java diff --git a/src/main/java/au/com/royalpay/payment/manage/management/clearing/core/CleanService.java b/src/main/java/au/com/royalpay/payment/manage/management/clearing/core/CleanService.java index 3fbe1e9ac..09518584a 100644 --- a/src/main/java/au/com/royalpay/payment/manage/management/clearing/core/CleanService.java +++ b/src/main/java/au/com/royalpay/payment/manage/management/clearing/core/CleanService.java @@ -83,9 +83,11 @@ public interface CleanService { JSONObject findLogSettleByDate(Date date); - JSONObject validTransactions(Date dt, boolean fix, boolean b, boolean b1); + JSONObject validTransactions(Date date, boolean fix, boolean b, boolean b1); - void distributeBank(Date dt, int clearingId, JSONObject bankDistribution); + void distributeBank(Date date, int clearingId, JSONObject bankDistribution); - void lockClearingLog(Date dt, int clearingId); + void lockClearingLog(Date date, int clearingId); + + void undoSettle(Date date, int clearingId); } 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 4b2e53e46..2eafe4324 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 @@ -5,6 +5,7 @@ import au.com.royalpay.payment.core.exceptions.InvalidShortIdException; import au.com.royalpay.payment.core.tasksupport.SettlementSupport; import au.com.royalpay.payment.manage.management.clearing.core.CleanService; import au.com.royalpay.payment.manage.mappers.log.*; +import au.com.royalpay.payment.manage.mappers.payment.TaskManualSettleMapper; import au.com.royalpay.payment.manage.mappers.payment.TransactionMapper; import au.com.royalpay.payment.manage.mappers.system.CalendarMapper; import au.com.royalpay.payment.manage.mappers.system.ClientRateMapper; @@ -97,6 +98,8 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider @Resource private ClearingDetailAnalysisMapper clearingDetailAnalysisMapper; @Resource + private TaskManualSettleMapper taskManualSettleMapper; + @Resource private ValidationLogMapper validationLogMapper; @Resource private ManagerMapper managerMapper; @@ -1133,6 +1136,27 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider clearingLogMapper.setLogEditable(false, clearingId); } + @Override + @Transactional + public void undoSettle(Date date, int clearingId) { + if (!DateUtils.isSameDay(date, new Date())) { + throw new ForbiddenException("Only today's settlement file can be modified"); + } + JSONObject log = clearingLogMapper.findById(clearingId); + if (log == null || !DateUtils.isSameDay(log.getDate("settle_date"), date)) { + throw new NotFoundException("Settlement log not found"); + } + if (!log.getBooleanValue("editable")) { + throw new ForbiddenException("Settlement log has been sent and unable to edit"); + } + transactionMapper.deleteSettlementTransaction(clearingId); + transactionMapper.removeSettleRemark(clearingId); + clearingDetailAnalysisMapper.clearAnalysis(clearingId); + taskManualSettleMapper.rollbackExecutedTask(clearingId); + clearingDetailMapper.deleteSettleLogs(clearingId); + clearingLogMapper.deleteSettleLogs(clearingId); + } + private byte[] getZipByteArr(List fileByteArrWithName) throws IOException { ByteArrayOutputStream bos = new ByteArrayOutputStream(); ZipOutputStream zos = new ZipOutputStream(bos); diff --git a/src/main/java/au/com/royalpay/payment/manage/management/clearing/web/SettlementDevController.java b/src/main/java/au/com/royalpay/payment/manage/management/clearing/web/SettlementDevController.java index 74f00e973..f4dea7830 100644 --- a/src/main/java/au/com/royalpay/payment/manage/management/clearing/web/SettlementDevController.java +++ b/src/main/java/au/com/royalpay/payment/manage/management/clearing/web/SettlementDevController.java @@ -2,6 +2,7 @@ package au.com.royalpay.payment.manage.management.clearing.web; import au.com.royalpay.payment.manage.management.clearing.core.CleanService; import au.com.royalpay.payment.manage.permission.manager.ManagerMapping; +import au.com.royalpay.payment.manage.permission.manager.RequireManager; import au.com.royalpay.payment.manage.support.abafile.ABATemplate; import au.com.royalpay.payment.tools.permission.enums.ManagerRole; import au.com.royalpay.payment.tools.CommonConsts; @@ -70,7 +71,7 @@ public class SettlementDevController { } @PutMapping("/reports/{date}/clearings/{clearingId}/lock") - public void lockClearingLog(@PathVariable String date,@PathVariable int clearingId){ + public void lockClearingLog(@PathVariable String date, @PathVariable int clearingId) { try { Date dt = dateFormat.parse(date); cleanService.lockClearingLog(dt, clearingId); @@ -79,6 +80,17 @@ public class SettlementDevController { } } + @DeleteMapping("/reports/{date}/clearings/{clearingId}") + @RequireManager(role = ManagerRole.DEVELOPER) + public void undoSettle(@PathVariable String date, @PathVariable int clearingId) { + try { + Date dt = dateFormat.parse(date); + cleanService.undoSettle(dt, clearingId); + } catch (ParseException e) { + throw new BadRequestException("error.payment.valid.invalid_date_format"); + } + } + @RequestMapping("/reports/{date}/settlement_csv") public void getSettlementCsv(@PathVariable String date, HttpServletResponse resp) throws IOException { try { diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/log/ClearingDetailAnalysisMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/log/ClearingDetailAnalysisMapper.java index ffe560d10..f97a11d43 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/log/ClearingDetailAnalysisMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/log/ClearingDetailAnalysisMapper.java @@ -26,4 +26,6 @@ public interface ClearingDetailAnalysisMapper { List listReportChannels(@Param("clearing_detail_id") String clearDetailId); BigDecimal getSysCleaingAmount(@Param("settle_date") String settle_date, @Param("channel") String channel); + + void clearAnalysis(@Param("clearing_id") int clearingId); } diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/log/ClearingDetailMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/log/ClearingDetailMapper.java index e37ac76e9..62ff594d9 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/log/ClearingDetailMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/log/ClearingDetailMapper.java @@ -45,4 +45,7 @@ public interface ClearingDetailMapper { @AutoSql(type = SqlType.UPDATE) void updateBanks(@Param("settle_bank") String bank,@Param("clear_detail_id") List clearingDetailIds); + + @AutoSql(type = SqlType.DELETE) + void deleteSettleLogs(@Param("clearing_id") int clearingId); } diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/log/ClearingLogMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/log/ClearingLogMapper.java index ca402dab9..2a7d47b66 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/log/ClearingLogMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/log/ClearingLogMapper.java @@ -46,4 +46,7 @@ public interface ClearingLogMapper { @AutoSql(type = SqlType.UPDATE) void setLogEditable(@Param("editable") boolean editable, @Param("clearing_id") int clearingId); + + @AutoSql(type = SqlType.DELETE) + void deleteSettleLogs(@Param("clearing_id") int clearingId); } diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/payment/TaskManualSettleMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/payment/TaskManualSettleMapper.java index 910343d73..5116e391d 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/payment/TaskManualSettleMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/payment/TaskManualSettleMapper.java @@ -31,4 +31,6 @@ public interface TaskManualSettleMapper { List getEveryLatestRecord(); + void rollbackExecutedTask(@Param("clearing_id") int clearingId); + } diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.java index e31fdb1d5..5e153fda9 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.java @@ -133,4 +133,7 @@ public interface TransactionMapper { List listClientUnsettleDataByDate(@Param("client_id") int clientId, @Param("max_settle_to") Date maxSettleTo); + void deleteSettlementTransaction(@Param("clearing_id") int clearingId); + + void removeSettleRemark(@Param("clearing_id") int clearingId); } diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/log/ClearingDetailAnalysisMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/log/ClearingDetailAnalysisMapper.xml index 37c80398e..4db57c4ab 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/mappers/log/ClearingDetailAnalysisMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/log/ClearingDetailAnalysisMapper.xml @@ -1,6 +1,11 @@ + + DELETE a FROM log_clearing_detail_analysis a + inner JOIN log_clearing_detail d on d.clear_detail_id = a.clearing_detail_id + where d.clearing_id = #{clearing_id} + - SELECT - s.request_time,c.client_id,c.client_moniker + SELECT + s.request_time, + c.client_id, + c.client_moniker FROM - task_client_manual_settle s - right join sys_clients c on s.client_id = c.client_id - inner join sys_client_config cc on cc.client_id = c.client_id - where (s.request_time=(select max(B.request_time) from task_client_manual_settle B where s.client_id =B.client_id) or s.request_time is null) - and cc.manual_settle = 1 + task_client_manual_settle s + right join sys_clients c on s.client_id = c.client_id + inner join sys_client_config cc on cc.client_id = c.client_id + where (s.request_time = (select max(B.request_time) + from task_client_manual_settle B + where s.client_id = B.client_id) or s.request_time is null) + and cc.manual_settle = 1 \ No newline at end of file diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.xml index dececd472..ad74bfa4d 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.xml @@ -1,6 +1,17 @@ + + UPDATE pmt_transactions AS t + INNER JOIN log_clearing_detail d ON d.clear_detail_id = t.clearing_order + SET clearing_status = 0, clearing_order = NULL, clearing_time = NULL + WHERE d.clearing_id = #{clearing_id} + + + DELETE t FROM pmt_transactions t + INNER JOIN log_clearing_detail d ON d.clear_detail_id = t.clearing_order + WHERE d.clearing_id = #{clearing_id} AND t.transaction_type = 'Debit' AND t.refund_id IS NULL and t.channel='Settlement' + + + +
    + +
    +

    +
    +
    + +
    + + \ No newline at end of file diff --git a/src/main/ui/static/analysis/templates/settlement_detail.html b/src/main/ui/static/analysis/templates/settlement_detail.html index 3d71c89be..5cdcce1b5 100644 --- a/src/main/ui/static/analysis/templates/settlement_detail.html +++ b/src/main/ui/static/analysis/templates/settlement_detail.html @@ -47,7 +47,7 @@
    Settlement Batches [{{datePattern}}]
    -
    +
    -
    - - +
    +
    + + + +
    diff --git a/src/test/au/com/royalpay/payment/manage/apps/core/impls/CustomerImpressionServiceImplTest.java b/src/test/au/com/royalpay/payment/manage/apps/core/impls/CustomerImpressionServiceImplTest.java deleted file mode 100644 index f165f4a3b..000000000 --- a/src/test/au/com/royalpay/payment/manage/apps/core/impls/CustomerImpressionServiceImplTest.java +++ /dev/null @@ -1,27 +0,0 @@ -package au.com.royalpay.payment.manage.apps.core.impls; - -import au.com.royalpay.payment.manage.apps.core.CustomerImpressionService; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.ActiveProfiles; -import org.springframework.test.context.junit4.SpringRunner; - -import javax.annotation.Resource; - -/** - * Created by wangning on 08/01/2018. - */ -@SpringBootTest -@ActiveProfiles({"local","alipay","wechat","jd","bestpay"}) -@RunWith(SpringRunner.class) -public class CustomerImpressionServiceImplTest { - @Resource - private CustomerImpressionService customerImpressionService; - @Test - public void generate() throws Exception { - customerImpressionService.generate(9); - } - -} \ No newline at end of file From 8e78d70a7e27294307dd9ba88639ae05543dfaa0 Mon Sep 17 00:00:00 2001 From: yixian Date: Tue, 26 Jun 2018 15:38:41 +0800 Subject: [PATCH 12/23] Round Half Down edit to prevent deprecated warnings --- .../manage/appclient/core/impls/RetailAppServiceImp.java | 3 ++- .../management/clearing/core/impl/CleanServiceImpl.java | 4 ++-- .../manage/merchants/core/impls/ClientManagerImpl.java | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java b/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java index 2295275b3..dc50ae7f1 100644 --- a/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java +++ b/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java @@ -79,6 +79,7 @@ import org.springframework.stereotype.Service; import org.springframework.util.Assert; import java.math.BigDecimal; +import java.math.RoundingMode; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; @@ -1012,7 +1013,7 @@ public class RetailAppServiceImp implements RetailAppService { @Override public void sendCleanMessage(JSONObject log_clearing_detail, int client_id) { - String clearing_amount = log_clearing_detail.getBigDecimal("clearing_amount").setScale(2, BigDecimal.ROUND_HALF_DOWN).toString(); + String clearing_amount = log_clearing_detail.getBigDecimal("clearing_amount").setScale(2, RoundingMode.HALF_DOWN).toString(); String settle_date_from = DateFormatUtils.format(log_clearing_detail.getDate("settle_date_from"), "MM/dd/yyyy"); String settle_date_to = DateFormatUtils.format(log_clearing_detail.getDate("settle_date_to"), "MM/dd/yyyy"); logger.debug("sendCleanMessage-" + log_clearing_detail.getString("client_moniker") + "- " + PlatformEnvironment.getEnv().getForeignCurrency() + " " 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 2eafe4324..196ccd952 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 @@ -510,9 +510,9 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider String transactionTime = DateFormatUtils.format(transaction.getDate("transaction_time"), "dd/MM/yyyy h:mm:ss a", Locale.ENGLISH); int multiply = "Credit".equals(transaction.getString("transaction_type")) ? 1 : -1; BigDecimal transactionAmount = transaction.getBigDecimal("transaction_amount").multiply(BigDecimal.valueOf(multiply)).setScale(2, - BigDecimal.ROUND_HALF_DOWN); + RoundingMode.HALF_DOWN); BigDecimal clearingAmount = transaction.getBigDecimal("clearing_amount").multiply(BigDecimal.valueOf(multiply)).setScale(2, - BigDecimal.ROUND_HALF_DOWN); + RoundingMode.HALF_DOWN); String[] values = {transaction.getString("system_transaction_id"), transaction.getString("order_id"), transaction.getString("client_id"), transaction.getString("device_id"), transaction.getString("transaction_currency"), transactionAmount.toPlainString(), transaction.getString("clearing_currency"), clearingAmount.toPlainString(), transaction.getString("channel"), transactionTime, "0"}; 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 044205045..92399242b 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 @@ -129,6 +129,7 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.math.BigDecimal; +import java.math.RoundingMode; import java.net.URISyntaxException; import java.net.URL; import java.util.ArrayList; @@ -3040,7 +3041,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid if (appClientBean.getCustomerSurchargeRate() <= 0) { throw new ForbiddenException("customerSurchargeRate is 0"); } - BigDecimal customerSurchargeRate = new BigDecimal(appClientBean.getCustomerSurchargeRate()).setScale(2, BigDecimal.ROUND_HALF_DOWN); + BigDecimal customerSurchargeRate = new BigDecimal(appClientBean.getCustomerSurchargeRate()).setScale(2, RoundingMode.HALF_DOWN); setCustomerSurchargeRate(account, client.getString("client_moniker"), customerSurchargeRate); } clientInfoCacheSupport.clearClientCache(client_id); From f4899470bd8966cb7eeb01d1d1401d4cbe1e7348 Mon Sep 17 00:00:00 2001 From: yuan <1551130722@qq.com> Date: Tue, 26 Jun 2018 15:45:49 +0800 Subject: [PATCH 13/23] fix bug --- .../manage/appclient/core/impls/RetailAppServiceImp.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java b/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java index 2295275b3..ca220dbaf 100644 --- a/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java +++ b/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java @@ -320,8 +320,6 @@ public class RetailAppServiceImp implements RetailAppService { String clientType = device.getString("client_type"); deviceSupport.findRegister(clientType); int client_id = device.getIntValue("client_id"); - JSONObject client = clientManager.getClientInfo(client_id); - device.put("client_moniker", client.getString("client_moniker")); TradeLogQuery tradeLogQuery = new TradeLogQuery(); tradeLogQuery.setDatefrom(appQueryBean.getBegin()); tradeLogQuery.setDateto(appQueryBean.getEnd()); @@ -329,6 +327,12 @@ public class RetailAppServiceImp implements RetailAppService { appQueryBean.setApp_client_ids(String.valueOf(client_id)); } tradeLogQuery.setClient_ids(appQueryBean.getApp_client_ids().split(",")); + JSONObject client = clientManager.getClientInfo(Integer.parseInt(tradeLogQuery.getClient_ids()[0])); + if(client==null){ + throw new NotFoundException("Client Not Exists"); + } + device.put("client_moniker", client.getString("client_moniker")); + device.put("client",client); tradeLogService.exportTransFlow(tradeLogQuery, device, httpResponse); } From b5156708f098e640659bda618118edd3b2f6d2ec Mon Sep 17 00:00:00 2001 From: eason Date: Tue, 26 Jun 2018 17:19:03 +0800 Subject: [PATCH 14/23] =?UTF-8?q?fix=20=E6=B8=85=E7=AE=97=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=E6=9C=AA=E5=AE=8C=E6=88=90=E5=8C=BA=E5=88=AB=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/db/modify.sql | 7 ++++++ .../core/impls/RetailAppServiceImp.java | 21 +++++++++--------- .../core/impls/ClientManagerImpl.java | 22 +++++++++++-------- .../core/impls/TradeLogServiceImpl.java | 15 ++++++++----- 4 files changed, 39 insertions(+), 26 deletions(-) diff --git a/src/db/modify.sql b/src/db/modify.sql index 0e60bfca6..b2e1be0e5 100644 --- a/src/db/modify.sql +++ b/src/db/modify.sql @@ -574,3 +574,10 @@ CREATE TABLE `sys_mail_unsub` ( alter table sys_clients add column ali_sub_merchant_id varchar(20) DEFAULT NULL; update sys_clients set ali_sub_merchant_id = client_moniker; +ALTER TABLE `log_clearing_detail` +ADD COLUMN `settle_bank` varchar(10) NULL DEFAULT NULL COMMENT '清算来源银行(RoyalPay)' AFTER `account_name`; +update log_clearing_detail set settle_bank='CBA'; + + +ALTER TABLE `log_clearing` +ADD COLUMN `editable` tinyint(1) NULL DEFAULT 1 COMMENT '是否可编辑' AFTER `balance`; \ No newline at end of file diff --git a/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java b/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java index dc50ae7f1..447419470 100644 --- a/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java +++ b/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java @@ -11,10 +11,7 @@ import au.com.royalpay.payment.manage.cashback.core.CashbackService; import au.com.royalpay.payment.manage.customers.core.CouponValidateService; import au.com.royalpay.payment.manage.fund.core.impls.XPlanFundConfigServiceImpl; import au.com.royalpay.payment.manage.management.clearing.core.CleanService; -import au.com.royalpay.payment.manage.mappers.log.AppMessageLogMapper; -import au.com.royalpay.payment.manage.mappers.log.ClearingDetailAnalysisMapper; -import au.com.royalpay.payment.manage.mappers.log.ClearingDetailMapper; -import au.com.royalpay.payment.manage.mappers.log.LogSettleMailMapper; +import au.com.royalpay.payment.manage.mappers.log.*; import au.com.royalpay.payment.manage.mappers.notice.NoticePartnerMapper; import au.com.royalpay.payment.manage.mappers.payment.OrderMapper; import au.com.royalpay.payment.manage.mappers.payment.TransactionMapper; @@ -167,6 +164,8 @@ public class RetailAppServiceImp implements RetailAppService { private ClientMapper clientMapper; @Resource private ClientModifySupport clientModifySupport; + @Resource + private ClearingLogMapper clearingLogMapper; private Map senderMap = new HashMap<>(); private final String fileName[] = { "client_bank_file", "client_id_file", "client_company_file" }; @@ -547,18 +546,18 @@ public class RetailAppServiceImp implements RetailAppService { PageList logs = clearingDetailMapper.listClientSettlementLog(params, new PageBounds(appQueryBean.getPage(), appQueryBean.getLimit(), Order.formString("report_date.desc"))); logs.forEach(log -> log.put("total_charge", log.getBigDecimal("total_charge").add(log.getBigDecimal("tax_amount")))); + JSONObject result = PageListUtils.buildPageListResult(logs); if (appQueryBean.getPage() == 1) { if (!logs.isEmpty() && logs.size() > 0) { - JSONObject sendMailLog = logSettleMailMapper.findByDate(logs.get(0).getDate("report_date")); - if (sendMailLog == null) { - logs.remove(0); - }else if (sendMailLog != null && sendMailLog.getIntValue("mail_status") != 1) { - logs.remove(0); + JSONObject clearingDetail = clearingDetailMapper.findByDetailId(logs.get(0).getIntValue("clearing_order")); + if (clearingDetail!=null){ + JSONObject clearingLog = clearingLogMapper.findById(clearingDetail.getIntValue("clearing_id")); + if(clearingLog.getBooleanValue("editable")){ + result.put("padding", true); + } } } } - JSONObject result = PageListUtils.buildPageListResult(logs); - return result; } 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 92399242b..258bbf04b 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 @@ -14,9 +14,7 @@ import au.com.royalpay.payment.manage.appclient.beans.AppClientBean; import au.com.royalpay.payment.manage.application.core.SimpleClientApplyService; import au.com.royalpay.payment.manage.device.core.DeviceManager; import au.com.royalpay.payment.manage.mappers.financial.FinancialBDConfigMapper; -import au.com.royalpay.payment.manage.mappers.log.ClientsOperationLogMapper; -import au.com.royalpay.payment.manage.mappers.log.LogClientSubMerchantIdMapper; -import au.com.royalpay.payment.manage.mappers.log.LogSettleMailMapper; +import au.com.royalpay.payment.manage.mappers.log.*; import au.com.royalpay.payment.manage.mappers.payment.TransactionMapper; import au.com.royalpay.payment.manage.mappers.redpack.ActClientInvitationCodeMapper; import au.com.royalpay.payment.manage.mappers.system.*; @@ -260,6 +258,11 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid private MailGunService mailGunService; @Resource private MailSendMapper mailSendMapper; + @Resource + private ClearingDetailMapper clearingDetailMapper; + @Resource + private ClearingLogMapper clearingLogMapper; + private static final String SOURCE_AGREE_FILE = "source_agree_file"; private static final String CLIENT_BANK_FILE = "client_bank_file"; @@ -2648,17 +2651,18 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid params.put("client_id", client_id); PageList logs = transactionMapper.listSettlementLog(params, new PageBounds(query.getPage(), query.getLimit(), Order.formString("clearing_time.desc"))); + JSONObject result = PageListUtils.buildPageListResult(logs); if (query.getPage() == 1) { if (!logs.isEmpty() && logs.size() > 0) { - JSONObject sendMailLog = logSettleMailMapper.findByDate(logs.get(0).getDate("clearing_time")); - if (sendMailLog == null) { - logs.remove(0); - }else if (sendMailLog != null && sendMailLog.getIntValue("mail_status") != 1) { - logs.remove(0); + JSONObject clearingDetail = clearingDetailMapper.findByDetailId(logs.get(0).getIntValue("clearing_order")); + if (clearingDetail!=null){ + JSONObject clearingLog = clearingLogMapper.findById(clearingDetail.getIntValue("clearing_id")); + if(clearingLog.getBooleanValue("editable")){ + result.put("padding", true); + } } } } - JSONObject result = PageListUtils.buildPageListResult(logs); return result; } diff --git a/src/main/java/au/com/royalpay/payment/manage/tradelog/core/impls/TradeLogServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/tradelog/core/impls/TradeLogServiceImpl.java index 6264b3f83..cdd48cdaa 100644 --- a/src/main/java/au/com/royalpay/payment/manage/tradelog/core/impls/TradeLogServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/tradelog/core/impls/TradeLogServiceImpl.java @@ -12,6 +12,7 @@ import au.com.royalpay.payment.core.exceptions.ParamInvalidException; import au.com.royalpay.payment.manage.mappers.client.ClientCustomersMapper; import au.com.royalpay.payment.manage.mappers.log.ClearingDetailAnalysisMapper; import au.com.royalpay.payment.manage.mappers.log.ClearingDetailMapper; +import au.com.royalpay.payment.manage.mappers.log.ClearingLogMapper; import au.com.royalpay.payment.manage.mappers.log.LogSettleMailMapper; import au.com.royalpay.payment.manage.mappers.payment.AustracDataMapper; import au.com.royalpay.payment.manage.mappers.payment.OrderMapper; @@ -132,6 +133,8 @@ public class TradeLogServiceImpl implements TradeLogService { private ClientCustomersMapper clientCustomersMapper; @Resource LogSettleMailMapper logSettleMailMapper; + @Resource + private ClearingLogMapper clearingLogMapper; @Resource private OrgManager orgManager; @@ -830,12 +833,12 @@ public class TradeLogServiceImpl implements TradeLogService { result.put("analysis", transactionMapper.getClientAmountAnalysis(params)); if (query.getPage() == 1) { if (!logs.isEmpty() && logs.size() > 0) { - JSONObject sendMailLog = logSettleMailMapper.findByDate(logs.get(0).getDate("clearing_time")); - if (sendMailLog == null) { - result.put("padding", true); - } - if (sendMailLog != null && sendMailLog.getIntValue("mail_status") != 1) { - result.put("padding", true); + JSONObject clearingDetail = clearingDetailMapper.findByDetailId(logs.get(0).getIntValue("clearing_order")); + if (clearingDetail!=null){ + JSONObject clearingLog = clearingLogMapper.findById(clearingDetail.getIntValue("clearing_id")); + if(clearingLog.getBooleanValue("editable")){ + result.put("padding", true); + } } } } From c4622ada47cba939fbf73095ee4e6effac3b0510 Mon Sep 17 00:00:00 2001 From: yixian Date: Tue, 26 Jun 2018 17:57:18 +0800 Subject: [PATCH 15/23] fix ui bug --- src/main/ui/static/analysis/clearing-log.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/ui/static/analysis/clearing-log.js b/src/main/ui/static/analysis/clearing-log.js index c6d5ca200..c23aa5710 100644 --- a/src/main/ui/static/analysis/clearing-log.js +++ b/src/main/ui/static/analysis/clearing-log.js @@ -389,8 +389,8 @@ define(['angular', 'decimal', 'uiBootstrap', 'uiRouter', 'angularEcharts'], func $scope.report = detail.data; }]); - app.controller('bankDistributionDialogCtrl', ['$scope', '$http', 'decimal', 'clearingBatch', 'banksConfig', 'settleDate', - function ($scope, $http, Decimal, clearingBatch, banksConfig, settleDate) { + app.controller('bankDistributionDialogCtrl', ['$scope', '$http', 'clearingBatch', 'banksConfig', 'settleDate', + function ($scope, $http, clearingBatch, banksConfig, settleDate) { $scope.banksConfig = banksConfig.data; $scope.bankData = []; angular.forEach($scope.banksConfig.banks, function (bank) { From ca67b30db2df152b30a9c20d22caefccb17b72bd Mon Sep 17 00:00:00 2001 From: yixian Date: Tue, 26 Jun 2018 18:05:03 +0800 Subject: [PATCH 16/23] fix ui bug --- src/main/ui/static/analysis/clearing-log.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/ui/static/analysis/clearing-log.js b/src/main/ui/static/analysis/clearing-log.js index c23aa5710..5f145da55 100644 --- a/src/main/ui/static/analysis/clearing-log.js +++ b/src/main/ui/static/analysis/clearing-log.js @@ -399,7 +399,7 @@ define(['angular', 'decimal', 'uiBootstrap', 'uiRouter', 'angularEcharts'], func } }); $scope.remainingAmount = function () { - var total = clearingBatch.clearing_amount; + var total = clearingBatch.net_amount; angular.forEach($scope.bankData, function (config) { total = Decimal.sub(total, config.amount); }); From 76600c5dfd3cacbbb8aaa9d6e574eeaf4fdb05c4 Mon Sep 17 00:00:00 2001 From: yixian Date: Tue, 26 Jun 2018 18:15:15 +0800 Subject: [PATCH 17/23] fix ui bug --- .../payment/manage/mappers/log/ClearingDetailMapper.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/log/ClearingDetailMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/log/ClearingDetailMapper.xml index 76f5845c9..473d41a81 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/mappers/log/ClearingDetailMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/log/ClearingDetailMapper.xml @@ -2,7 +2,7 @@ - update log_clearing_detail set settle_bank=#{bank} where clearing_id=#{clearing_id} + update log_clearing_detail set settle_bank=#{settle_bank} where clearing_id=#{clearing_id}
    + @@ -192,6 +193,7 @@ +
    Source Bank Client Moniker Transaction Date Gross Amount
    {{settleItem.settle_date_from|limitTo:10}} From 60f5594796859eb5424173e86e7b06b6706436cd Mon Sep 17 00:00:00 2001 From: wangning <164851225@qq.com> Date: Wed, 27 Jun 2018 10:22:11 +0800 Subject: [PATCH 19/23] remove transaction --- .../payment/manage/merchants/core/impls/ClientManagerImpl.java | 1 - 1 file changed, 1 deletion(-) 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 044205045..b0eced983 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 @@ -2185,7 +2185,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } @Override - @Transactional public void getNewAggregateAgreeFile(String clientMoniker, JSONObject manager, boolean renewal) throws Exception { JSONObject client = getClientInfoByMoniker(clientMoniker); if (client == null) { From a779b081a6f8b13572998cd8b70ea2f408956358 Mon Sep 17 00:00:00 2001 From: yixian Date: Wed, 27 Jun 2018 11:35:16 +0800 Subject: [PATCH 20/23] ui update --- src/main/ui/static/analysis/clearing-log.js | 1 + .../analysis/templates/settlement_detail.html | 36 +- src/main/ui/static/css/common.css | 366 +++++++++--------- src/main/ui/static/images/bank/ANZ.png | Bin 0 -> 7342 bytes src/main/ui/static/images/bank/CBA.png | Bin 0 -> 1662 bytes 5 files changed, 200 insertions(+), 203 deletions(-) create mode 100644 src/main/ui/static/images/bank/ANZ.png create mode 100644 src/main/ui/static/images/bank/CBA.png diff --git a/src/main/ui/static/analysis/clearing-log.js b/src/main/ui/static/analysis/clearing-log.js index 1eb5e5a0c..944faa786 100644 --- a/src/main/ui/static/analysis/clearing-log.js +++ b/src/main/ui/static/analysis/clearing-log.js @@ -249,6 +249,7 @@ define(['angular', 'decimal', 'uiBootstrap', 'uiRouter', 'angularEcharts'], func $scope.noticeResend = false; $scope.analysisFilter = {}; $scope.currentAnalysis = $scope.detail; + $scope.pageCtrl = {visible:{}}; function getAnalysisTemplate() { return [ diff --git a/src/main/ui/static/analysis/templates/settlement_detail.html b/src/main/ui/static/analysis/templates/settlement_detail.html index 44c02d21a..5157836b1 100644 --- a/src/main/ui/static/analysis/templates/settlement_detail.html +++ b/src/main/ui/static/analysis/templates/settlement_detail.html @@ -70,7 +70,8 @@ - @@ -137,22 +138,6 @@ - -
    -
    -
      -
    • -
      - T+{{group.settleDays}} - - Clients:{{group.clients}}, Amount:{{group.settleAmount|currency:''}} - -
      -
    • -
    -
    -
      @@ -170,16 +155,17 @@
    -
    -
    T+{{group.settleDays}}: Clients:{{group.clients}} +
    + T+{{group.settleDays}}: Clients:{{group.clients}} Amount:{{group.settleAmount|currency:''}} + Click to hide
    -
    - +
    +
    - @@ -193,8 +179,10 @@ - - +
    Source Bank Client Moniker Transaction Date Gross Amount
    + + + {{settleItem.settle_date_from|limitTo:10}} ~ diff --git a/src/main/ui/static/css/common.css b/src/main/ui/static/css/common.css index 327a7e4e8..b88c7fdef 100644 --- a/src/main/ui/static/css/common.css +++ b/src/main/ui/static/css/common.css @@ -549,21 +549,21 @@ position: relative; } -.active-rate-view:after{ - content:''; - clear:both; - display:block; +.active-rate-view:after { + content: ''; + clear: both; + display: block; } .active-rate-view .client-names { - width:100px; + width: 100px; overflow-x: hidden; float: left; border-right: 2px solid #bbb; display: block; } -.active-rate-view .client-name{ +.active-rate-view .client-name { width: 100%; text-align: left; font-weight: bold; @@ -571,245 +571,244 @@ border-bottom: 1px solid #bbb; } -.active-rate-view .client-row{ +.active-rate-view .client-row { height: 30px; line-height: 30px; white-space: nowrap; } -.active-rate-view .analysis-box{ +.active-rate-view .analysis-box { overflow-x: auto; display: block; float: left; padding-bottom: 5px; } -.active-rate-view .analysis-item{ +.active-rate-view .analysis-item { width: 35px; height: 100%; display: inline-block; - text-align:center; - line-height:30px; + text-align: center; + line-height: 30px; overflow: hidden; - border-right:1px solid #bbb; - border-bottom:1px solid #bbb; + border-right: 1px solid #bbb; + border-bottom: 1px solid #bbb; } -.selectRow,.table-striped>tbody>tr.selectRow:nth-of-type(odd){ +.selectRow, .table-striped > tbody > tr.selectRow:nth-of-type(odd) { background-color: #E0EEE0; } - -.fountainGBox{ - position:relative; - width:108px; - height:13px; +.fountainGBox { + position: relative; + width: 108px; + height: 13px; margin: auto auto 20px; } -.fountainG{ - position:absolute; - top:0; - background-color:rgb(0,0,0); - width:13px; - height:13px; - animation-name:bounce_fountainG; - -o-animation-name:bounce_fountainG; - -ms-animation-name:bounce_fountainG; - -webkit-animation-name:bounce_fountainG; - -moz-animation-name:bounce_fountainG; - animation-duration:1.5s; - -o-animation-duration:1.5s; - -ms-animation-duration:1.5s; - -webkit-animation-duration:1.5s; - -moz-animation-duration:1.5s; - animation-iteration-count:infinite; - -o-animation-iteration-count:infinite; - -ms-animation-iteration-count:infinite; - -webkit-animation-iteration-count:infinite; - -moz-animation-iteration-count:infinite; - animation-direction:normal; - -o-animation-direction:normal; - -ms-animation-direction:normal; - -webkit-animation-direction:normal; - -moz-animation-direction:normal; - transform:scale(.3); - -o-transform:scale(.3); - -ms-transform:scale(.3); - -webkit-transform:scale(.3); - -moz-transform:scale(.3); - border-radius:9px; - -o-border-radius:9px; - -ms-border-radius:9px; - -webkit-border-radius:9px; - -moz-border-radius:9px; -} - -.fountainG.fountainG_1{ - left:0; - animation-delay:0.6s; - -o-animation-delay:0.6s; - -ms-animation-delay:0.6s; - -webkit-animation-delay:0.6s; - -moz-animation-delay:0.6s; -} - -.fountainG.fountainG_2{ - left:13px; - animation-delay:0.75s; - -o-animation-delay:0.75s; - -ms-animation-delay:0.75s; - -webkit-animation-delay:0.75s; - -moz-animation-delay:0.75s; -} - -.fountainG.fountainG_3{ - left:27px; - animation-delay:0.9s; - -o-animation-delay:0.9s; - -ms-animation-delay:0.9s; - -webkit-animation-delay:0.9s; - -moz-animation-delay:0.9s; -} - -.fountainG.fountainG_4{ - left:40px; - animation-delay:1.05s; - -o-animation-delay:1.05s; - -ms-animation-delay:1.05s; - -webkit-animation-delay:1.05s; - -moz-animation-delay:1.05s; -} - -.fountainG.fountainG_5{ - left:54px; - animation-delay:1.2s; - -o-animation-delay:1.2s; - -ms-animation-delay:1.2s; - -webkit-animation-delay:1.2s; - -moz-animation-delay:1.2s; -} - -.fountainG.fountainG_6{ - left:67px; - animation-delay:1.35s; - -o-animation-delay:1.35s; - -ms-animation-delay:1.35s; - -webkit-animation-delay:1.35s; - -moz-animation-delay:1.35s; -} - -.fountainG.fountainG_7{ - left:81px; - animation-delay:1.5s; - -o-animation-delay:1.5s; - -ms-animation-delay:1.5s; - -webkit-animation-delay:1.5s; - -moz-animation-delay:1.5s; -} - -.fountainG.fountainG_8{ - left:94px; - animation-delay:1.64s; - -o-animation-delay:1.64s; - -ms-animation-delay:1.64s; - -webkit-animation-delay:1.64s; - -moz-animation-delay:1.64s; -} - - - -@keyframes bounce_fountainG{ - 0%{ - transform:scale(1); - background-color:rgb(0,0,0); +.fountainG { + position: absolute; + top: 0; + background-color: rgb(0, 0, 0); + width: 13px; + height: 13px; + animation-name: bounce_fountainG; + -o-animation-name: bounce_fountainG; + -ms-animation-name: bounce_fountainG; + -webkit-animation-name: bounce_fountainG; + -moz-animation-name: bounce_fountainG; + animation-duration: 1.5s; + -o-animation-duration: 1.5s; + -ms-animation-duration: 1.5s; + -webkit-animation-duration: 1.5s; + -moz-animation-duration: 1.5s; + animation-iteration-count: infinite; + -o-animation-iteration-count: infinite; + -ms-animation-iteration-count: infinite; + -webkit-animation-iteration-count: infinite; + -moz-animation-iteration-count: infinite; + animation-direction: normal; + -o-animation-direction: normal; + -ms-animation-direction: normal; + -webkit-animation-direction: normal; + -moz-animation-direction: normal; + transform: scale(.3); + -o-transform: scale(.3); + -ms-transform: scale(.3); + -webkit-transform: scale(.3); + -moz-transform: scale(.3); + border-radius: 9px; + -o-border-radius: 9px; + -ms-border-radius: 9px; + -webkit-border-radius: 9px; + -moz-border-radius: 9px; +} + +.fountainG.fountainG_1 { + left: 0; + animation-delay: 0.6s; + -o-animation-delay: 0.6s; + -ms-animation-delay: 0.6s; + -webkit-animation-delay: 0.6s; + -moz-animation-delay: 0.6s; +} + +.fountainG.fountainG_2 { + left: 13px; + animation-delay: 0.75s; + -o-animation-delay: 0.75s; + -ms-animation-delay: 0.75s; + -webkit-animation-delay: 0.75s; + -moz-animation-delay: 0.75s; +} + +.fountainG.fountainG_3 { + left: 27px; + animation-delay: 0.9s; + -o-animation-delay: 0.9s; + -ms-animation-delay: 0.9s; + -webkit-animation-delay: 0.9s; + -moz-animation-delay: 0.9s; +} + +.fountainG.fountainG_4 { + left: 40px; + animation-delay: 1.05s; + -o-animation-delay: 1.05s; + -ms-animation-delay: 1.05s; + -webkit-animation-delay: 1.05s; + -moz-animation-delay: 1.05s; +} + +.fountainG.fountainG_5 { + left: 54px; + animation-delay: 1.2s; + -o-animation-delay: 1.2s; + -ms-animation-delay: 1.2s; + -webkit-animation-delay: 1.2s; + -moz-animation-delay: 1.2s; +} + +.fountainG.fountainG_6 { + left: 67px; + animation-delay: 1.35s; + -o-animation-delay: 1.35s; + -ms-animation-delay: 1.35s; + -webkit-animation-delay: 1.35s; + -moz-animation-delay: 1.35s; +} + +.fountainG.fountainG_7 { + left: 81px; + animation-delay: 1.5s; + -o-animation-delay: 1.5s; + -ms-animation-delay: 1.5s; + -webkit-animation-delay: 1.5s; + -moz-animation-delay: 1.5s; +} + +.fountainG.fountainG_8 { + left: 94px; + animation-delay: 1.64s; + -o-animation-delay: 1.64s; + -ms-animation-delay: 1.64s; + -webkit-animation-delay: 1.64s; + -moz-animation-delay: 1.64s; +} + +@keyframes bounce_fountainG { + 0% { + transform: scale(1); + background-color: rgb(0, 0, 0); } - 100%{ - transform:scale(.3); - background-color:rgb(255,255,255); + 100% { + transform: scale(.3); + background-color: rgb(255, 255, 255); } } -@-o-keyframes bounce_fountainG{ - 0%{ - -o-transform:scale(1); - background-color:rgb(0,0,0); +@-o-keyframes bounce_fountainG { + 0% { + -o-transform: scale(1); + background-color: rgb(0, 0, 0); } - 100%{ - -o-transform:scale(.3); - background-color:rgb(255,255,255); + 100% { + -o-transform: scale(.3); + background-color: rgb(255, 255, 255); } } -@-ms-keyframes bounce_fountainG{ - 0%{ - -ms-transform:scale(1); - background-color:rgb(0,0,0); +@-ms-keyframes bounce_fountainG { + 0% { + -ms-transform: scale(1); + background-color: rgb(0, 0, 0); } - 100%{ - -ms-transform:scale(.3); - background-color:rgb(255,255,255); + 100% { + -ms-transform: scale(.3); + background-color: rgb(255, 255, 255); } } -@-webkit-keyframes bounce_fountainG{ - 0%{ - -webkit-transform:scale(1); - background-color:rgb(0,0,0); +@-webkit-keyframes bounce_fountainG { + 0% { + -webkit-transform: scale(1); + background-color: rgb(0, 0, 0); } - 100%{ - -webkit-transform:scale(.3); - background-color:rgb(255,255,255); + 100% { + -webkit-transform: scale(.3); + background-color: rgb(255, 255, 255); } } -@-moz-keyframes bounce_fountainG{ - 0%{ - -moz-transform:scale(1); - background-color:rgb(0,0,0); +@-moz-keyframes bounce_fountainG { + 0% { + -moz-transform: scale(1); + background-color: rgb(0, 0, 0); } - 100%{ - -moz-transform:scale(.3); - background-color:rgb(255,255,255); + 100% { + -moz-transform: scale(.3); + background-color: rgb(255, 255, 255); } } - -.analysis-nav ul li{ +.analysis-nav ul li { margin-right: 10px; margin-bottom: 10px; background-color: white; } -.analysis-nav .nav-pills li a:hover,.analysis-nav .nav-pills li a:focus,.analysis-nav .nav-pills li.active a{ + +.analysis-nav .nav-pills li a:hover, .analysis-nav .nav-pills li a:focus, .analysis-nav .nav-pills li.active a { background-color: #f06101; - border-top-color:#f06101; + border-top-color: #f06101; } -.channel-icon{ +.channel-icon { width: 16px; height: 16px; } -.channel-icon-lg{ + +.channel-icon-lg { width: 48px; height: 48px; } -.settle-forecast .rc-box .week .day{ - height:120px; + +.settle-forecast .rc-box .week .day { + height: 120px; } -.dashboard-page .tooltip .tooltip-inner{ +.dashboard-page .tooltip .tooltip-inner { max-width: 600px; text-align: center; } -.partner-settlement_page .tooltip .tooltip-inner{ - max-width: 600px; - } +.partner-settlement_page .tooltip .tooltip-inner { + max-width: 600px; +} .partner_list_style { position: relative; @@ -824,8 +823,17 @@ color: #ffffff; } -.check-i{ +.check-i { color: #00a65a; float: right; margin-top: 8px; +} + +.settle-result-box .box-header { + cursor: pointer; +} + +.settle-result-box .settle-result-table .bank-logo { + width: 24px; + vertical-align: middle; } \ No newline at end of file diff --git a/src/main/ui/static/images/bank/ANZ.png b/src/main/ui/static/images/bank/ANZ.png new file mode 100644 index 0000000000000000000000000000000000000000..661d0e6d0903dc1567e089bb902f076c4f21f7a1 GIT binary patch literal 7342 zcmV;f98u$mP) zdz4*Om9M|G_TJ}Fb?TA#3qleg;VB5+0-_hB0mW!|h(d#2kZVKZ;EwKQj8+)nkXA3< zw%ymhjiQ2AxwL?yBA{@afeq5~mVkmN5MFtZgrq7-Rh{?Vd(HdD+9#Z=11JGB5Q3is0!VC!(fz?01J^()3Cai25E}T` zQvjy}{k12i9%8pmRJ0KieN-=E&Op?Oh`J6TF5FKl)A>eAw3+z$i%h2Qe?Vn$Ud=cy}{K zdP-t#4xg%{LV-h$9N*cBef~YeQ?zZ-N=SZ3qA&@Z8Z@$kauNU|x08WRA4X3^wzi2Ic zyGfMPfm{+64Z}GvydOXPpO}4Mja351g)x00?&$5LI?Mq7x8G8Vu<3r{&TW&j39g@)kQ9-1Jx2kvRcnKcpJsdF22j&R6^Lhmv1A*_s6ZVA^6}}?IZcHTaP+&G(|aOH9_utY6~r?@*rt6K z0UUD*nrZ1UX$q8pQ7iG?$EFLD$1_0NM6m+obZb0Mliq0sgcDIZiZt##;u*m8+dxJH zqmF8ML{BFn3LH5Om7hzYmB#ySa=q^v%GZ+_Gf*YF;w!qMLb zQDq~nk3gw+?)qPW2qfJlBs)L&P!$8TO#&=vPeUDsO)^?Q!b}ThuYv&*t)~J71al$a z9jyR@jS%wn3bv)Eg(6r*KuEikK$-uJRsbuorr-jyDf|B&e&s48fN4Dy0I1n*YA9-s z&WPZ^fn+eqiY@!d63{L`fZ(;I9i_m?4uq$pgiiqmfjtc?UGe^*ziX%e~+jiBNTB}l+h!gw8EHGO}?vE8bypz7_!e69WHX=H{Pbr0+lqPP60tho;MJ=k(D5 zU~5xnTiS==Oqs`)y^r4FiyX3ns-&3$G6Ael4)f!8oxmAuf5)7W1r(d4qKJTYU&3{n z4q9LpIzY4=*m_zwH?bf0HZeHyFb~xgEc4zOaN}k&M6{Mh?eidOdsZN z+ZB+i1xn7-l$~c$a!mb%?IiFCRIsKY7l2@wDp8hBQFfAwfpTaISd4kQ6y7ONMNp`= z44|TxCHhsu1>FmN07`>N*bwMOV4R0RRyOt!0rV>vFPLIR+IJ>{9&P8Q=J-KwB*99{0~{O?G(xlD40S&$-s8hWDMvSTh-%*MfQ6# zIt8mtE#5JM{-V9NE}Ar$@D>(tv2E2P;RIAARNmOxKboqYi6%hvQhzH7Nf}kWfq5yq_lTnb=NJ5`{cWGPNaIQxyyAqG#8GM$!6P_^C+8 zr~)e5s}KPlRU$JXB&2Dv1kKO=HUI)khwTzzurJ~&D#Nu9#S3rO25S(*a^Y`8Uz${S{gtR&)J5QIHH^UiK6=3_gIKLfJAJw)I+*YBH@{ z1YG~)II5As--^Ta)!%Ncl^6&lTboAKhUyPdrzIRKzWm5%pvKwZd%^&LxrUVbSzVi^ zp@zV@kc7DgM<%vSMO*7dHi7YXxxDux!~-?!yt*SuL_n!8ft!o}ebj~#kgzQqv8`u- zis(wakWPXr*leR72L^LYxHT()D&GzICWd-0#jjE0^&RLbFJd5nCCd3nRK@)_4oX>R zQ}FEIPiP7XXy-gcj;+ru6>xX}_y%SQABiYC=-Nh%?xe5ccWEKoRR2Xqegh3|0n!Sd zJq&)c(CP&fZMFIuw7HzKpFfpZqsu7Nup6f$k?yCyh@ZQiAiKdb!8nMqUcvM{`z?Da ziwXpX(7)a~xM~=Q$~by%j-0w=LR}_O=qVfU45YDtkjUv~+Ot#G<^n)s#j`Q6U_0~= zKsIvA?wKT^H8^5$@)x4ziMk}P(LJc}pK!;{XRnB}5b&T}@uZDMv`jgre?pmMHOpd+ zWvF4fkbGjJt#G#cb&u;Rk5t(_*I0~MeYlA=o|z^AcUC(+wnX1 z77V;S^GQmx&!w;Q6GoCXjzt-q{_|kQKO^Qhd(nYFIZq`sWfugLGauz#9&5Qw1V=+5 zxPrAK_gHDL$Fqxon}Ee-80-O)fv{5Ty1nR32{1>XtYLG;?k6|_Ji0$Tav%&AAXAEF zLnKQ_GC$?0jsKMozI-eBL=AgIk-y&rpC^=ace_*>^NfjjVUNxa&DDfDS>Kq*=TUsq zdKkqrfWj_=C1t&j`)9x_SWUl!=-`PV(Ex|W&Y0uhf{nA_h4~ZT{?eR(%6XK>(%BA)%Kdys>BVWK+8f0Et|!Zm_DR8L1+v6>=%4n|HRMlwHosp{058AnaEJ z2_UN?rw$zp4w@ddN{Wt6K>6>Fz-3QZJAO~taPE64`$wU}Z8dh9!tlXeyJnG1Z#29* z174a9ugtWc-_L=Ky({tjB~?FND+opK&1ooZ-m__nzGZ@g2VrrK^#m5BrWa@xrpK8< zTI_D%+L>_dT9}iC8{Y@p(tF+ry7)YKXCW$iC#mA9sud^2;@!N0CUR3BzGG}xxpBZsfWP@Q9J6PAq9~%r zcS{(3CYm!qZMUjIjDK9jBaF7O$A4V4_s7AVJZd;vBJ9axC6u{{(42_UTWoL2E;Fta zz`O*k7=)w)#i0Ie?iQhm3{b5&o9e#E88X~!ojI324kx^BFYR?2hk&Sm2j-#WN8DGjDz$ zl#ABUQ`t+7ZNM7ft#J+3^x!?w7y}qN5Qno+sdIrPxMnUgsZs2I%0Q7-63RngDG?4iSb5UsA@i~f-?W+_7Y^A5X0WJ4p_%VtX>$N0mX8`*$?*sV< z3@73!>%NTNu2f*=Al@91!w|VVvcG-?@_mqB?B(#+SkK}1H0(DL&DyHoRDdR&bRj;l z0g0SJJFAxOF``DptSk&CVbdH~ya@{KBqBWWZ7A~r+}?{2a{&@g?B|~BHI15s7tTR= zH=@1>@**Nv13$0z4Xf7y1n|OM6c3=(uMtk%MP#)mO~nDe+r4Ll+zU!d zA=#dc@(EF)ZT}sxDFa_U4T2Q(7MXBBb$BL@8A8;}pk_i8#@$R`fKf*?;J<|{#}iUj zzI8kUq&4)rkZ}Hkz|3r%%Bdg_IB9yy-=VkkIH8`icmFux6yc2_7%JNXEu1?1^^L$N z8%4C=4p_ZE{PQW0ovf6O@=)A`Hg^NFc4^KnB3KkS=0Ro+EnrUkDj3fIM+|x#)c+M+ zwY=(Bwnkyit`pF*1xKI1`$YlQwSgtCY=;e5a2-h0;2v&-Fr%Qa1oN`+v%}%0;~{W& zy9L22g-QRvkTf}rKD%uUY7}Ubp*OsqjG4r*z6LXVBZ3>C;7(YR@x&tL& zwV5!L>tYAoQ?Pan){NRsm2?Xoo0a{7MLVoA_`gnqUmP~ceHyg7f@Jv-ywGd=iK3z) zbXE~MtKx30qE@gRftKY>A*>#hH4GL%$3XEQ3f{+d7A+I3BA9kzvk&20(Axtu6Sf2V zCKlij?3sYQWw`ffxc`vJYbc9=qyHza`Ww3jt4_InXCe|C$y`mL$c?~OU~%I#)d>Y? zIS0e9fRlIry)rA^gble{pMz{KEb4_`*LwS!u`IaCDr~=80>4~geFy{j-2*rR2Ye3} zj@(MY`&8qNHjE-lkHy^-&j9nseo3ewV0-E>2y~Nj)S$U||r#xuaJe>%iK;U748&8Klgmy$R2rc0|4n3cGRe`Ejjr~Gkc%suJ?S6%>#BYCxUOH z*=vacd&LB5 zu_vWeQm`k27I-@Y?_Il;lh?0ddwLq2Xs$r1`*CtBaf`DM z_*stJw49>*XB{o;8$^A5?z1G_zDny-=We z8E5oksL-CfT-~o?aMd05TZn2odp&sluaIC-+p5S;1?66aQeUlkS#rgin9ujwZ@0z= zWIb51<9rU?b_ZK}I$4)JgI)cq*Fz%Na>a8sWz7=qQVsIg%-z1%> z>5Srd1}Gf0cVipWQ*16>z=Dz6kxn1*s57YWN|b+1T>(znIyhJi=+viiyo2{j`e-*i z4cYS5ygv3*JZ*gzHTb~d-@G@!_uuj!^k?C+r@zb$b1nH!E`b^_8*w)ufG!6UCwWc; z12~}P+V5)Dv&xRPubxHpyXzphd2kGr)BlG}{TEa8CobCdgZE7NhU|UcJrsCD zeF3+BISKsUBm!>ikcWe6u9C0af8kdJ_?L}96fR|v&wbH zM^sTIY!VYofP#Vz`SV!TcPL67*)coVF;K{y&Pe)}s>eSH%weEdTZv*3!2Ou@4RlKJ zQ=r*`&aEVwh0J#9Rm9>MVA&M67y(rT+z%l=e}HhHE-D&DDB#Iy%p!%&yo-lTG=Z!i zy+;)tSWy=SoRd11&0{nS7Qy7tASmy!CHm@Lg5wz=GsQKfEJ0y*BbpCkdY))y+5ah_ zn2n>Cg8E~X_uBzXCaSk&?0xe=AJGwMr^JSv-TkhQ^Vp(i=`S{HfyFaGoMP>$sO(Gj zNkaF(;V1t$p#&LQ-JzFbAE;Oc0!RX0N@jeL$n1`j8xKTN6Sgowr<>VTRDXV1zZv2DmvZC(5YYwL&V zIkF??iXZ)lb_X4)z4~S6|_vvN3xol zMMm?cUmRQmVFG^du4F^7jYJwI@XIySMC=_~>L}RhD;P4HIce=Gdd*{Yue~i|)2qF> zQq5~r`;rl6=iyfi&*rB`Jlm=!;u+v?e^BS61E325fYWHB6R?1=X(5>_g!^PAh0f7EznoA z-_`5}YJqH`Own!K_ODUUqktXX=Jm0Eq`v@1yjGpYUk9pme>I4i1-SCj+tA?!6k4SZ zC{X5UBs{LF+bh+=*UX=~TKIUB9ay^U9_Hj$H55cL83gDHAlvr{-#+SOwo2n?cbBJj z&c?sRiH|i#fbT#e4?~+SWdDI>lrqN?w!l1eLMSAL8Oc;PJGIzZRfvvOsm4+%xnT6B zmITEb1xX-1_6F-mK0<09EKY*kpvE8L$BAcvmk(%+04=ua=c6aU0j0CJWcBZG%sl)i zi!^HnzE07tu8w}CTKLJY##alkzy^UnLoRt)(}O?~A(*7$uEWk`eLl<54eYF$*a#YC zfJHH9?Ny7}Wtg$!ZIZduG3npptLAEjWfxL~M>%-=l^>loR%t*U`sE!edo}d`6;7Gnif%`fPfVkUa4t$ z@oJVtGZ3=@d+u9vkPuMCD^O$K+%3_x8TewOF@d)q-7Hcp0t23R7e{$tVByG@DK$YE zFba~vS~8_qsxKQSb|-VB*M3*Ou5ZVa)oAnnrd0fL6cqGLyb*pA<3dlRa%tm_t_JO~ z0w%(NL-5%rZe%2RdBYu<3}ExX&8!=|lth(EQ$+_@K2*I9P=W9jkZbBAb{x_nloCJZ zYwur0zE%FEsrxp*=THAdvnbhxP=WGcVF(BIKZwYw4TTYS26iM)XQ=l|LzO zze#`Irk}SWy7~)$J>}*27MI3m7}p2ei7=Fa1IG^GldGR6r)n>zpf#XYVz|F9I_f#V z5kRS1 zj$MKQYxjY13LHI&n^qW@Bo-gm0nqE!l%%Cdg+U`F$scT0z=22oTv z^Szp)!gr!9FdvWk`Xx4{myu6Q?M@b8W(i)M^LN~M+;ug!)&Qm+;wsX^+rXtllxL8; ziRA-J(dw$$ZCzKvSnxrH{mtM_P)j%t0g!-KkG9{n23aUzjrJ)9CvohC=b2HML20tG zF+|0po!c4OaveuJ1AS$iUe@a3(T`4jIi3LyYEw*CdF1qNVi!Qq8qKhuN`2Pz35BU#> Uc(`}8;s5{u07*qoM6N<$g7$vcEdT%j literal 0 HcmV?d00001 diff --git a/src/main/ui/static/images/bank/CBA.png b/src/main/ui/static/images/bank/CBA.png new file mode 100644 index 0000000000000000000000000000000000000000..733de6180dd4ebb5adb8465765adeaa001177cd2 GIT binary patch literal 1662 zcmV-^27&pBP)>=E_jetq&Z9kWK&q1zSl(K~#90&72E+(>4@_6JH83NlA&yXx6%2!iJWuEZlZu zP+%Jy|NjpW+e%{Dy6YUt-w){XKIheuj%7Ea5m@Ha8QdR(OL3h}Phvy#Q!LVPdNDY# z*)koE$LTbW4Z^3Wu_~}ZRjiWOBwY*$Y&P9vRTUddSLRQSSUa%mNo=4d`7|51lRhe9 zBUPDS^H}3?wj6-U$&)Ttr80WOibWr509~0+Qvp`B#-c9%$x@6}Z5I($7LR0DQB_V9 zSP@m`Qi*$&QNUCZBdW}`SW#5!Bt}xHUh?gV1>G)8Bt}q~FGYt>bd~x}=0SxaDpIy6SA>Lh_ zI!oMxouXh}_+jn9E)c+Gp4Dn92Hus0;|9?M1Fo1)Cvsr0D*ZZ<1B2{J7>Ro@u!=!R zWMEJ#XMokJ!C+JtU~B6L25=<7N@QUED&6KSEtv1)+X=ufF9!3fnE#n51@lpfBawl* zkJeZc8JMd|j85dh+}^%H3^p1tm%9u3l`bHd{pGOT9fUKO?Zb%qMUp3&oyrgr8JLaA zQ{+zMz!t{a1@;Ef0lP4)nES)NTeAPZ8Jff@Wc~R+1F*0XcUgT-l7F>em`AlJyJ{tg z9xS}Xr%9p*iy~1E=6W0G8nXV79P;?Sv|52Th=W81CaKsYp2Q~K3BiJQ;_5@viAd#X z@D1W=7fYn_1ntR3l9d3fuW}N4$(KEeP0sEOP9g(qRSfU(RT8npuFBvNS1;vQNpkgo zRV(gx+Ryp@7!os;#3t1~Ci@}@D;kNcVwa=gbRq{fnhU;n!%Mb$XM&YnR_9_kFw#A$ z#c4LzJXpoZ+NfGLY|js+GBaCSmBc39FHn(E{$MVVf%U#YMF_dIkr+&6wlP{Nm~Wx~Ib0RSc&qH<~%(Mp>;I45MP?wYpqtiD)Xb zQawALX(VE)r0Nq}FA+&)sa#zq5}8Wa?SgLKD6n*$$W;tARu3hy ziHpiibUz3uk%8G)jL@G@B{s1idjuC=Zi9_Fwr3@|?Tydk7wf(e{SttxT+g~#S14GP zU74*ubtQVAiL%(7mAwluzrjWWX0EdATzFj}Vp*u9+fWjln5v}w_>3u$ff=bJ{FTHR zI+mHr&Jlzyv5A37{uR|jiyIp+Fx||bt^Nrtv58J4xqT5@A_G%bto=sM{5B9BtbJme zUFiaXDO9#j?2r-}n6zTq`cN+X?X(|hR~|3CWM5d~My9gdUwGjj)e10S#SR0`#EGwFN2ht6wWD_{UfKaBGZ? z>$MepmlvhI#_IRQ(0357nIBY=?epE470qy!&fl)vA(@-~RbWYzR^2zXMAA3LsE_4A?NRAOHXW07*qo IM6N<$f(<(q+5i9m literal 0 HcmV?d00001 From c30b9f0d728e59559088e5012f0bfb1d779e5695 Mon Sep 17 00:00:00 2001 From: yixian Date: Wed, 27 Jun 2018 12:01:47 +0800 Subject: [PATCH 21/23] ui update --- src/main/ui/static/analysis/templates/settlement_detail.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/ui/static/analysis/templates/settlement_detail.html b/src/main/ui/static/analysis/templates/settlement_detail.html index 5157836b1..51d386d05 100644 --- a/src/main/ui/static/analysis/templates/settlement_detail.html +++ b/src/main/ui/static/analysis/templates/settlement_detail.html @@ -180,7 +180,7 @@
    - + From f226209c9a080b3633db18c3d49a7ab1efac28b7 Mon Sep 17 00:00:00 2001 From: yixian Date: Wed, 27 Jun 2018 12:20:45 +0800 Subject: [PATCH 22/23] settle mail fix --- .../manage/management/clearing/core/impl/CleanServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 196ccd952..6431ae5e8 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 @@ -404,7 +404,7 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider if (settle.getBigDecimal("clearing_amount").compareTo(BigDecimal.ZERO) == 0) { continue; } - if (bank != null && Objects.equals(settle.getString("settle_bank"), bank)) { + if (bank != null && !Objects.equals(settle.getString("settle_bank"), bank)) { continue; } Row row = sheet.createRow(rowNum++); From d48d4393d1197d5763bc557eb208ca785d22d315 Mon Sep 17 00:00:00 2001 From: eason Date: Wed, 27 Jun 2018 15:30:18 +0800 Subject: [PATCH 23/23] short url --- .../payment/manage/merchants/core/ClientManager.java | 1 + .../manage/merchants/core/impls/ClientManagerImpl.java | 7 +++++++ 2 files changed, 8 insertions(+) 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 28b1d03c2..efbba73e0 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 @@ -319,4 +319,5 @@ public interface ClientManager { void removeSub(String client_moniker, JSONObject manager); + String getShortLink(String client_moniker); } 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 a47653f6c..59268e5e0 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 @@ -3663,4 +3663,11 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } mailService.removeUnsub(sub.getLong("id")); } + + @Override + public String getShortLink(String client_moniker){ + String longUrl = PlatformEnvironment.getEnv().concatUrl("/api/v1.0/hf_gateway/partners/"+client_moniker+"/jump"); + MpWechatApi api = mpWechatApiProvider.getNewPaymentApi(); + return api.registerShortUrl(longUrl); + } }