Browse Source

开发知识库相关接口

shilin 3 years ago
parent
commit
15ff194038

+ 4 - 3
src/main/java/com/gyee/frame/controller/recommen/RecommenController.java

@@ -5,6 +5,7 @@ import com.gyee.frame.common.conf.AjaxStatus;
 import com.gyee.frame.common.domain.AjaxResult;
 import com.gyee.frame.model.auto.Recommenmain;
 import com.gyee.frame.model.auto.Wobugeq;
+import com.gyee.frame.model.custom.ElementNode;
 import com.gyee.frame.model.custom.MainTrackVo;
 import com.gyee.frame.model.custom.Tablepar;
 import com.gyee.frame.model.custom.WoBugEqVo;
@@ -440,15 +441,15 @@ public class RecommenController {
 
     public AjaxResult findLocationTreeByWtId(String wtId) throws Exception {
 
-        String result="";
+        List<ElementNode> vos=new ArrayList<>();
 
         if(StringUtils.notEmp(wtId))
         {
 
-            result=recommenService.findLocationTreeByWtId(wtId);
+            vos=recommenService.findLocationTreeByWtId(wtId);
         }
 
-        return AjaxResult.successData(AjaxStatus.success.code, result);
+        return AjaxResult.successData(AjaxStatus.success.code, vos);
 
     }
 

+ 3 - 84
src/main/java/com/gyee/frame/model/custom/ElementNode.java

@@ -1,25 +1,16 @@
 package com.gyee.frame.model.custom;
 
+import java.io.Serializable;
 import java.util.List;
 
-public class ElementNode {
-	
+public class ElementNode implements Serializable {
+	private static final long serialVersionUID = 1L;
 	private String id;
-	private Integer state;
 	private String pid;
-	private String icon;
-	private String iconClose;
-	private String iconOpen;
 	private String label;
-	private Boolean open;
 	private Boolean isParent;
-	private Boolean collapse;
-	private String title;
-	private Boolean click;
-	private String url;
 	private List<ElementNode> children;
 
-
 	public String getId() {
 		return id;
 	}
@@ -28,14 +19,6 @@ public class ElementNode {
 		this.id = id;
 	}
 
-	public Integer getState() {
-		return state;
-	}
-
-	public void setState(Integer state) {
-		this.state = state;
-	}
-
 	public String getPid() {
 		return pid;
 	}
@@ -44,30 +27,6 @@ public class ElementNode {
 		this.pid = pid;
 	}
 
-	public String getIcon() {
-		return icon;
-	}
-
-	public void setIcon(String icon) {
-		this.icon = icon;
-	}
-
-	public String getIconClose() {
-		return iconClose;
-	}
-
-	public void setIconClose(String iconClose) {
-		this.iconClose = iconClose;
-	}
-
-	public String getIconOpen() {
-		return iconOpen;
-	}
-
-	public void setIconOpen(String iconOpen) {
-		this.iconOpen = iconOpen;
-	}
-
 	public String getLabel() {
 		return label;
 	}
@@ -76,14 +35,6 @@ public class ElementNode {
 		this.label = label;
 	}
 
-	public Boolean getOpen() {
-		return open;
-	}
-
-	public void setOpen(Boolean open) {
-		this.open = open;
-	}
-
 	public Boolean getParent() {
 		return isParent;
 	}
@@ -92,38 +43,6 @@ public class ElementNode {
 		isParent = parent;
 	}
 
-	public Boolean getCollapse() {
-		return collapse;
-	}
-
-	public void setCollapse(Boolean collapse) {
-		this.collapse = collapse;
-	}
-
-	public String getTitle() {
-		return title;
-	}
-
-	public void setTitle(String title) {
-		this.title = title;
-	}
-
-	public Boolean getClick() {
-		return click;
-	}
-
-	public void setClick(Boolean click) {
-		this.click = click;
-	}
-
-	public String getUrl() {
-		return url;
-	}
-
-	public void setUrl(String url) {
-		this.url = url;
-	}
-
 	public List<ElementNode> getChildren() {
 		return children;
 	}

+ 5 - 5
src/main/java/com/gyee/frame/service/recommen/RecommenService.java

@@ -584,9 +584,9 @@ public class RecommenService {
 	 * 获取部件结构树
 	 * @return
 	 */
-	public String findLocationTreeByWtId(String wtId) {
+	public List<ElementNode> findLocationTreeByWtId(String wtId) {
 
-		String result="";
+		List<ElementNode> vos=new ArrayList<>();
 		if (StringUtils.notEmp(wtId) ) {
 
 			MismapSql mis=mismapSqlService.findMismapSqlById(wtId);
@@ -605,17 +605,17 @@ public class RecommenService {
 						node.setId(eq.getLocation());
 						node.setPid(eq.getParent());
 						node.setLabel(eq.getDescription());
-						node.setOpen(true);
+					//	node.setOpen(true);
 						nodes.add(node);
 					}
 
 					TreeUtil treeUtil=new TreeUtil(nodes);
-					result=treeUtil.buildJSONTree();
+					vos=treeUtil.buildJSONTree();
 				}
 			}
 		}
 
-		return result;
+		return vos;
 	}
 
 

+ 3 - 4
src/main/java/com/gyee/frame/util/TreeUtil.java

@@ -1,6 +1,5 @@
 package com.gyee.frame.util;
 
-import com.alibaba.fastjson.JSON;
 import com.gyee.frame.model.custom.ElementNode;
 
 import java.util.ArrayList;
@@ -29,15 +28,15 @@ public class TreeUtil {
 	 * @return
 	 */
 
-	public String buildJSONTree() {
+	public List<ElementNode> buildJSONTree() {
 
 		List<ElementNode> nodeTree = buildTree();
 		
 		//nodeTree.get(0).setIcon(ROOT);
 
-		String json = JSON.toJSONString(nodeTree);
+		//String json = JSON.toJSONString(nodeTree);
 
-		return json;
+		return nodeTree;
 
 	}
 

+ 9 - 12
src/test/java/test/LeaderboardTest.java

@@ -1,17 +1,14 @@
 package test;
 
 import com.gyee.SpringbootStart;
-import com.gyee.frame.common.domain.AjaxResult;
 import com.gyee.frame.common.spring.SpringUtils;
 import com.gyee.frame.controller.leaderboard.LeaderboardController;
-import com.gyee.frame.model.auto.Curvefittingmonthmain;
 import com.gyee.frame.model.custom.Tablepar;
 import lombok.SneakyThrows;
 import org.springframework.boot.SpringApplication;
 
 import java.util.Calendar;
 import java.util.Date;
-import java.util.List;
 
 public class LeaderboardTest {
 
@@ -123,15 +120,15 @@ public class LeaderboardTest {
 //            System.out.println(wtd.getDeviationrate1()+"----------------"+wtd.getDeviationrate2()+"----------------"+wtd.getDeviationrate3());
 //        }
 
-                AjaxResult ajaxResult2 =leaderboardController.curveMonthchatAjax("sjzy",  "MG01_01",  "2021", "1");
-
-
-        List<Curvefittingmonthmain> list=(List<Curvefittingmonthmain>)ajaxResult2.get("data");
-
-        for(Curvefittingmonthmain wtd:list)
-        {
-            System.out.println(wtd.getDeviationrate1()+"----------------"+wtd.getDeviationrate2()+"----------------"+wtd.getDeviationrate3());
-        }
+//                AjaxResult ajaxResult2 =leaderboardController.curveMonthchatAjax("sjzy",  "MG01_01",  "2021", "1");
+//
+//
+//        List<Curvefittingmonthmain> list=(List<Curvefittingmonthmain>)ajaxResult2.get("data");
+//
+//        for(Curvefittingmonthmain wtd:list)
+//        {
+//            System.out.println(wtd.getDeviationrate1()+"----------------"+wtd.getDeviationrate2()+"----------------"+wtd.getDeviationrate3());
+//        }
 
     }
 

+ 21 - 25
src/test/java/test/RecommenTest.java

@@ -1,18 +1,15 @@
 package test;
 
-import com.github.pagehelper.PageInfo;
 import com.gyee.SpringbootStart;
 import com.gyee.frame.common.domain.AjaxResult;
 import com.gyee.frame.common.spring.SpringUtils;
 import com.gyee.frame.controller.recommen.RecommenController;
 import com.gyee.frame.model.custom.Tablepar;
-import com.gyee.frame.model.custom.WoBugEqVo;
 import lombok.SneakyThrows;
 import org.springframework.boot.SpringApplication;
 
 import java.util.Calendar;
 import java.util.Date;
-import java.util.List;
 
 public class RecommenTest {
 
@@ -28,16 +25,15 @@ public class RecommenTest {
         c.set(Calendar.MINUTE, 0);
         c.set(Calendar.SECOND, 0);
 
-        c.set(Calendar.DAY_OF_MONTH,1);
-        c.set(Calendar.MONTH,0);
-        c.set(Calendar.YEAR,2021);
+        c.set(Calendar.DAY_OF_MONTH, 1);
+        c.set(Calendar.MONTH, 0);
+        c.set(Calendar.YEAR, 2021);
 
         Date beginDate = c.getTime();
 
-        String wpid="MHS_FDC";
-
-        RecommenController recommenController= SpringUtils.getBean("recommenController");
+        String wpid = "MHS_FDC";
 
+        RecommenController recommenController = SpringUtils.getBean("recommenController");
 
 
 //        AjaxResult ajaxResult = recommenController.getRecommenmainDay1();
@@ -145,11 +141,11 @@ public class RecommenTest {
 //        }
 //        System.out.println("**********************************************************************************");
 //
-//        AjaxResult ajaxResult = recommenController.findLocationTreeByWtId("MG01_01");
-//
-//        String test=(String)ajaxResult.get("data");
-//
-//        System.out.println(test);
+        AjaxResult ajaxResult = recommenController.findLocationTreeByWtId("MG01_01");
+
+        String test = (String) ajaxResult.get("data");
+
+        System.out.println(test);
 //
 //        System.out.println("**********************************************************************************");
         Tablepar tablepar = new Tablepar();
@@ -164,19 +160,19 @@ public class RecommenTest {
 ////            System.out.println(wtd.getBugnum()+"----------------"+wtd.getArrivaltime()+"----------------"+wtd.getProdtdeptopinion());
 ////        }
 ////        System.out.println("**********************************************************************************");
+//
+//        AjaxResult ajaxResult2 = recommenController.unfinishedList(null,null,"2016-08-22","2020-08-22");
+//
+//        PageInfo<WoBugEqVo> value=(PageInfo<WoBugEqVo>)ajaxResult2.get("data");
+//        List<WoBugEqVo> test2=value.getList();
+//        for(WoBugEqVo wtd:test2)
+//        {
+//            System.out.println(wtd.getOperationdate()+"----------------"+wtd.getRepairedcomment()+"----------------"+wtd.getWfname());
+//        }
+//        System.out.println("**********************************************************************************");
+//    }
 
-        AjaxResult ajaxResult2 = recommenController.unfinishedList(null,null,"2016-08-22","2020-08-22");
-
-        PageInfo<WoBugEqVo> value=(PageInfo<WoBugEqVo>)ajaxResult2.get("data");
-        List<WoBugEqVo> test2=value.getList();
-        for(WoBugEqVo wtd:test2)
-        {
-            System.out.println(wtd.getOperationdate()+"----------------"+wtd.getRepairedcomment()+"----------------"+wtd.getWfname());
-        }
-        System.out.println("**********************************************************************************");
     }
 
 
-
-
 }