wangning 7 years ago
parent 55c7a93439
commit 24510cf6e6

@ -28,4 +28,7 @@ public interface TaskManualSettleMapper {
@AutoSql(type = SqlType.UPDATE)
void update(JSONObject task);
List<JSONObject> getEveryLatestRecord();
}

@ -55,6 +55,8 @@ public interface TransactionMapper {
double getClientUnClearedAmount(@Param("client_id") int clientId);
List<JSONObject> getClientsUnClearedAmount(@Param("client_ids") List<Integer> client_ids);
JSONObject getClientAmountAnalysis(JSONObject params);
PageList<JSONObject> listPreRefundClients(PageBounds pagination);

@ -3,6 +3,7 @@ package au.com.royalpay.payment.manage.settlement.core;
import com.alibaba.fastjson.JSONObject;
import java.util.Date;
import java.util.List;
/**
* Create by yixian at 2018-03-20 17:42
@ -13,4 +14,5 @@ public interface ManualSettleSupport {
JSONObject findCurrentSettle(int clientId, boolean includingUnsettleData);
List<JSONObject> listWithClearInfo();
}

@ -11,16 +11,20 @@ import au.com.royalpay.payment.tools.locale.LocaleSupport;
import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider;
import au.com.royalpay.payment.tools.permission.enums.PartnerRole;
import au.com.royalpay.payment.tools.utils.CurrencyAmountUtils;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.apache.commons.lang3.time.DateUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
/**
* Create by yixian at 2018-03-20 17:44
*/
@ -96,4 +100,24 @@ public class ManualSettleSupportImpl implements ManualSettleSupport {
}
return todayTask;
}
@Override
public List<JSONObject> listWithClearInfo() {
List<JSONObject> manuals = taskManualSettleMapper.getEveryLatestRecord();
List<Integer> client_ids = new ArrayList<>(manuals.size());
manuals.parallelStream().forEach(p->{
client_ids.add(p.getInteger("client_id"));
});
List<JSONObject> clientUnsettle = transactionMapper.getClientsUnClearedAmount(client_ids);
for (JSONObject manual : manuals) {
for (JSONObject settle : clientUnsettle) {
if (manual.getIntValue("client_id") == settle.getIntValue("client_id")) {
manual.put("unsettle", settle.getBigDecimal("clearing_amount"));
break;
}
}
}
return manuals;
}
}

@ -1,6 +1,7 @@
package au.com.royalpay.payment.manage.system.web;
import au.com.royalpay.payment.manage.permission.manager.ManagerMapping;
import au.com.royalpay.payment.manage.settlement.core.ManualSettleSupport;
import au.com.royalpay.payment.manage.system.core.ClientContractService;
import com.alibaba.fastjson.JSONObject;
@ -14,13 +15,24 @@ import java.util.List;
import javax.annotation.Resource;
@RestController
@RequestMapping(value = "/manage/contract")
@RequestMapping(value = "/manage/common/analysis")
public class contractController {
@Resource
private ClientContractService clientContractService;
@Resource
private ManualSettleSupport manualSettleSupport;
@ManagerMapping(value = "/list",method = RequestMethod.GET)
public List<JSONObject> list(){
@ManagerMapping(value = "/contract/list", method = RequestMethod.GET)
public List<JSONObject> contractList() {
return clientContractService.list();
}
@RequestMapping(value = "/manualSettle/list", method = RequestMethod.GET)
public List<JSONObject> manualList() {
List<JSONObject> asd = manualSettleSupport.listWithClearInfo();
System.out.println(asd);
System.out.println(asd);
System.out.println(asd);
return manualSettleSupport.listWithClearInfo();
}
}

@ -0,0 +1,12 @@
<?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.payment.TaskManualSettleMapper">
<select id="getEveryLatestRecord" resultType="com.alibaba.fastjson.JSONObject">
SELECT
s.request_time,s.client_id,c.client_moniker
FROM
task_client_manual_settle s
left join sys_clients c on s.client_id = c.client_id
where s.request_time=(select max(B.request_time) from task_client_manual_settle B where s.client_id =B.client_id)
</select>
</mapper>

@ -173,6 +173,16 @@
WHERE clearing_status = 0 AND client_id = #{client_id}
</select>
<select id="getClientsUnClearedAmount" resultType="com.alibaba.fastjson.JSONObject">
SELECT ifnull(sum(if(transaction_type = 'Credit', clearing_amount, -clearing_amount)), 0) clearing_amount,client_id
FROM pmt_transactions
where clearing_status = 0 AND
client_id in
<foreach collection="client_ids" open="(" close=")" separator="," item="item">
#{item}
</foreach>
group by client_id
</select>
<select id="getClientAmountAnalysis" resultType="com.alibaba.fastjson.JSONObject">
<![CDATA[
SELECT

@ -1,5 +1,5 @@
/**
* Created by yishuqian on 01/06/2017.
* Created by kira on 01/06/2017.
*/
define(['angular'], function (angular) {
'use strict';
@ -13,11 +13,15 @@ define(['angular'], function (angular) {
url: '/rate_warnings',
templateUrl: '/static/analysis/templates/settle_warnings.html',
controller: 'settleWarningsCtrl'
}).state('manual_settle', {
url: '/manual_settle',
templateUrl: '/static/analysis/templates/manual_settle.html',
controller: 'manualSettleCtrl'
})
}]);
app.controller('contractAnalysisCtrl', ['$scope', '$http', '$state', '$filter', 'commonDialog', function ($scope, $http, $state, $filter, commonDialog) {
$scope.getContractAnalysis = function () {
$http.get('/manage/contract/list').then(function (resp) {
$http.get('/manage/common/analysis/contract/list').then(function (resp) {
$scope.contract_analysis = resp.data;
});
};
@ -50,5 +54,15 @@ define(['angular'], function (angular) {
}
}]);
app.controller('manualSettleCtrl', ['$scope', '$http', function ($scope, $http) {
$scope.getContractAnalysis = function () {
$http.get('/manage/common/analysis/manualSettle/list').then(function (resp) {
$scope.contract_analysis = resp.data;
});
};
$scope.getContractAnalysis();
}]);
return app;
});

@ -4,9 +4,12 @@
<li ui-sref-active-eq="active" class="active">
<a ui-sref="contract">Contract</a>
</li>
<li ui-sref-active="active">
<li ui-sref-active-eq="active" class="active">
<a ui-sref="rate_warnings">Rate Warings</a>
</li>
<li ui-sref-active-eq="active" class="active">
<a ui-sref="manual_settle">Manual Settle</a>
</li>
</ul>
<div class="modal-body">
<div class="box box-danger">

@ -0,0 +1,38 @@
<div class="modal-header">Contract</div>
<ul class="nav nav-tabs">
<li ui-sref-active-eq="active" class="active">
<a ui-sref="contract">Contract</a>
</li>
<li ui-sref-active-eq="active" class="active">
<a ui-sref="rate_warnings">Rate Warings</a>
</li>
<li ui-sref-active-eq="active" class="active">
<a ui-sref="manual_settle">Manual Settle</a>
</li>
</ul>
<div class="modal-body">
<div class="box box-danger">
<div class="box-header">商户</div>
<div class="box-body table-responsive">
<table class="table table-bordered table-striped table-hover">
<thead>
<tr>
<th>Client Moniker</th>
<th>Unsettled</th>
<th>Latest Record</th>
<th>Record Time</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="contract in manual_settle_analysis">
<td ng-bind="contract.client_moniker"></td>
<td ng-bind="contract.unsettle"></td>
<td ng-bind="contract.latest_clearing"></td>
<td ng-bind="contract.latest_clearing_time|date:'dd/MMM/yyyy'"></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
Loading…
Cancel
Save