package com.landtool.lanbase.modules.res.controller;
|
|
import java.io.File;
|
import java.io.IOException;
|
import java.net.URLEncoder;
|
import java.text.SimpleDateFormat;
|
import java.util.ArrayList;
|
import java.util.HashMap;
|
import java.util.LinkedHashMap;
|
import java.util.LinkedList;
|
import java.util.List;
|
import java.util.Map;
|
import java.util.function.Consumer;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import org.apache.shiro.SecurityUtils;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.stereotype.Controller;
|
import org.springframework.ui.Model;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONObject;
|
//import com.amazonaws.services.kms.model.ListResourceTagsRequest;
|
import com.alibaba.fastjson.serializer.SerializerFeature;
|
import com.github.pagehelper.Page;
|
import com.github.pagehelper.PageHelper;
|
import com.landtool.lanbase.common.utils.HttpOperateUtils;
|
import com.landtool.lanbase.common.utils.HttpUtils;
|
import com.landtool.lanbase.common.utils.Result;
|
import com.landtool.lanbase.config.SysTemPropertyConfig;
|
import com.landtool.lanbase.modules.api.utils.Excel;
|
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_Ext3D;
|
import com.landtool.lanbase.modules.res.entity.Res_ExtFileSource;
|
import com.landtool.lanbase.modules.res.entity.Res_ExtIntegrate;
|
import com.landtool.lanbase.modules.res.entity.Res_ExtInterFaceService;
|
import com.landtool.lanbase.modules.res.entity.Res_ExtMapUrl;
|
import com.landtool.lanbase.modules.res.entity.Res_ExtSpaceServer;
|
import com.landtool.lanbase.modules.res.entity.Res_MainInfo;
|
import com.landtool.lanbase.modules.res.entity.SimpleZiYuan;
|
import com.landtool.lanbase.modules.res.entity.UserDefined.UserDef_ZYML_ChaXunQu;
|
import com.landtool.lanbase.modules.res.service.ResCatalogService;
|
import com.landtool.lanbase.modules.res.service.ResExt3DService;
|
import com.landtool.lanbase.modules.res.service.ResExtBusinessLayerService;
|
import com.landtool.lanbase.modules.res.service.ResExtFileSourceService;
|
import com.landtool.lanbase.modules.res.service.ResExtIntegrateService;
|
import com.landtool.lanbase.modules.res.service.ResExtInterFaceService;
|
import com.landtool.lanbase.modules.res.service.ResExtMapUrlService;
|
import com.landtool.lanbase.modules.res.service.ResExtSpaceServerService;
|
import com.landtool.lanbase.modules.res.service.ResExtThemeMapService;
|
import com.landtool.lanbase.modules.res.service.ResMainInfoService;
|
import com.landtool.lanbase.modules.res.service.ZiYuanMuLuService;
|
import com.landtool.lanbase.modules.sys.controller.AbstractController;
|
import com.landtool.lanbase.modules.sys.service.SysFieldvalueService;
|
|
/**
|
* 前台展示 - 资源目录
|
*/
|
@Controller
|
@RequestMapping("res/ziyuanmulu")
|
public class ZiYuanMuLuController extends AbstractController {
|
@Autowired
|
private SysTemPropertyConfig sysConfig;
|
|
@Autowired
|
public ZiYuanMuLuService ziYuanMuLuService;
|
|
@Autowired
|
private SysFieldvalueService fieldUtils;
|
|
@Autowired
|
private ResMainInfoService resMainInfoService;
|
|
@Autowired
|
private OrgUserService orgUserService;
|
|
@Autowired
|
private OrgUnitService orgUnitService;
|
|
@Autowired
|
private ResCatalogService resCatalogService;
|
|
@Autowired
|
private ResExt3DService resExt3DService;
|
|
@Autowired
|
private ResExtIntegrateService resExtIntegrateService;
|
|
@Autowired
|
private ResExtBusinessLayerService resExtBusinessLayerService;
|
|
@Autowired
|
private ResExtMapUrlService resExtMapUrlService;
|
|
@Autowired
|
private ResExtThemeMapService resExtThemeMapService;
|
|
@Autowired
|
private ResExtInterFaceService resExtInterFaceService;
|
|
@Autowired
|
private ResExtFileSourceService resExtFileSourceService;
|
|
@Autowired
|
private ResExtSpaceServerService resExtSpaceServerService;
|
|
//
|
// @Value("${ResCatalogAuthUrl}")
|
// private String ResCatalogAuthUrl;
|
|
/**
|
* 资源查询页面
|
*/
|
@RequestMapping("/indexbak")
|
public String index(String Message, Model model) {
|
//资源浏览 - 资源类型下拉框
|
LinkedHashMap<String, String> resourceTypeList = fieldUtils.getFieldListByKey("ResourceType");
|
model.addAttribute("resourceTypeList", resourceTypeList);
|
//资源类型Json
|
String resourceTypeListJson = "";
|
for (Map.Entry<String, String> entry : resourceTypeList.entrySet()) {
|
if (resourceTypeListJson != "") {
|
resourceTypeListJson += ",";
|
}
|
resourceTypeListJson += "{key:'" + entry.getKey() + "',value:'" + entry.getValue() + "'}";
|
}
|
//Message判断
|
if (Message != null) {
|
model.addAttribute("Message", Message);
|
}
|
model.addAttribute("resourceTypeListJson", "[" + resourceTypeListJson + "]");
|
model.addAttribute("pubzyWebRoot", sysConfig.getPubzyWebRoot());
|
model.addAttribute("systemName", sysConfig.getAppFullName());
|
model.addAttribute("backstageWebRoot", sysConfig.getApiServer() + "/");
|
|
//数据文件查询条件——文档类型
|
LinkedHashMap<String, String> filetypelist = fieldUtils.getFieldListByKey("FileType");
|
model.addAttribute("filetypelist", filetypelist);
|
|
//基础底图查询条件——发布平台、地图类型
|
LinkedHashMap<String, String> BaseMapTypeList = fieldUtils.getFieldListByKey("BaseMapType");// 获取底图类型字典列表
|
LinkedHashMap<String, String> PublishSoftList = fieldUtils.getFieldListByKey("PublishSoft");// 获取发布平台字典列表
|
LinkedHashMap<String, String> ImageAccuracyList = fieldUtils.getFieldListByKey("ImageAccuracy");// 获取影像精度字典列表
|
model.addAttribute("ImageAccuracyList", ImageAccuracyList);
|
model.addAttribute("PublishSoftList", PublishSoftList);
|
model.addAttribute("BaseMapTypeList", BaseMapTypeList);
|
|
//专题地图查询条件——专题类型
|
LinkedHashMap<String, String> typeList = fieldUtils.getFieldListByKey("ThemeMapType");//获取专题类型字典列表
|
model.addAttribute("typeList", typeList);
|
LinkedHashMap<String, String> GongXiangXieYiList = fieldUtils.getFieldListByKey("SharProtocol");// 获取共享协议列表
|
model.addAttribute("SharProtocolList", GongXiangXieYiList);
|
model.addAttribute("gisPortal", sysConfig.getGisPortal());
|
|
//获取统计图表数据
|
|
//1.资源类型
|
|
return "ziyuanmulu/index";
|
}
|
|
/**
|
* 获取资源目录树数据
|
* @param id 节点ID
|
* @param treeType 目录树类型(0:资源目录 4:资源类型)
|
* @param XZQHID 区域ID
|
* @param NF 时间
|
* @param IsSC 是否收藏
|
* @return String
|
*/
|
@ResponseBody
|
@RequestMapping("/getTreeData")
|
public String getTreeData(int id, int treeType, String XZQHID, String NF, int IsSC) {
|
String jsonTree = ziYuanMuLuService.getTreeData(id, treeType, XZQHID, NF, IsSC);
|
return jsonTree;
|
}
|
|
/**
|
* 获取统计图
|
*/
|
@ResponseBody
|
@RequestMapping(value = "/getChart")
|
public String getChart(String flag, UserDef_ZYML_ChaXunQu userDefZymlChaXunQu) {
|
String jsonChart = "";
|
if (flag.equals("zylx")) {
|
jsonChart = ziYuanMuLuService.getZiYuanLeiXingChart(); //资源类型
|
} else if (flag.equals("xzqh")) {
|
jsonChart = ziYuanMuLuService.getZYTJ_XingZhengQuHuaChart(new UserDef_ZYML_ChaXunQu()); //行政区划
|
} else if (flag.equals("gxxy")) {
|
jsonChart = ziYuanMuLuService.getGongXiangXieYiChart(); //共享协议
|
} else if (flag.equals("sjtj")) {
|
jsonChart = ziYuanMuLuService.getShiJianTongJiChart(new UserDef_ZYML_ChaXunQu()); //时间统计
|
} else if (flag.equals("dwtj")) {
|
jsonChart = ziYuanMuLuService.getDanWeiTongJiChart(); //单位统计
|
} else if (flag.equals("zytj_zylx")) {
|
jsonChart = ziYuanMuLuService.getZYTJ_ZiYuanLeiXingChart(userDefZymlChaXunQu); //资源统计 - 资源类型
|
} else if (flag.equals("zytj_xzqh")) {
|
jsonChart = ziYuanMuLuService.getZYTJ_XingZhengQuHuaChart(userDefZymlChaXunQu); //资源统计 - 行政区划
|
} else if (flag.equals("zytj_fbsj")) {
|
jsonChart = ziYuanMuLuService.getShiJianTongJiChart(userDefZymlChaXunQu); //资源统计-发布年份
|
} else if (flag.equals("zytj_shzt")) {
|
jsonChart = ziYuanMuLuService.getZYTJ_ShenHeZhuangTai();
|
}
|
return jsonChart;
|
}
|
|
/**
|
* 资源图文列表
|
*/
|
@RequestMapping("/ZiYuanDataList")
|
public String ziYuanDataList(UserDef_ZYML_ChaXunQu userDef_zyml_chaXunQu, Model model, PageBean pageBean) {
|
//alert ykm 2019/01/15
|
if(userDef_zyml_chaXunQu.getCreateuserid() == null && userDef_zyml_chaXunQu.getFaburen() != null && !userDef_zyml_chaXunQu.getFaburen().equals("")) {
|
String name = getUserIds(userDef_zyml_chaXunQu.getFaburen());
|
userDef_zyml_chaXunQu.setFaburen(name);
|
}
|
if(userDef_zyml_chaXunQu.getCreateuserid() != null) {
|
userDef_zyml_chaXunQu.setFaburen(null);
|
}
|
//接口服务和基础地理特殊处理 平台数据
|
if("1".equals(userDef_zyml_chaXunQu.getSpcStatus()) &&
|
("JKFW".equals(userDef_zyml_chaXunQu.getResourceclass()))){
|
userDef_zyml_chaXunQu.setSpcStatus(null);
|
}
|
//update:dsh(2018/12/05)
|
Page<Res_MainInfo> page = PageHelper.startPage(pageBean.getPage(), 14);
|
List<Res_MainInfo> ziYuanMuLuList = ziYuanMuLuService.selectZiYuanMuLuList(userDef_zyml_chaXunQu);
|
// added by qfx at 2021-09-14 09:44
|
int countNums =(int)((Page)ziYuanMuLuList).getTotal();
|
|
List<Integer> ResCatalogAuthlist=new ArrayList<>();
|
List<Res_MainInfo> zylist=new ArrayList<>();
|
|
//根据用户id获取用户信息,找到该用户所属的角色,由角色找到该用户能看的资源目录
|
// try {
|
// ResCatalogAuthlist=(List<Integer>) JSONObject.parseArray(HttpUtils.get(ResCatalogAuthUrl+getUserId()), Integer.class);
|
// } catch (Exception e) {
|
// e.printStackTrace();
|
// }
|
|
// for(Res_MainInfo res : ziYuanMuLuList){
|
// if(ResCatalogAuthlist.contains(res.getCatlogid())||"完全公开".equals(res.getSharprotocol())){
|
// zylist.add(res);
|
// }
|
//
|
// }
|
//
|
// ziYuanMuLuList=zylist;
|
|
PageBean<Res_MainInfo> pageData = new PageBean<>(pageBean.getPage(), pageBean.getLimit(), countNums);
|
pageData.setItems(ziYuanMuLuList);
|
List<SimpleZiYuan> simpleZiYuans = new ArrayList<>();
|
LinkedHashMap<String, String> ResourceTypeList = fieldUtils.getFieldListByKey("ResourceType");
|
for (Integer j = 0; j < ziYuanMuLuList.size(); j++) {
|
Res_MainInfo zy = ziYuanMuLuList.get(j);
|
SimpleZiYuan model1 = new SimpleZiYuan();
|
model1.setResourceid(zy.getResourceid());
|
model1.setTitle(zy.getTitle());
|
model1.setCreateuserid(zy.getCreateuserid());
|
String chinesename = orgUserService.getChinesename(zy.getCreateuserid());// 查询发布人id对应的 name
|
String unitname = orgUnitService.getUnitName((long) zy.getPubunitid());
|
model1.setCreateusername(chinesename);
|
model1.setDatasources(zy.getDatasources());
|
model1.setPubunitid(zy.getPubunitid());
|
model1.setPubunitname(unitname==null?"":unitname);
|
model1.setKeywords(zy.getKeywords());
|
|
model1.setStatus(zy.getResourcestatus());
|
|
model1.setSecuritylev(zy.getSecuritylev());
|
model1.setResourceclass(ResourceTypeList.get(zy.getResourceclass()));
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
model1.setPubdate(sdf.format(zy.getPubdate()));
|
String imgUrl = "";
|
String defClassImg = "/image/classimg/" + zy.getResourceclass() + ".gif"; //默认资源类型图片
|
if (zy.getImgurl() != null && zy.getImgurl().length() != 0) {
|
if(zy.getImgurl().startsWith("Atkas")){//图集
|
imgUrl = "/image/" + zy.getImgurl();
|
File file = new File(System.getProperty("user.dir")+ "\\src\\main\\resources\\static" + ("/image/"+zy.getImgurl()).replace("/","\\"));
|
if (!file.exists()) { //判断物理路径是否存在,不存在则默认
|
imgUrl = defClassImg;
|
}
|
}else {
|
imgUrl = "/uploadPath/" + zy.getImgurl();
|
File file = new File(sysConfig.getUploadPath() + zy.getImgurl());
|
if (!file.exists()) { //判断物理路径是否存在,不存在则默认
|
imgUrl = defClassImg;
|
}
|
}
|
} else {
|
imgUrl = defClassImg;
|
}
|
model1.setImgurl(imgUrl);
|
List list = new ArrayList();
|
if (zy.getKeywords() != "") {
|
String keywords = zy.getKeywords();
|
if (keywords != null && !keywords.equals("")) {
|
String key[] = keywords.split(",");
|
for (int i = 0; i < key.length; i++) {
|
String s = key[i];
|
list.add(s);
|
}
|
}
|
}
|
model1.setList(list);
|
simpleZiYuans.add(model1);
|
}
|
|
model.addAttribute("ZyList", simpleZiYuans);
|
model.addAttribute("Count", countNums);
|
model.addAttribute("Page", pageBean.getPage());
|
|
model.addAttribute("pageSize", ziYuanMuLuList.size()); //用于判断CSS样式
|
return "FuWuZiYuan/ZiYuanDataList";
|
}
|
|
/**
|
* 查询资源列表功能
|
*/
|
@ResponseBody
|
@RequestMapping("/selectResMainInfojoinCatalog")
|
public Result selectResMainInfojoinCatalog(UserDef_ZYML_ChaXunQu userDef_zyml_chaXunQu, PageBean pageBean) {
|
//alert ykm 2019/01/15
|
if(userDef_zyml_chaXunQu.getCreateuserid() == null && userDef_zyml_chaXunQu.getFaburen() != null && !userDef_zyml_chaXunQu.getFaburen().equals("")) {
|
String name = getUserIds(userDef_zyml_chaXunQu.getFaburen());
|
userDef_zyml_chaXunQu.setFaburen(name);
|
}
|
if(userDef_zyml_chaXunQu.getCreateuserid() != null) {
|
userDef_zyml_chaXunQu.setFaburen(null);
|
}
|
if("1".equals(userDef_zyml_chaXunQu.getSpcStatus()) &&
|
("JKFW".equals(userDef_zyml_chaXunQu.getResourceclass())
|
)){
|
userDef_zyml_chaXunQu.setSpcStatus(null);
|
}
|
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> ziYuanMuLuList = ziYuanMuLuService.selectZiYuanMuLuList(userDef_zyml_chaXunQu);
|
int countNums = (int) ((Page) ziYuanMuLuList).getTotal();
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
PageBean<Res_MainInfo> pageData = new PageBean<>(pageBean.getPage(), pageBean.getLimit(), countNums);
|
pageData.setItems(ziYuanMuLuList);
|
LinkedHashMap<String, String> ResourceTypeList = fieldUtils.getFieldListByKey("ResourceType");// 获取资源类型列表
|
StringBuilder rsb = new StringBuilder();
|
String leixin = "";
|
List<Map<String, Object>> maps = new LinkedList<>();
|
for (Integer i = 0; i < ziYuanMuLuList.size(); i++) {
|
leixin = ResourceTypeList.get(ziYuanMuLuList.get(i).getResourceclass());
|
String chinesename = orgUserService.getChinesename(ziYuanMuLuList.get(i).getCreateuserid());// 查询发布人id对应的 name
|
String unitname = orgUnitService.getUnitName((long) ziYuanMuLuList.get(i).getPubunitid());
|
unitname = unitname == null?"":unitname;
|
Map<String, Object> map = new HashMap<>();
|
map.put("resourceid", ziYuanMuLuList.get(i).getResourceid());
|
map.put("title", ziYuanMuLuList.get(i).getTitle());
|
map.put("mulu", GetBianMu(ziYuanMuLuList.get(i).getCatlogid() == null ? 0 : ziYuanMuLuList.get(i).getCatlogid()));
|
map.put("resourceclass", leixin);
|
map.put("pubdate", sdf.format(ziYuanMuLuList.get(i).getPubdate()));
|
map.put("pubunitid", unitname);
|
map.put("insteadaudit", ziYuanMuLuList.get(i).getInsteadaudit());
|
map.put("createuserid", chinesename);
|
maps.add(map);
|
|
}
|
return Result.ok().put("totalCount", countNums).put("topics", maps);
|
}
|
|
// 导出excel
|
@ResponseBody
|
@RequestMapping("/excel")
|
public String excel(HttpServletResponse response, UserDef_ZYML_ChaXunQu userDef_zyml_chaXunQu) {
|
//alert ykm 2019/01/15
|
if(userDef_zyml_chaXunQu.getCreateuserid() == null && userDef_zyml_chaXunQu.getFaburen() != null && !userDef_zyml_chaXunQu.getFaburen().equals("")) {
|
String name = getUserIds(userDef_zyml_chaXunQu.getFaburen());
|
userDef_zyml_chaXunQu.setFaburen(name);
|
}
|
if(userDef_zyml_chaXunQu.getCreateuserid() != null) {
|
userDef_zyml_chaXunQu.setFaburen(null);
|
}
|
|
List<Res_MainInfo> mainInfoJoinCatalogList = ziYuanMuLuService.selectZiYuanMuLuList(userDef_zyml_chaXunQu);
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
LinkedHashMap<String, String> ResourceTypeList = fieldUtils.getFieldListByKey("ResourceType");// 获取资源类型列表
|
StringBuilder rsb = new StringBuilder();
|
String leixin = "";
|
// alert ykm 2019/03/04
|
OrgUser user = getUser();
|
Map<String, Object> checkmap = new HashMap<>();
|
checkmap.put("userid", user.getUserid());
|
checkmap.put("unitid", orgUserService.getDefaultUnit(user.getUserid()).getUnitid());
|
List<Map<String,Object>> maps = new LinkedList<>();
|
for (Integer i = 0; i < mainInfoJoinCatalogList.size(); i++) {
|
leixin = ResourceTypeList.get(mainInfoJoinCatalogList.get(i).getResourceclass());
|
String chinesename = orgUserService.getChinesename(mainInfoJoinCatalogList.get(i).getCreateuserid()); // obj.getString("chinesename");
|
String unitname = orgUnitService.getUnitName((long) mainInfoJoinCatalogList.get(i).getPubunitid()); // obj1.getString("unitname");
|
String mulu = GetBianMu(mainInfoJoinCatalogList.get(i).getCatlogid() == null ? 0 : mainInfoJoinCatalogList.get(i).getCatlogid());
|
|
Map<String,Object> map = new HashMap<>();
|
map.put("resourceid",mainInfoJoinCatalogList.get(i).getResourceid());
|
map.put("title",mainInfoJoinCatalogList.get(i).getTitle());
|
map.put("mulu",mulu);
|
map.put("resourceclass",leixin);
|
map.put("pubdate",sdf.format(mainInfoJoinCatalogList.get(i).getPubdate()));
|
map.put("pubunitid",unitname);
|
map.put("createuserid",chinesename);
|
// alert ykm 2019/03/04
|
map.put("sharprotocol",mainInfoJoinCatalogList.get(i).getSharprotocol());
|
//判断是否有权限
|
String serverUrl = "";
|
//判断当前用户是否是管理员,是则可以获取全部的资源地址,不是则判断是否具有权限
|
if(SecurityUtils.getSubject().isPermitted("org_user_admin")) {
|
serverUrl = getServerUrl(mainInfoJoinCatalogList.get(i).getResourceid(), mainInfoJoinCatalogList.get(i).getResourceclass());
|
}
|
else {
|
//当前用户不是管理员,发布人或是完全公开资源则直接获取资源地址
|
if (!mainInfoJoinCatalogList.get(i).getSharprotocol().equals("完全公开") && mainInfoJoinCatalogList.get(i).getCreateuserid() != user.getUserid()) {
|
checkmap.remove("resourceid");
|
checkmap.put("resourceid", mainInfoJoinCatalogList.get(i).getResourceid());
|
int count = resMainInfoService.checkZiYuanQuanXian(checkmap);
|
if (count > 0) {
|
serverUrl = getServerUrl(mainInfoJoinCatalogList.get(i).getResourceid(), mainInfoJoinCatalogList.get(i).getResourceclass());
|
}
|
} else {
|
serverUrl = getServerUrl(mainInfoJoinCatalogList.get(i).getResourceid(), mainInfoJoinCatalogList.get(i).getResourceclass());
|
}
|
}
|
map.put("serverurl",serverUrl);
|
|
maps.add(map);
|
}
|
rsb.append("]}");
|
String a[] = {"资源id", "资源名称", "所属目录编码", "资源类型","共享协议","资源地址", "发布时间", "发布单位id", "发布添加人"};
|
try {
|
String Filename = Excel.going(response, a, JSON.toJSONString(maps, SerializerFeature.WriteMapNullValue), sysConfig.getUploadPath() + "excel\\");
|
String path2 = "/uploadPath/excel/";
|
String desFile = path2 + Filename;
|
return desFile;
|
} catch (IOException e) {
|
e.printStackTrace();
|
return null;
|
}
|
}
|
|
/**
|
* 查询资源所属目录
|
* @param Catlogid
|
* @return
|
*/
|
private String GetBianMu(int Catlogid) {
|
String str = "";
|
if (Catlogid > 0) {
|
Res_Catalog zymlBianMu = resCatalogService.selectByPrimaryKey(Catlogid);
|
if (zymlBianMu != null) {
|
str += zymlBianMu.getTitle();
|
while (zymlBianMu.getParentid()>0)
|
{
|
zymlBianMu=resCatalogService.selectByPrimaryKey(zymlBianMu.getParentid());
|
str = zymlBianMu.getTitle()+ " > "+str;
|
}
|
}
|
}
|
return str;
|
}
|
|
//获取用户或单位Map
|
private LinkedHashMap<String, String> queryUserOrUnitList(String gettype) {
|
String url = sysConfig.getApiServer() + (gettype == "unit" ? "/api/org/unit/queryAllList" : "/api/org/user/queryAllList");
|
LinkedHashMap<String, String> map = new LinkedHashMap<String, String>();
|
try {
|
String jsonStr = HttpOperateUtils.httpGet(url.trim());
|
if (jsonStr.length() != 0) {
|
JSONArray list = JSON.parseArray(jsonStr);
|
for (int i = 0; i < list.size(); i++) {
|
Map maps = (Map) JSON.parse(list.get(i).toString());
|
map.put(maps.get("id").toString(), maps.get("name").toString());
|
}
|
}
|
} catch (IOException e) {
|
e.printStackTrace();
|
}
|
return map;
|
}
|
|
/**
|
* 资源目录页面新设计
|
*/
|
|
/**
|
* 资源查询页面
|
*/
|
@RequestMapping("/index")
|
public String indexNew(String Message, Model model, String isDiTuwu) {
|
//资源浏览 - 资源类型下拉框
|
LinkedHashMap<String, String> resourceTypeList = fieldUtils.getFieldListByKey("ResourceType");
|
model.addAttribute("resourceTypeList", resourceTypeList);
|
//资源类型Json
|
String resourceTypeListJson = "";
|
for (Map.Entry<String, String> entry : resourceTypeList.entrySet()) {
|
if (resourceTypeListJson != "") {
|
resourceTypeListJson += ",";
|
}
|
resourceTypeListJson += "{key:'" + entry.getKey() + "',value:'" + entry.getValue() + "'}";
|
}
|
//Message判断
|
if (Message != null) {
|
model.addAttribute("Message", Message);
|
}
|
|
//是否地图服务搜索判断
|
if (isDiTuwu != null) {
|
model.addAttribute("isDiTuwu", isDiTuwu);
|
}
|
model.addAttribute("resourceTypeListJson", "[" + resourceTypeListJson + "]");
|
model.addAttribute("pubzyWebRoot", sysConfig.getPubzyWebRoot());
|
model.addAttribute("systemName", sysConfig.getAppFullName());
|
model.addAttribute("backstageWebRoot", sysConfig.getApiServer() + "/");
|
|
//数据文件查询条件——文档类型
|
LinkedHashMap<String, String> filetypelist = fieldUtils.getFieldListByKey("FileType");
|
model.addAttribute("filetypelist", filetypelist);
|
|
//基础底图查询条件——发布平台、地图类型
|
LinkedHashMap<String, String> BaseMapTypeList = fieldUtils.getFieldListByKey("BaseMapType");// 获取底图类型字典列表
|
LinkedHashMap<String, String> PublishSoftList = fieldUtils.getFieldListByKey("PublishSoft");// 获取发布平台字典列表
|
LinkedHashMap<String, String> ImageAccuracyList = fieldUtils.getFieldListByKey("ImageAccuracy");// 获取影像精度字典列表
|
model.addAttribute("ImageAccuracyList", ImageAccuracyList);
|
model.addAttribute("PublishSoftList", PublishSoftList);
|
model.addAttribute("BaseMapTypeList", BaseMapTypeList);
|
|
//专题地图查询条件——专题类型
|
LinkedHashMap<String, String> typeList = fieldUtils.getFieldListByKey("ThemeMapType");//获取专题类型字典列表
|
model.addAttribute("typeList", typeList);
|
LinkedHashMap<String, String> GongXiangXieYiList = fieldUtils.getFieldListByKey("SharProtocol");// 获取共享协议列表
|
model.addAttribute("SharProtocolList", GongXiangXieYiList);
|
model.addAttribute("gisPortal", sysConfig.getGisPortal());
|
|
//获取统计图表数据
|
|
//1.资源类型
|
|
model.addAttribute("logourl","ziyuanmulutitle");
|
return "ziyuanmulu/index_New";
|
}
|
|
//根据输入的用户名获取用户ID
|
private String getUserIds(String name) {
|
String url = sysConfig.getApiServer() + "/api/org/user/findUserByWord/" + URLEncoder.encode(URLEncoder.encode(name));
|
|
String username = null;
|
try {
|
username = HttpOperateUtils.httpGet(url);
|
} catch (IOException e) {
|
e.printStackTrace();
|
}
|
JSONArray object = JSONArray.parseArray(username);
|
StringBuilder t = new StringBuilder();
|
if(!name.equals( "%")) {
|
for (int i = 0; i < object.size(); i++) {
|
if (i != 0) t.append(",");
|
t.append(object.getJSONObject(i).getString("id"));
|
}
|
}
|
if(t.toString().equals("") && !name.equals( "%")) {
|
t.append("-1");
|
}
|
return t.toString();
|
}
|
|
// alert ykm 2019/03/04
|
|
/**
|
* 获取资源地址
|
* @param id
|
* @param resourceclass
|
* @return
|
*/
|
private String getServerUrl(Integer id, String resourceclass) {
|
//获取资源地址,多个默认取第一个
|
String firstMapUrl = "";
|
List<Res_ExtMapUrl> urlList = resExtMapUrlService.selectByCondition(id);
|
if (urlList != null && urlList.size() > 0 && urlList.get(0).getServerurl() != null) {
|
firstMapUrl = urlList.get(0).getServerurl();
|
}
|
else {
|
if(resourceclass.equals("JKFW")) {
|
Res_ExtInterFaceService res_extInterFaceService = resExtInterFaceService.selectByPrimaryKey(id);
|
if(res_extInterFaceService != null) {
|
firstMapUrl = res_extInterFaceService.getServerurl() == null ? "" : "\"" + res_extInterFaceService.getServerurl() + "\"";
|
}
|
}
|
if(resourceclass.equals("SJWJ")) {
|
Res_ExtFileSource resExtFileSource = resExtFileSourceService.selectByPrimaryKey(id);
|
if(resExtFileSource != null) {
|
firstMapUrl = resExtFileSource.getServerurl() == null ? "" : "\"" + resExtFileSource.getServerurl() + "\"";
|
}
|
}
|
if(resourceclass.equals("YWJC")) {
|
Res_ExtIntegrate resExtIntegrate = resExtIntegrateService.selectByPrimaryKey(id);
|
if(resExtIntegrate != null) {
|
firstMapUrl = resExtIntegrate.getServerurl() == null ? "" : "\"" + resExtIntegrate.getServerurl() + "\"";
|
}
|
}
|
if(resourceclass.equals("KJ_KJFX")) {
|
Res_ExtSpaceServer resExtSpaceServer = resExtSpaceServerService.selectByPrimaryKey(id);
|
if(resExtSpaceServer != null) {
|
firstMapUrl = resExtSpaceServer.getServerurl() == null ? "" : "\"" + resExtSpaceServer.getServerurl() + "\"";
|
}
|
}
|
// 添加三维地形和三维影像 alert 2019/08/01
|
if(resourceclass.equals("KJ_SWMX") || resourceclass.equals("KJ_SWDX") || resourceclass.equals("KJ_SWYX")) {
|
Res_Ext3D resExt3D = resExt3DService.selectByPrimaryKey(id);
|
if(resExt3D != null) {
|
firstMapUrl = resExt3D.getServerurl() == null ? "" : "\"" + resExt3D.getServerurl() + "\"";
|
}
|
}
|
}
|
return firstMapUrl;
|
}
|
}
|