|
@@ -35,11 +35,13 @@ public class PantentQueueService {
|
|
private Queue<UploadParamsVO> queue = new LinkedList<>();
|
|
private Queue<UploadParamsVO> queue = new LinkedList<>();
|
|
private List<Integer> taskQueueList = new ArrayList<>();
|
|
private List<Integer> taskQueueList = new ArrayList<>();
|
|
private Boolean flag = false;
|
|
private Boolean flag = false;
|
|
- private CountDownLatch patentLatch = new CountDownLatch(10);
|
|
|
|
- private CountDownLatch taskLatch = new CountDownLatch(10);
|
|
|
|
|
|
+ private CountDownLatch patentLatch = new CountDownLatch(1);
|
|
|
|
+ private CountDownLatch taskLatch = new CountDownLatch(1);
|
|
//将专利信息存入队列
|
|
//将专利信息存入队列
|
|
public void addPatnetToQueue() {
|
|
public void addPatnetToQueue() {
|
|
try {
|
|
try {
|
|
|
|
+
|
|
|
|
+ while (true){
|
|
//检查任务队列
|
|
//检查任务队列
|
|
if (taskQueueList.size() == 0) {
|
|
if (taskQueueList.size() == 0) {
|
|
taskLatch.await();
|
|
taskLatch.await();
|
|
@@ -63,7 +65,7 @@ public class PantentQueueService {
|
|
//检查文件合法性
|
|
//检查文件合法性
|
|
Integer totalRow = ReadExcelUtils.textExcel(filePath);
|
|
Integer totalRow = ReadExcelUtils.textExcel(filePath);
|
|
//调用解析数据类,根据数据来源id(如1:智慧芽)解析数据源配置文件信息
|
|
//调用解析数据类,根据数据来源id(如1:智慧芽)解析数据源配置文件信息
|
|
- List<UploadSettingVO.Column> jsonData = excuteUploadSettingService.ExcuteUploadSetting(1+"");
|
|
|
|
|
|
+ List<UploadSettingVO.Column> jsonData = excuteUploadSettingService.ExcuteUploadSetting(1 + "");
|
|
//遍历专利总数量,在循环中保存专利
|
|
//遍历专利总数量,在循环中保存专利
|
|
for (int i = 1; i <= totalRow; i++) {
|
|
for (int i = 1; i <= totalRow; i++) {
|
|
//解析读取一行专利
|
|
//解析读取一行专利
|
|
@@ -81,6 +83,7 @@ public class PantentQueueService {
|
|
//全部循环结束后,发送进度
|
|
//全部循环结束后,发送进度
|
|
Long percentage = 100L;
|
|
Long percentage = 100L;
|
|
messageService.sendWebsocketMessage(task, totalRow, totalRow, percentage);
|
|
messageService.sendWebsocketMessage(task, totalRow, totalRow, percentage);
|
|
|
|
+ }
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
} finally {
|
|
} finally {
|
|
@@ -111,7 +114,7 @@ public class PantentQueueService {
|
|
this.taskQueueList.addAll(taskQueueList);
|
|
this.taskQueueList.addAll(taskQueueList);
|
|
}
|
|
}
|
|
public void awakeTasktch(){
|
|
public void awakeTasktch(){
|
|
- taskLatch.countDown();
|
|
|
|
|
|
+ this.taskLatch.countDown();
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|