Browse Source

bug fix 代码质量

master
XiaXiang 8 years ago
parent
commit
908d71ad7e
  1. 9
      designer/src/com/fr/design/mainframe/alphafine/AlphaFineConstants.java
  2. 41
      designer/src/com/fr/design/mainframe/alphafine/cell/model/MoreModel.java
  3. 4
      designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java
  4. 5
      designer/src/com/fr/design/mainframe/alphafine/search/manager/RecommendSearchManager.java

9
designer/src/com/fr/design/mainframe/alphafine/AlphaFineConstants.java

@ -81,9 +81,12 @@ public class AlphaFineConstants {
public static final String PLUGIN_IMAGE_URL = "http://shopres.finereport.com/"; public static final String PLUGIN_IMAGE_URL = "http://shopres.finereport.com/";
public static final String SERVER_URL = "http://cloud.fanruan.com/api/monitor/record_of_afsearch/single"; public static final String CLOUD_SERVER_URL = "http://cloud.fanruan.com/api/monitor/record_of_afsearch/single";
//TODO:先用本地服务器测试一下,避免影响云中心正常信息收集 public static final String SEARCHAPI = "http://lcloud.fanruan.com/api/intelligence/search/recommend?searchKey=";
public static final String CLOUD_TEST_URL = "http://localhost:8080/cloud/monitor/record_of_afsearch/single";
//private static final String SEARCHAPI = "http://localhost:8080/cloud/intelligence/search/recommend?searchKey=";
//public static final String CLOUD_TEST_URL = "http://localhost:8080/cloud/monitor/record_of_afsearch/single";
} }

41
designer/src/com/fr/design/mainframe/alphafine/cell/model/MoreModel.java

@ -8,43 +8,24 @@ import com.fr.json.JSONObject;
* Created by XiaXiang on 2017/4/20. * Created by XiaXiang on 2017/4/20.
*/ */
public class MoreModel extends AlphaCellModel { public class MoreModel extends AlphaCellModel {
private String name;
private boolean needMore; private boolean needMore;
private String content;
private CellType type;
private boolean isLoading; private boolean isLoading;
public MoreModel(String name, String content, boolean needMore, CellType type) { public MoreModel(String name, String content, boolean needMore, CellType type) {
this.name = name; super(name, content, type);
this.needMore = needMore; this.needMore = needMore;
this.content = content;
this.type = type;
} }
public MoreModel(String name, CellType type) { public MoreModel(String name, CellType type) {
this.name = name; super(name, null, type);
this.needMore = false; this.needMore = false;
this.type = type;
}
public MoreModel(String name) {
this.name = name;
this.isLoading = true;
} }
public MoreModel(String name, boolean isLoading) { public MoreModel(String name, boolean isLoading) {
this.name = name; super(name, null);
this.isLoading = isLoading; this.isLoading = isLoading;
} }
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public boolean isNeedMore() { public boolean isNeedMore() {
return needMore; return needMore;
} }
@ -53,14 +34,6 @@ public class MoreModel extends AlphaCellModel {
this.needMore = needMore; this.needMore = needMore;
} }
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
@Override @Override
public JSONObject ModelToJson() throws JSONException { public JSONObject ModelToJson() throws JSONException {
return null; return null;
@ -76,14 +49,6 @@ public class MoreModel extends AlphaCellModel {
} }
public CellType getType() {
return type;
}
public void setType(CellType type) {
this.type = type;
}
public boolean isLoading() { public boolean isLoading() {
return isLoading; return isLoading;
} }

4
designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java

@ -257,7 +257,7 @@ public class AlphaFineDialog extends UIDialog {
*/ */
private void initSearchResultComponents() { private void initSearchResultComponents() {
searchResultList = new AlphaFineList(); searchResultList = new AlphaFineList();
//searchResultList.setFixedCellHeight(AlphaFineConstants.CELL_HEIGHT); searchResultList.setFixedCellHeight(AlphaFineConstants.CELL_HEIGHT);
searchListModel = new SearchListModel(new SearchResult()); searchListModel = new SearchListModel(new SearchResult());
searchResultList.setModel(searchListModel); searchResultList.setModel(searchListModel);
searchResultPane = new JPanel(); searchResultPane = new JPanel();
@ -686,7 +686,7 @@ public class AlphaFineDialog extends UIDialog {
String date = new SimpleDateFormat("yyyy-MM-dd").format(Calendar.getInstance().getTime()); String date = new SimpleDateFormat("yyyy-MM-dd").format(Calendar.getInstance().getTime());
para.put("token", CodeUtils.md5Encode(date, "", "MD5")); para.put("token", CodeUtils.md5Encode(date, "", "MD5"));
para.put("content", object.toString()); para.put("content", object.toString());
HttpClient httpClient = new HttpClient(AlphaFineConstants.CLOUD_TEST_URL, para, true); HttpClient httpClient = new HttpClient(AlphaFineConstants.CLOUD_SERVER_URL, para, true);
httpClient.setTimeout(5000); httpClient.setTimeout(5000);
httpClient.asGet(); httpClient.asGet();
if (!httpClient.isServerAlive()) { if (!httpClient.isServerAlive()) {

5
designer/src/com/fr/design/mainframe/alphafine/search/manager/RecommendSearchManager.java

@ -1,6 +1,7 @@
package com.fr.design.mainframe.alphafine.search.manager; package com.fr.design.mainframe.alphafine.search.manager;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.mainframe.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.AlphaFineHelper; import com.fr.design.mainframe.alphafine.AlphaFineHelper;
import com.fr.design.mainframe.alphafine.CellType; import com.fr.design.mainframe.alphafine.CellType;
import com.fr.design.mainframe.alphafine.cell.CellModelHelper; import com.fr.design.mainframe.alphafine.cell.CellModelHelper;
@ -24,8 +25,6 @@ import java.util.List;
* Created by XiaXiang on 2017/3/31. * Created by XiaXiang on 2017/3/31.
*/ */
public class RecommendSearchManager implements AlphaFineSearchProcessor { public class RecommendSearchManager implements AlphaFineSearchProcessor {
//todo:for test
private static final String SEARCHAPI = "http://localhost:8080/cloud/intelligence/search/recommend?searchKey=";
private static RecommendSearchManager recommendSearchManager = null; private static RecommendSearchManager recommendSearchManager = null;
private SearchResult modelList; private SearchResult modelList;
private List<AlphaCellModel> recommendModelList = new ArrayList<>(); private List<AlphaCellModel> recommendModelList = new ArrayList<>();
@ -43,7 +42,7 @@ public class RecommendSearchManager implements AlphaFineSearchProcessor {
this.recommendModelList = new ArrayList<>(); this.recommendModelList = new ArrayList<>();
if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainRecommend()) { if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainRecommend()) {
String result; String result;
HttpClient httpClient = new HttpClient(SEARCHAPI + CodeUtils.cjkEncode(searchText)); HttpClient httpClient = new HttpClient(AlphaFineConstants.SEARCHAPI + CodeUtils.cjkEncode(searchText));
httpClient.asGet(); httpClient.asGet();
httpClient.setTimeout(5000); httpClient.setTimeout(5000);
if (!httpClient.isServerAlive()) { if (!httpClient.isServerAlive()) {

Loading…
Cancel
Save