package com.landtool.lanbase.modules.res.controller;
|
|
import java.net.URLDecoder;
|
import java.util.HashMap;
|
import java.util.LinkedHashMap;
|
import java.util.LinkedList;
|
import java.util.List;
|
import java.util.Map;
|
|
import com.landtool.lanbase.common.utils.HttpUtils;
|
import com.landtool.lanbase.modules.res.service.impl.ResExtMapUrlServiceImpl;
|
import com.qiniu.util.Json;
|
import org.apache.shiro.SecurityUtils;
|
import org.apache.velocity.runtime.resource.util.StringResource;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Controller;
|
import org.springframework.ui.Model;
|
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.serializer.SerializerFeature;
|
import com.github.pagehelper.Page;
|
import com.github.pagehelper.PageHelper;
|
import com.landtool.lanbase.common.annotation.LogAction;
|
import com.landtool.lanbase.common.utils.Result;
|
import com.landtool.lanbase.config.SysTemPropertyConfig;
|
import com.landtool.lanbase.modules.api.utils.PageBean;
|
import com.landtool.lanbase.modules.res.entity.Res_Catalog;
|
import com.landtool.lanbase.modules.res.entity.Res_ExtBaseMap;
|
import com.landtool.lanbase.modules.res.entity.Res_ExtMapUrl;
|
import com.landtool.lanbase.modules.res.entity.Res_MainInfo;
|
import com.landtool.lanbase.modules.res.service.ResExtBaseMapService;
|
import com.landtool.lanbase.modules.res.service.ResExtMapUrlService;
|
import com.landtool.lanbase.modules.res.service.ResMainInfoService;
|
import com.landtool.lanbase.modules.sys.controller.AbstractController;
|
import com.landtool.lanbase.modules.sys.service.SysFieldvalueService;
|
|
/**
|
* @Author: lizhao
|
* @Date: 2018-03-05 13:57
|
* @Description:3系统资源扩展(基础底图)控制器
|
*/
|
@Controller
|
@RequestMapping("/res")
|
public class ResExtBaseMapController extends AbstractController {
|
|
@Autowired
|
private ResExtBaseMapService resExtBaseMapService;
|
|
@Autowired
|
private ResExtMapUrlService resExtMapUrlService;
|
|
@Autowired
|
private SysTemPropertyConfig sysConfig;
|
|
@Autowired
|
private ResMainInfoService resMainInfoService;
|
|
@Autowired
|
private SysFieldvalueService FieldUtils;
|
/**
|
* 访问资源基础底图新增页面
|
*/
|
@RequestMapping("/ResManage/ResRegister/ExtBaseMap")
|
public String ExtBaseMap(Integer resMainInfoId, Model model) {
|
List<Res_ExtMapUrl> resExtMapUrlList = resExtMapUrlService.selectByCondition(resMainInfoId);
|
model.addAttribute("resExtMapUrlList", resExtMapUrlList);
|
|
LinkedHashMap<String, String> typeandurlList = FieldUtils.getFieldListByKey("TypeAndURL");//获取地理参考模型列表
|
|
LinkedHashMap<String, String> layerTypeList = FieldUtils.getFieldListByKey("LayerTypeList");
|
String layerTypeListJson = "";
|
for (Map.Entry<String, String> entry : layerTypeList.entrySet()) {
|
if (layerTypeListJson != "")
|
layerTypeListJson += ",";
|
layerTypeListJson += "{key:'" + entry.getKey() + "',value:'" + entry.getValue() + "'}";
|
}
|
model.addAttribute("layerTypeListJson", "[" + layerTypeListJson + "]");
|
model.addAttribute("layertypeList", layerTypeList);
|
|
model.addAttribute("typeandurlList", typeandurlList);
|
|
String typeandurlListJson = "";
|
for (Map.Entry<String, String> entry : typeandurlList.entrySet()) {
|
if (typeandurlListJson != "")
|
typeandurlListJson += ",";
|
typeandurlListJson += "{key:'" + entry.getKey() + "',value:'" + entry.getValue() + "'}";
|
}
|
model.addAttribute("typeandurlListJson", "[" + typeandurlListJson + "]");
|
|
Res_ExtBaseMap resExtBaseMap = resExtBaseMapService.selectByPrimaryKey(resMainInfoId);
|
if (resExtBaseMap != null) {
|
if (resExtBaseMap.getRefmarkinfid() != null) {
|
Res_MainInfo title = resMainInfoService.selectByPrimaryKey(resExtBaseMap.getRefmarkinfid());
|
if (title != null) {
|
model.addAttribute("refmarkinfname", title.getTitle());
|
}
|
}
|
Res_MainInfo res_mainInfo = resMainInfoService.selectByPrimaryKey(resMainInfoId);
|
model.addAttribute("resMainInfo", res_mainInfo);
|
|
String[] arr = new String[2];
|
arr[0] = "null";
|
arr[1] = "null";
|
if(resExtBaseMap.getDisplaylev() != null) {
|
arr = resExtBaseMap.getDisplaylev().split("-");
|
}
|
model.addAttribute("xianshibiliStart", (arr[0] == null || arr[0].trim().equals("null")) ? "" : arr[0]);
|
model.addAttribute("xianshibiliEnd", (arr[1] == null || arr[1].trim().equals("null")) ? "" : arr[1]);
|
model.addAttribute("resExtBaseMap", resExtBaseMap);
|
model.addAttribute("resMainInfoId", resMainInfoId);
|
} else {
|
Res_ExtBaseMap resExtBaseMap1 = new Res_ExtBaseMap();
|
Res_MainInfo res_mainInfo = new Res_MainInfo();
|
model.addAttribute("resMainInfo", res_mainInfo);
|
model.addAttribute("resExtBaseMap", resExtBaseMap1);
|
model.addAttribute("xianshibiliStart", "");
|
model.addAttribute("xianshibiliEnd", "");
|
}
|
|
LinkedHashMap<String, String> PublishSoftList = FieldUtils.getFieldListByKey("PublishSoft");// 获取发布平台字典列表
|
LinkedHashMap<String, String> BaseMapTypeList = FieldUtils.getFieldListByKey("BaseMapType");// 获取底图类型字典列表
|
LinkedHashMap<String, String> ImageAccuracyList = FieldUtils.getFieldListByKey("ImageAccuracy");// 获取影像精度字典列表
|
model.addAttribute("PublishSoftList", PublishSoftList);
|
model.addAttribute("BaseMapTypeList", BaseMapTypeList);
|
model.addAttribute("ImageAccuracyList", ImageAccuracyList);
|
model.addAttribute("esbHost",sysConfig.getEsbHost());
|
model.addAttribute("esbUrl",sysConfig.getEsbUrl());
|
if(SecurityUtils.getSubject().isPermitted("org_user_admin")) {
|
//判断当前用户是否是管理员,是管理员或是未提交的资源才可以修改资源相关信息
|
model.addAttribute("admin",true);
|
}
|
else {
|
model.addAttribute("admin",false);
|
}
|
String oldesbids = resExtBaseMap != null ? resExtMapUrlService.queryRsbidsByResourceid(resMainInfoId):"";
|
model.addAttribute("oldesbids",oldesbids);
|
model.addAttribute("ipHost",sysConfig.getIpHost());
|
model.addAttribute("gisHost",sysConfig.getGisHost());
|
return "ResManage/ResRegister/ExtBaseMap";
|
}
|
|
/**
|
* 访问关联标注图列表页面
|
*/
|
@RequestMapping("/ResManage/ResRegister/GuanLianBiaoZhuTu")
|
public String GuanLianBiaoZhuTu(Model model, Integer resourceid) {
|
model.addAttribute("resourceid", resourceid);
|
model.addAttribute("pubzyWebRoot", sysConfig.getPubzyWebRoot());
|
return "/ResManage/ResRegister/GuanLianBiaoZhuTu";
|
}
|
|
/**
|
* 查询关联标注图层列表 关联标注图层列表:底图类型为标注的资源且不是它自身的资源
|
*/
|
@ResponseBody
|
@RequestMapping("/resExtBaseMap/selectByBaseMapType")
|
public Result selectByBaseMapType(Res_MainInfo resMainInfo, PageBean pageBean) {
|
PageHelper.startPage(pageBean.getPage(), pageBean.getLimit());
|
List<Res_MainInfo> list = resExtBaseMapService.selectByBaseMapType(resMainInfo);
|
int countNums = (int) ((Page) list).getTotal();
|
PageBean<Res_MainInfo> pageData = new PageBean<>(pageBean.getPage(), pageBean.getLimit(), countNums);
|
pageData.setItems(list);
|
StringBuilder rsb = new StringBuilder();
|
// rsb.append("{'totalCount':'" + countNums);
|
// rsb.append("','topics':[");
|
List<Map<String, Object>> maps = new LinkedList<>();
|
for (Integer i = 0; i < list.size(); i++) {
|
Map<String, Object> map = new HashMap<>();
|
map.put("resourceid", list.get(i).getResourceid());
|
map.put("title", list.get(i).getTitle());
|
maps.add(map);
|
|
// if (i != 0) {
|
// rsb.append(",");
|
// }
|
// rsb.append("{'resourceid':'" + list.get(i).getResourceid() + "'");// 资源id
|
// rsb.append(",'title':'" + list.get(i).getTitle() + "'");// 资源名称
|
// rsb.append("}");
|
}
|
// rsb.append("]}");
|
return Result.ok().put("totalCount", countNums).put("topics", maps);
|
}
|
|
/**
|
* 根据id 删除信息资源列表功能
|
*/
|
@ResponseBody
|
@RequestMapping("/resExtBaseMap/deleteByPrimaryKey")
|
public int deleteByPrimaryKey(int resourceid) {
|
|
return resExtBaseMapService.deleteByPrimaryKey(resourceid);
|
}
|
|
/**
|
* 插入信息资源列表功能(所有元素不能为空)
|
*/
|
@ResponseBody
|
@RequestMapping("/resExtBaseMap/insert")
|
public int insert(Res_ExtBaseMap record) {
|
return resExtBaseMapService.insert(record);
|
}
|
|
/**
|
* 插入信息资源列表功能(可以只填写必填字段)
|
*/
|
@ResponseBody
|
@RequestMapping("/resExtBaseMap/insertSelective")
|
public int insertSelective(Res_ExtBaseMap record) {
|
return resExtBaseMapService.insertSelective(record);
|
}
|
|
/**
|
* 插入信息资源列表功能并且增加更新功能
|
*/
|
@ResponseBody
|
@RequestMapping("/resExtBaseMap/insertSelectiveAndUpdate")
|
@LogAction("资源管理,资源发布,资源修改,修改|zy")
|
public String insertSelectiveAndUpdate(Res_ExtBaseMap record, Res_MainInfo resMainInfo, Integer resourceid, String xianshibiliStart, String xianshibiliEnd, String extMapUrlStr) {
|
extMapUrlStr+="servername="+resMainInfo.getTitle();
|
resExtMapUrlService.deleteAndInsertMapUrlArray(record.getResourceid(),extMapUrlStr);
|
// 判断 id是否存在 存在就更新 不存在就 添加
|
Res_ExtBaseMap resExtBaseMap = resExtBaseMapService.selectByPrimaryKey(resourceid);
|
if(!xianshibiliStart.isEmpty() && !xianshibiliEnd.isEmpty()) {
|
record.setDisplaylev(xianshibiliStart + "-" + xianshibiliEnd);
|
}
|
record.setResourceid(resourceid);
|
|
if (resExtBaseMap == null) {
|
// 添加
|
if (!record.getBasemaptype().equals("影像")) { // 判断底图类型是否是影像,不是则令影像精度为空
|
record.setImageaccuracy(null);
|
}
|
//alter: Xxx 处理资源注册向导新增时没有ESB代理
|
int mainInfoResult = 0;
|
if(resMainInfo.getEspproxy() != null) {
|
mainInfoResult = resMainInfoService.updateByPrimaryKeySelective(resMainInfo);
|
} else {
|
mainInfoResult = 1;
|
}
|
int baseMapresult = resExtBaseMapService.insertSelective(record);
|
// // TODO:更改服务地址为代理后的
|
// String proxyUrl=getProxyurl(record,resourceid); //代理后的地址
|
// String serverUrl = record.getServerurl();//服务地址
|
// Res_ExtMapUrl res_extMapUrl = new Res_ExtMapUrl();
|
// res_extMapUrl.setOldserverurl(serverUrl);
|
// res_extMapUrl.setServerurl(proxyUrl);
|
// resExtMapUrlService.insertSelective(res_extMapUrl);
|
int result;
|
if (mainInfoResult == 1 && baseMapresult == 1) {
|
result = 1;
|
} else {
|
result = 0;
|
}
|
return "{'result':'" + result + "','ziyuanId':'" + resourceid + "'}";
|
} else {
|
// 更新
|
if (!record.getBasemaptype().equals("影像")) { // 判断底图类型是否是影像,不是则令影像精度为空
|
record.setImageaccuracy(null);
|
}
|
int mainInfoResult = 0;
|
if(resMainInfo.getEspproxy() != null) {
|
mainInfoResult = resMainInfoService.updateByPrimaryKeySelective(resMainInfo);
|
} else {
|
mainInfoResult = 1;
|
}
|
int baseMapresult = resExtBaseMapService.updateByPrimaryKey(record);
|
int result;
|
if (mainInfoResult == 1 && baseMapresult == 1) {
|
result = 1;
|
} else {
|
result = 0;
|
}
|
return "{'result':'" + result + "','ziyuanId':'" + resourceid + "'}";
|
}
|
}
|
|
|
|
/**
|
* 根据id查询信息资源列表
|
*/
|
@ResponseBody
|
@RequestMapping("/resExtBaseMap/selectByPrimaryKey")
|
public Res_ExtBaseMap selectByPrimaryKey(Integer resourceid) {
|
return resExtBaseMapService.selectByPrimaryKey(resourceid);
|
}
|
|
/**
|
* 根据id更新信息资源列表(更新部分数据)
|
*/
|
@ResponseBody
|
@RequestMapping("/resExtBaseMap/updateByPrimaryKeySelective")
|
public int updateByPrimaryKeySelective(Res_ExtBaseMap record) {
|
return resExtBaseMapService.updateByPrimaryKeySelective(record);
|
}
|
|
/**
|
* 根据id更新信息资源列表(更新所有数据)
|
*/
|
@ResponseBody
|
@RequestMapping("/resExtBaseMap/updateByPrimaryKey")
|
public int updateByPrimaryKey(Res_ExtBaseMap record) {
|
return resExtBaseMapService.updateByPrimaryKey(record);
|
}
|
|
/**
|
* 获取地图相关信息(专题地图地图设置)
|
*/
|
@RequestMapping("/ResManage/ResRegister/BaseMapSelect")
|
public String BaseMapSelect(Model model,String isNotOnlyBaseMap) {
|
HashMap<String, String> DataSourceList = FieldUtils.getDataSourceList();// 获取数据来源列表
|
model.addAttribute("datasourcelist", DataSourceList);
|
model.addAttribute("pubzyWebRoot", sysConfig.getPubzyWebRoot());
|
model.addAttribute("systemName", sysConfig.getAppFullName());
|
model.addAttribute("isNotOnlyBaseMap",isNotOnlyBaseMap);
|
return "ResManage/ResRegister/BaseMapSelect";
|
}
|
|
// 查询列表地图设置
|
@ResponseBody
|
@RequestMapping("/ResManage/ResRegister/selectBaseMapJoinMainInfo")
|
public Result selectBaseMapJoinMainInfo(Res_MainInfo resMainInfo, PageBean pageBean) {
|
PageHelper.startPage(pageBean.getPage(), pageBean.getLimit());
|
List<Res_MainInfo> list = resExtBaseMapService.selectBaseMapJoinMainInfo(resMainInfo);
|
int countNums = (int) ((Page) list).getTotal();
|
PageBean<Res_MainInfo> pageData = new PageBean<>(pageBean.getPage(), pageBean.getLimit(), countNums);
|
HashMap<String, String> DataSourceList = FieldUtils.getDataSourceList();// 获取数据来源列表
|
pageData.setItems(list);
|
StringBuilder rsb = new StringBuilder();
|
String laiyuan = "";
|
rsb.append("{'totalCount':'" + countNums);
|
rsb.append("','topics':[");
|
|
List<Map<String, Object>> maps = new LinkedList<>();
|
for (Integer i = 0; i < list.size(); i++) {
|
Map<String, Object> map = new HashMap<>();
|
map.put("resourceid", list.get(i).getResourceid());
|
map.put("title", list.get(i).getTitle());
|
map.put("datasources", list.get(i).getDatasources());
|
maps.add(map);
|
|
// if (i != 0) {
|
// rsb.append(",");
|
// }
|
// rsb.append("{'resourceid':'" + list.get(i).getResourceid() + "'");// 资源id
|
// rsb.append(",'title':'" + list.get(i).getTitle() + "'");// 资源名称
|
//// laiyuan = DataSourceList.get(list.get(i).getDatasources());
|
// rsb.append(",'datasources':'" + list.get(i).getDatasources() + "'");
|
// rsb.append("}");
|
}
|
// rsb.append("]}");
|
return Result.ok().put("totalCount", countNums).put("topics", maps);
|
}
|
|
/**
|
* 自动补全输入首字母查询
|
* @param keyWord
|
* @return
|
*/
|
@ResponseBody
|
@GetMapping("/resExtBaseMap/findPinyinByKeyWord")
|
public String[] findpinyinByKeyWord(@RequestParam(name = "keyWord") String keyWord,String isNotOnlyBaseMap){
|
keyWord = URLDecoder.decode(keyWord);
|
Res_MainInfo resMainInfo = new Res_MainInfo();
|
Map<String, Object> map = new HashMap<>();
|
map.put("keyWord", keyWord);
|
map.put("isNotOnlyBaseMap", isNotOnlyBaseMap);
|
List<Res_MainInfo> list = null;
|
list = resExtBaseMapService.selectBaseMapJoinMainInfoTree(map);
|
String[] arr = new String[list.size()];
|
for (int i =0;i<list.size();i++) {
|
String title = list.get(i).getTitle();
|
arr[i] = title;
|
}
|
return arr;
|
}
|
|
|
@RequestMapping("/ResManage/ResRegister/selectBaseMapJoinMainInfoTree")
|
@ResponseBody
|
public String selectBaseMapJoinMainInfoTree(Res_MainInfo resMainInfo,String parentid,String isNotOnlyBaseMap) {
|
StringBuilder sb = new StringBuilder();
|
Map<String, Object> map = new HashMap<>();
|
map.put("title", resMainInfo.getTitle());
|
map.put("parentid", parentid);
|
map.put("isNotOnlyBaseMap", isNotOnlyBaseMap);
|
List<Res_Catalog> resCatalogs = resExtBaseMapService.selectBaseMapJoinMainInfoNode(map);
|
|
// 循环构造子目录节点
|
List<Map<String, Object>> maps = new LinkedList<>();
|
for (Res_Catalog resCatalog : resCatalogs) {
|
Map<String, Object> nodemap = new HashMap<>();
|
nodemap.put("title", resMainInfo.getTitle());
|
nodemap.put("parentid", resCatalog.getCatlogid());
|
nodemap.put("isNotOnlyBaseMap", isNotOnlyBaseMap);
|
int childCount = resExtBaseMapService.selectBaseMapJoinMainInfoTree(nodemap).size();
|
|
Map<String, Object> catlogmap = new HashMap<>();
|
if(childCount > 0) {
|
catlogmap.put("id", resCatalog.getCatlogid());
|
catlogmap.put("name", resCatalog.getTitle());
|
catlogmap.put("title", resCatalog.getTitle());
|
catlogmap.put("isParent", true);
|
catlogmap.put("iconOpen", "/image/classicons/folderOpen.png");
|
catlogmap.put("iconClose", "/image/classicons/folder.png");
|
maps.add(catlogmap);
|
|
// if (!"".equals(sb.toString())) {
|
// sb.append(',');
|
// }
|
// sb.append("{id: " + resCatalog.getCatlogid() + ",name:'" + resCatalog.getTitle() + "',title:'" + resCatalog.getTitle() + "',isParent: true,iconOpen:'/image/classicons/folderOpen.png',iconClose:'/image/classicons/folder.png'}");
|
}
|
else {
|
if(!getTreeNode(nodemap).isEmpty()) {
|
catlogmap.put("id", resCatalog.getCatlogid());
|
catlogmap.put("name", resCatalog.getTitle());
|
catlogmap.put("title", resCatalog.getTitle());
|
catlogmap.put("isParent", true);
|
catlogmap.put("iconOpen", "/image/classicons/folderOpen.png");
|
catlogmap.put("iconClose", "/image/classicons/folder.png");
|
maps.add(catlogmap);
|
|
// if (!"".equals(sb.toString())) {
|
// sb.append(',');
|
// }
|
// sb.append("{id: " + resCatalog.getCatlogid() + ",name:'" + resCatalog.getTitle() + "',title:'" + resCatalog.getTitle() + "',isParent: true,iconOpen:'/image/classicons/folderOpen.png',iconClose:'/image/classicons/folder.png'}");
|
// sb.append(getTreeNode(nodemap));
|
}
|
}
|
|
}
|
|
List<Res_MainInfo> list = resExtBaseMapService.selectBaseMapJoinMainInfoTree(map);
|
HashMap<String, String> DataSourceList = FieldUtils.getDataSourceList();// 获取数据来源列表
|
// 循环构造资源节点
|
for (Res_MainInfo resMainInfo1 : list) {
|
Map<String, Object> catlogmap = new HashMap<>();
|
catlogmap.put("id", "ZiYuan_" + resMainInfo1.getResourceid());
|
catlogmap.put("name", resMainInfo1.getTitle());
|
catlogmap.put("title", resMainInfo1.getTitle());
|
catlogmap.put("isParent", false);
|
catlogmap.put("icon", "/image/classicons/KJ_JCDT.png");
|
maps.add(catlogmap);
|
|
// if (!"".equals(sb.toString())) {
|
// sb.append(',');
|
// }
|
// sb.append("{id: 'ZiYuan_" + resMainInfo1.getResourceid() + "',name:'" + resMainInfo1.getTitle()
|
// + "', title: '"
|
// + resMainInfo1.getDatasources() + "',isParent:false,icon:'/image/classicons/KJ_JCDT.png'}");
|
}
|
// System.out.println(sb.toString());
|
return JSON.toJSONString(maps, SerializerFeature.WriteMapNullValue);
|
}
|
|
public String getTreeNode(Map<String,Object> map) {
|
StringBuilder sb = new StringBuilder();
|
List<Res_Catalog> resCatalogs = resExtBaseMapService.selectBaseMapJoinMainInfoNode(map);
|
// 循环构造子目录节点
|
for (Res_Catalog resCatalog : resCatalogs) {
|
Map<String, Object> nodemap = new HashMap<>();
|
nodemap = map;
|
nodemap.put("parentid", resCatalog.getCatlogid());
|
nodemap.put("isNotOnlyBaseMap", map.get("isNotOnlyBaseMap"));
|
int childCount = resExtBaseMapService.selectBaseMapJoinMainInfoTree(nodemap).size();
|
if(childCount > 0) {
|
if (!"".equals(sb.toString())) {
|
sb.append(',');
|
}
|
sb.append("{id: " + resCatalog.getCatlogid() + ",name:'" + resCatalog.getTitle() + "',title:'" + resCatalog.getTitle() + "',isParent: true,iconOpen:'/image/classicons/folderOpen.png',iconClose:'/image/classicons/folder.png'}"); //alter ykm 2018/12/9
|
}
|
else {
|
if(!getTreeNode(nodemap).isEmpty()) {
|
if (!"".equals(sb.toString())) {
|
sb.append(',');
|
}
|
sb.append("{id: " + resCatalog.getCatlogid() + ",name:'" + resCatalog.getTitle() + "',title:'" + resCatalog.getTitle() + "',isParent: true,icon:'/image/classicons/defaulticon.png'}");//update:dsh(2018/12/05)
|
// sb.append(getTreeNode(nodemap));
|
}
|
}
|
}
|
System.out.println(sb.toString());
|
return sb.toString();
|
}
|
|
|
/**
|
* 自动补全输入首字母查询
|
* @param keyWord
|
* @return
|
*/
|
@ResponseBody
|
@GetMapping("/resExtBaseMap/getBaseMapForBZTree/findPinyinByKeyWord")
|
public String[] getBaseMapForBZTreeByKeyWord(@RequestParam(name = "keyWord") String keyWord,Integer resourceid){
|
keyWord = URLDecoder.decode(keyWord);
|
Map<String, Object> map = new HashMap<>();
|
map.put("keyWord", keyWord);
|
map.put("resourceid", resourceid);
|
List<Res_MainInfo> list = null;
|
list = resExtBaseMapService.getBaseMapForBZTree(map);
|
String[] arr = new String[list.size()];
|
for (int i =0;i<list.size();i++) {
|
String title = list.get(i).getTitle();
|
arr[i] = title;
|
}
|
return arr;
|
}
|
|
|
@RequestMapping("/ResManage/ResRegister/getBaseMapForBZTree")
|
@ResponseBody
|
public String getBaseMapForBZTree(Res_MainInfo resMainInfo,String parentid) {
|
StringBuilder sb = new StringBuilder();
|
Map<String, Object> map = new HashMap<>();
|
map.put("title", resMainInfo.getTitle());
|
map.put("parentid", parentid);
|
map.put("resourceid", resMainInfo.getResourceid());
|
List<Res_Catalog> resCatalogs = resExtBaseMapService.getBaseMapForBZNode(map);
|
|
// 循环构造子目录节点
|
List<Map<String, Object>> maps = new LinkedList<>();
|
for (Res_Catalog resCatalog : resCatalogs) {
|
Map<String, Object> nodemap = new HashMap<>();
|
nodemap.put("title", resMainInfo.getTitle());
|
nodemap.put("parentid", resCatalog.getCatlogid());
|
nodemap.put("resourceid", resMainInfo.getResourceid());
|
int childCount = resExtBaseMapService.getBaseMapForBZTree(nodemap).size();
|
|
if(childCount > 0) {
|
Map<String, Object> catlogmap = new HashMap<>();
|
catlogmap.put("id", resCatalog.getCatlogid());
|
catlogmap.put("name", resCatalog.getTitle());
|
catlogmap.put("title", resCatalog.getTitle());
|
catlogmap.put("isParent", true);
|
catlogmap.put("iconOpen", "/image/classicons/folderOpen.png");
|
catlogmap.put("iconClose", "/image/classicons/folder.png");
|
maps.add(catlogmap);
|
//
|
// if (!"".equals(sb.toString())) {
|
// sb.append(',');
|
// }
|
// sb.append("{id: " + resCatalog.getCatlogid() + ",name:'" + resCatalog.getTitle() + "',title:'" + resCatalog.getTitle() + "',isParent: true,iconOpen:'/image/classicons/folderOpen.png',iconClose:'/image/classicons/folder.png'}");
|
}
|
else {
|
if(!getBaseMapForBZTreeNode(nodemap).isEmpty()) {
|
Map<String, Object> catlogmap = new HashMap<>();
|
catlogmap.put("id", resCatalog.getCatlogid());
|
catlogmap.put("name", resCatalog.getTitle());
|
catlogmap.put("title", resCatalog.getTitle());
|
catlogmap.put("isParent", true);
|
catlogmap.put("iconOpen", "/image/classicons/folderOpen.png");
|
catlogmap.put("iconClose", "/image/classicons/folder.png");
|
maps.add(catlogmap);
|
|
|
// if (!"".equals(sb.toString())) {
|
// sb.append(',');
|
// }
|
// sb.append("{id: " + resCatalog.getCatlogid() + ",name:'" + resCatalog.getTitle() + "',title:'" + resCatalog.getTitle() + "',isParent: true,iconOpen:'/image/classicons/folderOpen.png',iconClose:'/image/classicons/folder.png'}");
|
// sb.append(getBaseMapForBZTreeNode(nodemap));
|
}
|
}
|
}
|
|
List<Res_MainInfo> list = resExtBaseMapService.getBaseMapForBZTree(map);
|
// 循环构造资源节点
|
for (Res_MainInfo resMainInfo1 : list) {
|
Map<String, Object> catlogmap = new HashMap<>();
|
catlogmap.put("id", "ZiYuan_" + resMainInfo1.getResourceid());
|
catlogmap.put("name", resMainInfo1.getTitle());
|
catlogmap.put("title", resMainInfo1.getTitle());
|
catlogmap.put("isParent", false);
|
catlogmap.put("icon", "/image/classicons/KJ_JCDT.png");
|
maps.add(catlogmap);
|
|
// if (!"".equals(sb.toString())) {
|
// sb.append(',');
|
// }
|
// sb.append("{id: 'ZiYuan_" + resMainInfo1.getResourceid() + "',name:'" + resMainInfo1.getTitle()
|
// + "', title: '"
|
// + resMainInfo1.getDatasources() + "',isParent:false,icon:'/image/classicons/KJ_JCDT.png'}");
|
}
|
// System.out.println(sb.toString());
|
return JSON.toJSONString(maps, SerializerFeature.WriteMapNullValue);
|
}
|
|
public String getBaseMapForBZTreeNode(Map<String,Object> map) {
|
StringBuilder sb = new StringBuilder();
|
List<Res_Catalog> resCatalogs = resExtBaseMapService.getBaseMapForBZNode(map);
|
// 循环构造子目录节点
|
for (Res_Catalog resCatalog : resCatalogs) {
|
Map<String, Object> nodemap = new HashMap<>();
|
nodemap = map;
|
nodemap.put("parentid", resCatalog.getCatlogid());
|
int childCount = resExtBaseMapService.getBaseMapForBZTree(nodemap).size();
|
if(childCount > 0) {
|
if (!"".equals(sb.toString())) {
|
sb.append(',');
|
}
|
sb.append("{id: " + resCatalog.getCatlogid() + ",name:'" + resCatalog.getTitle() + "',title:'" + resCatalog.getTitle() + "',isParent: true}");
|
}
|
else {
|
if(!getBaseMapForBZTreeNode(nodemap).isEmpty()) {
|
if (!"".equals(sb.toString())) {
|
sb.append(',');
|
}
|
sb.append("{id: " + resCatalog.getCatlogid() + ",name:'" + resCatalog.getTitle() + "',title:'" + resCatalog.getTitle() + "',isParent: true,icon:'/image/classicons/defaulticon.png'}");
|
//sb.append(getBaseMapForBZTreeNode(nodemap));
|
}
|
}
|
}
|
System.out.println(sb.toString());
|
return sb.toString();
|
}
|
|
public static void main(String[] args) {
|
// Res_ExtBaseMap record = new Res_ExtBaseMap();
|
// record.setIsPublic(1);
|
// record.setResourceid(15);
|
// record.setServerurl("http://192.168.20.106:8066/test");
|
// String proxyurl = getProxyurl(record, 15);
|
// System.out.println("proxyurl = " + proxyurl);
|
}
|
}
|