master
yuan 6 years ago
parent 61884d34fc
commit 24191f31db

@ -13,4 +13,6 @@ public interface PartnersAnalysisService {
List<JSONObject> getTradePartnersAnalysis(JSONObject params);
List<JSONObject> getPartnersTypesAnalysis(JSONObject params);
List<JSONObject> getPartnersSettlementAnalysis(JSONObject params);
}

@ -47,7 +47,12 @@ public class PartnersAnalysisServiceImpl implements PartnersAnalysisService {
return getPartnerTypes(key_2,result,2,6,types);
}
private List<JSONObject> getPartnerTypes(String keys[],List<JSONObject> result,int short_length,int long_length,List<JSONObject> types){
@Override
public List<JSONObject> getPartnersSettlementAnalysis(JSONObject params) {
return clientAnalysisMapper.countClientsSettlementCycle(params);
}
private List<JSONObject> getPartnerTypes(String keys[], List<JSONObject> result, int short_length, int long_length, List<JSONObject> types){
for(String key : keys){
int countValue = 0;
JSONObject object = new JSONObject();

@ -35,4 +35,6 @@ public interface ClientAnalysisMapper {
List<JSONObject> countClientsTypes(JSONObject params);
List<JSONObject> notTradeSubMerchantId();
List<JSONObject> countClientsSettlementCycle(JSONObject params);
}

@ -66,4 +66,19 @@ public class PartnersAnalysisController {
}
return partnersAnalysisService.getPartnersTypesAnalysis(params);
}
@ManagerMapping("/settlement")
public List<JSONObject> getPartnersSettlementAnalysis(AnalysisBean analysis, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
JSONObject params = analysis.toParams(null);
if (manager.getInteger("org_id") != null) {
params.put("org_id", manager.getIntValue("org_id"));
}
if (analysis.isOnlyGroup() && ManagerRole.BD_LEADER.hasRole(manager.getIntValue("role"))) {
params.put("bd_group", manager.getString("manager_id"));
if (analysis.getGroup_bd()>0){
params.put("bd_group_bd",analysis.getGroup_bd());
}
}
return partnersAnalysisService.getPartnersSettlementAnalysis(params);
}
}

@ -148,4 +148,36 @@
GROUP by c.sub_merchant_id
</select>
<select id="countClientsSettlementCycle" resultType="com.alibaba.fastjson.JSONObject">
SELECT COUNT(DISTINCT c.client_id) client_count,
CASE c.clean_days
WHEN 1
THEN 'T+1'
WHEN 2
THEN 'T+2'
WHEN 3
THEN 'T+3'
END AS settlement_cycle
FROM sys_clients c
<where>
c.client_id IS not null AND c.merchant_id IS NOT NULL
AND (c.approve_result = 1 OR c.approve_result= 2) AND c.is_valid = 1
<if test="org_id!=null and org_ids==null">and org_id=#{org_id}</if>
<if test="org_ids!=null">and org_id in
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if>
<if test="bd_group!=null">and c.client_id in
(SELECT b.client_id FROM sys_client_bd b
INNER JOIN financial_bd_config c ON c.manager_id=b.bd_id
where b.is_valid=1 and b.start_date&lt;=now() and (b.end_date is null or b.end_date &gt;= now())
AND (c.bd_group=#{bd_group} or c.manager_id=#{bd_group})
<if test="bd_group_bd">and c.manager_id=#{bd_group_bd}</if>)
</if>
<if test="recent_client!=null">
c.client_id in
(SELECT p.client_id FROM sys_clients p INNER JOIN statistics_customer_order o ON o.client_id = p.client_id AND o.client_id !=0
WHERE datediff(now(), o.date) <![CDATA[ <= ]]>30 AND p.client_id is not null GROUP BY p.client_id)
</if>
</where>
GROUP by c.clean_days
</select>
</mapper>

@ -176,6 +176,43 @@ define(['angular', 'uiBootstrap', 'uiRouter', 'angularEcharts','./transaction/an
series: series
}
};
$scope.loadTradePartnersBySettlementCycle = function () {
var partnersBySettlementCycle = {
chart: {
tooltip: {
trigger: 'item',
formatter :"{a} {b} : {c} ({d}%)"
},
color: colors
},
series: [{
basic: {
name: '周期', type: 'pie',
radius: '60%',
center: ['50%', '40%'],
itemStyle: {
emphasis: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
},
normal : {
label : {
position : 'outer',
formatter :"{a} {b} : {c} ({d}%)"
}
}
}
},
column: {key: 'client_count', name: 'settlement_cycle'}
}]
};
$http.get('/analysis/partners/settlement', {params:{}}).then(function (resp) {
$scope.settlementCycle = resp.data;
$scope.partners_settlement_chart = chartParser.parse(partnersBySettlementCycle, resp.data);
});
};
$scope.loadTradePartnersBySettlementCycle();
/*var partnerTypesConfig = function (legend) {
return {
chart: {

@ -59,7 +59,13 @@
</div>
</div>
<div class="box box-warning">
<div class="box-header">
<div class="box-header pull-right">
<div class="btn-group" role="group">
<button type="button" class="btn btn-info" ng-click="showIndustry();display=false" ng-class="{'active':!display}">行业</button>
<button type="button" class="btn btn-info" ng-click="showCycle();display=true" ng-class="{'active':display}">周期</button>
</div>
</div>
<div class="box-body" ng-if="!display">
<div class="col-sm-12">
<div class="col-sm-6 col-xs-12">
<p class="text-center">各类型商家数量分布</p>
@ -92,6 +98,33 @@
</label>
</div>
</div>
<div class="box-body" ng-if="display">
<div class="col-sm-12">
<div class="col-sm-6 col-xs-12">
<p class="text-center">商户结算周期分布</p>
<div class="chart" style="height: 400px" echarts="partners_settlement_chart"
chart-setter="partner_type_chart($chart)"
ng-class="{nodata:partners_settlement_chart.nodata}"></div>
</div>
<div class="col-sm-6 col-xs-12">
<p class="text-center">结算周期列表</p>
<table class="table table-bordered table-hover table-striped">
<thead>
<tr>
<th>Clean Days</th>
<th>Partners</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="cycle in settlementCycle">
<td ng-bind="cycle.settlement_cycle"></td>
<td ng-bind="cycle.client_count"></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="box box-warning">
<div class="box-header">

Loading…
Cancel
Save