|
|
@ -1,7 +1,7 @@
|
|
|
|
define(['angular', 'decimal', 'uiBootstrap', 'uiRouter', 'angularEcharts'], function (angular, Decimal) {
|
|
|
|
define(['angular', 'decimal', 'uiBootstrap', 'uiRouter', 'angularEcharts'], function (angular, Decimal) {
|
|
|
|
'use strict';
|
|
|
|
'use strict';
|
|
|
|
var colors = ['#00c0ef', '#00a65a', '#ff851b', '#f39c12', '#d81b60', '#605ca8', '#dd4b39', '#008080', '#8B008B', '#D2691E', '#708090'];
|
|
|
|
let colors = ['#00c0ef', '#00a65a', '#ff851b', '#f39c12', '#d81b60', '#605ca8', '#dd4b39', '#008080', '#8B008B', '#D2691E', '#708090'];
|
|
|
|
var app = angular.module('clearingLogs', ['ui.bootstrap', 'ui.router', 'ngEcharts']);
|
|
|
|
let app = angular.module('clearingLogs', ['ui.bootstrap', 'ui.router', 'ngEcharts']);
|
|
|
|
app.config(['$stateProvider', function ($stateProvider) {
|
|
|
|
app.config(['$stateProvider', function ($stateProvider) {
|
|
|
|
$stateProvider.state('clearingLogs', {
|
|
|
|
$stateProvider.state('clearingLogs', {
|
|
|
|
url: '/analysis/clearing_logs',
|
|
|
|
url: '/analysis/clearing_logs',
|
|
|
@ -54,7 +54,7 @@ define(['angular', 'decimal', 'uiBootstrap', 'uiRouter', 'angularEcharts'], func
|
|
|
|
app.controller('clearingLogsCtrl', ['$scope', '$http', '$filter', '$timeout', '$uibModal', 'commonDialog', 'chartParser',
|
|
|
|
app.controller('clearingLogsCtrl', ['$scope', '$http', '$filter', '$timeout', '$uibModal', 'commonDialog', 'chartParser',
|
|
|
|
function ($scope, $http, $filter, $timeout, $uibModal, commonDialog, chartParser) {
|
|
|
|
function ($scope, $http, $filter, $timeout, $uibModal, commonDialog, chartParser) {
|
|
|
|
$scope.loadMonthLog = function (month) {
|
|
|
|
$scope.loadMonthLog = function (month) {
|
|
|
|
var monthStr = $filter('date')(month, 'yyyyMM');
|
|
|
|
let monthStr = $filter('date')(month, 'yyyyMM');
|
|
|
|
$http.get('/sys/settlement/month/' + monthStr + '/settled_dates').then(function (resp) {
|
|
|
|
$http.get('/sys/settlement/month/' + monthStr + '/settled_dates').then(function (resp) {
|
|
|
|
$scope.settledDates = resp.data;
|
|
|
|
$scope.settledDates = resp.data;
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -68,39 +68,39 @@ define(['angular', 'decimal', 'uiBootstrap', 'uiRouter', 'angularEcharts'], func
|
|
|
|
$scope.loadClearingLogs(1);
|
|
|
|
$scope.loadClearingLogs(1);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
$scope.chooseYesterday = function () {
|
|
|
|
$scope.chooseYesterday = function () {
|
|
|
|
var yesterday = new Date();
|
|
|
|
let yesterday = new Date();
|
|
|
|
yesterday.setDate(yesterday.getDate() - 1);
|
|
|
|
yesterday.setDate(yesterday.getDate() - 1);
|
|
|
|
$scope.params.begin = $scope.params.end = yesterday;
|
|
|
|
$scope.params.begin = $scope.params.end = yesterday;
|
|
|
|
$scope.loadClearingLogs(1);
|
|
|
|
$scope.loadClearingLogs(1);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
$scope.chooseLast7Days = function () {
|
|
|
|
$scope.chooseLast7Days = function () {
|
|
|
|
$scope.params.end = new Date();
|
|
|
|
$scope.params.end = new Date();
|
|
|
|
var day = new Date();
|
|
|
|
let day = new Date();
|
|
|
|
day.setDate(day.getDate() - 7);
|
|
|
|
day.setDate(day.getDate() - 7);
|
|
|
|
$scope.params.begin = day;
|
|
|
|
$scope.params.begin = day;
|
|
|
|
$scope.loadClearingLogs(1);
|
|
|
|
$scope.loadClearingLogs(1);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
$scope.thisMonth = function () {
|
|
|
|
$scope.thisMonth = function () {
|
|
|
|
$scope.params.end = new Date();
|
|
|
|
$scope.params.end = new Date();
|
|
|
|
var monthBegin = new Date();
|
|
|
|
let monthBegin = new Date();
|
|
|
|
monthBegin.setDate(1);
|
|
|
|
monthBegin.setDate(1);
|
|
|
|
$scope.params.begin = monthBegin;
|
|
|
|
$scope.params.begin = monthBegin;
|
|
|
|
$scope.loadClearingLogs(1);
|
|
|
|
$scope.loadClearingLogs(1);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
$scope.lastMonth = function () {
|
|
|
|
$scope.lastMonth = function () {
|
|
|
|
var monthFinish = new Date();
|
|
|
|
let monthFinish = new Date();
|
|
|
|
monthFinish.setDate(0);
|
|
|
|
monthFinish.setDate(0);
|
|
|
|
$scope.params.end = monthFinish;
|
|
|
|
$scope.params.end = monthFinish;
|
|
|
|
var monthBegin = new Date();
|
|
|
|
let monthBegin = new Date();
|
|
|
|
monthBegin.setDate(0);
|
|
|
|
monthBegin.setDate(0);
|
|
|
|
monthBegin.setDate(1);
|
|
|
|
monthBegin.setDate(1);
|
|
|
|
$scope.params.begin = monthBegin;
|
|
|
|
$scope.params.begin = monthBegin;
|
|
|
|
$scope.loadClearingLogs(1);
|
|
|
|
$scope.loadClearingLogs(1);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
$scope.thisYear = function () {
|
|
|
|
$scope.thisYear = function () {
|
|
|
|
var yearFinish = new Date();
|
|
|
|
let yearFinish = new Date();
|
|
|
|
$scope.params.end = yearFinish;
|
|
|
|
$scope.params.end = yearFinish;
|
|
|
|
var currentYearFirstDate = new Date(new Date().getFullYear(), 0, 1);
|
|
|
|
let currentYearFirstDate = new Date(new Date().getFullYear(), 0, 1);
|
|
|
|
$scope.params.begin = currentYearFirstDate;
|
|
|
|
$scope.params.begin = currentYearFirstDate;
|
|
|
|
$scope.loadClearingLogs(1);
|
|
|
|
$scope.loadClearingLogs(1);
|
|
|
|
};
|
|
|
|
};
|
|
|
@ -124,7 +124,7 @@ define(['angular', 'decimal', 'uiBootstrap', 'uiRouter', 'angularEcharts'], func
|
|
|
|
};
|
|
|
|
};
|
|
|
|
$scope.loadClearingLogs = function (page) {
|
|
|
|
$scope.loadClearingLogs = function (page) {
|
|
|
|
|
|
|
|
|
|
|
|
var params = angular.copy($scope.params);
|
|
|
|
let params = angular.copy($scope.params);
|
|
|
|
params.page = page || $scope.pagination.page || 1;
|
|
|
|
params.page = page || $scope.pagination.page || 1;
|
|
|
|
if (params.begin) {
|
|
|
|
if (params.begin) {
|
|
|
|
params.begin = $filter('date')(params.begin, 'yyyyMMdd');
|
|
|
|
params.begin = $filter('date')(params.begin, 'yyyyMMdd');
|
|
|
@ -140,15 +140,15 @@ define(['angular', 'decimal', 'uiBootstrap', 'uiRouter', 'angularEcharts'], func
|
|
|
|
});
|
|
|
|
});
|
|
|
|
analysisLog(params);
|
|
|
|
analysisLog(params);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
var analysisLog = function (params) {
|
|
|
|
let analysisLog = function (params) {
|
|
|
|
$http.get('/sys/clean_logs/analysis', {params: params}).then(function (resp) {
|
|
|
|
$http.get('/sys/clean_logs/analysis', {params: params}).then(function (resp) {
|
|
|
|
$scope.analysis = resp.data;
|
|
|
|
$scope.analysis = resp.data;
|
|
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
})
|
|
|
|
};
|
|
|
|
};
|
|
|
|
$scope.loadClearingLogsHistory = function (days) {
|
|
|
|
$scope.loadClearingLogsHistory = function (days) {
|
|
|
|
var endDate = new Date();
|
|
|
|
let endDate = new Date();
|
|
|
|
var startDate = new Date();
|
|
|
|
let startDate = new Date();
|
|
|
|
startDate.setDate(startDate.getDate() - days);
|
|
|
|
startDate.setDate(startDate.getDate() - days);
|
|
|
|
$http.get('/sys/clean_logs/logs', {
|
|
|
|
$http.get('/sys/clean_logs/logs', {
|
|
|
|
params: {
|
|
|
|
params: {
|
|
|
@ -160,7 +160,7 @@ define(['angular', 'decimal', 'uiBootstrap', 'uiRouter', 'angularEcharts'], func
|
|
|
|
})
|
|
|
|
})
|
|
|
|
};
|
|
|
|
};
|
|
|
|
$scope.loadClearingLogsHistory(7);
|
|
|
|
$scope.loadClearingLogsHistory(7);
|
|
|
|
var clearingHistoryConfig = {
|
|
|
|
let clearingHistoryConfig = {
|
|
|
|
chart: {
|
|
|
|
chart: {
|
|
|
|
tooltip: {
|
|
|
|
tooltip: {
|
|
|
|
trigger: 'axis',
|
|
|
|
trigger: 'axis',
|
|
|
@ -224,7 +224,7 @@ define(['angular', 'decimal', 'uiBootstrap', 'uiRouter', 'angularEcharts'], func
|
|
|
|
$scope.generateRate = function (client) {
|
|
|
|
$scope.generateRate = function (client) {
|
|
|
|
commonDialog.confirm({title: 'Confirm Required', content: '根据上季度总交易额自动计算下周期费率,确定执行?'}).then(function () {
|
|
|
|
commonDialog.confirm({title: 'Confirm Required', content: '根据上季度总交易额自动计算下周期费率,确定执行?'}).then(function () {
|
|
|
|
$http.put('/manage/clearing/clients/' + client.client_moniker + '/auto_rate').then(function (resp) {
|
|
|
|
$http.put('/manage/clearing/clients/' + client.client_moniker + '/auto_rate').then(function (resp) {
|
|
|
|
var content = 'New Rate value=' + resp.data.rate_value + '; expiry_time=' + $filter('date')(resp.data.expiry_time, 'dd/MMM/yyyy');
|
|
|
|
let content = 'New Rate value=' + resp.data.rate_value + '; expiry_time=' + $filter('date')(resp.data.expiry_time, 'dd/MMM/yyyy');
|
|
|
|
commonDialog.alert({
|
|
|
|
commonDialog.alert({
|
|
|
|
type: 'success',
|
|
|
|
type: 'success',
|
|
|
|
title: 'New Rate Generated',
|
|
|
|
title: 'New Rate Generated',
|
|
|
@ -248,77 +248,28 @@ define(['angular', 'decimal', 'uiBootstrap', 'uiRouter', 'angularEcharts'], func
|
|
|
|
$scope.analysisFilter = {};
|
|
|
|
$scope.analysisFilter = {};
|
|
|
|
$scope.currentAnalysis = $scope.detail;
|
|
|
|
$scope.currentAnalysis = $scope.detail;
|
|
|
|
$scope.pageCtrl = {visible: {}};
|
|
|
|
$scope.pageCtrl = {visible: {}};
|
|
|
|
|
|
|
|
$scope.searchingClient = null;
|
|
|
|
|
|
|
|
|
|
|
|
function getAnalysisTemplate() {
|
|
|
|
$scope.search = {client_moniker: null};
|
|
|
|
return [
|
|
|
|
|
|
|
|
{settleDays: 1, clients: 0, settleAmount: 0, settles: []},
|
|
|
|
|
|
|
|
{settleDays: 2, clients: 0, settleAmount: 0, settles: []},
|
|
|
|
|
|
|
|
{settleDays: 3, clients: 0, settleAmount: 0, settles: []}
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$scope.reloadPage = function () {
|
|
|
|
|
|
|
|
$state.reload();
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$scope.settleAnalysis = getAnalysisTemplate();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$scope.batchAnalysis = {
|
|
|
|
|
|
|
|
'All': $scope.settleAnalysis
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
angular.forEach($scope.detail.logs, function (batch) {
|
|
|
|
|
|
|
|
$scope.batchAnalysis[batch.clearing_id + ''] = getAnalysisTemplate();
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$scope.endIndexMap = {};
|
|
|
|
|
|
|
|
$scope.initEndIndex = 20;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$scope.more = function (key) {
|
|
|
|
$scope.searchClient = function () {
|
|
|
|
|
|
|
|
if (!$scope.search.client_moniker) {
|
|
|
|
var endIndex = $scope.endIndexMap[key] + $scope.initEndIndex;
|
|
|
|
$scope.searchingClient = null;
|
|
|
|
$scope.endIndexMap[key] = endIndex;
|
|
|
|
}
|
|
|
|
if (endIndex > $scope.clientsMap[key].clients) {
|
|
|
|
if ($scope.currentAnalysis.clearing_id) {
|
|
|
|
$scope.endIndexMap[key] = $scope.clientsMap[key].clients;
|
|
|
|
$http.get('/sys/settlement/clearing/' + $scope.currentAnalysis.clearing_id + '/client_detail/' + $scope.search.client_moniker).then(function (resp) {
|
|
|
|
|
|
|
|
$scope.searchingClient = resp.data;
|
|
|
|
|
|
|
|
}, function (resp) {
|
|
|
|
|
|
|
|
commonDialog.alert({type: 'error', title: 'Error', content: resp.data.message});
|
|
|
|
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$scope.packup = function (key) {
|
|
|
|
|
|
|
|
$scope.endIndexMap[key] = $scope.initEndIndex;
|
|
|
|
|
|
|
|
var length = $scope.clientsMap[key].clients;
|
|
|
|
|
|
|
|
if (length <= $scope.initEndIndex)
|
|
|
|
|
|
|
|
$scope.endIndexMap[key] = length;
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
$scope.displayAll = function (key) {
|
|
|
|
$scope.reloadPage = function () {
|
|
|
|
var length = $scope.clientsMap[key].clients;
|
|
|
|
$state.reload();
|
|
|
|
$scope.endIndexMap[key] = length;
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let nowStr = $filter('date')(new Date(), "yyyy-MM-dd");
|
|
|
|
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);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$scope.clientsMap = $scope.settleAnalysis;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (var key in $scope.clientsMap) {
|
|
|
|
|
|
|
|
$scope.endIndexMap[key] = $scope.initEndIndex;
|
|
|
|
|
|
|
|
var length = $scope.clientsMap[key].clients;
|
|
|
|
|
|
|
|
if (length <= $scope.initEndIndex)
|
|
|
|
|
|
|
|
$scope.endIndexMap[key] = length;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var nowStr = $filter('date')(new Date(), "yyyy-MM-dd");
|
|
|
|
|
|
|
|
$scope.datePattern = $stateParams.date;
|
|
|
|
$scope.datePattern = $stateParams.date;
|
|
|
|
if ($scope.datePattern == nowStr) {
|
|
|
|
if ($scope.datePattern == nowStr) {
|
|
|
|
$scope.sendNotice = true;
|
|
|
|
$scope.sendNotice = true;
|
|
|
@ -336,6 +287,8 @@ define(['angular', 'decimal', 'uiBootstrap', 'uiRouter', 'angularEcharts'], func
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
$scope.switchSettleBatch = function (batch) {
|
|
|
|
$scope.switchSettleBatch = function (batch) {
|
|
|
|
|
|
|
|
$scope.search.client_moniker = null;
|
|
|
|
|
|
|
|
$scope.searchingClient = null;
|
|
|
|
if (batch == null) {
|
|
|
|
if (batch == null) {
|
|
|
|
$scope.currentAnalysis = $scope.detail;
|
|
|
|
$scope.currentAnalysis = $scope.detail;
|
|
|
|
$scope.analysisFilter.clearing_id = null;
|
|
|
|
$scope.analysisFilter.clearing_id = null;
|
|
|
@ -408,10 +361,11 @@ define(['angular', 'decimal', 'uiBootstrap', 'uiRouter', 'angularEcharts'], func
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
$scope.rollbackSettlement = function () {
|
|
|
|
$scope.rollbackSettlement = function () {
|
|
|
|
var log = $scope.getCurrentLog();
|
|
|
|
let log = $scope.getCurrentLog();
|
|
|
|
commonDialog.confirm({
|
|
|
|
commonDialog.dangerConfirm({
|
|
|
|
title: '确认操作',
|
|
|
|
title: '确认操作',
|
|
|
|
content: '回滚当前清算,id=' + log.clearing_id + ',确认?'
|
|
|
|
operation: '回滚当前清算,id=' + log.clearing_id + ',确认?',
|
|
|
|
|
|
|
|
content: 'Undo Settlement'
|
|
|
|
}).then(function () {
|
|
|
|
}).then(function () {
|
|
|
|
$http.delete('/sys/settlement/reports/' + $stateParams.date + '/clearings/' + log.clearing_id).then(function () {
|
|
|
|
$http.delete('/sys/settlement/reports/' + $stateParams.date + '/clearings/' + log.clearing_id).then(function () {
|
|
|
|
$state.reload();
|
|
|
|
$state.reload();
|
|
|
@ -436,7 +390,7 @@ define(['angular', 'decimal', 'uiBootstrap', 'uiRouter', 'angularEcharts'], func
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
$scope.remainingAmount = function () {
|
|
|
|
$scope.remainingAmount = function () {
|
|
|
|
var total = clearingBatch.net_amount;
|
|
|
|
let total = clearingBatch.net_amount;
|
|
|
|
angular.forEach($scope.bankData, function (config) {
|
|
|
|
angular.forEach($scope.bankData, function (config) {
|
|
|
|
total = Decimal.sub(total, config.amount);
|
|
|
|
total = Decimal.sub(total, config.amount);
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -444,7 +398,7 @@ define(['angular', 'decimal', 'uiBootstrap', 'uiRouter', 'angularEcharts'], func
|
|
|
|
};
|
|
|
|
};
|
|
|
|
$scope.submitDistribution = function () {
|
|
|
|
$scope.submitDistribution = function () {
|
|
|
|
$scope.errmsg = null;
|
|
|
|
$scope.errmsg = null;
|
|
|
|
var data = {};
|
|
|
|
let data = {};
|
|
|
|
angular.forEach($scope.bankData, function (config) {
|
|
|
|
angular.forEach($scope.bankData, function (config) {
|
|
|
|
data[config.bank] = config.amount;
|
|
|
|
data[config.bank] = config.amount;
|
|
|
|
});
|
|
|
|
});
|
|
|
|