Browse Source

专利申请

guhongwei 3 years ago
parent
commit
3c3b0a4609
3 changed files with 85 additions and 82 deletions
  1. 22 16
      app/controller/patent/.patentapply.js
  2. 14 13
      app/model/patent/patentapply.js
  3. 49 53
      app/service/patent/patentapply.js

+ 22 - 16
app/controller/patent/.patentapply.js

@@ -2,11 +2,13 @@ module.exports = {
   create: {
     requestBody: [
       "user_id",
+      "user_name",
+      "mech_id",
+      "mech_name",
       "admin_id",
-      "is_mech",
-      "mechanism_id",
-      "mechanism_name",
-      "water_number",
+      "admin_name",
+      "agentmech_id",
+      "agentmech_name",
       "create_number",
       "name",
       "apply_name",
@@ -29,11 +31,13 @@ module.exports = {
     params: ["!id"],
     requestBody: [
       "user_id",
+      "user_name",
+      "mech_id",
+      "mech_name",
       "admin_id",
-      "is_mech",
-      "mechanism_id",
-      "mechanism_name",
-      "water_number",
+      "admin_name",
+      "agentmech_id",
+      "agentmech_name",
       "create_number",
       "name",
       "apply_name",
@@ -58,14 +62,16 @@ module.exports = {
     parameters: {
       query: {
         user_id: "user_id",
+        user_name: "%user_name%",
+        mech_id: "mech_id",
+        mechanism_name: "%mech_name%",
         admin_id: "admin_id",
-        is_mech: "is_mech",
-        mechanism_id: "mechanism_id",
-        mechanism_name: "mechanism_name",
-        water_number: "water_number",
-        create_number: "create_number",
-        name: "name",
-        apply_name: "apply_name",
+        admin_name: "%admin_name%",
+        agentmech_id: "agentmech_id",
+        agentmech_name: "%agentmech_name%",
+        create_number: "%create_number%",
+        name: "%apply_name%",
+        apply_name: "%apply_name%",
         type: "type",
         status: "status",
         "create_time@start": "create_time@start",
@@ -84,6 +90,6 @@ module.exports = {
     },
   },
   check: {
-    requestBody: ["id", "status", "remark", "water_number"],
+    requestBody: ["id", "status", "remark"],
   },
 };

+ 14 - 13
app/model/patent/patentapply.js

@@ -6,37 +6,38 @@ const { ObjectId } = require('mongoose').Types;
 // 专利申请-审批单
 const patentapply = {
   user_id: { type: ObjectId }, // 用户id
+  user_name: { type: String }, // 用户姓名
+  mech_id: { type: ObjectId }, // 机构id
+  mech_name: { type: String }, // 机构名称
   admin_id: { type: ObjectId }, // 管理员id
-  is_mech: { type: String }, // 是否需要机构
-  mechanism_id: { type: ObjectId }, // 机构id
-  mechanism_name: { type: String }, // 机构名称
-  water_number: { type: String }, // 流水号
+  admin_name: { type: String }, // 管理员姓名
+  agentmech_id: { type: ObjectId }, // 代理机构id
+  agentmech_name: { type: String }, // 代理机构姓名
   create_number: { type: String }, // 申请号
   name: { type: String }, // 发明名称
   apply_name: { type: String }, // 申请人
   type: { type: String }, // 申请类型
   inventor: { type: Array }, // 发明人
-  contact: { type: Array }, // 联系人
-  phone: { type: String }, // 联系电话
-  email: { type: String }, // 联系人邮箱
+  contact: { type: Array }, // 技术联系人
+  phone: { type: String }, // 联系电话
+  email: { type: String }, // 电子邮箱
   questions: { type: Object }, // 问题
   check_url: { type: Array }, // 审查文件
-  agent_url: { type: Array }, // 专利代理上报文件
+  agent_url: { type: Array }, // 申请文件
   record: { type: Array }, // 记录
-  status: { type: String, default: '0' }, // 状态
+  status: { type: String, default: '0' }, // 状态0:待审查,1:审查通过,-1:审查未通过,2:科企&&代理机构,3:代理机构选择科企,-3:自己走,4:科企上传并下发
   remark: { type: String },
 };
 const schema = new Schema(patentapply, { toJSON: { virtuals: true } });
 schema.index({ id: 1 });
 schema.index({ user_id: 1 });
+schema.index({ mech_id: 1 });
 schema.index({ admin_id: 1 });
-schema.index({ is_mech: 1 });
-schema.index({ mechanism_id: 1 });
-schema.index({ mechanism_name: 1 });
-schema.index({ water_number: 1 });
+schema.index({ agentmech_id: 1 });
 schema.index({ create_number: 1 });
 schema.index({ name: 1 });
 schema.index({ apply_name: 1 });
+schema.index({ type: 1 });
 schema.index({ status: 1 });
 schema.index({ 'meta.createdAt': 1 });
 schema.plugin(metaPlugin);

+ 49 - 53
app/service/patent/patentapply.js

@@ -24,8 +24,8 @@ class PatentapplyService extends CrudService {
    * @property status 交底书要改变成的状态
    * @property info 其他数据,当做多个备注,记录使用
    */
-  async check({ id, status, remark, water_number }) {
-    const data = { status, water_number };
+  async check({ id, status, remark }) {
+    const data = { status };
     await this.model.updateOne({ _id: ObjectId(id) }, data);
     // 换成对应的状态码,record在下面
     return await this.record({ id, method: status, remark });
@@ -40,28 +40,37 @@ class PatentapplyService extends CrudService {
         word = '修改';
         break;
       case '1':
-        word = '机构审核通过';
+        word = '企业/学校审批通过';
         break;
       case '-1':
-        word = '机构审核未通过';
+        word = '企业/学校审批通过';
         break;
       case '2':
-        word = '管理员审核通过';
-        break;
-      case '-2':
-        word = '管理员审核未通过';
+        word = '科企代理';
         break;
       case '3':
-        word = '申请文件待形式审查';
-        break;
-      case '-3':
-        word = '形式审查未通过';
+        word = '代理机构代理';
         break;
       case '4':
-        word = '待上传国知局';
+        word = '代理机构受理通过';
+        break;
+      case '-4':
+        word = '代理机构受理拒绝';
         break;
       case '5':
-        word = '已上传国知局';
+        word = '科企代理';
+        break;
+      case '-5':
+        word = '代理机构自行代理';
+        break;
+      case '6':
+        word = '接收申请文件通过';
+        break;
+      case '-6':
+        word = '接收申请文件未通过';
+        break;
+      case '7':
+        word = '已上报国知局';
         break;
       default:
         word = '未知状态';
@@ -87,28 +96,21 @@ class PatentapplyService extends CrudService {
   async toNotice(id, code) {
     const data = await this.model.findById(id);
     if (!data) return;
-    const { user_id, admin_id, mechanism_id, status, name, apply_name } = data;
+    const { user_id, mech_id, admin_id, agentmech_id, name, apply_name, status } = data;
     const arr = [];
     let content = '';
     let to = '';
     switch (code) {
       case 'create':
-        content = `${apply_name}提交了专利申请书【${name}】的申报,及时前往申请管理进行处理`;
+        content = `${apply_name}提交了专利申请书【${name}】的申报,及时前往专利申请管理进行处理`;
         if (status === '0') {
-          to = mechanism_id;
-        } else if (status === '1') {
-          to = admin_id;
+          to = mech_id;
         }
         break;
       case 'update':
-        content = `${apply_name}重新提交了专利申请书【${name}】的申报,请及时前往申请管理进行处理`;
+        content = `${apply_name}重新提交了专利申请书【${name}】的申报,请及时前往专利申请管理进行处理`;
         if (status === '0') {
-          to = mechanism_id;
-        } else if (status === '1') {
-          to = admin_id;
-        } else if (status === '3') {
-          content = `${apply_name}提交了专利申请书【${name}】的申请文件,请及时前往申请管理进行处理`;
-          to = admin_id;
+          to = mech_id;
         }
         break;
       case '-1':
@@ -116,35 +118,29 @@ class PatentapplyService extends CrudService {
         to = user_id;
         break;
       case '1':
-        arr.push({
-          content: `您的专利申请书【${name}】已通过机构的审核,请您耐心等待管理员进行受理`,
-          to: user_id,
-        });
-        arr.push({
-          content: `${apply_name}的专利申请书【${name}】已通过机构的审核,请您尽快对其进行受理`,
-          to: admin_id,
-        });
-        break;
-      case '-2':
-        content = `您的专利申请书【${name}】未通过管理员的受理,请您及时修改,重新提交申请`;
-        to = user_id;
-        break;
-      case '2':
-        content = `您的专利申请书【${name}】已通过管理员的受理,请及时准备申请文件,并上传`;
-        to = user_id;
-        break;
-      case '-3':
-        content = `您的专利申请书【${name}】未通过管理员的形式审查,请您及时修改,重新提交申请`;
-        to = user_id;
-        break;
-      case '4':
-        content = `您的专利申请书【${name}】已通过管理员的受理,待系统管理员上报国知局`;
-        to = user_id;
-        break;
-      case '5':
-        content = `您的专利申请书【${name}】已通过管理员上传到国知局`;
+        content = `您的专利申请书【${name}】通过机构的审批,请您及时选择机构,并上传申请文件进行专利CPC系统申报`;
         to = user_id;
         break;
+      // case '-2':
+      //   content = `您的专利申请书【${name}】未通过管理员的受理,请您及时修改,重新提交申请`;
+      //   to = user_id;
+      //   break;
+      // case '2':
+      //   content = `您的专利申请书【${name}】已通过管理员的受理,请及时准备申请文件,并上传`;
+      //   to = user_id;
+      //   break;
+      // case '-3':
+      //   content = `您的专利申请书【${name}】未通过管理员的形式审查,请您及时修改,重新提交申请`;
+      //   to = user_id;
+      //   break;
+      // case '4':
+      //   content = `您的专利申请书【${name}】已通过管理员的受理,待系统管理员上报国知局`;
+      //   to = user_id;
+      //   break;
+      // case '5':
+      //   content = `您的专利申请书【${name}】已通过管理员上传到国知局`;
+      //   to = user_id;
+      //   break;
       default:
         break;
     }