Merge branch 'develop_fill_surcharge' into develop

master
luoyang 6 years ago
commit c01d7114c0

@ -734,11 +734,11 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
JSONObject client = clientManager.getClientInfo(client_id); JSONObject client = clientManager.getClientInfo(client_id);
Assert.notNull(client, "Client not exists"); Assert.notNull(client, "Client not exists");
int parent_client_id = client.getIntValue("parent_client_id"); int parent_client_id = client.getIntValue("parent_client_id");
if (partner.get("client_id") != null) {
if (client_id != partner.getIntValue("client_id") && parent_client_id != partner.getIntValue("client_id")) { if (client_id != partner.getIntValue("client_id") && parent_client_id != partner.getIntValue("client_id")) {
throw new ForbiddenException("No Permission"); throw new ForbiddenException("No Permission");
} }
}
JSONObject clearClient = clearingDetailMapper.listReport(clearingDetailId, client_id); JSONObject clearClient = clearingDetailMapper.listReport(clearingDetailId, client_id);
if (clearClient == null) { if (clearClient == null) {
throw new NotFoundException(); throw new NotFoundException();

@ -1,17 +1,16 @@
package au.com.royalpay.payment.manage.management.clearing.web; package au.com.royalpay.payment.manage.management.clearing.web;
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.permission.manager.PartnerMapping;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole; import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import au.com.royalpay.payment.manage.permission.manager.RequireManager; import au.com.royalpay.payment.manage.permission.manager.RequireManager;
import au.com.royalpay.payment.manage.tradelog.beans.ClearingLogQuery; import au.com.royalpay.payment.manage.tradelog.beans.ClearingLogQuery;
import au.com.royalpay.payment.tools.CommonConsts; import au.com.royalpay.payment.tools.CommonConsts;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.List; import java.util.List;
/** /**
@ -44,4 +43,10 @@ public class CleanLogManagementController {
return cleanService.getSettlementLogs(query, manager); return cleanService.getSettlementLogs(query, manager);
} }
@PartnerMapping("/{client_id}/settlement_logs/{clearingDetailId}/export")
public void exportListClearingTransactions(@PathVariable int client_id, @PathVariable String clearingDetailId,
@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject partner, HttpServletResponse resp) {
cleanService.exportListClearingTransactions(client_id, clearingDetailId, partner, resp);
}
} }

@ -22,6 +22,4 @@ public interface ClearingDistributedSurchargeMapper {
List<JSONObject> getMonthDetailByClientId(@Param("datefrom") Date datefrom, @Param("dateto") Date dateto); List<JSONObject> getMonthDetailByClientId(@Param("datefrom") Date datefrom, @Param("dateto") Date dateto);
List<JSONObject> findTransactionsByDate(JSONObject params); List<JSONObject> findTransactionsByDate(JSONObject params);
} }

@ -13,6 +13,9 @@ import java.util.List;
@AutoMapper(tablename = "financial_surcharge_account_detail", pkName = "detail_id") @AutoMapper(tablename = "financial_surcharge_account_detail", pkName = "detail_id")
public interface FinancialSurchargeAccountDetailMapper { public interface FinancialSurchargeAccountDetailMapper {
@AutoSql(type = SqlType.SELECT)
JSONObject findByDetailId(@Param("detail_id") String detail_id);
List<JSONObject> findDetailsByMonth(@Param("settle_month") String settle_month); List<JSONObject> findDetailsByMonth(@Param("settle_month") String settle_month);
List<JSONObject> findDetailsByClientId(@Param("client_id") int client_id); List<JSONObject> findDetailsByClientId(@Param("client_id") int client_id);
@ -20,9 +23,11 @@ public interface FinancialSurchargeAccountDetailMapper {
@AutoSql(type = SqlType.INSERT) @AutoSql(type = SqlType.INSERT)
void save(JSONObject detail); void save(JSONObject detail);
List<JSONObject> listSettlementDatesInMonth(@Param("month") String month); @AutoSql(type = SqlType.UPDATE)
void update(JSONObject detail);
List<JSONObject> listSettlementDatesInMonth(@Param("month") String month);
List<JSONObject> listSettlementDatesByClientId(@Param("client_id") int client_id);
} }

@ -287,6 +287,8 @@ public interface ClientManager {
List<JSONObject> getAccountTransactions(JSONObject account,String clientMoniker); List<JSONObject> getAccountTransactions(JSONObject account,String clientMoniker);
List<JSONObject> getAccountDetailByMonths(JSONObject account,String clientMoniker);
List<JSONObject> getAccountTransactionsByDate(JSONObject account,String clientMoniker, String date); List<JSONObject> getAccountTransactionsByDate(JSONObject account,String clientMoniker, String date);
List<JSONObject> getAccountMonthDetails(JSONObject account,String clientMoniker); List<JSONObject> getAccountMonthDetails(JSONObject account,String clientMoniker);

@ -3441,12 +3441,20 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
} }
@Override @Override
public List<JSONObject> getAccountTransactionsByDate(JSONObject account, String clientMoniker, String date) { public List<JSONObject> getAccountDetailByMonths(JSONObject account, String clientMoniker) {
JSONObject client = getClientInfoByMoniker(clientMoniker); JSONObject client = getClientInfoByMoniker(clientMoniker);
if (client == null) { if (client == null) {
throw new InvalidShortIdException(); throw new InvalidShortIdException();
} }
return financialSurchargeAccountDetailMapper.listSettlementDatesByClientId(client.getIntValue("client_id"));
}
@Override
public List<JSONObject> getAccountTransactionsByDate(JSONObject account, String clientMoniker, String date) {
JSONObject client = getClientInfoByMoniker(clientMoniker);
if (client == null) {
throw new InvalidShortIdException();
}
JSONObject params = new JSONObject(); JSONObject params = new JSONObject();
params.put("client_id", client.getIntValue("client_id")); params.put("client_id", client.getIntValue("client_id"));
params.put("year", date.substring(0, 4)); params.put("year", date.substring(0, 4));

@ -195,6 +195,18 @@ public class PartnerViewController {
return clientManager.getAccountTransactions(manager, clientMoniker); return clientManager.getAccountTransactions(manager, clientMoniker);
} }
@PartnerMapping(value = "/{clientMoniker}/account/transactions/date", method = RequestMethod.GET, roles = {PartnerRole.ADMIN, PartnerRole.MANAGER})
@ResponseBody
public List<JSONObject> accountTransactionsByDate(@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject manager, @PathVariable String clientMoniker,@RequestParam String date) {
return clientManager.getAccountTransactionsByDate(manager, clientMoniker, date);
}
@PartnerMapping(value = "/{clientMoniker}/account/months", method = RequestMethod.GET, roles = {PartnerRole.ADMIN, PartnerRole.MANAGER})
@ResponseBody
public List<JSONObject> getAccountDetailByMonths(@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject manager, @PathVariable String clientMoniker){
return clientManager.getAccountDetailByMonths(manager, clientMoniker);
}
@PartnerMapping(value = "/accounts/{accountId}/audit_refund", method = RequestMethod.PUT, roles = PartnerRole.ADMIN) @PartnerMapping(value = "/accounts/{accountId}/audit_refund", method = RequestMethod.PUT, roles = PartnerRole.ADMIN)
@ResponseBody @ResponseBody
public void toggleAccountAuditRefund(@PathVariable String accountId, @ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject account, @RequestBody JSONObject enable) { public void toggleAccountAuditRefund(@PathVariable String accountId, @ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject account, @RequestBody JSONObject enable) {

@ -11,4 +11,6 @@ public interface SurchargeAccountService {
List<JSONObject> listSettledDatesInMonth(String mon); List<JSONObject> listSettledDatesInMonth(String mon);
void fillMothsSurcharge(JSONObject manager, String detail_id);
} }

@ -1,9 +1,15 @@
package au.com.royalpay.payment.manage.surchargeAccount.core.impl; 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.ClearingDistributedSurchargeMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientsSurchargeAccountsMapper;
import au.com.royalpay.payment.manage.mappers.system.FinancialSurchargeAccountDetailMapper; import au.com.royalpay.payment.manage.mappers.system.FinancialSurchargeAccountDetailMapper;
import au.com.royalpay.payment.manage.surchargeAccount.core.SurchargeAccountService; import au.com.royalpay.payment.manage.surchargeAccount.core.SurchargeAccountService;
import au.com.royalpay.payment.manage.system.core.impl.ClientContractServiceImpl; import au.com.royalpay.payment.manage.system.core.impl.ClientContractServiceImpl;
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.exceptions.ForbiddenException;
import au.com.royalpay.payment.tools.exceptions.ServerErrorException;
import au.com.royalpay.payment.tools.lock.Locker;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.time.DateFormatUtils; import org.apache.commons.lang3.time.DateFormatUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -12,6 +18,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;
@ -24,6 +31,10 @@ public class SurchargeAccountServiceImpl implements SurchargeAccountService{
private ClearingDistributedSurchargeMapper clearingDistributedSurchargeMapper; private ClearingDistributedSurchargeMapper clearingDistributedSurchargeMapper;
@Resource @Resource
private FinancialSurchargeAccountDetailMapper financialSurchargeAccountDetailMapper; private FinancialSurchargeAccountDetailMapper financialSurchargeAccountDetailMapper;
@Resource
private Locker locker;
@Resource
private ClientsSurchargeAccountsMapper clientsSurchargeAccountsMapper;
Logger logger = LoggerFactory.getLogger(ClientContractServiceImpl.class); Logger logger = LoggerFactory.getLogger(ClientContractServiceImpl.class);
@ -40,27 +51,59 @@ public class SurchargeAccountServiceImpl implements SurchargeAccountService{
Date dateto = monthCal.getTime(); Date dateto = monthCal.getTime();
monthCal.set(Calendar.MONTH, (monthCal.get(Calendar.MONTH) - 1)); monthCal.set(Calendar.MONTH, (monthCal.get(Calendar.MONTH) - 1));
Date datefrom = monthCal.getTime(); Date datefrom = monthCal.getTime();
logger.info("===============Start generator surcharge account month detail===============" + new Date()); logger.info("===============Start generator surcharge account month detail===============" + new Date());
List<JSONObject> thisMonthDetail = clearingDistributedSurchargeMapper.getMonthDetailByClientId(datefrom, dateto); List<JSONObject> thisMonthDetail = clearingDistributedSurchargeMapper.getMonthDetailByClientId(datefrom, dateto);
logger.info("this month details : " + thisMonthDetail.toString()); logger.info("this month details : " + thisMonthDetail.toString());
for (JSONObject detail : thisMonthDetail) { for (JSONObject detail : thisMonthDetail) {
detail.put("send_mail", 0); detail.put("send_mail", 0);
detail.put("wx_send", 0); detail.put("wx_send", 0);
detail.put("settle_month", DateFormatUtils.format(datefrom, "yyyy-MM")); detail.put("settle_month", DateFormatUtils.format(datefrom, "yyyy-MM"));
detail.put("create_time", new Date()); detail.put("create_time", new Date());
detail.put("is_valid", 0);
financialSurchargeAccountDetailMapper.save(detail); financialSurchargeAccountDetailMapper.save(detail);
} }
logger.info("===============generator OVER===============" + new Date()); logger.info("===============generator OVER===============" + new Date());
} }
@Override @Override
public List<JSONObject> listSettledDatesInMonth(String mon) { public List<JSONObject> listSettledDatesInMonth(String mon) {
List<JSONObject> settledDates = financialSurchargeAccountDetailMapper.listSettlementDatesInMonth(mon); return financialSurchargeAccountDetailMapper.listSettlementDatesInMonth(mon);
}
return settledDates; @Override
public void fillMothsSurcharge(JSONObject manager, String detail_id) {
if (!(ManagerRole.ADMIN.hasRole(manager.getIntValue("role")) || ManagerRole.OPERATOR.hasRole(manager.getIntValue("role")) || ManagerRole.FINANCIAL_STAFF.hasRole(manager.getIntValue("role")))) {
throw new ForbiddenException("无法执行平账操作,权限不足");
}
JSONObject detail = financialSurchargeAccountDetailMapper.findByDetailId(detail_id);
if (detail.getBooleanValue("is_valid")) {
throw new BadRequestException("该记录已结清");
}
if (!locker.lock(detail.getIntValue("client_id") + "_" + detail.getString("settle_month") + "_fill", 120_000)) {
throw new ServerErrorException("Processing task, wait for a moment");
}
try {
JSONObject surcharge_account = clientsSurchargeAccountsMapper.find(detail.getIntValue("client_id"));
JSONObject transaction = new JSONObject();
transaction.put("client_id", detail.getIntValue("client_id"));
// transaction.put("settle_date", detail.getString("settle_month"));
transaction.put("type", "Credit");
transaction.put("total_surcharge", BigDecimal.ZERO);
transaction.put("tax_amount", BigDecimal.ZERO);
transaction.put("amount", detail.getBigDecimal("debit_amount").negate());
transaction.put("post_balance", surcharge_account.getBigDecimal("balance").add(transaction.getBigDecimal("amount")));
transaction.put("operation", manager.getString("manager_id"));
transaction.put("create_time", new Date());
transaction.put("remark", detail.getString("settle_month")+"冲正");
clearingDistributedSurchargeMapper.save(transaction);
surcharge_account.put("balance", surcharge_account.getBigDecimal("balance").add(transaction.getBigDecimal("amount")));
clientsSurchargeAccountsMapper.update(surcharge_account);
detail.put("is_valid", 1);
detail.put("operator_id", manager.getString("manager_id"));
financialSurchargeAccountDetailMapper.update(detail);
} finally {
locker.unlock(detail.getIntValue("client_id") + "_" + detail.getString("settle_month") + "_fill");
}
} }
} }

@ -19,7 +19,6 @@ import java.util.List;
@RestController @RestController
public class SurchargeAccountController { public class SurchargeAccountController {
@Resource @Resource
private SurchargeAccountService surchargeAccountService; private SurchargeAccountService surchargeAccountService;
@ -27,4 +26,9 @@ public class SurchargeAccountController {
public List<JSONObject> surchargeAccountSettledDates(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @PathVariable String month) { public List<JSONObject> surchargeAccountSettledDates(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @PathVariable String month) {
return surchargeAccountService.listSettledDatesInMonth(month); return surchargeAccountService.listSettledDatesInMonth(month);
} }
@ManagerMapping(value = "/fill/{detail_id}", role = {ManagerRole.ADMIN, ManagerRole.OPERATOR, ManagerRole.FINANCIAL_STAFF}, method = RequestMethod.PUT)
public void fillMothsSurcharge(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @PathVariable String detail_id) {
surchargeAccountService.fillMothsSurcharge(manager, detail_id);
}
} }

@ -16,10 +16,7 @@ public class SurchargeAccountMonthTask {
@Resource @Resource
private SurchargeAccountService surchargeAccountService; private SurchargeAccountService surchargeAccountService;
@Scheduled(cron = "0 30 23 1 * ?")
@Scheduled(cron = "0 30 6 1 * ?")
public void generateSurchargeAccountDetail() { public void generateSurchargeAccountDetail() {
synchronizedScheduler.executeProcess("manage_task:generateSurchargeAccountMonth", 120_000, () -> synchronizedScheduler.executeProcess("manage_task:generateSurchargeAccountMonth", 120_000, () ->
surchargeAccountService.generatorMonthDetail()); surchargeAccountService.generatorMonthDetail());

@ -4,8 +4,10 @@
<select id="getMonthDetailByClientId" resultType="com.alibaba.fastjson.JSONObject"> <select id="getMonthDetailByClientId" resultType="com.alibaba.fastjson.JSONObject">
<![CDATA[ <![CDATA[
SELECT d.client_id,c.client_moniker,c.company_name, SELECT d.client_id,c.client_moniker,c.company_name,
SUM(IF(d.type='Debit',total_surcharge,-total_surcharge)) total_surcharge,
SUM(IF(d.type='Credit',amount,0)) credit_amount, SUM(IF(d.type='Credit',amount,0)) credit_amount,
SUM(IF(d.type='Debit',amount,0)) debit_amount SUM(IF(d.type='Debit',amount,0)) debit_amount,
SUM(IF(d.type='Debit',total_surcharge,0)) total_surcharge
FROM log_clearing_distributed_surcharge d INNER JOIN sys_clients c ON c.client_id=d.client_id 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} WHERE d.create_time >=#{datefrom} AND d.create_time < #{dateto}
AND c.is_valid= 1 AND c.is_valid= 1

@ -20,8 +20,19 @@
SELECT d.*,c.client_moniker,c.short_name,c.company_name,s.balance 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 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 LEFT JOIN sys_clients_surcharge_accounts s ON s.client_id = d.client_id
WHERE d.settle_month= #{month} WHERE
d.settle_month= #{month}
ORDER BY s.balance ASC ORDER BY s.balance ASC
]]> ]]>
</select> </select>
<select id="listSettlementDatesByClientId" 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
s.client_id = #{client_id}
ORDER BY s.create_time DESC
]]>
</select>
</mapper> </mapper>

@ -608,6 +608,11 @@ margin-bottom: 10%;"/>
<i class="fa fa-tv"></i> <span>商户欠款|Pre Refund</span> <i class="fa fa-tv"></i> <span>商户欠款|Pre Refund</span>
</a> </a>
</li> </li>
<li ui-sref-active="active">
<a ui-sref="surcharge_account_month">
<i class="fa fa-bell"></i> <span>后付费收款</span>
</a>
</li>
</ul> </ul>
</li> </li>

@ -821,6 +821,16 @@
</div> </div>
</a> </a>
</div> </div>
<div class="col-sm-2 col-xs-6">
<a ui-sref="surcharge_account_month" ui-sref-opts="{reload:true}">
<div class="description-block">
<img src="/static/images/main_menu/compliance_warning.png"/>
<div class="description-text">
<span>后付费收款</span>
</div>
</div>
</a>
</div>
</div> </div>
</div> </div>
<div class="list-group" ng-if="role=='accountant' || role=='director' || ('1000000000'|withRole)"> <div class="list-group" ng-if="role=='accountant' || role=='director' || ('1000000000'|withRole)">

@ -21,18 +21,16 @@ define(['angular', 'decimal', 'uiBootstrap', 'uiRouter', 'angularEcharts'], func
controller: 'surchargeAccountMonthCtrl' controller: 'surchargeAccountMonthCtrl'
}) })
}]); }]);
app.controller('clientSurchargeAccountCtrl', ['$scope', '$http','$state','$filter', 'commonDialog','partner', function ($scope, $http,$state,$filter, commonDialog, partner) { app.controller('clientSurchargeAccountCtrl', ['$scope', '$http','$state','$filter', 'commonDialog','partner','$uibModal', function ($scope, $http,$state,$filter, commonDialog, partner,$uibModal) {
$scope.partner = angular.copy(partner.data); $scope.partner = angular.copy(partner.data);
$scope.getBalance = function () { $scope.getBalance = function () {
$scope.surcharge = {}; $scope.surcharge = {};
if ($scope.partner.surcharge_mode != undefined && $scope.partner.surcharge_mode == "distributed") { 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) { $http.get('/client/partner_info/' + $scope.partner.client_moniker + '/surcharge_account').then(function (resp) {
$scope.surcharge = resp.data; $scope.surcharge = resp.data;
}) })
} }
}; };
@ -45,10 +43,36 @@ define(['angular', 'decimal', 'uiBootstrap', 'uiRouter', 'angularEcharts'], func
$scope.getBalance(); $scope.getBalance();
$scope.getTransactions(); $scope.getTransactions();
$scope.getDetailByMonths = function () {
$http.get('/client/partner_info/' + $scope.partner.client_moniker + '/account/months').then(function (resp) {
$scope.report = resp.data;
})
};
$scope.getDetailByMonths();
$scope.surchargeAccountDetail = function (client_moniker,mon) {
$uibModal.open({
templateUrl: '/static/payment/surchargeaccount/templates/client_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('/client/partner_info/' + client_moniker + '/account/transactions/date?date=' + mon);
}]
}
});
};
}]); }]);
app.controller('surchargeAccountMonthCtrl', ['$scope', '$http', '$filter', '$timeout', '$uibModal', 'commonDialog', 'chartParser', app.controller('surchargeAccountMonthCtrl', ['$scope', '$http', '$filter', '$timeout', '$uibModal', 'commonDialog', 'chartParser','$sce',
function ($scope, $http, $filter, $timeout, $uibModal, commonDialog, chartParser) { function ($scope, $http, $filter, $timeout, $uibModal, commonDialog, chartParser, $sce) {
$scope.params = {year: new Date().getFullYear()}; $scope.params = {year: new Date().getFullYear()};
$scope.availableYears = [new Date().getFullYear() - 1, new Date().getFullYear()]; $scope.availableYears = [new Date().getFullYear() - 1, new Date().getFullYear()];
$scope.initMonth = function (year) { $scope.initMonth = function (year) {
@ -67,7 +91,6 @@ define(['angular', 'decimal', 'uiBootstrap', 'uiRouter', 'angularEcharts'], func
return start <= mon && end >= mon return start <= mon && end >= mon
}; };
$scope.loadReport = function (mon) { $scope.loadReport = function (mon) {
$http.get('/sys/surcharge_account/month/' + mon + '/settled_dates').then(function (resp) { $http.get('/sys/surcharge_account/month/' + mon + '/settled_dates').then(function (resp) {
$scope.report = { $scope.report = {
month: mon, month: mon,
@ -97,6 +120,25 @@ define(['angular', 'decimal', 'uiBootstrap', 'uiRouter', 'angularEcharts'], func
$scope.loadReport($scope.report.month); $scope.loadReport($scope.report.month);
}); });
}; };
$scope.fillMonthsSurcharge = function (details) {
var contentHtml = $sce.trustAsHtml('即将为[' + details.short_name + ']冲正,<span style="color: red">请确认商户信息</span>');
commonDialog.confirm({
title: '后付费账户冲正',
content: '',
choises: [{label: 'OK', className: 'btn-success', key: '1'},
{label: 'Cancel', className: 'btn-danger', key: '2', dismiss: true}],
contentHtml: contentHtml
}).then(function () {
$http.put('/sys/surcharge_account/fill/' + details.detail_id).then(function () {
commonDialog.alert({title: 'Success', content: '冲正成功', type: 'success'});
$scope.loadReport($scope.report.month);
}, function (resp) {
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
});
})
};

@ -46,26 +46,38 @@
<tr> <tr>
<th>商户编号</th> <th>商户编号</th>
<th>Short Name</th> <th>Short Name</th>
<th>Total Surcharge</th>
<th>充值总额</th> <th>充值总额</th>
<th>支出总额</th> <th>支出总额</th>
<th>余额</th> <th>是否结清</th>
<!--<th>余额</th>-->
<th>操作</th> <th>操作</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr ng-repeat="details in report.details"> <tr ng-repeat="details in report.details">
<td ng-bind="details.client_moniker"></td> <td style="vertical-align:middle">
<td ng-bind="details.short_name"></td> <a class="text-primary" role="button" title="Detail"
<td ng-bind="details.credit_amount|currency:'$'" style="color: green"></td> ui-sref="partners.detail({clientMoniker:details.client_moniker})">
<td ng-bind="details.debit_amount|currency:'$'" style="color: red"></td> <span ng-bind="details.client_moniker"></span></a>
<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>
<td> <td ng-bind="details.short_name" style="vertical-align:middle"></td>
<td ng-bind="details.total_surcharge | currency:'$'"></td>
<td ng-bind="details.credit_amount|currency:'$'" style="color: green;vertical-align:middle" ></td>
<td ng-bind="details.debit_amount|currency:'$'" style="color: red;vertical-align:middle"></td>
<td style="vertical-align:middle">
<span ng-if="details.is_valid">已结清</span>
<span ng-if="!details.is_valid">未付款</span>
</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 style="vertical-align:middle">
<!-- 等待邮件和微信推送模板 --> <!-- 等待邮件和微信推送模板 -->
<!--<a style="cursor: pointer" > 催款</a>--> <!--<a style="cursor: pointer" > 催款</a>-->
<!--<a style="cursor: pointer" ng-click="showDetail()">充值</a>--> <!--<a style="cursor: pointer" ng-click="showDetail()">充值</a>-->
<button class="btn btn-warning" ng-if="!details.is_valid" type="button" ng-click="fillMonthsSurcharge(details)">冲正</button>
<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> <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> </td>
</tr> </tr>

@ -1,4 +1,3 @@
<section class="content-header"> <section class="content-header">
<h1> <h1>
Client Surcharge Account Client Surcharge Account
@ -14,7 +13,7 @@
<div class="box box-warning"> <div class="box box-warning">
<div class="box-header"> <div class="box-header">
<div class="form-horizontal col-sm-8" style="margin-top: 30px"> <div class="form-horizontal col-sm-8" style="margin-top: 30px">
<div class="form-group" ng-if="partner.surcharge_mode=='distributed'"> <div class="form-group">
<label class="control-label col-xs-4 col-sm-3">手续费账户余额</label> <label class="control-label col-xs-4 col-sm-3">手续费账户余额</label>
<div class="col-sm-6" style="font-size: 25px"> <div class="col-sm-6" style="font-size: 25px">
<p>{{surcharge.balance|currency:'AUD'}}</p> <p>{{surcharge.balance|currency:'AUD'}}</p>
@ -39,15 +38,6 @@
<!--</div>--> <!--</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> </div>
<div class="box"> <div class="box">
@ -112,3 +102,46 @@
</div> </div>
</div> </div>
</div> </div>
<section class="content-header">
<h1>
每月手续费
</h1>
</section>
<div class="content">
<div class="row">
<div class="box box-warning">
<div class="box-body">
<div class="table-responsive col-sm-12">
<table class="table table-bordered table-striped table-hover">
<thead>
<tr>
<th>清算月份</th>
<th>Total Surcharge</th>
<th>支出总额</th>
<th>是否结清</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="details in report">
<td ng-bind="details.settle_month"></td>
<td ng-bind="details.total_surcharge | currency:'$'"></td>
<td ng-bind="details.debit_amount|currency:'$'"
style="color: red;vertical-align:middle"></td>
<td style="vertical-align:middle">
<span ng-if="details.is_valid">已结清</span>
<span ng-if="!details.is_valid">未付款</span>
</td>
<td style="vertical-align:middle">
<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>
</div>
</div>
</div>

@ -0,0 +1,39 @@
<div class="modal-header">
<h4>Surcharge Account Detail{{partner.client_moniker?'('+partner.client_moniker+')':''}}</h4>
</div>
<div class="modal-body">
<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>
{{tr.remark}}
<a ng-href="/client/clean_logs/{{tr.client_id}}/settlement_logs/{{tr.clearing_detail_id}}/export" target="_blank" title="Download">
<i class="fa fa-download"></i>
</a>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>

@ -78,7 +78,12 @@
<td ng-bind="tr.amount|currency:'AUD'"></td> <td ng-bind="tr.amount|currency:'AUD'"></td>
<td ng-bind="tr.total_surcharge|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.tax_amount|currency:'AUD'"></td>
<td ng-bind="tr.remark"></td> <td>
{{tr.remark}}
<a ng-href="/sys/clean_logs/{{tr.client_id}}/settlement_logs/{{tr.clearing_detail_id}}/export" target="_blank" title="Download">
<i class="fa fa-download"></i>
</a>
</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>

Loading…
Cancel
Save