|
@@ -18,8 +18,11 @@ class IntelligentDockingService extends CrudService {
|
|
|
|
|
|
// 小程序 银企对接接口
|
|
|
async intelligentDocking(data) {
|
|
|
- const { uid, company_name, code, person, opening_bank, orientation, money, claims_min_term, claims_max_term,
|
|
|
- mongey_min_rate, mongey_max_rate, ensure_id, when, additional_information } = data;
|
|
|
+ // const { uid, company_name, code, person, opening_bank, orientation, money, claims_min_term, claims_max_term,
|
|
|
+ // mongey_min_rate, mongey_max_rate, ensure_id, when, additional_information } = data;
|
|
|
+ const { uid, company_name, person, phone, money, ensure_id, orientation, additional_information } = data;
|
|
|
+ assert(uid, company_name && person && phone && money && ensure_id && orientation && additional_information, '缺少部分信息项');
|
|
|
+
|
|
|
// 判断该企业是否有在进行中的需求(一个企业只能有一个进行中的需求)
|
|
|
// const companyList = await this.model.find({ uid, status: '0' });
|
|
|
const companyList = await this.model.aggregate([
|
|
@@ -70,7 +73,7 @@ class IntelligentDockingService extends CrudService {
|
|
|
return '您有一个正在进行中的对接需求,请完成后再近些申请';
|
|
|
}
|
|
|
// 需求
|
|
|
- const condition = { orientation, money, claims_min_term, claims_max_term, mongey_min_rate, mongey_max_rate, ensure_id };
|
|
|
+ const condition = { orientation, money, ensure_id };
|
|
|
// 对接产品
|
|
|
const products = await this.findFinanceClaimsList(condition);
|
|
|
|
|
@@ -99,7 +102,7 @@ class IntelligentDockingService extends CrudService {
|
|
|
// 根据对接条件查询产品
|
|
|
async findFinanceClaimsList(data) {
|
|
|
// opening_bank 传的是金融机构的id
|
|
|
- const { orientation, money, claims_min_term, claims_max_term, mongey_min_rate, mongey_max_rate, ensure_id } = data;
|
|
|
+ const { orientation, money, ensure_id } = data;
|
|
|
// 已发布的产品
|
|
|
const match = { status: '1' };
|
|
|
// 担保方式【企业选择】、贷款额度【企业选择】+融资取向对产品进行筛选
|
|
@@ -127,22 +130,6 @@ class IntelligentDockingService extends CrudService {
|
|
|
|
|
|
console.log('match', match);
|
|
|
|
|
|
-
|
|
|
- // // 资金期限
|
|
|
- // if (claims_max_term) {
|
|
|
- // match.claims_max_term = { $gte: parseInt(claims_max_term) };
|
|
|
- // }
|
|
|
- // if (claims_min_term) {
|
|
|
- // match.claims_min_term = { $lte: parseInt(claims_min_term) };
|
|
|
- // }
|
|
|
- // // 期望利率
|
|
|
- // if (mongey_max_rate) {
|
|
|
- // match.mongey_max_rate = { $gte: parseInt(mongey_max_rate) };
|
|
|
- // }
|
|
|
- // if (mongey_min_rate) {
|
|
|
- // match.mongey_min_rate = { $lte: parseInt(mongey_min_rate) };
|
|
|
- // }
|
|
|
-
|
|
|
const _sort = {};
|
|
|
// 排序
|
|
|
if (orientation && orientation[0] === '2501') {
|
|
@@ -199,6 +186,7 @@ class IntelligentDockingService extends CrudService {
|
|
|
cid: { $toObjectId: '$cid' },
|
|
|
uid: '$uid',
|
|
|
xqId: { $toString: '$_id' },
|
|
|
+ time: '$meta.createdAt',
|
|
|
},
|
|
|
},
|
|
|
{ $lookup:
|
|
@@ -255,18 +243,6 @@ class IntelligentDockingService extends CrudService {
|
|
|
{ $unwind: '$dictionary' },
|
|
|
{ $unwind: { path: '$follow', preserveNullAndEmptyArrays: true } },
|
|
|
{ $unwind: { path: '$when', preserveNullAndEmptyArrays: true } },
|
|
|
- // { $project:
|
|
|
- // {
|
|
|
- // id: '$_id',
|
|
|
- // jg_id: '$jg_id',
|
|
|
- // cid: '$cid',
|
|
|
- // uid: '$uid',
|
|
|
- // companyName: '$company.company_name',
|
|
|
- // institutionName: '$institution.name',
|
|
|
- // product: '$finance_claims.name',
|
|
|
- // time: '$meta.createdAt',
|
|
|
- // },
|
|
|
- // },
|
|
|
{ $skip: (skip - 1) * limit },
|
|
|
{ $limit: limit },
|
|
|
{ $sort: { time: -1 } },
|