Commit 6315b19c authored by Hsinli's avatar Hsinli

add

parent a198b44f
...@@ -197,6 +197,16 @@ class ApplyService extends Service { ...@@ -197,6 +197,16 @@ class ApplyService extends Service {
return ret; return ret;
} }
//生成订单
let orderData = {
type: 1,
name: inputParams.name,
phone: inputParams.phone,
id_card: inputParams.id_card
}
let order = await ctx.service.credit.order.createOrder(orderData);
ret.order_id = order.id;
//调用数据接口获取黑名单数据 //调用数据接口获取黑名单数据
let params = { let params = {
sign: "", sign: "",
...@@ -240,85 +250,19 @@ class ApplyService extends Service { ...@@ -240,85 +250,19 @@ class ApplyService extends Service {
ctx.failed('数据获取异常'); ctx.failed('数据获取异常');
} }
let blacklistInfo = result.data.data.blackList; let blacklistInfo = result.data.data.blackList;
let reportData = { let report = await this.service.credit.blackList.createReport(inputParams, blacklistInfo);
name: inputParams.name,
id_card: inputParams.id_card,
phone: inputParams.phone,
age: '',
city: '',
blacklist_of_internet_loans: blacklistInfo.pre_loan_risk.blacklist_of_internet_loans,
blacklist_of_court_dishonesty: blacklistInfo.pre_loan_risk.blacklist_of_court_dishonesty,
blacklist_of_industry: blacklistInfo.pre_loan_risk.blacklist_of_industry,
blacklist_of_ds_industry: blacklistInfo.pre_loan_risk.blacklist_of_ds_industry,
blacklist_of_bx_industry: blacklistInfo.pre_loan_risk.blacklist_of_bx_industry,
blacklist_of_zc_industry: blacklistInfo.pre_loan_risk.blacklist_of_zc_industry,
blacklist_of_zf_industry: blacklistInfo.pre_loan_risk.blacklist_of_zf_industry,
blacklist_of_jd_industry: blacklistInfo.pre_loan_risk.blacklist_of_jd_industry,
reg_count_1month: blacklistInfo.long_lending_risk.reg_count_1month,
reg_count_3month: blacklistInfo.long_lending_risk.reg_count_3month,
reg_count_6month: blacklistInfo.long_lending_risk.reg_count_6month,
consume_reg_count_1month: blacklistInfo.long_lending_risk.consume_reg_count_1month,
consume_reg_count_3month: blacklistInfo.long_lending_risk.consume_reg_count_3month,
consume_reg_count_6month: blacklistInfo.long_lending_risk.consume_reg_count_6month,
loan_reg_count_1month: blacklistInfo.long_lending_risk.loan_reg_count_1month,
loan_reg_count_3month: blacklistInfo.long_lending_risk.loan_reg_count_3month,
loan_reg_count_6month: blacklistInfo.long_lending_risk.loan_reg_count_6month,
consume_reg_platform_count_1month: blacklistInfo.long_lending_risk.consume_reg_platform_count_1month,
consume_reg_platform_count_3month: blacklistInfo.long_lending_risk.consume_reg_platform_count_3month,
consume_reg_platform_count_6month: blacklistInfo.long_lending_risk.consume_reg_platform_count_6month,
loan_reg_platform_count_1month: blacklistInfo.long_lending_risk.loan_reg_platform_count_1month,
loan_reg_platform_count_3month: blacklistInfo.long_lending_risk.loan_reg_platform_count_3month,
loan_reg_platform_count_6month: blacklistInfo.long_lending_risk.loan_reg_platform_count_6month,
reg_platform_count_1month: blacklistInfo.long_lending_risk.reg_platform_count_1month,
reg_platform_count_3month: blacklistInfo.long_lending_risk.reg_platform_count_3month,
reg_platform_count_6month: blacklistInfo.long_lending_risk.reg_platform_count_6month,
credit_count_1month: blacklistInfo.long_lending_risk.credit_count_1month,
credit_count_3month: blacklistInfo.long_lending_risk.credit_count_3month,
credit_count_6month: blacklistInfo.long_lending_risk.credit_count_6month,
credit_amount_1month: blacklistInfo.long_lending_risk.credit_amount_1month,
credit_amount_3month: blacklistInfo.long_lending_risk.credit_amount_3month,
credit_amount_6month: blacklistInfo.long_lending_risk.credit_amount_6month,
credit_closed_count_1month: blacklistInfo.long_lending_risk.credit_closed_count_1month,
credit_closed_count_3month: blacklistInfo.long_lending_risk.credit_closed_count_3month,
credit_closed_count_6month: blacklistInfo.long_lending_risk.credit_closed_count_6month,
credit_closed_amount_1month: blacklistInfo.long_lending_risk.credit_closed_amount_1month,
credit_closed_amount_3month: blacklistInfo.long_lending_risk.credit_closed_amount_3month,
credit_closed_amount_6month: blacklistInfo.long_lending_risk.credit_closed_amount_6month,
consume_credit_count_1month: blacklistInfo.long_lending_risk.consume_credit_count_1month,
consume_credit_count_3month: blacklistInfo.long_lending_risk.consume_credit_count_3month,
consume_credit_count_6month: blacklistInfo.long_lending_risk.consume_credit_count_6month,
loan_credit_count_1month: blacklistInfo.long_lending_risk.loan_credit_count_1month,
loan_credit_count_3month: blacklistInfo.long_lending_risk.loan_credit_count_3month,
loan_credit_count_6month: blacklistInfo.long_lending_risk.loan_credit_count_6month,
consume_credit_platform_count_1month: blacklistInfo.long_lending_risk.consume_credit_platform_count_1month,
consume_credit_platform_count_3month: blacklistInfo.long_lending_risk.consume_credit_platform_count_3month,
consume_credit_platform_count_6month: blacklistInfo.long_lending_risk.consume_credit_platform_count_6month,
loan_credit_platform_count_1month: blacklistInfo.long_lending_risk.loan_credit_platform_count_1month,
loan_credit_platform_count_3month: blacklistInfo.long_lending_risk.loan_credit_platform_count_3month,
loan_credit_platform_count_6month: blacklistInfo.long_lending_risk.loan_credit_platform_count_6month,
credit_platform_count_1month: blacklistInfo.long_lending_risk.credit_platform_count_1month,
credit_platform_count_3month: blacklistInfo.long_lending_risk.credit_platform_count_3month,
credit_platform_count_6month: blacklistInfo.long_lending_risk.credit_platform_count_6month,
id_card_relevant_mobilephone_count: blacklistInfo.identity_related_risk.id_card_relevant_mobilephone_count,
id_card_relevant_device_count: blacklistInfo.identity_related_risk.id_card_relevant_device_count,
mobilephone_relevant_id_card_count: blacklistInfo.identity_related_risk.mobilephone_relevant_id_card_count,
relevant_loan_app_count_6month: blacklistInfo.related_app.relevant_loan_app_count_6month,
relevant_gamble_app_count_6month: blacklistInfo.related_app.relevant_gamble_app_count_6month,
relevant_ip_app_count_6month: blacklistInfo.related_app.relevant_ip_app_count_6month,
relevant_other_app_count_6month: blacklistInfo.related_app.relevant_other_app_count_6month,
overdue: JSON.stringify(blacklistInfo.overdue_analysis)
}
let report = await ctx.prometheusModel.CreditBlacklistReport.create(reportData);
ret.report_id = report.id; ret.report_id = report.id;
//生成订单 //更新订单
let orderData = { let updateOrderData = {
type: 1, apply_id: apply_id,
report_id: report.id, report_id: report_id,
apply_id: apply.id, state: '待支付',
state_time: moment().format('YYYY-MM-DD HH:mm:ss'),
valid: 1
} }
let order = await ctx.service.credit.order.createOrder(orderData); await ctx.prometheusModel.CreditOrder.update(updateOrderData, { where: { id: order.id } });
ret.order_id = order.id;
return ret; return ret;
} }
......
...@@ -309,6 +309,86 @@ class BlacklistService extends Service { ...@@ -309,6 +309,86 @@ class BlacklistService extends Service {
} }
/**
* 生成报告内容
* @param {*} inputParams 三要素
* @param {*} blacklistInfo 获取的黑名单信息
*/
async createReport(inputParams, blacklistInfo) {
const { ctx } = this;
let reportData = {
name: inputParams.name,
id_card: inputParams.id_card,
phone: inputParams.phone,
age: '',
city: '',
blacklist_of_internet_loans: blacklistInfo.pre_loan_risk.blacklist_of_internet_loans,
blacklist_of_court_dishonesty: blacklistInfo.pre_loan_risk.blacklist_of_court_dishonesty,
blacklist_of_industry: blacklistInfo.pre_loan_risk.blacklist_of_industry,
blacklist_of_ds_industry: blacklistInfo.pre_loan_risk.blacklist_of_ds_industry,
blacklist_of_bx_industry: blacklistInfo.pre_loan_risk.blacklist_of_bx_industry,
blacklist_of_zc_industry: blacklistInfo.pre_loan_risk.blacklist_of_zc_industry,
blacklist_of_zf_industry: blacklistInfo.pre_loan_risk.blacklist_of_zf_industry,
blacklist_of_jd_industry: blacklistInfo.pre_loan_risk.blacklist_of_jd_industry,
reg_count_1month: blacklistInfo.long_lending_risk.reg_count_1month,
reg_count_3month: blacklistInfo.long_lending_risk.reg_count_3month,
reg_count_6month: blacklistInfo.long_lending_risk.reg_count_6month,
consume_reg_count_1month: blacklistInfo.long_lending_risk.consume_reg_count_1month,
consume_reg_count_3month: blacklistInfo.long_lending_risk.consume_reg_count_3month,
consume_reg_count_6month: blacklistInfo.long_lending_risk.consume_reg_count_6month,
loan_reg_count_1month: blacklistInfo.long_lending_risk.loan_reg_count_1month,
loan_reg_count_3month: blacklistInfo.long_lending_risk.loan_reg_count_3month,
loan_reg_count_6month: blacklistInfo.long_lending_risk.loan_reg_count_6month,
consume_reg_platform_count_1month: blacklistInfo.long_lending_risk.consume_reg_platform_count_1month,
consume_reg_platform_count_3month: blacklistInfo.long_lending_risk.consume_reg_platform_count_3month,
consume_reg_platform_count_6month: blacklistInfo.long_lending_risk.consume_reg_platform_count_6month,
loan_reg_platform_count_1month: blacklistInfo.long_lending_risk.loan_reg_platform_count_1month,
loan_reg_platform_count_3month: blacklistInfo.long_lending_risk.loan_reg_platform_count_3month,
loan_reg_platform_count_6month: blacklistInfo.long_lending_risk.loan_reg_platform_count_6month,
reg_platform_count_1month: blacklistInfo.long_lending_risk.reg_platform_count_1month,
reg_platform_count_3month: blacklistInfo.long_lending_risk.reg_platform_count_3month,
reg_platform_count_6month: blacklistInfo.long_lending_risk.reg_platform_count_6month,
credit_count_1month: blacklistInfo.long_lending_risk.credit_count_1month,
credit_count_3month: blacklistInfo.long_lending_risk.credit_count_3month,
credit_count_6month: blacklistInfo.long_lending_risk.credit_count_6month,
credit_amount_1month: blacklistInfo.long_lending_risk.credit_amount_1month,
credit_amount_3month: blacklistInfo.long_lending_risk.credit_amount_3month,
credit_amount_6month: blacklistInfo.long_lending_risk.credit_amount_6month,
credit_closed_count_1month: blacklistInfo.long_lending_risk.credit_closed_count_1month,
credit_closed_count_3month: blacklistInfo.long_lending_risk.credit_closed_count_3month,
credit_closed_count_6month: blacklistInfo.long_lending_risk.credit_closed_count_6month,
credit_closed_amount_1month: blacklistInfo.long_lending_risk.credit_closed_amount_1month,
credit_closed_amount_3month: blacklistInfo.long_lending_risk.credit_closed_amount_3month,
credit_closed_amount_6month: blacklistInfo.long_lending_risk.credit_closed_amount_6month,
consume_credit_count_1month: blacklistInfo.long_lending_risk.consume_credit_count_1month,
consume_credit_count_3month: blacklistInfo.long_lending_risk.consume_credit_count_3month,
consume_credit_count_6month: blacklistInfo.long_lending_risk.consume_credit_count_6month,
loan_credit_count_1month: blacklistInfo.long_lending_risk.loan_credit_count_1month,
loan_credit_count_3month: blacklistInfo.long_lending_risk.loan_credit_count_3month,
loan_credit_count_6month: blacklistInfo.long_lending_risk.loan_credit_count_6month,
consume_credit_platform_count_1month: blacklistInfo.long_lending_risk.consume_credit_platform_count_1month,
consume_credit_platform_count_3month: blacklistInfo.long_lending_risk.consume_credit_platform_count_3month,
consume_credit_platform_count_6month: blacklistInfo.long_lending_risk.consume_credit_platform_count_6month,
loan_credit_platform_count_1month: blacklistInfo.long_lending_risk.loan_credit_platform_count_1month,
loan_credit_platform_count_3month: blacklistInfo.long_lending_risk.loan_credit_platform_count_3month,
loan_credit_platform_count_6month: blacklistInfo.long_lending_risk.loan_credit_platform_count_6month,
credit_platform_count_1month: blacklistInfo.long_lending_risk.credit_platform_count_1month,
credit_platform_count_3month: blacklistInfo.long_lending_risk.credit_platform_count_3month,
credit_platform_count_6month: blacklistInfo.long_lending_risk.credit_platform_count_6month,
id_card_relevant_mobilephone_count: blacklistInfo.identity_related_risk.id_card_relevant_mobilephone_count,
id_card_relevant_device_count: blacklistInfo.identity_related_risk.id_card_relevant_device_count,
mobilephone_relevant_id_card_count: blacklistInfo.identity_related_risk.mobilephone_relevant_id_card_count,
relevant_loan_app_count_6month: blacklistInfo.related_app.relevant_loan_app_count_6month,
relevant_gamble_app_count_6month: blacklistInfo.related_app.relevant_gamble_app_count_6month,
relevant_ip_app_count_6month: blacklistInfo.related_app.relevant_ip_app_count_6month,
relevant_other_app_count_6month: blacklistInfo.related_app.relevant_other_app_count_6month,
overdue: JSON.stringify(blacklistInfo.overdue_analysis)
}
let report = await ctx.prometheusModel.CreditBlacklistReport.create(reportData);
return report;
}
} }
module.exports = BlacklistService; module.exports = BlacklistService;
...@@ -390,30 +390,28 @@ class OrderService extends Service { ...@@ -390,30 +390,28 @@ class OrderService extends Service {
/** /**
* 生成订单 * 初始化生成订单
* @param {*} params * @param {*} params
*/ */
async createOrder(params) { async createOrder(params) {
const { ctx } = this; const { ctx } = this;
let data = { let data = {
apply_id: params.apply_id,
report_id: params.report_id,
type: params.type, type: params.type,
phone: params.phone,
name: params.name,
id_card: params.id_card,
user_id: ctx.userId, user_id: ctx.userId,
app_user_id: ctx.userId, app_user_id: ctx.userId,
app_id: ctx.appId, app_id: ctx.appId,
app_type_id: ctx.appTypeId, app_type_id: ctx.appTypeId,
price: params.type === 1 ? 29.9 : 15.9, price: params.type === 1 ? 29.90 : 19.90,
state: '待支付', valid: 0,
state_time: moment().format('YYYY-MM-DD HH:mm:ss'),
pay_status: 0,
valid: 1,
} }
let order = await ctx.prometheusModel.CreditOrder.create(data); let order = await ctx.prometheusModel.CreditOrder.create(data);
return order;
//生成order_no //生成order_no
let orderNo = await ctx.service.credit.common.getOrdertNo(TypeConfigFlip[order.type], order.id); let orderNo = await ctx.service.credit.common.getOrdertNo(TypeConfigFlip[order.type], order.id);
await ctx.prometheusModel.CreditOrder.update({ order_no: orderNo }, { where: { id: order.id } }); await ctx.prometheusModel.CreditOrder.update({ order_no: orderNo }, { where: { id: order.id } });
return order;
} }
/** /**
......
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