Browse Source

REPORT-44390 alpha-fine搜索帮助文档,右侧不展示详细内容,只显示文档名称

【问题原因】之前的搜索接口有变化,导致返回结果里表示文档详情的key值也变化了(summary → content),然后修改过程中发现"本地常用"也不会显示文档详情,因为保存到本地的时候转json的key值错了
【改动思路】将key修改为现在使用的"content",然后为了让读和写的key保持一致,统一用DocumentModel中的字符串常量表示
feature/big-screen
Yvan 4 years ago
parent
commit
9717e6af3b
  1. 7
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/DocumentModel.java
  2. 8
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/DocumentSearchManager.java

7
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/DocumentModel.java

@ -19,6 +19,11 @@ public class DocumentModel extends AlphaCellModel {
private String informationUrl; private String informationUrl;
private int documentId; private int documentId;
public static final String TITLE = "title";
public static final String CONTENT = "content";
public static final String DID = "did";
public static final String SEARCHCOUNT = "searchcount";
public DocumentModel(String name, String content, int documentId) { public DocumentModel(String name, String content, int documentId) {
super(name, content, CellType.DOCUMENT); super(name, content, CellType.DOCUMENT);
this.documentId = documentId; this.documentId = documentId;
@ -43,7 +48,7 @@ public class DocumentModel extends AlphaCellModel {
public JSONObject modelToJson() { public JSONObject modelToJson() {
JSONObject object = JSONObject.create(); JSONObject object = JSONObject.create();
JSONObject modelObject = JSONObject.create(); JSONObject modelObject = JSONObject.create();
modelObject.put("title", getName()).put("summary", getContent()).put("did", getDocumentId()).put("searchCount", getSearchCount()); modelObject.put(TITLE, getName()).put(CONTENT, getContent()).put(DID, getDocumentId()).put(SEARCHCOUNT, getSearchCount());
object.put("result", modelObject).put("cellType", getType().getTypeValue()); object.put("result", modelObject).put("cellType", getType().getTypeValue());
return object; return object;
} }

8
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/DocumentSearchManager.java

@ -43,10 +43,10 @@ public class DocumentSearchManager implements AlphaFineSearchProvider {
* @return * @return
*/ */
public static DocumentModel getModelFromCloud(JSONObject object) { public static DocumentModel getModelFromCloud(JSONObject object) {
String name = object.optString("title"); String name = object.optString(DocumentModel.TITLE);
String content = object.optString("summary"); String content = object.optString(DocumentModel.CONTENT);
int documentId = object.optInt("did"); int documentId = object.optInt(DocumentModel.DID);
int searchCount = object.optInt("searchCount"); int searchCount = object.optInt(DocumentModel.SEARCHCOUNT);
return new DocumentModel(name, content, documentId, searchCount); return new DocumentModel(name, content, documentId, searchCount);
} }

Loading…
Cancel
Save