From f9f7bb15bdd01c0d92488750aa157287f777a66a Mon Sep 17 00:00:00 2001 From: luoyang Date: Thu, 24 Jan 2019 17:33:12 +0800 Subject: [PATCH 1/6] add app_style balance --- src/main/ui/static/cms/cms.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/main/ui/static/cms/cms.js b/src/main/ui/static/cms/cms.js index 156cda39b..937c8ccc8 100644 --- a/src/main/ui/static/cms/cms.js +++ b/src/main/ui/static/cms/cms.js @@ -64,6 +64,26 @@ define(['angular', 'uiRouter', 'static/commons/angular-ueditor'], function (angu { "style_key":"home_gray", "style_value":"" + }, + { + "style_key":"balance", + "style_value":"" + }, + { + "style_key":"pro_collection", + "style_value":"" + }, + { + "style_key":"pro_tralogs", + "style_value":"" + }, + { + "style_key":"pro_qrcode", + "style_value":"" + }, + { + "style_key":"pro_coupon", + "style_value":"" }]; app.config(['$stateProvider', function ($stateProvider) { $stateProvider.state('cms', { From 335290dc01da9006a71b51b5938a025b773c9951 Mon Sep 17 00:00:00 2001 From: luoyang Date: Thu, 31 Jan 2019 09:22:55 +0800 Subject: [PATCH 2/6] fix org commission year --- src/main/ui/static/config/orgcommission/orgcommission.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/ui/static/config/orgcommission/orgcommission.js b/src/main/ui/static/config/orgcommission/orgcommission.js index 2ef6f53e9..c9225b69c 100644 --- a/src/main/ui/static/config/orgcommission/orgcommission.js +++ b/src/main/ui/static/config/orgcommission/orgcommission.js @@ -97,7 +97,7 @@ define(['angular','../../analysis/org/analysis-org'], function (angular) { }) }) }; - $scope.availableYears = [new Date().getFullYear() - 1, new Date().getFullYear()]; + $scope.availableYears = [new Date().getFullYear() - 2,new Date().getFullYear() - 1, new Date().getFullYear()]; $scope.params = {}; $scope.months = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]; $scope.loadAvailableMonths = function (year) { From 7dc090209c4ff1833266663746c133f9b3f130e9 Mon Sep 17 00:00:00 2001 From: lujian Date: Thu, 31 Jan 2019 14:00:31 +0800 Subject: [PATCH 3/6] =?UTF-8?q?[fix]=E5=88=B0=E8=B4=A6=E6=8F=90=E9=86=92?= =?UTF-8?q?=E9=80=9A=E7=9F=A5=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../clearing/web/ArrivalNoticeController.java | 66 +++++++++++++++++++ .../templates/reports/arrival_notice.html | 46 +++++++++++++ 2 files changed, 112 insertions(+) create mode 100644 src/main/java/au/com/royalpay/payment/manage/management/clearing/web/ArrivalNoticeController.java create mode 100644 src/main/resources/templates/reports/arrival_notice.html diff --git a/src/main/java/au/com/royalpay/payment/manage/management/clearing/web/ArrivalNoticeController.java b/src/main/java/au/com/royalpay/payment/manage/management/clearing/web/ArrivalNoticeController.java new file mode 100644 index 000000000..46919c3c8 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/management/clearing/web/ArrivalNoticeController.java @@ -0,0 +1,66 @@ +package au.com.royalpay.payment.manage.management.clearing.web; + +import au.com.royalpay.payment.manage.mappers.log.ValidationLogMapper; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import netscape.javascript.JSObject; +import org.apache.commons.lang3.time.DateUtils; +import org.apache.xerces.impl.validation.ValidationManager; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; + +import javax.annotation.Resource; +import java.text.ParseException; +import java.util.*; + +/** + * @Description: + * @Author: lujian + * @Date: 2019/1/30 13:50 + */ +@Controller +@RequestMapping("/sys/financial") +public class ArrivalNoticeController { + + @Resource + private ValidationLogMapper validationLogMapper; + + @GetMapping("/notice") + public String noticePage(HashMap map, + @RequestParam("date") String date) throws ParseException { + + JSONArray reports = new JSONArray(); + Date dt = DateUtils.parseDate(date, new String[]{"yyyyMMdd"}); + JSONObject reportItem = validationLogMapper.findByDate(dt); + if (reportItem != null) { + JSONObject result = JSON.parseObject(reportItem.getString("result")); + reports = result.getJSONArray("channel_details"); + for (int i = 0; i < reports.size(); i++) { + JSONObject channelItem = reports.getJSONObject(i); + String channel = channelItem.getString("channel"); + if (channel.equals("Wechat") && result.containsKey("wechat_analysis")) { + JSONObject wechatAnalysis = result.getJSONObject("wechat_analysis"); + List analysis = new ArrayList<>(); + for (Map.Entry entry : wechatAnalysis.entrySet()) { + JSONObject oneMerchant = new JSONObject(); + oneMerchant.put("merchant_id", entry.getKey()); + oneMerchant.put("order_amount", ((JSONObject) JSON.toJSON(entry.getValue())).getJSONObject("wechat_analysis").getBigDecimal("order_amount")); + analysis.add(oneMerchant); + } + channelItem.put("analysis", analysis); + } + if (channel.equals("Bestpay") && result.containsKey("bestpay_valid_analysis")) { + List analysis = new ArrayList<>(); + analysis.add(result.getJSONObject("bestpay_valid_analysis")); + reports.getJSONObject(i).put("analysis", analysis); + } + } + } + map.put("reports", reports); + map.put("title", "到账提醒"); + return "reports/arrival_notice"; + } +} diff --git a/src/main/resources/templates/reports/arrival_notice.html b/src/main/resources/templates/reports/arrival_notice.html new file mode 100644 index 000000000..9b7280ce4 --- /dev/null +++ b/src/main/resources/templates/reports/arrival_notice.html @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + +
+
+
+
+ +
+
+
+
+ + +
+
+ +
+
+ + +
+
+
+
+
+ + From 375f0a38823382068d028b87fa2a879e60731a94 Mon Sep 17 00:00:00 2001 From: yixian Date: Fri, 1 Feb 2019 10:18:17 +0800 Subject: [PATCH 4/6] aba file remark from param outside --- .../clearing/core/impl/CleanServiceImpl.java | 6 +- .../manage/support/abafile/ABAFile.java | 24 ++++--- .../payment/manage/process/ABAGenerator.java | 66 +++++++++++++++++++ 3 files changed, 84 insertions(+), 12 deletions(-) create mode 100644 src/test/java/au/com/royalpay/payment/manage/process/ABAGenerator.java 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 52cce8e4d..fe3cc88e1 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 @@ -546,8 +546,10 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider if (settle.getBigDecimal("clearing_amount").compareTo(BigDecimal.ZERO) == 0) { continue; } - aba.addSettleMerchant(settle.getString("client_moniker"), settle.getString("bsb_no"), settle.getString("account_no"), settle.getString("account_name"), - settle.getBigDecimal("clearing_amount")); + String clientMoniker = settle.getString("client_moniker"); + String remark = "RoyalPay" + DateFormatUtils.format(dt, "MMdd") + clientMoniker; + aba.addSettleMerchant(settle.getString("bsb_no"), settle.getString("account_no"), settle.getString("account_name"), + settle.getBigDecimal("clearing_amount"), remark); } return aba; } 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 5e893936b..9e0f0d2e2 100644 --- a/src/main/java/au/com/royalpay/payment/manage/support/abafile/ABAFile.java +++ b/src/main/java/au/com/royalpay/payment/manage/support/abafile/ABAFile.java @@ -29,8 +29,8 @@ public class ABAFile { totalSettleAmount = BigDecimal.ZERO; } - public void addSettleMerchant(String clientMoniker, String bsbNo, String accountNo, String accountName, BigDecimal settleAmount) { - settlements.add(new SettleMerchantInfo(clientMoniker, bsbNo, accountNo, accountName, settleAmount)); + public void addSettleMerchant(String bsbNo, String accountNo, String accountName, BigDecimal settleAmount, String remark) { + settlements.add(new SettleMerchantInfo(bsbNo, accountNo, accountName, settleAmount, remark)); totalSettleAmount = totalSettleAmount.add(settleAmount); } @@ -129,18 +129,18 @@ public class ABAFile { } private class SettleMerchantInfo { - private final String clientMoniker; private final String bsbNo; private final String accountNo; private final String accountName; private final BigDecimal settleAmount; + private final String remark; - public SettleMerchantInfo(String clientMoniker, String bsbNo, String accountNo, String accountName, BigDecimal settleAmount) { - this.clientMoniker = clientMoniker; + public SettleMerchantInfo(String bsbNo, String accountNo, String accountName, BigDecimal settleAmount, String remark) { this.bsbNo = bsbNo; this.accountNo = accountNo.replaceAll("\\D", ""); this.accountName = accountName; this.settleAmount = settleAmount; + this.remark = remark; } public String settleLine() { @@ -151,7 +151,7 @@ public class ABAFile { lineBuilder.replace(18, 20, "50"); lineBuilder.replace(20, 30, getSettleAmount()); lineBuilder.replace(30, 62, getAccountName()); - lineBuilder.replace(62, 80, StringUtils.rightPad("RoyalPay" + DateFormatUtils.format(settleDate, "MMdd") + clientMoniker, 18)); + lineBuilder.replace(62, 80, StringUtils.rightPad(getRemark(), 18)); lineBuilder.replace(80, 87, bsbNo(base.getBsb())); lineBuilder.replace(87, 96, StringUtils.leftPad(base.getAccountNo(), 9)); lineBuilder.replace(96, 112, StringUtils.left(StringUtils.rightPad(base.getAccountName(), 16), 16)); @@ -159,19 +159,23 @@ public class ABAFile { return lineBuilder.toString(); } - private String getBsbNo() { + protected String getRemark() { + return remark; + } + + protected String getBsbNo() { return bsbNo(bsbNo); } - private String getAccountNo() { + protected String getAccountNo() { return StringUtils.leftPad(StringUtils.right(accountNo, 9), 9); } - private String getAccountName() { + protected String getAccountName() { return StringUtils.rightPad(StringUtils.substring(accountName, 0, 32), 32); } - private String getSettleAmount() { + protected String getSettleAmount() { Assert.isTrue(settleAmount.compareTo(BigDecimal.ZERO) > 0, "Invalid Settle Amount:" + settleAmount.toPlainString()); return amountString(settleAmount, 10); } diff --git a/src/test/java/au/com/royalpay/payment/manage/process/ABAGenerator.java b/src/test/java/au/com/royalpay/payment/manage/process/ABAGenerator.java new file mode 100644 index 000000000..6361dbfc8 --- /dev/null +++ b/src/test/java/au/com/royalpay/payment/manage/process/ABAGenerator.java @@ -0,0 +1,66 @@ +package au.com.royalpay.payment.manage.process; + +import au.com.royalpay.payment.manage.support.abafile.ABAConfig; +import au.com.royalpay.payment.manage.support.abafile.ABAFile; +import au.com.royalpay.payment.tools.env.PlatformEnvironment; +import org.apache.commons.csv.CSVFormat; +import org.apache.commons.csv.CSVParser; +import org.apache.commons.csv.CSVRecord; +import org.apache.commons.io.FileUtils; +import org.junit.Before; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.test.util.ReflectionTestUtils; + +import java.io.File; +import java.io.FileReader; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +/** + * Create by yixian at 2019-01-17 12:47 + */ +public class ABAGenerator { + private ABAConfig.ABABase config; + private Logger logger = LoggerFactory.getLogger(getClass()); + private String csvFile = "C:\\Users\\yixian\\Documents\\royalpay\\2019\\cemtexaba-template-csv.csv"; + + @Before + public void prepareEnv() { + PlatformEnvironment env = new PlatformEnvironment(); + env.afterInitialize(); + ReflectionTestUtils.setField(env, "foreignCurrency", "AUD"); + config = new ABAConfig.ABABase() + .setBank("CBA") + .setApca("301500") + .setBsb("063109") + .setAccountNo("11505847") + .setAccountName("Tunnel Show Pty Ltd"); + } + + @Test + public void generate() { + ABAFile file = config.initFile(new Date()); + try (FileReader reader = new FileReader(csvFile)) { + CSVParser parser = new CSVParser(reader, CSVFormat.newFormat(',')); + List records = parser.getRecords(); + for (CSVRecord record : records) { + logger.debug("reading record:{}", record.toString()); + String bsb = record.get(0).replace("-", ""); + String accountNo = record.get(1); + String accountName = record.get(2); + BigDecimal amount = new BigDecimal(record.get(3)); + String remark = record.get(4); + file.addSettleMerchant(bsb, accountNo, accountName, amount, remark); + } + byte[] bytes = file.output(0); + FileUtils.writeByteArrayToFile(new File("C:\\Users\\yixian\\Documents\\royalpay\\2019\\cemtexaba-template.aba"), bytes); + logger.info("output done"); + } catch (IOException e) { + throw new RuntimeException(e); + } + } +} From 64b6779ff819f0e2a85323ea6a5b859f5d828846 Mon Sep 17 00:00:00 2001 From: yixian Date: Fri, 1 Feb 2019 10:19:49 +0800 Subject: [PATCH 5/6] ui bug fix --- src/main/ui/static/analysis/templates/cheat_monitor_risk.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/ui/static/analysis/templates/cheat_monitor_risk.html b/src/main/ui/static/analysis/templates/cheat_monitor_risk.html index 3a5088842..909e4007c 100644 --- a/src/main/ui/static/analysis/templates/cheat_monitor_risk.html +++ b/src/main/ui/static/analysis/templates/cheat_monitor_risk.html @@ -275,7 +275,7 @@
- +
@@ -283,7 +283,7 @@
- +
From db148d036f4aff8a3e0111459c019a9f245cf6e0 Mon Sep 17 00:00:00 2001 From: lujian Date: Fri, 1 Feb 2019 13:34:38 +0800 Subject: [PATCH 6/6] =?UTF-8?q?[fix]wexin=20=E8=A7=A3=E7=BB=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../manage/signin/core/ManagerWechatBindService.java | 2 ++ .../signin/core/impls/ManagerWechatBindServiceImpl.java | 8 ++++++++ .../manage/signin/web/ManagerWechatBindController.java | 8 ++++++++ .../payment/manage/mappers/system/ManagerMapper.xml | 2 +- src/main/ui/static/config/managers/manager.js | 8 ++++++++ .../ui/static/config/managers/templates/managers.html | 6 +++++- 6 files changed, 32 insertions(+), 2 deletions(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/signin/core/ManagerWechatBindService.java b/src/main/java/au/com/royalpay/payment/manage/signin/core/ManagerWechatBindService.java index 30217dd0f..d767c8fda 100644 --- a/src/main/java/au/com/royalpay/payment/manage/signin/core/ManagerWechatBindService.java +++ b/src/main/java/au/com/royalpay/payment/manage/signin/core/ManagerWechatBindService.java @@ -9,4 +9,6 @@ public interface ManagerWechatBindService { JSONObject newBindRequest(String managerId); void bindWechatUser(String bindId, String openid); + + JSONObject removeBindWechat(String managerId); } diff --git a/src/main/java/au/com/royalpay/payment/manage/signin/core/impls/ManagerWechatBindServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/signin/core/impls/ManagerWechatBindServiceImpl.java index 9d14988de..abc0d9d7e 100644 --- a/src/main/java/au/com/royalpay/payment/manage/signin/core/impls/ManagerWechatBindServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/signin/core/impls/ManagerWechatBindServiceImpl.java @@ -71,6 +71,14 @@ public class ManagerWechatBindServiceImpl implements ManagerWechatBindService,Ap publisher.publishEvent(new CommonPageEvent(this, bindId, "manager_bind_success",manager)); } + @Override + public JSONObject removeBindWechat(String managerId) { + JSONObject manager = managerMapper.findById(managerId); + manager.put("wx_openid", null); + managerMapper.update(manager); + return managerMapper.findById(managerId); + } + private void setOpenId(String managerId, String openId) { JSONObject manager = new JSONObject(); manager.put("manager_id", managerId); diff --git a/src/main/java/au/com/royalpay/payment/manage/signin/web/ManagerWechatBindController.java b/src/main/java/au/com/royalpay/payment/manage/signin/web/ManagerWechatBindController.java index f9d9b29d6..515d413a8 100644 --- a/src/main/java/au/com/royalpay/payment/manage/signin/web/ManagerWechatBindController.java +++ b/src/main/java/au/com/royalpay/payment/manage/signin/web/ManagerWechatBindController.java @@ -1,6 +1,7 @@ package au.com.royalpay.payment.manage.signin.web; import au.com.royalpay.payment.manage.permission.manager.RequireManager; +import au.com.royalpay.payment.manage.signin.beans.ManagerInfo; import au.com.royalpay.payment.manage.signin.core.ManagerWechatBindService; import au.com.royalpay.payment.tools.CommonConsts; import au.com.royalpay.payment.tools.connections.mpsupport.beans.WxOauthType; @@ -32,4 +33,11 @@ public class ManagerWechatBindController { public JSONObject newBindRequest(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { return managerWechatBindService.newBindRequest(manager.getString("manager_id")); } + + @PutMapping(value = "/remove/{manager_id}") + @ResponseBody + public JSONObject removeBind(@PathVariable("manager_id") String managerId) { + return managerWechatBindService.removeBindWechat(managerId); + + } } diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ManagerMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ManagerMapper.xml index 7cac18eba..ca1174a32 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ManagerMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ManagerMapper.xml @@ -15,7 +15,7 @@ m.org_id, m.display_name, m.username,m.role,m.is_valid,m.create_time,m.last_login,o.name org_name, - m.email,m.phone,m.wechat, + m.email,m.phone,m.wechat,m.wx_openid, co.headimg, co.nickname, o.parent_org_id diff --git a/src/main/ui/static/config/managers/manager.js b/src/main/ui/static/config/managers/manager.js index ffea729ac..d4cbf90d2 100644 --- a/src/main/ui/static/config/managers/manager.js +++ b/src/main/ui/static/config/managers/manager.js @@ -71,6 +71,14 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) { }).result.then(function () { $scope.listManagers(); }) + }; + $scope.removeWechatBind = function (manager) { + $http.put('/system/manager_wechat_binds/remove/' + manager.manager_id).then(function () { + console.log(manager) + $scope.listManagers(); + }, function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) + }) } }]); app.controller('modifyManagerDialogCtrl', ['$scope', '$http', 'manager', function ($scope, $http, manager) { diff --git a/src/main/ui/static/config/managers/templates/managers.html b/src/main/ui/static/config/managers/templates/managers.html index 4acfb3305..0006548c4 100644 --- a/src/main/ui/static/config/managers/templates/managers.html +++ b/src/main/ui/static/config/managers/templates/managers.html @@ -96,7 +96,11 @@ - {{manager.nickname}} + + + {{manager.nickname}} + +