Browse Source

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

ruifeng_liu 3 years ago
parent
commit
9eb95cce21

+ 28 - 0
app/controller/patent/.patentinfo.js

@@ -18,6 +18,20 @@ module.exports = {
       "origin",
       "status",
       "trans_status",
+      "nationality",
+      "ipc_type",
+      "onlegal_status",
+      "legal_status",
+      "law_date",
+      "on_obligee",
+      "apply_address",
+      "apply_other",
+      "law_num",
+      "first_opendate",
+      "empower_date",
+      "lose_date",
+      "examine_date",
+      "invention_design",
     ],
   },
   destroy: {
@@ -44,6 +58,20 @@ module.exports = {
       "origin",
       "status",
       "trans_status",
+      "nationality",
+      "ipc_type",
+      "onlegal_status",
+      "legal_status",
+      "law_date",
+      "on_obligee",
+      "apply_address",
+      "apply_other",
+      "law_num",
+      "first_opendate",
+      "empower_date",
+      "lose_date",
+      "examine_date",
+      "invention_design",
     ],
   },
   show: {

+ 56 - 0
app/controller/patent/.patentwarning.js

@@ -0,0 +1,56 @@
+module.exports = {
+  create: {
+    requestBody: [
+      "to_id",
+      "to_name",
+      "patent_id",
+      "patent_name",
+      "content",
+      "file_url",
+      "is_read",
+    ],
+  },
+  destroy: {
+    params: ["!id"],
+    service: "delete",
+  },
+  update: {
+    params: ["!id"],
+    requestBody: [
+      "to_id",
+      "to_name",
+      "patent_id",
+      "patent_name",
+      "content",
+      "file_url",
+      "is_read",
+    ],
+  },
+  show: {
+    parameters: {
+      params: ["!id"],
+    },
+    service: "fetch",
+  },
+  index: {
+    parameters: {
+      query: {
+        to_id: "to_id",
+        to_name: "to_name",
+        patent_id: "patent_id",
+        patent_name: "patent_name",
+        is_read: "is_read",
+      },
+      // options: {
+      //   "meta.state": 0 // 默认条件
+      // },
+    },
+    service: "query",
+    options: {
+      query: ["skip", "limit"],
+      sort: ["meta.createdAt"],
+      desc: true,
+      count: true,
+    },
+  },
+};

+ 13 - 0
app/controller/patent/patentwarning.js

@@ -0,0 +1,13 @@
+'use strict';
+const meta = require('./.patentwarning.js');
+const Controller = require('egg').Controller;
+const { CrudController } = require('naf-framework-mongoose/lib/controller');
+
+// 专利运营专利申请预警表
+class PatentwarningController extends Controller {
+  constructor(ctx) {
+    super(ctx);
+    this.service = this.ctx.service.patent.patentwarning;
+  }
+}
+module.exports = CrudController(PatentwarningController, meta);

+ 15 - 0
app/model/patent/patentinfo.js

@@ -23,6 +23,21 @@ const patentinfo = {
   user_id: { type: [ ObjectId ] },
   status: { type: String, required: false, default: '0' }, // 状态
   trans_status: { type: String, required: false, default: '0' }, // 交易状态
+  // 数据新增属性2021-09-06
+  nationality: { type: String }, // 公开国别
+  ipc_type: { type: String }, // ipc主分类
+  onlegal_status: { type: String }, // 当前法律状态
+  legal_status: { type: String }, // 法律状态
+  law_date: { type: String }, // 法律文书日期
+  on_obligee: { type: String }, // 当前权利人
+  apply_address: { type: String }, // 申请人地址(其他)
+  apply_other: { type: String }, // 申请人(其他)
+  law_num: { type: String }, // 法律文书编号
+  first_opendate: { type: String }, // 首次公开日
+  empower_date: { type: String }, // 授权公告日
+  lose_date: { type: String }, // 失效日
+  examine_date: { type: String }, // 实际审查失效日
+  invention_design: { type: String }, // 发明人(设计)其他
 };
 const schema = new Schema(patentinfo, { toJSON: { virtuals: true } });
 schema.index({ id: 1 });

+ 29 - 0
app/model/patent/patentwarning.js

@@ -0,0 +1,29 @@
+'use strict';
+const Schema = require('mongoose').Schema;
+const moment = require('moment');
+const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
+const { ObjectId } = require('mongoose').Types;
+// 专利运营专利申请预警表
+const patentwarning = {
+  to_id: { type: ObjectId }, // 接收人id
+  to_name: { type: String }, // 接收人姓名
+  patent_id: { type: ObjectId }, // 预警专利id
+  patent_name: { type: String }, // 预警专利姓名
+  content: { type: String }, // 预警信息
+  file_url: { type: Array }, // 预警文件
+  is_read: { type: Boolean, default: false }, // 是否已读
+  remark: { type: String },
+};
+const schema = new Schema(patentwarning, { toJSON: { virtuals: true } });
+schema.index({ id: 1 });
+schema.index({ to_id: 1 });
+schema.index({ to_name: 1 });
+schema.index({ patent_id: 1 });
+schema.index({ patent_name: 1 });
+schema.index({ is_read: 1 });
+schema.index({ 'meta.createdAt': 1 });
+schema.plugin(metaPlugin);
+module.exports = app => {
+  const { mongoose } = app;
+  return mongoose.model('Patentwarning', schema, 'patent_warning');
+};

+ 1 - 0
app/router.js

@@ -82,6 +82,7 @@ module.exports = app => {
   require('./router/patent/patentexamine')(app); // 审核通知表
   require('./router/patent/patentnotice')(app); // 通知表
   require('./router/patent/patentapply')(app); // 专利申请表-审批单
+  require('./router/patent/patentwarning')(app); // 专利申请预警表
   require('./router/patent/patentanalysis')(app); // 专利分析表-交底单
   require('./router/patent/patentassess')(app); // 专利评估表
   require('./router/patent/patentinfo')(app); // 专利信息表

+ 12 - 0
app/router/patent/patentwarning.js

@@ -0,0 +1,12 @@
+'use strict';
+
+
+module.exports = app => {
+  const { router, controller } = app;
+  const profix = '/api/live/';
+  const vision = 'v0';
+  const index = 'patent';
+  const target = 'patentwarning';
+  router.resources(target, `${profix}${vision}/${index}/${target}`, controller[index][target]); // index、create、show、destroy
+  router.post(target, `${profix}${vision}/${index}/${target}/update/:id`, controller[index][target].update);
+};

+ 66 - 168
app/service/patent/patentinfo.js

@@ -136,7 +136,27 @@ class PatentinfoService extends CrudService {
           apply_personal = row.getCell(12).value || undefined,
           term = row.getCell(13).value || undefined,
           type = row.getCell(14).value || undefined,
-          number = row.getCell(1).value || undefined;
+          number = row.getCell(1).value || undefined,
+          // 新增专利数据属性2021-09-06
+          nationality = row.getCell(16).value || undefined,
+          ipc_type = row.getCell(17).value || undefined,
+          onlegal_status = row.getCell(18).value || undefined,
+          legal_status = row.getCell(19).value || undefined,
+          law_date =
+            moment(row.getCell(20).value).format('YYYY-MM-DD') || undefined,
+          on_obligee = row.getCell(21).value || undefined,
+          apply_address = row.getCell(22).value || undefined,
+          apply_other = row.getCell(23).value || undefined,
+          law_num = row.getCell(24).value || undefined,
+          first_opendate =
+            moment(row.getCell(25).value).format('YYYY-MM-DD') || undefined,
+          empower_date =
+            moment(row.getCell(26).value).format('YYYY-MM-DD') || undefined,
+          lose_date =
+            moment(row.getCell(27).value).format('YYYY-MM-DD') || undefined,
+          examine_date =
+            moment(row.getCell(28).value).format('YYYY-MM-DD') || undefined,
+          invention_design = row.getCell(29).value || undefined;
         const obj = {
           create_number,
           create_date,
@@ -155,7 +175,23 @@ class PatentinfoService extends CrudService {
           number,
           origin,
           user_id: [],
+          // 新增专利数据属性2021-09-06
+          nationality,
+          ipc_type,
+          onlegal_status,
+          legal_status,
+          law_date,
+          on_obligee,
+          apply_address,
+          apply_other,
+          law_num,
+          first_opendate,
+          empower_date,
+          lose_date,
+          examine_date,
+          invention_design,
         };
+
         // 此处添加判断条件,不限制则不需要加,直接放过即可
         const { result, notice } = this.tocheckData(obj);
         if (result) {
@@ -365,173 +401,35 @@ class PatentinfoService extends CrudService {
 
   getHeader() {
     const arr = [
-      {
-        header: '申请号',
-        key: 'create_number',
-        width: 30,
-        style: {
-          alignment: {
-            wrapText: true,
-            vertical: 'middle',
-            horizontal: 'center',
-          },
-        },
-      },
-      {
-        header: '申请日',
-        key: 'create_date',
-        width: 30,
-        style: {
-          alignment: {
-            wrapText: true,
-            vertical: 'middle',
-            horizontal: 'center',
-          },
-        },
-      },
-      {
-        header: '公开(公告)号',
-        key: 'success_number',
-        width: 30,
-        style: {
-          alignment: {
-            wrapText: true,
-            vertical: 'middle',
-            horizontal: 'center',
-          },
-        },
-      },
-      {
-        header: '公开(公告)日',
-        key: 'success_date',
-        width: 30,
-        style: {
-          alignment: {
-            wrapText: true,
-            vertical: 'middle',
-            horizontal: 'center',
-          },
-        },
-      },
-      {
-        header: '发明人',
-        key: 'inventor',
-        width: 30,
-        style: {
-          alignment: {
-            wrapText: true,
-            vertical: 'middle',
-            horizontal: 'center',
-          },
-        },
-      },
-      {
-        header: '代理机构',
-        key: 'agent',
-        width: 30,
-        style: {
-          alignment: {
-            wrapText: true,
-            vertical: 'middle',
-            horizontal: 'center',
-          },
-        },
-      },
-      {
-        header: '代理人',
-        key: 'agent_personal',
-        width: 30,
-        style: {
-          alignment: {
-            wrapText: true,
-            vertical: 'middle',
-            horizontal: 'center',
-          },
-        },
-      },
-      {
-        header: '摘要',
-        key: 'abstract',
-        width: 30,
-        style: {
-          alignment: {
-            wrapText: true,
-            vertical: 'middle',
-            horizontal: 'center',
-          },
-        },
-      },
-      {
-        header: '发明人地址',
-        key: 'address',
-        width: 30,
-        style: {
-          alignment: {
-            wrapText: true,
-            vertical: 'middle',
-            horizontal: 'center',
-          },
-        },
-      },
-      {
-        header: '标题',
-        key: 'name',
-        width: 30,
-        style: {
-          alignment: {
-            wrapText: true,
-            vertical: 'middle',
-            horizontal: 'center',
-          },
-        },
-      },
-      {
-        header: '申请人',
-        key: 'apply_personal',
-        width: 30,
-        style: {
-          alignment: {
-            wrapText: true,
-            vertical: 'middle',
-            horizontal: 'center',
-          },
-        },
-      },
-      {
-        header: '专利有效性',
-        key: 'term',
-        width: 30,
-        style: {
-          alignment: {
-            wrapText: true,
-            vertical: 'middle',
-            horizontal: 'center',
-          },
-        },
-      },
-      {
-        header: '专利类型',
-        key: 'type',
-        width: 30,
-        style: {
-          alignment: {
-            wrapText: true,
-            vertical: 'middle',
-            horizontal: 'center',
-          },
-        },
-      },
-      {
-        header: '首页附图',
-        width: 30,
-        style: {
-          alignment: {
-            wrapText: true,
-            vertical: 'middle',
-            horizontal: 'center',
-          },
-        },
-      },
+      { header: '申请号', key: 'create_number', width: 30, style: { alignment: { wrapText: true, vertical: 'middle', horizontal: 'center' } } },
+      { header: '申请日', key: 'create_date', width: 30, style: { alignment: { wrapText: true, vertical: 'middle', horizontal: 'center' } } },
+      { header: '公开(公告)号', key: 'success_number', width: 30, style: { alignment: { wrapText: true, vertical: 'middle', horizontal: 'center' } } },
+      { header: '公开(公告)日', key: 'success_date', width: 30, style: { alignment: { wrapText: true, vertical: 'middle', horizontal: 'center' } } },
+      { header: '发明人', key: 'inventor', width: 30, style: { alignment: { wrapText: true, vertical: 'middle', horizontal: 'center' } } },
+      { header: '代理机构', key: 'agent', width: 30, style: { alignment: { wrapText: true, vertical: 'middle', horizontal: 'center' } } },
+      { header: '代理人', key: 'agent_personal', width: 30, style: { alignment: { wrapText: true, vertical: 'middle', horizontal: 'center' } } },
+      { header: '摘要', key: 'abstract', width: 30, style: { alignment: { wrapText: true, vertical: 'middle', horizontal: 'center' } } },
+      { header: '发明人地址', key: 'address', width: 30, style: { alignment: { wrapText: true, vertical: 'middle', horizontal: 'center' } } },
+      { header: '标题', key: 'name', width: 30, style: { alignment: { wrapText: true, vertical: 'middle', horizontal: 'center' } } },
+      { header: '申请人', key: 'apply_personal', width: 30, style: { alignment: { wrapText: true, vertical: 'middle', horizontal: 'center' } } },
+      { header: '专利有效性', key: 'term', width: 30, style: { alignment: { wrapText: true, vertical: 'middle', horizontal: 'center' } } },
+      { header: '专利类型', key: 'type', width: 30, style: { alignment: { wrapText: true, vertical: 'middle', horizontal: 'center' } } },
+      { header: '首页附图', width: 30, style: { alignment: { wrapText: true, vertical: 'middle', horizontal: 'center' } } },
+      { header: '公开国别', key: 'nationality', width: 30, style: { alignment: { wrapText: true, vertical: 'middle', horizontal: 'center' } } },
+      { header: 'IPC主分类', key: 'ipc_type', width: 30, style: { alignment: { wrapText: true, vertical: 'middle', horizontal: 'center' } } },
+      { header: '当前法律状态', key: 'onlegal_status', width: 30, style: { alignment: { wrapText: true, vertical: 'middle', horizontal: 'center' } } },
+      { header: '法律状态', key: 'legal_status', width: 30, style: { alignment: { wrapText: true, vertical: 'middle', horizontal: 'center' } } },
+      { header: '法律文书日期', key: 'law_date', width: 30, style: { alignment: { wrapText: true, vertical: 'middle', horizontal: 'center' } } },
+      { header: '当前权利人', key: 'on_obligee', width: 30, style: { alignment: { wrapText: true, vertical: 'middle', horizontal: 'center' } } },
+      { header: '申请人地址(其他)', key: 'apply_address', width: 30, style: { alignment: { wrapText: true, vertical: 'middle', horizontal: 'center' } } },
+      { header: '申请人(其他)', key: 'apply_other', width: 30, style: { alignment: { wrapText: true, vertical: 'middle', horizontal: 'center' } } },
+      { header: '法律文书编号', key: 'law_num', width: 30, style: { alignment: { wrapText: true, vertical: 'middle', horizontal: 'center' } } },
+      { header: '首次公开日', key: 'first_opendate', width: 30, style: { alignment: { wrapText: true, vertical: 'middle', horizontal: 'center' } } },
+      { header: '授权公告日', key: 'empower_date', width: 30, style: { alignment: { wrapText: true, vertical: 'middle', horizontal: 'center' } } },
+      { header: '失效日', key: 'lose_date', width: 30, style: { alignment: { wrapText: true, vertical: 'middle', horizontal: 'center' } } },
+      { header: '实际审查失效日', key: 'examine_date', width: 30, style: { alignment: { wrapText: true, vertical: 'middle', horizontal: 'center' } } },
+      { header: '发明人(设计)其他', key: 'invention_design', width: 30, style: { alignment: { wrapText: true, vertical: 'middle', horizontal: 'center' } } },
+
     ];
     return arr;
   }

+ 18 - 0
app/service/patent/patentwarning.js

@@ -0,0 +1,18 @@
+'use strict';
+const { CrudService } = require('naf-framework-mongoose/lib/service');
+const { BusinessError, ErrorCode } = require('naf-core').Error;
+const { ObjectId } = require('mongoose').Types;
+const _ = require('lodash');
+const assert = require('assert');
+
+
+// 专利运营专利申请预警表
+class PatentwarningService extends CrudService {
+  constructor(ctx) {
+    super(ctx, 'patentwarning');
+    this.model = this.ctx.model.Patent.Patentwarning;
+  }
+}
+
+module.exports = PatentwarningService;
+