Commit e4a01a01 authored by BlackJokerCJ's avatar BlackJokerCJ

xiyi

parent 633f03e8
......@@ -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()));
}
}
......@@ -15,4 +15,6 @@ public interface CreditComponent {
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;
}
......@@ -74,4 +74,15 @@ public class CreditComponentImpl implements CreditComponent {
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);
}
}
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