Browse Source

除掉空格

ruifeng_liu 3 years ago
parent
commit
6d68281c4c
1 changed files with 3 additions and 1 deletions
  1. 3 1
      app/service/patent/patentinfo.js

+ 3 - 1
app/service/patent/patentinfo.js

@@ -210,13 +210,15 @@ class PatentinfoService extends CrudService {
       const midList = inventor.split(/[,;/]/);
       nameList = [ ...nameList, ...midList ];
     }
+    nameList = nameList.map(i => _.trim(i));
     const l1 = await this.personalModel.find({ name: nameList });
     const l2 = await this.organizationModel.find({ name: nameList });
     // 查出来的所有人,添加到user_id中
     const nList = [ ...l1, ...l2 ];
     for (const i of arr) {
       const { inventor } = i;
-      const midNameList = inventor.split(/[,;/]/);
+      let midNameList = inventor.split(/[,;/]/);
+      midNameList = midNameList.map(i => _.trim(i));
       if (!_.isArray(i.user_id)) i.user_id = [];
       for (const name of midNameList) {
         const rList = nList.filter(f => f.name === name);