Commit 41d6dfac authored by 张庆's avatar 张庆

Merge remote-tracking branch 'origin/master'

parents a0582644 e4a01a01
......@@ -24,9 +24,16 @@ public class RiskQueryDataCommand extends AbstractCommand {
public JsonResult execute() {
String request = RuntimeContextHolder.currentRuntimeContext().getRequestBody();
RiskCreditRequest riskCreditRequest = JSON.parseObject(request, RiskCreditRequest.class);
CreditModel creditModel = creditComponent.getByOrderNo(riskCreditRequest.getOrderNo());
CreditModel creditModel =null;
if(riskCreditRequest.getOrderNo()==null){
creditModel = creditComponent.getByCertNo(riskCreditRequest.getCertNo());
}else{
creditModel = creditComponent.getByOrderNo(riskCreditRequest.getOrderNo());
}
String data = ossUtils.getStringObject(creditModel.getCreditThirdUrl());
JSONObject jsonObject = JSONObject.parseObject(data);
return JsonResult.success(jsonObject.getJSONObject(riskCreditRequest.getApiCode()));
}
}
......@@ -31,6 +31,8 @@ public class SignContractCommand extends AbstractCommand {
signContractRequest.setCertNo(creditModel.getCertNo());
signContractRequest.setClientCell(creditModel.getClientCell());
log.info("融单协议提交-{}",JSONObject.toJSON(signContractRequest));
creditModel.setCreditThirdToken("INIT");
creditComponent.updateByOrderNo(creditModel.getOrderNo(),creditModel);
iProtocalFeignService.uploadRongdan(signContractRequest);
return JsonResult.success();
}
......
......@@ -12,5 +12,9 @@ public interface CreditComponent {
void updateByOrderNo(String orderNo,CreditModel model);
List<CreditModel> getListModelByCreditThirdStatus(String init);
List<CreditModel> getListModelByCreditThirdStatus(String token);
List<CreditModel> getListModelByCreditThirdToken(String token);
CreditModel getByCertNo(String certNo);
}
......@@ -30,7 +30,7 @@ public class CreditComponentImpl implements CreditComponent {
example.setOrderByClause("id desc");
List<WindowsCredit> list = windowsCreditMapper.selectByExample(example);
if (CollectionUtil.isNotEmpty(list)) {
return list.stream().map(e -> CglibUtil.copy(e, CreditModel.class)).findFirst().get();
return list.stream().map(e -> CglibUtil.copy(e, CreditModel.class)).findFirst().orElse(null);
}
return null;
}
......@@ -63,4 +63,26 @@ public class CreditComponentImpl implements CreditComponent {
return list.stream().map(e -> CglibUtil.copy(e, CreditModel.class)).collect(Collectors.toList());
}
@Override
public List<CreditModel> getListModelByCreditThirdToken(String token) {
WindowsCreditExample example = new WindowsCreditExample();
WindowsCreditExample.Criteria c = example.createCriteria();
c.andCreditThirdTokenEqualTo(token);
example.setOrderByClause("id desc");
List<WindowsCredit> list = windowsCreditMapper.selectByExample(example);
return list.stream().map(e -> CglibUtil.copy(e, CreditModel.class)).collect(Collectors.toList());
}
@Override
public CreditModel getByCertNo(String certNo) {
WindowsCreditExample example = new WindowsCreditExample();
WindowsCreditExample.Criteria c = example.createCriteria();
c.andCertNoEqualTo(certNo);
example.setOrderByClause("id desc");
List<WindowsCredit> list = windowsCreditMapper.selectByExample(example);
return list.stream().map(e -> CglibUtil.copy(e, CreditModel.class)).findFirst().orElse(null);
}
}
......@@ -59,6 +59,7 @@ public class LoanComponentImpl implements LoanComponent {
criteria.andOrderNoEqualTo(orderNo);
criteria.andLoanCreditResultEqualTo("INIT");
example.setOrderByClause("id desc");
List<WindowsLoan> windowsLoans = windowsLoanMapper.selectByExample(example);
return windowsLoans.stream().map(m -> BeanUtil.toBean(m, LoanModel.class)).findFirst().orElse(null);
}
......
package com.jqtx.windows.job;
import cn.hutool.core.util.IdUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.jqtx.infrastructure.oss.starter.config.OssUtils;
import com.jqtx.windows.component.CreditComponent;
import com.jqtx.windows.component.LoanComponent;
import com.jqtx.windows.component.enums.ZNPostUrlEnum;
import com.jqtx.windows.component.model.CreditModel;
import com.jqtx.windows.component.model.LoanModel;
import com.jqtx.windows.component.model.ZyJsonResult;
import com.jqtx.windows.infrastructure.feign.IProtocalFeignService;
import com.jqtx.windows.utils.AbcHttpClient;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Date;
import java.util.List;
import java.util.UUID;
@Component
@Slf4j
public class ProtocolJob {
@Autowired
private CreditComponent creditComponent;
@Autowired
private AbcHttpClient abcHttpClient;
@Autowired
private IProtocalFeignService iProtocalFeignService;
@Autowired
private LoanComponent loanComponent;
@Autowired
private OssUtils ossUtils;
@XxlJob("protocolJob")
public void run() {
List<CreditModel> creditModels = creditComponent.getListModelByCreditThirdToken("INIT");
creditModels.parallelStream().forEach(p -> {
LoanModel loanModel = loanComponent.getByOrderNo(p.getOrderNo());
String protocolUrl = iProtocalFeignService.getFilePathPdf(loanModel.getLoanNo(), "own-rongdan").getResult();
if (protocolUrl != null) {
String path = ossUtils.generateTempURLPrivateDomain(protocolUrl);
JSONObject thirdCredit = new JSONObject();
thirdCredit.put("orderNo", loanModel.getOrderNo());
thirdCredit.put("loanNo", loanModel.getLoanNo());
thirdCredit.put("transNo", IdUtil.fastSimpleUUID());
thirdCredit.put("contractFileUrl", path);
ZyJsonResult zyJsonResult = abcHttpClient.postRequest(thirdCredit.toJSONString(), ZNPostUrlEnum.CREDIT_QUERY.getCode());
log.info("zyJsonResult:[{}]",JSONObject.toJSONString(zyJsonResult));
p.setCreditThirdToken("FINISHED");
creditComponent.updateByOrderNo(p.getOrderNo(),p);
}
});
}
}
......@@ -37,6 +37,8 @@ public class RouterConfig implements CommandLineRunner {
@Autowired
private CreditThirdDataCommand creditThirdDataCommand;
@Autowired
private RiskQueryDataCommand riskQueryDataCommand;
private static HashMap<String, AbstractCommand> commandHashMap = new HashMap<>();
......@@ -59,6 +61,7 @@ public class RouterConfig implements CommandLineRunner {
commandHashMap.put("syncCreditResult",syncCreditCommand);
commandHashMap.put("syncBack",backedCommand);
commandHashMap.put("creditThirdData",creditThirdDataCommand);
commandHashMap.put("riskThirdData",riskQueryDataCommand);
}
......
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