Commit f99e224c authored by suntao's avatar suntao

二次风控

parent 06bf1b9f
...@@ -107,6 +107,22 @@ public class OrderController { ...@@ -107,6 +107,22 @@ public class OrderController {
} }
} }
/**
* 二次风控审批
*
* @return
*/
@Security(authorityId = "Order.loadSecondAuditJob")
@GetMapping("/loadSecondAuditJob")
public Result<Boolean> loadSecondAuditJob() {
if (Application.isDebug()) {
this.orderService.loadSecondAuditJob();
return Result.buildSuccess(true,"操作成功");
} else {
return Result.buildSuccess(false,"无此操作");
}
}
/** /**
* 贷前关单 * 贷前关单
* *
......
...@@ -39,4 +39,6 @@ public interface OrderService { ...@@ -39,4 +39,6 @@ public interface OrderService {
List<CallbackRecordVoModel> getOrderCallbackRecordList(String channelOrderNumber); List<CallbackRecordVoModel> getOrderCallbackRecordList(String channelOrderNumber);
Object findRepaymentPlan(String channelOrderNumber, Long loanId); Object findRepaymentPlan(String channelOrderNumber, Long loanId);
void loadSecondAuditJob();
} }
...@@ -19,16 +19,13 @@ import cn.quantgroup.cashloanflowboss.spi.clf.entity.ClfOrderMapping; ...@@ -19,16 +19,13 @@ import cn.quantgroup.cashloanflowboss.spi.clf.entity.ClfOrderMapping;
import cn.quantgroup.cashloanflowboss.spi.clf.model.CallbackRecordVoModel; import cn.quantgroup.cashloanflowboss.spi.clf.model.CallbackRecordVoModel;
import cn.quantgroup.cashloanflowboss.spi.clf.repository.ClfOrderMappingRepository; import cn.quantgroup.cashloanflowboss.spi.clf.repository.ClfOrderMappingRepository;
import cn.quantgroup.cashloanflowboss.spi.clf.service.CLFCenterService; import cn.quantgroup.cashloanflowboss.spi.clf.service.CLFCenterService;
import cn.quantgroup.cashloanflowboss.spi.clotho.client.ClothoCenter;
import cn.quantgroup.cashloanflowboss.spi.clotho.service.ClothoCenterService; import cn.quantgroup.cashloanflowboss.spi.clotho.service.ClothoCenterService;
import cn.quantgroup.cashloanflowboss.spi.jolyne.JolyneCenter;
import cn.quantgroup.cashloanflowboss.spi.jolyne.JolyneService; import cn.quantgroup.cashloanflowboss.spi.jolyne.JolyneService;
import cn.quantgroup.cashloanflowboss.spi.jolyne.JolyneUtil; import cn.quantgroup.cashloanflowboss.spi.jolyne.JolyneUtil;
import cn.quantgroup.cashloanflowboss.spi.opapi.OPCenter; import cn.quantgroup.cashloanflowboss.spi.opapi.OPCenter;
import cn.quantgroup.cashloanflowboss.spi.user.service.XyqbUserService; import cn.quantgroup.cashloanflowboss.spi.user.service.XyqbUserService;
import cn.quantgroup.cashloanflowboss.spi.xyqb.entity.Contract; import cn.quantgroup.cashloanflowboss.spi.xyqb.entity.Contract;
import cn.quantgroup.cashloanflowboss.spi.xyqb.entity.LoanApplicationHistory; import cn.quantgroup.cashloanflowboss.spi.xyqb.entity.LoanApplicationHistory;
import cn.quantgroup.cashloanflowboss.spi.xyqb.entity.WaitingFundingCorpOperatePeople;
import cn.quantgroup.cashloanflowboss.spi.xyqb.repository.CancelPreLoanRepository; import cn.quantgroup.cashloanflowboss.spi.xyqb.repository.CancelPreLoanRepository;
import cn.quantgroup.cashloanflowboss.spi.xyqb.service.XYQBCenterService; import cn.quantgroup.cashloanflowboss.spi.xyqb.service.XYQBCenterService;
import cn.quantgroup.cashloanflowboss.utils.JSONTools; import cn.quantgroup.cashloanflowboss.utils.JSONTools;
...@@ -38,7 +35,6 @@ import com.google.common.collect.Lists; ...@@ -38,7 +35,6 @@ import com.google.common.collect.Lists;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;
...@@ -55,7 +51,6 @@ import org.apache.commons.collections.CollectionUtils; ...@@ -55,7 +51,6 @@ import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.exception.ExceptionUtils; import org.apache.commons.lang3.exception.ExceptionUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -91,8 +86,6 @@ public class OrderServiceImpl implements OrderService{ ...@@ -91,8 +86,6 @@ public class OrderServiceImpl implements OrderService{
@Autowired @Autowired
private CLFCenterService clfCenterService; private CLFCenterService clfCenterService;
@Autowired @Autowired
private JolyneCenter jolyneCenter;
@Autowired
private JolyneService jolyneService; private JolyneService jolyneService;
...@@ -355,7 +348,7 @@ public class OrderServiceImpl implements OrderService{ ...@@ -355,7 +348,7 @@ public class OrderServiceImpl implements OrderService{
// 修改合同状态 // 修改合同状态
ArrayList<String> updateContract = Lists.newArrayList(); ArrayList<String> updateContract = Lists.newArrayList();
updateContract.add("update contract set generate_status = 2 where user_id = " + orderMapping.getQgUserId() + ";"); updateContract.add("update contract set generate_status = 2 where user_id = " + orderMapping.getQgUserId() + ";");
jolyneCenter.sqlXyqb(JolyneUtil.getJolneSql(updateContract)); jolyneService.executeXYQBSQL(JolyneUtil.getJolneSql(updateContract));
} }
} else { } else {
// 合同为空 log表记录问题,UI用户查询 // 合同为空 log表记录问题,UI用户查询
...@@ -489,13 +482,13 @@ public class OrderServiceImpl implements OrderService{ ...@@ -489,13 +482,13 @@ public class OrderServiceImpl implements OrderService{
public boolean cancel(OrderVo orderVo) { public boolean cancel(OrderVo orderVo) {
ClfOrderMapping orderMapping = clfOrderMappingRepository.findByChannelOrderNoLastOne(orderVo.getChannelOrderNumber()); ClfOrderMapping orderMapping = clfOrderMappingRepository.findByChannelOrderNoLastOne(orderVo.getChannelOrderNumber());
if (orderMapping == null) { if (orderMapping == null) {
log.info("sqlXyqb,关单失败,无订单 channelOrderNumber={}", orderVo.getChannelOrderNumber()); log.info("executeXYQBSQL,关单失败,无订单 channelOrderNumber={}", orderVo.getChannelOrderNumber());
return false; return false;
} }
XUser xUser = xyqbUserService.findXUserById(orderMapping.getQgUserId()); XUser xUser = xyqbUserService.findXUserById(orderMapping.getQgUserId());
if (xUser == null) { if (xUser == null) {
log.info("sqlXyqb,关单失败,未找到用户 channelOrderNumber={}", orderVo.getChannelOrderNumber()); log.info("executeXYQBSQL,关单失败,未找到用户 channelOrderNumber={}", orderVo.getChannelOrderNumber());
return false; return false;
} }
Long userId = xUser.getId(); Long userId = xUser.getId();
...@@ -508,7 +501,7 @@ public class OrderServiceImpl implements OrderService{ ...@@ -508,7 +501,7 @@ public class OrderServiceImpl implements OrderService{
cancel_list.add("delete from apply_quota_record where user_id=" + userId); cancel_list.add("delete from apply_quota_record where user_id=" + userId);
cancel_list.add("delete from user_operation_history where user_id=" + userId); cancel_list.add("delete from user_operation_history where user_id=" + userId);
data.put("sql", cancel_list); data.put("sql", cancel_list);
String cancel_result = jolyneCenter.sqlXyqb(JSONTools.serialize(data)); String cancel_result = jolyneService.executeXYQBSQL(JSONTools.serialize(data));
return "success".equals(cancel_result); return "success".equals(cancel_result);
} }
...@@ -684,6 +677,12 @@ public class OrderServiceImpl implements OrderService{ ...@@ -684,6 +677,12 @@ public class OrderServiceImpl implements OrderService{
return null; return null;
} }
@Override
public void loadSecondAuditJob() {
jolyneService.fetchDataLoanJob();
jolyneService.loanDataJob();
}
/** /**
* 查询订单状态 * 查询订单状态
......
...@@ -2,23 +2,39 @@ package cn.quantgroup.cashloanflowboss.spi.jolyne; ...@@ -2,23 +2,39 @@ package cn.quantgroup.cashloanflowboss.spi.jolyne;
import org.springframework.cloud.netflix.feign.FeignClient; import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
@Component @Component
@FeignClient(name = "JolyneServiceCenter", url = "http://192.168.4.156:9001/executeSQL/"+"${NAMESPACE}", fallback = JolyneCenter.Fallback.class) @FeignClient(name = "JolyneServiceCenter", url = "http://192.168.4.156:9001", fallback = JolyneCenter.Fallback.class)
public interface JolyneCenter { public interface JolyneCenter {
@PostMapping(value = "/executeSQL/"+"${NAMESPACE}" + "/xyqb", consumes = "application/json")
String executeXYQBSQL(String jsonData);
@PostMapping(value = "/xyqb", consumes = "application/json") @GetMapping(value = "/job/clotho-elastic-job/cn.qg.clotho.job.FetchDataLoanJob")
String sqlXyqb(String jsonData); void fetchDataLoanJob(@RequestParam("namespace") String namespace);
@GetMapping(value = "/job/clotho-elastic-job/cn.qg.clotho.job.LoanDataJob")
void loanDataJob(@RequestParam("namespace") String namespace);
@Component @Component
class Fallback implements JolyneCenter { class Fallback implements JolyneCenter {
@Override @Override
public String sqlXyqb(String jsonData) { public String executeXYQBSQL(String jsonData) {
return null; return null;
} }
@Override
public void fetchDataLoanJob(String namespace) {
}
@Override
public void loanDataJob(String namespace) {
}
} }
} }
...@@ -9,5 +9,14 @@ package cn.quantgroup.cashloanflowboss.spi.jolyne; ...@@ -9,5 +9,14 @@ package cn.quantgroup.cashloanflowboss.spi.jolyne;
*/ */
public interface JolyneService { public interface JolyneService {
String executeXYQBSQL(String jsonData);
void fetchDataLoanJob();
void loanDataJob();
String delayUpdateWaitingXyqbSql(Long sqlContent, Long delayTime); String delayUpdateWaitingXyqbSql(Long sqlContent, Long delayTime);
} }
...@@ -5,10 +5,10 @@ import cn.quantgroup.cashloanflowboss.spi.xyqb.service.XYQBCenterService; ...@@ -5,10 +5,10 @@ import cn.quantgroup.cashloanflowboss.spi.xyqb.service.XYQBCenterService;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.sql.Timestamp;
import java.util.ArrayList; import java.util.ArrayList;
/** /**
...@@ -26,6 +26,25 @@ public class JolyneServiceImpl implements JolyneService { ...@@ -26,6 +26,25 @@ public class JolyneServiceImpl implements JolyneService {
@Autowired @Autowired
private JolyneCenter jolyneCenter; private JolyneCenter jolyneCenter;
@Value("${NAMESPACE}")
private String namespace;
@Override
public String executeXYQBSQL(String jsonData) {
return jolyneCenter.executeXYQBSQL(jsonData);
}
@Override
public void fetchDataLoanJob() {
jolyneCenter.fetchDataLoanJob(namespace);
}
@Override
public void loanDataJob() {
jolyneCenter.loanDataJob(namespace);
}
@Async @Async
@Override @Override
public String delayUpdateWaitingXyqbSql(Long loanId, Long delayTime) { public String delayUpdateWaitingXyqbSql(Long loanId, Long delayTime) {
...@@ -33,6 +52,8 @@ public class JolyneServiceImpl implements JolyneService { ...@@ -33,6 +52,8 @@ public class JolyneServiceImpl implements JolyneService {
WaitingFundingCorpOperatePeople waitingFundingCorpOperatePeople = xyqbCenterService.findWaitingFundingCorpOperatePeopleByLoanId(loanId); WaitingFundingCorpOperatePeople waitingFundingCorpOperatePeople = xyqbCenterService.findWaitingFundingCorpOperatePeopleByLoanId(loanId);
int i = 0;
while (waitingFundingCorpOperatePeople == null) { while (waitingFundingCorpOperatePeople == null) {
try { try {
Thread.sleep(delayTime); Thread.sleep(delayTime);
...@@ -40,15 +61,22 @@ public class JolyneServiceImpl implements JolyneService { ...@@ -40,15 +61,22 @@ public class JolyneServiceImpl implements JolyneService {
e.printStackTrace(); e.printStackTrace();
} }
waitingFundingCorpOperatePeople = xyqbCenterService.findWaitingFundingCorpOperatePeopleByLoanId(loanId); waitingFundingCorpOperatePeople = xyqbCenterService.findWaitingFundingCorpOperatePeopleByLoanId(loanId);
if (++ i > 10000) {
return "fail";
}
} }
if (waitingFundingCorpOperatePeople.getCreatedAt().getTime() > (System.currentTimeMillis() - 5 * 60 * 1000)) { if (waitingFundingCorpOperatePeople.getCreatedAt().getTime() > (System.currentTimeMillis() - 5 * 60 * 1000)) {
// 更新待放款时间(5分钟之前) // 更新待放款时间(5分钟之前)
ArrayList<String> updateWaitingFundingCorpOperatePeople = Lists.newArrayList(); ArrayList<String> updateWaitingFundingCorpOperatePeople = Lists.newArrayList();
updateWaitingFundingCorpOperatePeople.add("update waiting_funding_corp_operate_people set created_at = DATE_SUB(created_at, interval 5 minute) where loan_application_history_id = " + loanId + ";"); updateWaitingFundingCorpOperatePeople.add("update waiting_funding_corp_operate_people set created_at = DATE_SUB(created_at, interval 5 minute) where loan_application_history_id = " + loanId + ";");
return jolyneCenter.sqlXyqb(JolyneUtil.getJolneSql(updateWaitingFundingCorpOperatePeople)); return jolyneCenter.executeXYQBSQL(JolyneUtil.getJolneSql(updateWaitingFundingCorpOperatePeople));
} }
fetchDataLoanJob();
loanDataJob();
return "success"; return "success";
} }
} }
...@@ -179,7 +179,7 @@ public class XyqbUserServiceImpl implements XyqbUserService { ...@@ -179,7 +179,7 @@ public class XyqbUserServiceImpl implements XyqbUserService {
cancel_list.add("delete from apply_quota_record where user_id="+userId); cancel_list.add("delete from apply_quota_record where user_id="+userId);
cancel_list.add("delete from user_operation_history where user_id="+userId); cancel_list.add("delete from user_operation_history where user_id="+userId);
data.put("sql",cancel_list); data.put("sql",cancel_list);
String cancel_result = jolyneCenter.sqlXyqb(JSONTools.serialize(data)); String cancel_result = jolyneCenter.executeXYQBSQL(JSONTools.serialize(data));
return "success".equals(cancel_result); return "success".equals(cancel_result);
} }
......
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