|
|
|
@ -8,13 +8,18 @@ import au.com.royalpay.payment.manage.mappers.riskbusiness.RiskFileMapper;
|
|
|
|
|
import au.com.royalpay.payment.manage.mappers.riskbusiness.RiskMaterialMapper;
|
|
|
|
|
import au.com.royalpay.payment.manage.mappers.system.ClientMapper;
|
|
|
|
|
import au.com.royalpay.payment.manage.mappers.system.ClientBDMapper;
|
|
|
|
|
import au.com.royalpay.payment.manage.merchants.beans.PartnerQuery;
|
|
|
|
|
import au.com.royalpay.payment.manage.notice.core.MailService;
|
|
|
|
|
import au.com.royalpay.payment.manage.riskbusiness.core.RiskBusinessService;
|
|
|
|
|
import au.com.royalpay.payment.manage.riskbusiness.enums.RiskResultTypeEnum;
|
|
|
|
|
import au.com.royalpay.payment.manage.signin.beans.TodoNotice;
|
|
|
|
|
import au.com.royalpay.payment.manage.signin.core.ManagerTodoNoticeProvider;
|
|
|
|
|
import au.com.royalpay.payment.manage.tradelog.core.TradeLogService;
|
|
|
|
|
import au.com.royalpay.payment.manage.riskbusiness.enums.RiskOrderTypeEnum;
|
|
|
|
|
import au.com.royalpay.payment.tools.env.PlatformEnvironment;
|
|
|
|
|
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
|
|
|
|
|
import au.com.royalpay.payment.tools.locale.LocaleSupport;
|
|
|
|
|
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
|
|
|
|
|
import au.com.royalpay.payment.tools.threadpool.RoyalThreadPoolExecutor;
|
|
|
|
|
import au.com.royalpay.payment.tools.utils.PageListUtils;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
@ -28,6 +33,8 @@ import org.apache.commons.lang3.time.DateFormatUtils;
|
|
|
|
|
import org.apache.commons.lang3.time.DateUtils;
|
|
|
|
|
import org.apache.poi.ss.usermodel.*;
|
|
|
|
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
@ -50,7 +57,9 @@ import java.util.concurrent.TimeUnit;
|
|
|
|
|
* @Date 2018/10/10 10:30
|
|
|
|
|
*/
|
|
|
|
|
@Service
|
|
|
|
|
public class RiskBusinessServiceImpl implements RiskBusinessService {
|
|
|
|
|
public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodoNoticeProvider {
|
|
|
|
|
|
|
|
|
|
private Logger logger = LoggerFactory.getLogger(RiskBusinessServiceImpl.class);
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private RiskEventMapper riskEventMapper;
|
|
|
|
@ -83,7 +92,13 @@ public class RiskBusinessServiceImpl implements RiskBusinessService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public JSONObject getRiskEventsByPage(JSONObject params) {
|
|
|
|
|
public JSONObject getRiskEventsByPage(JSONObject params, JSONObject manager) {
|
|
|
|
|
|
|
|
|
|
// TODO: 2018/10/19 BD看到的result_type应该是1或者4,后续改进
|
|
|
|
|
if (ManagerRole.BD_USER.hasRole(manager.getIntValue("role"))) {
|
|
|
|
|
params.put("bd_id", manager.getString("manager_id"));
|
|
|
|
|
params.put("result_type", RiskResultTypeEnum.SEND_EMAIL_TO_BD.getResultType());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PageList<JSONObject> riskEvents = riskEventMapper.listRisksByPage(params, new PageBounds(params.getInteger("page"), 10, Order.formString("create_time.desc")));
|
|
|
|
|
return PageListUtils.buildPageListResult(riskEvents);
|
|
|
|
@ -482,4 +497,34 @@ public class RiskBusinessServiceImpl implements RiskBusinessService {
|
|
|
|
|
}
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void checkTodo(JSONObject manager, List<TodoNotice> notices) {
|
|
|
|
|
// TODO: 2018/10/19 后面把if判断里面的权限改一下
|
|
|
|
|
if (ManagerRole.BD_USER.hasRole(manager.getIntValue("role"))) {
|
|
|
|
|
JSONObject params = new JSONObject();
|
|
|
|
|
params.put("bd_id", manager.getString("manager_id"));
|
|
|
|
|
params.put("date", new Date());
|
|
|
|
|
List<JSONObject> riskClientList = clientBDMapper.listBDClientInfo(params);
|
|
|
|
|
boolean noticeFlag = false;
|
|
|
|
|
for (JSONObject client : riskClientList) {
|
|
|
|
|
if (!noticeFlag) {
|
|
|
|
|
params.put("client_moniker", client.getString("client_moniker"));
|
|
|
|
|
List<JSONObject> riskEventList = riskEventMapper.findAll(params);
|
|
|
|
|
for (JSONObject event : riskEventList) {
|
|
|
|
|
if (event.getIntValue("result_type") == 1) {
|
|
|
|
|
noticeFlag = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (noticeFlag) {
|
|
|
|
|
String msg = LocaleSupport.localeMessage("todo.bd.order");
|
|
|
|
|
notices.add(new TodoNotice("riskBusiness", msg, "#/analysis/monitoring/risk_business"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|