This commit is contained in:
磷叶 2024-11-28 10:56:01 +08:00
parent 3c1030b55b
commit 0a14baad16
7 changed files with 88 additions and 25 deletions

View File

@ -26,7 +26,8 @@ public enum RedisLockKey {
PAY_BILL_SUCCESS("pay_bill_success", "支付订单成功处理"),
RECOVER_DEVICE_BALANCE("recover_device_balance", "恢复设备余额"),
ADD_USER_WX_OPEN_ID("add_user_wx_open_id", "微信注册用户"),
ADD_USER_MOBILE("add_user_mobile", "手机号注册用户");
ADD_USER_MOBILE("add_user_mobile", "手机号注册用户"),
SUBMIT_RISK_INFO("submit_risk_info", "提交风控材料");
private final String key;

View File

@ -14,7 +14,8 @@ public enum RiskSubmitType {
ID_CARD("2", "身份证正反面"),
ID_CARD_HAND("3", "手持身份证照片"),
VIDEO("4", "使用场景视频"),
BUSINESS_LICENCE("5", "营业执照");
BUSINESS_LICENCE("5", "营业执照"),
DUTY_VIDEO("6", "责任视频");
private final String code;
private final String msg;

View File

@ -15,4 +15,6 @@ public class RiskInfoQuery extends RiskInfoVO {
@ApiModelProperty("状态列表")
private List<String> statusList;
@ApiModelProperty("排除的ID")
private Long excludeInfoId;
}

View File

@ -54,6 +54,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="query.verifyRemark != null and query.verifyRemark != ''"> and sri.verify_remark like concat('%', #{query.verifyRemark}, '%')</if>
<if test="query.userId != null "> and sr.user_id = #{query.userId}</if>
<if test="query.userName != null and query.userName != ''"> and if(su.is_real, su.real_name, su.user_name) like concat('%', #{query.userName}, '%')</if>
<if test="query.excludeInfoId != null">
and sri.info_id != #{query.excludeInfoId}
</if>
<if test="query.statusList != null and query.statusList.size() > 0">
and sri.status in
<foreach collection="query.statusList" item="item" open="(" close=")" separator=",">

View File

@ -4,6 +4,8 @@ import java.time.LocalDateTime;
import java.util.List;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.core.redis.RedisLock;
import com.ruoyi.common.core.redis.enums.RedisLockKey;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.ServiceUtil;
@ -41,6 +43,9 @@ public class RiskInfoServiceImpl implements RiskInfoService
@Autowired
private RiskService riskService;
@Autowired
private RedisLock redisLock;
/**
* 查询风控材料
*
@ -124,31 +129,41 @@ public class RiskInfoServiceImpl implements RiskInfoService
// 校验数据
RiskInfoVO old = this.selectRiskInfoByInfoId(infoId);
riskInfoValidator.preSubmitCheck(old);
ServiceUtil.assertion(old == null || old.getRiskId() == null, "待提交的数据不存在");
Long lockKey = old.getRiskId();
ServiceUtil.assertion(!redisLock.lock(RedisLockKey.SUBMIT_RISK_INFO, lockKey), "正在处理,请勿重复提交");
Integer result = transactionTemplate.execute(status -> {
RiskInfoVO data = new RiskInfoVO();
data.setSubmitTime(LocalDateTime.now());
data.setStatus(RiskInfoStatus.WAIT_VERIFY.getStatus());
RiskInfoQuery query = new RiskInfoQuery();
query.setInfoId(infoId);
query.setStatusList(RiskInfoStatus.canSubmit());
int submit = this.updateByQuery(data, query);
ServiceUtil.assertion(submit != 1, "提交失败");
try {
// 校验
riskInfoValidator.preSubmitCheck(old);
// 操作
Integer result = transactionTemplate.execute(status -> {
RiskInfoVO data = new RiskInfoVO();
data.setSubmitTime(LocalDateTime.now());
data.setStatus(RiskInfoStatus.WAIT_VERIFY.getStatus());
RiskInfoQuery query = new RiskInfoQuery();
query.setInfoId(infoId);
query.setStatusList(RiskInfoStatus.canSubmit());
int submit = this.updateByQuery(data, query);
ServiceUtil.assertion(submit != 1, "提交失败");
// 若开启了提交后自动通过则直接通过
if (old.getRiskUnsealSelf() != null && old.getRiskUnsealSelf()) {
RiskInfoVerifyDTO dto = new RiskInfoVerifyDTO();
dto.setInfoId(infoId);
dto.setPass(true);
dto.setVerifyRemark("免审核通过");
this.verify(dto, LoginUser.system());
}
// 若开启了提交后自动通过则直接通过
if (old.getRiskUnsealSelf() != null && old.getRiskUnsealSelf()) {
RiskInfoVerifyDTO dto = new RiskInfoVerifyDTO();
dto.setInfoId(infoId);
dto.setPass(true);
dto.setVerifyRemark("免审核通过");
this.verify(dto, LoginUser.system());
}
return submit;
});
return submit;
});
return result == null ? 0 : result;
} finally {
redisLock.unlock(RedisLockKey.SUBMIT_RISK_INFO, lockKey);
}
return result == null ? 0 : result;
}
@Override
@ -185,8 +200,10 @@ public class RiskInfoServiceImpl implements RiskInfoService
ServiceUtil.assertion(update != 1, "当前风控材料状态已发生变化,请刷新后重试");
// 解封
int finish = riskService.finish(old.getRiskId());
ServiceUtil.assertion(finish != 1, "解封失败,请重试");
if (dto.getPass() != null && dto.getPass()) {
int finish = riskService.finish(old.getRiskId());
ServiceUtil.assertion(finish != 1, "解封失败,请重试");
}
return update;
});

View File

@ -8,6 +8,7 @@ import com.ruoyi.ss.realName.service.RealNameService;
import com.ruoyi.ss.risk.domain.enums.RiskSubmitType;
import com.ruoyi.ss.risk.service.RiskValidator;
import com.ruoyi.ss.riskInfo.domain.RiskInfo;
import com.ruoyi.ss.riskInfo.domain.RiskInfoQuery;
import com.ruoyi.ss.riskInfo.domain.RiskInfoVO;
import com.ruoyi.ss.riskInfo.domain.enums.RiskInfoStatus;
import com.ruoyi.ss.riskInfo.service.RiskInfoService;
@ -71,6 +72,9 @@ public class RiskInfoValidatorImpl implements RiskInfoValidator {
ServiceUtil.assertion(data == null, "参数错误");
ServiceUtil.assertion(!RiskInfoStatus.canSubmit().contains(data.getStatus()), "风控材料当前状态不允许提交");
// 判断是否已有提交的不允许重复提交
this.checkRepeatSubmit(data.getRiskId(), data.getInfoId());
if (CollectionUtils.isEmptyElement(data.getRiskSubmitType())) {
return;
}
@ -89,9 +93,23 @@ public class RiskInfoValidatorImpl implements RiskInfoValidator {
if (types.contains(RiskSubmitType.VIDEO.getCode())) {
ServiceUtil.assertion(StringUtils.isAnyBlank(data.getVideo()), "请上传使用场景视频");
}
if (types.contains(RiskSubmitType.DUTY_VIDEO.getCode())) {
ServiceUtil.assertion(StringUtils.isAnyBlank(data.getDutyVideo()), "请上传责任视频");
}
if (types.contains(RiskSubmitType.BUSINESS_LICENCE.getCode())) {
ServiceUtil.assertion(StringUtils.isAnyBlank(data.getBusinessLicence()), "请上传营业执照");
}
}
private void checkRepeatSubmit(Long riskId, Long infoId) {
if (riskId == null) {
return;
}
RiskInfoQuery query = new RiskInfoQuery();
query.setRiskId(riskId);
query.setExcludeInfoId(infoId);
query.setStatus(RiskInfoStatus.WAIT_VERIFY.getStatus());
ServiceUtil.assertion(riskInfoService.selectCount(query) > 0, "当前风控有正在审核中的材料,请勿重复提交");
}
}

View File

@ -0,0 +1,21 @@
package com.ruoyi.web.controller.staff;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.dashboard.service.DashboardService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 合伙人报表Controller
* @author wjh
* 2024/11/28
*/
@RestController
@RequestMapping("/staff/dashboard")
public class StaffDashboardController extends BaseController {
@Autowired
DashboardService dashboardService;
}