|
@@ -238,6 +238,7 @@ export class PatentService extends BaseService<modelType> {
|
|
|
}
|
|
|
// 导出
|
|
|
async export(query) {
|
|
|
+ if (this.redisService.get('file')) await this.redisService.del('file');
|
|
|
const termList: any = await this.adminAxios.get(
|
|
|
'dictData?type=patent_term'
|
|
|
);
|
|
@@ -340,7 +341,7 @@ export class PatentService extends BaseService<modelType> {
|
|
|
i + parseInt(query.end_num || total)
|
|
|
}).xlsx`;
|
|
|
const filePath = `${path}${sep}${filename}`;
|
|
|
- console.log(filePath);
|
|
|
+ // console.log(filePath);
|
|
|
await workbook.xlsx.writeFile(filePath);
|
|
|
try {
|
|
|
let progress = _.ceil((skip / total) * 100);
|
|
@@ -391,7 +392,6 @@ export class PatentService extends BaseService<modelType> {
|
|
|
uri: downloadPath,
|
|
|
remark: '打包成功',
|
|
|
};
|
|
|
- this.redisService.set('file', data.uri);
|
|
|
this.sendToMQ(data);
|
|
|
} catch (error) {
|
|
|
const data = {
|
|
@@ -469,7 +469,10 @@ export class PatentService extends BaseService<modelType> {
|
|
|
) {
|
|
|
data.progress = 100;
|
|
|
}
|
|
|
- console.log(`${_.get(data, 'progress') || '失败'} %`);
|
|
|
+ this.redisService.set('uri', data.uri || '');
|
|
|
+ this.redisService.set('remark', data.remark);
|
|
|
+ this.redisService.set('progress', data.progress);
|
|
|
+ // console.log(`${_.get(data, 'progress') || '失败'} %`);
|
|
|
await this.rabbitmqService.connect();
|
|
|
await this.rabbitmqService.sendToQueue('tasks', data);
|
|
|
await this.rabbitmqService.close();
|
|
@@ -568,7 +571,7 @@ export class PatentService extends BaseService<modelType> {
|
|
|
// 每天晚上11点执行一次检查并创建预警信息
|
|
|
@TaskLocal('0 0 23 * *')
|
|
|
async createWarnning() {
|
|
|
- console.log('定时任务');
|
|
|
+ // console.log('定时任务');
|
|
|
let data = await this.model.find({ term: '1' });
|
|
|
if (data.length > 0) data = JSON.parse(JSON.stringify(data));
|
|
|
await this.dealData(data);
|