master
kira 6 years ago
commit 09607c104d

@ -36,6 +36,7 @@ public class AnalysisBean {
private String amount_from;
private String amount_to;
private String bd_name;
private String timezone;
public JSONObject toParams(String timezone) {
JSONObject params = new JSONObject();
if (timezone != null) {
@ -229,4 +230,12 @@ public class AnalysisBean {
public void setBd_name(String bd_name) {
this.bd_name = bd_name;
}
public String getTimezone() {
return timezone;
}
public void setTimezone(String timezone) {
this.timezone = timezone;
}
}

@ -31,7 +31,7 @@ public class DashboardController {
@ManagerMapping("/common_analysis_1")
public JSONObject commonAnalysis1(AnalysisBean analysis, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
JSONObject params = analysis.toParams(null);
JSONObject params = analysis.toParams(analysis.getTimezone());
orgManager.checkOrg(manager,params);
return dashboardService.getCommonAnalysis1(params);
}

@ -1,5 +1,6 @@
package au.com.royalpay.payment.manage.mappers.risk;
import cn.yixblog.support.mybatis.autosql.annotations.AdvanceSelect;
import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper;
import cn.yixblog.support.mybatis.autosql.annotations.AutoSql;
import cn.yixblog.support.mybatis.autosql.annotations.SqlType;
@ -7,12 +8,15 @@ 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;
import org.apache.ibatis.annotations.Select;
import java.util.List;
/**
* Create by yixian at 2017-12-21 11:45
*/
@AutoMapper(tablename = "risk_attention_merchants", pkName = "client_id")
public interface RiskAttentionMerchantsAMapper {
public interface RiskAttentionMerchantsMapper {
@AutoSql(type = SqlType.UPDATE)
void update(JSONObject client);
@ -23,9 +27,18 @@ public interface RiskAttentionMerchantsAMapper {
JSONObject findById(@Param("id") String id);
@AutoSql(type = SqlType.SELECT)
JSONObject findByClientMoniker(@Param("client_moniker") String client_moniker);
JSONObject findByClientMoniker(@Param("client_moniker") String clientMoniker);
@AutoSql(type = SqlType.SELECT)
@AdvanceSelect(addonWhereClause = "is_valid=1")
PageList<JSONObject> query(JSONObject params, PageBounds pagination);
@Select("SELECT client_moniker FROM risk_attention_merchants " +
"WHERE (abn LIKE CONCAT('%',#{abn},'%') ) OR (acn LIKE CONCAT('%',#{acn},'%') ) " +
" OR (contact_phone LIKE CONCAT('%',#{contact_phone},'%') ) " +
" OR (contact_person LIKE CONCAT('%',#{contact_person},'%') ) " +
" OR (client_moniker LIKE CONCAT('%',#{client_moniker},'%') ) " +
" OR (bank_account_no LIKE CONCAT('%',#{bank_account_no},'%') ) ")
List<JSONObject> listRiskySimilarMerchants(JSONObject params);
}

@ -32,6 +32,7 @@ import javax.imageio.ImageIO;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import au.com.royalpay.payment.manage.mappers.risk.RiskAttentionMerchantsMapper;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.RandomStringUtils;
@ -294,6 +295,9 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
private PermissionClientModuleMapper permissionClientModuleMapper;
@Resource
private PermissionPartnerManagerImpl permissionPartnerManagerImpl;
@Resource
private RiskAttentionMerchantsMapper riskAttentionMerchantsMapper;
@Resource
private SmsSender smsSender;
private static final String SOURCE_AGREE_FILE = "source_agree_file";
@ -589,6 +593,9 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (clientMapper.findClientByMoniker(registery.getClientMoniker()) != null) {
throw new BadRequestException("error.partner.valid.dumplicate_client_moniker");
}
//检查商户是否进入系统黑名单
isRiskyMerchant(partner, null);
try {
clientMapper.save(partner);
@ -814,6 +821,10 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (client == null) {
throw new InvalidShortIdException();
}
//检查商户是否进入平台黑名单
int clientId = client.getIntValue("client_id");
isRiskyMerchant(client, clientBankAccountMapper.clientBankAccounts(clientId).get(0));
if (client.getString("sub_merchant_id") == null || client.getString("sub_merchant_id").equals("")) {
throw new BadRequestException("该商户未设置微信 Sub Merchant ID!");
}
@ -856,6 +867,10 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (client == null) {
throw new InvalidShortIdException();
}
//检查商户是否进入平台黑名单
int clientId = client.getIntValue("client_id");
isRiskyMerchant(client, clientBankAccountMapper.clientBankAccounts(clientId).get(0));
client.put("approve_result", 2);
client.put("approver", manager.getString("manager_id"));
client.put("approve_time", new Date());
@ -3743,10 +3758,31 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
}
@Override
public String getShortLink(String client_moniker) {
String longUrl = PlatformEnvironment.getEnv().concatUrl("/api/v1.0/hf_gateway/partners/" + client_moniker + "/jump");
public String getShortLink(String clientMoniker) {
String longUrl = PlatformEnvironment.getEnv().concatUrl("/api/v1.0/hf_gateway/partners/" + clientMoniker + "/jump");
MpWechatApi api = mpWechatApiProvider.getNewPaymentApi();
return api.registerShortUrl(longUrl);
}
private void isRiskyMerchant(JSONObject client, JSONObject bankAccount) {
JSONObject needCheckParams = new JSONObject();
needCheckParams.put("client_moniker", client.getString("client_moniker"));
needCheckParams.put("abn", client.getString("abn"));
needCheckParams.put("acn", client.getString("acn"));
needCheckParams.put("contact_phone", client.getString("contact_phone"));
needCheckParams.put("contact_person", client.getString("contact_person"));
if (bankAccount != null) {
needCheckParams.put("bank_account_no", bankAccount.getString("account_no"));
}
List<JSONObject> listRiskySimilarMerchants = riskAttentionMerchantsMapper.listRiskySimilarMerchants(needCheckParams);
StringBuilder appendStr = new StringBuilder();
listRiskySimilarMerchants.stream().forEach(json -> appendStr.append(json.getString("client_moniker")).append(","));
appendStr.deleteCharAt(appendStr.length() - 1);
if (listRiskySimilarMerchants.size() > 0) {
throw new BadRequestException("该商户信息已经进入系统黑名单,关联商户为【" + appendStr + "】");
}
}
}

@ -8,29 +8,29 @@ public interface RiskMerchantService {
void addDetailLog(AddRiskDetailLog addRiskDetailLog, JSONObject account);
void DropOrderRiskRecord(JSONObject account,String recordId);
void dropOrderRiskRecord(JSONObject account, String recordId);
void noopRiskRecord(JSONObject account, String recordId);
void dealRiskRecord(JSONObject account, DealRiskRecord dealRiskRecord);
void dealRiskRecordDirectly(JSONObject account,String record_id);
void dealRiskRecordDirectly(JSONObject account, String clientMoniker);
JSONObject getRiskOrders(QueryRiskOrder queryRiskOrder);
JSONObject getRiskRecords(QueryRiskRecord queryRiskRecord);
void addWhiteList(String client_moinker);
void addWhiteList(String clientMoniker);
void disableWhiteList(String client_moinker);
void disableWhiteList(String clientMoniker);
JSONObject getRecordById(String record_id);
JSONObject getRecordById(String recordId);
JSONObject getRiskDetails(QueryRiskDetail queryRiskDetail);
JSONObject listAttentionMerchants(JSONObject account,QueryAttentionMerchants queryAttention);
JSONObject listAttentionMerchants(JSONObject manager, QueryAttentionMerchants queryAttention);
void addAttentionMerchants(JSONObject account,String client_moniker);
void addAttentionMerchant(JSONObject manager, String clientMoniker);
void updateAttentionMerchants(JSONObject account,String client_moniker);
void disableAttentionMerchant(JSONObject manager, String clientMoniker);
}

@ -1,6 +1,7 @@
package au.com.royalpay.payment.manage.risk.core.impl;
import au.com.royalpay.payment.manage.mappers.risk.*;
import au.com.royalpay.payment.manage.mappers.system.ClientBankAccountMapper;
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.manage.risk.bean.*;
import au.com.royalpay.payment.manage.risk.core.RiskMerchantService;
@ -17,6 +18,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
@ -34,7 +36,9 @@ public class RiskMerchantServiceImpl implements RiskMerchantService {
@Resource
private ClientManager clientManager;
@Resource
private RiskAttentionMerchantsAMapper riskAttentionMerchantsAMapper;
private RiskAttentionMerchantsMapper riskAttentionMerchantsAMapper;
@Resource
private ClientBankAccountMapper clientBankAccountMapper;
@Override
@Transactional
@ -55,7 +59,7 @@ public class RiskMerchantServiceImpl implements RiskMerchantService {
@Override
@Transactional
public void DropOrderRiskRecord(JSONObject account, String recordId) {
public void dropOrderRiskRecord(JSONObject account, String recordId) {
JSONObject riskRecord = riskMerchantRecordMapper.findById(recordId);
if (riskRecord == null) {
throw new NotFoundException("Risk Record Not Found");
@ -170,14 +174,14 @@ public class RiskMerchantServiceImpl implements RiskMerchantService {
}
@Override
public void addWhiteList(String client_moinker) {
JSONObject white = riskWhiteListMapper.findByClientMoniker(client_moinker);
public void addWhiteList(String clientMoniker) {
JSONObject white = riskWhiteListMapper.findByClientMoniker(clientMoniker);
if (white != null) {
white.put("is_valid", true);
riskWhiteListMapper.update(white);
return;
}
JSONObject client = clientManager.getClientInfoByMoniker(client_moinker);
JSONObject client = clientManager.getClientInfoByMoniker(clientMoniker);
if (client == null) {
throw new NotFoundException("Merchant Not Found Please Check");
}
@ -189,8 +193,8 @@ public class RiskMerchantServiceImpl implements RiskMerchantService {
}
@Override
public void disableWhiteList(String client_moinker) {
JSONObject white = riskWhiteListMapper.findByClientMoniker(client_moinker);
public void disableWhiteList(String clientMoniker) {
JSONObject white = riskWhiteListMapper.findByClientMoniker(clientMoniker);
if (white == null) {
throw new NotFoundException("White List Not Found Please Check");
}
@ -199,8 +203,8 @@ public class RiskMerchantServiceImpl implements RiskMerchantService {
}
@Override
public JSONObject getRecordById(String record_id) {
return riskMerchantRecordMapper.findById(record_id);
public JSONObject getRecordById(String recordId) {
return riskMerchantRecordMapper.findById(recordId);
}
@Override
@ -211,53 +215,64 @@ public class RiskMerchantServiceImpl implements RiskMerchantService {
}
@Override
public JSONObject listAttentionMerchants(JSONObject account, QueryAttentionMerchants queryAttention) {
if (account == null) {
throw new BadRequestException("account not exists");
public JSONObject listAttentionMerchants(JSONObject manager, QueryAttentionMerchants queryAttention) {
if (manager == null) {
throw new BadRequestException("登录状态已过期,请清新登录再试");
}
return PageListUtils.buildPageListResult(
riskAttentionMerchantsAMapper.query(queryAttention.toParams(), new PageBounds(queryAttention.getPage(), queryAttention.getLimit(), Order.formString("create_time.desc"))));
riskAttentionMerchantsAMapper.query(queryAttention.toParams(), new PageBounds(queryAttention.getPage(), queryAttention.getLimit(), Order.formString("last_update_date.desc"))));
}
@Override
public void addAttentionMerchants(JSONObject account, String client_moniker) {
if (account == null) {
throw new BadRequestException("account not exists");
public void addAttentionMerchant(JSONObject manager, String clientMoniker) {
if (manager == null) {
throw new BadRequestException("登录状态已过期,请清新登录再试");
}
JSONObject client = clientManager.getClientInfoByMoniker(clientMoniker);
if (client == null) {
throw new BadRequestException("The Merchant does not exist");
}
JSONObject attentionMerchant = riskAttentionMerchantsAMapper.findByClientMoniker(client_moniker);
int clientId = client.getIntValue("client_id");
List<JSONObject> bankAccount = clientBankAccountMapper.clientBankAccounts(clientId);
JSONObject attention = new JSONObject();
attention.put("client_id", clientId);
attention.put("client_moniker", clientMoniker);
attention.put("abn", client.getString("abn"));
attention.put("acn", client.getString("acn"));
attention.put("contact_person", client.getString("contact_person"));
attention.put("contact_phone", client.getString("contact_phone"));
attention.put("bank_account_no", bankAccount == null || bankAccount.size() <= 0 ? "" : bankAccount.get(0).getString("account_no"));
attention.put("is_valid", 1);
attention.put("creation_date", new Date());
attention.put("creation_by", manager.getString("manager_id"));
attention.put("last_update_date", new Date());
attention.put("last_update_by", manager.getString("manager_id"));
JSONObject attentionMerchant = riskAttentionMerchantsAMapper.findByClientMoniker(clientMoniker);
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");
attention.remove("creation_date");
attention.remove("creation_by");
riskAttentionMerchantsAMapper.update(attention);
return;
}
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");
public void disableAttentionMerchant(JSONObject manager, String clientMoniker) {
if (manager == null) {
throw new BadRequestException("登录状态已过期,请清新登录再试");
}
JSONObject attentionMerchant = riskAttentionMerchantsAMapper.findByClientMoniker(client_moniker);
JSONObject attentionMerchant = riskAttentionMerchantsAMapper.findByClientMoniker(clientMoniker);
if (attentionMerchant == null) {
throw new BadRequestException("The client does not exist");
}
attentionMerchant.put("is_valid", 0);
attentionMerchant.put("update_time",new Date());
attentionMerchant.put("last_update_date", new Date());
attentionMerchant.put("last_update_by", manager.getString("manager_id"));
riskAttentionMerchantsAMapper.update(attentionMerchant);
}
}

@ -39,7 +39,7 @@ public class RiskController {
@RequestMapping(value = "/records/{record_id}/dropOrder", method = RequestMethod.PUT)
public void dropOrder(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @PathVariable String record_id) {
riskMerchantService.DropOrderRiskRecord(manager, record_id);
riskMerchantService.dropOrderRiskRecord(manager, record_id);
}
@RequestMapping(value = "/records/{record_id}/noop", method = RequestMethod.PUT)
@ -65,14 +65,14 @@ public class RiskController {
}
@RequestMapping(value = "/white/{client_moniker}", method = RequestMethod.POST)
public void addWhiteList(@PathVariable String client_moniker) {
riskMerchantService.addWhiteList(client_moniker);
@RequestMapping(value = "/white/{clientMoniker}", method = RequestMethod.POST)
public void addWhiteList(@PathVariable String clientMoniker) {
riskMerchantService.addWhiteList(clientMoniker);
}
@RequestMapping(value = "/white/{client_moniker}/disable", method = RequestMethod.PUT)
public void disableWhiteList(@PathVariable String client_moniker) {
riskMerchantService.disableWhiteList(client_moniker);
@RequestMapping(value = "/white/{clientMoniker}/disable", method = RequestMethod.PUT)
public void disableWhiteList(@PathVariable String clientMoniker) {
riskMerchantService.disableWhiteList(clientMoniker);
}
@RequestMapping(value = "/records/uploadFiles", method = RequestMethod.POST)
@ -91,17 +91,17 @@ public class RiskController {
}
@RequestMapping(value = "/attention", method = RequestMethod.GET)
public JSONObject listMerchants(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager,QueryAttentionMerchants queryAttention ) {
public JSONObject listMerchant(@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/{clientMoniker}", method = RequestMethod.POST)
public void addMerchant(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @PathVariable String clientMoniker) {
riskMerchantService.addAttentionMerchant(manager, clientMoniker);
}
@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);
@RequestMapping(value = "/attention/{clientMoniker}", method = RequestMethod.PUT)
public void disableRiskMerchant(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @PathVariable String clientMoniker) {
riskMerchantService.disableAttentionMerchant(manager, clientMoniker);
}
}

@ -28,7 +28,8 @@ require.config({
dragdrop: 'static/lib/angular-plugins/angular-drag-and-drop-lists.min',
echarts: 'static/lib/echarts/echarts.common.min',
angularEcharts: 'static/commons/angular-echarts',
decimal:'static/lib/decimal/decimal.min'
decimal:'static/lib/decimal/decimal.min',
jstz: 'static/lib/timezone/jstz-1.0.4.min'
},
shim: {
'angular': {deps: ['jquery'], exports: 'angular'},

@ -28,7 +28,8 @@ require.config({
dragdrop: 'static/lib/angular-plugins/angular-drag-and-drop-lists.min',
echarts: 'static/lib/echarts/echarts.common.min',
angularEcharts: 'static/commons/angular-echarts',
decimal:'static/lib/decimal/decimal.min'
decimal:'static/lib/decimal/decimal.min',
jstz: 'static/lib/timezone/jstz-1.0.4.min'
},
shim: {
'angular': {deps: ['jquery','decimal'], exports: 'angular'},

@ -30,7 +30,8 @@ require.config({
ueditor: 'static/lib/ueditor/ueditor.all.min',
ueditorConfig: 'static/lib/ueditor/ueditor.config',
angularEcharts: 'static/commons/angular-echarts',
decimal: 'static/lib/decimal/decimal.min'
decimal: 'static/lib/decimal/decimal.min',
jstz: 'static/lib/timezone/jstz-1.0.4.min'
},
shim: {
'angular': {deps: ['jquery', 'decimal'], exports: 'angular'},

@ -2,7 +2,7 @@
* Created by davep on 2016-07-27.
*/
define(['angular', 'uiRouter', 'uiBootstrap', 'angularEcharts'], function (angular) {
define(['angular', 'uiRouter', 'jstz', 'uiBootstrap', 'angularEcharts'], function (angular) {
'use strict';
var colors = ['#00c0ef', '#00a65a', '#ff851b', '#f39c12', '#d81b60', '#605ca8', '#dd4b39', '#008080', '#8B008B', '#D2691E', '#708090'];
var app = angular.module('dashboardApp', ['ui.router', 'ui.bootstrap', 'ngEcharts']);
@ -25,7 +25,8 @@ define(['angular', 'uiRouter', 'uiBootstrap', 'angularEcharts'], function (angul
params: function () {
return {
begin: $filter('date')(new Date(), 'yyyyMMdd'),
end: $filter('date')(new Date(), 'yyyyMMdd')
end: $filter('date')(new Date(), 'yyyyMMdd'),
timezone: jstz.determine().name()
}
}
},

File diff suppressed because one or more lines are too long

@ -48,15 +48,25 @@
<table class="table table-hover">
<thead>
<tr>
<th>Client Moniker</th>
<th>Create Time</th>
<th>Merchant Code</th>
<th>ABN</th>
<th>ACN</th>
<th>Account No</th>
<th>Contact Person</th>
<th>Contact Phone</th>
<th>Operation 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>{{client.abn}}</td>
<td>{{client.acn}}</td>
<td>{{client.bank_account_no}}</td>
<td>{{client.contact_person}}</td>
<td>{{client.contact_phone}}</td>
<td>{{client.last_update_date}}</td>
<td>
<a role="button" class="text-bold text-danger"
ng-click="disableAttention(client.client_moniker)">Disable</a>

Loading…
Cancel
Save