[Y] 商户欠款查询优化 & 清算记录免触发,限制最大查询周期30天 & 微信行业免刷新

master
taylor.dang 6 years ago
parent 6529413836
commit bece7b0dc9

@ -4,15 +4,14 @@ import au.com.royalpay.payment.core.risk.bean.RiskTypeEnum;
import au.com.royalpay.payment.manage.logview.beans.LogRiskQueryBean; import au.com.royalpay.payment.manage.logview.beans.LogRiskQueryBean;
import au.com.royalpay.payment.manage.mappers.log.LogRiskMapper; import au.com.royalpay.payment.manage.mappers.log.LogRiskMapper;
import au.com.royalpay.payment.manage.permission.manager.ManagerMapping; import au.com.royalpay.payment.manage.permission.manager.ManagerMapping;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import au.com.royalpay.payment.manage.tradelog.beans.PreRefundQueryBean; import au.com.royalpay.payment.manage.tradelog.beans.PreRefundQueryBean;
import au.com.royalpay.payment.manage.tradelog.core.TradeLogService; import au.com.royalpay.payment.manage.tradelog.core.TradeLogService;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import au.com.royalpay.payment.tools.utils.PageListUtils; import au.com.royalpay.payment.tools.utils.PageListUtils;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds; import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -30,14 +29,14 @@ public class LogRiskController {
@Resource @Resource
private TradeLogService tradeLogService; private TradeLogService tradeLogService;
@RequestMapping(value = "/risk_log/list", method = RequestMethod.GET) @GetMapping(value = "/risk_log/list")
public JSONObject listLogRisk(LogRiskQueryBean logRiskQueryBean) { public JSONObject listLogRisk(LogRiskQueryBean logRiskQueryBean) {
return PageListUtils.buildPageListResult( return PageListUtils.buildPageListResult(
logRiskMapper.listWithClientInfo(logRiskQueryBean.toParams(), new PageBounds(logRiskQueryBean.getPage(), logRiskQueryBean.getLimit()))); logRiskMapper.listWithClientInfo(logRiskQueryBean.toParams(), new PageBounds(logRiskQueryBean.getPage(), logRiskQueryBean.getLimit())));
} }
@RequestMapping(value = "/risk_log/typeCharts", method = RequestMethod.GET) @GetMapping(value = "/risk_log/typeCharts")
public JSONObject typeCharts(LogRiskQueryBean logRiskQueryBean) { public JSONObject typeCharts(LogRiskQueryBean logRiskQueryBean) {
List<JSONObject> statisticsRiskLogList = logRiskMapper.statisticsRiskLog(logRiskQueryBean.toParams()); List<JSONObject> statisticsRiskLogList = logRiskMapper.statisticsRiskLog(logRiskQueryBean.toParams());
if (CollectionUtils.isEmpty(statisticsRiskLogList)) { if (CollectionUtils.isEmpty(statisticsRiskLogList)) {
@ -84,7 +83,7 @@ public class LogRiskController {
return result; return result;
} }
@RequestMapping(value = "/pre_refund/list", method = RequestMethod.GET) @GetMapping(value = "/pre_refund/list")
public JSONObject listPreRefund(PreRefundQueryBean preRefundQueryBean) { public JSONObject listPreRefund(PreRefundQueryBean preRefundQueryBean) {
return PageListUtils.buildPageListResult(tradeLogService.listPreRefundClients(preRefundQueryBean)); return PageListUtils.buildPageListResult(tradeLogService.listPreRefundClients(preRefundQueryBean));
} }

@ -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.exceptions.InvalidShortIdException;
import au.com.royalpay.payment.core.tasksupport.SettlementSupport; import au.com.royalpay.payment.core.tasksupport.SettlementSupport;
import au.com.royalpay.payment.manage.management.clearing.core.CleanService; 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.*;
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.payment.TaskManualSettleMapper; 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.payment.TransactionMapper;
import au.com.royalpay.payment.manage.mappers.system.*; import au.com.royalpay.payment.manage.mappers.system.*;
@ -34,16 +30,15 @@ import au.com.royalpay.payment.tools.locale.LocaleSupport;
import au.com.royalpay.payment.tools.lock.Locker; import au.com.royalpay.payment.tools.lock.Locker;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole; import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import au.com.royalpay.payment.tools.tasksupport.TaskFinishNotifyEvent; import au.com.royalpay.payment.tools.tasksupport.TaskFinishNotifyEvent;
import au.com.royalpay.payment.tools.utils.DateVaildUtil;
import au.com.royalpay.payment.tools.utils.PageListUtils; import au.com.royalpay.payment.tools.utils.PageListUtils;
import au.com.royalpay.payment.tools.utils.TimeZoneUtils; import au.com.royalpay.payment.tools.utils.TimeZoneUtils;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.Order; import com.github.miemiedev.mybatis.paginator.domain.Order;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds; import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList; import com.github.miemiedev.mybatis.paginator.domain.PageList;
import org.apache.commons.codec.binary.Base64; import org.apache.commons.codec.binary.Base64;
import org.apache.commons.csv.CSVFormat; import org.apache.commons.csv.CSVFormat;
import org.apache.commons.csv.CSVPrinter; import org.apache.commons.csv.CSVPrinter;
@ -52,12 +47,7 @@ import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateFormatUtils; import org.apache.commons.lang3.time.DateFormatUtils;
import org.apache.commons.lang3.time.DateUtils; import org.apache.commons.lang3.time.DateUtils;
import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.*;
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.xssf.usermodel.XSSFWorkbook; import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.joda.time.DateTime; import org.joda.time.DateTime;
import org.joda.time.Days; import org.joda.time.Days;
@ -75,37 +65,20 @@ import org.springframework.util.CollectionUtils;
import org.thymeleaf.context.Context; import org.thymeleaf.context.Context;
import org.thymeleaf.spring4.SpringTemplateEngine; import org.thymeleaf.spring4.SpringTemplateEngine;
import java.io.BufferedWriter; import javax.annotation.Resource;
import java.io.ByteArrayOutputStream; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.*;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.Writer;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.text.NumberFormat; import java.text.NumberFormat;
import java.util.ArrayList; import java.util.*;
import java.util.Calendar;
import java.util.Currency;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.TreeMap;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream; 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; import static au.com.royalpay.payment.manage.permission.utils.OrgCheckUtils.checkOrgPermission;
/** /**
@ -163,7 +136,7 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
@Resource @Resource
private ClientDeviceMapper clientDeviceMapper; private ClientDeviceMapper clientDeviceMapper;
private static final int MAX_TRACK_DAYS = 31;
@Value("${app.settlement.email-to}") @Value("${app.settlement.email-to}")
private String settlementEmailTo; private String settlementEmailTo;
@Value("${app.settlement.email-cc}") @Value("${app.settlement.email-cc}")
@ -627,9 +600,9 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
@Override @Override
public JSONObject getCleanLogsInClients(ClearingLogQuery query, JSONObject manager) { public JSONObject getCleanLogsInClients(ClearingLogQuery query, JSONObject manager) {
JSONObject params = query.toParams(); JSONObject params = query.toParams();
DateVaildUtil.validDateDuration(params.getDate("from"), params.getDate("to"), MAX_TRACK_DAYS);
if (query.getClientMoniker() != null && !query.getClientMoniker().isEmpty()) { if (query.getClientMoniker() != null && !query.getClientMoniker().isEmpty()) {
JSONObject client = clientManager.getClientInfoByMoniker(query.getClientMoniker()); JSONObject client = clientManager.getClientInfoByMoniker(query.getClientMoniker());
Assert.notNull(client);
} }
if (manager.getInteger("org_id") != null) { if (manager.getInteger("org_id") != null) {
params.put("org_id", manager.getIntValue("org_id")); params.put("org_id", manager.getIntValue("org_id"));
@ -642,9 +615,9 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
@Override @Override
public JSONObject analysisCleanLogs(ClearingLogQuery query, JSONObject manager) { public JSONObject analysisCleanLogs(ClearingLogQuery query, JSONObject manager) {
JSONObject params = query.toParams(); JSONObject params = query.toParams();
DateVaildUtil.validDateDuration(params.getDate("from"), params.getDate("to"), MAX_TRACK_DAYS);
if (query.getClientMoniker() != null && !query.getClientMoniker().isEmpty()) { if (query.getClientMoniker() != null && !query.getClientMoniker().isEmpty()) {
JSONObject client = clientManager.getClientInfoByMoniker(query.getClientMoniker()); JSONObject client = clientManager.getClientInfoByMoniker(query.getClientMoniker());
Assert.notNull(client);
} }
if (manager.getInteger("org_id") != null) { if (manager.getInteger("org_id") != null) {
params.put("org_id", manager.getIntValue("org_id")); params.put("org_id", manager.getIntValue("org_id"));

@ -54,7 +54,7 @@ public class ManagerPermissionScanner implements BeanPostProcessor, PermissionRe
PermissionNode node = new PermissionNode(controller.getSimpleName(), method.getName()); PermissionNode node = new PermissionNode(controller.getSimpleName(), method.getName());
getRequestInfo(node, clazzRequestMapping, methodMapping); getRequestInfo(node, clazzRequestMapping, methodMapping);
node.setPermissions(clazzPermission, methodPermission); node.setPermissions(clazzPermission, methodPermission);
logger.debug("register permission:" + node.getFuncName() + ":" + node.getRequestId()); logger.trace("register permission:{}:{}", node.getFuncName(), node.getRequestId());
if (permissionNodes.containsKey(node.getFuncId())) { if (permissionNodes.containsKey(node.getFuncId())) {
throw new RuntimeException("Duplicated permission function ID:" + controller.getName() + "." + method.getName()); throw new RuntimeException("Duplicated permission function ID:" + controller.getName() + "." + method.getName());
} }

@ -307,14 +307,16 @@
<if test="to!=null">and t.transaction_time &lt; #{to}</if> <if test="to!=null">and t.transaction_time &lt; #{to}</if>
</select> </select>
<select id="listPreRefundClients" resultType="com.alibaba.fastjson.JSONObject"> <select id="listPreRefundClients" resultType="com.alibaba.fastjson.JSONObject">
SELECT ifnull(sum(if(transaction_type = 'Credit', clearing_amount, -clearing_amount)), 0) amount, SELECT sc.client_id,
cc.client_id client_id, sc.client_moniker,
max(t.transaction_time) transation_time, IFNULL(SUM(IF(pt.transaction_type = 'Credit', pt.clearing_amount, -pt.clearing_amount)), 0) amount,
cc.client_moniker client_moniker IFNULL(MAX(pt.create_time), sc.approve_time) transation_time
from (select client_id,client_moniker from sys_client_config where enable_refund_auth=1) cc FROM pmt_transactions pt,
inner join pmt_transactions t on cc.client_id = t.client_id sys_clients sc
GROUP BY cc.client_id WHERE clearing_status = 0
having amount &lt; 0 AND pt.client_id = sc.client_id
GROUP BY client_id
HAVING amount &lt; 0
</select> </select>
<select id="validAnalysis" resultType="com.alibaba.fastjson.JSONObject"> <select id="validAnalysis" resultType="com.alibaba.fastjson.JSONObject">
<![CDATA[ <![CDATA[

@ -113,7 +113,7 @@ define(['angular', 'decimal', 'uiBootstrap', 'uiRouter', 'angularEcharts'], func
} }
$scope.chooseOrg = function (org) { $scope.chooseOrg = function (org) {
if (org == 'all') { if (org === 'all') {
delete $scope.params.org_id; delete $scope.params.org_id;
$scope.showOrg = 'All' $scope.showOrg = 'All'
} else { } else {
@ -135,6 +135,8 @@ define(['angular', 'decimal', 'uiBootstrap', 'uiRouter', 'angularEcharts'], func
$http.get('/sys/clean_logs/clients', {params: params}).then(function (resp) { $http.get('/sys/clean_logs/clients', {params: params}).then(function (resp) {
$scope.clearing_logs = resp.data.data; $scope.clearing_logs = resp.data.data;
$scope.pagination = resp.data.pagination; $scope.pagination = resp.data.pagination;
}, function (resp) {
commonDialog.alert({type: 'error', title: 'Error', content: resp.data.message});
}); });
analysisLog(params); analysisLog(params);
}; };
@ -144,8 +146,6 @@ define(['angular', 'decimal', 'uiBootstrap', 'uiRouter', 'angularEcharts'], func
}) })
}; };
$scope.loadClearingLogs(1);
$scope.loadClearingLogsHistory = function (days) { $scope.loadClearingLogsHistory = function (days) {
var endDate = new Date(); var endDate = new Date();
var startDate = new Date(); var startDate = new Date();

@ -99,10 +99,6 @@
<a role="button" class="btn btn-default btn-sm" <a role="button" class="btn btn-default btn-sm"
ng-click="lastMonth()">Last Month</a> ng-click="lastMonth()">Last Month</a>
</div> </div>
<div class="btn-group">
<a role="button" class="btn btn-default btn-sm"
ng-click="thisYear()">This Year</a>
</div>
<div uib-dropdown ng-if="orgs" class="btn-group"> <div uib-dropdown ng-if="orgs" class="btn-group">
<button id="single-button" type="button" class="btn btn-default" <button id="single-button" type="button" class="btn btn-default"
uib-dropdown-toggle ng-disabled="disabled"> uib-dropdown-toggle ng-disabled="disabled">

@ -699,10 +699,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
}; };
$scope.showFile(); $scope.showFile();
$scope.passClient = function () { $scope.passClient = function () {
if (!$scope.partner.wechat_institution_merchant_id) { $scope.refreshWechatInstitutionMerchantId();
commonDialog.alert({title: 'info', content: 'Wechat Institution Merchant Id not Refresh', type: 'info'});
return;
}
if ($scope.partner.enable_hf) { if ($scope.partner.enable_hf) {
if ($scope.partner.hfindustry == null) { if ($scope.partner.hfindustry == null) {
alert("已开启HF支付通道HF行业不可为空!"); alert("已开启HF支付通道HF行业不可为空!");
@ -775,14 +772,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
}); });
}; };
$scope.pass2GreenChannel = function () { $scope.pass2GreenChannel = function () {
if (!$scope.partner.wechat_institution_merchant_id) { $scope.refreshWechatInstitutionMerchantId();
commonDialog.alert({
title: 'info',
content: 'Wechat Institution Merchant Id not Refresh',
type: 'info'
});
return;
}
commonDialog.confirm({ commonDialog.confirm({
title: 'Green Channel Audit Partner', title: 'Green Channel Audit Partner',
content: 'Are you sure to mark partner ' + $scope.partner.company_name + ' green channel audited ' content: 'Are you sure to mark partner ' + $scope.partner.company_name + ' green channel audited '
@ -1559,20 +1549,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
$scope.ctrl = {}; $scope.ctrl = {};
$scope.saveSubMerchantId = function () { $scope.saveSubMerchantId = function () {
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/payment_config', {sub_merchant_id: $scope.paymentInfo.sub_merchant_id}).then(function (resp) { $http.put('/sys/partners/' + $scope.partner.client_moniker + '/payment_config', {sub_merchant_id: $scope.paymentInfo.sub_merchant_id}).then(function (resp) {
$scope.refreshInstitutionAfterSaveMerchantId(); $scope.refreshWechatInstitutionMerchantId();
}, function (resp) {
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'})
});
};
$scope.refreshInstitutionAfterSaveMerchantId = function () {
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/wechat_institution_merchant_id', {wechat_institution_merchant_id: $scope.paymentInfo.wechat_institution_merchant_id}).then(function (resp) {
commonDialog.alert({
title: 'Success',
content: 'Modify Wechat Sub Merchant ID And Refresh Wechat Institution Merchant Id successfully',
type: 'success'
});
$scope.loadPartnerPaymentInfo();
}, function (resp) { }, function (resp) {
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'})
}); });
@ -1580,11 +1557,6 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
$scope.refreshWechatInstitutionMerchantId = function () { $scope.refreshWechatInstitutionMerchantId = function () {
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/wechat_institution_merchant_id', {wechat_institution_merchant_id: $scope.paymentInfo.wechat_institution_merchant_id}).then(function (resp) { $http.put('/sys/partners/' + $scope.partner.client_moniker + '/wechat_institution_merchant_id', {wechat_institution_merchant_id: $scope.paymentInfo.wechat_institution_merchant_id}).then(function (resp) {
commonDialog.alert({
title: 'Success',
content: 'Refresh Wechat Institution Merchant Id successfully',
type: 'success'
});
$scope.loadPartnerPaymentInfo(); $scope.loadPartnerPaymentInfo();
}, function (resp) { }, function (resp) {
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'})
@ -1610,7 +1582,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
content: '是否使用该商户的现有信息进件?', content: '是否使用该商户的现有信息进件?',
json:$scope.alipay_gms_json json:$scope.alipay_gms_json
}).then(function () { }).then(function () {
if ($scope.partner.business_structure == "Company") { if ($scope.partner.business_structure === "Company") {
$http.post('/sys/partners/' + $scope.partner.client_moniker + '/register/alipay_gms', {representative_id: ""}).then(function () { $http.post('/sys/partners/' + $scope.partner.client_moniker + '/register/alipay_gms', {representative_id: ""}).then(function () {
commonDialog.alert({title: 'Success', content: 'Alipay进件成功', type: 'success'}); commonDialog.alert({title: 'Success', content: 'Alipay进件成功', type: 'success'});
}, function (resp) { }, function (resp) {
@ -1634,7 +1606,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
}, function (resp) { }, function (resp) {
commonDialog.alert({title: 'Error', content: "查询失败:" + resp.data.message, type: 'error'}); commonDialog.alert({title: 'Error', content: "查询失败:" + resp.data.message, type: 'error'});
}) })
} };
$scope.submitAlipayOnlineSubId = function () { $scope.submitAlipayOnlineSubId = function () {
$http.get('/sys/partners/' + $scope.partner.client_moniker + '/query/alipayOnline_gms_json').then(function (resp) { $http.get('/sys/partners/' + $scope.partner.client_moniker + '/query/alipayOnline_gms_json').then(function (resp) {
$scope.alipayOnline_gms_json = resp.data; $scope.alipayOnline_gms_json = resp.data;

Loading…
Cancel
Save