|
@@ -55,7 +55,23 @@ class PatentwarningService extends CrudService {
|
|
|
errorList.push({ key: patentNumber, word: '未找到文件' });
|
|
|
continue;
|
|
|
}
|
|
|
- const xmlPath = filePaths.find(f => f.includes('.xml'));
|
|
|
+ // 2021-10-16 修改: 取出第一层的xml文件,即:路径最短的;除文件名外,字符串长度最小的
|
|
|
+ let xmlPaths = filePaths.filter(f => f.includes('.xml'));
|
|
|
+ if (xmlPaths.length > 0) {
|
|
|
+ // 去掉文件名
|
|
|
+ xmlPaths = xmlPaths.map(i => {
|
|
|
+ let arr = i.split(sep);
|
|
|
+ arr = arr.pop();
|
|
|
+ return arr.join(sep);
|
|
|
+ });
|
|
|
+ // 按路径字符串长度排序
|
|
|
+ xmlPaths = xmlPaths.sort((a, b) => {
|
|
|
+ const anum = a.length;
|
|
|
+ const bnum = b.length;
|
|
|
+ return anum - bnum;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ const xmlPath = _.head(xmlPaths);
|
|
|
if (!xmlPath) {
|
|
|
errorList.push({ key: patentNumber, word: '未找到xml文件' });
|
|
|
continue;
|
|
@@ -112,7 +128,7 @@ class PatentwarningService extends CrudService {
|
|
|
try {
|
|
|
await this.patentApply.updateOne({ _id: patent._id }, patent);
|
|
|
} catch (error) {
|
|
|
- errorList.push({ key: patentNumber, word: 'xml申请号同步至专利申请号失败' });
|
|
|
+ // errorList.push({ key: patentNumber, word: 'xml申请号同步至专利申请号失败' });
|
|
|
continue;
|
|
|
}
|
|
|
}
|