parent
9b465fe3aa
commit
fc653ca1f9
@ -0,0 +1,27 @@
|
||||
package au.com.royalpay.payment.manage.mappers.system;
|
||||
|
||||
import cn.yixblog.support.mybatis.autosql.annotations.AdvanceSelect;
|
||||
import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper;
|
||||
import cn.yixblog.support.mybatis.autosql.annotations.AutoSql;
|
||||
import cn.yixblog.support.mybatis.autosql.annotations.SqlType;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@AutoMapper(tablename = "log_clearing_distributed_surcharge", pkName = "log_id")
|
||||
public interface ClearingDistributedSurchargeMapper {
|
||||
|
||||
List<JSONObject> findTransactions(@Param("client_id") int clientId);
|
||||
|
||||
@AutoSql(type = SqlType.INSERT)
|
||||
void save(JSONObject transactions);
|
||||
|
||||
List<JSONObject> getMonthDetailByClientId(@Param("datefrom") Date datefrom, @Param("dateto") Date dateto);
|
||||
|
||||
List<JSONObject> findTransactionsByDate(JSONObject params);
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package au.com.royalpay.payment.manage.mappers.system;
|
||||
|
||||
import cn.yixblog.support.mybatis.autosql.annotations.AdvanceSelect;
|
||||
import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper;
|
||||
import cn.yixblog.support.mybatis.autosql.annotations.AutoSql;
|
||||
import cn.yixblog.support.mybatis.autosql.annotations.SqlType;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@AutoMapper(tablename = "sys_clients_surcharge_accounts", pkName = "client_id")
|
||||
public interface ClientsSurchargeAccountsMapper {
|
||||
|
||||
@AutoSql(type = SqlType.SELECT)
|
||||
@AdvanceSelect(addonWhereClause = "is_valid=1")
|
||||
JSONObject find(@Param("client_id") int clientId);
|
||||
|
||||
@AutoSql(type = SqlType.INSERT)
|
||||
void save(JSONObject surchargeAccount);
|
||||
|
||||
@AutoSql(type = SqlType.UPDATE)
|
||||
void update(JSONObject surchargeAccount);
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package au.com.royalpay.payment.manage.mappers.system;
|
||||
|
||||
import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper;
|
||||
import cn.yixblog.support.mybatis.autosql.annotations.AutoSql;
|
||||
import cn.yixblog.support.mybatis.autosql.annotations.SqlType;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@AutoMapper(tablename = "financial_surcharge_account_detail", pkName = "detail_id")
|
||||
public interface FinancialSurchargeAccountDetailMapper {
|
||||
|
||||
List<JSONObject> findDetailsByMonth(@Param("settle_month") String settle_month);
|
||||
|
||||
List<JSONObject> findDetailsByClientId(@Param("client_id") int client_id);
|
||||
|
||||
@AutoSql(type = SqlType.INSERT)
|
||||
void save(JSONObject detail);
|
||||
|
||||
List<JSONObject> listSettlementDatesInMonth(@Param("month") String month);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,29 @@
|
||||
package au.com.royalpay.payment.manage.merchants.entity.impls;
|
||||
|
||||
import au.com.royalpay.payment.manage.merchants.entity.ClientConfigModify;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
/**
|
||||
* Create by yixian at 2018-04-12 16:43
|
||||
*/
|
||||
public class SurchargeModeModify extends ClientConfigModify {
|
||||
private String surcharge_mode;
|
||||
|
||||
|
||||
public SurchargeModeModify(JSONObject account, String clientMoniker, String surcharge_mode) {
|
||||
super(account, clientMoniker);
|
||||
this.surcharge_mode = surcharge_mode;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String business() {
|
||||
return "切换商户清算模式(surcharge_mode)";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected JSONObject getModifyResult() {
|
||||
JSONObject modify = new JSONObject();
|
||||
modify.put("surcharge_mode", surcharge_mode);
|
||||
return modify;
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package au.com.royalpay.payment.manage.surchargeAccount.core;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public interface SurchargeAccountService {
|
||||
|
||||
void generatorMonthDetail();
|
||||
|
||||
List<JSONObject> listSettledDatesInMonth(String mon);
|
||||
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
package au.com.royalpay.payment.manage.surchargeAccount.core.impl;
|
||||
|
||||
import au.com.royalpay.payment.manage.mappers.system.ClearingDistributedSurchargeMapper;
|
||||
import au.com.royalpay.payment.manage.mappers.system.FinancialSurchargeAccountDetailMapper;
|
||||
import au.com.royalpay.payment.manage.surchargeAccount.core.SurchargeAccountService;
|
||||
import au.com.royalpay.payment.manage.system.core.impl.ClientContractServiceImpl;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.apache.commons.lang3.time.DateFormatUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class SurchargeAccountServiceImpl implements SurchargeAccountService{
|
||||
|
||||
@Resource
|
||||
private ClearingDistributedSurchargeMapper clearingDistributedSurchargeMapper;
|
||||
@Resource
|
||||
private FinancialSurchargeAccountDetailMapper financialSurchargeAccountDetailMapper;
|
||||
|
||||
Logger logger = LoggerFactory.getLogger(ClientContractServiceImpl.class);
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void generatorMonthDetail(){
|
||||
Calendar monthCal = Calendar.getInstance();
|
||||
monthCal.setTime(new Date());
|
||||
monthCal.set(Calendar.DAY_OF_MONTH, 1);
|
||||
monthCal.set(Calendar.HOUR_OF_DAY, 0);
|
||||
monthCal.set(Calendar.MINUTE, 0);
|
||||
monthCal.set(Calendar.SECOND, 0);
|
||||
Date dateto = monthCal.getTime();
|
||||
monthCal.set(Calendar.MONTH, (monthCal.get(Calendar.MONTH) - 1));
|
||||
Date datefrom = monthCal.getTime();
|
||||
|
||||
logger.info("===============Start generator surcharge account month detail===============" + new Date());
|
||||
List<JSONObject> thisMonthDetail = clearingDistributedSurchargeMapper.getMonthDetailByClientId(datefrom, dateto);
|
||||
logger.info("this month details : " + thisMonthDetail.toString());
|
||||
|
||||
for (JSONObject detail : thisMonthDetail) {
|
||||
detail.put("send_mail", 0);
|
||||
detail.put("wx_send", 0);
|
||||
detail.put("settle_month", DateFormatUtils.format(datefrom, "yyyy-MM"));
|
||||
detail.put("create_time", new Date());
|
||||
financialSurchargeAccountDetailMapper.save(detail);
|
||||
}
|
||||
|
||||
logger.info("===============generator OVER===============" + new Date());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JSONObject> listSettledDatesInMonth(String mon) {
|
||||
List<JSONObject> settledDates = financialSurchargeAccountDetailMapper.listSettlementDatesInMonth(mon);
|
||||
|
||||
return settledDates;
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package au.com.royalpay.payment.manage.surchargeAccount.web;
|
||||
|
||||
import au.com.royalpay.payment.manage.permission.manager.ManagerMapping;
|
||||
import au.com.royalpay.payment.manage.surchargeAccount.core.SurchargeAccountService;
|
||||
import au.com.royalpay.payment.tools.CommonConsts;
|
||||
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
|
||||
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.text.DateFormat;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@RequestMapping("/sys/surcharge_account")
|
||||
@RestController
|
||||
public class SurchargeAccountController {
|
||||
|
||||
|
||||
@Resource
|
||||
private SurchargeAccountService surchargeAccountService;
|
||||
|
||||
@ManagerMapping(value = "/month/{month}/settled_dates", role = {ManagerRole.ADMIN,ManagerRole.OPERATOR}, method = RequestMethod.GET)
|
||||
public List<JSONObject> surchargeAccountSettledDates(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @PathVariable String month) {
|
||||
return surchargeAccountService.listSettledDatesInMonth(month);
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package au.com.royalpay.payment.manage.task;
|
||||
|
||||
import au.com.royalpay.payment.manage.surchargeAccount.core.SurchargeAccountService;
|
||||
import au.com.royalpay.payment.tools.scheduler.SynchronizedScheduler;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Component
|
||||
@ConditionalOnProperty(value = "app.run-tasks", havingValue = "true")
|
||||
public class SurchargeAccountMonthTask {
|
||||
@Resource
|
||||
private SynchronizedScheduler synchronizedScheduler;
|
||||
@Resource
|
||||
private SurchargeAccountService surchargeAccountService;
|
||||
|
||||
|
||||
|
||||
|
||||
@Scheduled(cron = "0 30 6 1 * ?")
|
||||
public void generateSurchargeAccountDetail() {
|
||||
synchronizedScheduler.executeProcess("manage_task:generateSurchargeAccountMonth", 120_000, () ->
|
||||
surchargeAccountService.generatorMonthDetail());
|
||||
}
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="au.com.royalpay.payment.manage.mappers.system.ClearingDistributedSurchargeMapper">
|
||||
<select id="getMonthDetailByClientId" resultType="com.alibaba.fastjson.JSONObject">
|
||||
<![CDATA[
|
||||
SELECT d.client_id,c.client_moniker,c.company_name,
|
||||
SUM(IF(d.type='Credit',amount,0)) credit_amount,
|
||||
SUM(IF(d.type='Debit',amount,0)) debit_amount
|
||||
FROM log_clearing_distributed_surcharge d INNER JOIN sys_clients c ON c.client_id=d.client_id
|
||||
WHERE d.create_time >=#{datefrom} AND d.create_time < #{dateto}
|
||||
AND c.is_valid= 1
|
||||
GROUP BY d.client_id
|
||||
]]>
|
||||
</select>
|
||||
<select id="findTransactions" resultType="com.alibaba.fastjson.JSONObject">
|
||||
<![CDATA[
|
||||
SELECT * FROM log_clearing_distributed_surcharge WHERE client_id = #{client_id}
|
||||
ORDER BY create_time DESC
|
||||
]]>
|
||||
</select>
|
||||
|
||||
<select id="findTransactionsByDate" resultType="com.alibaba.fastjson.JSONObject">
|
||||
<![CDATA[
|
||||
SELECT * FROM log_clearing_distributed_surcharge WHERE client_id = #{client_id}
|
||||
AND year(create_time) = #{year}
|
||||
AND month(create_time) = #{month}
|
||||
ORDER BY create_time DESC
|
||||
]]>
|
||||
</select>
|
||||
|
||||
</mapper>
|
@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="au.com.royalpay.payment.manage.mappers.system.FinancialSurchargeAccountDetailMapper">
|
||||
<select id="findDetailsByMonth" resultType="com.alibaba.fastjson.JSONObject">
|
||||
<![CDATA[
|
||||
SELECT d.*,c.client_moniker,c.short_name,c.company_name
|
||||
FROM financial_surcharge_account_detail d INNER JOIN sys_clients c ON c.client_id=d.client_id
|
||||
WHERE d.settle_month = #{settle_month}
|
||||
]]>
|
||||
</select>
|
||||
<select id="findDetailsByClientId" resultType="com.alibaba.fastjson.JSONObject">
|
||||
<![CDATA[
|
||||
SELECT d.*,c.client_moniker,c.short_name,c.company_name
|
||||
FROM financial_surcharge_account_detail d INNER JOIN sys_clients c ON c.client_id=d.client_id
|
||||
WHERE d.client_id = #{client_id} ORDER BY create_time desc
|
||||
]]>
|
||||
</select>
|
||||
<select id="listSettlementDatesInMonth" resultType="com.alibaba.fastjson.JSONObject">
|
||||
<![CDATA[
|
||||
SELECT d.*,c.client_moniker,c.short_name,c.company_name,s.balance
|
||||
FROM financial_surcharge_account_detail d INNER JOIN sys_clients c ON c.client_id=d.client_id
|
||||
LEFT JOIN sys_clients_surcharge_accounts s ON s.client_id = d.client_id
|
||||
WHERE d.settle_month= #{month}
|
||||
ORDER BY s.balance ASC
|
||||
]]>
|
||||
</select>
|
||||
</mapper>
|
@ -0,0 +1,111 @@
|
||||
<div class="content">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="box-solid">
|
||||
<!--<div class="box box-warning">-->
|
||||
<!--<div class="box-header">-->
|
||||
<!--<div class="row">-->
|
||||
<!--<div class="col-sm-12">-->
|
||||
<!--<!–<div class="form-horizontal">–>-->
|
||||
<!--<!–<div class="form-group col-xs-12">–>-->
|
||||
<!--<!–<label class="control-label col-xs-4 col-sm-2">Date Range</label>–>-->
|
||||
<!--<!–<div class="col-sm-10 col-xs-8">–>-->
|
||||
<!--<!–<div class="form-control-static form-inline">–>-->
|
||||
<!--<!–<div style="display: inline-block">–>-->
|
||||
<!--<!–<input class="form-control" id="date-from-input"–>-->
|
||||
<!--<!–ng-model="params.datefrom"–>-->
|
||||
<!--<!–uib-datepicker-popup size="10" placeholder="From"–>-->
|
||||
<!--<!–is-open="dateBegin.open" ng-click="dateBegin.open=true"–>-->
|
||||
<!--<!–datepicker-options="{maxDate:params.dateto||today}">–>-->
|
||||
<!--<!–</div>–>-->
|
||||
<!--<!–~–>-->
|
||||
<!--<!–<div style="display: inline-block">–>-->
|
||||
<!--<!–<input class="form-control" id="date-to-input"–>-->
|
||||
<!--<!–ng-model="params.dateto"–>-->
|
||||
<!--<!–uib-datepicker-popup size="10" placeholder="To"–>-->
|
||||
<!--<!–is-open="dateTo.open" ng-click="dateTo.open=true"–>-->
|
||||
<!--<!–datepicker-options="{minDate:params.datefrom,maxDate:today}">–>-->
|
||||
<!--<!–</div>–>-->
|
||||
|
||||
<!--<!–<div class="btn-group">–>-->
|
||||
<!--<!–<a role="button" class="btn btn-default btn-sm"–>-->
|
||||
<!--<!–ng-click="chooseToday()">Today</a>–>-->
|
||||
<!--<!–</div>–>-->
|
||||
<!--<!–<div class="btn-group">–>-->
|
||||
<!--<!–<a role="button" class="btn btn-default btn-sm"–>-->
|
||||
<!--<!–ng-click="chooseYesterday()">Yesterday</a>–>-->
|
||||
<!--<!–</div>–>-->
|
||||
<!--<!–<div class="btn-group">–>-->
|
||||
<!--<!–<a role="button" class="btn btn-default btn-sm"–>-->
|
||||
<!--<!–ng-click="chooseLast7Days()">Last 7 Days</a>–>-->
|
||||
<!--<!–</div>–>-->
|
||||
<!--<!–<div class="btn-group">–>-->
|
||||
<!--<!–<a role="button" class="btn btn-default btn-sm"–>-->
|
||||
<!--<!–ng-click="thisMonth()">This Month</a>–>-->
|
||||
<!--<!–</div>–>-->
|
||||
<!--<!–<div class="btn-group">–>-->
|
||||
<!--<!–<a role="button" class="btn btn-default btn-sm"–>-->
|
||||
<!--<!–ng-click="lastMonth()">Last Month</a>–>-->
|
||||
<!--<!–</div>–>-->
|
||||
<!--<!–</div>–>-->
|
||||
<!--<!–</div>–>-->
|
||||
<!--<!–</div>–>-->
|
||||
<!--<!–<button class="btn btn-success" type="button" ng-click="loadSettlementLogs(1)">–>-->
|
||||
<!--<!–<i class="fa fa-search"></i> Search–>-->
|
||||
<!--<!–</button>–>-->
|
||||
<!--<!–</div>–>-->
|
||||
<!--</div>-->
|
||||
<!--</div>-->
|
||||
<!--</div>-->
|
||||
<!--</div>-->
|
||||
<div class="box box-warning">
|
||||
<div class="box-header">
|
||||
<h3 class="box-title">Surcharge Account Details</h3>
|
||||
|
||||
</div>
|
||||
<div class="box-body table-responsive">
|
||||
<table class="table table-bordered table-hover table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Client Moniker</th>
|
||||
<th>Settle Date</th>
|
||||
<th>Credit Amount</th>
|
||||
<th>Debit Amount</th>
|
||||
<th>Create_time</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="log in details">
|
||||
<td ng-bind="log.client_moniker"></td>
|
||||
<td ng-bind="log.settle_month"></td>
|
||||
<td ng-bind="log.credit_amount|currency:'AUD'"></td>
|
||||
<td ng-bind="log.debit_amount|currency:'AUD'"></td>
|
||||
<td ng-bind="log.create_time"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="panel-footer" ng-if="settlementLogs.length">
|
||||
<uib-pagination class="pagination"
|
||||
total-items="pagination.totalCount"
|
||||
boundary-links="true"
|
||||
ng-model="pagination.page"
|
||||
items-per-page="pagination.limit"
|
||||
max-size="10"
|
||||
ng-change="loadSettlementLogs()"
|
||||
previous-text="‹"
|
||||
next-text="›"
|
||||
first-text="«"
|
||||
last-text="»"></uib-pagination>
|
||||
<div class="row">
|
||||
<div class="col-xs-12">Total Records:{{pagination.totalCount}};Total
|
||||
Pages:{{pagination.totalPages}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.box-footer -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -0,0 +1,149 @@
|
||||
/**
|
||||
* Created by yishuqian on 01/06/2017.
|
||||
*/
|
||||
define(['angular', 'decimal', 'uiBootstrap', 'uiRouter', 'angularEcharts'], function (angular) {
|
||||
'use strict';
|
||||
var colors = ['#00c0ef', '#00a65a', '#ff851b', '#f39c12', '#d81b60', '#605ca8', '#dd4b39', '#008080', '#8B008B', '#D2691E', '#708090'];
|
||||
var app = angular.module('surchargeAccountApp', ['ui.bootstrap', 'ui.router', 'ngEcharts']);
|
||||
app.config(['$stateProvider', function ($stateProvider) {
|
||||
$stateProvider.state('surcharge_account', {
|
||||
url: '/surcharge_account',
|
||||
templateUrl: '/static/payment/surchargeaccount/templates/client_surcharge_account.html',
|
||||
resolve: {
|
||||
partner: ['$http', function ($http) {
|
||||
return $http.get('/client/partner_info');
|
||||
}]
|
||||
},
|
||||
controller: 'clientSurchargeAccountCtrl'
|
||||
}).state('surcharge_account_month', {
|
||||
url: '/surcharge_account_month',
|
||||
templateUrl: '/static/payment/surchargeaccount/templates/account_month_logs.html',
|
||||
controller: 'surchargeAccountMonthCtrl'
|
||||
})
|
||||
}]);
|
||||
app.controller('clientSurchargeAccountCtrl', ['$scope', '$http','$state','$filter', 'commonDialog','partner', function ($scope, $http,$state,$filter, commonDialog, partner) {
|
||||
|
||||
$scope.partner = angular.copy(partner.data);
|
||||
|
||||
$scope.getBalance = function () {
|
||||
$scope.surcharge = {};
|
||||
|
||||
if ($scope.partner.surcharge_mode != undefined && $scope.partner.surcharge_mode == "distributed") {
|
||||
$http.get('/client/partner_info/' + $scope.partner.client_moniker + '/surcharge_account').then(function (resp) {
|
||||
$scope.surcharge = resp.data;
|
||||
})
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
$scope.getTransactions = function () {
|
||||
$http.get('/client/partner_info/' + $scope.partner.client_moniker + '/account/transactions').then(function (resp) {
|
||||
$scope.transactions = resp.data;
|
||||
})
|
||||
}
|
||||
|
||||
$scope.getBalance();
|
||||
$scope.getTransactions();
|
||||
|
||||
|
||||
}]);
|
||||
app.controller('surchargeAccountMonthCtrl', ['$scope', '$http', '$filter', '$timeout', '$uibModal', 'commonDialog', 'chartParser',
|
||||
function ($scope, $http, $filter, $timeout, $uibModal, commonDialog, chartParser) {
|
||||
$scope.params = {year: new Date().getFullYear()};
|
||||
$scope.availableYears = [new Date().getFullYear() - 1, new Date().getFullYear()];
|
||||
$scope.initMonth = function (year) {
|
||||
$scope.params.year = year;
|
||||
$scope.months = [];
|
||||
for (var i = 1; i < 13; i++) {
|
||||
var mon = '00' + i;
|
||||
mon = mon.substr(mon.length - 2, 2);
|
||||
$scope.months.push(year + '-' + mon);
|
||||
}
|
||||
};
|
||||
$scope.initMonth(new Date().getFullYear());
|
||||
$scope.hasReport = function (mon) {
|
||||
var start = '2017-02';//todo modify in different country
|
||||
var end = $filter('date')(new Date().setMonth(new Date().getMonth()-1), 'yyyy-MM');
|
||||
return start <= mon && end >= mon
|
||||
};
|
||||
$scope.loadReport = function (mon) {
|
||||
|
||||
$http.get('/sys/surcharge_account/month/' + mon + '/settled_dates').then(function (resp) {
|
||||
$scope.report = {
|
||||
month: mon,
|
||||
details: resp.data
|
||||
};
|
||||
})
|
||||
};
|
||||
$scope.surchargeAccountDetail = function (client_moniker,mon) {
|
||||
$uibModal.open({
|
||||
templateUrl: '/static/payment/surchargeaccount/templates/partner_surcharge_account_dialog.html',
|
||||
controller: 'accountDetailCtrl',
|
||||
size: 'lg',
|
||||
resolve: {
|
||||
client_moniker: function () {
|
||||
return client_moniker;
|
||||
},
|
||||
month: function () {
|
||||
return mon;
|
||||
},
|
||||
transactions: ['$http', function ($http) {
|
||||
return $http.get('/sys/partners/' + client_moniker + '/account/transactions/date?date='+mon);
|
||||
}]
|
||||
}
|
||||
}).result.then(function () {
|
||||
$scope.loadReport($scope.report.month);
|
||||
}, function () {
|
||||
$scope.loadReport($scope.report.month);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
|
||||
}]);
|
||||
app.controller('accountDetailCtrl', ['$scope','$http','transactions','client_moniker','commonDialog','month', function ($scope, $http, transactions,client_moniker,commonDialog,month) {
|
||||
$scope.transactions = angular.copy(transactions.data);
|
||||
$scope.canAddDetail = false;
|
||||
$scope.params = {};
|
||||
$scope.month = angular.copy(month);
|
||||
|
||||
|
||||
$scope.getBalance = function () {
|
||||
$http.get('/sys/partners/' + client_moniker + '/surcharge_account').then(function (resp) {
|
||||
$scope.surcharge = resp.data;
|
||||
})
|
||||
};
|
||||
$scope.getBalance();
|
||||
|
||||
|
||||
$scope.getTransactions = function () {
|
||||
$http.get('/sys/partners/' + client_moniker + '/account/transactions/date?date=' + $scope.month).then(function (resp) {
|
||||
$scope.transactions = resp.data;
|
||||
});
|
||||
}
|
||||
|
||||
$scope.addDetail = function () {
|
||||
$scope.canAddDetail = true;
|
||||
};
|
||||
|
||||
$scope.cancel = function () {
|
||||
$scope.canAddDetail = false;
|
||||
$scope.params = {};
|
||||
}
|
||||
$scope.save = function () {
|
||||
$http.post('/sys/partners/' + client_moniker + '/account/save', {amount:$scope.params.amount,remark:$scope.params.remark}).then(function (resp) {
|
||||
$scope.getTransactions();
|
||||
$scope.getBalance();
|
||||
$scope.canAddDetail = false;
|
||||
$scope.params = {};
|
||||
}, function (resp) {
|
||||
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}]);
|
||||
|
||||
|
||||
return app;
|
||||
});
|
@ -0,0 +1,76 @@
|
||||
<section class="content-header">
|
||||
<h1>Surcharge Account Detail</h1>
|
||||
<ol class="breadcrumb">
|
||||
<li>
|
||||
<i class="fa fa-sitemap"></i> Compliance
|
||||
</li>
|
||||
<li class="active">Surcharge Account Detail</li>
|
||||
</ol>
|
||||
</section>
|
||||
<section class="content">
|
||||
<div class="box box-default">
|
||||
<div class="box-header">
|
||||
<!-- <div uib-dropdown>
|
||||
<button class="btn btn-primary" uib-dropdown-toggle type="button" ng-bind="params.year"></button>
|
||||
<ul class="dropdown-menu" uib-dropdown-menu role="menu">
|
||||
<li ng-repeat="year in availableYears" role="menuitem"><a role="button" ng-click="initMonth(year)" ng-bind="year"></a></li>
|
||||
</ul>
|
||||
</div>-->
|
||||
|
||||
<div ng-repeat="year in availableYears" style="display: inline">
|
||||
<button class="btn btn-info"
|
||||
ng-click="initMonth(year)"
|
||||
ng-bind="year"
|
||||
ng-class="{'active':year == params.year}"
|
||||
></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<div class="row">
|
||||
<div class="col-xs-3" ng-repeat="mon in months">
|
||||
<a class="text-success" role="button" ng-click="loadReport(mon)" ng-if="hasReport(mon)">
|
||||
<h2 ng-bind="mon.substring(5,7)"></h2>
|
||||
</a>
|
||||
<h2 class="text-gray" ng-bind="mon.substring(5,7)" ng-if="!hasReport(mon)"></h2>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box box-warning" ng-if="report">
|
||||
<div class="box-header">
|
||||
<span ng-bind="report.month"></span>
|
||||
</div>
|
||||
<div class="box-body table-responsive">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>商户编号</th>
|
||||
<th>Short Name</th>
|
||||
<th>充值总额</th>
|
||||
<th>支出总额</th>
|
||||
<th>余额</th>
|
||||
<th>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="details in report.details">
|
||||
<td ng-bind="details.client_moniker"></td>
|
||||
<td ng-bind="details.short_name"></td>
|
||||
<td ng-bind="details.credit_amount|currency:'$'" style="color: green"></td>
|
||||
<td ng-bind="details.debit_amount|currency:'$'" style="color: red"></td>
|
||||
<td>
|
||||
<span ng-if="details.balance>=0" style="color: green">{{details.balance|currency:'$'}}</span>
|
||||
<span ng-if="details.balance<0" style="color: red">{{details.balance|currency:'$'}}</span>
|
||||
</td>
|
||||
<td>
|
||||
<!-- 等待邮件和微信推送模板 -->
|
||||
<!--<a style="cursor: pointer" > 催款</a>-->
|
||||
<!--<a style="cursor: pointer" ng-click="showDetail()">充值</a>-->
|
||||
<i class="fa fa-bars" style="font-size: 15px;color: #3c8dbc;cursor: pointer;padding-left: 15px" ng-click="surchargeAccountDetail(details.client_moniker,details.settle_month)"></i>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
@ -0,0 +1,114 @@
|
||||
|
||||
<section class="content-header">
|
||||
<h1>
|
||||
Client Surcharge Account
|
||||
</h1>
|
||||
<ol class="breadcrumb">
|
||||
<li class="active"><i class="fa fa-dashboard"></i> Surcharge Account</li>
|
||||
</ol>
|
||||
</section>
|
||||
<div class="content">
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="box-solid">
|
||||
<div class="box box-warning">
|
||||
<div class="box-header">
|
||||
<div class="form-horizontal col-sm-8" style="margin-top: 30px">
|
||||
<div class="form-group" ng-if="partner.surcharge_mode=='distributed'">
|
||||
<label class="control-label col-xs-4 col-sm-3">手续费账户余额</label>
|
||||
<div class="col-sm-6" style="font-size: 25px">
|
||||
<p>{{surcharge.balance|currency:'AUD'}}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" ng-if="partner.surcharge_mode=='distributed'">
|
||||
<label class="control-label col-xs-4 col-sm-3">允许手续费账户欠款</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="checkbox" ng-model="partner.allow_surcharge_credit" bs-switch
|
||||
switch-change="allowSurchargeCredit(partner.allow_surcharge_credit)" switch-readonly="true">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-4 col-sm-3" style="padding-top:0px">Surcharge Mode:</label>
|
||||
<div class="col-xs-8 col-sm-6">
|
||||
<span class="control-label" ng-bind="partner.surcharge_mode"></span>
|
||||
<p class="text-info">
|
||||
<i class="fa fa-info"></i>启用到收支分离(distributed)模式,将使消费者支付手续费模式失效
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="col-sm-4" style="text-align: center" ng-if="code_url">
|
||||
<a class="thumbnail" download ng-href="{{code_url}}" uib-tooltip="Download">
|
||||
<img ng-src="{{code_url}}">
|
||||
</a>
|
||||
<p>
|
||||
<a ng-href="{{code_url}}" download><i class="fa fa-download"></i> Download Bill QR
|
||||
Code Image</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box">
|
||||
<div class="box box-default">
|
||||
<div class="box-header">Credits</div>
|
||||
<div class="box-body">
|
||||
<div class="table-responsive col-sm-12">
|
||||
<table class="table table-bordered table-striped table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Num</th>
|
||||
<th>Create Time</th>
|
||||
<th>Amount</th>
|
||||
<th>Remark</th>
|
||||
<th>Operator</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="tr in transactions|propsFilter:{type:'Credit',create_time:ctrl.day}:true">
|
||||
<td>{{$index+1}}</td>
|
||||
<td ng-bind="tr.create_time|date:'yyyy-MM-dd HH:mm:ss'"></td>
|
||||
<td ng-bind="tr.amount|currency:'AUD'"></td>
|
||||
<td ng-bind="tr.remark"></td>
|
||||
<td ng-bind="tr.operator_displayname"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box box-default">
|
||||
<div class="box-header">Debits</div>
|
||||
<div class="box-body">
|
||||
<div class="table-responsive col-sm-12">
|
||||
<table class="table table-bordered table-striped table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Num</th>
|
||||
<th>Settle Date</th>
|
||||
<th>Amount</th>
|
||||
<th>Total Surcharge</th>
|
||||
<th>Tax Amount</th>
|
||||
<th>Remark</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="tr in transactions|propsFilter:{type:'Debit',create_time:ctrl.day}:true">
|
||||
<td>{{$index+1}}</td>
|
||||
<td ng-bind="tr.settle_date|date:'yyyy-MM-dd'"></td>
|
||||
<td ng-bind="tr.amount|currency:'AUD'"></td>
|
||||
<td ng-bind="tr.total_surcharge|currency:'AUD'"></td>
|
||||
<td ng-bind="tr.tax_amount|currency:'AUD'"></td>
|
||||
<td ng-bind="tr.remark"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -0,0 +1,88 @@
|
||||
<div class="modal-header">
|
||||
<h4>Surcharge Account Detail{{partner.client_moniker?'('+partner.client_moniker+')':''}}</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="box box-warning">
|
||||
<div class="box-body" style="font-size: 35px;text-align: right">
|
||||
{{surcharge.balance|currency:'AUD'}}<i class="fa fa-plus-square-o" style="font-size: 15px;padding-left: 15px;cursor: pointer" ng-click="addDetail()"></i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box box-warning" ng-if="canAddDetail">
|
||||
<div class="box-body">
|
||||
<div class="row" style="margin-left: 20px;">
|
||||
<div class="form-group">
|
||||
<label>
|
||||
Amount:
|
||||
</label>
|
||||
<input type="number" ng-model="params.amount">
|
||||
<label>
|
||||
remark:
|
||||
</label>
|
||||
<input type="text" ng-model="params.remark">
|
||||
<div class="btn-group">
|
||||
<a class="btn btn-success" role="button" ng-click="save()">Submit</a>
|
||||
</div>
|
||||
<div class="btn-group">
|
||||
<a class="btn btn-danger" ng-click="cancel()" >Cancel</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box box-default">
|
||||
<div class="box-header">Credits</div>
|
||||
<div class="box-body">
|
||||
<div class="table-responsive col-sm-12">
|
||||
<table class="table table-bordered table-striped table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Num</th>
|
||||
<th>Create Time</th>
|
||||
<th>Amount</th>
|
||||
<th>Remark</th>
|
||||
<th>Operator</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="tr in transactions|propsFilter:{type:'Credit'}:true">
|
||||
<td>{{$index+1}}</td>
|
||||
<td ng-bind="tr.create_time|date:'yyyy-MM-dd HH:mm:ss'"></td>
|
||||
<td ng-bind="tr.amount|currency:'AUD'"></td>
|
||||
<td ng-bind="tr.remark"></td>
|
||||
<td ng-bind="tr.operator_displayname"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box box-default">
|
||||
<div class="box-header">Debits</div>
|
||||
<div class="box-body">
|
||||
<div class="table-responsive col-sm-12">
|
||||
<table class="table table-bordered table-striped table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Num</th>
|
||||
<th>Settle Date</th>
|
||||
<th>Amount</th>
|
||||
<th>Total Surcharge</th>
|
||||
<th>Tax Amount</th>
|
||||
<th>Remark</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="tr in transactions|propsFilter:{type:'Debit'}:true">
|
||||
<td>{{$index+1}}</td>
|
||||
<td ng-bind="tr.settle_date|date:'yyyy-MM-dd'"></td>
|
||||
<td ng-bind="tr.amount|currency:'AUD'"></td>
|
||||
<td ng-bind="tr.total_surcharge|currency:'AUD'"></td>
|
||||
<td ng-bind="tr.tax_amount|currency:'AUD'"></td>
|
||||
<td ng-bind="tr.remark"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
Loading…
Reference in new issue