risk control: chargeback

master
yixian 4 years ago
parent aa2e3acbb4
commit f837766573

@ -5,11 +5,11 @@
<parent> <parent>
<groupId>au.com.royalpay.payment</groupId> <groupId>au.com.royalpay.payment</groupId>
<artifactId>payment-parent</artifactId> <artifactId>payment-parent</artifactId>
<version>2.2.9</version> <version>2.2.10</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>manage</artifactId> <artifactId>manage</artifactId>
<version>2.3.48</version> <version>2.3.49</version>
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jib-maven-plugin.version>2.4.0</jib-maven-plugin.version> <jib-maven-plugin.version>2.4.0</jib-maven-plugin.version>

@ -5,9 +5,7 @@ import au.com.royalpay.payment.manage.risk.bean.*;
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;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -16,7 +14,7 @@ import javax.annotation.Resource;
* Created by wangning on 08/12/2016. * Created by wangning on 08/12/2016.
*/ */
@RestController @RestController
@ManagerMapping(value = "/sys/risk",role = {ManagerRole.ADMIN,ManagerRole.OPERATOR}) @ManagerMapping(value = "/sys/risk", role = {ManagerRole.ADMIN, ManagerRole.OPERATOR})
public class RiskController { public class RiskController {
@Resource @Resource
@ -47,17 +45,15 @@ public class RiskController {
riskMerchantService.dealRiskRecordDirectly(manager, record_id); riskMerchantService.dealRiskRecordDirectly(manager, record_id);
} }
@RequestMapping(value = "/records/{record_id}/deal",method = RequestMethod.PUT) @PutMapping("/records/{record_id}/deal")
public void dealRecord(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @PathVariable String record_id, @RequestBody DealRiskRecord dealRiskRecord){ public void dealRecord(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @PathVariable String record_id, @RequestBody DealRiskRecord dealRiskRecord) {
dealRiskRecord.setRecordId(record_id); dealRiskRecord.setRecordId(record_id);
riskMerchantService.dealRiskRecord(manager,dealRiskRecord); riskMerchantService.dealRiskRecord(manager, dealRiskRecord);
} }
@GetMapping("/orders") @GetMapping("/orders")
public JSONObject getRiskOrders(QueryRiskOrder queryRiskOrder) { public JSONObject getRiskOrders(QueryRiskOrder queryRiskOrder) {
return riskMerchantService.getRiskOrders(queryRiskOrder); return riskMerchantService.getRiskOrders(queryRiskOrder);
} }
@PostMapping("/white/{clientMoniker}") @PostMapping("/white/{clientMoniker}")
@ -71,13 +67,13 @@ public class RiskController {
} }
@PostMapping("/records/uploadFiles") @PostMapping("/records/uploadFiles")
public void addRecordLog(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager,@RequestBody AddRiskDetailLog addRiskDetailLog) { public void addRecordLog(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @RequestBody AddRiskDetailLog addRiskDetailLog) {
// riskMerchantService.addDetailLog(addRiskDetailLog,manager); // riskMerchantService.addDetailLog(addRiskDetailLog,manager);
} }
@GetMapping("/details") @GetMapping("/details")
public JSONObject listDetails(QueryRiskDetail queryRiskDetail) { public JSONObject listDetails(QueryRiskDetail queryRiskDetail) {
return riskMerchantService.getRiskDetails(queryRiskDetail); return riskMerchantService.getRiskDetails(queryRiskDetail);
} }
@PostMapping("/details/remark") @PostMapping("/details/remark")

@ -1,7 +1,7 @@
package au.com.royalpay.payment.manage.riskbusiness.core; package au.com.royalpay.payment.manage.riskbusiness.core;
import au.com.royalpay.payment.core.beans.ChargebackStatus;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
@ -143,5 +143,7 @@ public interface RiskBusinessService {
void completeOrderAmount(); void completeOrderAmount();
void UpdateRiskEventRemark(String riskId, String remark); void updateRiskEventRemark(String riskId, String remark);
void markChargebackStatus(String riskId, JSONObject manager, ChargebackStatus status);
} }

@ -1,8 +1,9 @@
package au.com.royalpay.payment.manage.riskbusiness.core.impl; package au.com.royalpay.payment.manage.riskbusiness.core.impl;
import au.com.royalpay.payment.core.CardSecureService;
import au.com.royalpay.payment.core.beans.ChargebackStatus;
import au.com.royalpay.payment.core.exceptions.EmailException; import au.com.royalpay.payment.core.exceptions.EmailException;
import au.com.royalpay.payment.core.exceptions.InvalidShortIdException; import au.com.royalpay.payment.core.exceptions.InvalidShortIdException;
import au.com.royalpay.payment.core.exceptions.OrderNotExistsException;
import au.com.royalpay.payment.core.exceptions.OrderNotMatchException; import au.com.royalpay.payment.core.exceptions.OrderNotMatchException;
import au.com.royalpay.payment.manage.mappers.log.AppMessageLogMapper; import au.com.royalpay.payment.manage.mappers.log.AppMessageLogMapper;
import au.com.royalpay.payment.manage.mappers.payment.OrderMapper; import au.com.royalpay.payment.manage.mappers.payment.OrderMapper;
@ -20,11 +21,11 @@ import au.com.royalpay.payment.manage.riskbusiness.core.RiskMaterialService;
import au.com.royalpay.payment.manage.riskbusiness.core.RiskProcessLogService; import au.com.royalpay.payment.manage.riskbusiness.core.RiskProcessLogService;
import au.com.royalpay.payment.manage.riskbusiness.core.RiskUploadService; import au.com.royalpay.payment.manage.riskbusiness.core.RiskUploadService;
import au.com.royalpay.payment.manage.riskbusiness.enums.RiskEmailStatusEnum; import au.com.royalpay.payment.manage.riskbusiness.enums.RiskEmailStatusEnum;
import au.com.royalpay.payment.manage.riskbusiness.enums.RiskOrderTypeEnum;
import au.com.royalpay.payment.manage.riskbusiness.enums.RiskResultTypeEnum; 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.beans.TodoNotice;
import au.com.royalpay.payment.manage.signin.core.ManagerTodoNoticeProvider; import au.com.royalpay.payment.manage.signin.core.ManagerTodoNoticeProvider;
import au.com.royalpay.payment.manage.tradelog.core.TradeLogService; import au.com.royalpay.payment.manage.tradelog.core.TradeLogService;
import au.com.royalpay.payment.manage.riskbusiness.enums.RiskOrderTypeEnum;
import au.com.royalpay.payment.tools.connections.mpsupport.MpWechatApi; import au.com.royalpay.payment.tools.connections.mpsupport.MpWechatApi;
import au.com.royalpay.payment.tools.connections.mpsupport.MpWechatApiProvider; import au.com.royalpay.payment.tools.connections.mpsupport.MpWechatApiProvider;
import au.com.royalpay.payment.tools.connections.mpsupport.beans.TemplateMessage; import au.com.royalpay.payment.tools.connections.mpsupport.beans.TemplateMessage;
@ -34,23 +35,28 @@ import au.com.royalpay.payment.tools.device.message.AppMsgSender;
import au.com.royalpay.payment.tools.env.PlatformEnvironment; import au.com.royalpay.payment.tools.env.PlatformEnvironment;
import au.com.royalpay.payment.tools.env.SysConfigManager; import au.com.royalpay.payment.tools.env.SysConfigManager;
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.ServerErrorException;
import au.com.royalpay.payment.tools.exceptions.event.WechatExceptionEvent; import au.com.royalpay.payment.tools.exceptions.event.WechatExceptionEvent;
import au.com.royalpay.payment.tools.locale.LocaleSupport; import au.com.royalpay.payment.tools.locale.LocaleSupport;
import au.com.royalpay.payment.tools.mappers.CommonRiskEventMapper;
import au.com.royalpay.payment.tools.mappers.RiskEventDAO;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole; import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import au.com.royalpay.payment.tools.exceptions.ServerErrorException; import au.com.royalpay.payment.tools.risk.RiskEvent;
import au.com.royalpay.payment.tools.threadpool.RoyalThreadPoolExecutor; import au.com.royalpay.payment.tools.threadpool.RoyalThreadPoolExecutor;
import au.com.royalpay.payment.tools.utils.PageListUtils; import au.com.royalpay.payment.tools.utils.PageListUtils;
import com.alibaba.fastjson.JSON;
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.Order;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds; import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList; import com.github.miemiedev.mybatis.paginator.domain.PageList;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.lang3.RandomStringUtils; import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateFormatUtils; import org.apache.commons.lang3.time.DateFormatUtils;
import org.apache.commons.lang3.time.DateUtils; import org.apache.commons.lang3.time.DateUtils;
import org.apache.poi.ss.usermodel.*; import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -62,17 +68,19 @@ import org.springframework.transaction.annotation.Transactional;
import org.thymeleaf.context.Context; import org.thymeleaf.context.Context;
import org.thymeleaf.spring5.SpringTemplateEngine; import org.thymeleaf.spring5.SpringTemplateEngine;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.*; import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL; import java.net.URL;
import java.text.ParseException; import java.text.ParseException;
import java.util.*; import java.util.*;
import javax.annotation.Resource;
import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream; import java.util.zip.ZipOutputStream;
import java.util.concurrent.TimeUnit;
/** /**
* @Author lvjian * @Author lvjian
@ -80,12 +88,20 @@ import java.util.concurrent.TimeUnit;
*/ */
@Service @Service
public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodoNoticeProvider, ApplicationEventPublisherAware { public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodoNoticeProvider, ApplicationEventPublisherAware {
public static final int RISK_ORDER_TYPE_WX = 1;
public static final int RISK_ORDER_TYPE_ALIPAY = 2;
public static final int RISK_ORDER_TYPE_RP = 3;
public static final int RISK_ORDER_TYPE_WARN = 4;
public static final int RISK_ORDER_TYPE_COMMON_MID = 5;
public static final int RISK_ORDER_TYPE_CHARGEBACK = 6;
private Logger logger = LoggerFactory.getLogger(RiskBusinessServiceImpl.class); private Logger logger = LoggerFactory.getLogger(RiskBusinessServiceImpl.class);
@Resource @Resource
private RiskEventMapper riskEventMapper; private RiskEventMapper riskEventMapper;
@Resource @Resource
private CommonRiskEventMapper commonRiskEventMapper;
@Resource
private ClientMapper clientMapper; private ClientMapper clientMapper;
@Resource @Resource
private ClientBDMapper clientBDMapper; private ClientBDMapper clientBDMapper;
@ -123,11 +139,13 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
@Resource @Resource
private AppMessageLogMapper appMessageLogMapper; private AppMessageLogMapper appMessageLogMapper;
private Map<String, AppMsgSender> senderMap = new HashMap<>(); private final Map<String, AppMsgSender> senderMap = new HashMap<>();
@Resource @Resource
private APNSMessageHelper apnsMessageHelper; private APNSMessageHelper apnsMessageHelper;
@Resource @Resource
private CardSecureService cardSecureService;
@Resource
private ManagerMapper managerMapper; private ManagerMapper managerMapper;
@Resource @Resource
private ClientAccountMapper clientAccountMapper; private ClientAccountMapper clientAccountMapper;
@ -144,7 +162,7 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
Arrays.stream(senders).forEach(appMsgSender -> senderMap.put(appMsgSender.devType(), appMsgSender)); Arrays.stream(senders).forEach(appMsgSender -> senderMap.put(appMsgSender.devType(), appMsgSender));
} }
private ThreadPoolExecutor sendingAppleMsgPool = new ThreadPoolExecutor(10, 30, 5, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>()); private final ThreadPoolExecutor sendingAppleMsgPool = new ThreadPoolExecutor(10, 30, 5, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>());
@Override @Override
public List<JSONObject> getRiskEvents(JSONObject params) { public List<JSONObject> getRiskEvents(JSONObject params) {
@ -158,7 +176,7 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
if (manager != null && ManagerRole.BD_USER.hasRole(manager.getIntValue("role"))) { if (manager != null && ManagerRole.BD_USER.hasRole(manager.getIntValue("role"))) {
params.put("bd_id", manager.getString("manager_id")); params.put("bd_id", manager.getString("manager_id"));
List<Integer> orderTypes = Arrays.asList(RiskOrderTypeEnum.WECHAT_ORDER.getOrderType(), List<Integer> orderTypes = Arrays.asList(RiskOrderTypeEnum.WECHAT_ORDER.getOrderType(),
RiskOrderTypeEnum.ALIPAY_ORDER.getOrderType(),RiskOrderTypeEnum.ROYALPAY_ORDER.getOrderType()); RiskOrderTypeEnum.ALIPAY_ORDER.getOrderType(), RiskOrderTypeEnum.ROYALPAY_ORDER.getOrderType());
params.put("order_types", orderTypes); params.put("order_types", orderTypes);
List<Integer> resultTypes = Arrays.asList(RiskResultTypeEnum.SEND_EMAIL_TO_BD.getResultType(), List<Integer> resultTypes = Arrays.asList(RiskResultTypeEnum.SEND_EMAIL_TO_BD.getResultType(),
@ -176,8 +194,10 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
* royalpay * royalpay
* *
*/ */
Date currentDate = new Date(), replyDate; Date currentDate = new Date();
Integer resultType, orderType; Date replyDate;
Integer resultType;
Integer orderType;
boolean isPassTimeout = false; boolean isPassTimeout = false;
for (JSONObject riskEvent : riskEvents) { for (JSONObject riskEvent : riskEvents) {
try { try {
@ -206,15 +226,15 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
@Override @Override
public List<JSONObject> analysisByIndustry(JSONObject params, JSONObject manager) { public List<JSONObject> analysisByIndustry(JSONObject params, JSONObject manager) {
List<JSONObject> industryAnalysis = riskEventMapper.analysisByIndustry(params); List<JSONObject> industryAnalysis = riskEventMapper.analysisByIndustry(params);
for(JSONObject industry:industryAnalysis){ for (JSONObject industry : industryAnalysis) {
if(StringUtils.isBlank(industry.getString("industry"))){ if (StringUtils.isBlank(industry.getString("industry"))) {
industry.put("industry","未知行业"); industry.put("industry", "未知行业");
} }
} }
return industryAnalysis; return industryAnalysis;
} }
private List<String> industryArray(){ private List<String> industryArray() {
List<String> industryArray = new ArrayList<>(); List<String> industryArray = new ArrayList<>();
industryArray.add("鞋包服饰"); industryArray.add("鞋包服饰");
industryArray.add("机票行业"); industryArray.add("机票行业");
@ -278,13 +298,13 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
* *
*/ */
if (riskEvent.getIntValue("order_type") == 3) { if (riskEvent.getIntValue("order_type") == 3) {
for (int i = 0; i < orderIdArray.length; i++) { for (String orderId : orderIdArray) {
orderInfo = tradeLogService.getOrderDetail(new JSONObject(), riskEvent.getString("client_moniker"), orderIdArray[i], null); orderInfo = tradeLogService.getOrderDetail(new JSONObject(), riskEvent.getString("client_moniker"), orderId, null);
tradeLogs.add(orderInfo); tradeLogs.add(orderInfo);
} }
} else { } else {
for (int i = 0; i < orderIdArray.length; i++) { for (String orderId : orderIdArray) {
orderInfo = orderMapper.findOrderById(orderIdArray[i],client.getIntValue("client_id")); orderInfo = orderMapper.findOrderById(orderId, client.getIntValue("client_id"));
tradeLogs.add(orderInfo); tradeLogs.add(orderInfo);
} }
} }
@ -298,7 +318,7 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
String clientMoniker = params.getString("client_moniker"); String clientMoniker = params.getString("client_moniker");
if (clientMoniker != null) { if (clientMoniker != null) {
client = clientMapper.findClientByMonikerAll(clientMoniker); client = clientMapper.findClientByMonikerAll(clientMoniker);
if(client == null){ if (client == null) {
throw new InvalidShortIdException(); throw new InvalidShortIdException();
} }
} }
@ -322,7 +342,7 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
PageList<JSONObject> transactionList = transactionMapper.findByClientIdAndSystemTransactionId(client.getIntValue("client_id"), orderIdArray[i], new PageBounds(Order.formString("transaction_time.desc"))); PageList<JSONObject> transactionList = transactionMapper.findByClientIdAndSystemTransactionId(client.getIntValue("client_id"), orderIdArray[i], new PageBounds(Order.formString("transaction_time.desc")));
// 判断该笔订单是否存在,是否属于该商户 // 判断该笔订单是否存在,是否属于该商户
// 由于查询订单时已经关联商户了,所以只会抛出订单不匹配的异常 // 由于查询订单时已经关联商户了,所以只会抛出订单不匹配的异常
if (transactionList == null || transactionList.size() <= 0) if (transactionList == null || transactionList.isEmpty())
throw new OrderNotMatchException(); throw new OrderNotMatchException();
/* /*
else { else {
@ -349,6 +369,7 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
* *
* risk_orders * risk_orders
* *
*
* @param params * @param params
* @param manager * @param manager
*/ */
@ -364,38 +385,51 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
RiskResultTypeEnum.NOT_HANDLED.getRemark(), RiskResultTypeEnum.NOT_HANDLED.getRemark(),
RiskResultTypeEnum.NOT_HANDLED.getResultType(), RiskResultTypeEnum.NOT_HANDLED.getResultType(),
RiskResultTypeEnum.NOT_HANDLED.getResultType()); RiskResultTypeEnum.NOT_HANDLED.getResultType());
int orderType = params.getIntValue("order_type");
if (orderType == RISK_ORDER_TYPE_CHARGEBACK) {
logger.info("Chargeback event");
RiskEvent evt = getRiskEvent(params.getString("risk_id"));
if (evt == null) {
return;
}
cardSecureService.submitChargeBackReport(evt);
}
}
private RiskEvent getRiskEvent(String riskId) {
return Optional.ofNullable(commonRiskEventMapper.findById(riskId)).map(RiskEventDAO::convert).orElse(null);
} }
private void setRiskOrders(JSONObject params){ private void setRiskOrders(JSONObject params) {
if(StringUtils.isNotBlank(params.getString("real_order_ids"))){ if (StringUtils.isNotBlank(params.getString("real_order_ids"))) {
String riskId = params.getString("risk_id"); String riskId = params.getString("risk_id");
String orderIds = params.getString("real_order_ids"); String orderIds = params.getString("real_order_ids");
for(String orderId : orderIds.split(",")){ for (String orderId : orderIds.split(",")) {
JSONObject order = transactionMapper.findByOrderId(orderId); JSONObject order = transactionMapper.findByOrderId(orderId);
JSONObject riskOrder = new JSONObject(); JSONObject riskOrder = new JSONObject();
riskOrder.put("risk_id",riskId); riskOrder.put("risk_id", riskId);
riskOrder.put("order_id",orderId); riskOrder.put("order_id", orderId);
riskOrder.put("clearing_amount",order.getString("clearing_amount")); riskOrder.put("clearing_amount", order.getString("clearing_amount"));
riskOrdersMapper.save(riskOrder); riskOrdersMapper.save(riskOrder);
} }
} }
} }
@Override @Override
public void updateRiskEvent(JSONObject params,JSONObject manager) { public void updateRiskEvent(JSONObject params, JSONObject manager) {
if(StringUtils.isNotBlank(params.getString("channel_result"))){ if (StringUtils.isNotBlank(params.getString("channel_result"))) {
JSONObject risk = riskEventMapper.findById(params.getString("risk_id")); JSONObject risk = riskEventMapper.findById(params.getString("risk_id"));
//填写渠道处理结果时候,支付宝、微信和内部调单在材料审核通过前无法填写渠道处理结果 //填写渠道处理结果时候,支付宝、微信和内部调单在材料审核通过前无法填写渠道处理结果
if(params.getIntValue("result_type") < RiskResultTypeEnum.MATERIAL_AUDIT_PASS.getResultType() && params.getIntValue("order_type") < RiskOrderTypeEnum.WARNING_ORDER.getOrderType()){ if (params.getIntValue("result_type") < RiskResultTypeEnum.MATERIAL_AUDIT_PASS.getResultType() && params.getIntValue("order_type") < RiskOrderTypeEnum.WARNING_ORDER.getOrderType()) {
throw new BadRequestException("请先提交渠道方材料进行审核!"); throw new BadRequestException("请先提交渠道方材料进行审核!");
} }
//渠道处理结果不一样,才会记录操作并更改事件单状态为渠道方处理结果 //渠道处理结果不一样,才会记录操作并更改事件单状态为渠道方处理结果
if(risk.getString("channel_result")==null || !risk.getString("channel_result").equals(params.getString("channel_result"))){ if (risk.getString("channel_result") == null || !risk.getString("channel_result").equals(params.getString("channel_result"))) {
params.put("result_type",RiskResultTypeEnum.ALREADY_HANDLED.getResultType()); params.put("result_type", RiskResultTypeEnum.ALREADY_HANDLED.getResultType());
riskProcessLogService.addRiskProcessLog(params.getString("risk_id"), riskProcessLogService.addRiskProcessLog(params.getString("risk_id"),
manager.getString("manager_id"), manager.getString("manager_id"),
manager.getString("display_name"), manager.getString("display_name"),
RiskResultTypeEnum.ALREADY_HANDLED.getRemark() + ":"+ params.getString("channel_result"), RiskResultTypeEnum.ALREADY_HANDLED.getRemark() + ":" + params.getString("channel_result"),
params.getIntValue("result_type"), params.getIntValue("result_type"),
RiskResultTypeEnum.ALREADY_HANDLED.getResultType()); RiskResultTypeEnum.ALREADY_HANDLED.getResultType());
} }
@ -411,12 +445,12 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
public void sendWxMess(JSONObject params, String channel, int result_type) { public void sendWxMess(JSONObject params, String channel, int result_type) {
String type = "禁用"; String type = "禁用";
if (params.get("temporary_close_merchant") != null) { if (params.get("temporary_close_merchant") != null) {
if (params.getBoolean("temporary_close_merchant")) { if (params.getBooleanValue("temporary_close_merchant")) {
type = "临时禁用"; type = "临时禁用";
} }
} }
if (params.get("temporary_close_channel") != null) { if (params.get("temporary_close_channel") != null) {
if (params.getBoolean("temporary_close_channel")) { if (params.getBooleanValue("temporary_close_channel")) {
type = "临时禁用"; type = "临时禁用";
} }
} }
@ -437,14 +471,14 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
for (String bdId : bdIdArray) { for (String bdId : bdIdArray) {
JSONObject bd = managerMapper.findById(bdId); JSONObject bd = managerMapper.findById(bdId);
if (bd != null) { if (bd != null) {
if (bd.get("wx_openid")!=null){ if (bd.get("wx_openid") != null) {
if (StringUtils.isNotBlank(bd.getString("wx_openid"))) { if (StringUtils.isNotBlank(bd.getString("wx_openid"))) {
try { try {
MpWechatApi paymentApi = mpWechatApiProvider.getNewPaymentApi(); MpWechatApi paymentApi = mpWechatApiProvider.getNewPaymentApi();
TemplateMessage msg = initSendBDCloseChannelAndPartnerTemplate(bd.getString("wx_openid"), paymentApi.getTemplateId("risk-forbidden-channelAndPartner"),client); TemplateMessage msg = initSendBDCloseChannelAndPartnerTemplate(bd.getString("wx_openid"), paymentApi.getTemplateId("risk-forbidden-channelAndPartner"), client);
paymentApi.sendTemplateMessage(msg); paymentApi.sendTemplateMessage(msg);
} catch (WechatException e) { } catch (WechatException e) {
logger.error("Wechat Message Error,风控关闭通道" + e.getMessage()); logger.error("Wechat Message Error,风控关闭通道{}", e.getMessage());
publisher.publishEvent(new WechatExceptionEvent(this, e, "风控关闭通道")); publisher.publishEvent(new WechatExceptionEvent(this, e, "风控关闭通道"));
} }
} }
@ -455,14 +489,14 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
List<JSONObject> accounts = clientAccountMapper.listRiskNoticeAccounts(client.getIntValue("client_id")); List<JSONObject> accounts = clientAccountMapper.listRiskNoticeAccounts(client.getIntValue("client_id"));
if (accounts != null) { if (accounts != null) {
for (JSONObject account : accounts) { for (JSONObject account : accounts) {
if (account.get("wechat_openid")!=null){ if (account.get("wechat_openid") != null) {
if (StringUtils.isNotBlank(account.getString("wechat_openid"))) { if (StringUtils.isNotBlank(account.getString("wechat_openid"))) {
try { try {
MpWechatApi paymentApi = mpWechatApiProvider.getNewPaymentApi(); MpWechatApi paymentApi = mpWechatApiProvider.getNewPaymentApi();
TemplateMessage msg = initSendPartnerCloseChannelAndPartnerTemplate(account.getString("wechat_openid"), paymentApi.getTemplateId("risk-forbidden-channelAndPartner"),client); TemplateMessage msg = initSendPartnerCloseChannelAndPartnerTemplate(account.getString("wechat_openid"), paymentApi.getTemplateId("risk-forbidden-channelAndPartner"), client);
paymentApi.sendTemplateMessage(msg); paymentApi.sendTemplateMessage(msg);
} catch (WechatException e) { } catch (WechatException e) {
logger.error("Wechat Message Error,风控关闭通道" + e.getMessage()); logger.error("Wechat Message Error,风控关闭通道,{}", e.getMessage());
publisher.publishEvent(new WechatExceptionEvent(this, e, "风控关闭通道")); publisher.publishEvent(new WechatExceptionEvent(this, e, "风控关闭通道"));
} }
} }
@ -473,26 +507,27 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
} }
private TemplateMessage initSendBDCloseChannelAndPartnerTemplate(String wxopenid, String templateId,JSONObject client) { private TemplateMessage initSendBDCloseChannelAndPartnerTemplate(String wxopenid, String templateId, JSONObject client) {
TemplateMessage msg = new TemplateMessage(wxopenid, templateId,null); TemplateMessage msg = new TemplateMessage(wxopenid, templateId, null);
//1:关闭渠道;2:关闭商户 //1:关闭渠道;2:关闭商户
if (client.getIntValue("result_type") == 1) { if (client.getIntValue("result_type") == 1) {
msg.put("first", "您的商户("+client.getString("client_moniker")+")" + client.getString("channel") + "支付渠道已"+client.getString("close_type"), "#000000"); msg.put("first", "您的商户(" + client.getString("client_moniker") + ")" + client.getString("channel") + "支付渠道已" + client.getString("close_type"), "#000000");
}else { } else {
msg.put("first", "您的商户("+client.getString("client_moniker")+")已"+client.getString("close_type"), "#000000"); msg.put("first", "您的商户(" + client.getString("client_moniker") + ")已" + client.getString("close_type"), "#000000");
} }
msg.put("keyword1", client.getString("channel") + "风控调单", "#0000ff"); msg.put("keyword1", client.getString("channel") + "风控调单", "#0000ff");
msg.put("keyword2", DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm:ss"), "#000000"); msg.put("keyword2", DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm:ss"), "#000000");
msg.put("remark", "请联系商户尽快配合风控部门上传相应资料,以免影响支付", "#0000FF"); msg.put("remark", "请联系商户尽快配合风控部门上传相应资料,以免影响支付", "#0000FF");
return msg; return msg;
} }
private TemplateMessage initSendPartnerCloseChannelAndPartnerTemplate(String wxopenid, String templateId,JSONObject client) {
TemplateMessage msg = new TemplateMessage(wxopenid, templateId,null); private TemplateMessage initSendPartnerCloseChannelAndPartnerTemplate(String wxopenid, String templateId, JSONObject client) {
TemplateMessage msg = new TemplateMessage(wxopenid, templateId, null);
//1:关闭渠道;2:关闭商户 //1:关闭渠道;2:关闭商户
if (client.getIntValue("result_type") == 1) { if (client.getIntValue("result_type") == 1) {
msg.put("first", "您的商户" + client.getString("channel") + "支付渠道已"+client.getString("close_type"), "#000000"); msg.put("first", "您的商户" + client.getString("channel") + "支付渠道已" + client.getString("close_type"), "#000000");
}else { } else {
msg.put("first", "您的商户("+client.getString("client_moniker")+")已"+client.getString("close_type"), "#000000"); msg.put("first", "您的商户(" + client.getString("client_moniker") + ")已" + client.getString("close_type"), "#000000");
} }
msg.put("keyword1", client.getString("channel") + "风控调单", "#0000ff"); msg.put("keyword1", client.getString("channel") + "风控调单", "#0000ff");
msg.put("keyword2", DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm:ss"), "#000000"); msg.put("keyword2", DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm:ss"), "#000000");
@ -507,6 +542,7 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
/** /**
* *
*
* @param riskId * @param riskId
* @param response * @param response
*/ */
@ -524,11 +560,11 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
response.setContentType("application/octet-stream"); response.setContentType("application/octet-stream");
response.setHeader("Content-Disposition", "attachment;filename=" + downloadFilename); response.setHeader("Content-Disposition", "attachment;filename=" + downloadFilename);
ZipOutputStream zos = new ZipOutputStream(response.getOutputStream()); ZipOutputStream zos = new ZipOutputStream(response.getOutputStream());
for(int i = 1; i <= 6; i++){ for (int i = 1; i <= 6; i++) {
if(riskMaterial.containsKey("file" + i)){ if (riskMaterial.containsKey("file" + i)) {
List<String> fileList= (List<String>) riskMaterial.get("file"+i); List<String> fileList = (List<String>) riskMaterial.get("file" + i);
for(String fileUrl : fileList){ for (String fileUrl : fileList) {
zos.putNextEntry(new ZipEntry("file" + i+fileUrl.substring(fileUrl.lastIndexOf("/")))); zos.putNextEntry(new ZipEntry("file" + i + fileUrl.substring(fileUrl.lastIndexOf("/"))));
InputStream inputStream = new URL(fileUrl).openConnection().getInputStream(); InputStream inputStream = new URL(fileUrl).openConnection().getInputStream();
byte[] buffer = new byte[1024]; byte[] buffer = new byte[1024];
int result = 0; int result = 0;
@ -551,6 +587,7 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
* *
* *
* App * App
*
* @param riskId * @param riskId
* @throws IOException * @throws IOException
*/ */
@ -558,22 +595,22 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
public void sendUploadEmail(String riskId) throws IOException { public void sendUploadEmail(String riskId) throws IOException {
JSONObject event = getRiskEventDetail(riskId); JSONObject event = getRiskEventDetail(riskId);
Context ctx = getMailContext(event); Context ctx = getMailContext(event);
final List<String> emailsTos = (List<String>)ctx.getVariable("emailsTos"); final List<String> emailsTos = (List<String>) ctx.getVariable("emailsTos");
final List<String> emailsCcs = ctx.getVariable("emailsCcs")==null?new ArrayList<>():(List<String>)ctx.getVariable("emailsCcs"); final List<String> emailsCcs = ctx.getVariable("emailsCcs") == null ? new ArrayList<>() : (List<String>) ctx.getVariable("emailsCcs");
final List<String> emailsBccs = ctx.getVariable("emailsBccs") == null ? new ArrayList<>() : (List<String>) ctx.getVariable("emailsBccs"); final List<String> emailsBccs = ctx.getVariable("emailsBccs") == null ? new ArrayList<>() : (List<String>) ctx.getVariable("emailsBccs");
final String title = (String)ctx.getVariable("title"); final String title = (String) ctx.getVariable("title");
final String content = thymeleaf.process("mail/risk_upload_mail.html", ctx); final String content = thymeleaf.process("mail/risk_upload_mail.html", ctx);
final String uploadUrl = (String)ctx.getVariable("uploadUrl"); final String uploadUrl = (String) ctx.getVariable("uploadUrl");
royalThreadPoolExecutor.execute(() -> { royalThreadPoolExecutor.execute(() -> {
try { try {
String emailId = mailService.sendRiskEmail(title, String emailId = mailService.sendRiskEmail(title,
emailsTos.isEmpty() ? "" : StringUtils.join(emailsTos, ","), emailsTos.isEmpty() ? "" : StringUtils.join(emailsTos, ","),
emailsCcs.isEmpty() ? "" : StringUtils.join(emailsCcs, ","), emailsCcs.isEmpty() ? "" : StringUtils.join(emailsCcs, ","),
emailsBccs.isEmpty() ? "" : StringUtils.join(emailsBccs, ","), emailsBccs.isEmpty() ? "" : StringUtils.join(emailsBccs, ","),
content, null,event.getIntValue("order_type")); content, null, event.getIntValue("order_type"));
event.put("email_status", RiskEmailStatusEnum.ALREADY_SEND.getEmailStatus()); event.put("email_status", RiskEmailStatusEnum.ALREADY_SEND.getEmailStatus());
event.put("result_type", RiskResultTypeEnum.SEND_EMAIL_TO_BD.getResultType()); event.put("result_type", RiskResultTypeEnum.SEND_EMAIL_TO_BD.getResultType());
event.put("submit_url",uploadUrl); event.put("submit_url", uploadUrl);
Integer orderType = event.getInteger("order_type"); Integer orderType = event.getInteger("order_type");
if (orderType.equals(RiskOrderTypeEnum.WARNING_ORDER.getOrderType())) { if (orderType.equals(RiskOrderTypeEnum.WARNING_ORDER.getOrderType())) {
event.put("result_type", RiskResultTypeEnum.ALREADY_HANDLED.getResultType()); event.put("result_type", RiskResultTypeEnum.ALREADY_HANDLED.getResultType());
@ -585,7 +622,7 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
RiskResultTypeEnum.SEND_EMAIL_TO_BD.getRemark(), RiskResultTypeEnum.SEND_EMAIL_TO_BD.getRemark(),
RiskResultTypeEnum.NOT_HANDLED.getResultType(), RiskResultTypeEnum.NOT_HANDLED.getResultType(),
RiskResultTypeEnum.SEND_EMAIL_TO_BD.getResultType()); RiskResultTypeEnum.SEND_EMAIL_TO_BD.getResultType());
if(event.getIntValue("is_send_client") == 1){ if (event.getIntValue("is_send_client") == 1) {
sendAppRiskMessage(event); sendAppRiskMessage(event);
} }
} catch (Exception e) { } catch (Exception e) {
@ -597,11 +634,12 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
/** /**
* App * App
* risk * risk
*
* @param event * @param event
*/ */
private void sendAppRiskMessage(JSONObject event){ private void sendAppRiskMessage(JSONObject event) {
JSONObject client = clientMapper.findClientByMoniker(event.getString("client_moniker")); JSONObject client = clientMapper.findClientByMoniker(event.getString("client_moniker"));
logger.debug("sendRiskAppMessage-" + client.getString("client_moniker") + "-" + "risk_id:"+event.getString("risk_id")); logger.debug("sendRiskAppMessage-{}-risk_id:{}", client.getString("client_moniker"), event.getString("risk_id"));
List<JSONObject> tokens = clientDeviceTokenMapper.listTokensByClient_id(client.getIntValue("client_id")); List<JSONObject> tokens = clientDeviceTokenMapper.listTokensByClient_id(client.getIntValue("client_id"));
for (JSONObject devToken : tokens) { for (JSONObject devToken : tokens) {
Runnable task = () -> { Runnable task = () -> {
@ -634,7 +672,7 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
log.put("status", 2); log.put("status", 2);
appMessageLogMapper.update(log); appMessageLogMapper.update(log);
} catch (Exception e) { } catch (Exception e) {
logger.error("出错了:" + e.getMessage()); logger.error("出错了:{}", e.getMessage());
appMessageLogMapper.updateStatus(log.getString("send_id"), 1, e.getMessage()); appMessageLogMapper.updateStatus(log.getString("send_id"), 1, e.getMessage());
throw new ServerErrorException("Send App " + devToken.getString("client_type") + " Failed" + ",token" + token, e); throw new ServerErrorException("Send App " + devToken.getString("client_type") + " Failed" + ",token" + token, e);
} }
@ -645,6 +683,7 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
/** /**
* *
*
* @param dev_id * @param dev_id
* @param client_id * @param client_id
* @param messageType * @param messageType
@ -670,6 +709,7 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
* *
* *
* *
*
* @param riskId * @param riskId
* @param refuseDescription * @param refuseDescription
* @throws IOException * @throws IOException
@ -683,29 +723,29 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
throw new BadRequestException("Refused Already!"); throw new BadRequestException("Refused Already!");
} else if (RiskResultTypeEnum.MATERIAL_AUDIT_PASS.getResultType().intValue() == resultType) { } else if (RiskResultTypeEnum.MATERIAL_AUDIT_PASS.getResultType().intValue() == resultType) {
throw new BadRequestException("Passed Already!"); throw new BadRequestException("Passed Already!");
} else if (RiskResultTypeEnum.WAIT_FOR_AUDIT.getResultType().intValue() != resultType){ } else if (RiskResultTypeEnum.WAIT_FOR_AUDIT.getResultType().intValue() != resultType) {
throw new BadRequestException(); throw new BadRequestException();
} }
riskMaterialService.updateRiskMaterial(riskId, refuseDescription); riskMaterialService.updateRiskMaterial(riskId, refuseDescription);
Context ctx = getMailContext(event); Context ctx = getMailContext(event);
ctx.setVariable("refuse",true); ctx.setVariable("refuse", true);
List<JSONObject> findAllMaterials = riskMaterialMapper.findAllMaterials(riskId); List<JSONObject> findAllMaterials = riskMaterialMapper.findAllMaterials(riskId);
if (findAllMaterials == null || findAllMaterials.size() == 0) { if (findAllMaterials == null || findAllMaterials.size() == 0) {
ctx.setVariable("refuse_description", ""); ctx.setVariable("refuse_description", "");
}else { } else {
ctx.setVariable("refuse_description", findAllMaterials.get(0).getString("refuse_description")); ctx.setVariable("refuse_description", findAllMaterials.get(0).getString("refuse_description"));
} }
final List<String> emailsTos = (List<String>)ctx.getVariable("emailsTos"); final List<String> emailsTos = (List<String>) ctx.getVariable("emailsTos");
final List<String> emailsCcs = ctx.getVariable("emailsCcs")==null?new ArrayList<>():(List<String>)ctx.getVariable("emailsCcs"); final List<String> emailsCcs = ctx.getVariable("emailsCcs") == null ? new ArrayList<>() : (List<String>) ctx.getVariable("emailsCcs");
final String uploadUrl = (String)ctx.getVariable("uploadUrl"); final String uploadUrl = (String) ctx.getVariable("uploadUrl");
final String content = thymeleaf.process("mail/risk_upload_mail.html", ctx); final String content = thymeleaf.process("mail/risk_upload_mail.html", ctx);
royalThreadPoolExecutor.execute(() -> { royalThreadPoolExecutor.execute(() -> {
try { try {
String emailId = mailService.sendRiskEmail("You need to resubmit risk materials", emailsTos.isEmpty() ? "" : StringUtils.join(emailsTos, ","), String emailId = mailService.sendRiskEmail("You need to resubmit risk materials", emailsTos.isEmpty() ? "" : StringUtils.join(emailsTos, ","),
emailsCcs.isEmpty() ? "" : StringUtils.join(emailsCcs, ","), "",content, null,event.getIntValue("order_type")); emailsCcs.isEmpty() ? "" : StringUtils.join(emailsCcs, ","), "", content, null, event.getIntValue("order_type"));
event.put("email_status",RiskEmailStatusEnum.BACK_AND_SEND.getEmailStatus()); event.put("email_status", RiskEmailStatusEnum.BACK_AND_SEND.getEmailStatus());
event.put("result_type",RiskResultTypeEnum.MATERIAL_NOT_PASS.getResultType()); event.put("result_type", RiskResultTypeEnum.MATERIAL_NOT_PASS.getResultType());
event.put("submit_url",uploadUrl); event.put("submit_url", uploadUrl);
riskEventMapper.update(event); riskEventMapper.update(event);
riskProcessLogService.addRiskProcessLog(riskId, riskProcessLogService.addRiskProcessLog(riskId,
event.getString("fillin_id"), event.getString("fillin_id"),
@ -721,6 +761,7 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
/** /**
* *
*
* @param riskId * @param riskId
* @throws IOException * @throws IOException
*/ */
@ -728,14 +769,14 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
public void sendUrgeEmail(String riskId) throws IOException { public void sendUrgeEmail(String riskId) throws IOException {
JSONObject event = getRiskEventDetail(riskId); JSONObject event = getRiskEventDetail(riskId);
Context ctx = getMailContext(event); Context ctx = getMailContext(event);
final List<String> emailsTos = (List<String>)ctx.getVariable("emailsTos"); final List<String> emailsTos = (List<String>) ctx.getVariable("emailsTos");
final List<String> emailsCcs = ctx.getVariable("emailsCcs")==null?new ArrayList<>():(List<String>)ctx.getVariable("emailsCcs"); final List<String> emailsCcs = ctx.getVariable("emailsCcs") == null ? new ArrayList<>() : (List<String>) ctx.getVariable("emailsCcs");
final String content = thymeleaf.process("mail/risk_urge_mail.html", ctx); final String content = thymeleaf.process("mail/risk_urge_mail.html", ctx);
royalThreadPoolExecutor.execute(() -> { royalThreadPoolExecutor.execute(() -> {
try { try {
String emailId = mailService.sendRiskEmail("Please submit risk materials as soon as possible", emailsTos.isEmpty() ? "" : StringUtils.join(emailsTos, ","), String emailId = mailService.sendRiskEmail("Please submit risk materials as soon as possible", emailsTos.isEmpty() ? "" : StringUtils.join(emailsTos, ","),
emailsCcs.isEmpty() ? "" : StringUtils.join(emailsCcs, ","),"", content, null,event.getIntValue("order_type")); emailsCcs.isEmpty() ? "" : StringUtils.join(emailsCcs, ","), "", content, null, event.getIntValue("order_type"));
event.put("email_status",3); event.put("email_status", 3);
riskEventMapper.update(event); riskEventMapper.update(event);
} catch (Exception e) { } catch (Exception e) {
throw new EmailException("Email Sending Failed", e); throw new EmailException("Email Sending Failed", e);
@ -750,20 +791,14 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
throw new InvalidShortIdException(); throw new InvalidShortIdException();
} }
String codeKey = RandomStringUtils.random(20, true, true); String codeKey = RandomStringUtils.random(20, true, true);
while(stringRedisTemplate.boundValueOps(getRiskUploadKey(codeKey)).get()!=null ){ while (stringRedisTemplate.boundValueOps(getRiskUploadKey(codeKey)).get() != null) {
codeKey = RandomStringUtils.random(20, true, true); codeKey = RandomStringUtils.random(20, true, true);
} }
String codeKeyValue = RandomStringUtils.random(10, true, true); String codeKeyValue = RandomStringUtils.random(10, true, true);
/*
String expireDay = "7";
if(event.getIntValue("order_type")>2){
expireDay = "3";
}
)*/
// 原来设定的过期时间是7天 // 原来设定的过期时间是7天
String expireDay = "3650"; String expireDay = "3650";
stringRedisTemplate.boundValueOps(getRiskUploadKey(codeKey)).set(codeKeyValue, Long.parseLong(expireDay), TimeUnit.DAYS); stringRedisTemplate.boundValueOps(getRiskUploadKey(codeKey)).set(codeKeyValue, Long.parseLong(expireDay), TimeUnit.DAYS);
String uploadUrl = PlatformEnvironment.getEnv().concatUrl("/risk/upload/") + event.getString("risk_id") + "/" + codeKey; String uploadUrl = PlatformEnvironment.getEnv().concatUrl("/risk/upload/") + event.getString("risk_id") + "/" + codeKey;
int orderType = event.getIntValue("order_type"); int orderType = event.getIntValue("order_type");
if (orderType == 1 || orderType == 2) if (orderType == 1 || orderType == 2)
uploadUrl = PlatformEnvironment.getEnv().concatUrl("/manage.html#/analysis/monitoring/") + event.getString("risk_id") + "/bd/detail?codeKey=" + codeKey; uploadUrl = PlatformEnvironment.getEnv().concatUrl("/manage.html#/analysis/monitoring/") + event.getString("risk_id") + "/bd/detail?codeKey=" + codeKey;
@ -782,10 +817,10 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
} }
List<String> clientEmails = new ArrayList<>(); List<String> clientEmails = new ArrayList<>();
clientEmails.add(client.getString("contact_email")); clientEmails.add(client.getString("contact_email"));
client.put("is_resend",new Date().compareTo(event.getDate("reply_email_date"))); client.put("is_resend", new Date().compareTo(event.getDate("reply_email_date")));
String bdNamesStr = bdNames.isEmpty() ? "" : StringUtils.join(bdNames, ","); String bdNamesStr = bdNames.isEmpty() ? "" : StringUtils.join(bdNames, ",");
String reply_date = DateFormatUtils.format(DateUtils.addDays(event.getDate("reply_email_date"),-1),"yyyy年MM月dd日"); String reply_date = DateFormatUtils.format(DateUtils.addDays(event.getDate("reply_email_date"), -1), "yyyy年MM月dd日");
String reply_date_english = DateFormatUtils.format(DateUtils.addDays(event.getDate("reply_email_date"),-1),"dd/MM/yyyy"); String reply_date_english = DateFormatUtils.format(DateUtils.addDays(event.getDate("reply_email_date"), -1), "dd/MM/yyyy");
GregorianCalendar gregorianCalendar = new GregorianCalendar(); GregorianCalendar gregorianCalendar = new GregorianCalendar();
String hello = gregorianCalendar.get(GregorianCalendar.AM_PM) == 0 ? "上午好" : "下午好"; String hello = gregorianCalendar.get(GregorianCalendar.AM_PM) == 0 ? "上午好" : "下午好";
Context ctx = new Context(); Context ctx = new Context();
@ -799,9 +834,9 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
ctx.setVariable("royalpay_order_type", event.getIntValue("royalpay_order_type")); ctx.setVariable("royalpay_order_type", event.getIntValue("royalpay_order_type"));
ctx.setVariable("warning_order_type", event.getIntValue("warning_order_type")); ctx.setVariable("warning_order_type", event.getIntValue("warning_order_type"));
ctx.setVariable("description", event.getString("description")); ctx.setVariable("description", event.getString("description"));
ctx.setVariable("is_send_client",event.getIntValue("is_send_client")); ctx.setVariable("is_send_client", event.getIntValue("is_send_client"));
ctx.setVariable("mail_template",event.get("mail_template")==null?0:event.getIntValue("mail_template")); ctx.setVariable("mail_template", event.get("mail_template") == null ? 0 : event.getIntValue("mail_template"));
ctx.setVariable("send_clean_days",event.getIntValue("send_clean_days")); ctx.setVariable("send_clean_days", event.getIntValue("send_clean_days"));
String realOrderIdsStr = event.getString("real_order_ids"); String realOrderIdsStr = event.getString("real_order_ids");
String[] realOrderIds = {}; String[] realOrderIds = {};
if (StringUtils.isNotBlank(realOrderIdsStr)) { if (StringUtils.isNotBlank(realOrderIdsStr)) {
@ -857,24 +892,24 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
} }
} }
switch (event.getIntValue("order_type")){ switch (event.getIntValue("order_type")) {
case 1: case 1:
case 2: case 2:
for(String orderId : realOrderIds){ for (String orderId : realOrderIds) {
JSONObject order = orderMapper.findOrderById(orderId,client.getIntValue("client_id")); JSONObject order = orderMapper.findOrderById(orderId, client.getIntValue("client_id"));
if(order==null){ if (order == null) {
throw new BadRequestException("Order: " + orderId + " not exists"); throw new BadRequestException("Order: " + orderId + " not exists");
} }
orders.add(order); orders.add(order);
} }
ctx.setVariable("orders", orders); ctx.setVariable("orders", orders);
ctx.setVariable("title","Your merchants needs to submit risk materials"); ctx.setVariable("title", "Your merchants needs to submit risk materials");
break; break;
case 3: case 3:
for(String orderId : realOrderIds){ for (String orderId : realOrderIds) {
JSONObject order = tradeLogService.getOrderDetail(new JSONObject(), clientMoniker, orderId, null); JSONObject order = tradeLogService.getOrderDetail(new JSONObject(), clientMoniker, orderId, null);
if(order==null){ if (order == null) {
throw new BadRequestException("Order: "+orderId+" not exists"); throw new BadRequestException("Order: " + orderId + " not exists");
} }
order.put("order_description", StringUtils.defaultString(order.getString("order_description"))); order.put("order_description", StringUtils.defaultString(order.getString("order_description")));
order.put("gateway", getGateWay(order.getIntValue("gateway"))); order.put("gateway", getGateWay(order.getIntValue("gateway")));
@ -883,45 +918,41 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
order.put("total_amount", order.getString("currency") + " " + order.getString("total_amount")); order.put("total_amount", order.getString("currency") + " " + order.getString("total_amount"));
order.put("display_amount", order.getString("currency") + " " + order.getString("display_amount")); order.put("display_amount", order.getString("currency") + " " + order.getString("display_amount"));
order.put("customer_payment_amount", order.getString("currency") + " " + order.getString("customer_payment_amount")); order.put("customer_payment_amount", order.getString("currency") + " " + order.getString("customer_payment_amount"));
order.put("clearing_amount", "AUD "+ order.getString("clearing_amount")); order.put("clearing_amount", "AUD " + order.getString("clearing_amount"));
orders.add(order); orders.add(order);
} }
ctx.setVariable("orders", orders); ctx.setVariable("orders", orders);
// List<JSONObject> attachList = new ArrayList<>();
// JSONObject file = new JSONObject();
// file.put("name", client.getString("short_name")+ "被查单号相关信息.xlsx");
// file.put("content", Base64.encodeBase64String(generateRiskOrders(event)));
// attachList.add(file);
// ctx.setVariable("files",attachList);
case 4: case 4:
ctx.setVariable("title","RoyalPay风控调查 — " + client.getString("short_name")); ctx.setVariable("title", "RoyalPay风控调查 — " + client.getString("short_name"));
break; break;
} }
return ctx; return ctx;
} }
private String getRiskUploadKey(String codeKey){
private String getRiskUploadKey(String codeKey) {
return UPLOAD_MAIL_PREFIX + codeKey; return UPLOAD_MAIL_PREFIX + codeKey;
} }
/** /**
* *
*
* @param param * @param param
* @return * @return
*/ */
@Override @Override
public JSONObject getRiskMaterial(JSONObject param) { public JSONObject getRiskMaterial(JSONObject param) {
List<JSONObject> riskMaterialList = riskMaterialMapper.findAllMaterials(param.getString("risk_id")); List<JSONObject> riskMaterialList = riskMaterialMapper.findAllMaterials(param.getString("risk_id"));
if (riskMaterialList != null && riskMaterialList.size() > 0){ if (riskMaterialList != null && riskMaterialList.size() > 0) {
JSONObject fileNew = riskMaterialList.get(0); JSONObject fileNew = riskMaterialList.get(0);
List<JSONObject> files = riskFileMapper.findAllFiles(fileNew.getString("material_id")); List<JSONObject> files = riskFileMapper.findAllFiles(fileNew.getString("material_id"));
for(JSONObject file : files){ for (JSONObject file : files) {
int fileType = file.getIntValue("file_type"); int fileType = file.getIntValue("file_type");
if(!fileNew.containsKey("file" + fileType)){ if (!fileNew.containsKey("file" + fileType)) {
List<String> fileList = new ArrayList<>(); List<String> fileList = new ArrayList<>();
fileList.add(file.getString("file_url")); fileList.add(file.getString("file_url"));
fileNew.put("file" + fileType, fileList); fileNew.put("file" + fileType, fileList);
}else{ } else {
List<String> fileList = (List<String>) fileNew.get("file"+fileType); List<String> fileList = (List<String>) fileNew.get("file" + fileType);
fileList.add(file.getString("file_url")); fileList.add(file.getString("file_url"));
fileNew.put("file" + fileType, fileList); fileNew.put("file" + fileType, fileList);
} }
@ -973,7 +1004,7 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
String[] orderIds = event.getString("order_ids").split(","); String[] orderIds = event.getString("order_ids").split(",");
JSONObject client = clientMapper.findClientByMonikerAll(event.getString("client_moniker")); JSONObject client = clientMapper.findClientByMonikerAll(event.getString("client_moniker"));
Workbook wb = new XSSFWorkbook(); Workbook wb = new XSSFWorkbook();
for(String orderId : orderIds){ for (String orderId : orderIds) {
JSONObject orderDetail = tradeLogService.getOrderDetail(new JSONObject(), event.getString("client_moniker"), orderId, null); JSONObject orderDetail = tradeLogService.getOrderDetail(new JSONObject(), event.getString("client_moniker"), orderId, null);
Sheet sheet = wb.createSheet(orderId); Sheet sheet = wb.createSheet(orderId);
sheet.setDefaultColumnWidth((short) 40); sheet.setDefaultColumnWidth((short) 40);
@ -993,45 +1024,46 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
Row row13 = sheet.createRow(13); Row row13 = sheet.createRow(13);
Row row14 = sheet.createRow(14); Row row14 = sheet.createRow(14);
Row row15 = sheet.createRow(15); Row row15 = sheet.createRow(15);
row0.createCell(0,Cell.CELL_TYPE_STRING).setCellValue("Partner"); row0.createCell(0, Cell.CELL_TYPE_STRING).setCellValue("Partner");
row0.createCell(1,Cell.CELL_TYPE_STRING).setCellValue(orderDetail.getJSONObject("client").getString("short_name")+"("+orderDetail.getJSONObject("client").getString("client_moniker")+")"); row0.createCell(1, Cell.CELL_TYPE_STRING).setCellValue(orderDetail.getJSONObject("client").getString("short_name") + "(" + orderDetail.getJSONObject("client").getString("client_moniker") + ")");
row1.createCell(0,Cell.CELL_TYPE_STRING).setCellValue("Order ID"); row1.createCell(0, Cell.CELL_TYPE_STRING).setCellValue("Order ID");
row1.createCell(1,Cell.CELL_TYPE_STRING).setCellValue(orderDetail.getString("order_id")); row1.createCell(1, Cell.CELL_TYPE_STRING).setCellValue(orderDetail.getString("order_id"));
row2.createCell(0,Cell.CELL_TYPE_STRING).setCellValue("Platform Transaction ID"); row2.createCell(0, Cell.CELL_TYPE_STRING).setCellValue("Platform Transaction ID");
row2.createCell(1,Cell.CELL_TYPE_STRING).setCellValue(orderDetail.getString("system_transaction_id")); row2.createCell(1, Cell.CELL_TYPE_STRING).setCellValue(orderDetail.getString("system_transaction_id"));
row3.createCell(0,Cell.CELL_TYPE_STRING).setCellValue("Order Description"); row3.createCell(0, Cell.CELL_TYPE_STRING).setCellValue("Order Description");
row3.createCell(1,Cell.CELL_TYPE_STRING).setCellValue(StringUtils.defaultString(orderDetail.getString("order_description"))); row3.createCell(1, Cell.CELL_TYPE_STRING).setCellValue(StringUtils.defaultString(orderDetail.getString("order_description")));
row4.createCell(0,Cell.CELL_TYPE_STRING).setCellValue("Customer ID"); row4.createCell(0, Cell.CELL_TYPE_STRING).setCellValue("Customer ID");
row4.createCell(1,Cell.CELL_TYPE_STRING).setCellValue(orderDetail.getString("customer_id")); row4.createCell(1, Cell.CELL_TYPE_STRING).setCellValue(orderDetail.getString("customer_id"));
row5.createCell(0,Cell.CELL_TYPE_STRING).setCellValue("IP"); row5.createCell(0, Cell.CELL_TYPE_STRING).setCellValue("IP");
row5.createCell(1,Cell.CELL_TYPE_STRING).setCellValue(orderDetail.getString("customer_ip")); row5.createCell(1, Cell.CELL_TYPE_STRING).setCellValue(orderDetail.getString("customer_ip"));
row6.createCell(0,Cell.CELL_TYPE_STRING).setCellValue("Total Amount"); row6.createCell(0, Cell.CELL_TYPE_STRING).setCellValue("Total Amount");
row6.createCell(1,Cell.CELL_TYPE_STRING).setCellValue(orderDetail.getString("currency")+" "+orderDetail.getString("total_amount")); row6.createCell(1, Cell.CELL_TYPE_STRING).setCellValue(orderDetail.getString("currency") + " " + orderDetail.getString("total_amount"));
row7.createCell(0,Cell.CELL_TYPE_STRING).setCellValue("Input Amount"); row7.createCell(0, Cell.CELL_TYPE_STRING).setCellValue("Input Amount");
row7.createCell(1,Cell.CELL_TYPE_STRING).setCellValue(orderDetail.getString("currency")+" "+orderDetail.getString("display_amount")); row7.createCell(1, Cell.CELL_TYPE_STRING).setCellValue(orderDetail.getString("currency") + " " + orderDetail.getString("display_amount"));
row8.createCell(0,Cell.CELL_TYPE_STRING).setCellValue("Pay Amount"); row8.createCell(0, Cell.CELL_TYPE_STRING).setCellValue("Pay Amount");
row8.createCell(1,Cell.CELL_TYPE_STRING).setCellValue(orderDetail.getString("currency")+" "+orderDetail.getString("customer_payment_amount")); row8.createCell(1, Cell.CELL_TYPE_STRING).setCellValue(orderDetail.getString("currency") + " " + orderDetail.getString("customer_payment_amount"));
row9.createCell(0,Cell.CELL_TYPE_STRING).setCellValue("Exchange Rate"); row9.createCell(0, Cell.CELL_TYPE_STRING).setCellValue("Exchange Rate");
row9.createCell(1,Cell.CELL_TYPE_STRING).setCellValue(orderDetail.getString("exchange_rate")); row9.createCell(1, Cell.CELL_TYPE_STRING).setCellValue(orderDetail.getString("exchange_rate"));
row10.createCell(0,Cell.CELL_TYPE_STRING).setCellValue("Clearing Amount"); row10.createCell(0, Cell.CELL_TYPE_STRING).setCellValue("Clearing Amount");
row10.createCell(1,Cell.CELL_TYPE_STRING).setCellValue("AUD "+ orderDetail.getString("clearing_amount")); row10.createCell(1, Cell.CELL_TYPE_STRING).setCellValue("AUD " + orderDetail.getString("clearing_amount"));
row11.createCell(0,Cell.CELL_TYPE_STRING).setCellValue("Gateway"); row11.createCell(0, Cell.CELL_TYPE_STRING).setCellValue("Gateway");
row11.createCell(1,Cell.CELL_TYPE_STRING).setCellValue(getGateWay(orderDetail.getIntValue("gateway"))); row11.createCell(1, Cell.CELL_TYPE_STRING).setCellValue(getGateWay(orderDetail.getIntValue("gateway")));
row12.createCell(0,Cell.CELL_TYPE_STRING).setCellValue("Create Time"); row12.createCell(0, Cell.CELL_TYPE_STRING).setCellValue("Create Time");
row12.createCell(1,Cell.CELL_TYPE_STRING).setCellValue(orderDetail.getString("create_time")); row12.createCell(1, Cell.CELL_TYPE_STRING).setCellValue(orderDetail.getString("create_time"));
row13.createCell(0,Cell.CELL_TYPE_STRING).setCellValue("Status"); row13.createCell(0, Cell.CELL_TYPE_STRING).setCellValue("Status");
row13.createCell(1,Cell.CELL_TYPE_STRING).setCellValue(getStatus(orderDetail.getIntValue("status"))); row13.createCell(1, Cell.CELL_TYPE_STRING).setCellValue(getStatus(orderDetail.getIntValue("status")));
row14.createCell(0,Cell.CELL_TYPE_STRING).setCellValue("Pay Time"); row14.createCell(0, Cell.CELL_TYPE_STRING).setCellValue("Pay Time");
row14.createCell(1,Cell.CELL_TYPE_STRING).setCellValue(orderDetail.getString("transaction_time")); row14.createCell(1, Cell.CELL_TYPE_STRING).setCellValue(orderDetail.getString("transaction_time"));
row15.createCell(0,Cell.CELL_TYPE_STRING).setCellValue("Order Detail"); row15.createCell(0, Cell.CELL_TYPE_STRING).setCellValue("Order Detail");
row15.createCell(1,Cell.CELL_TYPE_STRING).setCellValue(StringUtils.defaultString(orderDetail.getString("order_detail"))); row15.createCell(1, Cell.CELL_TYPE_STRING).setCellValue(StringUtils.defaultString(orderDetail.getString("order_detail")));
} }
ByteArrayOutputStream bos = new ByteArrayOutputStream(); ByteArrayOutputStream bos = new ByteArrayOutputStream();
wb.write(bos); wb.write(bos);
bos.flush(); bos.flush();
return bos.toByteArray(); return bos.toByteArray();
} }
private String getGateWay(int gateWay){
private String getGateWay(int gateWay) {
switch (gateWay) { switch (gateWay) {
case 0: case 0:
return "线下扫码"; return "线下扫码";
@ -1067,7 +1099,7 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
return ""; return "";
} }
private String getStatus(int status){ private String getStatus(int status) {
switch (status) { switch (status) {
case 0: case 0:
return "Creating"; return "Creating";
@ -1091,6 +1123,7 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
/** /**
* *
*
* @param manager * @param manager
* @param notices * @param notices
*/ */
@ -1138,6 +1171,7 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
/** /**
* *
*
* @param clientId * @param clientId
* @return * @return
*/ */
@ -1145,7 +1179,7 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
public JSONObject getNoticeInfo(int clientId) { public JSONObject getNoticeInfo(int clientId) {
JSONObject client = clientMapper.findClient(clientId); JSONObject client = clientMapper.findClient(clientId);
if(client == null){ if (client == null) {
throw new InvalidShortIdException(); throw new InvalidShortIdException();
} }
JSONObject params = new JSONObject(); JSONObject params = new JSONObject();
@ -1168,6 +1202,7 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
* *
* *
* *
*
* @param riskId * @param riskId
* @return * @return
*/ */
@ -1230,6 +1265,9 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
case 3: case 3:
materialsRemark = getStudyTemplate(); materialsRemark = getStudyTemplate();
break; break;
case 4:
materialsRemark = getChargebackTemplate();
break;
default: default:
break; break;
} }
@ -1257,18 +1295,18 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
@Override @Override
public void banRiskEvent(String riskId) { public void banRiskEvent(String riskId) {
JSONObject params = new JSONObject(); JSONObject params = new JSONObject();
params.put("risk_id",riskId); params.put("risk_id", riskId);
params.put("is_valid",0); params.put("is_valid", 0);
riskEventMapper.update(params); riskEventMapper.update(params);
} }
@Override @Override
public void commitWaitRiskStatus(String riskId, String codeKey, JSONObject manager) { public void commitWaitRiskStatus(String riskId, String codeKey, JSONObject manager) {
JSONObject event = riskEventMapper.findById(riskId); JSONObject event = riskEventMapper.findById(riskId);
if (event.getIntValue("result_type") != RiskResultTypeEnum.SEND_EMAIL_TO_BD.getResultType() &&event.getIntValue("result_type") != RiskResultTypeEnum.MATERIAL_NOT_PASS.getResultType()) { if (event.getIntValue("result_type") != RiskResultTypeEnum.SEND_EMAIL_TO_BD.getResultType() && event.getIntValue("result_type") != RiskResultTypeEnum.MATERIAL_NOT_PASS.getResultType()) {
throw new BadRequestException("风控调单不存在或资料已补全"); throw new BadRequestException("风控调单不存在或资料已补全");
} }
if(event.getIntValue("result_type")!= RiskResultTypeEnum.MATERIAL_AUDIT_PASS.getResultType()){ if (event.getIntValue("result_type") != RiskResultTypeEnum.MATERIAL_AUDIT_PASS.getResultType()) {
event.put("result_type", RiskResultTypeEnum.WAIT_FOR_AUDIT.getResultType()); event.put("result_type", RiskResultTypeEnum.WAIT_FOR_AUDIT.getResultType());
riskEventMapper.update(event); riskEventMapper.update(event);
} }
@ -1315,29 +1353,50 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
@Override @Override
public void completeOrderAmount() { public void completeOrderAmount() {
List<JSONObject> riskEventList = getRiskEvents(null); List<JSONObject> riskEventList = getRiskEvents(null);
for(JSONObject riskEvent:riskEventList){ for (JSONObject riskEvent : riskEventList) {
if(riskEvent.getIntValue("order_type") == 4 || StringUtils.isBlank(riskEvent.getString("real_order_ids"))){ if (riskEvent.getIntValue("order_type") == 4 || StringUtils.isBlank(riskEvent.getString("real_order_ids"))) {
continue; continue;
} }
String[] order_ids=riskEvent.getString("real_order_ids").split(","); String[] orderIds = riskEvent.getString("real_order_ids").split(",");
for(String orderId : order_ids){ for (String orderId : orderIds) {
JSONObject transaction = transactionMapper.findByOrderId(orderId); JSONObject transaction = transactionMapper.findByOrderId(orderId);
JSONObject riskOrder = new JSONObject(); JSONObject riskOrder = new JSONObject();
riskOrder.put("risk_id",riskEvent.getString("risk_id")); riskOrder.put("risk_id", riskEvent.getString("risk_id"));
riskOrder.put("order_id",transaction.getString("order_id")); riskOrder.put("order_id", transaction.getString("order_id"));
riskOrder.put("clearing_amount",transaction.getString("clearing_amount")); riskOrder.put("clearing_amount", transaction.getString("clearing_amount"));
riskOrdersMapper.save(riskOrder); riskOrdersMapper.save(riskOrder);
} }
} }
} }
@Override @Override
public void UpdateRiskEventRemark(String riskId, String remark) { public void updateRiskEventRemark(String riskId, String remark) {
JSONObject event = riskEventMapper.findById(riskId); JSONObject event = riskEventMapper.findById(riskId);
event.put("remark", remark); event.put("remark", remark);
riskEventMapper.update(event); riskEventMapper.update(event);
} }
@Override
public void markChargebackStatus(String riskId, JSONObject manager, ChargebackStatus status) {
RiskEvent risk = getRiskEvent(riskId);
if (risk == null) {
throw new NotFoundException("Risk Event not found");
}
if (risk.getOrderType() != RISK_ORDER_TYPE_CHARGEBACK) {
throw new BadRequestException("Not Chargeback event");
}
if (status == null || status == ChargebackStatus.PROCESSING) {
throw new BadRequestException("Invalid status");
}
riskProcessLogService.addRiskProcessLog(riskId,
manager.getString("manager_id"),
manager.getString("display_name"),
RiskResultTypeEnum.ALREADY_HANDLED.getRemark(),
RiskResultTypeEnum.ALREADY_HANDLED.getResultType(),
RiskResultTypeEnum.ALREADY_HANDLED.getResultType());
cardSecureService.changeChargebackReportStatus(riskId, status);
}
private List<String> getShopTemplate() { private List<String> getShopTemplate() {
return Arrays.asList("1.与调查交易金额对应的购物小票/发票存根照片 要求:照片应清晰,必须显示商户名称、商户地址、购物时间、物品名称、购物金额等;\n" + return Arrays.asList("1.与调查交易金额对应的购物小票/发票存根照片 要求:照片应清晰,必须显示商户名称、商户地址、购物时间、物品名称、购物金额等;\n" +
"Photos of shopping receipts/ invoice stubs Requirement corresponding with the investigated orders Requirement: The photos should be clear and must show Merchant name, Business address, Transaction time, Product information, Quantity purchased, etc;", "Photos of shopping receipts/ invoice stubs Requirement corresponding with the investigated orders Requirement: The photos should be clear and must show Merchant name, Business address, Transaction time, Product information, Quantity purchased, etc;",
@ -1375,4 +1434,19 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
"Other materials including onboarding materials as task description requiredExplanation of business model for your merchant including actual selling-goods or services, per customer transaction, business hours, etc;" "Other materials including onboarding materials as task description requiredExplanation of business model for your merchant including actual selling-goods or services, per customer transaction, business hours, etc;"
); );
} }
private List<String> getChargebackTemplate() {
return Arrays.asList("1.A legible copy of the signed authority and/or receipts from the Cardholder. \n" +
"持卡人签名授权书和/或收据的清晰副本。",
"2.Copy of any tax invoice/s and/or signed disclosure of cancellation policy. \n" +
"任何税务发票和/或签署的披露取消政策的副本。",
"3.Any transaction Information relating to the sale of any digital goods purchased online.\n" +
"与在线购买的任何数字商品的销售有关的任何交易信息。",
"4.Description of the goods/services supplied and/or proof of delivery/collection of goods.\n" +
"提供的商品/服务的说明和/或交付/收货的证明。(消费者买了什么,商家卖了什么,消费者收没收到货,如何收到的)",
"5.Copy of Mail Order/telephone order transaction receipt.\n" +
"邮件订单/电话订单交易收据的副本。",
"6.Cardholder identification or any form of communication with the Cardholder, including email correspondence. \n" +
"持卡人身份或与持卡人的任何形式的通信,包括电子邮件通信。");
}
} }

@ -1,5 +1,8 @@
package au.com.royalpay.payment.manage.riskbusiness.web; package au.com.royalpay.payment.manage.riskbusiness.web;
import au.com.royalpay.payment.core.CardSecureService;
import au.com.royalpay.payment.core.beans.ChargebackStatus;
import au.com.royalpay.payment.core.beans.ChargebackTransaction;
import au.com.royalpay.payment.manage.merchants.beans.PartnerQuery; import au.com.royalpay.payment.manage.merchants.beans.PartnerQuery;
import au.com.royalpay.payment.manage.merchants.core.ClientManager; import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.manage.permission.manager.ManagerMapping; import au.com.royalpay.payment.manage.permission.manager.ManagerMapping;
@ -14,13 +17,14 @@ import com.alibaba.fastjson.JSONObject;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
/** /**
* *
*
* @Author lvjian * @Author lvjian
* @Date 2018/10/10 1:12 * @Date 2018/10/10 1:12
*/ */
@ -33,7 +37,8 @@ public class RiskBusinessController {
@Autowired @Autowired
private RiskMaterialService riskMaterialService; private RiskMaterialService riskMaterialService;
@Resource
private CardSecureService cardSecureService;
@Autowired @Autowired
private ClientManager clientManager; private ClientManager clientManager;
@ -41,7 +46,6 @@ public class RiskBusinessController {
private RiskProcessLogService riskProcessLogService; private RiskProcessLogService riskProcessLogService;
@GetMapping(value = "events") @GetMapping(value = "events")
public JSONObject getRiskEvents(RiskEventQuery riskEventQuery, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { public JSONObject getRiskEvents(RiskEventQuery riskEventQuery, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
JSONObject params = riskEventQuery.toJSON(); JSONObject params = riskEventQuery.toJSON();
@ -72,13 +76,18 @@ public class RiskBusinessController {
@GetMapping(value = "events/{risk_id}/detail") @GetMapping(value = "events/{risk_id}/detail")
public JSONObject getRiskEventDetailWithoutTradelogs(@PathVariable("risk_id") String riskId, public JSONObject getRiskEventDetailWithoutTradelogs(@PathVariable("risk_id") String riskId,
@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
JSONObject riskEvent = riskBusinessService.getRiskEventDetail(riskId); return riskBusinessService.getRiskEventDetail(riskId);
return riskEvent; }
@GetMapping("/chargeback_orders")
public List<ChargebackTransaction> searchForChargeback(@RequestParam("channel_order_id") String channelOrderId) {
return cardSecureService.queryOrdersForChargeBack(channelOrderId);
} }
@PostMapping(value = "events") @PostMapping(value = "events")
public void RegisterRiskEvent(@RequestBody JSONObject params, public void registerRiskEvent(@RequestBody JSONObject params,
@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
params.put("fillin_id", manager.getString("manager_id")); params.put("fillin_id", manager.getString("manager_id"));
params.put("fillin_person", manager.getString("display_name")); params.put("fillin_person", manager.getString("display_name"));
@ -86,8 +95,8 @@ public class RiskBusinessController {
} }
@PutMapping(value = "events") @PutMapping(value = "events")
public void UpdateRiskEvent(@RequestBody JSONObject params,@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { public void updateRiskEvent(@RequestBody JSONObject params, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
riskBusinessService.updateRiskEvent(params,manager); riskBusinessService.updateRiskEvent(params, manager);
} }
@PutMapping(value = "events/pass") @PutMapping(value = "events/pass")
@ -97,17 +106,17 @@ public class RiskBusinessController {
} }
@GetMapping(value = "/{risk_id}/download/materialsAsZIP") @GetMapping(value = "/{risk_id}/download/materialsAsZIP")
public void downloadComplianceZip(@PathVariable("risk_id") String riskId, HttpServletResponse response) throws Exception { public void downloadComplianceZip(@PathVariable("risk_id") String riskId, HttpServletResponse response) {
riskBusinessService.downloadAuditMaterialZiP(riskId, response); riskBusinessService.downloadAuditMaterialZiP(riskId, response);
} }
@RequestMapping(value = "/{risk_id}/upload_mail",method = RequestMethod.PUT) @RequestMapping(value = "/{risk_id}/upload_mail", method = RequestMethod.PUT)
public void uploadEmail(@PathVariable String risk_id) throws IOException { public void uploadEmail(@PathVariable String risk_id) throws IOException {
riskBusinessService.sendUploadEmail(risk_id); riskBusinessService.sendUploadEmail(risk_id);
} }
@RequestMapping(value = "/{risk_id}/refuse",method = RequestMethod.PUT) @RequestMapping(value = "/{risk_id}/refuse", method = RequestMethod.PUT)
public void refuseEmail(@PathVariable("risk_id") String riskId, @RequestBody JSONObject otherParams) throws IOException { public void refuseEmail(@PathVariable("risk_id") String riskId, @RequestBody JSONObject otherParams) throws IOException {
riskBusinessService.sendRefuseEmail(riskId, otherParams.getString("refuse_description")); riskBusinessService.sendRefuseEmail(riskId, otherParams.getString("refuse_description"));
} }
@ -137,7 +146,7 @@ public class RiskBusinessController {
//1:禁用渠道;2:禁用商户 //1:禁用渠道;2:禁用商户
riskBusinessService.sendWxMess(params, channel, 1); riskBusinessService.sendWxMess(params, channel, 1);
} }
riskBusinessService.updateRiskEvent(params,manager); riskBusinessService.updateRiskEvent(params, manager);
} }
@PutMapping(value = "/partner/{isValid}") @PutMapping(value = "/partner/{isValid}")
@ -152,26 +161,31 @@ public class RiskBusinessController {
if (temporaryCloseMerchant != 1) { if (temporaryCloseMerchant != 1) {
params.put("result_type", RiskResultTypeEnum.ALREADY_HANDLED.getResultType()); params.put("result_type", RiskResultTypeEnum.ALREADY_HANDLED.getResultType());
} }
} } else {
else {
clientManager.revertClient(clientMoniker, manager); clientManager.revertClient(clientMoniker, manager);
params.put("result_type", RiskResultTypeEnum.ALREADY_HANDLED.getResultType()); params.put("result_type", RiskResultTypeEnum.ALREADY_HANDLED.getResultType());
} }
riskBusinessService.updateRiskEvent(params,manager); riskBusinessService.updateRiskEvent(params, manager);
} }
@RequestMapping(value = "/{risk_id}/urge",method = RequestMethod.PUT) @PutMapping("/{risk_id}/urge")
public void urgeEmail(@PathVariable String risk_id) throws IOException { public void urgeEmail(@PathVariable String risk_id) throws IOException {
riskBusinessService.sendUrgeEmail(risk_id); riskBusinessService.sendUrgeEmail(risk_id);
} }
@RequestMapping(value = "/ban/{risk_id}",method = RequestMethod.DELETE) @PutMapping("/chargebacks/{riskId}/mark_status")
public void banEvent(@PathVariable String risk_id){ public void markChargebackStatus(@PathVariable String riskId, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager,
@RequestBody JSONObject status) {
riskBusinessService.markChargebackStatus(riskId, manager, status.getObject("status", ChargebackStatus.class));
}
@DeleteMapping("/ban/{risk_id}")
public void banEvent(@PathVariable String risk_id) {
riskBusinessService.banRiskEvent(risk_id); riskBusinessService.banRiskEvent(risk_id);
} }
@PutMapping("/commitWaitRiskStatus/{risk_id}/{codeKey}") @PutMapping("/commitWaitRiskStatus/{risk_id}/{codeKey}")
public void commitWaitRiskStatus(@PathVariable String risk_id,@PathVariable String codeKey,@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { public void commitWaitRiskStatus(@PathVariable String risk_id, @PathVariable String codeKey, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
riskBusinessService.commitWaitRiskStatus(risk_id, codeKey, manager); riskBusinessService.commitWaitRiskStatus(risk_id, codeKey, manager);
} }
@ -205,8 +219,8 @@ public class RiskBusinessController {
@PutMapping(value = "{risk_id}/remark") @PutMapping(value = "{risk_id}/remark")
@ResponseBody @ResponseBody
public void UpdateRiskEventRemark(@PathVariable("risk_id") String riskId, @RequestBody JSONObject remark) { public void updateRiskEventRemark(@PathVariable("risk_id") String riskId, @RequestBody JSONObject remark) {
riskBusinessService.UpdateRiskEventRemark(riskId, remark.getString("remark")); riskBusinessService.updateRiskEventRemark(riskId, remark.getString("remark"));
} }
} }

@ -5,38 +5,40 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
function (angular, $) { function (angular, $) {
'use strict'; 'use strict';
var mailTemplate = { let mailTemplate = {
"1": "代购、综合商城类", "1": "代购、综合商城类",
"2": "飞机票、旅行社类", "2": "飞机票、旅行社类",
"3": "教育类、中介类" "3": "教育类、中介类",
"4": "Chargeback"
}; };
var orderTypesMap = { let orderTypesMap = {
"1": "微信调单", "1": "微信调单",
"2": "支付宝调单", "2": "支付宝调单",
"3": "RoyalPay调单", "3": "RoyalPay调单",
"4": "警告", "4": "警告",
"5": "通用号调单" "5": "通用号调单",
"6": "卡支付ChargeBack"
}; };
var orderTypesMapForBD = { let orderTypesMapForBD = {
"1": "微信调单", "1": "微信调单",
"2": "支付宝调单", "2": "支付宝调单",
"3": "RoyalPay调单" "3": "RoyalPay调单"
}; };
var royalpayOrderTypesMap = { let royalpayOrderTypesMap = {
"0": "正常调单", "0": "正常调单",
"1": "单纯大金额频繁刷单" "1": "单纯大金额频繁刷单"
}; };
var warningOrderTypesMap = { let warningOrderTypesMap = {
"0": "单人多次大金额交易", "0": "单人多次大金额交易",
"1": "退款频繁" "1": "退款频繁"
}; };
var resultTypesMap = { let resultTypesMap = {
"0": "未处理", "0": "未处理",
"1": "已发送邮件", "1": "已发送邮件",
"2": "已提交材料,等待审核", "2": "已提交材料,等待审核",
@ -45,7 +47,7 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
"5": "已处理" "5": "已处理"
}; };
var resultTypeSearchMap = { let resultTypeSearchMap = {
"0": "未处理", "0": "未处理",
"1": "资料完善中", "1": "资料完善中",
"2": "等待风控", "2": "等待风控",
@ -54,7 +56,7 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
"5": "已处理" "5": "已处理"
}; };
var resultTypeSearchMapForBD = { let resultTypeSearchMapForBD = {
"1": "材料待上传", "1": "材料待上传",
"2": "材料已提交", "2": "材料已提交",
"3": "风控初审完成,渠道方审核中", "3": "风控初审完成,渠道方审核中",
@ -62,14 +64,14 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
"5": "已处理" "5": "已处理"
}; };
var emailStatusMap = { let emailStatusMap = {
"0": "未发送", "0": "未发送",
"1": "已发送", "1": "已发送",
"2": "打回并已发送", "2": "打回并已发送",
"3": "已发送催促邮件" "3": "已发送催促邮件"
}; };
var amountSectionMap = { let amountSectionMap = {
"0-500": "0-500", "0-500": "0-500",
"500-1000": "500-1000", "500-1000": "500-1000",
"1000-1500": "1000-1500", "1000-1500": "1000-1500",
@ -81,7 +83,7 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
"4000-4500": "4000-4500" "4000-4500": "4000-4500"
}; };
var channelResultArray = [ let channelResultArray = [
"关闭支付", "关闭支付",
"恢复支付", "恢复支付",
"单日10", "单日10",
@ -95,7 +97,7 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
"其他" "其他"
]; ];
var app = angular.module('riskBusinessApp', ['ui.router']); let app = angular.module('riskBusinessApp', ['ui.router']);
app.config(['$stateProvider', function ($stateProvider) { app.config(['$stateProvider', function ($stateProvider) {
$stateProvider.state('analysis_monitoring.risk_business', { $stateProvider.state('analysis_monitoring.risk_business', {
url: '/risk_business', url: '/risk_business',
@ -137,7 +139,7 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
}]); }]);
app.controller('riskBusinessCtrl', ['$scope', '$state', '$http', '$uibModal', '$filter', 'commonDialog', 'industryMap','chartParser', app.controller('riskBusinessCtrl', ['$scope', '$state', '$http', '$uibModal', '$filter', 'commonDialog', 'industryMap', 'chartParser',
function ($scope, $state, $http, $uibModal, $filter, commonDialog, industryMap, chartParser) { function ($scope, $state, $http, $uibModal, $filter, commonDialog, industryMap, chartParser) {
$scope.orderTypes = orderTypesMap; $scope.orderTypes = orderTypesMap;
$scope.orderTypesForBD = orderTypesMapForBD; $scope.orderTypesForBD = orderTypesMapForBD;
@ -148,26 +150,26 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
$scope.amountSection = amountSectionMap; $scope.amountSection = amountSectionMap;
$scope.pagination = {}; $scope.pagination = {};
$scope.params = {}; $scope.params = {};
var industries = new Array(); let industries = [];
angular.forEach($scope.industries, function (industry) { angular.forEach($scope.industries, function (industry) {
industries.push(industry.label); industries.push(industry.label);
}); });
industries.push('未知行业'); industries.push('未知行业');
$scope.$watch('params',function (newVal) { $scope.$watch('params', function (newVal) {
console.log('params changed--->',newVal) console.log('params changed--->', newVal)
}); });
console.log('riskBusinessCtrl loaded') console.log('riskBusinessCtrl loaded')
// console.log(industries); // console.log(industries);
// 加载风险注册事件 // 加载风险注册事件
$scope.loadRiskEvents = function (page) { $scope.loadRiskEvents = function (page) {
var params = angular.copy($scope.params); let params = angular.copy($scope.params);
params.page = page || $scope.pagination.page || 1; params.page = page || $scope.pagination.page || 1;
params.replyEmailDateBegin = $filter('date')(params.replyEmailDateBegin, 'yyyy-MM-dd'); params.replyEmailDateBegin = $filter('date')(params.replyEmailDateBegin, 'yyyy-MM-dd');
params.replyEmailDateEnd = $filter('date')(params.replyEmailDateEnd, 'yyyy-MM-dd'); params.replyEmailDateEnd = $filter('date')(params.replyEmailDateEnd, 'yyyy-MM-dd');
params.receiveEmailDateBegin = $filter('date')(params.receiveEmailDateBegin, 'yyyy-MM-dd'); params.receiveEmailDateBegin = $filter('date')(params.receiveEmailDateBegin, 'yyyy-MM-dd');
params.receiveEmailDateEnd = $filter('date')(params.receiveEmailDateEnd, 'yyyy-MM-dd'); params.receiveEmailDateEnd = $filter('date')(params.receiveEmailDateEnd, 'yyyy-MM-dd');
if (params.section != null) { if (params.section != null) {
var sectionArray = params.section.split('-'); let sectionArray = params.section.split('-');
params.startAmount = sectionArray[0]; params.startAmount = sectionArray[0];
params.endAmount = sectionArray[1]; params.endAmount = sectionArray[1];
} }
@ -177,16 +179,16 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
}); });
$http.get('/risk/business/events/analysis/industry', {params: params}).then(function (resp) { $http.get('/risk/business/events/analysis/industry', {params: params}).then(function (resp) {
$scope.riskEventsByIndustry = resp.data; $scope.riskEventsByIndustry = resp.data;
$scope.risk_industry_chart = chartParser.parse(industryAmount(industries),$scope.riskEventsByIndustry); $scope.risk_industry_chart = chartParser.parse(industryAmount(industries), $scope.riskEventsByIndustry);
}); });
$http.get('/risk/business/events/analysis/amount', {params: params}).then(function (resp) { $http.get('/risk/business/events/analysis/amount', {params: params}).then(function (resp) {
$scope.riskEventsByAmount = resp.data; $scope.riskEventsByAmount = resp.data;
$scope.risk_amount_chart = chartParser.parse(intervalsAmount(),$scope.riskEventsByAmount); $scope.risk_amount_chart = chartParser.parse(intervalsAmount(), $scope.riskEventsByAmount);
}); });
}; };
var industryAmount = function (industries) { let industryAmount = function (industries) {
return { return {
chart: { chart: {
tooltip: { tooltip: {
@ -205,15 +207,15 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
name: '风控事件单量', type: 'pie', name: '风控事件单量', type: 'pie',
radius: '80%', radius: '80%',
center: ['50%', '58%'], center: ['50%', '58%'],
label:{ //饼图图形上的文本标签 label: { //饼图图形上的文本标签
normal:{ normal: {
show:true, show: true,
position:'outer', //标签的位置 position: 'outer', //标签的位置
textStyle : { textStyle: {
fontWeight : 300 , fontWeight: 300,
fontSize : 16 //文字的字体大小 fontSize: 16 //文字的字体大小
}, },
formatter:'{d}%' formatter: '{d}%'
} }
}, },
itemStyle: { itemStyle: {
@ -229,7 +231,7 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
} }
}; };
var intervalsAmount = function () { let intervalsAmount = function () {
return { return {
chart: { chart: {
tooltip: { tooltip: {
@ -240,8 +242,8 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
legend: { legend: {
orient: 'vertical', orient: 'vertical',
left: 'right', left: 'right',
data: [ '0-500','500-1000','1000-1500','1500-2000','2000-2500','2500-3000','3000-3500','3500-4000','4000-4500','4500-5000','5000-5500','5500-6000', data: ['0-500', '500-1000', '1000-1500', '1500-2000', '2000-2500', '2500-3000', '3000-3500', '3500-4000', '4000-4500', '4500-5000', '5000-5500', '5500-6000',
'6000-6500','6500-7000','7000-7500','7500-8000','8000-8500','8500-9000','>9000'] '6000-6500', '6500-7000', '7000-7500', '7500-8000', '8000-8500', '8500-9000', '>9000']
} }
}, },
series: [{ series: [{
@ -249,15 +251,15 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
name: '风控事件单量', type: 'pie', name: '风控事件单量', type: 'pie',
radius: '80%', radius: '80%',
center: ['50%', '58%'], center: ['50%', '58%'],
label:{ //饼图图形上的文本标签 label: { //饼图图形上的文本标签
normal:{ normal: {
show:true, show: true,
position:'outer', //标签的位置 position: 'outer', //标签的位置
textStyle : { textStyle: {
fontWeight : 300 , fontWeight: 300,
fontSize : 16 //文字的字体大小 fontSize: 16 //文字的字体大小
}, },
formatter:'{d}%' formatter: '{d}%'
} }
}, },
itemStyle: { itemStyle: {
@ -286,7 +288,7 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
$scope.mailTemplate = mailTemplate; $scope.mailTemplate = mailTemplate;
$scope.resultTypes = resultTypesMap; $scope.resultTypes = resultTypesMap;
$scope.channelResults = channelResultArray; $scope.channelResults = channelResultArray;
if (riskEvent.data.is_send_client == 1) if (riskEvent.data.is_send_client === 1)
riskEvent.data.is_send_client = true; riskEvent.data.is_send_client = true;
$scope.riskEvent = riskEvent.data; $scope.riskEvent = riskEvent.data;
@ -299,7 +301,7 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
}; };
$scope.checkTemplate = function () { $scope.checkTemplate = function () {
var url = ""; let url = "";
switch ($scope.riskEvent.mail_template) { switch ($scope.riskEvent.mail_template) {
case "1": case "1":
url = "https://file.royalpay.com.au/open/2019/03/27/1553658222567_BzfAtsEgsBdMQLl3jGOAlfcYmFUL1F.png"; url = "https://file.royalpay.com.au/open/2019/03/27/1553658222567_BzfAtsEgsBdMQLl3jGOAlfcYmFUL1F.png";
@ -323,13 +325,13 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
// 编辑表格的数据保存对象,重新从源数据复制,从而取消保存操作时不会更新视图 // 编辑表格的数据保存对象,重新从源数据复制,从而取消保存操作时不会更新视图
$scope.riskEventEdit = angular.copy(riskEvent.data); $scope.riskEventEdit = angular.copy(riskEvent.data);
//var index = $scope.riskEvent.order_ids.lastIndexOf(","); //let index = $scope.riskEvent.order_ids.lastIndexOf(",");
//$scope.riskEvent.order_ids = $scope.riskEvent.order_ids.substring(0, index) + "" + $scope.riskEvent.order_ids.substring(index + 1); //$scope.riskEvent.order_ids = $scope.riskEvent.order_ids.substring(0, index) + "" + $scope.riskEvent.order_ids.substring(index + 1);
// 获取数据库中对应的渠道字段 // 获取数据库中对应的渠道字段
var orderChannel = 'enable_'; let orderChannel = 'enable_';
if ($scope.riskEvent.order_type == 1) { if ($scope.riskEvent.order_type === 1) {
orderChannel += 'wechat'; orderChannel += 'wechat';
} else if ($scope.riskEvent.order_type == 2) { } else if ($scope.riskEvent.order_type === 2) {
orderChannel += 'alipay'; orderChannel += 'alipay';
} else { } else {
orderChannel = null; orderChannel = null;
@ -342,7 +344,11 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
}).then(function () { }).then(function () {
$http.delete('/risk/business/ban/' + $scope.riskEvent.risk_id).then(function () { $http.delete('/risk/business/ban/' + $scope.riskEvent.risk_id).then(function () {
$state.go('analysis_monitoring.risk_business'); $state.go('analysis_monitoring.risk_business');
commonDialog.alert({title: 'Delete', content: 'Risk Event Already Disabled', type: 'error'}); commonDialog.alert({
title: 'Delete',
content: 'Risk Event Already Disabled',
type: 'error'
});
}, function (resp) { }, function (resp) {
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
}) })
@ -350,10 +356,10 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
}; };
$scope.commitWaitRiskStatus = function () { $scope.commitWaitRiskStatus = function () {
var index = $scope.riskEvent.submit_url.lastIndexOf('='); let index = $scope.riskEvent.submit_url.lastIndexOf('=');
if (index < 0) if (index < 0)
index = $scope.riskEvent.submit_url.lastIndexOf('/'); index = $scope.riskEvent.submit_url.lastIndexOf('/');
var codeKey = $scope.riskEvent.submit_url.substring(index + 1); let codeKey = $scope.riskEvent.submit_url.substring(index + 1);
commonDialog.confirm({ commonDialog.confirm({
title: '确认已提交资料', title: '确认已提交资料',
content: '确认已收到商户资料,更新风控状态为等待风控审核?' content: '确认已收到商户资料,更新风控状态为等待风控审核?'
@ -368,6 +374,18 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
}) })
}; };
$scope.commitChargebackStatus = function (std) {
commonDialog.confirm({title: '确认操作', content: '当前操作不可逆,并会将风控项标记为办结状态,确认操作?'}).then(function () {
$http.put('/risk/business/chargebacks/' + $scope.riskEvent.risk_id + '/status', {status: std}).then(function () {
$state.reload();
commonDialog.alert({title: 'Success', content: '修改成功', type: success})
}, function (res) {
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'})
})
})
}
/** /**
* order_ids在指定位置换行 * order_ids在指定位置换行
* @param str * @param str
@ -375,15 +393,15 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
* @returns {*} * @returns {*}
*/ */
$scope.splitStr = function (str, position) { $scope.splitStr = function (str, position) {
if (str == null || str == '') if (str == null || str === '')
return; return;
var strArr = str.split(","); let strArr = str.split(",");
var resultStr = ''; let resultStr = '';
for (var i = 0; i < strArr.length; i++) { for (let i = 0; i < strArr.length; i++) {
resultStr += strArr[i]; resultStr += strArr[i];
if (i == (strArr.length - 1)) if (i === (strArr.length - 1))
break; break;
if ((i + 1) % position == 0) if ((i + 1) % position === 0)
resultStr += ", "; resultStr += ", ";
else else
resultStr += ","; resultStr += ",";
@ -405,7 +423,7 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
// 控制编辑表格的显示 // 控制编辑表格的显示
$scope.editFlag = false; $scope.editFlag = false;
$scope.changeEditFlag = function(editFlag) { $scope.changeEditFlag = function (editFlag) {
$scope.editFlag = !editFlag; $scope.editFlag = !editFlag;
// 如果是在编辑状态需要将日期转换为date类型前端控件需要 // 如果是在编辑状态需要将日期转换为date类型前端控件需要
// 如果是在非编辑状态需要将日期转换为yyyy-MM-dd格式 // 如果是在非编辑状态需要将日期转换为yyyy-MM-dd格式
@ -418,7 +436,7 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
} }
}; };
$scope.save = function(form) { $scope.save = function (form) {
if (form.$invalid) { if (form.$invalid) {
angular.forEach(form, function (item, key) { angular.forEach(form, function (item, key) {
if (key.indexOf('$') < 0) { if (key.indexOf('$') < 0) {
@ -454,10 +472,10 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
* @param temporaryFlag 是否临时关停 * @param temporaryFlag 是否临时关停
*/ */
$scope.updateChannel = function (orderType, channelFlag, temporaryFlag) { $scope.updateChannel = function (orderType, channelFlag, temporaryFlag) {
var channel; let channel;
if (orderType == "1") if (orderType === "1")
channel = 'wechat'; channel = 'wechat';
else if (orderType == "2") else if (orderType === "2")
channel = 'alipay'; channel = 'alipay';
$scope.riskEvent.temporary_close_channel = temporaryFlag; $scope.riskEvent.temporary_close_channel = temporaryFlag;
commonDialog.confirm({ commonDialog.confirm({
@ -477,7 +495,7 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
}; };
// 关停商户 // 关停商户
$scope.updateClient = function(isValid, temporaryFlag) { $scope.updateClient = function (isValid, temporaryFlag) {
$scope.riskEvent.temporary_close_merchant = temporaryFlag; $scope.riskEvent.temporary_close_merchant = temporaryFlag;
commonDialog.confirm({ commonDialog.confirm({
title: 'Warning', title: 'Warning',
@ -497,8 +515,8 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
title: 'Warning', title: 'Warning',
content: 'Please confirm sending mail.' content: 'Please confirm sending mail.'
}).then(function () { }).then(function () {
var url = '/risk/business/' + $scope.riskEvent.risk_id + '/upload_mail'; let url = '/risk/business/' + $scope.riskEvent.risk_id + '/upload_mail';
if ($scope.riskEvent.result_type == 1) if ($scope.riskEvent.result_type === 1)
url = '/risk/business/' + $scope.riskEvent.risk_id + '/urge'; url = '/risk/business/' + $scope.riskEvent.risk_id + '/urge';
$http.put(url).then(function () { $http.put(url).then(function () {
$state.reload(); $state.reload();
@ -514,14 +532,14 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
}; };
// 以下为BD上传材料相关 // 以下为BD上传材料相关
$scope.material={}; $scope.material = {};
$scope.uploadFile = function(files, index) { $scope.uploadFile = function (files, index) {
if (files && files.length) { if (files && files.length) {
var urls = new Array(); let urls = [];
var value = 0; let value = 0;
$scope.allMaterialInfo.material[index].fileProgressValue = 0; $scope.allMaterialInfo.material[index].fileProgressValue = 0;
for (var i = 0; i < files.length; i++) { for (let i = 0; i < files.length; i++) {
var file = files[i]; let file = files[i];
Upload.upload({ Upload.upload({
url: '/attachment/riskFiles', url: '/attachment/riskFiles',
data: {file: file} data: {file: file}
@ -531,8 +549,8 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
delete $scope.allMaterialInfo.material[index].fileProgressValue; delete $scope.allMaterialInfo.material[index].fileProgressValue;
alert('Upload Failed'); alert('Upload Failed');
}, function (evt) { }, function (evt) {
value += parseInt(100 * evt.loaded / evt.total ); value += parseInt(100 * evt.loaded / evt.total);
$scope.allMaterialInfo.material[index].fileProgressValue = value/(files.length*2); $scope.allMaterialInfo.material[index].fileProgressValue = value / (files.length * 2);
}) })
} }
$scope.allMaterialInfo.material[index].uploadFile = urls; $scope.allMaterialInfo.material[index].uploadFile = urls;
@ -540,11 +558,11 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
}; };
$scope.submit = function (form) { $scope.submit = function (form) {
var codeKey = $scope.riskEvent.submit_url.substring($scope.riskEvent.submit_url.lastIndexOf('=') + 1) || $scope.riskEvent.submit_url.substring($scope.riskEvent.submit_url.lastIndexOf('/') + 1); let codeKey = $scope.riskEvent.submit_url.substring($scope.riskEvent.submit_url.lastIndexOf('=') + 1) || $scope.riskEvent.submit_url.substring($scope.riskEvent.submit_url.lastIndexOf('/') + 1);
$scope.material.update_time=$filter('date')(new Date(), 'yyyy-MM-dd HH:mm:ss'); $scope.material.update_time = $filter('date')(new Date(), 'yyyy-MM-dd HH:mm:ss');
$scope.material.risk_id = $scope.riskEvent.risk_id; $scope.material.risk_id = $scope.riskEvent.risk_id;
for (var i = 0; i < $scope.allMaterialInfo.material.length; i++) { for (let i = 0; i < $scope.allMaterialInfo.material.length; i++) {
var key = 'file' + (i + 1) + "_url"; let key = 'file' + (i + 1) + "_url";
$scope.material[key] = $scope.allMaterialInfo.material[i].uploadFile; $scope.material[key] = $scope.allMaterialInfo.material[i].uploadFile;
} }
$scope.material.description = $scope.allMaterialInfo.description; $scope.material.description = $scope.allMaterialInfo.description;
@ -565,12 +583,12 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
}; };
// 加载提交材料 // 加载提交材料
$scope.loadRiskMaterial = function() { $scope.loadRiskMaterial = function () {
// $http.get('/risk/business/' + $scope.riskEvent.risk_id + '/material').then(function(resp) { // $http.get('/risk/business/' + $scope.riskEvent.risk_id + '/material').then(function(resp) {
// $scope.material = resp.data; // $scope.material = resp.data;
// }); // });
$http.get('/risk/business/' + $scope.riskEvent.risk_id + '/all_material_info').then(function(resp) { $http.get('/risk/business/' + $scope.riskEvent.risk_id + '/all_material_info').then(function (resp) {
$scope.allMaterialInfo = resp.data; $scope.allMaterialInfo = resp.data;
if ($scope.uploadShowFlag) { if ($scope.uploadShowFlag) {
$scope.allMaterialInfo.description = ''; $scope.allMaterialInfo.description = '';
@ -579,7 +597,7 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
}; };
// BD是否可上传 // BD是否可上传
$scope.uploadShowFlag = ($scope.riskEvent.result_type == 1 || $scope.riskEvent.result_type == 3 || $scope.riskEvent.result_type == 4) ? true : false; $scope.uploadShowFlag = ($scope.riskEvent.result_type === 1 || $scope.riskEvent.result_type === 3 || $scope.riskEvent.result_type === 4);
//if (!$scope.uploadShowFlag) //if (!$scope.uploadShowFlag)
$scope.loadRiskMaterial(); $scope.loadRiskMaterial();
} }
@ -595,7 +613,7 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
// 加载提交材料 // 加载提交材料
// $scope.fileObject = {}; // $scope.fileObject = {};
$scope.loadRiskMaterial = function() { $scope.loadRiskMaterial = function () {
// $http.get('/risk/business/' + $scope.riskEvent.risk_id + '/material').then(function(resp) { // $http.get('/risk/business/' + $scope.riskEvent.risk_id + '/material').then(function(resp) {
// $scope.riskMaterial = resp.data; // $scope.riskMaterial = resp.data;
// $scope.file1 = resp.data.file1; // $scope.file1 = resp.data.file1;
@ -605,31 +623,31 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
// $scope.file5 = resp.data.file5; // $scope.file5 = resp.data.file5;
// $scope.file6 = resp.data.file6; // $scope.file6 = resp.data.file6;
// //
// // for (var i = 1; i <= 10; i++) { // // for (let i = 1; i <= 10; i++) {
// // var key = "file" + i; // // let key = "file" + i;
// // if (riskMaterial[key + '_url'] != null) // // if (riskMaterial[key + '_url'] != null)
// // $scope.fileObject[key] = riskMaterial[key + '_url']; // // $scope.fileObject[key] = riskMaterial[key + '_url'];
// // } // // }
// // $scope.fileLength = Object.keys($scope.fileObject).length; // // $scope.fileLength = Object.keys($scope.fileObject).length;
// }) // })
$http.get('/risk/business/' + $scope.riskEvent.risk_id + '/all_material_info').then(function(resp) { $http.get('/risk/business/' + $scope.riskEvent.risk_id + '/all_material_info').then(function (resp) {
$scope.riskMaterial = resp.data; $scope.riskMaterial = resp.data;
}); });
}; };
$scope.loadRiskMaterial(); $scope.loadRiskMaterial();
//审核通过也要可以传图片 //审核通过也要可以传图片
$scope.uploadShowFlag = ($scope.riskEvent.result_type == 1 || $scope.riskEvent.result_type == 3 || $scope.riskEvent.result_type == 4) ? true : false; $scope.uploadShowFlag = ($scope.riskEvent.result_type === 1 || $scope.riskEvent.result_type === 3 || $scope.riskEvent.result_type === 4);
// 材料上传 // 材料上传
$scope.uploadFile = function(files, index) { $scope.uploadFile = function (files, index) {
if (files && files.length) { if (files && files.length) {
var urls = new Array(); let urls = [];
var value = 0; let value = 0;
$scope.riskMaterial.material[index].fileProgressValue = 0; $scope.riskMaterial.material[index].fileProgressValue = 0;
for (var i = 0; i < files.length; i++) { for (let i = 0; i < files.length; i++) {
var file = files[i]; let file = files[i];
Upload.upload({ Upload.upload({
url: '/attachment/riskFiles', url: '/attachment/riskFiles',
data: {file: file} data: {file: file}
@ -640,8 +658,8 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
delete $scope.riskMaterial.material[index].fileProgressValue; delete $scope.riskMaterial.material[index].fileProgressValue;
alert('Upload Failed'); alert('Upload Failed');
}, function (evt) { }, function (evt) {
value += parseInt(100 * evt.loaded / evt.total ); value += parseInt(100 * evt.loaded / evt.total);
$scope.riskMaterial.material[index].fileProgressValue = value/(files.length*2); $scope.riskMaterial.material[index].fileProgressValue = value / (files.length * 2);
}) })
} }
$scope.riskMaterial.material[index].file = urls; $scope.riskMaterial.material[index].file = urls;
@ -649,14 +667,14 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
}; };
$scope.submit = function (form) { $scope.submit = function (form) {
var index = $scope.riskEvent.submit_url.lastIndexOf('='); let index = $scope.riskEvent.submit_url.lastIndexOf('=');
if (index < 0) if (index < 0)
index = $scope.riskEvent.submit_url.lastIndexOf('/'); index = $scope.riskEvent.submit_url.lastIndexOf('/');
var codeKey = $scope.riskEvent.submit_url.substring(index + 1); let codeKey = $scope.riskEvent.submit_url.substring(index + 1);
$scope.material.update_time=$filter('date')(new Date(), 'yyyy-MM-dd HH:mm:ss'); $scope.material.update_time = $filter('date')(new Date(), 'yyyy-MM-dd HH:mm:ss');
$scope.material.risk_id = $scope.riskEvent.risk_id; $scope.material.risk_id = $scope.riskEvent.risk_id;
for (var i = 0; i < $scope.riskMaterial.material.length; i++) { for (let i = 0; i < $scope.riskMaterial.material.length; i++) {
var key = 'file' + (i + 1) + "_url"; let key = 'file' + (i + 1) + "_url";
$scope.material[key] = $scope.riskMaterial.material[i].file; $scope.material[key] = $scope.riskMaterial.material[i].file;
} }
$scope.material.description = $scope.riskMaterial.description; $scope.material.description = $scope.riskMaterial.description;
@ -677,11 +695,11 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
}; };
// 材料审核 // 材料审核
$scope.auditMaterial = function(auditType) { $scope.auditMaterial = function (auditType) {
var url = '/risk/business/events/pass'; let url = '/risk/business/events/pass';
var warningMessageHTML = '是否确定<span style="color: green; font-weight: bolder; font-size: 20px;">通过</span>该材料?'; let warningMessageHTML = '是否确定<span style="color: green; font-weight: bolder; font-size: 20px;">通过</span>该材料?';
if (auditType == 3) { if (auditType === 3) {
commonDialog.confirm({ commonDialog.confirm({
title: 'Warning', title: 'Warning',
contentHtml: $sce.trustAsHtml(warningMessageHTML) contentHtml: $sce.trustAsHtml(warningMessageHTML)
@ -698,8 +716,7 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
}); });
}); });
}); });
} } else if (auditType === 4) {
else if (auditType == 4) {
url = '/risk/business/' + $scope.riskEvent.risk_id + '/refuse'; url = '/risk/business/' + $scope.riskEvent.risk_id + '/refuse';
//warningMessageHTML = '是否确定<span style="color: red; font-weight: bolder; font-size: 20px;">拒绝</span>该材料?' //warningMessageHTML = '是否确定<span style="color: red; font-weight: bolder; font-size: 20px;">拒绝</span>该材料?'
commonDialog.inputText({title: 'Input Refuse Description', size: 'lg'}).then(function (text) { commonDialog.inputText({title: 'Input Refuse Description', size: 'lg'}).then(function (text) {
@ -732,8 +749,21 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
$scope.materials = [{key: 0, value: ""}]; $scope.materials = [{key: 0, value: ""}];
$scope.canMinus = false; $scope.canMinus = false;
$scope.riskEvent = {}; $scope.riskEvent = {};
$scope.searchForChargeback = function () {
$scope.riskEvent.order_ids = null;
let channelOrderId = $scope.riskEvent.channel_order_id;
$http.get('/risk/business/chargeback_orders', {channel_order_id: channelOrderId}).then(function (res) {
$scope.channel_orders = res.data;
}, function (res) {
commonDialog.alert({type: 'error', title: 'Error', content: res.data.message})
});
};
$scope.chooseOrderForChargeback = function (chargebackOrder) {
$scope.riskEvent.order_ids = chargebackOrder.channel_order_id;
$scope.riskEvent.client_moniker = chargebackOrder.client_moniker;
}
$scope.checkTemplate = function () { $scope.checkTemplate = function () {
var url = ""; let url = "";
switch ($scope.riskEvent.mail_template) { switch ($scope.riskEvent.mail_template) {
case "1": case "1":
url = "https://file.royalpay.com.au/open/2019/03/27/1553658222567_BzfAtsEgsBdMQLl3jGOAlfcYmFUL1F.png"; url = "https://file.royalpay.com.au/open/2019/03/27/1553658222567_BzfAtsEgsBdMQLl3jGOAlfcYmFUL1F.png";
@ -757,35 +787,35 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
$scope.canMinus = true; $scope.canMinus = true;
}; };
$scope.decrease = function($index) { $scope.decrease = function ($index) {
// 如果input大于1删除 // 如果input大于1删除
if ($scope.materials.length > 1) { if ($scope.materials.length > 1) {
$scope.materials.splice($index, 1); $scope.materials.splice($index, 1);
} }
// 如果回复数为1不允许删除 // 如果回复数为1不允许删除
if ($scope.materials.length == 1) { if ($scope.materials.length === 1) {
$scope.canMinus = false; $scope.canMinus = false;
} }
}; };
var array=new Array(); let array = [];
var validIndex = 0; let validIndex = 0;
$scope.combineMaterials = function() { $scope.combineMaterials = function () {
for (var i = 0; i < $scope.materials.length; i++) { for (let i = 0; i < $scope.materials.length; i++) {
var value = $scope.materials[i].value; let value = $scope.materials[i].value;
if (value == '') if (value === '')
continue; continue;
var cr = {}; let cr = {};
cr['question' + (validIndex + 1)] = $scope.materials[i].value; cr['question' + (validIndex + 1)] = $scope.materials[i].value;
array[validIndex] = cr; array[validIndex] = cr;
validIndex++; validIndex++;
} }
if (array.length == 0) if (array.length === 0)
return null; return null;
return JSON.stringify(array); return JSON.stringify(array);
}; };
$scope.is_send_client = false; $scope.is_send_client = false;
$scope.changeIsSendClient = function(flag) { $scope.changeIsSendClient = function (flag) {
$scope.is_send_client = flag $scope.is_send_client = flag
$scope.send_clean_days = flag $scope.send_clean_days = flag
}; };
@ -803,7 +833,7 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
if ($scope.riskEvent.receive_email_date == null) if ($scope.riskEvent.receive_email_date == null)
$scope.riskEvent.receive_email_date = new Date(); $scope.riskEvent.receive_email_date = new Date();
// 默认设置邮件回复截止日期为收到邮件的七天后,如果是内部调单,设置三天后 // 默认设置邮件回复截止日期为收到邮件的七天后,如果是内部调单,设置三天后
var replyDeadline = angular.copy($scope.riskEvent.receive_email_date); let replyDeadline = angular.copy($scope.riskEvent.receive_email_date);
if ($scope.riskEvent.order_type > 2) if ($scope.riskEvent.order_type > 2)
replyDeadline.setDate(replyDeadline.getDate() + 3); replyDeadline.setDate(replyDeadline.getDate() + 3);
else else
@ -818,8 +848,8 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
$scope.riskEvent.send_clean_days = $scope.send_clean_days; $scope.riskEvent.send_clean_days = $scope.send_clean_days;
var saveRiskBtn = document.getElementById('save-risk-btn'); let saveRiskBtn = document.getElementById('save-risk-btn');
var saveRiskBtnInnerHtmlBak = saveRiskBtn.innerHTML; let saveRiskBtnInnerHtmlBak = saveRiskBtn.innerHTML;
saveRiskBtn.disabled = true; saveRiskBtn.disabled = true;
saveRiskBtn.innerHTML = "<i class='fa fa-spinner fa-spin '></i> Processing"; saveRiskBtn.innerHTML = "<i class='fa fa-spinner fa-spin '></i> Processing";
$http.post('/risk/business/events', $scope.riskEvent).then(function (resp) { $http.post('/risk/business/events', $scope.riskEvent).then(function (resp) {
@ -830,7 +860,7 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
content: 'Register new riskEvent successfully', content: 'Register new riskEvent successfully',
type: 'success' type: 'success'
}); });
$state.go('^',{}, {reload: true}); $state.go('^', {}, {reload: true});
}, function (resp) { }, function (resp) {
saveRiskBtn.innerHTML = saveRiskBtnInnerHtmlBak; saveRiskBtn.innerHTML = saveRiskBtnInnerHtmlBak;
saveRiskBtn.disabled = false; saveRiskBtn.disabled = false;
@ -842,16 +872,15 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
}); });
}; };
$scope.partnerParam = {}; $scope.partnerParam = {};
$scope.loadParnters = function() { $scope.loadParnters = function () {
$scope.partnerParam.sub_merchant_id = $scope.riskEvent.sub_merchant_id; $scope.partnerParam.sub_merchant_id = $scope.riskEvent.sub_merchant_id;
$http.get('/risk/business/partners', {params: $scope.partnerParam}).then(function (resp) { $http.get('/risk/business/partners', {params: $scope.partnerParam}).then(function (resp) {
$scope.partners = resp.data; $scope.partners = resp.data;
if ($scope.partners != null && $scope.partners.length > 0) { if ($scope.partners != null && $scope.partners.length > 0) {
// 由于通用号调单可能无法提供商户client_moniker,所以后台无法查询到订单 // 由于通用号调单可能无法提供商户client_moniker,所以后台无法查询到订单
if ($scope.partners.length == 1 || $scope.riskEvent.order_type != 5) if ($scope.partners.length === 1 || $scope.riskEvent.order_type !== 5)
$scope.riskEvent.client_moniker = $scope.partners[0].client_moniker; $scope.riskEvent.client_moniker = $scope.partners[0].client_moniker;
} } else {
else {
commonDialog.confirm({ commonDialog.confirm({
title: 'Warning', title: 'Warning',
content: '该微信子商户号下暂时没有商户或者商户被禁用,是否继续?' content: '该微信子商户号下暂时没有商户或者商户被禁用,是否继续?'
@ -863,7 +892,7 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
$scope.riskEvent.sub_merchant_id = ''; $scope.riskEvent.sub_merchant_id = '';
}); });
} }
if ($scope.partners != null && $scope.partners.length > 1 && $scope.riskEvent.order_type != 5) if ($scope.partners != null && $scope.partners.length > 1 && $scope.riskEvent.order_type !== 5)
commonDialog.confirm({ commonDialog.confirm({
title: 'Warning', title: 'Warning',
content: '该微信子商户号下有多个商户,是否将调单类型改为通用号调单?' content: '该微信子商户号下有多个商户,是否将调单类型改为通用号调单?'
@ -877,8 +906,8 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
]); ]);
// 调单类型过滤器 // 调单类型过滤器
app.filter('orderType', function() { app.filter('orderType', function () {
return function(type) { return function (type) {
return orderTypesMap[type]; return orderTypesMap[type];
} }
}); });
@ -895,22 +924,22 @@ define(['angular', 'jquery', 'uiRouter', './monitoring/analysis-monitoring'],
} }
}); });
app.filter('warningOrderType', function() { app.filter('warningOrderType', function () {
return function(type) { return function (type) {
return warningOrderTypesMap[type]; return warningOrderTypesMap[type];
} }
}); });
// 处理结果过滤器 // 处理结果过滤器
app.filter('resultType', function() { app.filter('resultType', function () {
return function(type, resultTypesMap) { return function (type, resultTypesMap) {
return resultTypesMap[type]; return resultTypesMap[type];
} }
}); });
// 邮件发送状态过滤器 // 邮件发送状态过滤器
app.filter('emailStatus', function() { app.filter('emailStatus', function () {
return function(status) { return function (status) {
return emailStatusMap[status]; return emailStatusMap[status];
} }
}); });

@ -25,6 +25,9 @@
<li class="list-group-item" ng-class="{'active':regionActive('AU_NSW')}" <li class="list-group-item" ng-class="{'active':regionActive('AU_NSW')}"
ng-click="toggleRegion('AU_NSW')">AU NSW ng-click="toggleRegion('AU_NSW')">AU NSW
</li> </li>
<li class="list-group-item" ng-class="{'active':regionActive('AU_QLD')}"
ng-click="toggleRegion('AU_QLD')">AU QLD
</li>
</ul> </ul>
</div> </div>
</div> </div>

@ -1,4 +1,3 @@
<section class="content-header"> <section class="content-header">
<h1>New RiskEvent</h1> <h1>New RiskEvent</h1>
</section> </section>
@ -56,7 +55,8 @@
</div> </div>
</div> </div>
</div> </div>
<div class="form-group" ng-if="riskEvent.order_type ==3 && riskEvent.royalpay_order_type==1"> <div class="form-group"
ng-if="riskEvent.order_type ==3 && riskEvent.royalpay_order_type==1">
<label class="control-label col-sm-2">是否发送清算周期变更</label> <label class="control-label col-sm-2">是否发送清算周期变更</label>
<div class="col-xs-6"> <div class="col-xs-6">
<input type="checkbox" <input type="checkbox"
@ -111,7 +111,8 @@
</div> </div>
</div> </div>
<div class="form-group" ng-if="(partners != null) && (partners.length > 0) && riskEvent.order_type == 1"> <div class="form-group"
ng-if="(partners != null) && (partners.length > 0) && riskEvent.order_type == 1">
<label class="control-label col-sm-2" <label class="control-label col-sm-2"
for="order-type-input">Company Name for="order-type-input">Company Name
</label> </label>
@ -134,7 +135,7 @@
</div> </div>
<div class="form-group" <div class="form-group"
ng-if="riskEvent.order_type != 5" ng-if="riskEvent.order_type != 5 && riskEvent.order_type!=6"
ng-class="{'has-error':riskEventForm.client_moniker.$invalid && riskEventForm.client_moniker.$dirty}"> ng-class="{'has-error':riskEventForm.client_moniker.$invalid && riskEventForm.client_moniker.$dirty}">
<label class="control-label col-sm-2" <label class="control-label col-sm-2"
for="short-id-input">Partner Code for="short-id-input">Partner Code
@ -165,19 +166,19 @@
</div> </div>
<div class="form-group" <div class="form-group"
ng-if="riskEvent.order_type != 4" ng-if="riskEvent.order_type != 4 && riskEvent.order_type!=6"
ng-class="{'has-error':riskEventForm.order_ids.$invalid && riskEventForm.order_ids.$dirty}"> ng-class="{'has-error':riskEventForm.order_ids.$invalid && riskEventForm.order_ids.$dirty}">
<label class="control-label col-sm-2" <label class="control-label col-sm-2"
for="order-ids-input">Platform Transaction IDs</label> for="order-ids-input">Platform Transaction IDs</label>
<div class="col-sm-8"> <div class="col-sm-8">
<textarea class="form-control" <textarea class="form-control"
ng-model="riskEvent.order_ids" ng-model="riskEvent.order_ids"
type="text" type="text"
rows="2" rows="2"
name="order_ids" name="order_ids"
id="order-ids-input" id="order-ids-input"
placeholder="多个id请用半角逗号 ',' 隔开" placeholder="多个id请用半角逗号 ',' 隔开"
required> required>
</textarea> </textarea>
<div ng-messages="riskEventForm.order_ids.$error" <div ng-messages="riskEventForm.order_ids.$error"
ng-if="riskEventForm.order_ids.$dirty"> ng-if="riskEventForm.order_ids.$dirty">
@ -187,11 +188,59 @@
</div> </div>
</div> </div>
</div> </div>
<div class="form-group" ng-if="riskEvent.order_type==6"
ng-class="{'has-error':riskEventForm.channel_order_id.$invalid && riskEventForm.channel_order_id.$dirty}">
<label class="control-label col-sm-2" for="channel-order-id-input">Channel Transaction
ID</label>
<div class="col-sm-8">
<div class="input-group">
<input type="text" name="channel_order_id" id="channel-order-id-input"
class="form-control" ng-model="riskEvent.channel_order_id">
<div class="input-group-btn">
<button type="button" class="btn btn-success"
ng-click="searchForChargeback()"><i class="fa fa-search"></i>
</button>
</div>
</div>
</div>
</div>
<div class="row" ng-if="riskEvent.order_type==6 && channel_orders && !riskEvent.order_ids">
<div class="col-sm-12 table-responsive">
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>Merchant</th>
<th>Order ID</th>
<th>Channel</th>
<th>Channel Order ID</th>
<th>Amount</th>
<th>Transaction Time</th>
<th>Operation</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="order in channel_orders">
<td ng-bind="order.client_moniker"></td>
<td ng-bind="order.order_id"></td>
<td ng-bind="order.channel"></td>
<td ng-bind="order.channel_order_id"></td>
<td ng-bind="order.amount|currency:'AUD'"></td>
<td ng-bind="order.transaction_time|date:'yyyy-MM-dd HH:mm:ss'"></td>
<td>
<button class="btn btn-link" type="button"
ng-click="chooseOrderForChargeback(order)">Choose
</button>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="form-group"> <div class="form-group">
<label class="control-label col-sm-2" <label class="control-label col-sm-2"
for="receive-date-input"> for="receive-date-input">
{{(riskEvent.order_type == 1 || riskEvent.order_type ==2) ? 'Receive Date' : 'Create Date'}} {{(riskEvent.order_type == 1 || riskEvent.order_type == 2) ? 'Receive Date' : 'Create Date'}}
</label> </label>
<div class="col-xs-2"> <div class="col-xs-2">
<input class="form-control" <input class="form-control"
@ -213,9 +262,9 @@
</label> </label>
<div class="col-sm-8"> <div class="col-sm-8">
<textarea class="form-control" <textarea class="form-control"
ng-model="riskEvent.description" ng-model="riskEvent.description"
name="description" name="description"
id="description-input"> id="description-input">
</textarea> </textarea>
</div> </div>
</div> </div>
@ -223,21 +272,23 @@
<div class="form-group" ng-repeat="material in materials" <div class="form-group" ng-repeat="material in materials"
ng-if="riskEvent.order_type == 2"> ng-if="riskEvent.order_type == 2">
<label class="control-label col-sm-2" <label class="control-label col-sm-2"
for="material{{$index+1}}">Material{{$index + 1}} for="material{{$index+1}}">Material{{$index + 1}}
</label> </label>
<div class="col-sm-8"> <div class="col-sm-8">
<input class="form-control" <input class="form-control"
ng-model="material.value" ng-model="material.value"
type="text" type="text"
name="material{{$index+1}}" ng-input-name="material{{$index+1}}"
id="material{{$index+1}}" id="material{{$index+1}}"
required> required>
</div> </div>
<div class="col-sm-2"> <div class="col-sm-2">
<a class="text-success" ng-click="increase($index)"><i class="fa fa-plus-circle" style="width: 30px"></i></a> <a class="text-success" ng-click="increase($index)"><i class="fa fa-plus-circle"
<a class="text-danger" ng-click="decrease($index)" ng-show="canMinus"><i class="fa fa-minus-circle" style="width: 30px"></i></a> style="width: 30px"></i></a>
</div> <a class="text-danger" ng-click="decrease($index)" ng-show="canMinus"><i
class="fa fa-minus-circle" style="width: 30px"></i></a>
</div>
</div> </div>
<div class="form-group" <div class="form-group"

@ -252,7 +252,8 @@
<button class="btn btn-info" <button class="btn btn-info"
ng-if="enableChannel == 0" ng-if="enableChannel == 0"
type="button" type="button"
ng-click="updateChannel(riskEvent.order_type, true, false)">重新启用渠道 ng-click="updateChannel(riskEvent.order_type, true, false)">
重新启用渠道
</button> </button>
</div> </div>
<div class="col-xs-2" ng-if="clientInfo.is_valid == 0"> <div class="col-xs-2" ng-if="clientInfo.is_valid == 0">
@ -262,6 +263,18 @@
ng-if="'10000000000'|withRole">重新启用商户 ng-if="'10000000000'|withRole">重新启用商户
</button> </button>
</div> </div>
<div class="col-xs-2"
ng-if="riskEvent.order_type==6 && ('10000000000'|withRole)">
<button class="btn btn-info" type="button"
ng-click="commitChargebackStatus('ACCEPTED')">放弃申诉
</button>
</div>
<div class="col-xs-2"
ng-if="riskEvent.order_type==6 && ('10000000000'|withRole)">
<button class="btn btn-info" type="button"
ng-click="commitChargebackStatus('DECLINED')">申诉成功
</button>
</div>
</div> </div>
<div class="form-group" ng-if="riskEvent.channel_result != null && ('10000000000'|withRole)"> <div class="form-group" ng-if="riskEvent.channel_result != null && ('10000000000'|withRole)">

Loading…
Cancel
Save