Merge branch '7/30'

master
yuan 6 years ago
commit 1eb2326941

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

@ -88,4 +88,7 @@ public interface ClientMapper {
PageList<JSONObject> simpleQuery(JSONObject params, PageBounds pagination);
@AutoSql(type = SqlType.SELECT)
JSONObject findByWechatInstitutionMerchantId(@Param("wechat_institution_merchant_id") String wechat_institution_merchant_id);
}

@ -63,6 +63,9 @@ public interface ClientManager {
@Transactional
void updateAliSubMerchantId(JSONObject manager, String clientMoniker, JSONObject aliSubMerchantInfo);
@Transactional
void refreshWechatInstitutionMerchantId(JSONObject manager, String clientMoniker, JSONObject refreshWechatInstitutionMerchantId);
@Transactional(noRollbackFor = EmailException.class)
void auditClient(JSONObject manager, String clientMoniker, int pass);

@ -742,11 +742,40 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
clientInfoCacheSupport.clearClientCache(clientId);
}
@Override
public void refreshWechatInstitutionMerchantId(JSONObject manager, String clientMoniker, JSONObject refreshWechatInstitutionMerchantId) {
JSONObject client = getClientInfoByMoniker(clientMoniker);
if (client == null) {
throw new InvalidShortIdException();
}
checkOrgPermission(manager, client);
JSONObject update = new JSONObject();
int clientId = client.getIntValue("client_id");
update.put("client_id", clientId);
String wechatInstitutionMerchantId = RandomStringUtils.random(6, true, true).toUpperCase();
if(StringUtils.isEmpty(refreshWechatInstitutionMerchantId.getString("wechat_institution_merchant_id"))){
update.put("wechat_institution_merchant_id",wechatInstitutionMerchantId);
}else {
update.put("wechat_institution_merchant_id",createWechatInstitutionMerchantId(wechatInstitutionMerchantId)) ;
}
clientMapper.update(update);
clientInfoCacheSupport.clearClientCache(clientId);
}
private String createWechatInstitutionMerchantId(String wechatInstitutionMerchantId){
JSONObject client = clientMapper.findByWechatInstitutionMerchantId(wechatInstitutionMerchantId);
if(client == null){
return wechatInstitutionMerchantId;
}else {
return createWechatInstitutionMerchantId(RandomStringUtils.random(6, true, true).toUpperCase());
}
}
private void recordSubMerchantLog(JSONObject client, JSONObject subMerchantInfo, JSONObject manager) {
JSONObject log = new JSONObject();
log.put("sub_merchant_id_after", subMerchantInfo.getString("sub_merchant_id"));
log.put("operator", manager.getString("display_name"));
log.put("create_time", new Date());
log.put("wechat_institution_merchant_id", client.getString("wechat_institution_merchant_id"));
log.put("client_id", client.getIntValue("client_id"));
log.put("sub_merchant_id_before", client.getString("sub_merchant_id"));
logClientSubMerchantIdMapper.save(log);

@ -159,6 +159,11 @@ public class PartnerManageController {
clientManager.updateAliSubMerchantId(manager, clientMoniker, aliSubMerchantInfo);
}
@ManagerMapping(value = "/{clientMoniker}/wechat_institution_merchant_id", method = RequestMethod.PUT, role = {ManagerRole.OPERATOR})
public void refreshWechatInsMerchantId(@PathVariable String clientMoniker, @RequestBody JSONObject refreshWechatInstitutionMerchantId, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
clientManager.refreshWechatInstitutionMerchantId(manager, clientMoniker, refreshWechatInstitutionMerchantId);
}
@ManagerMapping(value = "/{clientMoniker}/qrcode_surcharge", method = RequestMethod.PUT, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN, ManagerRole.BD_USER, ManagerRole.SERVANT})
public void setClientPaySurCharge(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager,@PathVariable String clientMoniker, @RequestBody JSONObject config) {
clientManager.setClientQRCodePaySurCharge(manager,clientMoniker, config.getBooleanValue("qrcode_surcharge"));

@ -148,4 +148,41 @@
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 clean_days
FROM sys_clients c
<where>
(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="begin!=null">
AND c.client_id in (SELECT o.client_id FROM statistics_customer_order o
<where>
<if test="begin!=null">
o.date >=#{begin}
</if>
<if test="eng!=null">
o.date > #{end}
</if>
</where>)
</if>
</where>
GROUP by c.clean_days
</select>
</mapper>

@ -12,7 +12,7 @@ define(['angular', 'uiBootstrap', 'uiRouter', 'angularEcharts','./transaction/an
app.controller('partnersAnalysisCtrl', ['$scope', '$http', '$filter', '$timeout', 'commonDialog', 'chartParser','industryMap',
function ($scope, $http, $filter, $timeout, commonDialog, chartParser,industryMap) {
$scope.params = {};
$scope.analysis = {};
if (($scope.currentUser.role & parseInt('1000000000', 2)) > 0 && $scope.currentUser.org_id) {
$http.get('/sys/manager_accounts/group/group_bds').then(function (resp) {
$scope.bd_group_bds = resp.data;
@ -23,6 +23,7 @@ define(['angular', 'uiBootstrap', 'uiRouter', 'angularEcharts','./transaction/an
if (!$scope.params.onlyGroup){
$scope.loadPartnersInTypes();
$scope.doAnalysis();
$scope.loadTradePartnersBySettlementCycle();
return;
}
if (groupBD == 'all') {
@ -36,6 +37,7 @@ define(['angular', 'uiBootstrap', 'uiRouter', 'angularEcharts','./transaction/an
}
$scope.loadPartnersInTypes();
$scope.doAnalysis();
$scope.loadTradePartnersBySettlementCycle();
};
$scope.loadRoyalpayindustry = function () {
$http.get('/static/data/royalpayindustry.json').then(function (resp) {
@ -176,6 +178,71 @@ define(['angular', 'uiBootstrap', 'uiRouter', 'angularEcharts','./transaction/an
series: series
}
};
$scope.loadTradePartnersBySettlementCycle = function () {
var params = angular.copy($scope.analysis);
params.onlyGroup = $scope.params.onlyGroup;
if ($scope.params.group_bd){
params.group_bd=angular.copy($scope.params.group_bd);
}
$http.get('/analysis/partners/settlement', {params:params}).then(function (resp) {
$scope.settlementCycle = resp.data;
$scope.partners_settlement_chart = chartParser.parse(partnersBySettlementCycle, resp.data);
});
};
$scope.loadTradePartnersBySettlementCycle();
$scope.chooseAll = function () {
$scope.analysis = {};
$scope.loadTradePartnersBySettlementCycle()
};
$scope.chooseThirtyDays = function () {
$scope.analysis = {};
$scope.analysis.end = $filter('date')(new Date(), 'yyyyMMdd');
var day = new Date();
day.setDate(day.getDate() - 30);
$scope.analysis.begin = $filter('date')(day, 'yyyyMMdd');
$scope.loadTradePartnersBySettlementCycle();
};
$scope.chooseLastMonth = function () {
$scope.analysis = {};
var monthFinish = new Date();
monthFinish.setDate(0);
$scope.analysis.end = $filter('date')(monthFinish, 'yyyyMMdd');
var monthBegin = new Date();
monthBegin.setDate(0);
monthBegin.setDate(1);
$scope.analysis.begin = $filter('date')(monthBegin, 'yyyyMMdd');
$scope.loadTradePartnersBySettlementCycle();
};
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: 'clean_days'}
}]
};
/*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="display=false" ng-class="{'active':!display}">行业</button>
<button type="button" class="btn btn-info" ng-click="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,41 @@
</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: 300px" 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">
<div class="text-center">
<p class="btn-group text-center" role="group">
<button type="button" class="btn btn-primary btn-xs" ng-click="chooseAll()">All</button>
<button type="button" class="btn btn-primary btn-xs" ng-click="chooseThirtyDays();">recent 30 days</button>
<button type="button" class="btn btn-primary btn-xs" ng-click="chooseLastMonth();">Last Month</button>
</p>
<p></p>
<p>清算周期列表</p>
</div>
<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.clean_days"></td>
<td ng-bind="cycle.client_count"></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="box box-warning">
<div class="box-header">

@ -522,6 +522,10 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
};
$scope.showFile();
$scope.passClient = function () {
if(!$scope.partner.wechat_institution_merchant_id){
commonDialog.alert({title: 'info', content: 'Wechat Institution Merchant Id not Refresh', type: 'info'});
return;
}
if ($scope.partner.enable_hf) {
if($scope.partner.hfindustry == null){
alert("已开启HF支付通道HF行业不可为空!");
@ -570,6 +574,10 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
});
};
$scope.pass2GreenChannel = function () {
if(!$scope.partner.wechat_institution_merchant_id){
commonDialog.alert({title: 'info', content: 'Wechat Institution Merchant Id not Refresh', type: 'info'});
return;
}
commonDialog.confirm({
title: 'Green Channel Audit Partner',
content: 'Are you sure to mark partner ' + $scope.partner.company_name + ' green channel audited '
@ -1108,6 +1116,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
}
}]);
app.controller('partnerPaymentInfoCtrl', ['$scope', '$http', '$state', 'commonDialog','$uibModal', function ($scope, $http, $state, commonDialog,$uibModal) {
$scope.refresh = false;
$scope.loadPartnerPaymentInfo = function () {
$http.get('/sys/partners/' + $scope.partner.client_moniker).then(function (resp) {
$scope.paymentInfo = resp.data;
@ -1232,12 +1241,30 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
};
$scope.ctrl = {};
$scope.saveSubMerchantId = function () {
if(!$scope.refresh){
commonDialog.alert({title: 'info', content: 'Wechat Institution Merchant Id not Refresh', type: 'info'});
return;
}
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/payment_config', {sub_merchant_id: $scope.paymentInfo.sub_merchant_id}).then(function (resp) {
commonDialog.alert({
title: 'Success',
content: 'Modify Wechat Sub Merchant ID successfully',
type: 'success'
});
$scope.refresh = false;
$scope.loadPartnerPaymentInfo();
}, function (resp) {
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'})
});
};
$scope.refreshWechatInstitutionMerchantId = function () {
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/wechat_institution_merchant_id', {wechat_institution_merchant_id: $scope.paymentInfo.wechat_institution_merchant_id}).then(function (resp) {
commonDialog.alert({
title: 'Success',
content: 'Refresh Wechat Institution Merchant Id successfully',
type: 'success'
});
$scope.refresh = true;
$scope.loadPartnerPaymentInfo();
}, function (resp) {
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'})

@ -332,7 +332,7 @@
<div class="form-group"
ng-class="{'has-error':partnerForm.description.$invalid && partnerForm.description.$dirty}">
<label class="control-label col-sm-2" for="desc-input">*
Description</label>
Major Products/Service</label>
<div class="col-sm-8">
<textarea class="form-control" required
ng-model="partner.description"

@ -271,7 +271,7 @@
</div>
<div class="form-group"
ng-class="{'has-error':partnerForm.description.$invalid && partnerForm.description.$dirty}">
<label class="control-label col-sm-2" for="desc-input">* Description</label>
<label class="control-label col-sm-2" for="desc-input">* Major Products/Service</label>
<div class="col-sm-8">
<textarea class="form-control" required ng-model="partner.description"
name="description" id="desc-input" maxlength="200"></textarea>

@ -160,7 +160,7 @@
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2">*Description</label>
<label class="control-label col-sm-2">Major Products/Service</label>
<div class="col-sm-10">
<p class="form-control-static" ng-bind="partner.description"></p>
@ -480,7 +480,7 @@
</div>
<div class="form-group"
ng-class="{'has-error':partnerForm.description.$invalid && partnerForm.description.$dirty}">
<label class="control-label col-sm-2" for="desc-input">Description</label>
<label class="control-label col-sm-2" for="desc-input">Major Products/Service</label>
<div class="col-sm-8">
<textarea class="form-control" ng-model="partner.description"
name="description" id="desc-input" maxlength="200" required

@ -157,7 +157,7 @@
</div>
<div class="form-group"
ng-class="{'has-error':partnerForm.description.$invalid && partnerForm.description.$dirty}">
<label class="control-label col-sm-2" for="desc-input">Description</label>
<label class="control-label col-sm-2" for="desc-input">Major Products/Service</label>
<div class="col-sm-8">
<textarea class="form-control" ng-model="partner.description"
name="description" id="desc-input" maxlength="200" required></textarea>

@ -19,6 +19,7 @@
<tr>
<th>Sub Merchant Id Before</th>
<th>Sub Merchant Id After</th>
<th>Wechat Institution Merchant Id</th>
<th>Operator</th>
<th>Create Time</th>
</tr>
@ -27,6 +28,7 @@
<tr ng-repeat="log in logs">
<td ng-bind="log.sub_merchant_id_before"></td>
<td ng-bind="log.sub_merchant_id_after"></td>
<td ng-bind="log.wechat_institution_merchant_id"></td>
<td ng-bind="log.operator"></td>
<td ng-bind="log.create_time"></td>
</tr>

@ -390,7 +390,7 @@
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2">Description</label>
<label class="control-label col-sm-2">Major Products/Service</label>
<div class="col-sm-10">
<p class="form-control-static" ng-bind="partner.description"></p>

@ -307,7 +307,7 @@
</div>
<div class="form-group"
ng-class="{'has-error':partnerForm.description.$invalid && partnerForm.description.$dirty}">
<label class="control-label col-sm-2" for="desc-input">Description</label>
<label class="control-label col-sm-2" for="desc-input">Major Products/Service</label>
<div class="col-sm-8">
<textarea class="form-control" ng-model="partner.description"
name="description" id="desc-input" maxlength="200"></textarea>

@ -39,6 +39,16 @@
</div>
</div>
</div>
<div class="form-group" ng-if="'10'|withRole">
<label class="col-sm-3 control-label">Wechat Institution Merchant Id</label>
<div class="col-sm-9">
<p class="form-control-static">
{{paymentInfo.wechat_institution_merchant_id||'初始化'}}
<a role="button" ng-click="refreshWechatInstitutionMerchantId()"><i class="fa fa-refresh"></i></a>
</p>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">Ali Sub Merchant Id</label>
<div class="col-sm-9">

Loading…
Cancel
Save