Upd:【财务报表】添加清算额数据

master
duLingLing 5 years ago
parent 1fb4f23f9f
commit 3f2a8dc1ae

@ -209,6 +209,7 @@ public class DailyReportImp implements DailyReport {
JSONObject report = new JSONObject();
List<JSONObject> settles = transactionMapper.getSettleDataDailyReport(beginTime,endTime);
JSONObject yesterdayTotal = this.computerTotalAmount(settles);
BigDecimal yesterday_settle_amount = yesterdayTotal.getBigDecimal("total_settle_amount");
BigDecimal yesterday_credit_amount = yesterdayTotal.getBigDecimal("total_credit_amount");
BigDecimal yesterday_debit_amount = yesterdayTotal.getBigDecimal("total_debit_amount");
BigDecimal yesterday_net_trading = yesterdayTotal.getBigDecimal("total_net_trading");
@ -219,6 +220,7 @@ public class DailyReportImp implements DailyReport {
List<JSONObject> last_settle = transactionMapper.getSettleDataDailyReport(DateUtils.addDays(beginTime,-1),DateUtils.addDays(endTime,-1));
JSONObject lastTotal = this.computerTotalAmount(last_settle);
BigDecimal last_settle_amount = lastTotal.getBigDecimal("total_settle_amount");
BigDecimal last_total_credit = lastTotal.getBigDecimal("total_credit_amount");
BigDecimal last_debit_amount = lastTotal.getBigDecimal("total_debit_amount");
BigDecimal last_net_trading = lastTotal.getBigDecimal("total_net_trading");
@ -227,6 +229,7 @@ public class DailyReportImp implements DailyReport {
BigDecimal last_channel_surcharge = lastTotal.getBigDecimal("total_channel_surcharge");
BigDecimal last_tax_amount = lastTotal.getBigDecimal("total_tax_amount");
JSONObject percentage_yesterday_settle_amount = this.percentage(yesterday_settle_amount, last_settle_amount);
JSONObject percentage_yesterday_total_credit = this.percentage(yesterday_credit_amount, last_total_credit);
JSONObject percentage_yesterday_debit_amount = this.percentage(yesterday_debit_amount, last_debit_amount);
JSONObject percentage_yesterday_net_trading = this.percentage(yesterday_net_trading, last_net_trading);
@ -236,6 +239,10 @@ public class DailyReportImp implements DailyReport {
JSONObject percentage_yesterday_tax_amount = this.percentage(yesterday_tax_amount, last_tax_amount);
report.put("channels",settles);
report.put("total_settle_amount",new JSONObject(){{
put("amount",yesterday_settle_amount);
put("compare",percentage_yesterday_settle_amount);
}});
report.put("total_credit_amount",new JSONObject(){{
put("amount",yesterday_credit_amount);
put("compare",percentage_yesterday_total_credit);
@ -265,10 +272,11 @@ public class DailyReportImp implements DailyReport {
put("compare",percentage_yesterday_tax_amount);
}});
return report;
return report;
}
private JSONObject computerTotalAmount(List<JSONObject> settles){
BigDecimal total_settle_amount = new BigDecimal("0.00");
BigDecimal total_credit_amount = new BigDecimal("0.00");
BigDecimal total_debit_amount = new BigDecimal("0.00");
BigDecimal total_net_trading = new BigDecimal("0.00");
@ -281,6 +289,10 @@ public class DailyReportImp implements DailyReport {
for (int i=0;i<settles.size();i++){
JSONObject jsonObject = settles.get(i);
BigDecimal settle_amount = jsonObject.getBigDecimal("settle_amount");
total_settle_amount = total_settle_amount.add(settle_amount);
jsonObject.put("settle_amount",df1.format(settle_amount));
BigDecimal credit_amount = jsonObject.getBigDecimal("credit_amount");
total_credit_amount = total_credit_amount.add(credit_amount);
jsonObject.put("credit_amount",df1.format(credit_amount));
@ -310,6 +322,7 @@ public class DailyReportImp implements DailyReport {
total_tax_amount = total_tax_amount.add(tax_amount);
jsonObject.put("tax_amount",df1.format(tax_amount));
}
String finalTotal_settle_amount = df1.format(total_settle_amount);
String finalTotal_credit_amount = df1.format(total_credit_amount);
String finalTotal_debit_amount = df1.format(total_debit_amount);
String finalTotal_net_trading = df1.format(total_net_trading);
@ -318,6 +331,7 @@ public class DailyReportImp implements DailyReport {
String finalTotal_channel_surcharge = df1.format(total_channel_surcharge);
String finalTotal_tax_amount = df1.format(total_tax_amount);
return new JSONObject(){{
put("total_settle_amount",finalTotal_settle_amount);
put("total_credit_amount", finalTotal_credit_amount);
put("total_debit_amount", finalTotal_debit_amount);
put("total_net_trading", finalTotal_net_trading);

@ -1220,6 +1220,7 @@
<select id="getSettleDataDailyReport" resultType="com.alibaba.fastjson.JSONObject">
SELECT
channel,
SUM(IF(transaction_type = 'Credit', settle_amount, 0)) AS settle_amount,
SUM(IF(transaction_type = 'Credit', clearing_amount, 0)) AS credit_amount,
SUM(IF(transaction_type = 'Credit', 0, -clearing_amount)) AS debit_amount,
SUM(IF(transaction_type = 'Credit', clearing_amount, -clearing_amount)) AS net_trading,

@ -41,7 +41,7 @@
</div>
<div class="weui-panel__ft">
<div class="weui-cell">
<div class="weui-cell__bd weui-cell_primary">入账</div>
<div class="weui-cell__bd weui-cell_primary">入账</div>
<div class="weui-cell__ft" th:text="${report.credit.total_credit_amount.amount}"></div>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<div class="weui-cell__ft">
@ -52,7 +52,7 @@
</div>
<div class="weui-panel__ft">
<div class="weui-cell">
<div class="weui-cell__bd weui-cell_primary">出账</div>
<div class="weui-cell__bd weui-cell_primary">出账</div>
<div class="weui-cell__ft" th:text="${report.credit.total_debit_amount.amount}"></div>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<div class="weui-cell__ft">
@ -61,6 +61,17 @@
</div>
</div>
</div>
<div class="weui-panel__ft">
<div class="weui-cell">
<div class="weui-cell__bd weui-cell_primary">清算额</div>
<div class="weui-cell__ft" th:text="${report.credit.total_settle_amount.amount}"></div>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<div class="weui-cell__ft">
<span style="color: green" th:if="${report.credit.total_settle_amount.compare.positive}" th:text="'↑'+${report.credit.total_settle_amount.compare.compare}"></span>
<span style="color: red" th:if="${!report.credit.total_settle_amount.compare.positive}" th:text="'↓'+${report.credit.total_settle_amount.compare.compare}"></span>
</div>
</div>
</div>
<div class="weui-panel__ft">
<div class="weui-cell">
<div class="weui-cell__bd weui-cell_primary">净交易</div>
@ -74,7 +85,7 @@
</div>
<div class="weui-panel__ft">
<div class="weui-cell">
<div class="weui-cell__bd weui-cell_primary">手续费</div>
<div class="weui-cell__bd weui-cell_primary">手续费</div>
<div class="weui-cell__ft" th:text="${report.credit.total_total_surcharge.amount}"></div>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<div class="weui-cell__ft">
@ -107,7 +118,7 @@
</div>
<div class="weui-panel__ft">
<div class="weui-cell">
<div class="weui-cell__bd weui-cell_primary"></div>
<div class="weui-cell__bd weui-cell_primary"></div>
<div class="weui-cell__ft" th:text="${report.credit.total_tax_amount.amount}"></div>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<div class="weui-cell__ft">
@ -252,49 +263,50 @@
" <div class='weui-panel__ft'>\n" +
" <div class='weui-panel__ft'>\n" +
" <div class='weui-cell'>\n" +
" <div class='weui-cell__bd weui-cell_primary'>入账</div>\n" +
" <div class='weui-cell__bd weui-cell_primary'>入账</div>\n" +
" <div class='weui-cell__ft'>"+convertJsonChannel.credit_amount+"</div>\n" +
" </div>\n" +
" </div>\n" +
" <div class='weui-panel__ft'>\n" +
" <div class='weui-cell'>\n" +
" <div class='weui-cell__bd weui-cell_primary'>出账</div>\n" +
" <div class='weui-cell__bd weui-cell_primary'>出账</div>\n" +
" <div class='weui-cell__ft'>"+convertJsonChannel.debit_amount+"</div>\n" +
" </div>\n" +
" </div>\n" +
" <div class='weui-panel__ft'>\n" +
" <div class='weui-cell'>\n" +
" <div class='weui-cell__bd weui-cell_primary'>净交易</div>\n" +
" <div class='weui-cell__ft'>"+convertJsonChannel.net_trading+"</div>\n" +
" <div class='weui-cell__bd weui-cell_primary'>清算额</div>\n" +
" <div class='weui-cell__ft'>"+convertJsonChannel.settle_amount+"</div>\n" +
" </div>\n" +
" </div>\n" +
" <div class='weui-panel__ft'>\n" +
" <div class='weui-cell'>\n" +
" <div class='weui-cell__bd weui-cell_primary'>总手续费</div>\n" +
" <div class='weui-cell__ft'>"+convertJsonChannel.total_surcharge+"</div>\n" +
" <div class='weui-cell__bd weui-cell_primary'>净交易</div>\n" +
" <div class='weui-cell__ft'>"+convertJsonChannel.net_trading+"</div>\n" +
" </div>\n" +
" </div>\n" +
" <div class='weui-panel__ft'>\n" +
" <div class='weui-cell'>\n" +
" <div class='weui-cell__bd weui-cell_primary'>手续费</div>\n" +
" <div class='weui-cell__bd weui-cell_primary'>手续费</div>\n" +
" <div class='weui-cell__ft'>"+convertJsonChannel.total_surcharge+"</div>\n" +
" </div>\n" +
" </div>\n" +
" <div class='weui-panel__ft'>\n" +
" <div class='weui-cell'>\n" +
" <div class='weui-cell__bd weui-cell_primary'>平台手续费</div>\n" +
" <div class='weui-cell__bd weui-cell_primary'>平台手续费</div>\n" +
" <div class='weui-cell__ft'>"+convertJsonChannel.royal_surcharge+"</div>\n" +
" </div>\n" +
" </div>\n" +
" <div class='weui-panel__ft'>\n" +
" <div class='weui-cell'>\n" +
" <div class='weui-cell__bd weui-cell_primary'>渠道成本手续费</div>\n" +
" <div class='weui-cell__bd weui-cell_primary'>渠道成本手续费</div>\n" +
" <div class='weui-cell__ft'>"+convertJsonChannel.channel_surcharge+"</div>\n" +
" </div>\n" +
" </div>\n" +
" <div class='weui-panel__ft'>\n" +
" <div class='weui-cell'>\n" +
" <div class='weui-cell__bd weui-cell_primary'>税费</div>\n" +
" <div class='weui-cell__bd weui-cell_primary'>税费</div>\n" +
" <div class='weui-cell__ft'>"+convertJsonChannel.tax_amount+"</div>\n" +
" </div>\n" +
" </div>\n" +

Loading…
Cancel
Save