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

EventHandler代码格式化

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