Commit 3768b722 authored by 郝彦辉's avatar 郝彦辉

非联合贷-实时数据报送sql修改

parent 8d3965e3
package cn.quantgroup.report.controller.external;
import cn.quantgroup.report.domain.baihang.*;
import cn.quantgroup.report.response.GlobalResponse;
import cn.quantgroup.report.service.baihang.BaiHangZhuDaiService;
import com.alibaba.fastjson.JSON;
import com.google.common.base.Stopwatch;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.Objects;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
/**
* 百行征信报送出现错误的贷款记录信息重新报送
*
......@@ -15,7 +28,7 @@ import org.springframework.web.bind.annotation.RestController;
* @Date 2019-04-15 17:27
*/
@RestController
@RequestMapping("/ex/re_send")
@RequestMapping("/zhudai/re_send")
public class ExZhuDaiBaiHangReSendController {
private static final Logger log = LoggerFactory.getLogger(ExZhuDaiBaiHangReSendController.class);
......@@ -223,5 +236,43 @@ public class ExZhuDaiBaiHangReSendController {
}
}
//test3.接口测试 手动调用
@RequestMapping("/test/apiSend2")
public String apiSend2(String type, String startDate, String endDate) {
try {
//"2019-05-07T00:00:00"
if (StringUtils.isAnyBlank(type, startDate, endDate)) {
return "参数为空";
}
if (startDate.length() != 19 || endDate.length() != 19 || !startDate.contains("T") || !endDate.contains("T")) {
log.warn("日期格式有误, startDate : {} , endDate : {} ", startDate, endDate);
return "日期格式有误";
}
String startnyr = LocalDateTime.parse(startDate).format(DateTimeFormatter.ISO_DATE);
String endnyr = LocalDateTime.parse(endDate).format(DateTimeFormatter.ISO_DATE);
if ("A1".equalsIgnoreCase(type)) {
//贷款申请信息(A1)
baiHangZhuDaiService.sendZhuDaiApplyToBaiHang(startnyr, endnyr);
} else if ("D2".equalsIgnoreCase(type)) {
//非循环贷款账户数据信息(D2)
baiHangZhuDaiService.sendZhuDaiLoanToBaiHang(startnyr, endnyr);
} else if ("D3".equalsIgnoreCase(type)) {
//非循环贷款贷后数据信息(D3)
baiHangZhuDaiService.sendZhuDaiRepaymentToBaiHang(startnyr, endnyr);
} else {
return "其他未知类型type=" + type;
}
} catch (Exception e) {
log.error("dataTuoMin异常, {} , {} ", e.getMessage(), e);
return e.getMessage();
}
return type + "手动报送结束";
}
}
......@@ -16,7 +16,9 @@ public class ApplyLoanInfoZhuDai {
private String reqID;
private String opCode;//操作代码A-增加 M-修改
private String uploadTs;
//private Integer isFinTechAgencyBusiness;//N
private int isFinTechAgencyBusiness;//是否是助贷业务 N
private String applyDate;
private String applyId;
private int applyType;
......@@ -25,14 +27,14 @@ public class ApplyLoanInfoZhuDai {
private int idType;
private String pid;
private String mobile;
private String emailAddress;
private String emailAddress; //电子邮箱
private int eduBackground;//学历
private int degree;//学位
private int guaranteeType;//信贷业务担保类型
private int loanPurpose;//贷款用途 Y/N
private int customType;
private int customType; //客户类型
private BigDecimal applyAmount; //申请贷款金额
private String businessOrgCreditCode;//业务发生机构代码 Y/N
......@@ -52,19 +54,25 @@ public class ApplyLoanInfoZhuDai {
//private String spouseMobile;
//private String spouseWorkName;
private String firstContactsName; //第一联系人姓名 Y/N
//private String firstContactsName; //第一联系人姓名 Y/N
//private Integer firstContactsRelationship;
//private Integer firstContactsIdType;
//private String firstContactsPid;
private String firstContactsMobile; //第一联系人手机号码 Y/N
//private String firstContactsPid;
//private String firstContactsMobile; //第一联系人手机号码 Y/N
//private String firstContactsTelephone;
//private String firstContactsWorkName;
private String secondContactsName;//第二联系人姓名 Y/N
//private String secondContactsName;//第二联系人姓名 Y/N
//private Integer secondContactsRelationship;
//private Integer secondContactsIdType;
//private String secondContactsPid;
private String secondContactsMobile;//第二联系人手机号码 Y/N
//private String secondContactsPid;
//private String secondContactsMobile;//第二联系人手机号码 Y/N
//private String secondContactsTelephone;
//private String secondContactsWorkName;
......@@ -73,9 +81,6 @@ public class ApplyLoanInfoZhuDai {
//imei;
//mac;
//ipAddress;
//osName;
//osName;
}
......@@ -12,6 +12,7 @@ import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.concurrent.TimeUnit;
......@@ -44,13 +45,17 @@ public class QuantGroupZhuDaiReportToBaiHang {
redisTemplate.expire(Constant.QG_ZHU_DAI_REPORT_LOCK_KEY, 10, TimeUnit.SECONDS);
Stopwatch stopwatch = Stopwatch.createStarted();
log.info("量化派-助贷模式报送贷款信息开始, startTime: {} ", LocalDateTime.now());
//yyyy-MM-dd
String startnyr = LocalDateTime.now().plusDays(-1).format(DateTimeFormatter.ISO_DATE);
String endnyr = LocalDateTime.now().format(DateTimeFormatter.ISO_DATE);
baiHangZhuDaiService.sendZhuDaiApplyToBaiHang(); //生产 助贷-贷款申请 报送T+1 暂时先不报送C1 因为百行还没有开放查询接口
log.info("量化派-助贷模式报送贷款信息开始, newTime: {} , startnyr: {} , endnyr: {} ", LocalDateTime.now(), startnyr, endnyr);
baiHangZhuDaiService.sendZhuDaiLoanToBaiHang(); //生产 助贷-放款信息 报送T+1
baiHangZhuDaiService.sendZhuDaiApplyToBaiHang(startnyr,endnyr); //生产 助贷-贷款申请 报送T+1 暂时先不报送C1 因为百行还没有开放查询接口
baiHangZhuDaiService.sendZhuDaiRepaymentToBaiHang(); //生产 助贷-还款&逾期信息 报送T+1
baiHangZhuDaiService.sendZhuDaiLoanToBaiHang(startnyr,endnyr); //生产 助贷-放款信息 报送T+1
baiHangZhuDaiService.sendZhuDaiRepaymentToBaiHang(startnyr,endnyr); //生产 助贷-还款&逾期信息 报送T+1
log.info("量化派-助贷模式报送贷款信息息结束, endTime: {}, 耗时: {} ", LocalDateTime.now(), stopwatch.stop().elapsed(TimeUnit.MILLISECONDS));
}
......
......@@ -45,7 +45,7 @@ public interface ApplyLoanInfoMapper {
* 创建人: yanhui.Hao <br/>
* 创建时间: 2019.10.28 <br/>
*/
List<ApplyLoanInfoZhuDai> findRealTimeApplyLoanZhuDai();
List<ApplyLoanInfoZhuDai> findRealTimeApplyLoanZhuDai(BaiHangTimeRecord timeRecord);
/**
* 描述: 1.2百行助贷-联合贷 实时申请 <br/>
......
......@@ -66,7 +66,7 @@ public interface LoanInfoMapper {
* 创建人: yanhui.Hao <br/>
* 创建时间: 2019.10.28 <br/>
*/
List<LoanInfoZhuDai> findRealTimeLoanInfoZhuDai();
List<LoanInfoZhuDai> findRealTimeLoanInfoZhuDai(BaiHangTimeRecord timeRecord);
/**
......
-----BEGIN PRIVATE KEY-----
MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBALg0QqQSZ0YSrSQU
LvIB/u+E/bUQ45DIDtVSO1PQpvhLOrvD7rWNrouLRMjj2Ermi3RvNRZIIx5QaHVQ
BvW2FJm11JC4JxfgcWrT/p0AKqGh9UAyyC9zAfkggpG2BZddZxvQTXVJj5Wn0fWQ
FtE4riCfWpRo1OQc/YljdeqKXTEFAgMBAAECgYBomNRWklSuR6ClYgieR1/Z5myi
SmrOJau2mjEyEMMfLqi1QjbkRQWeG4D9idOiBHOftB4y/tdiOUp3gu/Qyom7Hud4
QxUOEs3popduqPvTfmrlVHfuq+LrV/eVmClPRi+cWsAYEBwZtNxeeGmu/50xf78i
NPFYkP3z71fJ5NA3gQJBAO9tUjcJqbLVpzSt6Q3RrB3h8yXmJZmyWx72Yn/MgTj6
ctxTubSQ60ehQ4HSgziwV8ahXnYEM0YNYp2Bko3Kw1ECQQDE9GHU71wZy/FL2avs
OMLs1AA+CFVpFnFzYIhP48L6IB55P6yVh72IzdjVu6ljHkmlHKRbp/9Jcc2ORtRp
hd11AkEAumy/yFUAylurjswfHAB3aOknHwpdmpgSdUBZH7NHpurzhnS2s07ns+Vw
H+SfAgPkxKefWnsYxWHkuElMqJUJkQJAO/wSL8AW1OSAQRGygudmtqp6yGnRWYg0
VWd5HJvJrlRJ87Oo5IHK//dxqubU2BNJargmdqPb5Ip8iHCaEOlsYQJAKhzD6foy
aK6mJvK+lxwUh2GJKzK3EJrWuTKcuelL9dCp5Z/nNsxxX+9tkOJynyEV56iKlh/h
FJyOOoS03Y9OiA==
duiFangWeiTiGong
-----END PRIVATE KEY-----
-----BEGIN PUBLIC KEY-----
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDEOwIm8MFLteFGz6Eaou1Dza9ov6lddd24xwDDjd/juk2WSZSmq7ZqUeyCqlTQHwoWgXm77qyahqCYZjmzctfO5xM6tB84LDYVhW9WdskeuhejScA30DkzyFls57pYEAdotj8JTGncB5qqU8p213osVCwq0jSD1pDFZP9/+fRPmQIDAQAB
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCWXGJSOw/qQBXaui9Z7NITO4wV3f5Ysh7tbC9op/X33AI6JP8Zlnh7+ZPmuddrYHc683n+qdU3cONCaOTuWmBiXNDQfRqMkR69vpGJel7l9RpFqlR7pyWGkZ1Bac4wUXT+ewPjutT6LyKUaBbIV8Z4jIqO7j/qtvqJt1oHzNzZtwIDAQAB
-----END PUBLIC KEY-----
......@@ -91,11 +91,57 @@
<!--1.1百行助贷-非联合贷 申请实时 2019.10.28-->
<select id="findRealTimeApplyLoanZhuDai" resultType="cn.quantgroup.report.domain.baihang.ApplyLoanInfoZhuDai">
select b.name as name, b.id_no as pid, b.phone_no as mobile, '1' as queryReason, '1' as guaranteeType, '1' as loanPurpose, '99' as customType, '-1' as applyAmount, a.order_no as loanId
from xyqb_i_apply_quota_record a left join xyqb_user_i_user_detail b on a.user_id=b.user_id
where a.created_at>=DATE_FORMAT(DATE_ADD(NOW(), INTERVAL -1 DAY), '%Y-%m-%d')
and 1>2;
<select id="findRealTimeApplyLoanZhuDai" parameterType="cn.quantgroup.report.domain.baihang.BaiHangTimeRecord" resultType="cn.quantgroup.report.domain.baihang.ApplyLoanInfoZhuDai">
select
a.id reqID
,'A' opCode
,DATE_FORMAT(now(),'%Y-%m-%dT%H:%i:%S') uploadTs
,'1' isFinTechAgencyBusiness
,DATE_FORMAT(case when i.created_at is null and h.created_at &lt;= f.created_at then h.created_at
when i.created_at is null and h.created_at>f.created_at then f.created_at
else i.created_at end,'%Y-%m-%dT%H:%i:%S') as applyDate
,if(d.order_no is null,a.loan_application_history_id,d.order_no) applyId
,'1' applyType
,b.name name
,'1' idType
,b.id_no pid
,b.phone_no mobile
,b.email emailAddress
,case when j.education=1 then '10'
when j.education=2 then '20'
when j.education=3 then '30'
when j.education in (4,6) then '40'
when j.education=5 then '50'
when j.education in (7,8) then '60'
else '70' end eduBackground
,'500' degree
,'1' guaranteeType
,'1' loanPurpose
,'99' customType
,'-1' applyAmount
,'8' livingCondition
,case when j.marry_status=1 then '10'
when j.marry_status=2 then '20'
when j.marry_status=4 then '30'
when j.marry_status=3 then '40'
else '90' end marriageStatus
from xyqb_i_loan_application_manifest_history a
left join xyqb_user_i_user_detail b on a.user_id=b.user_id
left join xyqb_i_loan_account_ext c on a.loan_application_history_id=c.loan_id
left join xyqb_i_apply_quota_record d on c.order_no=d.order_no
left join xyqb_i_loan_submit_info f on a.loan_application_history_id=f.loan_id
left join xyqb_i_loan_application_history h on a.loan_application_history_id=h.id
left join xyqb_i_quota_credit i on d.order_no=i.order_no
left join xyqb_i_loan_base_info j on a.loan_application_history_id=j.loan_id
where a.funding_corp_id in (420,520,580,650,670,810,240,640,700)
and a.contract_term not in (2,3)
and a.transaction_status in (2,5)
and case when i.created_at is null and h.created_at &lt;=f.created_at then h.created_at
when i.created_at is null and h.created_at>f.created_at then f.created_at
else i.created_at end >= #{startTime,jdbcType=VARCHAR}
and case when i.created_at is null and h.created_at &lt;=f.created_at then h.created_at
when i.created_at is null and h.created_at>f.created_at then f.created_at
else i.created_at end &lt; #{endTime,jdbcType=VARCHAR};
</select>
<!--1.2百行助贷-联合贷 申请实时 2019.10.28-->
......
......@@ -312,16 +312,57 @@
and a.contract_term not in (2,3)
and a.transaction_status in (2,5)
and a.loan_paid_at >= #{startTime,jdbcType=VARCHAR}
and a.loan_paid_at &lt; #{endTime,jdbcType=VARCHAR}
and a.loan_paid_at &lt; #{endTime,jdbcType=VARCHAR};
</select>
<!--2.1百行助贷-非联合贷 放款实时 2019.10.28-->
<select id="findRealTimeLoanInfoZhuDai" parameterType="cn.quantgroup.report.domain.baihang.BaiHangTimeRecord" resultType="cn.quantgroup.report.domain.baihang.LoanInfoZhuDai">
select a.loan_application_history_id reqID
,'A' opCode
,DATE_FORMAT(now(),'%Y-%m-%dT%H:%i:%S') uploadTs
,if(a.funding_corp_id in (240,640,700),'深圳市小赢科技有限责任公司','广州惠金小额贷款有限公司') institutionalFundingPartner
,if(a.funding_corp_id in (240,640,700),'91440300MA5DMXHN4R','91440101MA59G7X78Y') institutionalFundingPartnerID
,j.corp_loan_id relationID
,'' institutionalFundingPartnerLoanID
,if(d.order_no is null,a.loan_application_history_id,d.order_no) orderID
,'' preCreditLimit
,b.name name
,b.id_no pid
,b.phone_no mobile
,if(d.order_no is null,a.loan_application_history_id,d.order_no) loanId
,'1' guaranteeType
,'1' loanPurpose
,DATE_FORMAT(case when i.created_at is null and h.created_at &lt;= f.created_at then h.created_at
when i.created_at is null and h.created_at>f.created_at then f.created_at
else i.created_at end,'%Y-%m-%dT%H:%i:%S') as applyDate
,DATE_FORMAT(case when d.created_at is null and f.created_at>=h.created_at then f.created_at
when d.created_at is null and f.created_at &lt; h.created_at then h.created_at
else d.created_at end,'%Y-%m-%dT%H:%i:%S') as accountOpenDate
,DATE_FORMAT(a.loan_paid_at,'%Y-%m-%dT%H:%i:%S') issueDate
,date(date_sub(e.deadline,INTERVAL 1 second)) dueDate
,a.contract_loan_amount loanAmount
,a.contract_term totalTerm
,'2' targetRepayDateType
,'-1' termPeriod
,date(date_sub(g.deadline,INTERVAL 1 second)) firstRepaymentDate
,'0' gracePeriod
from xyqb_i_loan_application_manifest_history a
where 1>2;
left join xyqb_user_i_user_detail b on a.user_id=b.user_id
left join xyqb_i_loan_account_ext c on a.loan_application_history_id=c.loan_id
left join xyqb_i_apply_quota_record d on c.order_no=d.order_no
left join xyqb_i_repayment_plan e on a.loan_application_history_id=e.loan_application_history_id
left join xyqb_i_loan_submit_info f on a.loan_application_history_id=f.loan_id
left join xyqb_i_repayment_plan g on a.loan_application_history_id=g.loan_application_history_id
left join xyqb_i_loan_application_history h on a.loan_application_history_id=h.id
left join xyqb_i_quota_credit i on d.order_no=i.order_no
left join xyqb_i_waiting_funding_corp_operate_people j on a.loan_application_history_id=j.loan_application_history_id
where a.funding_corp_id in (420,520,580,650,670,810,240,640,700) and
e.term_no=a.contract_term and g.term_no=1
and a.contract_term not in (2,3)
and a.transaction_status in (2,5)
and a.loan_paid_at>= #{startTime,jdbcType=VARCHAR}
and a.loan_paid_at &lt; #{endTime,jdbcType=VARCHAR};
</select>
<!--2.2百行助贷-联合贷 放款实时 2019.10.28-->
......
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