Commit e786cdd5 authored by 王向伟's avatar 王向伟

EventHandler代码格式化

parent 5339af9b
...@@ -46,100 +46,94 @@ import java.util.*; ...@@ -46,100 +46,94 @@ import java.util.*;
@Service @Service
@Slf4j @Slf4j
public class ${prefix}EventHandler extends AbstractEventHandler implements IEventHandler { public class ${prefix}EventHandler extends AbstractEventHandler implements IEventHandler {
@Autowired @Autowired
private ILoanOrderMappingService orderMappingService; private ILoanOrderMappingService orderMappingService;
@Autowired @Autowired
private IUserMappingService userMappingService; private IUserMappingService userMappingService;
@Autowired @Autowired
private LoanMappingService loanMappingService; private LoanMappingService loanMappingService;
@Autowired @Autowired
private IRepayFlowNoMappingRepository repayFlowNoMappingRepository; private IRepayFlowNoMappingRepository repayFlowNoMappingRepository;
@Resource(name = "standardApplicationMoService") @Resource(name = "standardApplicationMoService")
private StandardApplicationService standardApplicationService; private StandardApplicationService standardApplicationService;
@Override @Override
public void creditSuccessPublish(CreditSuccessEvent creditSuccEvent) { public void creditSuccessPublish(CreditSuccessEvent creditSuccEvent) {
String logPrefix = "[notify][handler][creditSuccEvent]"; String logPrefix = "[notify][handler][creditSuccEvent]";
log.info("{},不处理进件同步成功事件,消息内容:{}", logPrefix, creditSuccEvent); log.info("{},不处理进件同步成功事件,消息内容:{}", logPrefix, creditSuccEvent);
} }
@Override @Override
public void auditRejectPublish(AuditRejectEvent auditRejectEvent) { public void auditRejectPublish(AuditRejectEvent auditRejectEvent) {
String logPrefix = "[${prefix}EventHandler][auditRejectPublish]"; String logPrefix = "[${prefix}EventHandler][auditRejectPublish]";
log.info("{},${prefix},审核拒绝事件,消息内容:{}", logPrefix, auditRejectEvent); log.info("{},${prefix},审核拒绝事件,消息内容:{}", logPrefix, auditRejectEvent);
QuotaNoticeExtraDto extraDto = auditRejectEvent.getQueueNotice(); QuotaNoticeExtraDto extraDto = auditRejectEvent.getQueueNotice();
Long channelId = auditRejectEvent.getChannelId(); Long channelId = auditRejectEvent.getChannelId();
KANoticeType noticeType = auditRejectEvent.getNoticeType(); KANoticeType noticeType = auditRejectEvent.getNoticeType();
String applyNo = extraDto.getData().getApplyNo(); String applyNo = extraDto.getData().getApplyNo();
String channelOrderNo = auditRejectEvent.getChannelOrderNo(); String channelOrderNo = auditRejectEvent.getChannelOrderNo();
Long nextApplyTime = auditRejectEvent.getNextApplyTime(); Long nextApplyTime = auditRejectEvent.getNextApplyTime();
String reason = auditRejectEvent.getReason(); String reason = auditRejectEvent.getReason();
String callbackUrl = getOrderCallbackUrl(channelId, noticeType);
if (StringUtils.isEmpty(callbackUrl)) {
log.error("{},回调地址无配置,channelId:{},applyNo:{},noticeType:{}", logPrefix, channelId, applyNo, noticeType.name());
throw new CommonBizException("回调地址无配置");
}
LoanOrderMapping orderMapping = getOrderMapping(channelOrderNo, channelId); String callbackUrl = getOrderCallbackUrl(channelId, noticeType);
Long userId = orderMapping.getQgUserId(); if (StringUtils.isEmpty(callbackUrl)) {
log.error("{},回调地址无配置,channelId:{},applyNo:{},noticeType:{}", logPrefix, channelId, applyNo, noticeType.name());
throw new CommonBizException("回调地址无配置");
}
UserMapping userMapping = getUserMapping(userId, channelId); LoanOrderMapping orderMapping = getOrderMapping(channelOrderNo, channelId);
String channelUserId = userMapping.getChannelUserId(); Long userId = orderMapping.getQgUserId();
Map UserMapping userMapping = getUserMapping(userId, channelId);
<String, String> callbackParam = new HashMap<>(); String channelUserId = userMapping.getChannelUserId();
QueueNotice queueNotice = new QueueNotice(noticeType, extraDto);
publishTask(callbackParam, callbackUrl, queueNotice);
}
@Override Map<String, String> callbackParam = new HashMap<>();
public void auditPassPublish(AuditPassEvent auditPassEvent) { QueueNotice queueNotice = new QueueNotice(noticeType, extraDto);
String logPrefix = "[${prefix}EventHandler][auditPassPublish]"; publishTask(callbackParam, callbackUrl, queueNotice);
log.info("{},审核通过事件,消息内容:{}", logPrefix, auditPassEvent); }
QuotaNoticeExtraDto extraDto = auditPassEvent.getQueueNotice();
Long channelId = auditPassEvent.getChannelId(); @Override
KANoticeType noticeType = auditPassEvent.getNoticeType(); public void auditPassPublish(AuditPassEvent auditPassEvent) {
String applyNo = extraDto.getData().getApplyNo(); String logPrefix = "[${prefix}EventHandler][auditPassPublish]";
String channelOrderNo = auditPassEvent.getChannelOrderNo(); log.info("{},审核通过事件,消息内容:{}", logPrefix, auditPassEvent);
QuotaNoticeExtraDto extraDto = auditPassEvent.getQueueNotice();
String callbackUrl = getOrderCallbackUrl(channelId, noticeType); Long channelId = auditPassEvent.getChannelId();
if (StringUtils.isEmpty(callbackUrl)) { KANoticeType noticeType = auditPassEvent.getNoticeType();
log.error("{},回调地址无配置,channelId:{},applyNo:{},noticeType:{}", logPrefix, channelId, applyNo, noticeType.name()); String applyNo = extraDto.getData().getApplyNo();
throw new CommonBizException("回调地址无配置"); String channelOrderNo = auditPassEvent.getChannelOrderNo();
}
String callbackUrl = getOrderCallbackUrl(channelId, noticeType);
if (StringUtils.isEmpty(callbackUrl)) {
log.error("{},回调地址无配置,channelId:{},applyNo:{},noticeType:{}", logPrefix, channelId, applyNo, noticeType.name());
throw new CommonBizException("回调地址无配置");
}
LoanOrderMapping orderMapping = getOrderMapping(channelOrderNo, channelId); LoanOrderMapping orderMapping = getOrderMapping(channelOrderNo, channelId);
Long userId = orderMapping.getQgUserId(); Long userId = orderMapping.getQgUserId();
UserMapping userMapping = getUserMapping(userId, channelId); UserMapping userMapping = getUserMapping(userId, channelId);
String channelUserId = userMapping.getChannelUserId(); String channelUserId = userMapping.getChannelUserId();
ChannelOrder channelOrderQueryCreditStatus = ChannelOrder.builder() ChannelOrder channelOrderQueryCreditStatus = ChannelOrder.builder()
.channelOrderNo(channelOrderNo) .channelOrderNo(channelOrderNo)
.channelId(channelId) .channelId(channelId)
.build(); .build();
ServiceResult ServiceResult<QueryCreditStatusResponseModel> creditStatus =
<QueryCreditStatusResponseModel> creditStatus =
standardApplicationService.queryCreditStatus(channelOrderQueryCreditStatus); standardApplicationService.queryCreditStatus(channelOrderQueryCreditStatus);
log.info("{} 授信结果查询返回信息 creditStatus={},orderNo={}", logPrefix, creditStatus, channelOrderNo); log.info("{} 授信结果查询返回信息 creditStatus={},orderNo={}", logPrefix, creditStatus, channelOrderNo);
QueryCreditStatusResponseModel creditInfo; QueryCreditStatusResponseModel creditInfo;
if (Objects.isNull(creditStatus) || !creditStatus.isSuccess() || Objects.isNull(creditInfo = if (Objects.isNull(creditStatus) || !creditStatus.isSuccess() || Objects.isNull(creditInfo = creditStatus.getData())) {
creditStatus.getData())) {
log.error("{},审批通过推送,查询授信结果失败或无数据,orderNo={},applyNo={}", logPrefix, channelOrderNo, applyNo); log.error("{},审批通过推送,查询授信结果失败或无数据,orderNo={},applyNo={}", logPrefix, channelOrderNo, applyNo);
throw new CommonBizException("审批推送,查询授信结果失败或无数据"); throw new CommonBizException("审批推送,查询授信结果失败或无数据");
} }
Map Map<String, String> callbackParam = new HashMap<>();
<String
, String> callbackParam = new HashMap<>();
QueueNotice queueNotice = new QueueNotice(noticeType, extraDto); QueueNotice queueNotice = new QueueNotice(noticeType, extraDto);
publishTask(callbackParam, callbackUrl, queueNotice); publishTask(callbackParam, callbackUrl, queueNotice);
} }
...@@ -181,11 +175,8 @@ ServiceResult ...@@ -181,11 +175,8 @@ ServiceResult
String channelLoanNo = loanMapping.getChannelLoanNo(); String channelLoanNo = loanMapping.getChannelLoanNo();
Map Map<String, String> callbackParam = new HashMap<>();
<String
, String> callbackParam = new HashMap<>();
QueueNotice queueNotice = new QueueNotice(noticeType, extraDto); QueueNotice queueNotice = new QueueNotice(noticeType, extraDto);
publishTask(callbackParam, callbackUrl, queueNotice); publishTask(callbackParam, callbackUrl, queueNotice);
...@@ -223,9 +214,7 @@ ServiceResult ...@@ -223,9 +214,7 @@ ServiceResult
String channelLoanNo = loanMapping.getChannelLoanNo(); String channelLoanNo = loanMapping.getChannelLoanNo();
Map Map<String, String> callbackParam = new HashMap<>();
<String
, String> callbackParam = new HashMap<>();
QueueNotice queueNotice = new QueueNotice(noticeType, extraDto); QueueNotice queueNotice = new QueueNotice(noticeType, extraDto);
publishTask(callbackParam, callbackUrl, queueNotice); publishTask(callbackParam, callbackUrl, queueNotice);
...@@ -254,9 +243,7 @@ ServiceResult ...@@ -254,9 +243,7 @@ ServiceResult
UserMapping userMapping = getUserMapping(userId, channelId); UserMapping userMapping = getUserMapping(userId, channelId);
String channelUserId = userMapping.getChannelUserId(); String channelUserId = userMapping.getChannelUserId();
Map Map<String, String> callbackParam = new HashMap<>();
<String
, String> callbackParam = new HashMap<>();
QueueNotice queueNotice = new QueueNotice(noticeType, extraDto); QueueNotice queueNotice = new QueueNotice(noticeType, extraDto);
publishTask(callbackParam, callbackUrl, queueNotice); publishTask(callbackParam, callbackUrl, queueNotice);
...@@ -287,9 +274,7 @@ ServiceResult ...@@ -287,9 +274,7 @@ ServiceResult
UserMapping userMapping = getUserMapping(userId, channelId); UserMapping userMapping = getUserMapping(userId, channelId);
String channelUserId = userMapping.getChannelUserId(); String channelUserId = userMapping.getChannelUserId();
Map Map<String, String> callbackParam = new HashMap<>();
<String
, String> callbackParam = new HashMap<>();
QueueNotice queueNotice = new QueueNotice(noticeType, extraDto); QueueNotice queueNotice = new QueueNotice(noticeType, extraDto);
publishTask(callbackParam, callbackUrl, queueNotice); publishTask(callbackParam, callbackUrl, queueNotice);
...@@ -345,12 +330,9 @@ ServiceResult ...@@ -345,12 +330,9 @@ ServiceResult
log.error("{},还款成功推送,查询还款计划返回错误或无数据,orderNo={},applyNo={}", logPrefix, channelOrderNo, applyNo); log.error("{},还款成功推送,查询还款计划返回错误或无数据,orderNo={},applyNo={}", logPrefix, channelOrderNo, applyNo);
throw new CommonBizException("还款成功,查询还款计划返回错误或无数据"); throw new CommonBizException("还款成功,查询还款计划返回错误或无数据");
} }
List List<RepaymentPlanItem> repaymentPlans = serviceResult.getData().getRepaymentPlans();
<RepaymentPlanItem> repaymentPlans = serviceResult.getData().getRepaymentPlans();
Map Map<String, String> callbackParam = new HashMap<>();
<String
, String> callbackParam = new HashMap<>();
QueueNotice queueNotice = new QueueNotice(noticeType, extraDto); QueueNotice queueNotice = new QueueNotice(noticeType, extraDto);
publishTask(callbackParam, callbackUrl, queueNotice); publishTask(callbackParam, callbackUrl, queueNotice);
super.processRepay(repaySuccessEvent.getQueueNotice()); super.processRepay(repaySuccessEvent.getQueueNotice());
...@@ -370,8 +352,7 @@ ServiceResult ...@@ -370,8 +352,7 @@ ServiceResult
String callbackUrl = getOrderCallbackUrl(channelId, noticeType); String callbackUrl = getOrderCallbackUrl(channelId, noticeType);
if (StringUtils.isEmpty(callbackUrl)) { if (StringUtils.isEmpty(callbackUrl)) {
log.error("{},回调地址无配置,channelId:{},applyNo:{},noticeType:{}", logPrefix, channelId, applyNo, log.error("{},回调地址无配置,channelId:{},applyNo:{},noticeType:{}", logPrefix, channelId, applyNo,noticeType.name());
noticeType.name());
throw new CommonBizException("回调地址无配置"); throw new CommonBizException("回调地址无配置");
} }
...@@ -391,9 +372,7 @@ ServiceResult ...@@ -391,9 +372,7 @@ ServiceResult
repaymentAmount = new BigDecimal(repayFlowNoMapping.getRepayAmount()); repaymentAmount = new BigDecimal(repayFlowNoMapping.getRepayAmount());
} }
Map Map<String, String> callbackParam = new HashMap<>();
<String
, String> callbackParam = new HashMap<>();
QueueNotice queueNotice = new QueueNotice(noticeType, extraDto); QueueNotice queueNotice = new QueueNotice(noticeType, extraDto);
publishTask(callbackParam, callbackUrl, queueNotice); publishTask(callbackParam, callbackUrl, queueNotice);
super.processRepay(repayFailEvent.getQueueNotice()); super.processRepay(repayFailEvent.getQueueNotice());
...@@ -433,8 +412,7 @@ ServiceResult ...@@ -433,8 +412,7 @@ ServiceResult
* @return * @return
*/ */
private LoanOrderMapping getOrderMapping(String channelOrderNo, Long channelId) { private LoanOrderMapping getOrderMapping(String channelOrderNo, Long channelId) {
LoanOrderMapping orderMapping = LoanOrderMapping orderMapping = orderMappingService.findByChannelOrderNoAndRegisteredFromLastOne(channelOrderNo, channelId);
orderMappingService.findByChannelOrderNoAndRegisteredFromLastOne(channelOrderNo, channelId);
if (Objects.isNull(orderMapping)) { if (Objects.isNull(orderMapping)) {
log.error("${prefix}渠道回调通知,查询授信订单为空, channelOrderNo={}, channelId={}", channelOrderNo, channelId); log.error("${prefix}渠道回调通知,查询授信订单为空, channelOrderNo={}, channelId={}", channelOrderNo, channelId);
throw new CommonBizException("查询授信订单为空"); throw new CommonBizException("查询授信订单为空");
...@@ -466,9 +444,7 @@ ServiceResult ...@@ -466,9 +444,7 @@ ServiceResult
* @param url * @param url
* @param queueNotice * @param queueNotice
*/ */
private void publishTask(Map private void publishTask(Map<String , String> paraMap, String url, QueueNotice queueNotice) {
<String
, String> paraMap, String url, QueueNotice queueNotice) {
log.info("[publishTask],发送消息内容:{},url地址:{},ka消息体:{}", paraMap, url, queueNotice); log.info("[publishTask],发送消息内容:{},url地址:{},ka消息体:{}", paraMap, url, queueNotice);
HttpTaskBody taskBody = this.buildTaskBody(paraMap, url, queueNotice); HttpTaskBody taskBody = this.buildTaskBody(paraMap, url, queueNotice);
log.info("[publishTask],taskBody:{}", taskBody); log.info("[publishTask],taskBody:{}", taskBody);
...@@ -486,16 +462,12 @@ ServiceResult ...@@ -486,16 +462,12 @@ ServiceResult
* @param queueNotice * @param queueNotice
* @return * @return
*/ */
private HttpTaskBody buildTaskBody(Map private HttpTaskBody buildTaskBody(Map<String , String> paraMap, String url, QueueNotice queueNotice) {
<String
, String> paraMap, String url, QueueNotice queueNotice) {
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
jsonObject.put("", ""); jsonObject.put("", "");
String assetRule = jsonObject.toJSONString(); String assetRule = jsonObject.toJSONString();
Map Map<String , String> header = new HashMap<>(2);
<String
, String> header = new HashMap<>(2);
header.put("Content-Type", ""); header.put("Content-Type", "");
HttpTaskBody taskBody = new HttpTaskBody(); HttpTaskBody taskBody = new HttpTaskBody();
taskBody.setHeaders(header); taskBody.setHeaders(header);
...@@ -507,4 +479,4 @@ ServiceResult ...@@ -507,4 +479,4 @@ ServiceResult
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment