Commit 19a5ace1 authored by BlackJokerCJ's avatar BlackJokerCJ

xiyi

parent b918d2f8
...@@ -16,6 +16,7 @@ import com.jqtx.windows.component.model.LoanModel; ...@@ -16,6 +16,7 @@ import com.jqtx.windows.component.model.LoanModel;
import com.jqtx.windows.utils.AbcHttpClient; import com.jqtx.windows.utils.AbcHttpClient;
import com.jqtx.windows.web.response.WithdrawDetailResponse; import com.jqtx.windows.web.response.WithdrawDetailResponse;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import java.time.LocalDateTime; import java.time.LocalDateTime;
...@@ -43,17 +44,41 @@ public class CreditThirdDataListener extends AbstractMQConsumerHandler<JSONObjec ...@@ -43,17 +44,41 @@ public class CreditThirdDataListener extends AbstractMQConsumerHandler<JSONObjec
@Override @Override
public void run(JSONObject req) throws Exception { public void run(JSONObject req) throws Exception {
CreditModel creditModel= creditComponent.getByOrderNo(req.getString("orderNo"));
String orderNo=req.getString("orderNo");
String loanNo= req.getString("loanNo");
if(StringUtils.isNotEmpty(orderNo)&& StringUtils.isEmpty(loanNo)){
credit(orderNo);
}else{
withdraw(orderNo,loanNo);
}
}
private void credit(String orderNo) {
CreditModel creditModel= creditComponent.getByOrderNo(orderNo);
if(creditModel!=null&& creditModel.getCreditThirdStatus()!="INIT"){ if(creditModel!=null&& creditModel.getCreditThirdStatus()!="INIT"){
log.info("req:[{}]",req.toJSONString());
JSONObject thirdCredit = new JSONObject(); JSONObject thirdCredit = new JSONObject();
thirdCredit.put("reqNo", req.getString("orderNo")); thirdCredit.put("reqNo", orderNo);
thirdCredit.put("type", "01"); thirdCredit.put("type", "01");
abcHttpClient.postRequest(thirdCredit.toJSONString(), ZNPostUrlEnum.CREDIT_APPLY.getCode()); abcHttpClient.postRequest(thirdCredit.toJSONString(), ZNPostUrlEnum.CREDIT_APPLY.getCode());
CreditModel creditModel1=new CreditModel(); CreditModel creditModel1=new CreditModel();
creditModel1.setCreditThirdStatus("INIT"); creditModel1.setCreditThirdStatus("INIT");
creditModel1.setCreditThirdUrl(""); creditModel1.setCreditThirdUrl("");
creditComponent.updateByOrderNo(req.getString("orderNo"),creditModel1); creditComponent.updateByOrderNo(orderNo,creditModel1);
}
}
private void withdraw(String orderNo,String loanNo) {
CreditModel creditModel= creditComponent.getByOrderNo(orderNo);
if(creditModel!=null&& creditModel.getCreditThirdStatus()!="INIT-WITHDRAW"){
JSONObject thirdCredit = new JSONObject();
thirdCredit.put("reqNo", loanNo);
thirdCredit.put("type", "02");
abcHttpClient.postRequest(thirdCredit.toJSONString(), ZNPostUrlEnum.CREDIT_APPLY.getCode());
CreditModel creditModel1=new CreditModel();
creditModel1.setCreditThirdStatus("INIT-WITHDRAW");
creditModel1.setCreditThirdUrl("");
creditComponent.updateByOrderNo(orderNo,creditModel1);
} }
} }
} }
......
...@@ -5,8 +5,10 @@ import com.alibaba.fastjson.JSONArray; ...@@ -5,8 +5,10 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.jqtx.infrastructure.oss.starter.config.OssUtils; import com.jqtx.infrastructure.oss.starter.config.OssUtils;
import com.jqtx.windows.component.CreditComponent; import com.jqtx.windows.component.CreditComponent;
import com.jqtx.windows.component.LoanComponent;
import com.jqtx.windows.component.enums.ZNPostUrlEnum; import com.jqtx.windows.component.enums.ZNPostUrlEnum;
import com.jqtx.windows.component.model.CreditModel; 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.component.model.ZyJsonResult;
import com.jqtx.windows.utils.AbcHttpClient; import com.jqtx.windows.utils.AbcHttpClient;
import com.xxl.job.core.handler.annotation.XxlJob; import com.xxl.job.core.handler.annotation.XxlJob;
...@@ -28,6 +30,9 @@ public class CreditThirdDataJob { ...@@ -28,6 +30,9 @@ public class CreditThirdDataJob {
@Autowired @Autowired
private AbcHttpClient abcHttpClient; private AbcHttpClient abcHttpClient;
@Autowired
private LoanComponent loanComponent;
@Autowired @Autowired
private OssUtils ossUtils; private OssUtils ossUtils;
...@@ -40,33 +45,48 @@ public class CreditThirdDataJob { ...@@ -40,33 +45,48 @@ public class CreditThirdDataJob {
thirdCredit.put("type", "01"); thirdCredit.put("type", "01");
ZyJsonResult zyJsonResult = abcHttpClient.postRequest(thirdCredit.toJSONString(), ZNPostUrlEnum.CREDIT_QUERY.getCode()); ZyJsonResult zyJsonResult = abcHttpClient.postRequest(thirdCredit.toJSONString(), ZNPostUrlEnum.CREDIT_QUERY.getCode());
JSONArray jsonArray = zyJsonResult.getExternalInfo(); JSONArray jsonArray = zyJsonResult.getExternalInfo();
JSONObject thirdData = new JSONObject(); processThirdData(c.getClientCell(), c.getOrderNo(), jsonArray);
for (int i = 0; i < jsonArray.size(); i++) { });
JSONObject jsonObject = (JSONObject) jsonArray.get(i);
log.info("dataSource:[{}],data:[{}]",jsonObject.getString("dataSource"),jsonObject.getJSONObject("data")); List<CreditModel> withdraw = creditComponent.getListModelByCreditThirdStatus("INIT-WITHDRAW");
if("TENCENT_FRAUD_VIP".equals(jsonObject.getString("dataSource"))){ withdraw.parallelStream().forEach(w->{
thirdData.put("PD_TENCENT_FRAUD",jsonObject.getJSONObject("data")); LoanModel loanModel= loanComponent.getByOrderNo(w.getOrderNo());
}else if("TENCENT_FRAUD_SUMMIT".equals(jsonObject.getString("dataSource"))){ JSONObject thirdCredit = new JSONObject();
thirdData.put("PD_TENCENT_FRAUD_VIP",jsonObject.getJSONObject("data")); thirdCredit.put("reqNo", loanModel.getLoanNo());
}else if ("RONG360_BLACK_LIST".equals(jsonObject.getString("dataSource"))){ thirdCredit.put("type", "01");
thirdData.put("PD_R360_ZHDZPF_V2",jsonObject.getJSONObject("data")); ZyJsonResult zyJsonResult = abcHttpClient.postRequest(thirdCredit.toJSONString(), ZNPostUrlEnum.CREDIT_QUERY.getCode());
}else if("RONG360_ZXFV3_SCORE".equals(jsonObject.getString("dataSource"))){ JSONArray jsonArray = zyJsonResult.getExternalInfo();
thirdData.put("PD_R360_ZHDZPF",jsonObject.getJSONObject("data")); processThirdData(w.getClientCell(), w.getOrderNo(), jsonArray);
}else{ });
thirdData.put(jsonObject.getString("dataSource"),jsonObject.getJSONObject("data")); }
}
private void processThirdData(String clientCell, String orderNo, JSONArray jsonArray) {
JSONObject thirdData = new JSONObject();
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject jsonObject = (JSONObject) jsonArray.get(i);
log.info("dataSource:[{}],data:[{}]", jsonObject.getString("dataSource"), jsonObject.getJSONObject("data"));
if ("TENCENT_FRAUD_VIP".equals(jsonObject.getString("dataSource"))) {
thirdData.put("PD_TENCENT_FRAUD", jsonObject.getJSONObject("data"));
} else if ("TENCENT_FRAUD_SUMMIT".equals(jsonObject.getString("dataSource"))) {
thirdData.put("PD_TENCENT_FRAUD_VIP", jsonObject.getJSONObject("data"));
} else if ("RONG360_BLACK_LIST".equals(jsonObject.getString("dataSource"))) {
thirdData.put("PD_R360_ZHDZPF_V2", jsonObject.getJSONObject("data"));
} else if ("RONG360_ZXFV3_SCORE".equals(jsonObject.getString("dataSource"))) {
thirdData.put("PD_R360_ZHDZPF", jsonObject.getJSONObject("data"));
} else {
thirdData.put(jsonObject.getString("dataSource"), jsonObject.getJSONObject("data"));
} }
StringBuffer filePath = new StringBuffer();
filePath.append("zhenong").append("/").append(DateFormatUtils.format(new Date(), "yyyyMMdd")).append("/").append(c.getOrderNo()).append("/"); }
String pdfFileName = c.getClientCell()+UUID.randomUUID(); StringBuffer filePath = new StringBuffer();
ossUtils.upStringObject(filePath+pdfFileName,thirdData.toString());
CreditModel creditModel=new CreditModel(); filePath.append("zhenong").append("/").append(DateFormatUtils.format(new Date(), "yyyyMMdd")).append("/").append(orderNo).append("/");
creditModel.setCreditThirdStatus("FINISHED"); String pdfFileName = clientCell + UUID.randomUUID();
creditModel.setCreditThirdUrl(filePath+pdfFileName); ossUtils.upStringObject(filePath + pdfFileName, thirdData.toString());
creditComponent.updateByOrderNo(c.getOrderNo(),creditModel); CreditModel creditModel = new CreditModel();
}); creditModel.setCreditThirdStatus("FINISHED");
creditModel.setCreditThirdUrl(filePath + pdfFileName);
creditComponent.updateByOrderNo(orderNo, creditModel);
} }
......
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