settlement fix

master
james.zhao 6 years ago
parent 03720651b8
commit c6f1a1aa54

@ -171,7 +171,7 @@ public interface TransactionMapper {
JSONObject getClearDetailTotal(JSONObject params);
List<JSONObject> getSettlementLogDetailList(@Param("clientOrders") List<Integer> clientOrders, @Param("client_id") int clientId);
List<JSONObject> getSettlementLogDetailList(@Param("clientOrders") List<Integer> clientOrders);
List<JSONObject> getClientOrderByTransactionTime(JSONObject params);

@ -19,10 +19,7 @@ import au.com.royalpay.payment.manage.mappers.payment.OrderMapper;
import au.com.royalpay.payment.manage.mappers.payment.RefundAuditionMapper;
import au.com.royalpay.payment.manage.mappers.payment.RefundMapper;
import au.com.royalpay.payment.manage.mappers.payment.TransactionMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientAccountMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientDeviceMapper;
import au.com.royalpay.payment.manage.mappers.system.CustomerMapper;
import au.com.royalpay.payment.manage.mappers.system.ManagerCustomerRelationAlipayMapper;
import au.com.royalpay.payment.manage.mappers.system.*;
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.manage.organizations.core.OrgManager;
import au.com.royalpay.payment.manage.tradelog.beans.PreRefundQueryBean;
@ -1208,18 +1205,16 @@ public class TradeLogServiceImpl implements TradeLogService {
@Override
public void exportSettlementLog(TradeLogQuery query, JSONObject partner, HttpServletResponse resp) {
int client_id = partner.getIntValue("client_id");
String begin = query.getDatefrom() == null ?"":query.getDatefrom();
String end = query.getDateto() == null ?"":query.getDateto();
String timezone = partner.getJSONObject("client").getString("timezone");
JSONObject params = query.toParams(timezone);
params.put("client_id", client_id);
List<JSONObject> clientOrderList = transactionMapper.getClientOrderByTransactionTime(params);
List<Integer> clientOrders = new ArrayList<>(clientOrderList.size());
clientOrderList.parallelStream().forEach(p->{
clientOrders.add(p.getInteger("clearing_order"));
});
List<JSONObject> settlementLogDetailList = transactionMapper.getSettlementLogDetailList(clientOrders, client_id);
List<JSONObject> settlementLogDetailList = transactionMapper.getSettlementLogDetailList(clientOrders);
OutputStream ous = null;
try {
JSONObject clearDetailTotal = transactionMapper.getClearDetailTotal(params);
@ -1288,7 +1283,7 @@ public class TradeLogServiceImpl implements TradeLogService {
row.createCell(0, Cell.CELL_TYPE_STRING).setCellValue(clearDetailTotal.getString("total_payment"));
row.createCell(1, Cell.CELL_TYPE_STRING).setCellValue(clearDetailTotal.getString("total_refund"));
row.createCell(2, Cell.CELL_TYPE_STRING).setCellValue(clearDetailTotal.getString("gross_amount"));
row.createCell(3, Cell.CELL_TYPE_STRING).setCellValue(clearDetailTotal.getString("total_charge"));
row.createCell(3, Cell.CELL_TYPE_STRING).setCellValue(clearDetailTotal.getBigDecimal("total_charge").add(clearDetailTotal.getBigDecimal("tax_amount")).toPlainString());
row.createCell(4, Cell.CELL_TYPE_STRING).setCellValue(clearDetailTotal.getString("clearing_amount"));
wb.write(ous);
@ -1302,19 +1297,17 @@ public class TradeLogServiceImpl implements TradeLogService {
@Override
public void exportPDFSettlement(TradeLogQuery query, JSONObject partner, HttpServletResponse response) {
int client_id = partner.getIntValue("client_id");
String begin = query.getDatefrom() == null ?"":query.getDatefrom();
String end = query.getDateto() == null ?"":query.getDateto();
JSONObject client = partner.getJSONObject("client");
String timezone = client.getString("timezone");
JSONObject params = query.toParams(timezone);
params.put("client_id", client_id);
List<JSONObject> clientOrderList = transactionMapper.getClientOrderByTransactionTime(params);
List<Integer> clientOrders = new ArrayList<>(clientOrderList.size());
clientOrderList.parallelStream().forEach(p->{
clientOrders.add(p.getInteger("clearing_order"));
});
List<JSONObject> settlementLogDetailList = transactionMapper.getSettlementLogDetailList(clientOrders, client_id);
List<JSONObject> settlementLogDetailList = transactionMapper.getSettlementLogDetailList(clientOrders);
TimeZoneUtils.switchTimeZoneToString(settlementLogDetailList, timezone, "yyyy-MM-dd HH:mm:ss", Arrays.asList("transaction_time"));
try {

@ -1053,7 +1053,8 @@
sum(total_refund) total_refund,
sum(gross_amount) gross_amount,
SUM(clearing_amount) clearing_amount,
sum(total_charge) total_charge
sum(total_charge) total_charge,
sum(tax_amount) tax_amount
from (
SELECT
t.client_id,
@ -1061,13 +1062,18 @@
total_refund,
gross_amount,
cd.clearing_amount,
total_charge
total_charge,
cd.tax_amount
FROM
pmt_transactions t
LEFT JOIN log_clearing_detail cd ON cd.clear_detail_id = t.clearing_order
WHERE
t.channel = 'Settlement' and t.client_id=#{client_id}
t.channel = 'Settlement'
]]>
AND t.client_id IN
<foreach collection="client_ids" open="(" close=")" separator="," item="clientId">
#{clientId}
</foreach>
<if test="from!=null">and t.transaction_time &gt;= #{from}</if>
<if test="to!=null">and t.transaction_time &lt; #{to}</if>
GROUP BY
@ -1091,7 +1097,7 @@
LEFT JOIN pmt_refunds r ON r.refund_id = t.refund_id
LEFT JOIN log_clearing_detail_analysis a ON a.clearing_detail_id = t.clearing_order
AND t.channel = a.channel
WHERE t.channel != 'Settlement' AND t.client_id = #{client_id}
WHERE t.channel != 'Settlement'
]]>
<if test="clientOrders!=null">
AND t.clearing_order IN
@ -1103,11 +1109,13 @@
</select>
<select id="getClientOrderByTransactionTime" resultType="com.alibaba.fastjson.JSONObject">
<![CDATA[
SELECT t.clearing_order
FROM pmt_transactions t
WHERE t.channel='Settlement' AND client_id = #{client_id}
]]>
WHERE t.channel='Settlement'
AND t.client_id IN
<foreach collection="client_ids" open="(" close=")" separator="," item="clientId">
#{clientId}
</foreach>
<if test="from!=null">and t.transaction_time &gt;= #{from}</if>
<if test="to!=null">and t.transaction_time &lt; #{to}</if>
</select>

@ -88,6 +88,29 @@
</div>
</div>
<div class="form-group"
ng-class="{'has-error':rate_form.bestpay_rate_value.$invalid && rate_form.bestpay_rate_value.$dirty}">
<label class="control-label col-sm-4" for="bestpay_rate_value_input">Bestpay Rate Value</label>
<div class="col-sm-6">
<div class="input-group">
<input type="number" name="bestpay_rate_value" stringToNumber2 class="form-control" ng-model="rate.bestpay_rate_value"
min="0.6" max="2.2" step="0.1" id="bestpay_rate_value_input" required>
<div class="input-group-addon">%</div>
</div>
<div ng-messages="rate_form.bestpay_rate_value.$error" ng-if="rate_form.bestpay_rate_value.$dirty">
<div class="small text-danger" ng-message="max">
<i class="glyphicon glyphicon-alert"></i> No more than 2.2%
</div>
<div class="small text-danger" ng-message="min">
<i class="glyphicon glyphicon-alert"></i> No less than 0.6%
</div>
<div class="small text-danger" ng-message="required">
<i class="glyphicon glyphicon-alert"></i> Required Field
</div>
</div>
</div>
</div>
<div class="form-group"
ng-class="{'has-error':rate_form.jd_rate_value.$invalid && rate_form.jd_rate_value.$dirty}">
<label class="control-label col-sm-4" for="jd_rate_value_input">JD Rate Value</label>
@ -97,7 +120,7 @@
min="0.6" max="2.2" step="0.1" id="jd_rate_value_input" required>
<div class="input-group-addon">%</div>
</div>
<div ng-messages="rate_form.bestpay_rate_value.$error" ng-if="rate_form.jd_rate_value.$dirty">
<div ng-messages="rate_form.jd_rate_value.$error" ng-if="rate_form.jd_rate_value.$dirty">
<div class="small text-danger" ng-message="max">
<i class="glyphicon glyphicon-alert"></i> No more than 2.2%
</div>

@ -108,6 +108,13 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) {
params.dateto = $filter('date')(params.dateto, 'yyyyMMdd');
url += connectSymbol + 'dateto=' + params.dateto;
}
if (params.client_ids){
params.client_ids.forEach(function (i) {
url += connectSymbol + 'client_ids=' + i;
connectSymbol = '&';
});
}
return url;
};
@ -136,4 +143,4 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) {
}
}]);
return app;
});
});

Loading…
Cancel
Save