|
|
@@ -527,9 +527,9 @@ public class SmsbAppointmentInfoServiceImpl implements ISmsbAppointmentInfoServi
|
|
|
result.setDeviceStartInfoList(deviceStartInfoList);
|
|
|
// TODO 异步现场启动 更新知识库
|
|
|
// 线程1 更新评估报告知识库
|
|
|
- syncDatasets(reportContentList, difyScDatasetReportId);
|
|
|
+ syncDatasetsReport(reportContentList, difyScDatasetReportId);
|
|
|
// 线程2 更新有样学样的知识库
|
|
|
- syncDatasets(caseContentList, difyScDatasetCaseId);
|
|
|
+ syncDatasetsCase(caseContentList, difyScDatasetCaseId);
|
|
|
return R.ok(result);
|
|
|
}
|
|
|
|
|
|
@@ -544,10 +544,10 @@ public class SmsbAppointmentInfoServiceImpl implements ISmsbAppointmentInfoServi
|
|
|
return contentList;
|
|
|
}
|
|
|
|
|
|
- private synchronized void syncDatasets(List<String> contentList, String datasetsId) {
|
|
|
+ private synchronized void syncDatasetsReport(List<String> contentList, String datasetsId) {
|
|
|
Runnable transTask = () -> {
|
|
|
try {
|
|
|
- log.info("syncDatasets thread begin contentList.size(): " + contentList.size() + ",datasetsId : " + datasetsId);
|
|
|
+ log.info("syncDatasetsReport thread begin contentList.size(): " + contentList.size() + ",datasetsId : " + datasetsId);
|
|
|
// 组装条目
|
|
|
StringBuilder allContentStr = new StringBuilder();
|
|
|
for (String content : contentList) {
|
|
|
@@ -555,12 +555,34 @@ public class SmsbAppointmentInfoServiceImpl implements ISmsbAppointmentInfoServi
|
|
|
allContentStr.append(content).append("\n");
|
|
|
}
|
|
|
String filePath = createTempFile(allContentStr.toString());
|
|
|
- log.info("syncDatasets thread createTempFile success tempFilePath = " + filePath);
|
|
|
+ log.info("syncDatasetsReport thread createTempFile success tempFilePath = " + filePath);
|
|
|
boolean uploadResult = uploadDatasetsToDify(datasetsId,filePath);
|
|
|
} catch (IOException e) {
|
|
|
throw new RuntimeException(e);
|
|
|
}
|
|
|
- log.info("createReport thread end !");
|
|
|
+ log.info("syncDatasetsReport thread end !");
|
|
|
+ };
|
|
|
+ // 提交Runnable任务到线程池
|
|
|
+ threadPoolTaskExecutor.submit(transTask);
|
|
|
+ }
|
|
|
+
|
|
|
+ private synchronized void syncDatasetsCase(List<String> contentList, String datasetsId) {
|
|
|
+ Runnable transTask = () -> {
|
|
|
+ try {
|
|
|
+ log.info("syncDatasetsCase thread begin contentList.size(): " + contentList.size() + ",datasetsId : " + datasetsId);
|
|
|
+ // 组装条目
|
|
|
+ StringBuilder allContentStr = new StringBuilder();
|
|
|
+ for (String content : contentList) {
|
|
|
+ allContentStr.append("###").append("\n");
|
|
|
+ allContentStr.append(content).append("\n");
|
|
|
+ }
|
|
|
+ String filePath = createTempFile(allContentStr.toString());
|
|
|
+ log.info("syncDatasetsCase thread createTempFile success tempFilePath = " + filePath);
|
|
|
+ boolean uploadResult = uploadDatasetsToDify(datasetsId,filePath);
|
|
|
+ } catch (IOException e) {
|
|
|
+ throw new RuntimeException(e);
|
|
|
+ }
|
|
|
+ log.info("syncDatasetsCase thread end !");
|
|
|
};
|
|
|
// 提交Runnable任务到线程池
|
|
|
threadPoolTaskExecutor.submit(transTask);
|