ruifeng_liu 3 years ago
parent
commit
4fcb971e8a
1 changed files with 7 additions and 1 deletions
  1. 7 1
      app/service/patent/patentwarning.js

+ 7 - 1
app/service/patent/patentwarning.js

@@ -66,7 +66,12 @@ class PatentwarningService extends CrudService {
     if (!result) result = await this.getPatentFromApply(create_number);
     // 找不到就算了,弹回去了
     if (!result) throw new BusinessError(ErrorCode.DATA_NOT_EXIST, '未通过申请号找到指定专利');
-    const warningData = await this.getWarningData(result);
+    let warningData;
+    try {
+      warningData = await this.getWarningData(result);
+    } catch (error) {
+      throw new BusinessError(ErrorCode.SERVICE_FAULT, '组织专利信息警告数据失败');
+    }
     const tifPaths = filePaths.filter(f => f.includes('.tif'));
     if (tifPaths && tifPaths.length > 0) this.toUploadTif(warningData, tifPaths);
     await this.dirDelete(`${uncompressFilePath}${fileName}`);
@@ -152,6 +157,7 @@ class PatentwarningService extends CrudService {
     // 找人的信息
     let userIds = _.get(patent, 'user_id', _.get(patent, 'inventer'));
     if (!userIds) throw new BusinessError(ErrorCode.DATA_NOT_EXIST, '未找到专利的发明人');
+    if (!_.isArray(userIds)) userIds = [ userIds ];
     userIds = userIds.map(i => ObjectId(i));
     const users = await this.personalModel.find({ _id: userIds });
     const arr = [];