yesterday trans analysis

master
yixian 4 years ago
parent 39ee9a1505
commit a05d93d48d

@ -13,4 +13,7 @@ public interface SettleTasksService {
List<JSONObject> listMerchantsInfo(String mchMonikers); List<JSONObject> listMerchantsInfo(String mchMonikers);
void submitTasks(List<ManualSettleTask> tasks); void submitTasks(List<ManualSettleTask> tasks);
List<JSONObject> analysisYesterdayTransaction();
} }

@ -1,15 +1,20 @@
package au.com.royalpay.payment.manage.management.clearing.core.impl; package au.com.royalpay.payment.manage.management.clearing.core.impl;
import au.com.royalpay.payment.core.PaymentApi;
import au.com.royalpay.payment.manage.management.clearing.core.SettleTasksService; import au.com.royalpay.payment.manage.management.clearing.core.SettleTasksService;
import au.com.royalpay.payment.manage.management.clearing.web.ManualSettleTask; import au.com.royalpay.payment.manage.management.clearing.web.ManualSettleTask;
import au.com.royalpay.payment.manage.mappers.payment.TransactionMapper;
import au.com.royalpay.payment.manage.mappers.system.SysSettlePlanMapper; import au.com.royalpay.payment.manage.mappers.system.SysSettlePlanMapper;
import au.com.royalpay.payment.tools.exceptions.ServerErrorException; import au.com.royalpay.payment.tools.exceptions.ServerErrorException;
import au.com.royalpay.payment.tools.livecheck.AppLiveCheck; import au.com.royalpay.payment.tools.livecheck.AppLiveCheck;
import au.com.royalpay.payment.tools.merchants.beans.BalanceGroup;
import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider; import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONException; import com.alibaba.fastjson.JSONException;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.web.client.RestTemplateBuilder; import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.data.redis.core.StringRedisTemplate;
@ -25,8 +30,10 @@ import org.springframework.web.util.UriComponentsBuilder;
import java.net.URI; import java.net.URI;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import java.util.TimeZone;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Service @Service
@ -34,6 +41,8 @@ public class SettleTaskServiceImpl implements SettleTasksService {
private final SysSettlePlanMapper planMapper; private final SysSettlePlanMapper planMapper;
private final StringRedisTemplate redisTemplate; private final StringRedisTemplate redisTemplate;
private final MerchantInfoProvider mchInfoProvider; private final MerchantInfoProvider mchInfoProvider;
private final PaymentApi paymentApi;
private final TransactionMapper transactionMapper;
private final String prefix; private final String prefix;
private final RestTemplate restTemplate; private final RestTemplate restTemplate;
private final String transactionHost; private final String transactionHost;
@ -41,11 +50,13 @@ public class SettleTaskServiceImpl implements SettleTasksService {
private static final String SETTLE_TASK_URI = "/dev/manual/settle_tasks"; private static final String SETTLE_TASK_URI = "/dev/manual/settle_tasks";
public SettleTaskServiceImpl(SysSettlePlanMapper planMapper, StringRedisTemplate redisTemplate, public SettleTaskServiceImpl(SysSettlePlanMapper planMapper, StringRedisTemplate redisTemplate,
MerchantInfoProvider mchInfoProvider, @Value("${app.redis.prefix}") String prefix, MerchantInfoProvider mchInfoProvider, PaymentApi paymentApi, TransactionMapper transactionMapper, @Value("${app.redis.prefix}") String prefix,
@Value("${platform.services.transaction:http://127.0.0.1:6012}") String transactionHost, AppLiveCheck appLiveCheck) { @Value("${platform.services.transaction:http://127.0.0.1:6012}") String transactionHost, AppLiveCheck appLiveCheck) {
this.planMapper = planMapper; this.planMapper = planMapper;
this.redisTemplate = redisTemplate; this.redisTemplate = redisTemplate;
this.mchInfoProvider = mchInfoProvider; this.mchInfoProvider = mchInfoProvider;
this.paymentApi = paymentApi;
this.transactionMapper = transactionMapper;
this.prefix = prefix; this.prefix = prefix;
this.appLiveCheck = appLiveCheck; this.appLiveCheck = appLiveCheck;
this.restTemplate = new RestTemplateBuilder() this.restTemplate = new RestTemplateBuilder()
@ -108,5 +119,15 @@ public class SettleTaskServiceImpl implements SettleTasksService {
} }
} }
@Override
public List<JSONObject> analysisYesterdayTransaction() {
Date from = DateTime.now().withMillisOfDay(0).withZoneRetainFields(DateTimeZone.forTimeZone(TimeZone.getTimeZone("Asia/Shanghai")))
.minusDays(1).toDate();
Date to = new DateTime(from).plusDays(1).toDate();
List<String> channels = paymentApi.channelsInGroup(BalanceGroup.NORMAL_CROSS_BORDER);
channels.remove("System");
return transactionMapper.analysisByChannels(from, to, channels);
}
} }

@ -14,14 +14,19 @@ import java.util.List;
@RestController @RestController
@ManagerMapping(value = "/sys/settle_tasks", role = {ManagerRole.FINANCIAL_STAFF, ManagerRole.DEVELOPER}) @ManagerMapping(value = "/sys/settle_tasks", role = {ManagerRole.FINANCIAL_STAFF, ManagerRole.DEVELOPER})
public class SettleTasksController { public class SettleTasksController {
private SettleTasksService svc; private final SettleTasksService svc;
private PriorityListManager priorityListManager; private final PriorityListManager priorityListManager;
public SettleTasksController(SettleTasksService svc, PriorityListManager priorityListManager) { public SettleTasksController(SettleTasksService svc, PriorityListManager priorityListManager) {
this.svc = svc; this.svc = svc;
this.priorityListManager = priorityListManager; this.priorityListManager = priorityListManager;
} }
@GetMapping("/yesterday_trans_analysis")
public List<JSONObject> getYesterdayTransAnalysis() {
return svc.analysisYesterdayTransaction();
}
@GetMapping("/plans") @GetMapping("/plans")
public List<JSONObject> listPlans() { public List<JSONObject> listPlans() {
return svc.listPlans(); return svc.listPlans();

@ -166,4 +166,5 @@ public interface TransactionMapper {
*/ */
List<JSONObject> getSettleDataDailyReport(@Param("beginTime") Date beginTime,@Param("endTime")Date endTime); List<JSONObject> getSettleDataDailyReport(@Param("beginTime") Date beginTime,@Param("endTime")Date endTime);
List<JSONObject> analysisByChannels(@Param("from") Date from, @Param("to") Date to, @Param("channels") List<String> channels);
} }

@ -5062,7 +5062,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (client == null) { if (client == null) {
throw new InvalidShortIdException(); throw new InvalidShortIdException();
} }
clientModifySupport.processClientConfigModify(new ClientMinSettleModify(manager, clientMoniker, minSettle)); clientModifySupport.processClientModify(new ClientMinSettleModify(manager, clientMoniker, minSettle));
} }
@Override @Override

@ -562,9 +562,9 @@
SELECT t.client_id,DATE(t.transaction_time) clearing_time, SELECT t.client_id,DATE(t.transaction_time) clearing_time,
ifnull(cd.report_date,date(t.transaction_time)) report_date, ifnull(cd.report_date,date(t.transaction_time)) report_date,
<if test="merge_settle!=null"> <if test="merge_settle!=null">
SUM(cd.tax_amount) /2 as tax_amount, SUM(cd.tax_amount) /2 as tax_amount,
SUM(cd.total_charge)/2 as total_charge, SUM(cd.total_charge)/2 as total_charge,
1 as merge_settle, 1 as merge_settle,
</if> </if>
<if test="merge_settle==null"> <if test="merge_settle==null">
cd.tax_amount, cd.tax_amount,
@ -591,7 +591,7 @@
</foreach> </foreach>
</if> </if>
<if test="client_ids==null and client_id !=null"> <if test="client_ids==null and client_id !=null">
and (sc.client_id=#{client_id} or sc.parent_client_id =#{client_id}) and (sc.client_id=#{client_id} or sc.parent_client_id =#{client_id})
</if> </if>
<if test="from!=null">and cd.report_date &gt;= DATE_FORMAT(#{from},'%Y-%m-%d')</if> <if test="from!=null">and cd.report_date &gt;= DATE_FORMAT(#{from},'%Y-%m-%d')</if>
<if test="to!=null">and cd.report_date &lt; DATE_FORMAT(#{to},'%Y-%m-%d')</if> <if test="to!=null">and cd.report_date &lt; DATE_FORMAT(#{to},'%Y-%m-%d')</if>
@ -1479,4 +1479,15 @@
AND channel != 'Settlement' AND channel != 'Settlement'
GROUP BY channel GROUP BY channel
</select> </select>
<select id="analysisByChannels" resultType="com.alibaba.fastjson.JSONObject">
select
o.merchant_id,t.channel,sum(if(transaction_type='Credit',clearing_amount-channel_surcharge,channel_surcharge-clearing_amount))
amt
from pmt_transactions t
inner join pmt_orders o on o.order_id=t.order_id
where t.transaction_time between #{from} and #{to}
and t.system_generate=0 and t.channel in
<foreach collection="channels" open="(" close=")" separator="," item="channel">#{channel}</foreach>
group by o.merchant_id
</select>
</mapper> </mapper>

@ -28,6 +28,20 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) {
$scope.redirectToSettleLogs = function () { $scope.redirectToSettleLogs = function () {
$state.go('clearingLogs.settlementDetail', {date: $filter('date')(new Date(), 'yyyy-MM-dd')}) $state.go('clearingLogs.settlementDetail', {date: $filter('date')(new Date(), 'yyyy-MM-dd')})
} }
$scope.displayYesterdayTransaction = function () {
$uibModal.open({
templateUrl: '/static/analysis/templates/yesterday_trans_report.html',
controller: ['$scope', 'data', function (scope, data) {
scope.data = data.data
}],
resolve: {
'data': ['$http', function (http) {
return http.get('/sys/settle_tasks/yesterday_trans_analysis')
}]
},
size: 'lg'
})
};
$scope.checkProgressStatus = function () { $scope.checkProgressStatus = function () {
let defer = $q.defer(); let defer = $q.defer();
$http.get('/sys/settle_tasks/current_progress').then(function (res) { $http.get('/sys/settle_tasks/current_progress').then(function (res) {

@ -25,6 +25,9 @@
<button type="button" class="btn btn-primary" ng-click="redirectToSettleLogs()">Today Settlement Logs <button type="button" class="btn btn-primary" ng-click="redirectToSettleLogs()">Today Settlement Logs
</button> </button>
<a class="btn btn-primary" ui-sref=".priority_list">Priority List</a> <a class="btn btn-primary" ui-sref=".priority_list">Priority List</a>
<button type="button" class="btn btn-primary" ng-click="displayYesterdayTransaction()">Yesterday
Transaction Funds
</button>
</div> </div>
</div> </div>
<div class="box box-info"> <div class="box box-info">

@ -0,0 +1,24 @@
<div class="modal-header">
Yesterday Transaction Analysis
</div>
<div class="modal-body">
<table class="table-bordered table-striped table-hover">
<thead>
<tr>
<th>Channel</th>
<th>Merchant ID</th>
<th>Amount</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="channel in data">
<td ng-bind="channel.channel"></td>
<td ng-bind="channel.merchant_id"></td>
<td ng-bind="channel.amt|currency:'A$'"></td>
</tr>
</tbody>
</table>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger"><i class="fa fa-close"></i> Close</button>
</div>

@ -6,57 +6,58 @@ define(['angular', 'angularSanitize', 'angularAnimate', 'angularMessages', 'uiRo
var app = angular.module('managerMainAppv2', ['ngSanitize', 'ngAnimate', 'ngMessages', 'ui.router', 'ui.bootstrap', 'ngFileUpload']); var app = angular.module('managerMainAppv2', ['ngSanitize', 'ngAnimate', 'ngMessages', 'ui.router', 'ui.bootstrap', 'ngFileUpload']);
app.config(['$urlRouterProvider', '$httpProvider', function ($urlRouterProvider, $httpProvider) { app.config(['$urlRouterProvider', '$httpProvider', function ($urlRouterProvider, $httpProvider) {
window.getRoleMenulist = function (role) { window.getRoleMenulist = function (role) {
var roleMenu = []; var roleMenu = [];
if ((role & 1) >0){ if ((role & 1) > 0) {
roleMenu.push({'value':'administrator','module':'系统配置'}); roleMenu.push({'value': 'administrator', 'module': '系统配置'});
} }
if ((role & 2) >0){ if ((role & 2) > 0) {
roleMenu.push({'value':'compliance','module':'合规中心'}); roleMenu.push({'value': 'compliance', 'module': '合规中心'});
} }
if ((role & 4) >0){ if ((role & 4) > 0) {
roleMenu.push({'value':'bduser','module':"销售中心"}); roleMenu.push({'value': 'bduser', 'module': "销售中心"});
} }
if ((role & 8) >0){ if ((role & 8) > 0) {
roleMenu.push({'value':'accountant','module':"财务中心"}); roleMenu.push({'value': 'accountant', 'module': "财务中心"});
} }
if ((role & 64) >0){ if ((role & 64) > 0) {
roleMenu.push({'value':'director','module':"领导决策"}); roleMenu.push({'value': 'director', 'module': "领导决策"});
} }
if ((role & 128) >0){ if ((role & 128) > 0) {
roleMenu.push({'value':'sitemanager','module':"营销中心"}); roleMenu.push({'value': 'sitemanager', 'module': "营销中心"});
} }
if ((role & 256) >0){ if ((role & 256) > 0) {
roleMenu.push({'value':'developer','module':"开发中心"}); roleMenu.push({'value': 'developer', 'module': "开发中心"});
} }
if ((role & 1024) >0){ if ((role & 1024) > 0) {
roleMenu.push({'value':'riskmanager','module':"风控中心"}); roleMenu.push({'value': 'riskmanager', 'module': "风控中心"});
} }
if ((role & 2048) >0){ if ((role & 2048) > 0) {
roleMenu.push({'value':'guest','module':"访客中心"}); roleMenu.push({'value': 'guest', 'module': "访客中心"});
} }
if ((role & 4096) >0){ if ((role & 4096) > 0) {
roleMenu.push({'value':'orgmanager','module':"代理商中心"}); roleMenu.push({'value': 'orgmanager', 'module': "代理商中心"});
} }
if ((role & 8192) >0){ if ((role & 8192) > 0) {
roleMenu.push({'value':'salesmanager','module':"销管中心"}); roleMenu.push({'value': 'salesmanager', 'module': "销管中心"});
} }
return roleMenu; return roleMenu;
}; };
if (getRoleMenulist(window.currentUser.role).length>1) { if (getRoleMenulist(window.currentUser.role).length > 1) {
sessionStorage.setItem('roleNum','N'); sessionStorage.setItem('roleNum', 'N');
$urlRouterProvider.otherwise(((window.currentUser.role & parseInt('100000', 2)) > 0) ? '/managers' : '/home'); $urlRouterProvider.otherwise(((window.currentUser.role & parseInt('100000', 2)) > 0) ? '/managers' : '/home');
}else { } else {
sessionStorage.setItem('roleNum','1'); sessionStorage.setItem('roleNum', '1');
sessionStorage.setItem('role',getRoleMenulist(window.currentUser.role)[0].value); var roleTemplValue = "guest";
if (getRoleMenulist(window.currentUser.role)[0]) {
roleTemplValue = getRoleMenulist(window.currentUser.role)[0].value;
}
sessionStorage.setItem('role', roleTemplValue);
$urlRouterProvider.otherwise(((window.currentUser.role & parseInt('100000', 2)) > 0) ? '/managers' : '/menu'); $urlRouterProvider.otherwise(((window.currentUser.role & parseInt('100000', 2)) > 0) ? '/managers' : '/menu');
} }
if (!$httpProvider.defaults.headers.get) { if (!$httpProvider.defaults.headers.get) {
$httpProvider.defaults.headers.get = {}; $httpProvider.defaults.headers.get = {};
} }
@ -64,45 +65,45 @@ define(['angular', 'angularSanitize', 'angularAnimate', 'angularMessages', 'uiRo
$httpProvider.defaults.headers.get['Cache-Control'] = 'no-cache'; $httpProvider.defaults.headers.get['Cache-Control'] = 'no-cache';
$httpProvider.defaults.headers.get['Pragma'] = 'no-cache'; $httpProvider.defaults.headers.get['Pragma'] = 'no-cache';
}]); }]);
app.controller('managerIndexCtrl', ['$scope', '$state','$rootScope', '$http', '$log', '$timeout', '$interval', '$uibModal', '$filter', 'myLoginLogView', 'commonDialog', app.controller('managerIndexCtrl', ['$scope', '$state', '$rootScope', '$http', '$log', '$timeout', '$interval', '$uibModal', '$filter', 'myLoginLogView', 'commonDialog',
function ($scope, $state,$rootScope, $http, $log, $timeout, $interval, $uibModal, $filter, myLoginLogView, commonDialog) { function ($scope, $state, $rootScope, $http, $log, $timeout, $interval, $uibModal, $filter, myLoginLogView, commonDialog) {
$scope.rolelist = window.getRoleMenulist(window.currentUser.role); $scope.rolelist = window.getRoleMenulist(window.currentUser.role);
$scope.roleNow = getroleNow(); $scope.roleNow = getroleNow();
$scope.roleName = sessionStorage.getItem('role'); $scope.roleName = sessionStorage.getItem('role');
$scope.changeRole = function (index) { $scope.changeRole = function (index) {
sessionStorage.setItem('role',index); sessionStorage.setItem('role', index);
$scope.roleNow = getroleNow(); $scope.roleNow = getroleNow();
$state.go('listMenu',null,{ $state.go('listMenu', null, {
reload:true reload: true
}); });
}; };
if (sessionStorage.getItem('roleNum') =='N'){ if (sessionStorage.getItem('roleNum') == 'N') {
if (window.location.hash == "" || window.location.hash == "#/home") { if (window.location.hash == "" || window.location.hash == "#/home") {
$scope.headerDisplay = false; $scope.headerDisplay = false;
$scope.copyright = false; $scope.copyright = false;
}else { } else {
$scope.headerDisplay = true;
$scope.copyright = true;
}
}else {
$scope.headerDisplay = true; $scope.headerDisplay = true;
$scope.copyright = true; $scope.copyright = true;
} }
$scope.headerCopyDisplay = function () { } else {
if (sessionStorage.getItem('role')=='guest'){ $scope.headerDisplay = true;
$scope.copyright = true;
}
$scope.headerCopyDisplay = function () {
if (sessionStorage.getItem('role') == 'guest') {
return; return;
} }
$state.go('home'); $state.go('home');
$scope.headerDisplay = false; $scope.headerDisplay = false;
$scope.copyright = false; $scope.copyright = false;
}; };
$scope.headerShow = function (role) { $scope.headerShow = function (role) {
$scope.headerDisplay = true; $scope.headerDisplay = true;
$scope.copyright = true; $scope.copyright = true;
sessionStorage.setItem('role',role); sessionStorage.setItem('role', role);
$scope.roleNow = getroleNow(); $scope.roleNow = getroleNow();
$scope.roleName = sessionStorage.getItem('role'); $scope.roleName = sessionStorage.getItem('role');
}; };
@ -199,7 +200,7 @@ define(['angular', 'angularSanitize', 'angularAnimate', 'angularMessages', 'uiRo
} }
}) })
}; };
// $scope.getManagerTodoNotices(); // $scope.getManagerTodoNotices();
var connected; var connected;
@ -313,7 +314,7 @@ define(['angular', 'angularSanitize', 'angularAnimate', 'angularMessages', 'uiRo
} }
$scope.customerService = function () { $scope.customerService = function () {
$http.put('/sys/openim/check').then(function (resp) { $http.put('/sys/openim/check').then(function (resp) {
window.open('/service_client.html?key='+resp.data.appkey+'&p='+resp.data.password+'&uid='+resp.data.user_id,'_blank'); window.open('/service_client.html?key=' + resp.data.appkey + '&p=' + resp.data.password + '&uid=' + resp.data.user_id, '_blank');
}); });
} }

@ -2544,6 +2544,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
$scope.modifyMinSettle = function () { $scope.modifyMinSettle = function () {
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/min_settle', {min_settle: $scope.partner.min_settle}).then(function () { $http.put('/sys/partners/' + $scope.partner.client_moniker + '/min_settle', {min_settle: $scope.partner.min_settle}).then(function () {
commonDialog.alert({title: 'Success', content: '修改起结金额成功', type: 'success'}); commonDialog.alert({title: 'Success', content: '修改起结金额成功', type: 'success'});
$scope.bankCtrl.modify_min_settle = false;
}, function (resp) { }, function (resp) {
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
}) })

@ -80,11 +80,18 @@
<label class="col-sm-4" for="minSettleEdit">Min Settle</label> <label class="col-sm-4" for="minSettleEdit">Min Settle</label>
<div class="col-sm-6"> <div class="col-sm-6">
<p ng-if="!bankCtrl.modify_min_settle" class="form-control-static"> <p ng-if="!bankCtrl.modify_min_settle" class="form-control-static">
{{partner.min_settle||'Not Configure'}} <span ng-if="partner.min_settle">AU$</span>{{partner.min_settle||'Not Configure'}}
<a role="button" ng-click="bankCtrl.modify_min_settle=true"><i class="fa fa-edit"></i></a> <a role="button" ng-click="bankCtrl.modify_min_settle=true"><i class="fa fa-edit"></i></a>
</p> </p>
<div class="input-group" ng-if="bankCtrl.modify_min_settle"> <div class="input-group" ng-if="bankCtrl.modify_min_settle">
<input ng-model="partner.min_settle" type="number" id="minSettleEdit" min="0"> <div class="input-group-addon">AU$</div>
<input class="form-control" ng-model="partner.min_settle" type="number" id="minSettleEdit"
min="0">
<div class="input-group-btn">
<button class="btn btn-danger" ng-click="bankCtrl.modify_min_settle=false"><i
class="fa fa-close"></i>
</button>
</div>
<div class="input-group-btn"> <div class="input-group-btn">
<button class="btn btn-success" ng-click="modifyMinSettle()"><i class="fa fa-check"></i> <button class="btn btn-success" ng-click="modifyMinSettle()"><i class="fa fa-check"></i>
</button> </button>

Loading…
Cancel
Save