|
|
@ -1,5 +1,6 @@ |
|
|
|
package org.jeecg.modules.demo.seknowgroup.controller; |
|
|
|
package org.jeecg.modules.demo.seknowgroup.controller; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Map; |
|
|
@ -12,6 +13,11 @@ import javax.servlet.http.HttpServletResponse; |
|
|
|
import org.jeecg.common.api.vo.Result; |
|
|
|
import org.jeecg.common.api.vo.Result; |
|
|
|
import org.jeecg.common.system.query.QueryGenerator; |
|
|
|
import org.jeecg.common.system.query.QueryGenerator; |
|
|
|
import org.jeecg.common.util.oConvertUtils; |
|
|
|
import org.jeecg.common.util.oConvertUtils; |
|
|
|
|
|
|
|
import org.jeecg.modules.demo.know.entity.SeKonw; |
|
|
|
|
|
|
|
import org.jeecg.modules.demo.know.service.ISeKonwService; |
|
|
|
|
|
|
|
import org.jeecg.modules.demo.seknowgroup.entity.Exports; |
|
|
|
|
|
|
|
import org.jeecg.modules.demo.seknowgroup.entity.NodeList; |
|
|
|
|
|
|
|
import org.jeecg.modules.demo.seknowgroup.entity.NodeName; |
|
|
|
import org.jeecg.modules.demo.seknowgroup.entity.SeKnowGroup; |
|
|
|
import org.jeecg.modules.demo.seknowgroup.entity.SeKnowGroup; |
|
|
|
import org.jeecg.modules.demo.seknowgroup.service.ISeKnowGroupService; |
|
|
|
import org.jeecg.modules.demo.seknowgroup.service.ISeKnowGroupService; |
|
|
|
|
|
|
|
|
|
|
@ -20,6 +26,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import org.jeecg.modules.konwRelationshipMain.entity.SeKonwRelationshipMain; |
|
|
|
import org.jeecgframework.poi.excel.ExcelImportUtil; |
|
|
|
import org.jeecgframework.poi.excel.ExcelImportUtil; |
|
|
|
import org.jeecgframework.poi.excel.def.NormalExcelConstants; |
|
|
|
import org.jeecgframework.poi.excel.def.NormalExcelConstants; |
|
|
|
import org.jeecgframework.poi.excel.entity.ExportParams; |
|
|
|
import org.jeecgframework.poi.excel.entity.ExportParams; |
|
|
@ -50,6 +57,9 @@ public class SeKnowGroupController extends JeecgController<SeKnowGroup, ISeKnowG |
|
|
|
@Autowired |
|
|
|
@Autowired |
|
|
|
private ISeKnowGroupService seKnowGroupService; |
|
|
|
private ISeKnowGroupService seKnowGroupService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
|
|
private ISeKonwService seKonwService; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 分页列表查询 |
|
|
|
* 分页列表查询 |
|
|
|
* |
|
|
|
* |
|
|
@ -168,4 +178,73 @@ public class SeKnowGroupController extends JeecgController<SeKnowGroup, ISeKnowG |
|
|
|
return super.importExcel(request, response, SeKnowGroup.class); |
|
|
|
return super.importExcel(request, response, SeKnowGroup.class); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 开始组装知识图谱 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/zzzztp") |
|
|
|
|
|
|
|
public Result<?> zzzztp(@RequestParam(name="id",required=true) String id) { |
|
|
|
|
|
|
|
//最多显示三层结构
|
|
|
|
|
|
|
|
List<NodeName> nodelist = new ArrayList<>(); |
|
|
|
|
|
|
|
//开始根据id查找中心知识点id
|
|
|
|
|
|
|
|
String pointnode = seKnowGroupService.findpointnode(id); |
|
|
|
|
|
|
|
//开始组装知识点节点
|
|
|
|
|
|
|
|
//获取中心知识点
|
|
|
|
|
|
|
|
SeKonw seknow = seKonwService.getById(pointnode); |
|
|
|
|
|
|
|
//将list的第一个位置设置成中心知识点名称
|
|
|
|
|
|
|
|
NodeName nodes = new NodeName(); |
|
|
|
|
|
|
|
nodes.setName(seknow.getName()); |
|
|
|
|
|
|
|
nodelist.add(nodes); |
|
|
|
|
|
|
|
//开是循环,根据中心知识点id,在知识点关系表中查询以中心知识点为中心查询第二层知识点
|
|
|
|
|
|
|
|
List<String> listid = seKnowGroupService.listid(seknow.getId()); |
|
|
|
|
|
|
|
//开始循环
|
|
|
|
|
|
|
|
for (int i=0;i<listid.size();i++){ |
|
|
|
|
|
|
|
NodeName nodes1 = new NodeName(); |
|
|
|
|
|
|
|
//根据id获取知识点名字,并且进行赋值
|
|
|
|
|
|
|
|
nodes1.setName(seKonwService.getById(listid.get(i)).getName()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
nodelist.add(nodes1); |
|
|
|
|
|
|
|
//开始第二层循环
|
|
|
|
|
|
|
|
List<String> listid2 = seKnowGroupService.listid(listid.get(i)); |
|
|
|
|
|
|
|
for (int j =0;j<listid2.size();j++ ){ |
|
|
|
|
|
|
|
NodeName nodes2 = new NodeName(); |
|
|
|
|
|
|
|
nodes2.setName(seKonwService.getById(listid.get(j)).getName()); |
|
|
|
|
|
|
|
nodelist.add(nodes2); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//现在开始组装知识图谱经管系节点
|
|
|
|
|
|
|
|
List<NodeList> nodelistdss = new ArrayList<>(); |
|
|
|
|
|
|
|
//首先根据中心知识点查询
|
|
|
|
|
|
|
|
List<SeKonwRelationshipMain> segouplisttemp = new ArrayList<>(); |
|
|
|
|
|
|
|
segouplisttemp=seKnowGroupService.getzxzsnodelist(seknow.getId()); |
|
|
|
|
|
|
|
for (int i=0; i< segouplisttemp.size();i++){ |
|
|
|
|
|
|
|
NodeList ndoesl = new NodeList(); |
|
|
|
|
|
|
|
ndoesl.setSource(seKonwService.getById(segouplisttemp.get(i).getPerKowId()).getName()); |
|
|
|
|
|
|
|
ndoesl.setTarget(seKonwService.getById(segouplisttemp.get(i).getNextKnowId()).getName()); |
|
|
|
|
|
|
|
ndoesl.setValue(seKonwService.getrelaint(segouplisttemp.get(i).getRelationId())); |
|
|
|
|
|
|
|
nodelistdss.add(ndoesl); |
|
|
|
|
|
|
|
List<SeKonwRelationshipMain> segouplisttemp2 = new ArrayList<>(); |
|
|
|
|
|
|
|
segouplisttemp2=seKnowGroupService.getzxzsnodelist(segouplisttemp.get(i).getNextKnowId()); |
|
|
|
|
|
|
|
for (int j=0;j<segouplisttemp2.size();j++){ |
|
|
|
|
|
|
|
NodeList ndoesl2 = new NodeList(); |
|
|
|
|
|
|
|
ndoesl2.setSource(seKonwService.getById(segouplisttemp.get(i).getPerKowId()).getName()); |
|
|
|
|
|
|
|
ndoesl2.setTarget(seKonwService.getById(segouplisttemp.get(i).getNextKnowId()).getName()); |
|
|
|
|
|
|
|
ndoesl2.setValue(seKonwService.getrelaint(segouplisttemp.get(i).getRelationId())); |
|
|
|
|
|
|
|
nodelistdss.add(ndoesl2); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Exports exep = new Exports(); |
|
|
|
|
|
|
|
exep.setNodes(nodelist.stream().distinct().collect(Collectors.toList())); |
|
|
|
|
|
|
|
exep.setLinks(nodelistdss); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
System.out.println(exep); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return Result.OK(exep); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|