|
@@ -235,11 +235,6 @@ class IntelligentDockingService extends CrudService {
|
|
|
{ $unwind: { path: '$institution', preserveNullAndEmptyArrays: true } },
|
|
|
{ $unwind: { path: '$finance_claims', preserveNullAndEmptyArrays: true } },
|
|
|
{ $unwind: { path: '$dictionary', preserveNullAndEmptyArrays: true } },
|
|
|
-
|
|
|
- // { $unwind: '$company', preserveNullAndEmptyArrays: true },
|
|
|
- // { $unwind: '$institution', preserveNullAndEmptyArrays: true },
|
|
|
- // { $unwind: '$finance_claims', preserveNullAndEmptyArrays: true },
|
|
|
- // { $unwind: '$dictionary', preserveNullAndEmptyArrays: true },
|
|
|
{ $unwind: { path: '$follow', preserveNullAndEmptyArrays: true } },
|
|
|
{ $project:
|
|
|
{
|
|
@@ -285,223 +280,6 @@ class IntelligentDockingService extends CrudService {
|
|
|
return { result, total };
|
|
|
}
|
|
|
|
|
|
- // 金控端查询列表
|
|
|
- async jinkongList(data) {
|
|
|
- const query = {};
|
|
|
- if (data.id) { // 单查 对接需求id
|
|
|
- query._id = ObjectId(data.id);
|
|
|
- }
|
|
|
- if (data.jg_id) { // 金融机构ID
|
|
|
- query.jg_id = data.jg_id;
|
|
|
- }
|
|
|
- if (data.uid) { // 企业ID
|
|
|
- query.uid = data.uid;
|
|
|
- }
|
|
|
- if (data.cid) { // 产品id
|
|
|
- query.cid = data.cid;
|
|
|
- }
|
|
|
- if (data.status) { // 状态
|
|
|
- query.status = data.status;
|
|
|
- }
|
|
|
- const skip = Number.parseInt(data.skip) || 1;
|
|
|
- const limit = Number.parseInt(data.limit) || 10;
|
|
|
-
|
|
|
- // const total = await this.model.countDocuments(query);
|
|
|
- const total = await this.model.aggregate([
|
|
|
- { $match: query },
|
|
|
- { $project:
|
|
|
- {
|
|
|
- ensure_id: 1,
|
|
|
- person: 1,
|
|
|
- money: 1,
|
|
|
- claims_min_term: 1,
|
|
|
- claims_max_term: 1,
|
|
|
- mongey_min_rate: 1,
|
|
|
- mongey_max_rate: 1,
|
|
|
- when: 1,
|
|
|
- refuse_times: 1,
|
|
|
- additional_information: 1,
|
|
|
- status: 1,
|
|
|
- jg_id: { $toObjectId: '$jg_id' },
|
|
|
- cid: { $toObjectId: '$cid' },
|
|
|
- uid: '$uid',
|
|
|
- xqId: { $toString: '$_id' },
|
|
|
- time: '$meta.createdAt',
|
|
|
- },
|
|
|
- },
|
|
|
- { $lookup:
|
|
|
- {
|
|
|
- from: 'institution',
|
|
|
- localField: 'jg_id',
|
|
|
- foreignField: '_id',
|
|
|
- as: 'institution',
|
|
|
- },
|
|
|
- },
|
|
|
- { $lookup:
|
|
|
- {
|
|
|
- from: 't_finance_claims',
|
|
|
- localField: 'cid',
|
|
|
- foreignField: '_id',
|
|
|
- as: 'finance_claims',
|
|
|
- },
|
|
|
- },
|
|
|
- { $lookup:
|
|
|
- {
|
|
|
- from: 'dictionary',
|
|
|
- localField: 'ensure_id',
|
|
|
- foreignField: 'code',
|
|
|
- as: 'dictionary',
|
|
|
- },
|
|
|
- },
|
|
|
- { $lookup:
|
|
|
- {
|
|
|
- from: 'intelligent_follow',
|
|
|
- localField: 'xqId',
|
|
|
- foreignField: 'intelligentId',
|
|
|
- as: 'follow',
|
|
|
- },
|
|
|
- },
|
|
|
- { $unwind: '$institution' },
|
|
|
- { $unwind: '$finance_claims' },
|
|
|
- { $unwind: '$dictionary' },
|
|
|
- { $unwind: { path: '$follow', preserveNullAndEmptyArrays: true } },
|
|
|
- { $project:
|
|
|
- {
|
|
|
- ensure_id: 1,
|
|
|
- person: 1,
|
|
|
- money: 1,
|
|
|
- claims_min_term: 1,
|
|
|
- claims_max_term: 1,
|
|
|
- mongey_min_rate: 1,
|
|
|
- mongey_max_rate: 1,
|
|
|
- when: 1,
|
|
|
- refuse_times: 1,
|
|
|
- additional_information: 1,
|
|
|
- status: 1,
|
|
|
- creditStatus: '$follow.creditStatus',
|
|
|
- jg_id: { $toObjectId: '$jg_id' },
|
|
|
- cid: { $toObjectId: '$cid' },
|
|
|
- uid: '$uid',
|
|
|
- xqId: { $toString: '$_id' },
|
|
|
- time: '$meta.createdAt',
|
|
|
- company: '$company',
|
|
|
- institution: '$institution',
|
|
|
- finance_claims: '$finance_claims',
|
|
|
- dictionary: '$dictionary',
|
|
|
- follow: '$follow',
|
|
|
- },
|
|
|
- },
|
|
|
- { $sort: { time: -1 } },
|
|
|
- ]);
|
|
|
- const result = await this.model.aggregate([
|
|
|
- { $match: query },
|
|
|
- { $project:
|
|
|
- {
|
|
|
- ensure_id: 1,
|
|
|
- person: 1,
|
|
|
- money: 1,
|
|
|
- claims_min_term: 1,
|
|
|
- claims_max_term: 1,
|
|
|
- mongey_min_rate: 1,
|
|
|
- mongey_max_rate: 1,
|
|
|
- when: 1,
|
|
|
- refuse_times: 1,
|
|
|
- additional_information: 1,
|
|
|
- status: 1,
|
|
|
- jg_id: { $toObjectId: '$jg_id' },
|
|
|
- cid: { $toObjectId: '$cid' },
|
|
|
- uid: '$uid',
|
|
|
- xqId: { $toString: '$_id' },
|
|
|
- time: '$meta.createdAt',
|
|
|
- },
|
|
|
- },
|
|
|
- { $lookup:
|
|
|
- {
|
|
|
- from: 'company_identify',
|
|
|
- localField: 'uid',
|
|
|
- foreignField: 'uid',
|
|
|
- as: 'company',
|
|
|
- },
|
|
|
- },
|
|
|
- { $lookup:
|
|
|
- {
|
|
|
- from: 'institution',
|
|
|
- localField: 'jg_id',
|
|
|
- foreignField: '_id',
|
|
|
- as: 'institution',
|
|
|
- },
|
|
|
- },
|
|
|
- { $lookup:
|
|
|
- {
|
|
|
- from: 't_finance_claims',
|
|
|
- localField: 'cid',
|
|
|
- foreignField: '_id',
|
|
|
- as: 'finance_claims',
|
|
|
- },
|
|
|
- },
|
|
|
- { $lookup:
|
|
|
- {
|
|
|
- from: 'dictionary',
|
|
|
- localField: 'ensure_id',
|
|
|
- foreignField: 'code',
|
|
|
- as: 'dictionary',
|
|
|
- },
|
|
|
- },
|
|
|
- // { $lookup:
|
|
|
- // {
|
|
|
- // from: 'dictionary',
|
|
|
- // localField: 'when',
|
|
|
- // foreignField: 'code',
|
|
|
- // as: 'when',
|
|
|
- // },
|
|
|
- // },
|
|
|
- { $lookup:
|
|
|
- {
|
|
|
- from: 'intelligent_follow',
|
|
|
- localField: 'xqId',
|
|
|
- foreignField: 'intelligentId',
|
|
|
- as: 'follow',
|
|
|
- },
|
|
|
- },
|
|
|
- { $unwind: '$company' },
|
|
|
- { $unwind: '$institution' },
|
|
|
- { $unwind: '$finance_claims' },
|
|
|
- { $unwind: '$dictionary' },
|
|
|
- { $unwind: { path: '$follow', preserveNullAndEmptyArrays: true } },
|
|
|
- // { $unwind: { path: '$when', preserveNullAndEmptyArrays: true } },
|
|
|
- { $project:
|
|
|
- {
|
|
|
- ensure_id: 1,
|
|
|
- person: 1,
|
|
|
- money: 1,
|
|
|
- claims_min_term: 1,
|
|
|
- claims_max_term: 1,
|
|
|
- mongey_min_rate: 1,
|
|
|
- mongey_max_rate: 1,
|
|
|
- when: 1,
|
|
|
- refuse_times: 1,
|
|
|
- additional_information: 1,
|
|
|
- status: 1,
|
|
|
- creditStatus: '$follow.creditStatus',
|
|
|
- jg_id: { $toObjectId: '$jg_id' },
|
|
|
- cid: { $toObjectId: '$cid' },
|
|
|
- uid: '$uid',
|
|
|
- xqId: { $toString: '$_id' },
|
|
|
- time: '$meta.createdAt',
|
|
|
- company: '$company',
|
|
|
- institution: '$institution',
|
|
|
- finance_claims: '$finance_claims',
|
|
|
- dictionary: '$dictionary',
|
|
|
- follow: '$follow',
|
|
|
- },
|
|
|
- },
|
|
|
- { $skip: (skip - 1) * limit },
|
|
|
- { $limit: limit },
|
|
|
- { $sort: { time: -1 } },
|
|
|
- ]);
|
|
|
- return { result, total: total.length };
|
|
|
- }
|
|
|
-
|
|
|
// 拒绝接口
|
|
|
async refuse(data) {
|
|
|
const { intelligentId, guanzhuid, userid, reason } = data;// intelligentId, userid, reason 需求id,银行id,拒绝理由
|