tmp commit fix getClearDetailTotal

master
luoyang 6 years ago
parent 2ad3ba5e73
commit 652c076016

@ -3446,7 +3446,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (client == null) {
throw new InvalidShortIdException();
}
JSONObject params = new JSONObject();
params.put("client_id", client.getIntValue("client_id"));
params.put("year", date.substring(0, 4));

@ -5,6 +5,7 @@ import au.com.royalpay.payment.manage.mappers.system.ClientsSurchargeAccountsMap
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 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;
@ -50,11 +51,9 @@ public class SurchargeAccountServiceImpl implements SurchargeAccountService{
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);
@ -63,9 +62,7 @@ public class SurchargeAccountServiceImpl implements SurchargeAccountService{
detail.put("is_valid", 0);
financialSurchargeAccountDetailMapper.save(detail);
}
logger.info("===============generator OVER===============" + new Date());
}
@Override
@ -79,6 +76,9 @@ public class SurchargeAccountServiceImpl implements SurchargeAccountService{
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");
}
@ -86,20 +86,19 @@ public class SurchargeAccountServiceImpl implements SurchargeAccountService{
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_date"));
// 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"));
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_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);

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

@ -1074,10 +1074,15 @@
WHERE
t.channel = 'Settlement'
]]>
<if test="client_ids!=null">
AND t.client_id IN
<foreach collection="client_ids" open="(" close=")" separator="," item="clientId">
#{clientId}
</foreach>
</if>
<if test="client_ids==null">
and t.client_id=#{client_id}
</if>
<if test="from!=null">and t.transaction_time &gt;= #{from}</if>
<if test="to!=null">and t.transaction_time &lt; #{to}</if>
GROUP BY

@ -47,8 +47,8 @@ define(['angular', 'decimal', 'uiBootstrap', 'uiRouter', 'angularEcharts'], func
}]);
app.controller('surchargeAccountMonthCtrl', ['$scope', '$http', '$filter', '$timeout', '$uibModal', 'commonDialog', 'chartParser',
function ($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, $sce) {
$scope.params = {year: new Date().getFullYear()};
$scope.availableYears = [new Date().getFullYear() - 1, new Date().getFullYear()];
$scope.initMonth = function (year) {
@ -110,7 +110,7 @@ define(['angular', 'decimal', 'uiBootstrap', 'uiRouter', 'angularEcharts'], func
};
$scope.fillMonthsSurcharge = function (details) {
var contentHtml = $sce.trustAsHtml('即将为[' + $scope.details.short_name + '],<span style="color: red">冲正,请确认商户信息</span>');
var contentHtml = $sce.trustAsHtml('即将为[' + details.short_name + ']冲正,<span style="color: red">请确认商户信息</span>');
commonDialog.confirm({
title: '后付费账户冲正',
@ -119,12 +119,11 @@ define(['angular', 'decimal', 'uiBootstrap', 'uiRouter', 'angularEcharts'], func
{label: 'Cancel', className: 'btn-danger', key: '2', dismiss: true}],
contentHtml: contentHtml
}).then(function () {
$http.post('/sys/settlement/settlement_notice').then(function () {
commonDialog.alert({title: 'Success', content: '发送成功', type: 'success'});
$scope.noticeResend = false;
$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'});
$scope.noticeResend = false;
});
})

@ -55,15 +55,15 @@
</thead>
<tbody>
<tr ng-repeat="details in report.details">
<td>
<td style="vertical-align:middle">
<a class="text-primary" role="button" title="Detail"
ng-click="openClientBoard(details)">
<span ng-bind="details.client_moniker"></span></a>
</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>
<td ng-bind="details.short_name" style="vertical-align:middle"></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>
@ -71,11 +71,11 @@
<!--<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 style="vertical-align:middle">
<!-- 等待邮件和微信推送模板 -->
<!--<a style="cursor: pointer" > 催款</a>-->
<!--<a style="cursor: pointer" ng-click="showDetail()">充值</a>-->
<button class="btn btn-success" type="button" ng-click="fillMonthsSurcharge(details)"></button>
<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>
</td>
</tr>

Loading…
Cancel
Save