|
@@ -89,19 +89,23 @@ public class KnowledgeSharingDetailsService extends CrudService<KnowledgeSharing
|
|
|
//判断文件是否同步至dify
|
|
|
String nameOnly = clientAttachment.getAttachmentName().substring(0, clientAttachment.getAttachmentName().lastIndexOf("."));
|
|
|
JSONObject docItem = DifyApiClient.findKnowledgeBaseById(1, 999, datasetId, nameOnly);
|
|
|
- JSONArray data = docItem.getJSONArray("data");
|
|
|
- List<KnowledgeBaseDoc> knowledgeBaseDocArrayList = JSON.parseArray(data.toString(), KnowledgeBaseDoc.class);
|
|
|
- if (knowledgeBaseDocArrayList != null && !knowledgeBaseDocArrayList.isEmpty()) {
|
|
|
- clientAttachment.setSyncDifySync("1");
|
|
|
- } else {
|
|
|
- clientAttachment.setSyncDifySync("0");
|
|
|
- }
|
|
|
+ if(docItem.isNull("data")){
|
|
|
+
|
|
|
+ }else{
|
|
|
+ JSONArray data = docItem.getJSONArray("data");
|
|
|
+ List<KnowledgeBaseDoc> knowledgeBaseDocArrayList = JSON.parseArray(data.toString(), KnowledgeBaseDoc.class);
|
|
|
+ if (knowledgeBaseDocArrayList != null && !knowledgeBaseDocArrayList.isEmpty()) {
|
|
|
+ clientAttachment.setSyncDifySync("1");
|
|
|
+ } else {
|
|
|
+ clientAttachment.setSyncDifySync("0");
|
|
|
+ }
|
|
|
|
|
|
- if (clientAttachment.getCollectFlag().equals("1")) {
|
|
|
- for (Workattachment workattachment : knowledgeSharingInfo.getWorkAttachments()) {
|
|
|
- if (clientAttachment.getId().equals(workattachment.getId())) {
|
|
|
- workattachment.setCollectFlag("1");
|
|
|
- break;
|
|
|
+ if (clientAttachment.getCollectFlag().equals("1")) {
|
|
|
+ for (Workattachment workattachment : knowledgeSharingInfo.getWorkAttachments()) {
|
|
|
+ if (clientAttachment.getId().equals(workattachment.getId())) {
|
|
|
+ workattachment.setCollectFlag("1");
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -158,7 +162,7 @@ public class KnowledgeSharingDetailsService extends CrudService<KnowledgeSharing
|
|
|
columnName = "案例讨论";
|
|
|
break;
|
|
|
case "10":
|
|
|
- columnName = "项目案例资料";
|
|
|
+ columnName = "材价库";
|
|
|
break;
|
|
|
default:
|
|
|
columnName = "学习园地";
|
|
@@ -177,7 +181,7 @@ public class KnowledgeSharingDetailsService extends CrudService<KnowledgeSharing
|
|
|
* 根据id获取dify的分类id
|
|
|
*/
|
|
|
public String getTypeIdByCaseBase(String columnId) throws Exception {
|
|
|
- String columnName = "项目案例资料";
|
|
|
+ String columnName = "材价库";
|
|
|
KnowledgeBase knowledgeBase = new KnowledgeBase();
|
|
|
knowledgeBase.setName(columnName);
|
|
|
JSONObject jsonObject = DifyApiClient.selectKnowledgeBaseList(1, 999, knowledgeBase);
|