ruifeng_liu há 3 anos atrás
pai
commit
1742e0f064

+ 85 - 0
app/controller/patent/.patent_info.js

@@ -0,0 +1,85 @@
+module.exports = {
+  create: {
+    requestBody: [
+      "create_number",
+      "create_date",
+      "success_number",
+      "success_date",
+      "name",
+      "inventor",
+      "address",
+      "apply_personal",
+      "term",
+      "type",
+      "agent_personal",
+      "agent",
+      "abstract",
+      "img_url",
+      "origin",
+      "status",
+      "trans_status",
+    ],
+  },
+  destroy: {
+    params: ["!id"],
+    service: "delete",
+  },
+  update: {
+    params: ["!id"],
+    requestBody: [
+      "create_number",
+      "create_date",
+      "success_number",
+      "success_date",
+      "name",
+      "inventor",
+      "address",
+      "apply_personal",
+      "term",
+      "type",
+      "agent_personal",
+      "agent",
+      "abstract",
+      "img_url",
+      "origin",
+      "status",
+      "trans_status",
+    ],
+  },
+  show: {
+    parameters: {
+      params: ["!id"],
+    },
+    service: "fetch",
+  },
+  index: {
+    parameters: {
+      query: {
+        create_number: "create_number",
+        create_date: "create_date",
+        create_number: "create_number",
+        success_date: "success_date",
+        name: "%name%",
+        inventor: "%inventor%",
+        address: "address",
+        apply_personal: "%apply_personal%",
+        term: "term",
+        type: "type",
+        agent_personal: "agent_personal",
+        agent: "agent",
+        origin: "%origin%",
+        code: "code",
+        status: "status",
+        trans_status: "trans_status",
+      },
+    },
+    service: "query",
+    options: {
+      query: ["skip", "limit"],
+      sort: ["meta.createdAt"],
+      desc: true,
+      count: true,
+    },
+  },
+  
+};

+ 73 - 0
app/controller/patent/.patent_trans.js

@@ -0,0 +1,73 @@
+module.exports = {
+  create: {
+    requestBody: [
+      "user_id",
+      "patent_id",
+      "patent_name",
+      "contact",
+      "phone",
+      "email",
+      "budget",
+      "type",
+      "requirementdesc",
+      "expect",
+      "present",
+      "condition",
+      "status",
+    ],
+  },
+  destroy: {
+    params: ["!id"],
+    service: "delete",
+  },
+  update: {
+    params: ["!id"],
+    requestBody: [
+      "user_id",
+      "patent_id",
+      "patent_name",
+      "contact",
+      "phone",
+      "email",
+      "budget",
+      "type",
+      "requirementdesc",
+      "expect",
+      "present",
+      "condition",
+      "status",
+    ],
+  },
+  show: {
+    parameters: {
+      params: ["!id"],
+    },
+    service: "fetch",
+  },
+  index: {
+    parameters: {
+      query: {
+        patent_id: "patent_id",
+        patent_name: "patent_name",
+        contact: "contact",
+        phone: "phone",
+        email: "email",
+        budget: "budget",
+        type: "type",
+        status: "status",
+        "create_time@start": "create_time@start",
+        "create_time@end": "create_time@end",
+      },
+      // options: {
+      //   "meta.state": 0 // 默认条件
+      // },
+    },
+    service: "query",
+    options: {
+      query: ["skip", "limit"],
+      sort: ["meta.createdAt"],
+      desc: true,
+      count: true,
+    },
+  },
+};

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

@@ -0,0 +1,13 @@
+'use strict';
+const meta = require('./.patent_info.js');
+const Controller = require('egg').Controller;
+const { CrudController } = require('naf-framework-mongoose/lib/controller');
+
+// 专利信息
+class PatentinfoController extends Controller {
+  constructor(ctx) {
+    super(ctx);
+    this.service = this.ctx.service.patent.patentInfo;
+  }
+}
+module.exports = CrudController(PatentinfoController, meta);

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

@@ -0,0 +1,13 @@
+'use strict';
+const meta = require('./.patent_trans.js');
+const Controller = require('egg').Controller;
+const { CrudController } = require('naf-framework-mongoose/lib/controller');
+
+// 专利信息
+class Patent_transController extends Controller {
+  constructor(ctx) {
+    super(ctx);
+    this.service = this.ctx.service.patent.patentTrans;
+  }
+}
+module.exports = CrudController(Patent_transController, meta);

+ 42 - 0
app/model/patent/patent_info.js

@@ -0,0 +1,42 @@
+'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 patentinfo = {
+  create_number: { type: String, required: false }, // 申请号
+  create_date: { type: String, required: false }, // 申请日
+  success_number: { type: String, required: false }, // 公开(公告)号
+  success_date: { type: String, required: false }, //  公开(公告)日
+  name: { type: String, required: false }, // 标题
+  inventor: { type: String, required: false }, // 发明人
+  address: { type: String, required: false }, // 发明人地址
+  apply_personal: { type: String, required: false }, // 申请人
+  term: { type: String, required: false }, // 专利有效性
+  type: { type: String, required: false }, // 专利类型
+  agent_personal: { type: String, required: false }, // 代理人
+  agent: { type: String, required: false }, // 代理机构
+  abstract: { type: String, required: false }, // 摘要
+  img_url: { type: String, required: false }, // 图片
+  origin: { type: String }, // 数据来源(手写的)
+  user_id: { type: [ ObjectId ] },
+  status: { type: String, required: false }, // 状态
+  trans_status: { type: String, required: false }, // 交易状态
+};
+const schema = new Schema(patentinfo, { toJSON: { virtuals: true } });
+schema.index({ id: 1 });
+schema.index({ create_number: 1 });
+schema.index({ name: 1 });
+schema.index({ inventor: 1 });
+schema.index({ apply_personal: 1 });
+schema.index({ term: 1 });
+schema.index({ type: 1 });
+schema.index({ status: 1 });
+schema.index({ trans_status: 1 });
+schema.index({ 'meta.createdAt': 1 });
+schema.plugin(metaPlugin);
+module.exports = app => {
+  const { mongoose } = app;
+  return mongoose.model('Patent_info', schema, 'patent_info');
+};

+ 37 - 0
app/model/patent/patent_trans.js

@@ -0,0 +1,37 @@
+'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 patent_trans = {
+  user_id: { type: ObjectId },
+  patent_id: { type: ObjectId }, // 专利id
+  patent_name: { type: String }, // 专利名
+  contact: { type: String }, // 联系人
+  phone: { type: String }, // 联系电话
+  email: { type: String }, // 电子邮箱
+  budget: { type: String }, // 投资预算
+  type: { type: String }, // 交易类型(转让,合作,招商,质押)
+  requirementdesc: { type: String }, // 技术说明
+  expect: { type: String }, // 预期目标
+  present: { type: String }, // 需求现状
+  condition: { type: String }, // 合作条件及要求
+  status: { type: String }, // 状态 0:未交易 1:已交易
+};
+const schema = new Schema(patent_trans, { toJSON: { virtuals: true } });
+schema.index({ id: 1 });
+schema.index({ patent_id: 1 });
+schema.index({ patent_name: 1 });
+schema.index({ contact: 1 });
+schema.index({ phone: 1 });
+schema.index({ email: 1 });
+schema.index({ budget: 1 });
+schema.index({ type: 1 });
+schema.index({ status: 1 });
+schema.index({ 'meta.createdAt': 1 });
+schema.plugin(metaPlugin);
+module.exports = app => {
+  const { mongoose } = app;
+  return mongoose.model('Patent_trans', schema, 'patent_trans');
+};

+ 2 - 0
app/router.js

@@ -84,4 +84,6 @@ module.exports = app => {
   require('./router/patent/patentapply')(app); // 专利申请表-审批单
   require('./router/patent/patentanalysis')(app); // 专利分析表-交底单
   require('./router/patent/patentassess')(app); // 专利评估表
+  require('./router/patent/patent_info')(app); // 专利信息表
+  require('./router/patent/patent_trans')(app); // 专利交易表
 };

+ 13 - 0
app/router/patent/patent_info.js

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

+ 13 - 0
app/router/patent/patent_trans.js

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

+ 15 - 0
app/service/patent/patent_info.js

@@ -0,0 +1,15 @@
+'use strict';
+const { CrudService } = require('naf-framework-mongoose/lib/service');
+const { BusinessError, ErrorCode } = require('naf-core').Error;
+const _ = require('lodash');
+const assert = require('assert');
+
+// 专利信息
+class PatentinfoService extends CrudService {
+  constructor(ctx) {
+    super(ctx, 'patentinfo');
+    this.model = this.ctx.model.Patent.PatentInfo;
+  }
+}
+
+module.exports = PatentinfoService;

+ 15 - 0
app/service/patent/patent_trans.js

@@ -0,0 +1,15 @@
+'use strict';
+const { CrudService } = require('naf-framework-mongoose/lib/service');
+const { BusinessError, ErrorCode } = require('naf-core').Error;
+const _ = require('lodash');
+const assert = require('assert');
+
+// 专利信息
+class Patent_transService extends CrudService {
+  constructor(ctx) {
+    super(ctx, 'patent_trans');
+    this.model = this.ctx.model.Patent.PatentTrans;
+  }
+}
+
+module.exports = Patent_transService;