package com.landtool.lanbase.modules.res.controller;
|
|
import java.net.URLDecoder;
|
import java.text.SimpleDateFormat;
|
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 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.JSONArray;
|
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.serializer.SerializerFeature;
|
import com.github.pagehelper.Page;
|
import com.github.pagehelper.PageHelper;
|
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.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_DiyLayerInfo;
|
import com.landtool.lanbase.modules.res.entity.Res_ExtThemeMap;
|
import com.landtool.lanbase.modules.res.entity.Res_MainInfo;
|
import com.landtool.lanbase.modules.res.entity.Res_Theme_Module;
|
import com.landtool.lanbase.modules.res.service.ResDiyLayerInfoService;
|
import com.landtool.lanbase.modules.res.service.ResExtThemeMapService;
|
import com.landtool.lanbase.modules.res.service.ResMainInfoService;
|
import com.landtool.lanbase.modules.res.service.ResThemeModuleService;
|
import com.landtool.lanbase.modules.res.service.ResThemeRelationService;
|
import com.landtool.lanbase.modules.sys.controller.AbstractController;
|
import com.landtool.lanbase.modules.sys.service.SysFieldvalueService;
|
|
import cn.hutool.core.date.DateTime;
|
|
@Controller
|
@RequestMapping("/res/ResThemeModule")
|
public class ResThemeModuleController extends AbstractController {
|
@Autowired
|
private SysTemPropertyConfig sysConfig;
|
|
@Autowired
|
private ResThemeModuleService resThemeModuleService;
|
|
@Autowired
|
private ResThemeRelationService resThemeRelationService;
|
|
@Autowired
|
private ResMainInfoService resMainInfoService;
|
|
@Autowired
|
private OrgUserService orgUserService;
|
|
@Autowired
|
private SysFieldvalueService fieldUtils;
|
|
@Autowired
|
private SysFieldvalueService FieldUtils;
|
|
@Autowired
|
private OrgUnitService orgUnitService;
|
|
@Autowired
|
private ResDiyLayerInfoService resDiyLayerInfoService;
|
|
@Autowired
|
private ResExtThemeMapService resExtThemeMapService;
|
|
@ResponseBody
|
@RequestMapping("insert")
|
public int insert(Res_Theme_Module record) {
|
return resThemeModuleService.insert(record);
|
}
|
|
@ResponseBody
|
@RequestMapping("insertSelective")
|
public int insertSelective(Res_Theme_Module record) {
|
return resThemeModuleService.insertSelective(record);
|
}
|
|
@RequestMapping("ResThemeModuleIndex")
|
public String ResThemeModuleIndex(Model model,String selectIds) {
|
model.addAttribute("pubzyWebRoot", sysConfig.getPubzyWebRoot());
|
model.addAttribute("systemName", sysConfig.getAppFullName());
|
model.addAttribute("selectIds", selectIds);
|
return "/ResManage/ResTheme/ResThemeModule";
|
}
|
|
/**
|
* 查询业务专题列表
|
* @param resThemeModule
|
* @param pageBean
|
* @return
|
*/
|
@ResponseBody
|
@RequestMapping("selectResThemeModule")
|
public Result selectResThemeModule(Res_Theme_Module resThemeModule, PageBean pageBean) {
|
PageHelper.startPage(pageBean.getPage(), pageBean.getLimit());
|
List<Res_Theme_Module> list = resThemeModuleService.selectList(resThemeModule);
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
int countNums = (int) ((Page) list).getTotal();
|
PageBean<Res_Theme_Module> 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 (int i = 0; i < list.size(); i++) {
|
String name = "";
|
if (list.get(i).getDiyuserid() != null) {
|
name = orgUserService.queryObject((long) list.get(i).getDiyuserid()).getChinesename();
|
}
|
String paneltitle = "";
|
if(list.get(i).getPanelresid() != null) {
|
Res_MainInfo resMainInfo = resMainInfoService.selectByPrimaryKey(list.get(i).getPanelresid());
|
if(resMainInfo != null) {
|
paneltitle = resMainInfo.getTitle();
|
}
|
}
|
String maptitle = "";
|
if(list.get(i).getMapresid() != null ) {
|
Res_MainInfo mapresMainInfo = resMainInfoService.selectByPrimaryKey(list.get(i).getMapresid());
|
if(mapresMainInfo != null) {
|
maptitle = mapresMainInfo.getTitle();
|
}
|
}
|
String panelurl = list.get(i).getPanelurl() == null ? "":list.get(i).getPanelurl();
|
Map<String, Object> map = new HashMap<>();
|
map.put("moduleid", list.get(i).getModuleid());
|
map.put("title", list.get(i).getTitle());
|
map.put("panelid", list.get(i).getPanelresid());
|
map.put("paneltitle", paneltitle);
|
map.put("mapid", list.get(i).getMapresid());
|
map.put("maptitle", maptitle);
|
map.put("diyuserid", name);
|
map.put("panelurl", panelurl);
|
maps.add(map);
|
|
|
// if (i != 0) {
|
// rsb.append(",");
|
// }
|
// rsb.append("{'moduleid':'" + list.get(i).getModuleid() + "'");
|
// rsb.append(",'title':'" + list.get(i).getTitle() + "'");
|
// rsb.append(",'panelid':'" + list.get(i).getPanelresid() + "'");
|
// rsb.append(",'paneltitle':'" + paneltitle + "'");
|
// rsb.append(",'panelurl':'" + list.get(i).getPanelurl() + "'");
|
// rsb.append(",'mapid':'" + list.get(i).getMapresid() + "'");
|
// rsb.append(",'maptitle':'" + maptitle + "'");
|
// rsb.append(",'diyuserid':'" + name + "'}");
|
}
|
return Result.ok().put("totalCount", countNums).put("topics", maps);
|
}
|
|
/**
|
* 新增修改页面
|
*/
|
@RequestMapping("/AddResThemeModule")
|
public String AddResThemeModule(Integer moduleid, Model model) {
|
Res_Theme_Module resThemeModule = new Res_Theme_Module();
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
if (moduleid != null) {
|
resThemeModule = resThemeModuleService.selectByid(moduleid);
|
if(resThemeModule.getFitbrowser()!=null){
|
if(resThemeModule.getFitbrowser().indexOf("IE")>=0){
|
resThemeModule.setIsIE(1);
|
}
|
if(resThemeModule.getFitbrowser().indexOf("Google")>=0){
|
resThemeModule.setIsGoogle(1);
|
}
|
if(resThemeModule.getFitbrowser().indexOf("Firefox")>=0){
|
resThemeModule.setIsFirefox(1);
|
}
|
}
|
|
}
|
|
model.addAttribute("resThemeModule", resThemeModule);
|
if (resThemeModule.getMapresid() != null) {
|
Res_MainInfo resMainInfo1 = resMainInfoService.selectByPrimaryKey(resThemeModule.getMapresid());
|
if (resMainInfo1 != null) {
|
model.addAttribute("mapresid", resMainInfo1.getTitle());
|
model.addAttribute("resourceClass",resMainInfo1.getResourceclass());
|
}
|
List<Res_DiyLayerInfo> layerInfos=resDiyLayerInfoService.selectByResourceid(resThemeModule.getMapresid());
|
model.addAttribute("layerInfos",layerInfos);
|
}
|
if (resThemeModule.getPanelresid() != null) {
|
Res_MainInfo resMainInfo2 = resMainInfoService.selectByPrimaryKey(resThemeModule.getPanelresid());
|
if (resMainInfo2 != null) {
|
model.addAttribute("panelresid", resMainInfo2.getTitle());
|
}
|
}
|
String title = "";
|
if(resThemeModule != null && resThemeModule.getServiceconfig() != null && !resThemeModule.getServiceconfig().trim().equals("")) {
|
JSONObject obj = JSONObject.parseObject(resThemeModule.getServiceconfig());
|
StringBuilder sb = new StringBuilder();
|
if(!obj.getString("charts").equals("[]")){
|
String charts = JSONArray.parseArray(obj.getString("charts")).get(0).toString();
|
String charts1 = JSONObject.parseObject(charts).get("chart1").toString();
|
title = JSONObject.parseObject(charts1).get("title").toString();
|
}
|
if(!obj.getString("tables").equals("[]")) {
|
String charts = JSONArray.parseArray(obj.getString("tables")).get(0).toString();
|
String charts1 = JSONObject.parseObject(charts).get("table1").toString();
|
title = JSONObject.parseObject(charts1).get("groupby").toString();
|
}
|
}
|
if(resThemeModule.getEchartsheight() != null && resThemeModule.getEchartsheight() %1==0) {
|
model.addAttribute("echartsheight", resThemeModule.getEchartsheight().intValue());
|
}else{
|
model.addAttribute("echartsheight", resThemeModule.getEchartsheight());
|
}
|
model.addAttribute("charttitle", title);
|
model.addAttribute("pubzyWebRoot", sysConfig.getPubzyWebRoot());
|
model.addAttribute("systemName", sysConfig.getAppFullName());
|
return "/ResManage/ResTheme/AddResThemeModule";
|
}
|
|
/**
|
* 新增修改
|
*/
|
@ResponseBody
|
@RequestMapping("updateOrInsert")
|
public String updateOrInsert(Res_Theme_Module resThemeModule, Model model) {
|
String msg = "";
|
if (resThemeModule.getModuleid() == null) {
|
//获取兼容浏览器,拼接成字符串
|
String fitbrowser="";
|
|
if(resThemeModule.getIsIE()==1 ){
|
fitbrowser+="IE,";
|
}
|
if(resThemeModule.getIsGoogle()==1){
|
fitbrowser+="Google,";
|
}
|
if(resThemeModule.getIsFirefox()==1){
|
fitbrowser+="Firefox,";
|
}
|
if(fitbrowser.length()>0){
|
fitbrowser=fitbrowser.substring(0,fitbrowser.length()-1);
|
}
|
resThemeModule.setFitbrowser(fitbrowser);
|
resThemeModule.setDiyuserid(getUserId().intValue());
|
if (resThemeModule.getIsclickchartfilter() == null) {
|
resThemeModule.setIsclickchartfilter(0);
|
}
|
if (resThemeModule.getIsmaplinkage() == null) {
|
resThemeModule.setIsmaplinkage(0);
|
}
|
resThemeModule.setDiytime(DateTime.now());
|
int r = resThemeModuleService.insertSelective(resThemeModule);
|
if (r == 1) {
|
msg = "保存成功!";
|
} else {
|
msg = "保存失败!";
|
}
|
} else if (resThemeModule.getModuleid() != null) {
|
String fitbrowser="";
|
|
if(resThemeModule.getIsIE()==1 ){
|
fitbrowser+="IE,";
|
}
|
if(resThemeModule.getIsGoogle()==1){
|
fitbrowser+="Google,";
|
}
|
if(resThemeModule.getIsFirefox()==1){
|
fitbrowser+="Firefox,";
|
}
|
if(fitbrowser.length()>0){
|
fitbrowser=fitbrowser.substring(0,fitbrowser.length()-1);
|
}
|
resThemeModule.setFitbrowser(fitbrowser);
|
if (resThemeModule.getIsclickchartfilter() == null) {
|
resThemeModule.setIsclickchartfilter(0);
|
}
|
if (resThemeModule.getIsmaplinkage() == null) {
|
resThemeModule.setIsmaplinkage(0);
|
}
|
int r = resThemeModuleService.updateById(resThemeModule);
|
if (r == 1) {
|
msg = "更新成功!";
|
} else {
|
msg = "更新失败!";
|
}
|
}
|
return "{'msg':'" + msg + "','id':'" + resThemeModule.getModuleid() + "'}";
|
}
|
|
/**
|
* 删除
|
* @param moduleid
|
* @return
|
*/
|
@ResponseBody
|
@RequestMapping("deleteById")
|
public int DeleteById(Integer moduleid) {
|
int t = resThemeRelationService.deleteByModuleId(moduleid);
|
int r = resThemeModuleService.deleteById(moduleid);
|
if (t >= 0 && r == 1) {
|
return 1;
|
} else {
|
return 0;
|
}
|
}
|
|
/**
|
* 地图选择页面
|
*/
|
@RequestMapping("selectMap")
|
public String selectMap(Model model) {
|
model.addAttribute("pubzyWebRoot", sysConfig.getPubzyWebRoot());
|
model.addAttribute("systemName", sysConfig.getAppFullName());
|
return "/ResManage/ResTheme/MapSelect";
|
}
|
|
//根据resid获取diy id
|
@ResponseBody
|
@RequestMapping("selectDiyId")
|
public List<Res_DiyLayerInfo> selectMap(Model model, Res_DiyLayerInfo resDiyLayerInfo) {
|
model.addAttribute("pubzyWebRoot", sysConfig.getPubzyWebRoot());
|
model.addAttribute("systemName", sysConfig.getAppFullName());
|
List<Res_DiyLayerInfo> diyinfoList = resDiyLayerInfoService.selectByResourceid(resDiyLayerInfo.getResourceid());
|
return diyinfoList;
|
}
|
|
|
|
/**
|
* 自动补全输入首字母查询
|
* @param keyWord
|
* @return
|
*/
|
@ResponseBody
|
@GetMapping("/findPinyinByKeyWord")
|
public String[] findpinyinByKeyWord(@RequestParam(name = "keyWord") String keyWord,String type){
|
keyWord = URLDecoder.decode(keyWord);
|
Map<String,Object> map = new HashMap<String,Object>();
|
map.put("type", type);
|
map.put("keyWord",keyWord);
|
List<Res_MainInfo> list = resThemeModuleService.selectCatalogZiYuanList(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 ("selectMapList")
|
@ResponseBody
|
public String selectMapList(PageBean pageBean) {
|
Page<Res_MainInfo> page = PageHelper.startPage(pageBean.getPage(), pageBean.getLimit());
|
// if(!SecurityUtils.getSubject().isPermitted("org_user_admin")) {
|
//// // 如果是超级管理员,不添加用户id,查询所有。如果不是 添加id 查询单个
|
//// resMainInfo.setExistPermission(getUserId().toString());
|
//// }
|
List<Res_MainInfo> mainInfoJoinCatalogList = resThemeModuleService.selectMapList();
|
int countNums = (int) ((Page) mainInfoJoinCatalogList).getTotal();
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
PageBean<Res_MainInfo> pageData = new PageBean<>(pageBean.getPage(), pageBean.getLimit(), countNums);
|
pageData.setItems(mainInfoJoinCatalogList);
|
LinkedHashMap<String, String> ResourceTypeList = fieldUtils.getFieldListByKey("ResourceType");// 获取资源类型列表
|
StringBuilder rsb = new StringBuilder();
|
String leixin = "";
|
rsb.append("{'totalCount':'" + countNums);
|
rsb.append("','topics':[");
|
for (Integer i = 0; i < mainInfoJoinCatalogList.size(); i++) {
|
if (i != 0) {
|
rsb.append(",");
|
}
|
rsb.append("{'resourceid':'" + mainInfoJoinCatalogList.get(i).getResourceid() + "'");// 资源id
|
rsb.append(",'title':'" + mainInfoJoinCatalogList.get(i).getTitle() + "'");// 资源名称
|
leixin = ResourceTypeList.get(mainInfoJoinCatalogList.get(i).getResourceclass());
|
rsb.append(",'resourceclass':'" + leixin + "'");// 资源类型
|
rsb.append(",'pubdate':'" + sdf.format(mainInfoJoinCatalogList.get(i).getPubdate()) + "'");// 发布时间
|
String chinesename = orgUserService.getChinesename(mainInfoJoinCatalogList.get(i).getCreateuserid());// 查询发布人id对应的 name
|
String unitname = orgUnitService.getUnitName((long) mainInfoJoinCatalogList.get(i).getPubunitid());
|
rsb.append(",'pubunitid':'" + unitname + "'");// 发布单位id
|
rsb.append(",'createuserid':'" + chinesename);// 发布添加人
|
rsb.append("'}");
|
}
|
rsb.append("]}");
|
return rsb.toString();
|
}
|
|
/**
|
* 面板选择页面
|
*/
|
@RequestMapping("selectPanel")
|
public String selectPanel(Model model) {
|
model.addAttribute("pubzyWebRoot", sysConfig.getPubzyWebRoot());
|
model.addAttribute("systemName", sysConfig.getAppFullName());
|
return "/ResManage/ResTheme/PanelSelect";
|
}
|
|
/**
|
* 获取业务集成--页面集成--Iframe区块列表(列表弃用,改用树形节点)
|
* @return
|
*/
|
@RequestMapping("getYWJCIFrameDataList")
|
@ResponseBody
|
public String getYWJCIFrameDataList(Res_MainInfo resMainInfo, PageBean pageBean) {
|
Page<Res_MainInfo> page = PageHelper.startPage(pageBean.getPage(), pageBean.getLimit());
|
resMainInfo.setResourceclass("YWJC");
|
List<Res_MainInfo> mainInfoJoinCatalogList = resMainInfoService.getYWJCTreeData(resMainInfo);
|
int countNums = (int) ((Page) mainInfoJoinCatalogList).getTotal();
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
PageBean<Res_MainInfo> pageData = new PageBean<>(pageBean.getPage(), pageBean.getLimit(), countNums);
|
pageData.setItems(mainInfoJoinCatalogList);
|
LinkedHashMap<String, String> ResourceTypeList = FieldUtils.getFieldListByKey("ResourceType");// 获取资源类型列表
|
StringBuilder rsb = new StringBuilder();
|
String leixin = "";
|
rsb.append("{'totalCount':'" + countNums);
|
rsb.append("','topics':[");
|
for (int i = 0; i < mainInfoJoinCatalogList.size(); i++) {
|
if (i != 0) {
|
rsb.append(",");
|
}
|
|
rsb.append("{'resourceid':'" + mainInfoJoinCatalogList.get(i).getResourceid() + "'");// 资源id
|
rsb.append(",'title':'" + mainInfoJoinCatalogList.get(i).getTitle() + "'");// 资源名称
|
leixin = ResourceTypeList.get(mainInfoJoinCatalogList.get(i).getResourceclass());
|
rsb.append(",'resourceclass':'" + leixin + "'");// 资源类型
|
String unitname = orgUnitService.getUnitName((long) mainInfoJoinCatalogList.get(i).getPubunitid());
|
|
rsb.append(",'pubunitid':'" + unitname + "'");// 发布单位id
|
rsb.append("}");
|
}
|
rsb.append("]}");
|
return rsb.toString();
|
}
|
|
//选择资源(type:1面板2地图)
|
@RequestMapping("getSelectZiYuan")
|
@ResponseBody
|
public String getSelectZiYuan(Integer type,String parentid, String title, HttpServletRequest request){
|
StringBuilder resCatalogJson = new StringBuilder();
|
Map<String, Object> map = new HashMap<>();
|
|
List<Map<String, Object>> maps = new LinkedList<>();
|
if (parentid.indexOf("ZiYuan_") == -1) {
|
map.put("parentid", parentid);
|
map.put("title", title); //资源名称
|
map.put("type", type);
|
List<Res_Catalog> resCatalogList = resThemeModuleService.selectCatalog(map);// 获取子目录列表
|
// 循环构造子目录节点
|
for (Res_Catalog resCatalog : resCatalogList) {
|
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(resCatalogJson.toString())) {
|
// resCatalogJson.append(',');
|
// }
|
// resCatalogJson.append("{id: " + resCatalog.getCatlogid() + ",name:'" + resCatalog.getTitle() + "', isParent: true,iconOpen:'/image/classicons/folderOpen.png',iconClose:'/image/classicons/folder.png'}");
|
}
|
// 获取资源类型列表
|
List<Res_MainInfo> resMainInfo = resThemeModuleService.selectCatalogZiYuanList(map); // 获取目录下业务图层资源列表
|
// 循环构造资源节点
|
for (Res_MainInfo resMainInfo1 : resMainInfo) {
|
String unitname = orgUnitService.getUnitName((long) resMainInfo1.getPubunitid());
|
|
Map<String, Object> catlogmap = new HashMap<>();
|
|
|
// if (!"".equals(resCatalogJson.toString())) {
|
// resCatalogJson.append(',');
|
// }
|
|
if(resMainInfo1.getResourceclass().equals("KJ_YWTC")){
|
catlogmap.put("id", "ZiYuan_" + resMainInfo1.getResourceid());
|
catlogmap.put("name", resMainInfo1.getTitle()+(unitname != null && unitname.length()>0?("("+unitname+")"):"" ));
|
catlogmap.put("title", resMainInfo1.getTitle());
|
catlogmap.put("resourceClass", resMainInfo1.getResourceclass());
|
catlogmap.put("isParent", false);
|
catlogmap.put("icon", "/image/classicons/KJ_YWTC.png");
|
|
// resCatalogJson.append("{id: 'ZiYuan_" + resMainInfo1.getResourceid() + "',name:'" + resMainInfo1.getTitle()
|
// +(unitname != null && unitname.length()>0?("("+unitname+")"):"" )+ "', title: '"
|
// + resMainInfo1.getDatasources() + "',resourceClass:'" + resMainInfo1.getResourceclass() + "',isParent:false,icon:'/image/classicons/KJ_YWTC.png'}");
|
}else{
|
catlogmap.put("id", "ZiYuan_" + resMainInfo1.getResourceid());
|
catlogmap.put("name", resMainInfo1.getTitle()+(unitname != null && unitname.length()>0?("("+unitname+")"):"" ));
|
catlogmap.put("title", resMainInfo1.getTitle());
|
catlogmap.put("resourceClass", resMainInfo1.getResourceclass());
|
catlogmap.put("isParent", false);
|
catlogmap.put("icon", "/image/classicons/KJ_JCDT.png");
|
|
resCatalogJson.append("{id: 'ZiYuan_" + resMainInfo1.getResourceid() + "',name:'" + resMainInfo1.getTitle()
|
+(unitname != null && unitname.length()>0?("("+unitname+")"):"" )+ "', title: '"
|
+ resMainInfo1.getDatasources() + "',resourceClass:'" + resMainInfo1.getResourceclass() + "',isParent:false,icon:'/image/classicons/KJ_JCDT.png'}");
|
}
|
maps.add(catlogmap);
|
}
|
}
|
return JSON.toJSONString(maps, SerializerFeature.WriteMapNullValue);
|
}
|
|
@RequestMapping("ModuleList")
|
public String ModuleList(Model model) {
|
model.addAttribute("pubzyWebRoot", sysConfig.getPubzyWebRoot());
|
model.addAttribute("systemName", sysConfig.getAppFullName());
|
return "/ResManage/ResTheme/ModuleList";
|
}
|
|
/**
|
* 获取模块列表(包含模块关联的资源名称)
|
* @param resThemeModule
|
* @param pageBean
|
* @return
|
*/
|
@ResponseBody
|
@RequestMapping("getModuleList")
|
public Result getModule(Res_Theme_Module resThemeModule,PageBean pageBean) {
|
PageHelper.startPage(pageBean.getPage(), pageBean.getLimit());
|
List<Res_Theme_Module> list = resThemeModuleService.selectList(resThemeModule);
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
int countNums = (int) ((Page) list).getTotal();
|
PageBean<Res_Theme_Module> 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 (int i = 0; i < list.size(); i++) {
|
String name = "";
|
if (list.get(i).getDiyuserid() != null) {
|
name = orgUserService.queryObject((long) list.get(i).getDiyuserid()).getChinesename();
|
}
|
String paneltitle = "";
|
if(list.get(i).getPanelresid() != null) {
|
Res_MainInfo resMainInfo = resMainInfoService.selectByPrimaryKey(list.get(i).getPanelresid());
|
if(resMainInfo != null) {
|
paneltitle = resMainInfo.getTitle();
|
}
|
}
|
String maptitle = "";
|
if(list.get(i).getMapresid() != null ) {
|
Res_MainInfo mapresMainInfo = resMainInfoService.selectByPrimaryKey(list.get(i).getMapresid());
|
if(mapresMainInfo != null) {
|
maptitle = mapresMainInfo.getTitle();
|
}
|
}
|
String panelurl = list.get(i).getPanelurl() == null ? "":list.get(i).getPanelurl();
|
|
Map<String, Object> map = new HashMap<>();
|
map.put("moduleid", list.get(i).getModuleid());
|
map.put("title", list.get(i).getTitle());
|
map.put("panelid", list.get(i).getPanelresid());
|
map.put("paneltitle", paneltitle);
|
map.put("mapid", list.get(i).getMapresid());
|
map.put("maptitle", maptitle);
|
map.put("diyuserid", name);
|
map.put("panelurl", panelurl);
|
maps.add(map);
|
|
// if (i != 0) {
|
// rsb.append(",");
|
// }
|
// rsb.append("{'moduleid':'" + list.get(i).getModuleid() + "'");
|
// rsb.append(",'title':'" + list.get(i).getTitle() + "'");
|
// rsb.append(",'panelid':'" + list.get(i).getPanelresid() + "'");
|
// rsb.append(",'paneltitle':'" + paneltitle + "'");
|
// String panelurl = list.get(i).getPanelurl() == null ? "":list.get(i).getPanelurl();
|
// rsb.append(",'panelurl':'" + panelurl + "'");
|
// rsb.append(",'mapid':'" + list.get(i).getMapresid() + "'");
|
// rsb.append(",'maptitle':'" + maptitle + "'");
|
// rsb.append(",'diyuserid':'" + name + "'}");
|
}
|
return Result.ok().put("totalCount", countNums).put("topics", maps);
|
}
|
|
/**
|
* 获取关联图层
|
* @param resourceid
|
* @return
|
*/
|
@ResponseBody
|
@RequestMapping("getMapLayers")
|
public String getMapLayers(Integer resourceid) {
|
String result = "";
|
Res_ExtThemeMap resExtThemeMap = resExtThemeMapService.selectByPrimaryKey(resourceid);
|
if(resExtThemeMap != null && resExtThemeMap.getMapjson() != null && !resExtThemeMap.getMapjson().equals("")){
|
result = resExtThemeMap.getMapjson();
|
}
|
return result;
|
}
|
}
|