[Y] 优化通用商户号查询

master
taylor.dang 6 years ago
parent 29500e60a7
commit 7af0564814

@ -139,7 +139,10 @@ public class MerchantIdManageServiceImpl implements MerchantIdManageService {
client.put("temp_sub_merchant", true);
}
}
Map<String, List<JSONObject>> clientsMap = clients.stream().filter(t->t.containsKey("merchant_id")).filter(t->t.containsKey("sub_merchant_id")).collect(Collectors.groupingBy(t->t.getString("merchant_id")));
Map<String, List<JSONObject>> clientsMap = clients.stream()
.filter(t->t.containsKey("merchant_id"))
.filter(t->t.containsKey("sub_merchant_id"))
.collect(Collectors.groupingBy(t->t.getString("merchant_id")));
return clientsMap;
}

@ -21,14 +21,56 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS
$scope.toShow = false;
$scope.client_loading = true;
// 前端渲染的end索引
$scope.endIndexMap = {};
// 初始化索引是60
const initEndIndex = 60;
$scope.loadClient = function () {
$http.get('/sys/merchant_id').then(function (resp) {
$scope.clientsMap = resp.data;
$scope.client_loading = false;
// 加入对应项的end索引值
// 如果数据小于60索引值为数据长度
// 否则设置为60
for (var key in $scope.clientsMap) {
$scope.endIndexMap[key] = initEndIndex;
var length = $scope.clientsMap[key].length;
if (length <= initEndIndex)
$scope.endIndexMap[key] = length;
}
});
};
$scope.loadClient();
/**
* 点击更多加载
* 判断加60后的索引是否超出数组长度
* @param key
*/
$scope.more = function(key) {
var endIndex = $scope.endIndexMap[key] + initEndIndex;
$scope.endIndexMap[key] = endIndex;
if (endIndex > $scope.clientsMap[key].length) {
$scope.endIndexMap[key] = $scope.clientsMap[key].length;
}
};
/**
* 收起
* @param key
*/
$scope.packup = function(key) {
$scope.endIndexMap[key] = initEndIndex;
var length = $scope.clientsMap[key].length;
if (length <= initEndIndex)
$scope.endIndexMap[key] = length;
};
$scope.showClient = function (sub_merchant_id) {
if($scope.sub_merchant_id == sub_merchant_id){
return;
@ -38,6 +80,7 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS
$scope.sub_merchant_id = sub_merchant_id;
});
};
}]);
app.controller('noTradeSubMerchantIdCtrl', ['$scope', '$state', '$http','$uibModal', function ($scope, $state, $http,$uibModal) {
$scope.pagination = {};

@ -78,24 +78,32 @@
<loadingbar ng-if="client_loading"></loadingbar>
<div class="col-sm-12 col-xs-12">
<div style="margin-top: 5px">
<div class="list-group col-sm-12 col-xs-12" ng-repeat="(key,clients) in clientsMap">
<div class="list-group col-sm-12 col-xs-12"
ng-repeat="(key, clients) in clientsMap">
<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"><span
ng-if="clients.length>59">更多 <i class="fa fa-arrow-circle-right"
ng-class="{'i-rotate_90':!isCollapsed}"></i></span></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);toShow=!toShow" ng-if="$index<60">
ng-repeat="client in clients.slice(0, endIndexMap[key]) | orderBy:'client_count':true"
ng-click="showClient(client.sub_merchant_id); toShow = !toShow">
<span>
{{client.sub_merchant_id}}&nbsp;<i class="fa fa-clock-o text-danger"
{{client.sub_merchant_id}}&nbsp;
<i class="fa fa-clock-o text-danger"
title="Using temp Sub Merchant ID"
ng-if="client.temp_sub_merchant"></i></span>
ng-if="client.temp_sub_merchant">
</i>
</span>
<span class="badge pull-right position_re">
{{client.client_count}}
<div ng-if="sub_merchant_id==client.sub_merchant_id&&toShow" class="popover fade in position_ab"
<div ng-if="sub_merchant_id==client.sub_merchant_id&&toShow"
class="popover fade in position_ab"
role="tooltip" style="display: block;">
<div class="arrow"></div>
<h3 class="popover-title popover-color">Clients</h3>
@ -104,7 +112,8 @@
ng-repeat="client_moniker in client_monikers"
ng-show="$index<client_monikers.length-1"
ui-sref="partners.detail({clientMoniker:client_moniker.client_moniker})">
{{client_moniker.client_moniker}}<span class="text-black">,</span>&nbsp;
{{client_moniker.client_moniker}}
<span class="text-black">,</span>&nbsp;
</button>
<button type="button" class="btn btn-link"
ng-repeat="client_moniker in client_monikers" ng-if="$last"
@ -114,8 +123,8 @@
</div>
</div>
</span>
</a>
<!--
<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);toShow=!toShow" ng-if="$index>59">
@ -124,7 +133,7 @@
title="Using temp Sub Merchant ID"
ng-if="client.temp_sub_merchant"></i></span>
<span class="badge pull-right position_re" aria-hidden="true" title="show detail">
{{client.client_count}}
{{client.client_count}}</span>
<div ng-if="sub_merchant_id==client.sub_merchant_id&&toShow" class="popover fade in position_ab"
role="tooltip" style="display: block;">
<div class="arrow"></div>
@ -145,6 +154,21 @@
</div>
</span>
</a>
-->
<a ng-if="clients.length > 60"
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] > 60">
收起 <i class="fa fa-arrow-circle-up"></i>
</span>
</a>
</div>
</div>
</div>

Loading…
Cancel
Save