Merge remote-tracking branch 'origin/develop' into develop

master
eason 6 years ago
commit 493b44b013

@ -660,3 +660,15 @@ CREATE TABLE `act_charity` (
`active_time` date DEFAULT NULL,
PRIMARY KEY (`client_moniker`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE `risk_attention_merchants` (
`id` varchar(50) NOT NULL,
`client_id` int(11) NOT NULL,
`client_moniker` varchar(20) NOT NULL,
`is_valid` tinyint(1) NOT NULL DEFAULT 1,
`create_time` datetime NOT NULL,
`update_time` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `client_moniker` (`client_moniker`),
KEY `id` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

@ -3,7 +3,6 @@ package au.com.royalpay.payment.manage.customers.web;
import au.com.royalpay.payment.manage.customers.core.EncourageService;
import au.com.royalpay.payment.tools.CommonConsts;
import au.com.royalpay.payment.tools.connections.mpsupport.beans.WxOauthType;
import au.com.royalpay.payment.tools.permission.alipay.AlipayMapping;
import au.com.royalpay.payment.tools.permission.wechat.WechatMapping;
import com.alibaba.fastjson.JSONObject;
@ -11,11 +10,11 @@ import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;
import javax.annotation.Resource;
@ -23,7 +22,7 @@ import javax.annotation.Resource;
/**
* Created by yixian on 2017-04-28.
*/
@Controller
@RestController
@RequestMapping("/act/encourage_money")
public class EncourageMoneyController {
Logger logger = LoggerFactory.getLogger(getClass());
@ -44,48 +43,32 @@ public class EncourageMoneyController {
return encourageService.takeEncourageMoney(orderId, user_id);
}
@RequestMapping(value = "/orders/{orderId}/wechat", method = RequestMethod.GET)
public JSONObject takeEncourageMoneyWeChat(@PathVariable String orderId, @ModelAttribute(CommonConsts.WECHATINFO) JSONObject wxUser) {
logger.info("kiratest---wechat");
if (wxUser == null) {
return new JSONObject();
}
logger.info(wxUser.toJSONString());
return encourageService.takeEncourageMoney(orderId, wxUser.getString("openid"));
}
@AlipayMapping(value = "/orders/{orderId}/alipay", method = RequestMethod.GET)
public JSONObject takeEncourageMoneyAlipay(@PathVariable String orderId, @ModelAttribute(CommonConsts.ALIUSER) JSONObject alipayInfo) {
logger.info("kiratest---alipay");
if (alipayInfo == null) {
return new JSONObject();
}
logger.info(alipayInfo.toJSONString());
return encourageService.takeEncourageMoney(orderId, alipayInfo.getString("user_id"));
}
@RequestMapping(value = "/orders/{orderId}/crit", method = RequestMethod.PUT)
public JSONObject takeEncourageMoneyCrit(@PathVariable String orderId) {
return encourageService.doubleEncourageMoney(orderId);
}
@WechatMapping(value = "/my", method = RequestMethod.GET, oauthType = WxOauthType.USERINFO)
public ModelAndView encourageLogs(@ModelAttribute(CommonConsts.WECHATINFO) JSONObject wxUser) {
@RequestMapping(value = "/my", method = RequestMethod.GET)
public ModelAndView encourageLogs(@ModelAttribute(CommonConsts.WECHATINFO) JSONObject wxUser,@ModelAttribute(CommonConsts.ALIUSER) JSONObject aliuser) {
ModelAndView mav = new ModelAndView("activity/encourage_money/my");
mav.addObject("wxUser", wxUser);
JSONObject balanceStatus = encourageService.getBalanceStatus(wxUser.getString("openid"));
String user_id = "";
if(wxUser==null){
user_id = aliuser.getString("user_id");
}else {
user_id = wxUser.getString("openid");
}
JSONObject balanceStatus = encourageService.getBalanceStatus(user_id);
mav.addObject("balance_status", balanceStatus);
return mav;
}
@WechatMapping(value = "/desc",method = RequestMethod.GET)
@RequestMapping(value = "/desc",method = RequestMethod.GET)
public ModelAndView descPage(){
return new ModelAndView("activity/encourage_money/desc");
}
@WechatMapping(value = "/merchants",method = RequestMethod.GET)
@RequestMapping(value = "/merchants",method = RequestMethod.GET)
public ModelAndView merchantsPage(){
return new ModelAndView("activity/encourage_money/merchants");
}

@ -0,0 +1,31 @@
package au.com.royalpay.payment.manage.mappers.risk;
import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper;
import cn.yixblog.support.mybatis.autosql.annotations.AutoSql;
import cn.yixblog.support.mybatis.autosql.annotations.SqlType;
import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
import org.apache.ibatis.annotations.Param;
/**
* Create by yixian at 2017-12-21 11:45
*/
@AutoMapper(tablename = "risk_attention_merchants", pkName = "id")
public interface RiskAttentionMerchantsAMapper {
@AutoSql(type = SqlType.UPDATE)
void update(JSONObject client);
@AutoSql(type = SqlType.INSERT)
void save(JSONObject client);
@AutoSql(type = SqlType.SELECT)
JSONObject findById(@Param("id") String id);
@AutoSql(type = SqlType.SELECT)
JSONObject findByClientMoniker(@Param("client_moniker") String client_moniker);
@AutoSql(type = SqlType.SELECT)
PageList<JSONObject> query(JSONObject params, PageBounds pagination);
}

@ -0,0 +1,49 @@
package au.com.royalpay.payment.manage.risk.bean;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils;
/**
* Created by yuan on 2018/7/13.
*/
public class QueryAttentionMerchants {
private String client_moniker;
private int page = 1;
private int limit = 10;
public JSONObject toParams() {
JSONObject params = new JSONObject();
if(StringUtils.isNotEmpty(client_moniker)){
params.put("client_moniker", this.client_moniker);
}
params.put("is_valid", 1);
return params;
}
public String getClient_moniker() {
return client_moniker;
}
public void setClient_moniker(String client_moniker) {
this.client_moniker = client_moniker;
}
public int getPage() {
return page;
}
public void setPage(int page) {
this.page = page;
}
public int getLimit() {
return limit;
}
public void setLimit(int limit) {
this.limit = limit;
}
}

@ -1,10 +1,6 @@
package au.com.royalpay.payment.manage.risk.core;
import au.com.royalpay.payment.manage.risk.bean.AddRiskDetailLog;
import au.com.royalpay.payment.manage.risk.bean.DealRiskRecord;
import au.com.royalpay.payment.manage.risk.bean.QueryRiskDetail;
import au.com.royalpay.payment.manage.risk.bean.QueryRiskOrder;
import au.com.royalpay.payment.manage.risk.bean.QueryRiskRecord;
import au.com.royalpay.payment.manage.risk.bean.*;
import com.alibaba.fastjson.JSONObject;
@ -32,6 +28,9 @@ public interface RiskMerchantService {
JSONObject getRiskDetails(QueryRiskDetail queryRiskDetail);
JSONObject listAttentionMerchants(JSONObject account,QueryAttentionMerchants queryAttention);
void addAttentionMerchants(JSONObject account,String client_moniker);
void updateAttentionMerchants(JSONObject account,String client_moniker);
}

@ -1,21 +1,15 @@
package au.com.royalpay.payment.manage.risk.core.impl;
import au.com.royalpay.payment.manage.mappers.risk.RiskMerchantDetailLogMapper;
import au.com.royalpay.payment.manage.mappers.risk.RiskMerchantRecordMapper;
import au.com.royalpay.payment.manage.mappers.risk.RiskTransactionLogMapper;
import au.com.royalpay.payment.manage.mappers.risk.RiskWhiteListMapper;
import au.com.royalpay.payment.manage.mappers.risk.*;
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.manage.risk.bean.AddRiskDetailLog;
import au.com.royalpay.payment.manage.risk.bean.DealRiskRecord;
import au.com.royalpay.payment.manage.risk.bean.QueryRiskDetail;
import au.com.royalpay.payment.manage.risk.bean.QueryRiskOrder;
import au.com.royalpay.payment.manage.risk.bean.QueryRiskRecord;
import au.com.royalpay.payment.manage.risk.bean.*;
import au.com.royalpay.payment.manage.risk.core.RiskMerchantService;
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.exceptions.NotFoundException;
import au.com.royalpay.payment.tools.utils.PageListUtils;
import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.Order;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import org.apache.commons.lang3.StringUtils;
@ -39,6 +33,8 @@ public class RiskMerchantServiceImpl implements RiskMerchantService {
private RiskWhiteListMapper riskWhiteListMapper;
@Resource
private ClientManager clientManager;
@Resource
private RiskAttentionMerchantsAMapper riskAttentionMerchantsAMapper;
@Override
@Transactional
@ -213,4 +209,55 @@ public class RiskMerchantServiceImpl implements RiskMerchantService {
riskMerchantDetailLogMapper.query(queryRiskDetail.toParams(), new PageBounds(queryRiskDetail.getPage(), queryRiskDetail.getLimit())));
}
@Override
public JSONObject listAttentionMerchants(JSONObject account, QueryAttentionMerchants queryAttention) {
if (account == null) {
throw new BadRequestException("account not exists");
}
return PageListUtils.buildPageListResult(
riskAttentionMerchantsAMapper.query(queryAttention.toParams(), new PageBounds(queryAttention.getPage(), queryAttention.getLimit(), Order.formString("create_time.desc"))));
}
@Override
public void addAttentionMerchants(JSONObject account, String client_moniker) {
if (account == null) {
throw new BadRequestException("account not exists");
}
JSONObject attentionMerchant = riskAttentionMerchantsAMapper.findByClientMoniker(client_moniker);
if(attentionMerchant != null){
if(attentionMerchant.getBoolean("is_valid")){
throw new BadRequestException("The client has already existed");
}else {
attentionMerchant.put("is_valid",1);
attentionMerchant.put("update_time",new Date());
riskAttentionMerchantsAMapper.update(attentionMerchant);
return;
}
}
JSONObject client = clientManager.getClientInfoByMoniker(client_moniker);
if(client == null){
throw new BadRequestException("The client does not exist");
}
JSONObject attention = new JSONObject();
attention.put("client_id",client.getIntValue("client_id"));
attention.put("client_moniker",client.getString("client_moniker"));
attention.put("is_valid",1);
attention.put("create_time",new Date());
riskAttentionMerchantsAMapper.save(attention);
}
@Override
public void updateAttentionMerchants(JSONObject account, String client_moniker) {
if (account == null) {
throw new BadRequestException("account not exists");
}
JSONObject attentionMerchant = riskAttentionMerchantsAMapper.findByClientMoniker(client_moniker);
if(attentionMerchant == null){
throw new BadRequestException("The client does not exist");
}
attentionMerchant.put("is_valid",0);
attentionMerchant.put("update_time",new Date());
riskAttentionMerchantsAMapper.update(attentionMerchant);
}
}

@ -1,11 +1,7 @@
package au.com.royalpay.payment.manage.risk.web;
import au.com.royalpay.payment.manage.permission.manager.ManagerMapping;
import au.com.royalpay.payment.manage.risk.bean.AddRiskDetailLog;
import au.com.royalpay.payment.manage.risk.bean.DealRiskRecord;
import au.com.royalpay.payment.manage.risk.bean.QueryRiskDetail;
import au.com.royalpay.payment.manage.risk.bean.QueryRiskOrder;
import au.com.royalpay.payment.manage.risk.bean.QueryRiskRecord;
import au.com.royalpay.payment.manage.risk.bean.*;
import au.com.royalpay.payment.manage.risk.core.RiskMerchantService;
import au.com.royalpay.payment.tools.CommonConsts;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
@ -94,4 +90,18 @@ public class RiskController {
riskMerchantService.addDetailLog(addRiskDetailLog,manager);
}
@RequestMapping(value = "/attention", method = RequestMethod.GET)
public JSONObject listMerchants(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager,QueryAttentionMerchants queryAttention ) {
return riskMerchantService.listAttentionMerchants(manager,queryAttention);
}
@RequestMapping(value = "/attention/{client_moniker}", method = RequestMethod.POST)
public void addMerchants(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager,@PathVariable String client_moniker) {
riskMerchantService.addAttentionMerchants(manager,client_moniker);
}
@RequestMapping(value = "/attention/{client_moniker}", method = RequestMethod.PUT)
public void updateMerchants(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager,@PathVariable String client_moniker) {
riskMerchantService.updateAttentionMerchants(manager,client_moniker);
}
}

@ -23,21 +23,24 @@ define(['angular', 'uiBootstrap', 'uiRouter', 'angularEcharts'], function (angul
$http.get('/actchairty/clients', {params: params}).then(function (resp) {
$scope.clients = resp.data.data;
$scope.pagination = resp.data.pagination;
})
};
$scope.loadClients();
$scope.new_conf = {};
$scope.ctrl = {dateInput: false};
$scope.submitClient = function () {
$scope.errmsg = null;
var client_moniker = $scope.new_conf.client_moniker;
$scope.msg = null;
var conf = {
date: $filter('date')($scope.new_conf.date, 'yyyy-MM-dd'),
};
$http.put('/actchairty/clients/' + $scope.new_conf.client_moniker, conf).then(function () {
$scope.new_conf = {};
$scope.loadClients();
$scope.msg = "商户创建成功商户ID"+ client_moniker + " 参加时间:" + conf.date;
}, function (resp) {
$scope.errmsg = resp.data.message;
$scope.msg = resp.data.message;
});
};
}]);

@ -23,7 +23,7 @@
</ul>
<div class="tab-content" ui-view>
<div class="modal-body">
<div class="alert alert-danger" ng-if="errmsg" ng-bind="errmsg"></div>
<div class="alert alert-info" ng-if="msg" ng-bind="msg"></div>
<div class="form-inline">
<div class="form-group">
<input class="form-control" placeholder="Client Moniker" ng-model="new_conf.client_moniker">
@ -74,6 +74,9 @@
next-text="&rsaquo;"
first-text="&laquo;"
last-text="&raquo;"></uib-pagination>
<div class="row">
<div class="col-xs-12">Total Records:{{pagination.totalCount}};Total Pages:{{pagination.totalPages}}</div>
</div>
</div>
</div>

@ -45,6 +45,10 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS
});
}]
}
}).state('analysis_monitoring.attention', {
url: '/risk/attention',
templateUrl: '/static/risk/templates/attention_merchants.html',
controller: 'AttentionMerchantCtrl'
});
}]);
app.controller('RiskManageCtrl', ['$scope', '$http', function ($scope, $http){
@ -218,6 +222,41 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS
}
}]);
app.controller('AttentionMerchantCtrl', ['$scope', '$http','commonDialog','$uibModal', function ($scope, $http,commonDialog,$uibModal){
$scope.params = {};
$scope.pagination = {};
$scope.ctrl = {};
$scope.loadAttentionMerchants = function (page) {
var params = angular.copy($scope.params);
params.page = page || $scope.pagination.page || 1;
$http.get('/sys/risk/attention', {params: params}).then(function (resp) {
$scope.attentions = resp.data.data;
$scope.pagination = resp.data.pagination;
$scope.ctrl.addAttention = false;
});
};
$scope.loadAttentionMerchants(1);
$scope.disableAttention = function (client_moniker) {
commonDialog.confirm({title: 'Confirm', content: '确定删除这个商户?'
}).then(function () {
$http.put('/sys/risk/attention/' + client_moniker).then(function () {
commonDialog.alert({title: 'Success', content: 'disable successfully', type: 'success'});
$scope.loadAttentionMerchants(1);
}, function (resp) {
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
});
})
};
$scope.addAttentionMerchants = function (client_moniker) {
$http.post('/sys/risk/attention/'+ client_moniker).then(function () {
commonDialog.alert({title: 'Success', content: 'add successfully', type: 'success'});
$scope.loadAttentionMerchants(1);
}, function (resp) {
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
});
}
}]);
app.filter('risk_type', function () {
return function (riskStr) {
angular.forEach(riskType,function (type) {

@ -0,0 +1,84 @@
<div ui-view>
<section class="content-header">
<h1>Risky Merchants</h1>
<ol class="breadcrumb">
<li><i class="fa fa-gift"></i> Risk</li>
<li class="active">Risk Merchants</li>
</ol>
</section>
<section class="content">
<div class="box box-warning">
<div class="box-header">
<div class="form-inline">
<div class="form-group">
<label class="control-label" for="partner-code-search">Partner Code</label>
<input type="text" class="form-control" id="partner-code-search"
ng-enter="loadAttentionMerchants(1)"
ng-model="params.client_moniker">
</div>
<div class="form-group">
<button class="btn btn-primary" type="button" ng-click="loadAttentionMerchants(1)"><i
class="fa fa-search"></i></button>
</div>
<div class="form-group pull-right">
<button ng-hide="ctrl.addAttention" class="btn btn-info" type="button" ng-click="ctrl.addAttention = true"><i class="fa fa-plus"></i>Add</button>
<div class="input-group" ng-if="ctrl.addAttention">
<input type="text" class="form-control" ng-model="client_moniker"
title="Add Attention" placeholder="client Moniker">
<div class="input-group-btn">
<button class="btn btn-success" ng-click="addAttentionMerchants(client_moniker)">
<i class="fa fa-check"></i>
</button>
</div>
<div class="input-group-btn">
<button class="btn btn-danger" ng-click="ctrl.addAttention=false">
<i class="fa fa-remove"></i>
</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="box box-warning">
<div class="box-header">Clients</div>
<div class="box-body table-responsive">
<table class="table table-hover">
<thead>
<tr>
<th>Client Moniker</th>
<th>Create Time</th>
<th>Operation</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="client in attentions">
<td>{{client.client_moniker}}</td>
<td>{{client.create_time}}</td>
<td>
<a role="button" class="text-bold text-danger"
ng-click="disableAttention(client.client_moniker)">Disable</a>
</td>
</tr>
</tbody>
</table>
<div class="modal-footer">
<uib-pagination ng-if="attentions.length"
class="pagination"
total-items="pagination.totalCount"
boundary-links="true"
ng-model="pagination.page"
items-per-page="pagination.limit"
max-size="10"
ng-change="loadAttentionMerchants()"
previous-text="&lsaquo;"
next-text="&rsaquo;"
first-text="&laquo;"
last-text="&raquo;"></uib-pagination>
</div>
</div>
</div>
</section>
</div>

@ -34,6 +34,10 @@
<button class="btn btn-primary" type="button" ng-click="loadRecords(1)"><i
class="fa fa-search"></i></button>
</div>
<div class="form-group pull-right">
<button class="btn btn-primary" type="button" ui-sref="analysis_monitoring.attention">Risky Merchants</button>
</div>
</div>
</div>
</div>

Loading…
Cancel
Save