Merge branch 'develop'

master
taylor.dang 6 years ago
commit a8a4ee8af5

@ -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,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;
}
}

@ -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 params);
}

@ -858,4 +858,14 @@ 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) clear_amount,
sum(channel_surcharge) charge_amount ,
transaction_type
FROM pmt_transactions where channel='hf'
AND transaction_time >= #{datefrom}
AND transaction_time &lt;= #{dateto}
GROUP BY transaction_type
</select>
</mapper>

@ -55,7 +55,11 @@ 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) {
$scope.sendRefund = function () {
@ -338,6 +342,27 @@ 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.hfClearResult =resp.data;
$scope.totalhide = false;
$scope.selecttotal = true;
}, 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>{{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>

@ -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>

@ -23,20 +23,20 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS
// 前端渲染的end索引
$scope.endIndexMap = {};
// 初始化索引是60
const initEndIndex = 60;
// 初始化索引是30
$scope.initEndIndex = 30;
$scope.loadClient = function () {
$http.get('/sys/merchant_id').then(function (resp) {
$scope.clientsMap = resp.data;
$scope.client_loading = false;
// 加入对应项的end索引值
// 如果数据小于60,索引值为数据长度
// 否则设置为60
// 如果数据小于initEndIndex,索引值为数据长度
// 否则设置为initEndIndex
for (var key in $scope.clientsMap) {
$scope.endIndexMap[key] = initEndIndex;
$scope.endIndexMap[key] = $scope.initEndIndex;
var length = $scope.clientsMap[key].length;
if (length <= initEndIndex)
if (length <= $scope.initEndIndex)
$scope.endIndexMap[key] = length;
}
@ -46,12 +46,12 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS
/**
* 点击更多加载
* 判断加60后的索引是否超出数组长度
* 判断加initEndIndex后的索引是否超出数组长度
* @param key
*/
$scope.more = function(key) {
var endIndex = $scope.endIndexMap[key] + initEndIndex;
var endIndex = $scope.endIndexMap[key] + $scope.initEndIndex;
$scope.endIndexMap[key] = endIndex;
if (endIndex > $scope.clientsMap[key].length) {
@ -65,9 +65,9 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS
* @param key
*/
$scope.packup = function(key) {
$scope.endIndexMap[key] = initEndIndex;
$scope.endIndexMap[key] = $scope.initEndIndex;
var length = $scope.clientsMap[key].length;
if (length <= initEndIndex)
if (length <= $scope.initEndIndex)
$scope.endIndexMap[key] = length;
};
@ -87,12 +87,27 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS
$scope.params = {};
$scope.isCollapsed = true;
// 前端渲染的end索引
$scope.endIndexMap = {};
// 初始化索引是30
$scope.initEndIndex = 30;
$scope.loadNotTradeClient = function () {
$scope.disable_button = true;
$http.get('/sys/merchant_id/trade').then(function (resp) {
$scope.notTradeClientsMap = resp.data.merchant_id_map;
$scope.refresh_time = resp.data.refresh_time;
$scope.disable_button = false;
// 加入对应项的end索引值
// 如果数据小于initEndIndex索引值为数据长度
// 否则设置为initEndIndex
for (var key in $scope.notTradeClientsMap) {
$scope.endIndexMap[key] = $scope.initEndIndex;
var length = $scope.notTradeClientsMap[key].length;
if (length <= $scope.initEndIndex)
$scope.endIndexMap[key] = length;
}
});
};
$scope.loadNotTradeClient();
@ -116,6 +131,35 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS
size: 'sm'
})
};
/**
* 点击更多加载
* 判断加initEndIndex后的索引是否超出数组长度
* @param key
*/
$scope.more = function(key) {
var endIndex = $scope.endIndexMap[key] + $scope.initEndIndex;
$scope.endIndexMap[key] = endIndex;
if (endIndex > $scope.notTradeClientsMap[key].length) {
$scope.endIndexMap[key] = $scope.notTradeClientsMap[key].length;
}
};
/**
* 收起
* @param key
*/
$scope.packup = function(key) {
$scope.endIndexMap[key] = $scope.initEndIndex;
var length = $scope.notTradeClientsMap[key].length;
if (length <= $scope.initEndIndex)
$scope.endIndexMap[key] = length;
};
}]);
app.controller('showClientsCtrl', ['$scope', '$http','qrJson', function ($scope, $http,qrJson) {
$scope.qrJson = qrJson.data;

@ -156,7 +156,7 @@
</a>
-->
<a ng-if="clients.length > 60"
<a ng-if="clients.length > initEndIndex"
class="list-group-item col-sm-12 col-xs-12 text-center" >
<span class="small-box-footer cursor"
ng-click="more(key)"
@ -165,7 +165,7 @@
</span>
<span class="small-box-footer cursor pull-right"
ng-click="packup(key)"
ng-if="endIndexMap[key] > 60">
ng-if="endIndexMap[key] > initEndIndex">
收起 <i class="fa fa-arrow-circle-up"></i>
</span>
</a>

@ -15,26 +15,55 @@
<loadingbar ng-if="disable_button"></loadingbar>
<div>
<div class="list-group col-sm-12 col-xs-12"
ng-repeat="(key,clients) in notTradeClientsMap">
ng-repeat="(key, clients) in notTradeClientsMap">
<!--
<a class="list-group-item active col-sm-12 col-xs-12">
{{key|choose_merchant_id}}
<span ng-show="clients.length>59" class="small-box-footer cursor pull-right" ng-click="isCollapsed = !isCollapsed">更多 <i class="fa fa-arrow-circle-right" ng-class="{'i-rotate_90':!isCollapsed}"></i></span>
</a>
-->
<a class="list-group-item col-sm-2 col-xs-6 cursor"
ng-repeat="client in clients | orderBy:'client_count':true"
ng-click="showClient(client.sub_merchant_id)" ng-if="$index<60">
<span>{{client.sub_merchant_id}}&nbsp;<i class="fa fa-clock-o text-danger"
title="Temp Sub Merchant ID"
ng-if="client.temp_sub_merchant"></i></span>
<span class="badge" aria-hidden="true" title="show detail">{{client.client_count}}</span>
ng-repeat="client in clients.slice(0, endIndexMap[key]) | orderBy:'client_count':true"
ng-click="showClient(client.sub_merchant_id)">
<span>{{client.sub_merchant_id}}&nbsp;
<i class="fa fa-clock-o text-danger"
title="Temp Sub Merchant ID"
ng-if="client.temp_sub_merchant">
</i>
</span>
<span class="badge" aria-hidden="true" title="show detail">
{{client.client_count}}
</span>
</a>
<a class="list-group-item col-sm-2 col-xs-6 cursor" ng-hide="isCollapsed"
<!--
<a class="list-group-item col-sm-2 col-xs-6 cursor"
ng-hide="isCollapsed"
ng-repeat="client in clients | orderBy:'client_count':true"
ng-click="showClient(client.sub_merchant_id)" ng-if="$index>59">
<span>{{client.sub_merchant_id}}&nbsp;<i class="fa fa-clock-o text-danger"
title="Temp Sub Merchant ID"
ng-if="client.temp_sub_merchant"></i></span>
<span class="badge" aria-hidden="true" title="show detail">{{client.client_count}}</span>
ng-click="showClient(client.sub_merchant_id)"
ng-if="$index>59">
<span>{{client.sub_merchant_id}}&nbsp;
<i class="fa fa-clock-o text-danger"
title="Temp Sub Merchant ID"
ng-if="client.temp_sub_merchant">
</i>
</span>
<span class="badge" aria-hidden="true" title="show detail">
{{client.client_count}}
</span>
</a>
-->
<a ng-if="clients.length > initEndIndex"
class="list-group-item col-sm-12 col-xs-12 text-center" >
<span class="small-box-footer cursor"
ng-click="more(key)"
ng-if="endIndexMap[key] < clients.length">
更多 <i class="fa fa-arrow-circle-down"></i>
</span>
<span class="small-box-footer cursor pull-right"
ng-click="packup(key)"
ng-if="endIndexMap[key] > initEndIndex">
收起 <i class="fa fa-arrow-circle-up"></i>
</span>
</a>
</div>
</div>

Loading…
Cancel
Save