Browse Source

bug fix 代码质量

master
XiaXiang 7 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 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 CLOUD_TEST_URL = "http://localhost:8080/cloud/monitor/record_of_afsearch/single";
public static final String SEARCHAPI = "http://lcloud.fanruan.com/api/intelligence/search/recommend?searchKey=";
//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.
*/
public class MoreModel extends AlphaCellModel {
private String name;
private boolean needMore;
private String content;
private CellType type;
private boolean isLoading;
public MoreModel(String name, String content, boolean needMore, CellType type) {
this.name = name;
super(name, content, type);
this.needMore = needMore;
this.content = content;
this.type = type;
}
public MoreModel(String name, CellType type) {
this.name = name;
super(name, null, type);
this.needMore = false;
this.type = type;
}
public MoreModel(String name) {
this.name = name;
this.isLoading = true;
}
public MoreModel(String name, boolean isLoading) {
this.name = name;
super(name, null);
this.isLoading = isLoading;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public boolean isNeedMore() {
return needMore;
}
@ -53,14 +34,6 @@ public class MoreModel extends AlphaCellModel {
this.needMore = needMore;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
@Override
public JSONObject ModelToJson() throws JSONException {
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() {
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() {
searchResultList = new AlphaFineList();
//searchResultList.setFixedCellHeight(AlphaFineConstants.CELL_HEIGHT);
searchResultList.setFixedCellHeight(AlphaFineConstants.CELL_HEIGHT);
searchListModel = new SearchListModel(new SearchResult());
searchResultList.setModel(searchListModel);
searchResultPane = new JPanel();
@ -686,7 +686,7 @@ public class AlphaFineDialog extends UIDialog {
String date = new SimpleDateFormat("yyyy-MM-dd").format(Calendar.getInstance().getTime());
para.put("token", CodeUtils.md5Encode(date, "", "MD5"));
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.asGet();
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;
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.CellType;
import com.fr.design.mainframe.alphafine.cell.CellModelHelper;
@ -24,8 +25,6 @@ import java.util.List;
* Created by XiaXiang on 2017/3/31.
*/
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 SearchResult modelList;
private List<AlphaCellModel> recommendModelList = new ArrayList<>();
@ -43,7 +42,7 @@ public class RecommendSearchManager implements AlphaFineSearchProcessor {
this.recommendModelList = new ArrayList<>();
if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainRecommend()) {
String result;
HttpClient httpClient = new HttpClient(SEARCHAPI + CodeUtils.cjkEncode(searchText));
HttpClient httpClient = new HttpClient(AlphaFineConstants.SEARCHAPI + CodeUtils.cjkEncode(searchText));
httpClient.asGet();
httpClient.setTimeout(5000);
if (!httpClient.isServerAlive()) {

Loading…
Cancel
Save