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 javax.servlet.http.HttpServletRequest; //import net.sf.json.JSON; //import net.sf.json.JSONObject; import org.apache.shiro.SecurityUtils; 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.serializer.SerializerFeature; import com.github.pagehelper.Page; import com.github.pagehelper.PageHelper; import com.landtool.lanbase.common.annotation.LogAction; import com.landtool.lanbase.config.SysTemPropertyConfig; import com.landtool.lanbase.modules.api.utils.PageBean; import com.landtool.lanbase.modules.org.entity.OrgUser; import com.landtool.lanbase.modules.org.service.OrgUnitService; import com.landtool.lanbase.modules.org.service.OrgUserService; import com.landtool.lanbase.modules.res.entity.Res_Catalog; import com.landtool.lanbase.modules.res.entity.Res_ExtBusinessLayer; import com.landtool.lanbase.modules.res.entity.Res_ExtMapUrl; import com.landtool.lanbase.modules.res.entity.Res_MainInfo; import com.landtool.lanbase.modules.res.entity.Res_QueryAround; import com.landtool.lanbase.modules.res.service.ResCatalogService; import com.landtool.lanbase.modules.res.service.ResExtBusinessLayerService; 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; import cn.hutool.http.HtmlUtil; /** * @Author: lizhao * @Date: 2018-03-05 13:55 * @Description:4系统资源扩展(业务图层)控制器 */ @Controller @RequestMapping("/res") public class ResExtBusinessLayerController extends AbstractController { @Autowired private ResExtBusinessLayerService resExtBusinessLayerService; @Autowired private ResExtMapUrlService resExtMapUrlService; @Autowired private SysTemPropertyConfig sysConfig; @Autowired private ResMainInfoService resMainInfoService; @Autowired private SysFieldvalueService FieldUtils; @Autowired private OrgUserService orgUserService; @Autowired private OrgUnitService orgUnitService; @Autowired private ResCatalogService resCatalogService; /** * 访问资源业务图层信息页面 */ @RequestMapping("/ResManage/ResRegister/ExtBusinessLayer") public String ExtBusinessLayer(int resMainInfoId, Model model) { List resExtMapUrlList = resExtMapUrlService.selectByCondition(resMainInfoId); model.addAttribute("resExtMapUrlList", resExtMapUrlList); LinkedHashMap typeandurlList = FieldUtils.getFieldListByKey("TypeAndURL");// 获取地理参考模型列表 model.addAttribute("typeandurlList", typeandurlList); String typeandurlListJson = ""; for (Map.Entry entry : typeandurlList.entrySet()) { if (typeandurlListJson != "") typeandurlListJson += ","; typeandurlListJson += "{key:'" + entry.getKey() + "',value:'" + entry.getValue() + "'}"; } model.addAttribute("typeandurlListJson", "[" + typeandurlListJson + "]"); Res_ExtBusinessLayer resExtBusinessLayer = resExtBusinessLayerService.selectByPrimaryKey(resMainInfoId); if (resExtBusinessLayer != null) { Res_MainInfo res_mainInfo = resMainInfoService.selectByPrimaryKey(resMainInfoId); model.addAttribute("resMainInfo", res_mainInfo); model.addAttribute("resExtBusinessLayer", resExtBusinessLayer); model.addAttribute("resMainInfoId", resMainInfoId); } else { Res_ExtBusinessLayer resExtBusinessLayer1 = new Res_ExtBusinessLayer(); Res_MainInfo res_mainInfo = new Res_MainInfo(); model.addAttribute("resMainInfo", res_mainInfo); model.addAttribute("resExtBusinessLayer", resExtBusinessLayer1); } LinkedHashMap PublishSoftList = FieldUtils.getFieldListByKey("PublishSoft");// 获取发布平台字典列表 model.addAttribute("PublishSoftList", PublishSoftList); if(SecurityUtils.getSubject().isPermitted("org_user_admin")) { //判断当前用户是否是管理员,是管理员或是未提交的资源才可以修改资源相关信息 model.addAttribute("admin",true); } else { model.addAttribute("admin",false); } model.addAttribute("esbHost",sysConfig.getEsbHost()); model.addAttribute("esbUrl",sysConfig.getEsbUrl()); model.addAttribute("srHost", sysConfig.getSrHost()); model.addAttribute("srUrl", sysConfig.getSrUrl()); String oldesbids = resExtBusinessLayer != null ? resExtMapUrlService.queryRsbidsByResourceid(resMainInfoId):""; model.addAttribute("oldesbids",oldesbids); model.addAttribute("ipHost",sysConfig.getIpHost()); model.addAttribute("gisHost",sysConfig.getGisHost()); return "ResManage/ResRegister/ExtBusinessLayer"; } /** * 根据id 删除业务图层列表功能 */ @ResponseBody @RequestMapping("/ResExtBusinessLayer/deleteByPrimaryKey") public int deleteByPrimaryKey(int resourceid) { return resExtBusinessLayerService.deleteByPrimaryKey(resourceid); } /** * 插入业务图层列表功能(所有元素不能为空) */ @ResponseBody @RequestMapping("/ResExtBusinessLayer/insert") public int insert(Res_ExtBusinessLayer record) { return resExtBusinessLayerService.insert(record); } /** * 插入业务图层列表功能(可以只填写必填字段) */ @ResponseBody @RequestMapping("/ResExtBusinessLayer/insertSelective") public int insertSelective(Res_ExtBusinessLayer record) { return resExtBusinessLayerService.insertSelective(record); } /** * 插入业务图层列表功能并且增加更新功能 */ @ResponseBody @RequestMapping("/ResExtBusinessLayer/insertSelectiveAndUpdate") @LogAction("资源管理,资源发布,资源修改,修改|zy") public int insertSelectiveAndUpdate(Res_ExtBusinessLayer record, Res_MainInfo resMainInfo, String extMapUrlStr) { // 插入资源支持协议与地址表 resExtMapUrlService.deleteAndInsertMapUrlArray(record.getResourceid(),extMapUrlStr); // 判断 id是否存在 存在就更新 不存在就 添加 Res_ExtBusinessLayer resExtBusinessLayer = resExtBusinessLayerService .selectByPrimaryKey(record.getResourceid()); if (resExtBusinessLayer == null) { // 添加 //alter: Xxx 处理资源注册向导新增时没有ESB代理 int mainInfoResult = 0; if(resMainInfo.getEspproxy() != null) { mainInfoResult = resMainInfoService.updateByPrimaryKeySelective(resMainInfo); } else { mainInfoResult = 1; } int extResult = resExtBusinessLayerService.insertSelective(record); int result; if (mainInfoResult == 1 && extResult == 1) { result = 1; } else { result = 0; } return result; } else { // 更新 int mainInfoResult = 0; if(resMainInfo.getEspproxy() != null) { mainInfoResult = resMainInfoService.updateByPrimaryKeySelective(resMainInfo); } else { mainInfoResult = 1; } int extResult = resExtBusinessLayerService.updateByPrimaryKeySelective(record); int result; if (mainInfoResult == 1 && extResult == 1) { result = 1; } else { result = 0; } return result; } } /** * 根据id查询业务图层列表 */ @ResponseBody @RequestMapping("/ResExtBusinessLayer/selectByPrimaryKey") public Res_ExtBusinessLayer selectByPrimaryKey(int resourceid) { return resExtBusinessLayerService.selectByPrimaryKey(resourceid); } /** * 根据id更新业务图层列表(更新部分数据) */ @ResponseBody @RequestMapping("/ResExtBusinessLayer/updateByPrimaryKeySelective") public int updateByPrimaryKeySelective(Res_ExtBusinessLayer record) { return resExtBusinessLayerService.updateByPrimaryKeySelective(record); } /** * 根据id更新业务图层列表(更新所有数据) */ @ResponseBody @RequestMapping("/ResExtBusinessLayer/updateByPrimaryKey") public int updateByPrimaryKey(Res_ExtBusinessLayer record) { return resExtBusinessLayerService.updateByPrimaryKey(record); } /** * 获取业务图层相关信息 */ @RequestMapping("/ResManage/ResRegister/BusinessLayerSelect") public String BaseMapSelect(Model model) { HashMap DataSourceList = FieldUtils.getDataSourceList();// 获取数据来源列表 model.addAttribute("datasourcelist", DataSourceList); model.addAttribute("pubzyWebRoot", sysConfig.getPubzyWebRoot()); model.addAttribute("systemName", sysConfig.getAppFullName()); return "ResManage/ResRegister/BusinessLayerSelect"; } // @RequestMapping("/ResManage/ResRegister/SelectZhouBianTCSetBasic") // public String SelectZhouBianTCSetBasic(Integer resourceid, Model model) { // // model.addAttribute("resourceid", resourceid); // model.addAttribute("pubzyWebRoot", sysConfig.getPubzyWebRoot()); // return "ResManage/ResRegister/SelectZhouBianTCSetBasic"; // } @RequestMapping("/ResManage/ResRegister/ZiYuanKZ") public String ZiYuanKZ(Model model, Integer resourceid) { model.addAttribute("resourceid", resourceid); model.addAttribute("pubzyWebRoot", sysConfig.getPubzyWebRoot()); // 获取 数据来源表 HashMap DataSourceList = FieldUtils.getDataSourceList();// 获取数据来源列表 model.addAttribute("DataSourceList", DataSourceList); return "ResManage/ResRegister/ZiYuanKZ"; } // @ResponseBody // @RequestMapping("/ResManage/ResRegister/SelectZiYuanKZ") // public String SelectZiYuanKZ(Res_MainInfo resMainInfo, PageBean pageBean, Model model) { // Page page = PageHelper.startPage(pageBean.getPage(), pageBean.getLimit()); // // List res_mainInfos = resMainInfoService.selectTiTle(resMainInfo); // int countNums = (int) ((Page) res_mainInfos).getTotal(); // PageBean pageData = new PageBean<>(pageBean.getPage(), pageBean.getLimit(), countNums); // pageData.setItems(res_mainInfos); // // 拼接字符串 // StringBuilder rsb = new StringBuilder(); // rsb.append("{'totalCount':'" + countNums); // rsb.append("','topics':["); // for (int i = 0; i < res_mainInfos.size(); i++) { // if (i != 0) { // rsb.append(","); // } // rsb.append("{'TITLE':'" + res_mainInfos.get(i).getTitle() + "'"); // rsb.append(",'DATASOURCES':'" + res_mainInfos.get(i).getDatasources() + "'"); // rsb.append(",'RESOURCEID':'" + res_mainInfos.get(i).getResourceid()); // rsb.append("'}"); // } // rsb.append("]}"); // // return rsb.toString(); // } @ResponseBody @RequestMapping("/ResManage/ResRegister/ZiYuanZhouBianGuanLianAdd") // 确定添加资源 (添加资源到 Res_QueryAround) public String ZiYuanZhouBianGuanLianAdd(Res_QueryAround res_queryAround, String ZiYuanIdStr, HttpServletRequest request) { String callbackFunName = request.getParameter("callback"); if (callbackFunName == null || callbackFunName.isEmpty()) { callbackFunName = "callback"; } Integer userid = Math.toIntExact(getUserId()); res_queryAround.setAdduserid(userid); String[] arr = ZiYuanIdStr.split("\\|"); try { for (int i = 0; i < arr.length; i++) { String s = arr[i]; res_queryAround.setAroundresid(Integer.valueOf(s)); resMainInfoService.ZiYuanZhouBianGuanLianAdd(res_queryAround); } return callbackFunName + "(1)"; // 添加成功 } catch (Exception e) { return callbackFunName + "(" + e.toString() + ")"; } } // // 删除添加资源 (删除资源 Res_QueryAround) // @ResponseBody // @RequestMapping("/ResManage/ResRegister/ZiYuanZhouBianGuanLianDelete") // public String ZiYuanZhouBianGuanLianDelete(Res_QueryAround res_queryAround) { // try { // int result = resMainInfoService.ZiYuanZhouBianGuanLianDelete(res_queryAround); // return String.valueOf(result); // } catch (Exception e) { // return e.toString(); // } // } // @ResponseBody // @RequestMapping("/ResExtBusinessLayer/SelectQueryAround") // // 关联查询 //查询id对应的 多个资源,在循环查询资源的内容 // public String SelectQueryAround(Integer resourceid, PageBean pageBean) { // Page page = PageHelper.startPage(pageBean.getPage(), pageBean.getLimit()); // List res_queryArounds = resExtBusinessLayerService.SelectQueryAround(resourceid); // int countNums = (int) ((Page) res_queryArounds).getTotal(); // PageBean pageData = new PageBean<>(pageBean.getPage(), pageBean.getLimit(), countNums); // pageData.setItems(res_queryArounds); // // // 拼接字符串 // StringBuilder rsb = new StringBuilder(); // rsb.append("{'totalCount':'" + countNums); // rsb.append("','topics':["); // for (int i = 0; i < res_queryArounds.size(); i++) { // // 查询对应资源的数据 // Res_MainInfo resMainInfo = resMainInfoService.selectByPrimaryKey(res_queryArounds.get(i).getAroundresid()); // if (resMainInfo != null) { // if (i != 0) { // rsb.append(","); // } // rsb.append("{'TITLE':'" + resMainInfo.getTitle() + "'"); // rsb.append(",'DATASOURCES':'" + resMainInfo.getDatasources() + "'"); // rsb.append(",'CREATDATE':'" + resMainInfo.getCreatedate() + "'"); // rsb.append(",'AROUNDRESID':'" + res_queryArounds.get(i).getAroundresid()); // // rsb.append("'}"); // } // } // rsb.append("]}"); // return rsb.toString(); // } /** * 查询业务图层信息列表 */ @ResponseBody @RequestMapping("/ResManage/ResRegister/selectBusinessLayerJoinMainInfo") public String selectBusinessLayerJoinMainInfo(Res_MainInfo resMainInfo, PageBean pageBean) { PageHelper.startPage(pageBean.getPage(), pageBean.getLimit()); List list = resExtBusinessLayerService.selectBusinessLayerJoinMainInfo(resMainInfo); int countNums = (int) ((Page) list).getTotal(); PageBean pageData = new PageBean<>(pageBean.getPage(), pageBean.getLimit(), countNums); HashMap DataSourceList = FieldUtils.getDataSourceList();// 获取数据来源列表 pageData.setItems(list); StringBuilder rsb = new StringBuilder(); String laiyuan = ""; rsb.append("{'totalCount':'" + countNums); rsb.append("','topics':["); for (Integer i = 0; i < list.size(); i++) { if (i != 0) { rsb.append(","); } rsb.append("{'resourceid':'" + list.get(i).getResourceid() + "'");// 资源id rsb.append(",'title':'" + list.get(i).getTitle() + "'");// 资源名称 rsb.append(",'datasources':'" + list.get(i).getDatasources() + "'"); rsb.append("}"); } rsb.append("]}"); return rsb.toString(); } /** * 查询无权限业务图层信息列表(弃用列表) */ @ResponseBody @RequestMapping("/ResManage/ResRegister/selectBusinessLayerList") public String selectBusinessLayerList(Res_MainInfo resMainInfo,String parentid, PageBean pageBean) { PageHelper.startPage(pageBean.getPage(), pageBean.getLimit()); Map map = new HashMap<>(); map.put("resourceid", resMainInfo.getResourceid()); OrgUser user = getUser(); map.put("userid", user.getUserid()); map.put("unitid", orgUserService.getDefaultUnit(user.getUserid()).getUnitid()); map.put("title", resMainInfo.getTitle()); map.put("datasources", resMainInfo.getDatasources()); map.put("selectids", resMainInfo.getSelectids()); map.put("parentid", parentid); List list = resExtBusinessLayerService.selectBusinessLayerList(map); int countNums = (int) ((Page) list).getTotal(); PageBean pageData = new PageBean<>(pageBean.getPage(), pageBean.getLimit(), countNums); HashMap DataSourceList = FieldUtils.getDataSourceList();// 获取数据来源列表 pageData.setItems(list); StringBuilder rsb = new StringBuilder(); String laiyuan = ""; rsb.append("{'totalCount':'" + countNums); rsb.append("','topics':["); for (Integer i = 0; i < list.size(); i++) { if (i != 0) { rsb.append(","); } rsb.append("{'resourceid':'" + list.get(i).getResourceid() + "'");// 资源id rsb.append(",'title':'" + list.get(i).getTitle() + "'");// 资源名称 rsb.append(",'datasources':'" + list.get(i).getDatasources() + "'"); rsb.append("}"); } rsb.append("]}"); return rsb.toString(); } /** * 查询无权限业务图层信息树 */ @ResponseBody @RequestMapping("/ResManage/ResRegister/selectBusinessLayerTree") public String selectBusinessLayerTree(Res_MainInfo resMainInfo,String parentid) { StringBuilder sb = new StringBuilder(); Map map = new HashMap<>(); map.put("resourceid", resMainInfo.getResourceid()); OrgUser user = getUser(); map.put("userid", user.getUserid()); map.put("unitid", orgUserService.getDefaultUnit(user.getUserid()).getUnitid()); map.put("title", resMainInfo.getTitle()); map.put("datasources", resMainInfo.getDatasources()); map.put("selectids", resMainInfo.getSelectids()); map.put("parentid", parentid); List BusinessLayerNode = resExtBusinessLayerService.selectBusinessLayerNode(map); // 循环构造子目录节点 List> maps = new LinkedList<>(); for (Res_Catalog resCatalog : BusinessLayerNode) { Map nodemap = new HashMap<>(); nodemap.put("resourceid", resMainInfo.getResourceid()); nodemap.put("userid", user.getUserid()); nodemap.put("unitid", orgUserService.getDefaultUnit(user.getUserid()).getUnitid()); nodemap.put("title", resMainInfo.getTitle()); nodemap.put("datasources", resMainInfo.getDatasources()); nodemap.put("selectids", resMainInfo.getSelectids()); nodemap.put("parentid", resCatalog.getCatlogid()); int childCount = resExtBusinessLayerService.selectBusinessLayerList(nodemap).size(); if(childCount > 0) { Map 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(!getTreeNode(nodemap).isEmpty()) { Map 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(getTreeNode(nodemap)); } } } List list = resExtBusinessLayerService.selectBusinessLayerList(map); HashMap DataSourceList = FieldUtils.getDataSourceList();// 获取数据来源列表 // 循环构造资源节点 for (Res_MainInfo resMainInfo1 : list) { Map 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/"+ resMainInfo1.getResourceclass() +".png"); maps.add(catlogmap); // if (!"".equals(sb.toString())) { // sb.append(','); // } // String unitname = orgUnitService.getUnitName((long) resMainInfo1.getPubunitid()); // sb.append("{id: 'ZiYuan_" + resMainInfo1.getResourceid() + "',name:'" + resMainInfo1.getTitle() // + "', title: '" // + resMainInfo1.getDatasources() + "',isParent:false,icon:'/image/classicons/"+ resMainInfo1.getResourceclass() +".png'}"); } System.out.println(com.alibaba.fastjson.JSON.toJSONString(maps, SerializerFeature.WriteMapNullValue)); return com.alibaba.fastjson.JSON.toJSONString(maps, SerializerFeature.WriteMapNullValue); } public String getTreeNode(Map map) { StringBuilder sb = new StringBuilder(); List BusinessLayerNode = resExtBusinessLayerService.selectBusinessLayerNode(map); // 循环构造子目录节点 for (Res_Catalog resCatalog : BusinessLayerNode) { Map nodemap = new HashMap<>(); nodemap = map; nodemap.put("parentid", resCatalog.getCatlogid()); int childCount = resExtBusinessLayerService.selectBusinessLayerList(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'}"); } else { if(!getTreeNode(nodemap).isEmpty()) { 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)); } } } System.out.println(sb.toString()); return sb.toString(); } /** * 自动补全输入首字母查询 * @param keyWord * @return */ @ResponseBody @GetMapping("/businessLayerTree/findPinyinByKeyWord") public String[] findpinyinByKeyWord(@RequestParam(name = "keyWord") String keyWord,String selectids){ keyWord = URLDecoder.decode(keyWord); Map map = new HashMap(); OrgUser user = getUser(); map.put("userid", user.getUserid()); map.put("unitid", orgUserService.getDefaultUnit(user.getUserid()).getUnitid()); map.put("selectids", selectids); map.put("keyWord",keyWord); List list = null; list = resExtBusinessLayerService.selectBusinessLayerList(map); String[] arr = new String[list.size()]; for (int i =0;i map = new HashMap<>(); map.put("title", resMainInfo.getTitle()); map.put("parentid", parentid); List BusinessLayerNode = resExtBusinessLayerService.selectBusinessLayerJoinMainInfoNode(map); // 循环构造子目录节点 List> maps = new LinkedList<>(); for (Res_Catalog resCatalog : BusinessLayerNode) { Map nodemap = new HashMap<>(); nodemap.put("title", resMainInfo.getTitle()); nodemap.put("parentid", resCatalog.getCatlogid()); int childCount = resExtBusinessLayerService.selectBusinessLayerJoinMainInfoTree(nodemap).size(); Map 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(!selectBusinessLayerJoinMainInfoNode(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'}"); } } } List list = resExtBusinessLayerService.selectBusinessLayerJoinMainInfoTree(map); // 循环构造资源节点 for (Res_MainInfo resMainInfo1 : list) { Map 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_YWTC.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_YWTC.png'}");//update:dsh(2018/12/10) } return com.alibaba.fastjson.JSON.toJSONString(maps,SerializerFeature.WriteMapNullValue); } public String selectBusinessLayerJoinMainInfoNode(Map map) { StringBuilder sb = new StringBuilder(); List BusinessLayerNode = resExtBusinessLayerService.selectBusinessLayerJoinMainInfoNode(map); // 循环构造子目录节点 for (Res_Catalog resCatalog : BusinessLayerNode) { Map nodemap = new HashMap<>(); nodemap = map; nodemap.put("parentid", resCatalog.getCatlogid()); int childCount = resExtBusinessLayerService.selectBusinessLayerJoinMainInfoTree(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(!selectBusinessLayerJoinMainInfoNode(nodemap).isEmpty()) { 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 } } } // System.out.println(sb.toString()); return sb.toString(); } /** * 自动补全输入首字母查询 * @param keyWord * @return */ @ResponseBody @GetMapping("/selectBusinessLayerJoinMainInfoTree/findPinyinByKeyWord") public String[] selectBusinessLayerJoinMainInfoKeyWord(@RequestParam(name = "keyWord") String keyWord){ keyWord = URLDecoder.decode(keyWord); Map map = new HashMap(); map.put("keyWord",keyWord); List list = null; list = resExtBusinessLayerService.selectBusinessLayerJoinMainInfoTree(map); String[] arr = new String[list.size()]; for (int i =0;i