Commit c98fe94c authored by BlackJokerCJ's avatar BlackJokerCJ

修改提交

parent 3ca28c99
...@@ -66,7 +66,9 @@ public class LoanSubmitCommand extends AbstractCommand { ...@@ -66,7 +66,9 @@ public class LoanSubmitCommand extends AbstractCommand {
thirdCredit.put("reqNo",loanSubmitResponse.getOrderNo()); thirdCredit.put("reqNo",loanSubmitResponse.getOrderNo());
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 creditModel=new CreditModel();
creditModel.setCreditThirdStatus("INIT");
creditComponent.updateByOrderNo(loanSubmitResponse.getOrderNo(),creditModel);
// 提现授信 // 提现授信
LoanCreditSubmitModel model = new LoanCreditSubmitModel(); LoanCreditSubmitModel model = new LoanCreditSubmitModel();
model.setOrderNo(byOrderNo.getOrderNo()); model.setOrderNo(byOrderNo.getOrderNo());
......
...@@ -2,6 +2,8 @@ package com.jqtx.windows.component; ...@@ -2,6 +2,8 @@ package com.jqtx.windows.component;
import com.jqtx.windows.component.model.CreditModel; import com.jqtx.windows.component.model.CreditModel;
import java.util.List;
public interface CreditComponent { public interface CreditComponent {
CreditModel getByOrderNo(String orderNo); CreditModel getByOrderNo(String orderNo);
...@@ -9,4 +11,6 @@ public interface CreditComponent { ...@@ -9,4 +11,6 @@ public interface CreditComponent {
void insert(CreditModel model); void insert(CreditModel model);
void updateByOrderNo(String orderNo,CreditModel model); void updateByOrderNo(String orderNo,CreditModel model);
List<CreditModel> getListModelByCreditThirdStatus(String init);
} }
...@@ -14,6 +14,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -14,6 +14,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
@Service @Service
public class CreditComponentImpl implements CreditComponent { public class CreditComponentImpl implements CreditComponent {
...@@ -27,16 +28,16 @@ public class CreditComponentImpl implements CreditComponent { ...@@ -27,16 +28,16 @@ public class CreditComponentImpl implements CreditComponent {
WindowsCreditExample.Criteria c = example.createCriteria(); WindowsCreditExample.Criteria c = example.createCriteria();
c.andOrderNoEqualTo(orderNo); c.andOrderNoEqualTo(orderNo);
example.setOrderByClause("id desc"); example.setOrderByClause("id desc");
List<WindowsCredit> list= windowsCreditMapper.selectByExample(example); List<WindowsCredit> list = windowsCreditMapper.selectByExample(example);
if(CollectionUtil.isNotEmpty(list)){ 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().get();
} }
return null; return null;
} }
@Override @Override
public void insert(CreditModel model) { public void insert(CreditModel model) {
windowsCreditMapper.insertSelective(CglibUtil.copy(model,WindowsCredit.class)); windowsCreditMapper.insertSelective(CglibUtil.copy(model, WindowsCredit.class));
} }
@Override @Override
...@@ -46,8 +47,20 @@ public class CreditComponentImpl implements CreditComponent { ...@@ -46,8 +47,20 @@ public class CreditComponentImpl implements CreditComponent {
c.andOrderNoEqualTo(orderNo); c.andOrderNoEqualTo(orderNo);
example.setOrderByClause("id desc"); example.setOrderByClause("id desc");
int i = windowsCreditMapper.updateByExampleSelective(CglibUtil.copy(model, WindowsCredit.class), example); int i = windowsCreditMapper.updateByExampleSelective(CglibUtil.copy(model, WindowsCredit.class), example);
if(i!=1){ if (i != 1) {
throw new BizException(ExceptionCodeEnum.SYSTEM_SQL_UPDATE_ERROR); throw new BizException(ExceptionCodeEnum.SYSTEM_SQL_UPDATE_ERROR);
} }
} }
@Override
public List<CreditModel> getListModelByCreditThirdStatus(String creditThirdStatus) {
WindowsCreditExample example = new WindowsCreditExample();
WindowsCreditExample.Criteria c = example.createCriteria();
c.andCreditThirdStatusEqualTo(creditThirdStatus);
example.setOrderByClause("id desc");
List<WindowsCredit> list = windowsCreditMapper.selectByExample(example);
return list.stream().map(e -> CglibUtil.copy(e, CreditModel.class)).collect(Collectors.toList());
}
} }
...@@ -22,6 +22,12 @@ public class CreditModel { ...@@ -22,6 +22,12 @@ public class CreditModel {
private String creditAmt; private String creditAmt;
private String creditThirdToken;
private String creditThirdUrl;
private String creditThirdStatus;
private LocalDateTime gmtCreated; private LocalDateTime gmtCreated;
private LocalDateTime gmtModified; private LocalDateTime gmtModified;
......
package com.jqtx.windows.component.model; package com.jqtx.windows.component.model;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.jqtx.windows.common.exception.BizException; import com.jqtx.windows.common.exception.BizException;
import com.jqtx.windows.infrastructure.enums.ExceptionCodeEnum; import com.jqtx.windows.infrastructure.enums.ExceptionCodeEnum;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
...@@ -23,6 +25,18 @@ public class ZyJsonResult<T> implements Serializable { ...@@ -23,6 +25,18 @@ public class ZyJsonResult<T> implements Serializable {
private String message; private String message;
@ApiModelProperty("返回业务数据") @ApiModelProperty("返回业务数据")
private T result; private T result;
@ApiModelProperty("扩展字段")
private JSONArray externalInfo;
public JSONArray getExternalInfo() {
return externalInfo;
}
public void setExternalInfo(JSONArray externalInfo) {
this.externalInfo = externalInfo;
}
public ZyJsonResult() { public ZyJsonResult() {
} }
......
package com.jqtx.windows.job; package com.jqtx.windows.job;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
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.enums.ZNPostUrlEnum; import com.jqtx.windows.component.enums.ZNPostUrlEnum;
import com.jqtx.windows.component.model.CreditModel;
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;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.Date;
import java.util.List;
import java.util.UUID;
@Component @Component
@Slf4j @Slf4j
public class CreditThirdDataJob { public class CreditThirdDataJob {
@Autowired
private CreditComponent creditComponent;
@Autowired @Autowired
private AbcHttpClient abcHttpClient; private AbcHttpClient abcHttpClient;
@Autowired
private OssUtils ossUtils;
@XxlJob("creditThirdDataJob") @XxlJob("creditThirdDataJob")
public void run (){ public void run() {
List<CreditModel> creditModels = creditComponent.getListModelByCreditThirdStatus("INIT");
creditModels.parallelStream().forEach(c -> {
JSONObject thirdCredit = new JSONObject();
thirdCredit.put("reqNo", c.getOrderNo());
thirdCredit.put("type", "01");
ZyJsonResult zyJsonResult = abcHttpClient.postRequest(thirdCredit.toJSONString(), ZNPostUrlEnum.CREDIT_QUERY.getCode());
JSONArray jsonArray = zyJsonResult.getExternalInfo();
JSONObject thirdData = new JSONObject();
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject jsonObject = (JSONObject) jsonArray.get(i);
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();
ossUtils.upStringObject(filePath+pdfFileName,thirdData.toString());
CreditModel creditModel=new CreditModel();
creditModel.setCreditThirdStatus("FINISHED");
creditModel.setCreditThirdUrl(filePath+pdfFileName);
creditComponent.updateByOrderNo(c.getOrderNo(),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