master
yuan 7 years ago
parent ae8ea53870
commit 071c05905a

@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.text.ParseException;
import java.util.List;
import java.util.Map;
/**
* Created by yishuqian on 20/02/2017.
@ -78,5 +79,11 @@ public class PartnerCardDashboardController {
return cleanService.getCleanLogTransactions(detailId, manager);
}
@RequestMapping("/settlement_logs/{detailId}/analysis/{channel}")
public Map<String,JSONObject> getDayAndChannelOfAnalysisMap(@PathVariable int detailId,
@PathVariable String channel, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
return cleanService.getDayAndChannelOfAnalysisMap(detailId,channel, manager);
}
}

@ -11,6 +11,7 @@ import java.io.PrintWriter;
import java.io.Writer;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* Created by davep on 2016-08-29.
@ -31,6 +32,8 @@ public interface CleanService {
JSONObject getCleanLogTransactions(int detailId, JSONObject manager);
Map<String,JSONObject> getDayAndChannelOfAnalysisMap(int detailId, String channel,JSONObject manager);
JSONObject getCleanLogTransactions(int client_id, String detailId);
void settlementCsv(Date dt, HttpServletResponse resp) throws IOException;
@ -60,6 +63,8 @@ public interface CleanService {
JSONObject listClearingTransactions(int client_id, String clearingDetailId, JSONObject partner);
Map<String,JSONObject> channelAndDayOfAnalysis(int client_id, String clearingDetailId, String channel,JSONObject partner);
void exportListClearingTransactions(int client_id, String clearingDetailId, JSONObject partner, HttpServletResponse resp);
List<JSONObject> getSettlementMonthReport(int year, int monthOfYear);

@ -83,14 +83,9 @@ import java.math.RoundingMode;
import java.net.URISyntaxException;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Currency;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.List;
import java.util.Locale;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
@ -261,6 +256,19 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
return cleanLog;
}
@Override
public Map<String,JSONObject> getDayAndChannelOfAnalysisMap(int detailId,String channel,JSONObject manager) {
JSONObject cleanLog = clearingDetailMapper.findByDetailId(detailId);
if (cleanLog == null) {
throw new NotFoundException();
}
JSONObject client = clientManager.getClientInfo(cleanLog.getIntValue("client_id"));
Assert.notNull(client, "Client ID invalid");
checkOrgPermission(manager, client);
return getDayAnalysisMap(String.valueOf(detailId),channel,client);
}
@Override
public JSONObject getCleanLogTransactions(int clientId, String clearingDetailId) {
return settlementSupport.listSettlementTransactionsForClient(clientId, clearingDetailId);
@ -642,7 +650,6 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
TimeZoneUtils.switchTimeZone(p, timezone_client, "transaction_time");
});
}
clearClient.put("report", transactions);
List<JSONObject> channels = clearingDetailAnalysisMapper.listReportChannels(clearClient.getString("clear_detail_id"));
JSONObject channelsObj = new JSONObject();
@ -654,6 +661,68 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
return clearClient;
}
@Override
public Map<String,JSONObject> channelAndDayOfAnalysis(int client_id, String clearingDetailId,String channel,JSONObject partner) {
JSONObject client = clientManager.getClientInfo(client_id);
Assert.notNull(client, "Client not exists");
int parent_client_id = client.getIntValue("parent_client_id");
if (client_id != partner.getIntValue("client_id") && parent_client_id != partner.getIntValue("client_id")) {
throw new ForbiddenException("No Permission");
}
return getDayAnalysisMap(clearingDetailId,channel,client);
}
private Map<String,JSONObject> getDayAnalysisMap(String clearingDetailId,String channel,JSONObject client){
List<JSONObject> transactions = transactionMapper.listTransactionsOfClearingOrder(Integer.parseInt(clearingDetailId),
new PageBounds(Order.formString("order_id.asc")));
String timezone_client = client.getString("timezone");
if(!channel.equals("null")){
transactions = transactions.stream().filter(t->t.getString("channel").equals(channel)).collect(Collectors.toList());
}
List<String> dateKeysList = new ArrayList<>();
dateKeysList.add("transaction_time");
if (timezone_client == null) {
transactions.parallelStream().forEach(p -> {
TimeZoneUtils.switchTimeZone(p, timezone_client, "transaction_time");
});
//TimeZoneUtils.switchTimeZoneToString(transactions,timezone_client,TimeZoneUtils.PATTERN_DATE,dateKeysList);
}
Map<String,List<JSONObject>> dayTransactionsMap = transactions.stream().collect(Collectors.groupingBy(x -> x.getString("transaction_time").substring(0,10)));
Map<String,JSONObject> dayAnalysisMap = new TreeMap<>();
for (Map.Entry<String, List<JSONObject>> entry : dayTransactionsMap.entrySet()){
JSONObject analysis = new JSONObject();
List<JSONObject> transactionsOfDay = entry.getValue();
/*if(entry.getKey().equals("2017-11-20")){
int i = 0;
}*/
BigDecimal total_credit = transactionsOfDay.stream().filter(t->t.getString("transaction_type").equals("Credit")).filter(t->t.containsKey("clearing_amount")).map(t-> t.getBigDecimal("clearing_amount")).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal total_debit = transactionsOfDay.stream().filter(t->t.getString("transaction_type").equals("Debit")).filter(t->t.containsKey("clearing_amount")).map(t-> t.getBigDecimal("clearing_amount")).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal total_charge_credit = transactionsOfDay.stream().filter(t->t.getString("transaction_type").equals("Credit")).filter(t->t.containsKey("total_surcharge")).map(t-> t.getBigDecimal("total_surcharge")).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal total_charge_debit = transactionsOfDay.stream().filter(t->t.getString("transaction_type").equals("Debit")).filter(t->t.containsKey("total_surcharge")).map(t-> t.getBigDecimal("total_surcharge")).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal net_amount_credit = transactionsOfDay.stream().filter(t->t.getString("transaction_type").equals("Credit")).filter(t->t.containsKey("settle_amount")).map(t-> t.getBigDecimal("settle_amount")).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal net_amount_debit = transactionsOfDay.stream().filter(t->t.getString("transaction_type").equals("Debit")).filter(t->t.containsKey("settle_amount")).map(t-> t.getBigDecimal("settle_amount")).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal tax_amount_credit = transactionsOfDay.stream().filter(t->t.getString("transaction_type").equals("Credit")).filter(t->t.containsKey("tax_amount")).map(t-> t.getBigDecimal("tax_amount")).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal tax_amount_debit = transactionsOfDay.stream().filter(t->t.getString("transaction_type").equals("Debit")).filter(t->t.containsKey("tax_amount")).map(t-> t.getBigDecimal("tax_amount")).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal wechat_charge_credit = transactionsOfDay.stream().filter(t->t.getString("transaction_type").equals("Credit")).filter(t->t.containsKey("wechat_charge")).map(t-> t.getBigDecimal("wechat_charge")).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal wechat_charge_debit = transactionsOfDay.stream().filter(t->t.getString("transaction_type").equals("Debit")).filter(t->t.containsKey("wechat_charge")).map(t-> t.getBigDecimal("wechat_charge")).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal royalpay_charge_credit = transactionsOfDay.stream().filter(t->t.getString("transaction_type").equals("Credit")).filter(t->t.containsKey("royal_surcharge")).map(t-> t.getBigDecimal("royal_surcharge")).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal royalpay_charge_debit = transactionsOfDay.stream().filter(t->t.getString("transaction_type").equals("Debit")).filter(t->t.containsKey("royal_surcharge")).map(t-> t.getBigDecimal("royal_surcharge")).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal tax_amount = tax_amount_credit.subtract(tax_amount_debit);
analysis.put("total_credit",total_credit.setScale(2,BigDecimal.ROUND_HALF_UP));
analysis.put("total_debit",total_debit.setScale(2,BigDecimal.ROUND_HALF_UP));
analysis.put("net_amount",net_amount_credit.subtract(net_amount_debit).setScale(2,BigDecimal.ROUND_HALF_UP));
analysis.put("tax_amount",tax_amount.setScale(2,BigDecimal.ROUND_HALF_UP));
analysis.put("total_charge",total_charge_credit.subtract(total_charge_debit).add(tax_amount).setScale(2,BigDecimal.ROUND_HALF_UP));
analysis.put("gross_amount",total_credit.subtract(total_debit).setScale(2,BigDecimal.ROUND_HALF_UP));
analysis.put("wechat_charge",wechat_charge_credit.subtract(wechat_charge_debit).setScale(2,BigDecimal.ROUND_HALF_UP));
analysis.put("royalpay_charge",royalpay_charge_credit.subtract(royalpay_charge_debit).setScale(2,BigDecimal.ROUND_HALF_UP));
dayAnalysisMap.put(entry.getKey(),analysis);
}
return dayAnalysisMap;
}
@Override
public void exportListClearingTransactions(int client_id, String clearingDetailId, JSONObject partner, HttpServletResponse resp) {
OutputStream ous = null;
@ -815,6 +884,17 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
PageList<JSONObject> logs = clearingDetailMapper.listReportsOfSettlementLogs(params,
new PageBounds(query.getPage(), query.getLimit(), Order.formString("report_date.desc")));
JSONObject result = PageListUtils.buildPageListResult(logs);
if (query.getPage()==1){
if (!logs.isEmpty() && logs.size()>0){
JSONObject sendMailLog = logSettleMailMapper.findByDate(logs.get(0).getDate("clearing_time"));
if (sendMailLog == null) {
result.put("padding",true);
}
if (sendMailLog!=null && sendMailLog.getIntValue("mail_status") != 1) {
result.put("padding",true);
}
}
}
return result;
}

@ -13,6 +13,7 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.text.ParseException;
import java.util.List;
import java.util.Map;
/**
* Created by davep on 2016-08-29.
@ -38,6 +39,12 @@ public class CleanLogClientController {
return cleanService.listClearingTransactions(client_id, clearingDetailId, partner);
}
@RequestMapping("/{client_id}/settlement_logs/{clearingDetailId}/analysis/{channel}")
public Map<String,JSONObject> channelAndDayOfAnalysis(@PathVariable int client_id, @PathVariable String clearingDetailId,
@PathVariable String channel, @ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject partner) {
return cleanService.channelAndDayOfAnalysis(client_id, clearingDetailId,channel,partner);
}
@PartnerMapping("/{client_id}/settlement_logs/{clearingDetailId}/export")
public void exportListClearingTransactions(@PathVariable int client_id, @PathVariable String clearingDetailId,
@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject partner, HttpServletResponse resp) {

@ -14,87 +14,39 @@
<div class="box-body">
<ul class="nav nav-pills">
<li ng-class="{active:ctrl.channel==null}">
<a role="button" ng-click="ctrl.channel=null" title="All">
<a role="button" ng-click="ctrl.channel=null;channelAndDayOfAnalysis()" title="All">
<img src="/static/images/royalpay_sign.png" class="channel-icon-lg">
</a>
</li>
<li ng-class="{active:ctrl.channel=='Wechat'}" ng-if="report.channels.Wechat">
<a role="button" ng-click="ctrl.channel='Wechat'" title="Wechat">
<a role="button" ng-click="ctrl.channel='Wechat';channelAndDayOfAnalysis()" title="Wechat">
<img src="/static/images/wechatpay_sign_lg.png" class="channel-icon-lg">
</a>
</li>
<li ng-class="{active:ctrl.channel=='Alipay'}" ng-if="report.channels.Alipay">
<a role="button" ng-click="ctrl.channel='Alipay'" title="Alipay">
<a role="button" ng-click="ctrl.channel='Alipay';channelAndDayOfAnalysis()" title="Alipay">
<img src="/static/images/alipay_sign_lg.png" class="channel-icon-lg">
</a>
</li>
<li ng-class="{active:ctrl.channel=='AlipayOnline'}" ng-if="report.channels.AlipayOnline">
<a role="button" ng-click="ctrl.channel='AlipayOnline'" title="AlipayOnline">
<a role="button" ng-click="ctrl.channel='AlipayOnline';channelAndDayOfAnalysis()" title="AlipayOnline">
<img src="/static/images/alipay_online.png" class="channel-icon-lg">
</a>
</li>
<li ng-class="{active:ctrl.channel=='Bestpay'}" ng-if="report.channels.Bestpay">
<a role="button" ng-click="ctrl.channel='Bestpay'" title="Bestpay">
<a role="button" ng-click="ctrl.channel='Bestpay';channelAndDayOfAnalysis()" title="Bestpay">
<img src="/static/images/bestpay_sign_lg.png" class="channel-icon-lg">
</a>
</li>
<li ng-class="{active:ctrl.channel=='jd'}" ng-if="report.channels.jd">
<a role="button" ng-click="ctrl.channel='jd'" title="JD">
<a role="button" ng-click="ctrl.channel='jd';channelAndDayOfAnalysis()" title="JD">
<img src="/static/images/jd_sign_lg.png" class="channel-icon-lg">
</a>
</li>
</ul>
</div>
</div>
<div class="box box-warning" ng-if="ctrl.channel==null">
<div class="box-header">Analysis</div>
<div class="box-body">
<div class="row">
<div class="col-xs-6 col-sm-3">
<span class="col-xs-6 text-bold">Rate</span>
<span class="col-xs-6" ng-bind="report.rate+'%'"></span>
</div>
<div class="col-xs-6 col-sm-3">
<span class="col-xs-6 text-bold">Total Credit</span>
<span class="col-xs-6" ng-bind="report.total_payment|currency:''"></span>
</div>
<div class="col-xs-6 col-sm-3">
<span class="col-xs-6 text-bold">Total Debit</span>
<span class="col-xs-6" ng-bind="report.total_refund|currency:''"></span>
</div>
<div class="col-xs-6 col-sm-3">
<span class="col-xs-6 text-bold">Gross Amount</span>
<span class="col-xs-6" ng-bind="report.gross_amount|currency:''"></span>
</div>
</div>
<div class="row">
<div class="col-xs-6 col-sm-3">
<span class="col-xs-6 text-bold">Total Charge</span>
<span class="col-xs-6" ng-bind="report.total_charge|currency:''"></span>
</div>
<div class="col-xs-6 col-sm-3">
<span class="col-xs-6 text-bold">Channel Charge</span>
<span class="col-xs-6" ng-bind="report.wechat_charge|currency:''"></span>
</div>
<div class="col-xs-6 col-sm-3">
<span class="col-xs-6 text-bold">RoyalPay Charge</span>
<span class="col-xs-6" ng-bind="report.royalpay_charge|currency:''"></span>
</div>
<div class="col-xs-6 col-sm-3">
<span class="col-xs-6 text-bold">Net Amount</span>
<span class="col-xs-6" ng-bind="report.clearing_amount|currency:''"></span>
</div>
</div>
<div class="row">
<div class="col-xs-6 col-sm-3">
<span class="col-xs-6 text-bold">Tax Amount</span>
<span class="col-xs-6" ng-bind="report.tax_amount|currency:''"></span>
</div>
</div>
</div>
</div>
<div class="box box-warning" ng-if="ctrl.channel!=null">
<!--<div class="box box-warning" ng-if="ctrl.channel!=null">
<div class="box-header">Analysis</div>
<div class="box-body">
<div class="row">
@ -141,6 +93,144 @@
</div>
</div>
</div>
</div>-->
<div class="box box-warning">
<uib-tabset active="index">
<uib-tab index="0" heading="Analysis" ng-click="ctrl.day=''">
<div class="box-body">
<div class="row">
<div class="col-xs-6 col-sm-3">
<span class="col-xs-6 text-bold">Rate</span>
<span ng-if="ctrl.channel==null"class="col-xs-6" ng-bind="report.rate+'%'"></span>
<span ng-if="ctrl.channel!=null" class="col-xs-6" ng-bind="report.channels[ctrl.channel].rate+'%'"></span>
</div>
<div class="col-xs-6 col-sm-3">
<span class="col-xs-6 text-bold">Total Credit</span>
<span ng-if="ctrl.channel==null" class="col-xs-6" ng-bind="report.total_payment|currency:''"></span>
<span ng-if="ctrl.channel!=null" class="col-xs-6" ng-bind="report.channels[ctrl.channel].total_credit|currency:''"></span>
</div>
<div class="col-xs-6 col-sm-3">
<span class="col-xs-6 text-bold">Total Debit</span>
<span ng-if="ctrl.channel==null" class="col-xs-6" ng-bind="report.total_refund|currency:''"></span>
<span ng-if="ctrl.channel!=null" class="col-xs-6" ng-bind="report.channels[ctrl.channel].total_debit|currency:''"></span>
</div>
<div class="col-xs-6 col-sm-3">
<span class="col-xs-6 text-bold">Gross Amount</span>
<span ng-if="ctrl.channel==null" class="col-xs-6" ng-bind="report.gross_amount|currency:''"></span>
<span ng-if="ctrl.channel!=null" class="col-xs-6" ng-bind="report.channels[ctrl.channel].gross_amount|currency:''"></span>
</div>
</div>
<div class="row">
<div class="col-xs-6 col-sm-3">
<span class="col-xs-6 text-bold">Total Charge</span>
<span ng-if="ctrl.channel==null" class="col-xs-6" ng-bind="report.total_charge|currency:''"></span>
<span ng-if="ctrl.channel!=null" class="col-xs-6" ng-bind="report.channels[ctrl.channel].total_charge|currency:''"></span>
</div>
<div class="col-xs-6 col-sm-3">
<span class="col-xs-6 text-bold">Channel Charge</span>
<span ng-if="ctrl.channel==null" class="col-xs-6" ng-bind="report.wechat_charge|currency:''"></span>
<span ng-if="ctrl.channel!=null" class="col-xs-6" ng-bind="report.channels[ctrl.channel].third_charge|currency:''"></span>
</div>
<div class="col-xs-6 col-sm-3">
<span class="col-xs-6 text-bold">RoyalPay Charge</span>
<span ng-if="ctrl.channel==null" class="col-xs-6" ng-bind="report.royalpay_charge|currency:''"></span>
<span ng-if="ctrl.channel!=null" class="col-xs-6" ng-bind="report.channels[ctrl.channel].royalpay_charge|currency:''"></span>
</div>
<div class="col-xs-6 col-sm-3">
<span class="col-xs-6 text-bold">Net Amount</span>
<span ng-if="ctrl.channel==null" class="col-xs-6" ng-bind="report.clearing_amount|currency:''"></span>
<span ng-if="ctrl.channel!=null" class="col-xs-6" ng-bind="report.channels[ctrl.channel].gross_amount-report.channels[ctrl.channel].total_charge|currency:''"></span>
</div>
</div>
<div class="row" ng-if="ctrl.channel==null">
<div class="col-xs-6 col-sm-3">
<span class="col-xs-6 text-bold">Tax Amount</span>
<span class="col-xs-6" ng-bind="report.tax_amount|currency:''"></span>
</div>
</div>
</div>
</uib-tab>
<!--<uib-tab heading="Analysis" ng-if="ctrl.channel!=null" ng-click="ctrl.day=''">
<div class="box-body">
<div class="row">
<div class="col-xs-6 col-sm-3">
<span class="col-xs-6 text-bold">Total Credit</span>
<span class="col-xs-6" ng-bind="report.channels[ctrl.channel].total_credit|currency:''"></span>
</div>
<div class="col-xs-6 col-sm-3">
<span class="col-xs-6 text-bold">Total Debit</span>
<span class="col-xs-6" ng-bind="report.channels[ctrl.channel].total_debit|currency:''"></span>
</div>
<div class="col-xs-6 col-sm-3">
<span class="col-xs-6 text-bold">Gross Amount</span>
<span class="col-xs-6" ng-bind="report.channels[ctrl.channel].gross_amount|currency:''"></span>
</div>
</div>
<div class="row">
<div class="col-xs-6 col-sm-3">
<span class="col-xs-6 text-bold">Total Charge</span>
<span class="col-xs-6" ng-bind="report.channels[ctrl.channel].total_charge|currency:''"></span>
</div>
<div class="col-xs-6 col-sm-3" ng-if="!is_partner">
<span class="col-xs-6 text-bold">Channel Charge</span>
<span class="col-xs-6" ng-bind="report.channels[ctrl.channel].third_charge|currency:''"></span>
</div>
<div class="col-xs-6 col-sm-3" ng-if="!is_partner">
<span class="col-xs-6 text-bold">RoyalPay Charge</span>
<span class="col-xs-6" ng-bind="report.channels[ctrl.channel].royalpay_charge|currency:''"></span>
</div>
<div class="col-xs-6 col-sm-3">
<span class="col-xs-6 text-bold">Net Amount</span>
<span class="col-xs-6"
ng-bind="report.channels[ctrl.channel].gross_amount-report.channels[ctrl.channel].total_charge|currency:''"></span>
</div>
</div>
</div>
</uib-tab>-->
<uib-tab ng-repeat="(key,analysis) in channelAndDayMap" heading="{{key}}" ng-click="ctrl.day=key" ng-if="show">
<div class="box-body" >
<div class="row">
<div class="col-xs-6 col-sm-3">
<span class="col-xs-6 text-bold">Total Credit</span>
<span class="col-xs-6" ng-bind="analysis.total_credit|currency:''"></span>
</div>
<div class="col-xs-6 col-sm-3">
<span class="col-xs-6 text-bold">Total Debit</span>
<span class="col-xs-6" ng-bind="analysis.total_debit|currency:''"></span>
</div>
<div class="col-xs-6 col-sm-3">
<span class="col-xs-6 text-bold">Gross Amount</span>
<span class="col-xs-6" ng-bind="analysis.gross_amount|currency:''"></span>
</div>
</div>
<div class="row">
<div class="col-xs-6 col-sm-3">
<span class="col-xs-6 text-bold">Total Charge</span>
<span class="col-xs-6" ng-bind="analysis.total_charge|currency:''"></span>
</div>
<div class="col-xs-6 col-sm-3" ng-if="!is_partner">
<span class="col-xs-6 text-bold">Channel Charge</span>
<span class="col-xs-6" ng-bind="analysis.wechat_charge|currency:''"></span>
</div>
<div class="col-xs-6 col-sm-3" ng-if="!is_partner">
<span class="col-xs-6 text-bold">RoyalPay Charge</span>
<span class="col-xs-6" ng-bind="analysis.royalpay_charge|currency:''"></span>
</div>
<div class="col-xs-6 col-sm-3">
<span class="col-xs-6 text-bold">Net Amount</span>
<span class="col-xs-6" ng-bind="analysis.net_amount|currency:''"></span>
</div>
<div class="col-xs-6 col-sm-3" ng-if="!ctrl.channel">
<span class="col-xs-6 text-bold">Tax Amount</span>
<span class="col-xs-6" ng-bind="analysis.tax_amount|currency:''"></span>
</div>
</div>
</div>
</uib-tab>
</uib-tabset>
</div>
<div class="box box-default">
<div class="box-header">Credits</div>
@ -162,7 +252,7 @@
</tr>
</thead>
<tbody>
<tr ng-repeat="tr in report.report|propsFilter:{transaction_type:'Credit',channel:ctrl.channel}:true">
<tr ng-repeat="tr in report.report|propsFilter:{transaction_type:'Credit',channel:ctrl.channel,transaction_time:ctrl.day}:true">
<td>
<img class="channel-icon" ng-src="{{tr.channel|channel_image}}">{{tr.order_id}}
</td>
@ -200,7 +290,7 @@
</tr>
</thead>
<tbody>
<tr ng-repeat="tr in report.report|propsFilter:{transaction_type:'Debit',channel:ctrl.channel}:true">
<tr ng-repeat="tr in report.report|propsFilter:{transaction_type:'Debit',channel:ctrl.channel,transaction_time:ctrl.day}:true">
<td>
<img class="channel-icon" ng-src="{{tr.channel|channel_image}}">{{tr.order_id}}
</td>

@ -4,7 +4,7 @@
define(['../app','decimal'], function (app,Decimal) {
'use strict';
app.factory('clearingDetailService', ['$uibModal', function ($uibModal) {
function openDetail(url, is_partner) {
function openDetail(url, is_partner,client_id,detailId) {
$uibModal.open({
templateUrl: '/static/payment/tradelog/templates/partner_settlement_dialog.html',
controller: 'clearingDetailCtrl',
@ -12,7 +12,9 @@ define(['../app','decimal'], function (app,Decimal) {
detail: ['$http', function ($http) {
return $http.get(url);
}],
is_partner: is_partner
is_partner: is_partner,
client_id:client_id,
detailId:detailId
},
size: 'lg'
})
@ -20,16 +22,26 @@ define(['../app','decimal'], function (app,Decimal) {
return {
clientClearingDetail: function (client_id, detailId, is_partner) {
openDetail('/client/clean_logs/' + client_id + '/settlement_logs/' + detailId, is_partner);
openDetail('/client/clean_logs/' + client_id + '/settlement_logs/' + detailId, is_partner,client_id,detailId);
}
}
}]);
app.controller('clearingDetailCtrl', ['$scope', 'detail', 'is_partner', function ($scope, detail, is_partner) {
$scope.ctrl = {channel: null};
app.controller('clearingDetailCtrl', ['$scope', 'detail', 'is_partner','client_id','detailId','$http', function ($scope, detail, is_partner,client_id,detailId,$http) {
$scope.ctrl = {channel: null,day:null};
$scope.report = detail.data;
$scope.report.total_charge = Decimal.add($scope.report.total_charge,$scope.report.tax_amount).toFixed(2);
angular.forEach($scope.report.channels,function (e) {
e.total_charge = Decimal.add(e.total_charge,e.tax_amount).toFixed(2);
});
$scope.is_partner = is_partner;
$scope.channelAndDayOfAnalysis = function () {
$http.get('/client/clean_logs/' + client_id + '/settlement_logs/' + detailId+'/analysis/'+$scope.ctrl.channel).then(function (resp) {
$scope.channelAndDayMap = resp.data;
$scope.index = 0;
})
}
$scope.channelAndDayOfAnalysis();
}]);
app.filter('channel_image', function () {
return function (channel) {

@ -2470,27 +2470,41 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
params.limit = 10;
$http.get('/sys/partners/' + clientMoniker + '/lists_settlements', {params: params}).then(function (resp) {
$scope.settlementLogs = resp.data.data;
$scope.padding = resp.data.padding;
$scope.pagination = resp.data.pagination;
});
};
$scope.getClearingTransactions = function (client_id, detail_id) {
$uibModal.open({
templateUrl: '/static/analysis/templates/settlement_transactions.html',
controller: 'managerClearingDetailCtrl',
controller: 'managerSettlementDetailCtrl',
resolve: {
detail: ['$http', '$stateParams', function ($http) {
return $http.get('/analysis/partner_card/' + client_id + '/settlement_logs/' + detail_id);
}]
}],
detail_id:detail_id
},
size: 'lg'
});
};
$scope.chooseLast7Days();
}]);
app.controller('managerClearingDetailCtrl', ['$scope', 'detail', function ($scope, detail) {
app.controller('managerSettlementDetailCtrl', ['$scope', 'detail','detail_id','$http', function ($scope, detail,detail_id,$http) {
$scope.ctrl = {channel: null};
$scope.show = true;
$scope.report = detail.data;
$scope.report.total_charge = Decimal.add($scope.report.total_charge,$scope.report.tax_amount).toFixed(2);
angular.forEach($scope.report.channels,function (e) {
e.total_charge = Decimal.add(e.tax_amount,e.total_charge).toFixed(2);
});
$scope.channelAndDayOfAnalysis = function () {
$http.get('/analysis/partner_card/settlement_logs/' + detail_id+'/analysis/'+$scope.ctrl.channel).then(function (resp) {
$scope.channelAndDayMap = resp.data;
$scope.index = 0;
})
};
$scope.channelAndDayOfAnalysis(1);
}]);
app.controller('productCtrl', ['$scope', '$http', '$uibModal', 'commonDialog', '$state', 'Upload', 'industryMap', function ($scope, $http, $uibModal, commonDialog, $state, Upload, industryMap) {

@ -76,7 +76,12 @@
</thead>
<tbody>
<tr ng-repeat="log in settlementLogs">
<td ng-bind="log.clearing_time|limitTo:10"></td>
<td>
{{log.clearing_time|limitTo:10}}
&nbsp;<span ng-if="$index==0&&padding" class="text-red">
<i class="glyphicon glyphicon-time" uib-tooltip="清算正在执行中,以最终结果为准"></i>
</span>
</td>
<td ng-bind="log.total"></td>
<td ng-bind="log.income"></td>
<td ng-bind="log.fee"></td>

@ -86,6 +86,7 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) {
$http.get('/client/trans_flow/settlement/log', {params: params}).then(function (resp) {
$scope.settlementLogs = resp.data.data;
$scope.pagination = resp.data.pagination;
$scope.padding = resp.data.padding;
$scope.analysis = resp.data.analysis;
});
};

@ -6,122 +6,172 @@
<div class="box-body">
<ul class="nav nav-pills">
<li ng-class="{active:ctrl.channel==null}">
<a role="button" ng-click="ctrl.channel=null" title="All">
<a role="button" ng-click="ctrl.channel=null;channelAndDayOfAnalysis()" title="All">
<img src="/static/images/royalpay_sign.png">
</a>
</li>
<li ng-class="{active:ctrl.channel=='Wechat'}" ng-if="report.channels.Wechat">
<a role="button" ng-click="ctrl.channel='Wechat'" title="Wechat">
<a role="button" ng-click="ctrl.channel='Wechat';channelAndDayOfAnalysis()" title="Wechat">
<img src="/static/images/wechatpay_sign_lg.png">
</a>
</li>
<li ng-class="{active:ctrl.channel=='Alipay'}" ng-if="report.channels.Alipay">
<a role="button" ng-click="ctrl.channel='Alipay'" title="Alipay">
<a role="button" ng-click="ctrl.channel='Alipay';channelAndDayOfAnalysis()" title="Alipay">
<img src="/static/images/alipay_sign_lg.png">
</a>
</li>
<li ng-class="{active:ctrl.channel=='AlipayOnline'}" ng-if="report.channels.AlipayOnline">
<a role="button" ng-click="ctrl.channel='AlipayOnline'" title="AlipayOnline">
<a role="button" ng-click="ctrl.channel='AlipayOnline';channelAndDayOfAnalysis()" title="AlipayOnline">
<img src="/static/images/alipay_online.png" class="channel-icon-lg">
</a>
</li>
<li ng-class="{active:ctrl.channel=='Bestpay'}" ng-if="report.channels.Bestpay">
<a role="button" ng-click="ctrl.channel='Bestpay'" title="Bestpay">
<a role="button" ng-click="ctrl.channel='Bestpay';channelAndDayOfAnalysis()" title="Bestpay">
<img src="/static/images/bestpay_sign_lg.png">
</a>
</li>
<li ng-class="{active:ctrl.channel=='jd'}" ng-if="report.channels.jd">
<a role="button" ng-click="ctrl.channel='jd'" title="JD Pay">
<a role="button" ng-click="ctrl.channel='jd';channelAndDayOfAnalysis()" title="JD Pay">
<img src="/static/images/jd_sign_lg.png">
</a>
</li>
</ul>
</div>
</div>
<div class="box box-warning" ng-if="ctrl.channel==null">
<div class="box-header">Analysis</div>
<div class="box-body">
<div class="row">
<!--<div class="col-xs-6 col-sm-3">-->
<!--<span class="col-xs-6 text-bold">Rate</span>-->
<!--<span class="col-xs-6" ng-bind="report.rate+'%'"></span>-->
<!--</div>-->
<div class="col-xs-6 col-sm-3">
<span class="col-xs-6 text-bold">Total Credit</span>
<span class="col-xs-6" ng-bind="report.total_payment|currency:''"></span>
</div>
<div class="col-xs-6 col-sm-3">
<span class="col-xs-6 text-bold">Total Debit</span>
<span class="col-xs-6" ng-bind="report.total_refund|currency:''"></span>
</div>
<div class="col-xs-6 col-sm-3">
<span class="col-xs-6 text-bold">Gross Amount</span>
<span class="col-xs-6" ng-bind="report.gross_amount|currency:''"></span>
</div>
<div class="box box-warning">
<uib-tabset active="index">
<uib-tab index="0" heading="Analysis" ng-click="ctrl.day=null">
<div class="box-body">
<div class="row">
<!--<div class="col-xs-6 col-sm-3">-->
<!--<span class="col-xs-6 text-bold">Rate</span>-->
<!--<span class="col-xs-6" ng-bind="report.rate+'%'"></span>-->
<!--</div>-->
<div class="col-xs-6 col-sm-3">
<span class="col-xs-6 text-bold">Total Credit</span>
<span ng-if="ctrl.channel==null" class="col-xs-6" ng-bind="report.total_payment|currency:''"></span>
<span ng-if="ctrl.channel!=null"class="col-xs-6" ng-bind="report.channels[ctrl.channel].total_credit|currency:''"></span>
</div>
<div class="col-xs-6 col-sm-3">
<span class="col-xs-6 text-bold">Total Debit</span>
<span ng-if="ctrl.channel==null" class="col-xs-6" ng-bind="report.total_refund|currency:''"></span>
<span ng-if="ctrl.channel!=null" class="col-xs-6" ng-bind="report.channels[ctrl.channel].total_debit|currency:''"></span>
</div>
<div class="col-xs-6 col-sm-3">
<span class="col-xs-6 text-bold">Gross Amount</span>
<span ng-if="ctrl.channel==null" class="col-xs-6" ng-bind="report.gross_amount|currency:''"></span>
<span ng-if="ctrl.channel!=null" class="col-xs-6" ng-bind="report.channels[ctrl.channel].gross_amount|currency:''"></span>
</div>
</div>
<div class="row">
<div class="col-xs-6 col-sm-3">
<span class="col-xs-6 text-bold">Total Charge</span>
<span class="col-xs-6" ng-bind="report.total_charge|currency:''"></span>
</div>
<div class="col-xs-6 col-sm-3" ng-if="!is_partner">
<span class="col-xs-6 text-bold">Channel Charge</span>
<span class="col-xs-6" ng-bind="report.wechat_charge|currency:''"></span>
</div>
<div class="col-xs-6 col-sm-3" ng-if="!is_partner">
<span class="col-xs-6 text-bold">RoyalPay Charge</span>
<span class="col-xs-6" ng-bind="report.royalpay_charge|currency:''"></span>
</div>
<div class="col-xs-6 col-sm-3">
<span class="col-xs-6 text-bold">Net Amount</span>
<span class="col-xs-6" ng-bind="report.clearing_amount|currency:''"></span>
</div>
<div class="col-xs-6 col-sm-3">
<span class="col-xs-6 text-bold">Tax Amount</span>
<span class="col-xs-6" ng-bind="report.tax_amount|currency:''"></span>
</div>
</div>
</div>
</div>
<div class="box box-warning" ng-if="ctrl.channel!=null">
<div class="box-header">Analysis</div>
<div class="box-body">
<div class="row">
<div class="col-xs-6 col-sm-3">
<span class="col-xs-6 text-bold">Total Credit</span>
<span class="col-xs-6" ng-bind="report.channels[ctrl.channel].total_credit|currency:''"></span>
</div>
<div class="col-xs-6 col-sm-3">
<span class="col-xs-6 text-bold">Total Debit</span>
<span class="col-xs-6" ng-bind="report.channels[ctrl.channel].total_debit|currency:''"></span>
</div>
<div class="col-xs-6 col-sm-3">
<span class="col-xs-6 text-bold">Gross Amount</span>
<span class="col-xs-6" ng-bind="report.channels[ctrl.channel].gross_amount|currency:''"></span>
</div>
<div class="row">
<div class="col-xs-6 col-sm-3">
<span class="col-xs-6 text-bold">Total Charge</span>
<span ng-if="ctrl.channel==null" class="col-xs-6" ng-bind="report.total_charge|currency:''"></span>
<span ng-if="ctrl.channel!=null" class="col-xs-6" ng-bind="report.channels[ctrl.channel].total_charge|currency:''"></span>
</div>
<div class="col-xs-6 col-sm-3" ng-if="!is_partner">
<span class="col-xs-6 text-bold">Channel Charge</span>
<span ng-if="ctrl.channel==null" class="col-xs-6" ng-bind="report.wechat_charge|currency:''"></span>
<span ng-if="ctrl.channel!=null" class="col-xs-6" ng-bind="report.channels[ctrl.channel].third_charge|currency:''"></span>
</div>
<div class="col-xs-6 col-sm-3" ng-if="!is_partner">
<span class="col-xs-6 text-bold">RoyalPay Charge</span>
<span ng-if="ctrl.channel==null" class="col-xs-6" ng-bind="report.royalpay_charge|currency:''"></span>
<span ng-if="ctrl.channel!=null" class="col-xs-6" ng-bind="report.channels[ctrl.channel].royalpay_charge|currency:''"></span>
</div>
<div class="col-xs-6 col-sm-3">
<span class="col-xs-6 text-bold">Net Amount</span>
<span ng-if="ctrl.channel==null" class="col-xs-6" ng-bind="report.clearing_amount|currency:''"></span>
<span ng-if="ctrl.channel!=null" class="col-xs-6"
ng-bind="report.channels[ctrl.channel].gross_amount-report.channels[ctrl.channel].total_charge|currency:''"></span>
</div>
<div class="col-xs-6 col-sm-3" ng-if="!ctrl.channel">
<span class="col-xs-6 text-bold">Tax Amount</span>
<span class="col-xs-6" ng-bind="report.tax_amount|currency:''"></span>
</div>
</div>
</div>
</uib-tab>
<!-- <uib-tab heading="Analysis" ng-if="ctrl.channel!=null" ng-click="ctrl.day=''">
<div class="box-body">
<div class="row">
<div class="col-xs-6 col-sm-3">
<span class="col-xs-6 text-bold">Total Credit</span>
<span class="col-xs-6" ng-bind="report.channels[ctrl.channel].total_credit|currency:''"></span>
</div>
<div class="col-xs-6 col-sm-3">
<span class="col-xs-6 text-bold">Total Debit</span>
<span class="col-xs-6" ng-bind="report.channels[ctrl.channel].total_debit|currency:''"></span>
</div>
<div class="col-xs-6 col-sm-3">
<span class="col-xs-6 text-bold">Gross Amount</span>
<span class="col-xs-6" ng-bind="report.channels[ctrl.channel].gross_amount|currency:''"></span>
</div>
</div>
<div class="row">
<div class="col-xs-6 col-sm-3">
<span class="col-xs-6 text-bold">Total Charge</span>
<span class="col-xs-6" ng-bind="report.channels[ctrl.channel].total_charge|currency:''"></span>
</div>
<div class="col-xs-6 col-sm-3" ng-if="!is_partner">
<span class="col-xs-6 text-bold">Channel Charge</span>
<span class="col-xs-6" ng-bind="report.channels[ctrl.channel].third_charge|currency:''"></span>
</div>
<div class="col-xs-6 col-sm-3" ng-if="!is_partner">
<span class="col-xs-6 text-bold">RoyalPay Charge</span>
<span class="col-xs-6" ng-bind="report.channels[ctrl.channel].royalpay_charge|currency:''"></span>
</div>
<div class="row">
<div class="col-xs-6 col-sm-3">
<span class="col-xs-6 text-bold">Total Charge</span>
<span class="col-xs-6" ng-bind="report.channels[ctrl.channel].total_charge|currency:''"></span>
</div>
<div class="col-xs-6 col-sm-3" ng-if="!is_partner">
<span class="col-xs-6 text-bold">Channel Charge</span>
<span class="col-xs-6" ng-bind="report.channels[ctrl.channel].third_charge|currency:''"></span>
</div>
<div class="col-xs-6 col-sm-3" ng-if="!is_partner">
<span class="col-xs-6 text-bold">RoyalPay Charge</span>
<span class="col-xs-6" ng-bind="report.channels[ctrl.channel].royalpay_charge|currency:''"></span>
</div>
<div class="col-xs-6 col-sm-3">
<span class="col-xs-6 text-bold">Net Amount</span>
<span class="col-xs-6"
ng-bind="report.channels[ctrl.channel].gross_amount-report.channels[ctrl.channel].total_charge|currency:''"></span>
</div>
</div>
</div>
<div class="col-xs-6 col-sm-3">
<span class="col-xs-6 text-bold">Net Amount</span>
<span class="col-xs-6"
ng-bind="report.channels[ctrl.channel].gross_amount-report.channels[ctrl.channel].total_charge|currency:''"></span>
</uib-tab>-->
<uib-tab ng-repeat="(key,analysis) in channelAndDayMap" heading="{{key}}" ng-click="ctrl.day=key">
<div class="box-body" >
<div class="row">
<div class="col-xs-6 col-sm-3">
<span class="col-xs-6 text-bold">Total Credit</span>
<span class="col-xs-6" ng-bind="analysis.total_credit|currency:''"></span>
</div>
<div class="col-xs-6 col-sm-3">
<span class="col-xs-6 text-bold">Total Debit</span>
<span class="col-xs-6" ng-bind="analysis.total_debit|currency:''"></span>
</div>
<div class="col-xs-6 col-sm-3">
<span class="col-xs-6 text-bold">Gross Amount</span>
<span class="col-xs-6" ng-bind="analysis.gross_amount|currency:''"></span>
</div>
</div>
<div class="row">
<div class="col-xs-6 col-sm-3">
<span class="col-xs-6 text-bold">Total Charge</span>
<span class="col-xs-6" ng-bind="analysis.total_charge|currency:''"></span>
</div>
<div class="col-xs-6 col-sm-3" ng-if="!is_partner">
<span class="col-xs-6 text-bold">Channel Charge</span>
<span class="col-xs-6" ng-bind="analysis.wechat_charge|currency:''"></span>
</div>
<div class="col-xs-6 col-sm-3" ng-if="!is_partner">
<span class="col-xs-6 text-bold">RoyalPay Charge</span>
<span class="col-xs-6" ng-bind="analysis.royalpay_charge|currency:''"></span>
</div>
<div class="col-xs-6 col-sm-3">
<span class="col-xs-6 text-bold">Net Amount</span>
<span class="col-xs-6" ng-bind="analysis.net_amount|currency:''"></span>
</div>
<div class="col-xs-6 col-sm-3" ng-if="!ctrl.channel">
<span class="col-xs-6 text-bold">Tax Amount</span>
<span class="col-xs-6" ng-bind="analysis.tax_amount|currency:''"></span>
</div>
</div>
</div>
</div>
</div>
</uib-tab>
</uib-tabset>
</div>
<div class="box box-default">
<div class="box-header">Credits</div>
@ -144,7 +194,7 @@
</tr>
</thead>
<tbody>
<tr ng-repeat="tr in report.report|propsFilter:{transaction_type:'Credit',channel:ctrl.channel}:true">
<tr ng-repeat="tr in report.report|propsFilter:{transaction_type:'Credit',channel:ctrl.channel,transaction_time:ctrl.day}:true">
<td>
<img class="channel-icon" ng-src="{{tr.channel|channel_image}}">{{tr.order_id}}
</td>
@ -180,7 +230,7 @@
</tr>
</thead>
<tbody>
<tr ng-repeat="tr in report.report|propsFilter:{transaction_type:'Debit',channel:ctrl.channel}:true">
<tr ng-repeat="tr in report.report|propsFilter:{transaction_type:'Debit',channel:ctrl.channel,transaction_time:ctrl.day}:true">
<td ng-bind="tr.order_id"></td>
<td ng-bind="tr.transaction_time"></td>
<td ng-bind="tr.transaction_currency"></td>

@ -120,7 +120,10 @@
</thead>
<tbody>
<tr ng-repeat="log in settlementLogs">
<td ng-bind="log.clearing_time|limitTo:10"></td>
<td>
{{log.clearing_time|limitTo:10}}
&nbsp;<span ng-if="$index==0&&padding" class="text-red"><i class="glyphicon glyphicon-time" uib-tooltip="清算正在执行中,以最终结果为准"></i></span>
</td>
<td ng-bind="log.total"></td>
<td ng-bind="log.income"></td>
<td ng-bind="log.fee"></td>

Loading…
Cancel
Save