Commit 183714aa authored by 陈宏杰's avatar 陈宏杰

报送(A1)

parent 7c1ad593
...@@ -82,5 +82,6 @@ public class ApplyLoanInfoZhuDai { ...@@ -82,5 +82,6 @@ public class ApplyLoanInfoZhuDai {
//mac; //mac;
//ipAddress; //ipAddress;
//osName; //osName;
private String recordId;
} }
package cn.quantgroup.report.mapper.master;
import cn.quantgroup.report.domain.baihang.ApplyLoanInfoZhuDai;
import org.springframework.stereotype.Repository;
/**
* -----------------------------------------------------------------------------<br>
* 描述: 贷款申请信息 <br>
* 作者:hongjie.chen <br>
* 时间:2021.07.08 <br>
* -----------------------------------------------------------------------------
*/
@Repository
public interface ApplyLoanInfoZhuDaiMapper {
void saveApplyLoanInfoZhuDaiLog(ApplyLoanInfoZhuDai applyLoanInfoZhuDai);
}
...@@ -5,11 +5,13 @@ import cn.quantgroup.report.error.QGException; ...@@ -5,11 +5,13 @@ import cn.quantgroup.report.error.QGException;
import cn.quantgroup.report.mapper.baihang.ApplyLoanInfoMapper; import cn.quantgroup.report.mapper.baihang.ApplyLoanInfoMapper;
import cn.quantgroup.report.mapper.baihang.LoanInfoMapper; import cn.quantgroup.report.mapper.baihang.LoanInfoMapper;
import cn.quantgroup.report.mapper.baihang.RepaymentLoanInfoMapper; import cn.quantgroup.report.mapper.baihang.RepaymentLoanInfoMapper;
import cn.quantgroup.report.mapper.master.ApplyLoanInfoZhuDaiMapper;
import cn.quantgroup.report.mapper.master.LoanInfoDbMapper; import cn.quantgroup.report.mapper.master.LoanInfoDbMapper;
import cn.quantgroup.report.mapper.master.RepaymentLoanInfoDbMapper; import cn.quantgroup.report.mapper.master.RepaymentLoanInfoDbMapper;
import cn.quantgroup.report.service.baihang.client.BhFileCreditApiClient; import cn.quantgroup.report.service.baihang.client.BhFileCreditApiClient;
import cn.quantgroup.report.service.baihang.request.FileUploadRequest; import cn.quantgroup.report.service.baihang.request.FileUploadRequest;
import cn.quantgroup.report.service.baihang.response.FileUploadResponse; import cn.quantgroup.report.service.baihang.response.FileUploadResponse;
import cn.quantgroup.report.service.baihang.util.TuoMinUtils;
import cn.quantgroup.report.service.http.IHttpService; import cn.quantgroup.report.service.http.IHttpService;
import cn.quantgroup.report.utils.DateUtils; import cn.quantgroup.report.utils.DateUtils;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
...@@ -56,6 +58,8 @@ public class BaiHangFileReportService { ...@@ -56,6 +58,8 @@ public class BaiHangFileReportService {
public LoanInfoDbMapper loanInfoDbMapper; public LoanInfoDbMapper loanInfoDbMapper;
@Autowired @Autowired
public RepaymentLoanInfoDbMapper repaymentLoanInfoDbMapper; public RepaymentLoanInfoDbMapper repaymentLoanInfoDbMapper;
@Autowired
public ApplyLoanInfoZhuDaiMapper applyLoanInfoZhuDaiMapper;
private static final String HOST_PATH = "/home/quant_group/reportFile/"; private static final String HOST_PATH = "/home/quant_group/reportFile/";
...@@ -107,12 +111,64 @@ public class BaiHangFileReportService { ...@@ -107,12 +111,64 @@ public class BaiHangFileReportService {
} }
/** /**
* 贷款申请信息(A1) 暂时不支持A1报送 * 贷款申请信息(A1)
* @param starTime 开始时间 * @param starTime 开始时间
* @param endTime 截止时间 * @param endTime 截止时间
*/ */
private void reportA1(String starTime, String endTime){ private void reportA1(String starTime, String endTime){
throw new QGException(COMMON_ILLEGAL_PARAM_TOAST,"报送类型暂不支持"); try {
Stopwatch queryWatch1 = Stopwatch.createStarted();
BaiHangTimeRecord timeRecord = BaiHangTimeRecord.builder().startTime(starTime).endTime(endTime).build();
List<ApplyLoanInfoZhuDai> applyLoanInfos = applyLoanInfoMapper.findRealTimeApplyLoanZhuDai(timeRecord);
log.info("量化派助贷TO百行报送(A1)-非联合贷申请查询完成, 大小: {} , 耗时: {} ", (applyLoanInfos != null ? applyLoanInfos.size() : 0), (queryWatch1.stop().elapsed(TimeUnit.MILLISECONDS) / 1000) + ".s");
Stopwatch queryWatch2 = Stopwatch.createStarted();
List<ApplyLoanInfoZhuDai> applyLoanInfosLh = applyLoanInfoMapper.findRealTimeApplyLoanZhuDaiLh(timeRecord);
log.info("量化派助贷TO百行报送(A1)-联合贷申请查询完成, 大小: {} , 耗时: {} ", (applyLoanInfosLh != null ? applyLoanInfosLh.size() : 0), (queryWatch2.stop().elapsed(TimeUnit.MILLISECONDS) / 1000) + ".s");
if (applyLoanInfos == null) {
applyLoanInfos = new ArrayList<ApplyLoanInfoZhuDai>();
}
if (applyLoanInfosLh != null && applyLoanInfosLh.size() > 0) {
applyLoanInfos.addAll(applyLoanInfosLh);
}
AtomicInteger atomicInteger = new AtomicInteger();
Stopwatch sendWatch = Stopwatch.createStarted();
List<String> reportList = new ArrayList<>();
reportList.add("#applyInfo");
String reqId_log = "";
for (int i = 0; i < applyLoanInfos.size(); i++) {
try {
ApplyLoanInfoZhuDai applyLoanInfo = applyLoanInfos.get(i);
try {
ApplyLoanInfoZhuDai record = new ApplyLoanInfoZhuDai();
BeanUtils.copyProperties(applyLoanInfo, record);
record.setRecordId(UUID.randomUUID().toString().replaceAll("-", ""));
applyLoanInfoZhuDaiMapper.saveApplyLoanInfoZhuDaiLog(record);
} catch (Exception e) {
log.error("量化派助贷TO百行报送(A1)-贷款申请信息保存记录失败", e);
}
reqId_log = applyLoanInfo.getReqID();
//邮箱有错误的就不传
if (!TuoMinUtils.checkEmail(applyLoanInfo.getEmailAddress())) {
applyLoanInfo.setEmailAddress(null);
}
applyLoanInfo.setName(sensitiveFilter(applyLoanInfo.getName()));
applyLoanInfo.setMobile(sensitiveFilter(applyLoanInfo.getMobile()));
applyLoanInfo.setPid(sensitiveFilter(applyLoanInfo.getPid()));
reportList.add(JSON.toJSONString(applyLoanInfo));
atomicInteger.getAndIncrement();
} catch (Exception e) {
log.error("量化派助贷TO百行报送(A1)-贷款申请信息异常, reqId_log: {} ", reqId_log, e);
}
}
File file = new File("D3-3S\\量子数科科技有限公司_A1_"+starTime.split("T")[0].replaceAll("-","")+"_"+endTime.split("T")[0].replaceAll("-","")+"_0001"+".txt");
FileUtils.writeLines(file,reportList);
createFile(file.getAbsolutePath());
log.info("量化派助贷TO百行报送(A1)-贷款申请信息完成, 实际大小: {} , 报送成功大小: {} , 耗时: {} ", applyLoanInfos.size(), atomicInteger.get(), sendWatch.stop().elapsed(TimeUnit.MILLISECONDS));
} catch (Exception e) {
log.error("量化派助贷TO百行报送(A1)-异常", e);
}
} }
/** /**
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.quantgroup.report.mapper.master.ApplyLoanInfoZhuDaiMapper">
<resultMap id="LoanInfoResultMap" type="cn.quantgroup.report.domain.baihang.ApplyLoanInfoZhuDai">
<result column="recordId" jdbcType="VARCHAR" property="record_id"/>
<result column="reqID" jdbcType="VARCHAR" property="req_id"/>
<result column="opCode" jdbcType="VARCHAR" property="op_code"/>
<result column="uploadTs" jdbcType="VARCHAR" property="upload_ts"/>
<result column="isFinTechAgencyBusiness" jdbcType="INTEGER" property="is_fin_tech_agency_business"/>
<result column="applyDate" jdbcType="VARCHAR" property="apply_date"/>
<result column="applyId" jdbcType="VARCHAR" property="apply_id"/>
<result column="applyType" jdbcType="INTEGER" property="apply_type"/>
<result column="name" jdbcType="VARCHAR" property="name"/>
<result column="idType" jdbcType="INTEGER" property="id_type"/>
<result column="pid" jdbcType="VARCHAR" property="pid"/>
<result column="mobile" jdbcType="VARCHAR" property="mobile"/>
<result column="emailAddress" jdbcType="VARCHAR" property="email_address"/>
<result column="eduBackground" jdbcType="INTEGER" property="edu_background"/>
<result column="degree" jdbcType="INTEGER" property="degree"/>
<result column="guaranteeType" jdbcType="INTEGER" property="guarantee_type"/>
<result column="loanPurpose" jdbcType="INTEGER" property="loan_purpose"/>
<result column="customType" jdbcType="INTEGER" property="custom_type"/>
<result column="applyAmount" jdbcType="DECIMAL" property="apply_amount"/>
<result column="businessOrgCreditCode" jdbcType="VARCHAR" property="business_org_credit_code"/>
<result column="livingCondition" jdbcType="INTEGER" property="living_condition"/>
<result column="marriageStatus" jdbcType="INTEGER" property="marriage_status"/>
<result column="spouseName" jdbcType="VARCHAR" property="spouse_name"/>
</resultMap>
<select id="saveApplyLoanInfoZhuDaiLog" parameterType="cn.quantgroup.report.domain.baihang.ApplyLoanInfoZhuDai">
insert into apply_loan_info_zhudai (record_id,req_id,op_code,upload_ts,is_fin_tech_agency_business,apply_date,
apply_id,apply_type,name,id_type,pid,mobile,email_address,edu_background,
degree,guarantee_type,loan_purpose,custom_type,apply_amount,business_org_credit_code,
living_condition,marriage_status,spouse_name)
VALUES (#{recordId},#{reqID},#{opCode},#{uploadTs},#{isFinTechAgencyBusiness},#{applyDate},#{applyId},#{applyType},#{name},#{idType},
#{pid},#{mobile},#{emailAddress},#{eduBackground},#{degree},#{guaranteeType},#{loanPurpose},#{customType},#{applyAmount},
#{businessOrgCreditCode},#{livingCondition},#{marriageStatus},#{spouseName})
</select>
</mapper>
\ No newline at end of file
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