|
|
|
@ -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;
|
|
|
|
@ -34,7 +35,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 +58,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 +173,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 +192,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 +202,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 +214,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 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(clientMoniker);
|
|
|
|
|
if (client == null) {
|
|
|
|
|
throw new BadRequestException("The Merchant does not exist");
|
|
|
|
|
}
|
|
|
|
|
int clientId = client.getIntValue("client_id");
|
|
|
|
|
JSONObject bankAccount = clientBankAccountMapper.clientBankAccounts(clientId).get(0);
|
|
|
|
|
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.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");
|
|
|
|
|
}
|
|
|
|
|
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);
|
|
|
|
|
if(attentionMerchant == null){
|
|
|
|
|
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("is_valid", 0);
|
|
|
|
|
attentionMerchant.put("last_update_date", new Date());
|
|
|
|
|
attentionMerchant.put("last_update_by", manager.getString("manager_id"));
|
|
|
|
|
riskAttentionMerchantsAMapper.update(attentionMerchant);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|