add hf clearingAmount select

master
luoyang 6 years ago
parent 91a89dcc51
commit 6acf488ce6

@ -10,6 +10,4 @@ import java.io.IOException;
public interface AliforexcelService {
JSONObject listClients(HttpServletResponse httpResponse,JSONObject manager, AliExcel query);
}

@ -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,52 @@
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 com.alibaba.fastjson.JSONObject;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.List;
@Service
public class HfClearAmountServiceImpl implements HfClearAmountService{
private final DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:MM:ss");
@Resource
private TransactionMapper transactionMapper;
@Override
public JSONObject hfjsonobject(String dateto,String datefrom) {
JSONObject hfAmountInfo = new JSONObject();
JSONObject parms = new JSONObject();
parms.put("dateto", dateto + " 02:00:00");
parms.put("datefrom", datefrom + " 02:00:00");
List<JSONObject> hflist = transactionMapper.getHfClearAmount(parms);
Double payallAmount = 0.0;
Double refundAllAmount = 0.0;
Double paySurAmount = 0.0;
Double refundSurAllAmount = 0.0;
if (hflist.isEmpty()) {
hfAmountInfo.put("PayAmount", 0);
hfAmountInfo.put("RefundAmount", 0);
}
for(JSONObject hfAmount : hflist){
if ("Credit".equals(hfAmount.getString("transaction_type"))) {
hfAmountInfo.put("PayAmount",hfAmount.getBigDecimal("clearingamount").setScale(4, BigDecimal.ROUND_HALF_UP).doubleValue());
payallAmount = hfAmount.getDouble("clearingamount");
paySurAmount = hfAmount.getDouble("suramount");
}
if ("Debit".equals(hfAmount.getString("transaction_type"))) {
hfAmountInfo.put("RefundAmount",hfAmount.getBigDecimal("clearingamount").setScale(4, BigDecimal.ROUND_HALF_UP).doubleValue());
refundAllAmount = hfAmount.getDouble("clearingamount");
refundSurAllAmount = hfAmount.getDouble("suramount");
}
}
hfAmountInfo.put("realAmount", new BigDecimal(payallAmount - refundAllAmount).setScale(4,BigDecimal.ROUND_HALF_UP).doubleValue());
hfAmountInfo.put("surAmount", new BigDecimal(paySurAmount - refundSurAllAmount).setScale(4,BigDecimal.ROUND_HALF_UP).doubleValue());
hfAmountInfo.put("hfAmount", new BigDecimal(((payallAmount - refundAllAmount) - (paySurAmount - refundSurAllAmount))).setScale(4,BigDecimal.ROUND_HALF_UP).doubleValue());
return hfAmountInfo;
}
}

@ -14,6 +14,7 @@ import au.com.royalpay.payment.manage.dev.bean.AliExcel;
import au.com.royalpay.payment.manage.dev.bean.Message;
import au.com.royalpay.payment.manage.dev.bean.SendWechatMessage;
import au.com.royalpay.payment.manage.dev.core.AliforexcelService;
import au.com.royalpay.payment.manage.dev.core.HfClearAmountService;
import au.com.royalpay.payment.manage.dev.core.NewpartnerService;
import au.com.royalpay.payment.manage.dev.core.WechatMessageService;
import au.com.royalpay.payment.manage.mappers.customers.CustomerEncourageMoneyUseLogMapper;
@ -107,6 +108,8 @@ public class TestController implements ApplicationEventPublisherAware {
private NewpartnerService newpartnerService;
@Resource
private AliforexcelService aliforexcelService;
@Resource
private HfClearAmountService hfClearAmountService;
@ManagerMapping(value = "/{clientMoniker}/export/agreepdf", method = RequestMethod.GET, role = {ManagerRole.ADMIN, ManagerRole.DIRECTOR, ManagerRole.OPERATOR})
public void exportAgreeFile(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, HttpServletResponse httpResponse) throws Exception {
@ -389,4 +392,9 @@ public class TestController implements ApplicationEventPublisherAware {
public void aliforexcel(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, HttpServletResponse httpResponse, AliExcel query) throws Exception {
aliforexcelService.listClients(httpResponse,manager,query);
}
@ManagerMapping(value = "/hfClearAmount", method = RequestMethod.GET, role = ManagerRole.DEVELOPER)
public JSONObject hfClearAmount(@RequestParam String datefrom, @RequestParam String dateto) {
return hfClearAmountService.hfjsonobject(dateto,datefrom);
}
}

@ -140,4 +140,6 @@ public interface TransactionMapper {
void deleteSettlementTransaction(@Param("clearing_id") int clearingId);
void removeSettleRemark(@Param("clearing_id") int clearingId);
List<JSONObject> getHfClearAmount(JSONObject parms);
}

@ -858,4 +858,11 @@ select sum(if(temp.transaction_type='Credit',temp.clearing_amount*d.proportion,
ORDER BY trans_date DESC
</select>
<select id="getHfClearAmount" resultType="com.alibaba.fastjson.JSONObject">
SELECT sum(clearing_amount) as ClearingAmount,sum(channel_surcharge) as SurAmount,transaction_type FROM pmt_transactions where channel='hf'
AND transaction_time >= #{datefrom}
AND transaction_time &lt;= #{dateto}
GROUP BY transaction_type
</select>
</mapper>

@ -55,6 +55,10 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
url: '/aliforexcel',
templateUrl: '/static/config/devtools/templates/aliforexcel.html',
controller: 'aliforexcelCtrl'
}).state('devtools.hfClearAmount', {
url: '/hfClearAmount',
templateUrl: '/static/config/devtools/templates/hfClearAmount.html',
controller: 'hfClearAmountCtrl'
})
}]);
app.controller('devManualRefundCtrl', ['$scope', '$http', 'commonDialog', function ($scope, $http, commonDialog) {
@ -338,6 +342,31 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
}]);
app.controller('hfClearAmountCtrl', ['$scope', '$http','$filter', function ($scope, $http,$filter) {
$scope.params = {};
$scope.totalhide = true;
$scope.selecttotal = true;
$scope.select = function () {
$scope.totalhide = true;
$scope.selecttotal = false;
var params = angular.copy($scope.params);
params.datefrom = $filter('date')(params.datefrom, 'yyyy-MM-dd');
params.dateto = $filter('date')(params.dateto, 'yyyy-MM-dd');
$http.get('/dev/hfClearAmount',{params:params}).then(function (resp) {
$scope.totalhide = false;
$scope.selecttotal = true;
$scope.PayAmount = resp.data.PayAmount;
$scope.RefundAmount = resp.data.RefundAmount;
$scope.hfAmount = resp.data.hfAmount;
$scope.realAmount = resp.data.realAmount;
$scope.surAmount = resp.data.surAmount;
}, function (resp) {
alert(resp.data.message);
})
}
}]);
return app;
});

@ -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>&nbsp&nbsp&nbsp
<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>{{PayAmount}}</u></label> <br>
<label> 退款金额:</label>
<label><u>{{RefundAmount}}</u></label><br>
<label>实际交易金额:</label>
<label><u>{{realAmount}}</u></label><br>
<label>手续费:</label>
<label><u>{{surAmount}}</u></label><br>
<label>应转款金额:</label>
<label><u>{{hfAmount}}</u></label>
</div>
</section>

@ -75,6 +75,10 @@
<i class="fa fa-envelope"></i>
支付宝进件导出
</a>
<a class="btn btn-app" role="button" ui-sref=".hfClearAmount">
<i class="fa fa-credit-card-alt"></i>
HF清算金额统计
</a>
</div>
</div>
</section>

Loading…
Cancel
Save