add risk merchants html

master
yuan 6 years ago
parent b69737a554
commit 5105bdc6d2

@ -660,3 +660,15 @@ CREATE TABLE `act_charity` (
`active_time` date DEFAULT NULL, `active_time` date DEFAULT NULL,
PRIMARY KEY (`client_moniker`) PRIMARY KEY (`client_moniker`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; ) 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;

@ -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; 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.*;
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 com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
@ -32,6 +28,9 @@ public interface RiskMerchantService {
JSONObject getRiskDetails(QueryRiskDetail queryRiskDetail); 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; 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.*;
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.merchants.core.ClientManager; 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.*;
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.core.RiskMerchantService; import au.com.royalpay.payment.manage.risk.core.RiskMerchantService;
import au.com.royalpay.payment.tools.exceptions.BadRequestException; import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.exceptions.NotFoundException; import au.com.royalpay.payment.tools.exceptions.NotFoundException;
import au.com.royalpay.payment.tools.utils.PageListUtils; import au.com.royalpay.payment.tools.utils.PageListUtils;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.Order;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds; import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@ -39,6 +33,8 @@ public class RiskMerchantServiceImpl implements RiskMerchantService {
private RiskWhiteListMapper riskWhiteListMapper; private RiskWhiteListMapper riskWhiteListMapper;
@Resource @Resource
private ClientManager clientManager; private ClientManager clientManager;
@Resource
private RiskAttentionMerchantsAMapper riskAttentionMerchantsAMapper;
@Override @Override
@Transactional @Transactional
@ -213,4 +209,55 @@ public class RiskMerchantServiceImpl implements RiskMerchantService {
riskMerchantDetailLogMapper.query(queryRiskDetail.toParams(), new PageBounds(queryRiskDetail.getPage(), queryRiskDetail.getLimit()))); 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; package au.com.royalpay.payment.manage.risk.web;
import au.com.royalpay.payment.manage.permission.manager.ManagerMapping; 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.*;
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.core.RiskMerchantService; import au.com.royalpay.payment.manage.risk.core.RiskMerchantService;
import au.com.royalpay.payment.tools.CommonConsts; import au.com.royalpay.payment.tools.CommonConsts;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole; import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
@ -94,4 +90,18 @@ public class RiskController {
riskMerchantService.addDetailLog(addRiskDetailLog,manager); 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);
}
} }

@ -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>
Loading…
Cancel
Save