浏览代码

Merge branch 'master' of http://git.cc-lotus.info/financial_platform/service-financial

wq 5 年之前
父节点
当前提交
70f7ed6bdc

+ 22 - 19
app/controller/.companyidentify.js

@@ -11,6 +11,7 @@ module.exports = {
       '!establish_date',
       '!valid_period',
       '!person',
+      '!opening_bank',
       'status',
       // '!code',
       // 'business_license',
@@ -22,12 +23,12 @@ module.exports = {
       // 'taking',
       // 'number',
       // 'belong_type',
-      // 'profession_one',
-      // 'profession_two',
-      // 'profession_three',
-      // 'profession_four',
-      // 'belong_addr_city',
-      // 'belong_addr_area',
+      'profession_one',
+      'profession_two',
+      'profession_three',
+      'profession_four',
+      'belong_addr_city',
+      'belong_addr_area',
       // 'business_addr',
       // 'registered_addr',
       // 'business_scope',
@@ -57,6 +58,7 @@ module.exports = {
       'establish_date',
       'valid_period',
       'person',
+      'opening_bank',
       'status',
       // 'uid',
       // 'business_license',
@@ -70,12 +72,12 @@ module.exports = {
       // 'taking',
       // 'number',
       // 'belong_type',
-      // 'profession_one',
-      // 'profession_two',
-      // 'profession_three',
-      // 'profession_four',
-      // 'belong_addr_city',
-      // 'belong_addr_area',
+      'profession_one',
+      'profession_two',
+      'profession_three',
+      'profession_four',
+      'belong_addr_city',
+      'belong_addr_area',
       // 'business_addr',
       // 'registered_addr',
       // 'business_scope',
@@ -107,7 +109,8 @@ module.exports = {
         establish_date:'establish_date',
         valid_period:'valid_period',
         person:'person',
-        status:'status'
+        opening_bank:'opening_bank',
+        status:'status',
         // business_license:'business_license',
         // company_name:'%company_name%',
         // establish_date :'establish_date',
@@ -119,12 +122,12 @@ module.exports = {
         // taking:'taking',
         // number:'number',
         // belong_type :'belong_type',
-        // profession_one:'profession_one',
-        // profession_two :'profession_two',
-        // profession_three :'profession_three',
-        // profession_four :'profession_four',
-        // belong_addr_city :'belong_addr_city',
-        // belong_addr_area :'belong_addr_area',
+        profession_one:'profession_one',
+        profession_two :'profession_two',
+        profession_three :'profession_three',
+        profession_four :'profession_four',
+        belong_addr_city :'belong_addr_city',
+        belong_addr_area :'belong_addr_area',
         // business_addr :'business_addr',
         // registered_addr :'registered_addr',
         // business_scope :'business_scope',

+ 4 - 1
app/controller/.companyuser.js

@@ -3,7 +3,8 @@ module.exports = {
     requestBody: [
       '!phone',
       '!passwd',
-      '!company_name',
+      'company_name',
+      '!person',
       'institution_name',
       'roles'
     ]
@@ -18,6 +19,7 @@ module.exports = {
       'phone',
       'passwd',
       'company_name',
+      'person',
       'institution_name',
       'roles'
     ]
@@ -34,6 +36,7 @@ module.exports = {
         phone:'phone',
         passwd :'passwd',
         company_name :'%company_name%',
+        person :'%person%',
         institution_name:'institution_name',
         roles: 'roles'
       }

+ 17 - 17
app/controller/.intelligentDocking.js

@@ -2,21 +2,21 @@ module.exports = {
   create: {
     requestBody: [
       '!uid',
-      '!company_name',
-      '!code',
-      '!person',
+      'company_name',
+      'code',
+      'person',
       'phone',
-      '!opening_bank',
-      '!orientation',
-      '!money',
-      '!claims_min_term',
-      '!claims_max_term',
-      '!mongey_min_rate',
-      '!mongey_max_rate',
-      '!ensure_id',
+      'opening_bank',
+      'orientation',
+      'money',
+      'claims_min_term',
+      'claims_max_term',
+      'mongey_min_rate',
+      'mongey_max_rate',
+      'ensure_id',
       'ensure_name',
-      '!when',
-      '!additional_information',
+      'when',
+      'additional_information',
       'create_time',
       'cid',
       'jg_id',
@@ -33,8 +33,8 @@ module.exports = {
     params: ['!id'],
     requestBody: [
       'uid',
-      'company_name',
-      'code',
+      // 'company_name',
+      // 'code',
       'person',
       'phone',
       'opening_bank',
@@ -66,8 +66,8 @@ module.exports = {
     parameters: {
       query: {
         uid:'uid',
-        company_name:'%company_name%',
-        code:'code',
+        // company_name:'%company_name%',
+        // code:'code',
         person:'person',
         phone:'phone',
         opening_bank:'opening_bank',

+ 8 - 7
app/model/companyidentify.js

@@ -15,7 +15,8 @@ const CompanyidentifySchema = {
   establish_date: { type: String, required: true, maxLength: 200 }, // 成立日期             必填
   valid_period: { type: String, required: true, maxLength: 200 }, //    公司营业期限终止日期      "长期"表示为"29991231"
   person: { type: String, required: true, maxLength: 200 }, //      法定代表人      必填
-  status: { type: String, required: false, maxLength: 200, default: '0' }, // 认证状态,0-认证中,1-认证通过,2-认证失败
+  opening_bank: { type: String, required: true, maxLength: 200 }, //      开户行      必填
+  status: { type: String, required: false, maxLength: 200, default: '1' }, // 认证状态,0-认证中,1-认证通过,2-认证失败  改为默认认证通过
 
   // business_license: { type: String, required: false, maxLength: 200 }, // 营业执照图片
   // establish_date: { type: String, required: false, maxLength: 200 }, // 成立日期
@@ -26,12 +27,12 @@ const CompanyidentifySchema = {
   // taking: { type: String, required: false, maxLength: 200 }, // 营业收入
   // number: { type: String, required: false, maxLength: 200 }, // 从业人员数量
   // belong_type: { type: String, required: false, maxLength: 200 }, // 企业所属类型
-  // profession_one: { type: String, required: false, maxLength: 200 }, // 所属一级行业
-  // profession_two: { type: String, required: false, maxLength: 200 }, // 所属二级行业
-  // profession_three: { type: String, required: false, maxLength: 200 }, // 所属三级行业
-  // profession_four: { type: String, required: false, maxLength: 200 }, // 所属四级行业
-  // belong_addr_city: { type: String, required: false, maxLength: 200 }, // 企业所属地-市
-  // belong_addr_area: { type: String, required: false, maxLength: 200 }, // 企业所属地-区
+  profession_one: { type: String, required: false, maxLength: 200 }, // 所属一级行业
+  profession_two: { type: String, required: false, maxLength: 200 }, // 所属二级行业
+  profession_three: { type: String, required: false, maxLength: 200 }, // 所属三级行业
+  profession_four: { type: String, required: false, maxLength: 200 }, // 所属四级行业
+  belong_addr_city: { type: String, required: false, maxLength: 200 }, // 企业所属地-市
+  belong_addr_area: { type: String, required: false, maxLength: 200 }, // 企业所属地-区
   // business_addr: { type: String, required: false, maxLength: 200 }, // 经营地址
   // registered_addr: { type: String, required: false, maxLength: 200 }, // 注册地址
   // business_scope: { type: String, required: false, maxLength: 200 }, // 经营范围

+ 2 - 1
app/model/companyuser.js

@@ -7,7 +7,8 @@ const { Secret } = require('naf-framework-mongoose/lib/model/schema');
 const CompanyuserSchema = {
   phone: { type: String, required: true, maxLength: 100 }, // 手机
   passwd: { type: { Secret }, select: false }, // 注册密码
-  company_name: { type: String, required: true, maxLength: 200 }, // 企业名称
+  company_name: { type: String, required: false, maxLength: 200 }, // 企业名称
+  person: { type: String, required: true, maxLength: 200 }, // 联系人姓名
   institution_name: { type: String, required: false, maxLength: 200 }, // 推荐单位名称
   roles: { type: String, required: false, maxLength: 200, default: '0' }, // 企业用户权限,0-注册(只可浏览),1-认证(可申请),2-上传财务信息(皆可)
 };

+ 12 - 12
app/model/intelligentDocking.js

@@ -11,21 +11,21 @@ const info = new Schema({
 const IntelligentDockingSchema = {
   uid: { type: String, required: true, maxLength: 200 }, // 企业用户id
   // 对接需求
-  company_name: { type: String, required: true, maxLength: 200 }, // 企业名称
-  code: { type: String, required: true, maxLength: 200 }, // 统一社会信用代码
-  person: { type: String, required: true, maxLength: 200 }, // 联系人
+  company_name: { type: String, required: false, maxLength: 200 }, // 企业名称
+  code: { type: String, required: false, maxLength: 200 }, // 统一社会信用代码
+  person: { type: String, required: false, maxLength: 200 }, // 联系人
   phone: { type: String, required: false, maxLength: 200 }, // 手机号
   opening_bank: { type: String, required: false, maxLength: 200 }, // 首选开户行
-  orientation: { type: [ String ], required: true }, // 融资取向
-  money: { type: String, required: true, maxLength: 200 }, // 融资金额
-  claims_min_term: { type: String, required: true, maxLength: 200 }, // 融资期限(小)
-  claims_max_term: { type: String, required: true, maxLength: 200 }, // 融资期限(大)
-  mongey_min_rate: { type: String, required: true, maxLength: 200 }, // 融资利率(小)
-  mongey_max_rate: { type: String, required: true, maxLength: 200 }, // 融资利率(小)
-  ensure_id: { type: String, required: true, maxLength: 200 }, // 担保方式的code(字典表)
+  orientation: { type: [ String ], required: false }, // 融资取向
+  money: { type: String, required: false, maxLength: 200 }, // 融资金额
+  claims_min_term: { type: String, required: false, maxLength: 200 }, // 融资期限(小)
+  claims_max_term: { type: String, required: false, maxLength: 200 }, // 融资期限(大)
+  mongey_min_rate: { type: String, required: false, maxLength: 200 }, // 融资利率(小)
+  mongey_max_rate: { type: String, required: false, maxLength: 200 }, // 融资利率(小)
+  ensure_id: { type: String, required: false, maxLength: 200 }, // 担保方式的code(字典表)
   ensure_name: { type: String, required: false, maxLength: 200 }, // 担保方式
-  when: { type: String, required: true, maxLength: 200 }, // 预计何时有融资需求  非必填
-  additional_information: { type: String, required: true, maxLength: 200 }, // 补充信息  非必填
+  when: { type: String, required: false, maxLength: 200 }, // 预计何时有融资需求  非必填
+  additional_information: { type: String, required: false, maxLength: 200 }, // 补充信息  非必填
   // 对接结果
   create_time: { type: String, required: false, maxLength: 200 }, // 查询时间
   cid: { type: String, required: false, maxLength: 200 }, // 对接结果-产品

+ 2 - 2
app/service/companyuser.js

@@ -16,8 +16,8 @@ class CompanyuserService extends CrudService {
   }
   // 重写创建方法
   async create(data) {
-    const { phone, passwd, company_name, institution_name, roles } = data;
-    assert(company_name && phone && passwd, '缺少部分信息项');
+    const { phone, passwd, company_name, person, institution_name, roles } = data;
+    assert(person && phone && passwd, '缺少部分信息项');
     assert(/^\d{11}$/i.test(phone), 'phone无效');
     const user = await this.model.findOne({ phone });
     if (user) {

+ 8 - 32
app/service/intelligentDocking.js

@@ -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 } },