commit
a8a4ee8af5
@ -0,0 +1,9 @@
|
|||||||
|
package au.com.royalpay.payment.manage.dev.core;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
|
||||||
|
public interface HfClearAmountService {
|
||||||
|
|
||||||
|
JSONObject hfjsonobject(String dateto,String datefrom);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,55 @@
|
|||||||
|
package au.com.royalpay.payment.manage.dev.core.impl;
|
||||||
|
|
||||||
|
import au.com.royalpay.payment.manage.dev.core.HfClearAmountService;
|
||||||
|
import au.com.royalpay.payment.manage.mappers.payment.TransactionMapper;
|
||||||
|
import au.com.royalpay.payment.tools.env.PlatformEnvironment;
|
||||||
|
import au.com.royalpay.payment.tools.exceptions.ServerErrorException;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import org.apache.commons.lang3.time.DateUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.text.ParseException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class HfClearAmountServiceImpl implements HfClearAmountService {
|
||||||
|
@Resource
|
||||||
|
private TransactionMapper transactionMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JSONObject hfjsonobject(String dateto, String datefrom) {
|
||||||
|
JSONObject params = new JSONObject();
|
||||||
|
try {
|
||||||
|
params.put("datefrom", DateUtils.addMinutes(DateUtils.parseDate(datefrom), PlatformEnvironment.getEnv().getTimeZoneOffsetMinutes()));
|
||||||
|
params.put("dateto", DateUtils.addMinutes(DateUtils.parseDate(dateto), PlatformEnvironment.getEnv().getTimeZoneOffsetMinutes()));
|
||||||
|
} catch (ParseException e) {
|
||||||
|
throw new ServerErrorException("时间转换异常");
|
||||||
|
}
|
||||||
|
List<JSONObject> hfClearAmountResult = transactionMapper.getHfClearAmount(params);
|
||||||
|
JSONObject result = new JSONObject();
|
||||||
|
result.put("payment_amount", BigDecimal.ZERO);
|
||||||
|
result.put("refund_amount", BigDecimal.ZERO);
|
||||||
|
result.put("gross_amount", BigDecimal.ZERO);
|
||||||
|
result.put("charge_amount", BigDecimal.ZERO);
|
||||||
|
result.put("clear_amount", BigDecimal.ZERO);
|
||||||
|
if (hfClearAmountResult.isEmpty()) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
hfClearAmountResult.forEach(dbResult -> {
|
||||||
|
if ("Credit".equals(dbResult.getString("transaction_type"))) {
|
||||||
|
result.put("payment_amount", dbResult.getBigDecimal("clear_amount"));
|
||||||
|
result.put("payment_surcharge", dbResult.getBigDecimal("charge_amount"));
|
||||||
|
}
|
||||||
|
if ("Debit".equals(dbResult.getString("transaction_type"))) {
|
||||||
|
result.put("refund_amount", dbResult.getBigDecimal("clear_amount"));
|
||||||
|
result.put("refund_surcharge", dbResult.getBigDecimal("charge_amount"));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
result.put("gross_amount", result.getBigDecimal("payment_amount").subtract(result.getBigDecimal("refund_amount")));
|
||||||
|
result.put("real_charge", result.getBigDecimal("payment_surcharge").subtract(result.getBigDecimal("refund_surcharge")));
|
||||||
|
result.put("clear_amount", result.getBigDecimal("gross_amount").subtract(result.getBigDecimal("real_charge")));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,44 @@
|
|||||||
|
<section class="content-header">
|
||||||
|
<h1>HF清算金额统计</h1>
|
||||||
|
<ol class="breadcrumb">
|
||||||
|
<li>
|
||||||
|
<i class="fa fa-cog"></i> Basic Config
|
||||||
|
</li>
|
||||||
|
<li><a ui-sref="^">Dev Tools</a></li>
|
||||||
|
<li class="active">hfClearAmount</li>
|
||||||
|
</ol>
|
||||||
|
</section>
|
||||||
|
<section class="content">
|
||||||
|
<div class="box">
|
||||||
|
<div class="box-body">
|
||||||
|
<div style="display: inline-block">
|
||||||
|
<input class="form-control" id="date-from-input"
|
||||||
|
ng-model="params.datefrom"
|
||||||
|
uib-datepicker-popup size="10" placeholder="From"
|
||||||
|
is-open="dateBegin.open" ng-click="dateBegin.open=true"
|
||||||
|
datepicker-options="{maxDate:params.dateto||today}">
|
||||||
|
</div>
|
||||||
|
~
|
||||||
|
<div style="display: inline-block">
|
||||||
|
<input class="form-control" id="date-to-input"
|
||||||
|
ng-model="params.dateto"
|
||||||
|
uib-datepicker-popup size="10" placeholder="To"
|
||||||
|
is-open="dateTo.open" ng-click="dateTo.open=true"
|
||||||
|
datepicker-options="{minDate:params.datefrom,maxDate:today}">
|
||||||
|
</div>   
|
||||||
|
<button class="btn btn-primary" ng-click="select()">Select</button> <label ng-hide="selecttotal" style="padding-left: 30px">请稍后</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div style="padding-left: 3%;padding-top: 2%" ng-hide="totalhide">
|
||||||
|
<label>付款金额:</label>
|
||||||
|
<label><u>{{hfClearResult.payment_amount}}</u></label> <br>
|
||||||
|
<label> 退款金额:</label>
|
||||||
|
<label><u>{{hfClearResult.refund_amount}}</u></label><br>
|
||||||
|
<label>实际交易金额:</label>
|
||||||
|
<label><u>{{hfClearResult.gross_amount}}</u></label><br>
|
||||||
|
<label>手续费:</label>
|
||||||
|
<label><u>{{hfClearResult.charge_amount}}</u></label><br>
|
||||||
|
<label>应转款金额:</label>
|
||||||
|
<label><u>{{hfClearResult.clear_amount}}</u></label>
|
||||||
|
</div>
|
||||||
|
</section>
|
Loading…
Reference in new issue