master
yuan 6 years ago
parent f114f89dd2
commit 968ce024e7

@ -36,7 +36,6 @@ public class AnalysisBean {
private String amount_from;
private String amount_to;
private String bd_name;
private boolean recent_client = false;
public JSONObject toParams(String timezone) {
JSONObject params = new JSONObject();
if (timezone != null) {
@ -95,14 +94,6 @@ public class AnalysisBean {
return params;
}
public boolean isRecent_client() {
return recent_client;
}
public void setRecent_client(boolean recent_client) {
this.recent_client = recent_client;
}
public String getBegin() {
return begin;
}

@ -79,9 +79,6 @@ public class PartnersAnalysisController {
params.put("bd_group_bd",analysis.getGroup_bd());
}
}
if (analysis.isRecent_client()){
params.put("recent_client",true);
}
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"));

@ -160,7 +160,7 @@
END AS clean_days
FROM sys_clients c
<where>
c.client_id IS not null AND (c.approve_result = 1 OR c.approve_result= 2) AND c.is_valid = 1
(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>
@ -171,9 +171,16 @@
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">
AND 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[ <= ]]>230 AND p.client_id is not null GROUP BY p.client_id)
<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

@ -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;
@ -179,15 +179,38 @@ define(['angular', 'uiBootstrap', 'uiRouter', 'angularEcharts','./transaction/an
}
};
$scope.loadTradePartnersBySettlementCycle = function () {
var params = angular.copy($scope.params);
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.params.recent_client = true;
$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 = {

@ -62,7 +62,7 @@
<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>
<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">
@ -101,18 +101,21 @@
<div class="box-body" ng-if="display">
<div class="col-sm-12">
<div class="col-sm-6 col-xs-12">
<p class="text-center">商户结算周期分布
<span class="btn-group" role="group">
<button type="button" class="btn btn-primary btn-xs" ng-click="loadTradePartnersBySettlementCycle();choose=false" ng-class="{'active':!choose}">All</button>
<button type="button" class="btn btn-primary btn-xs" ng-click="chooseThirtyDays();choose=true" ng-class="{'active':choose}">recent 30 days</button>
</span>
</p>
<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">
<p class="text-center">结算周期列表</p>
<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>

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

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