Commit 29ef77d7 authored by BlackJokerCJ's avatar BlackJokerCJ

xiyi

parent 9b3a270e
......@@ -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,7 @@ public interface CreditComponent {
void updateByOrderNo(String orderNo,CreditModel model);
List<CreditModel> getListModelByCreditThirdStatus(String init);
List<CreditModel> getListModelByCreditThirdStatus(String token);
List<CreditModel> getListModelByCreditThirdToken(String token);
}
......@@ -63,4 +63,15 @@ 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());
}
}
......@@ -47,6 +47,7 @@ public class LoanComponentImpl implements LoanComponent {
WindowsLoanExample example = new WindowsLoanExample();
WindowsLoanExample.Criteria criteria = example.createCriteria();
criteria.andOrderNoEqualTo(orderNo);
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