package com.landtool.lanbase.modules.res.controller;
|
|
import java.io.File;
|
import java.io.IOException;
|
import java.text.SimpleDateFormat;
|
import java.util.ArrayList;
|
import java.util.Date;
|
import java.util.HashMap;
|
import java.util.LinkedHashMap;
|
import java.util.List;
|
import java.util.Map;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import org.apache.commons.lang.StringEscapeUtils;
|
import org.apache.commons.lang.StringUtils;
|
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.RequestBody;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
import com.alibaba.fastjson.JSONObject;
|
import com.landtool.lanbase.common.annotation.LogAction;
|
import com.landtool.lanbase.common.utils.DateUtils;
|
import com.landtool.lanbase.common.utils.HttpOperateUtils;
|
import com.landtool.lanbase.common.utils.JpinyinUtils;
|
import com.landtool.lanbase.config.SysTemPropertyConfig;
|
import com.landtool.lanbase.modules.api.utils.DeleteFileUtils;
|
import com.landtool.lanbase.modules.org.entity.OrgUnit;
|
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_ExtBaseMap;
|
import com.landtool.lanbase.modules.res.entity.Res_ExtBusinessLayer;
|
import com.landtool.lanbase.modules.res.entity.Res_ExtDataBase;
|
import com.landtool.lanbase.modules.res.entity.Res_ExtDataSource;
|
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_ExtSpaceServerWithBLOBs;
|
import com.landtool.lanbase.modules.res.entity.Res_ExtThemeMap;
|
import com.landtool.lanbase.modules.res.entity.Res_FileSource_Way;
|
import com.landtool.lanbase.modules.res.entity.Res_Files;
|
import com.landtool.lanbase.modules.res.entity.Res_MainInfo;
|
import com.landtool.lanbase.modules.res.entity.Res_SpacesParam;
|
import com.landtool.lanbase.modules.res.entity.UserDefined.MainInfoJoinRegister;
|
import com.landtool.lanbase.modules.res.service.ResCatalogService;
|
import com.landtool.lanbase.modules.res.service.ResExt3DService;
|
import com.landtool.lanbase.modules.res.service.ResExtBaseMapService;
|
import com.landtool.lanbase.modules.res.service.ResExtBusinessLayerService;
|
import com.landtool.lanbase.modules.res.service.ResExtDataBaseService;
|
import com.landtool.lanbase.modules.res.service.ResExtDataSourceService;
|
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.ResFileSourceWayService;
|
import com.landtool.lanbase.modules.res.service.ResFilesService;
|
import com.landtool.lanbase.modules.res.service.ResMainInfoService;
|
import com.landtool.lanbase.modules.res.service.ResSpacesParamService;
|
import com.landtool.lanbase.modules.sys.controller.AbstractController;
|
import com.landtool.lanbase.modules.sys.service.SysFieldvalueService;
|
|
/**
|
* 功能描述:资源管理 - 资源注册
|
*/
|
@Controller
|
@RequestMapping("/res/ResManage/NewResRegister")
|
public class NewResRegisterController extends AbstractController {
|
@Autowired
|
private SysTemPropertyConfig sysConfig;
|
@Autowired
|
private ResMainInfoService resMainInfoService;
|
@Autowired
|
private ResExtDataBaseService resExtDataBaseService;
|
@Autowired
|
private ResExtDataSourceService resExtDataSourceService;
|
@Autowired
|
private ResExtInterFaceService resExtInterFaceService;
|
@Autowired
|
private ResExtFileSourceService resExtFileSourceService;
|
@Autowired
|
private ResExtIntegrateService resExtIntegrateService;
|
@Autowired
|
private ResExtBaseMapService resExtBaseMapService;
|
@Autowired
|
private ResExtMapUrlService resExtMapUrlService;
|
@Autowired
|
private ResExtThemeMapService resExtThemeMapService;
|
@Autowired
|
private ResExtSpaceServerService resExtSpaceServerService;
|
@Autowired
|
private ResExt3DService resExt3DService;
|
@Autowired
|
private ResExtBusinessLayerService resExtBusinessLayerService;
|
@Autowired
|
private ResFilesService resFilesService;
|
@Autowired
|
private ResFileSourceWayService resFileSourceWayService;
|
|
@Autowired
|
private ResCatalogService resCatalogService;
|
|
@Autowired
|
private OrgUserService orgUserService;
|
|
@Autowired
|
private OrgUnitService orgUnitService;
|
|
@Autowired
|
private SysFieldvalueService FieldUtils;
|
|
@Autowired
|
private ResSpacesParamService resSpacesParamService;
|
|
/**
|
* 数据库表资源拓展页面
|
*/
|
@RequestMapping("/ExtDataBase")
|
public String ExtDataBase(Model model) {
|
model.addAttribute("backstageWebRoot", sysConfig.getApiServer() + "/");
|
model.addAttribute("pubzyWebRoot", sysConfig.getPubzyWebRoot());
|
return "ResManage/NewResRegister/ExtDataBase";
|
}
|
|
/**
|
* 接口服务资源拓展页面
|
*/
|
@RequestMapping("/ExtInterFaceService")
|
public String ExtInterFaceService(Integer resMainInfoId, Model model) {
|
Res_ExtInterFaceService res_extInterFaceService;
|
if (resMainInfoId != null) {
|
res_extInterFaceService = resExtInterFaceService.selectByPrimaryKey(resMainInfoId);//获取接口服务拓展信息
|
if (res_extInterFaceService != null) {
|
model.addAttribute("Res_ExtInterFaceService", res_extInterFaceService);
|
Res_MainInfo res_mainInfo = resMainInfoService.selectByPrimaryKey(resMainInfoId);
|
model.addAttribute("resMainInfo", res_mainInfo);
|
} else {
|
res_extInterFaceService = new Res_ExtInterFaceService();
|
model.addAttribute("Res_ExtInterFaceService", res_extInterFaceService);
|
model.addAttribute("resMainInfo", new Res_MainInfo());
|
}
|
} else {
|
res_extInterFaceService = new Res_ExtInterFaceService();
|
model.addAttribute("Res_ExtInterFaceService", res_extInterFaceService);
|
model.addAttribute("resMainInfo", new Res_MainInfo());
|
}
|
model.addAttribute("resMainInfoId", resMainInfoId);
|
model.addAttribute("content", res_extInterFaceService.getHelpurl());
|
|
if (SecurityUtils.getSubject().isPermitted("org_user_admin")) {
|
//判断当前用户是否是管理员,是管理员或是未提交的资源才可以修改资源相关信息
|
model.addAttribute("admin", true);
|
} else {
|
model.addAttribute("admin", false);
|
}
|
model.addAttribute("esbWebServiceHost", sysConfig.getEsbWebServiceHost());
|
model.addAttribute("esbHost", sysConfig.getEsbHost());
|
model.addAttribute("esbUrl", sysConfig.getEsbUrl());
|
|
return "ResManage/NewResRegister/ExtInterFaceService";
|
}
|
|
/**
|
* 数据文件资源拓展页面
|
*/
|
@RequestMapping("/ExtFileSource")
|
public String ExtFileSource(Model model) {
|
String unit = "";
|
model.addAttribute("unitConvert", "5");
|
unit = "KB";
|
Res_ExtFileSource resExtFileSource1 = new Res_ExtFileSource();
|
model.addAttribute("Res_ExtFileSource", resExtFileSource1);
|
model.addAttribute("resMainInfo", new Res_MainInfo());
|
|
model.addAttribute("unit", unit);
|
// 获取文档类型列表
|
LinkedHashMap<String, String> filetypelist = FieldUtils.getFieldListByKey("FileType");
|
model.addAttribute("filetypelist", filetypelist);
|
|
if (SecurityUtils.getSubject().isPermitted("org_user_admin")) {
|
//判断当前用户是否是管理员,是管理员或是未提交的资源才可以修改资源相关信息
|
model.addAttribute("admin", true);
|
} else {
|
model.addAttribute("admin", false);
|
}
|
model.addAttribute("ncSyncStorageUrl", sysConfig.getNcStorageUrl().substring(0, sysConfig.getNcStorageUrl().length() - 9) + "jobs/");
|
model.addAttribute("readNcFileURL", sysConfig.getReadNcFileURL());
|
|
return "ResManage/NewResRegister/ExtFileSource";
|
}
|
|
/**
|
* 数据文件下的 展现方式
|
*/
|
@RequestMapping("/ExtPresentationMode")
|
public String ExtPresentationMode(Integer resMainInfoId, Model model) {
|
model.addAttribute("resMainInfoId", resMainInfoId);
|
List<Res_FileSource_Way> list = null;
|
if (resMainInfoId != null) {
|
resFileSourceWayService.selectById(resMainInfoId);
|
}
|
model.addAttribute("FileSourceWay", list);
|
return "ResManage/NewResRegister/ExtPresentationMode";
|
}
|
|
/**
|
* 业务集成资源拓展页面
|
*/
|
@RequestMapping("/ExtIntegrate")
|
public String ExtIntegrate(Model model) {
|
Integer isSetChart = 0;//是否显示模型设置按钮(0不显示1显示)
|
String serverUrl = "";
|
String resolutionBen = "";
|
String resolutionEnd = "";
|
Res_ExtIntegrate resExtIntegrate1 = new Res_ExtIntegrate();
|
model.addAttribute("Res_ExtIntegrate", resExtIntegrate1);
|
model.addAttribute("resMainInfo", new Res_MainInfo());
|
model.addAttribute("isSetChart", isSetChart);
|
model.addAttribute("serverUrl", serverUrl);
|
model.addAttribute("resolutionBen", resolutionBen);
|
model.addAttribute("resolutionEnd", resolutionEnd);
|
|
if (SecurityUtils.getSubject().isPermitted("org_user_admin")) {
|
//判断当前用户是否是管理员,是管理员或是未提交的资源才可以修改资源相关信息
|
model.addAttribute("admin", true);
|
} else {
|
model.addAttribute("admin", false);
|
}
|
|
return "ResManage/NewResRegister/ExtIntegrate";
|
}
|
|
/**
|
* 基础底图资源拓展页面
|
*/
|
@RequestMapping("/ExtBaseMap")
|
public String ExtBaseMap(Integer resMainInfoId, Model model) {
|
Res_ExtMapUrl resExtMapUrl = new Res_ExtMapUrl();
|
Res_ExtBaseMap resExtBaseMap;
|
|
LinkedHashMap<String, String> typeandurlList = FieldUtils.getFieldListByKey("TypeAndURL");//获取地理参考模型列表
|
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 + "]");
|
if (resMainInfoId != null) {
|
List<Res_ExtMapUrl> resExtMapUrlList = resExtMapUrlService.selectByCondition(resMainInfoId);
|
if (resExtMapUrlList.size() > 0) {
|
resExtMapUrl = resExtMapUrlList.get(0);
|
}
|
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 {
|
resExtBaseMap = new Res_ExtBaseMap();
|
Res_MainInfo res_mainInfo = new Res_MainInfo();
|
model.addAttribute("resMainInfo", res_mainInfo);
|
model.addAttribute("resExtBaseMap", resExtBaseMap);
|
model.addAttribute("xianshibiliStart", "");
|
model.addAttribute("xianshibiliEnd", "");
|
}
|
} else {
|
resExtBaseMap = new Res_ExtBaseMap();
|
Res_MainInfo res_mainInfo = new Res_MainInfo();
|
model.addAttribute("resMainInfo", res_mainInfo);
|
model.addAttribute("resExtBaseMap", resExtBaseMap);
|
model.addAttribute("xianshibiliStart", "");
|
model.addAttribute("xianshibiliEnd", "");
|
}
|
|
model.addAttribute("resExtMapUrl", resExtMapUrl);
|
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/NewResRegister/ExtBaseMap";
|
}
|
|
/**
|
* 基础底图--关联标注图页面
|
*/
|
@RequestMapping("/GuanLianBiaoZhuTu")
|
public String GuanLianBiaoZhuTu(Model model) {
|
model.addAttribute("pubzyWebRoot", sysConfig.getPubzyWebRoot());
|
return "/ResManage/NewResRegister/GuanLianBiaoZhuTu";
|
}
|
|
/**
|
* 基础底图--获取关联标注图标注底图目录树
|
* @param resMainInfo
|
* @param parentid
|
*/
|
@RequestMapping("/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);
|
List<Res_Catalog> resCatalogs = resExtBaseMapService.getBaseMapForBZNode(map);
|
|
// 循环构造子目录节点
|
for (Res_Catalog resCatalog : resCatalogs) {
|
Map<String, Object> nodemap = new HashMap<>();
|
nodemap.put("title", resMainInfo.getTitle());
|
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,iconOpen:'/image/classicons/folderOpen.png',iconClose:'/image/classicons/folder.png'}");
|
} else {
|
if (!getBaseMapForBZTreeNode(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(getBaseMapForBZTreeNode(nodemap));
|
}
|
}
|
}
|
|
List<Res_MainInfo> list = resExtBaseMapService.getBaseMapForBZTree(map);
|
// 循环构造资源节点
|
for (Res_MainInfo resMainInfo1 : list) {
|
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 "[" + sb.toString() + "]";
|
}
|
|
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();
|
}
|
|
/**
|
* 专题地图资源拓展页面
|
*/
|
@RequestMapping("/ExtThemeMap")
|
public String ExtThemeMap(Integer resMainInfoId, Model model) {
|
Res_ExtMapUrl resExtMapUrl = new Res_ExtMapUrl();
|
Res_ExtThemeMap resExtThemeMap;
|
|
LinkedHashMap<String, String> typeandurlList = FieldUtils.getFieldListByKey("TypeAndURL");//获取地理参考模型列表
|
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 + "]");
|
|
if (resMainInfoId != null) {
|
List<Res_ExtMapUrl> resExtMapUrlList = resExtMapUrlService.selectByCondition(resMainInfoId);
|
if (resExtMapUrlList.size() > 0) {
|
resExtMapUrl = resExtMapUrlList.get(0);
|
}
|
resExtThemeMap = resExtThemeMapService.selectByPrimaryKey(resMainInfoId);
|
if (resExtThemeMap != null) {
|
Res_MainInfo res_mainInfo = resMainInfoService.selectByPrimaryKey(resMainInfoId);
|
model.addAttribute("resMainInfo", res_mainInfo);
|
model.addAttribute("resExtThemeMap", resExtThemeMap);
|
model.addAttribute("resMainInfoId", resMainInfoId);
|
|
if (resExtThemeMap.getDefaultlayerset() != null) {
|
Res_MainInfo res_mainInfo1 = resMainInfoService.selectByPrimaryKey(resExtThemeMap.getDefaultlayerset());
|
String name = res_mainInfo1.getTitle();
|
model.addAttribute("baseMapLayerName", name);
|
}
|
|
LinkedHashMap<Integer, String> tucengList = new LinkedHashMap<Integer, String>();
|
if (resExtThemeMap.getSublayerset() != null && !resExtThemeMap.getSublayerset().isEmpty()) {
|
String[] tuceng = resExtThemeMap.getSublayerset().split(",");
|
for (int i = 0; i < tuceng.length; i++) {
|
Res_MainInfo resMainInfo = resMainInfoService.selectByPrimaryKey(Integer.parseInt(tuceng[i]));
|
if (resMainInfo != null) {
|
tucengList.put(resMainInfo.getResourceid(), resMainInfo.getTitle());
|
}
|
}
|
}
|
model.addAttribute("tucengList", tucengList);
|
} else {
|
Res_MainInfo res_mainInfo = new Res_MainInfo();
|
model.addAttribute("resMainInfo", res_mainInfo);
|
resExtThemeMap = new Res_ExtThemeMap();
|
model.addAttribute("resExtThemeMap", resExtThemeMap);
|
model.addAttribute("tucengList", new LinkedHashMap<Integer, String>());
|
}
|
} else {
|
Res_MainInfo res_mainInfo = new Res_MainInfo();
|
model.addAttribute("resMainInfo", res_mainInfo);
|
resExtThemeMap = new Res_ExtThemeMap();
|
model.addAttribute("resExtThemeMap", resExtThemeMap);
|
model.addAttribute("tucengList", new LinkedHashMap<Integer, String>());
|
}
|
|
model.addAttribute("resExtMapUrl", resExtMapUrl);
|
LinkedHashMap<String, String> PublishSoftList = FieldUtils.getFieldListByKey("PublishSoft");//获取发布平台字典列表
|
LinkedHashMap<String, String> typeList = FieldUtils.getFieldListByKey("ThemeMapType");//获取发布平台字典列表
|
model.addAttribute("PublishSoftList", PublishSoftList);
|
model.addAttribute("typeList", typeList);
|
|
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());
|
String oldesbids = resExtThemeMap != null ? resExtMapUrlService.queryRsbidsByResourceid(resMainInfoId) : "";
|
model.addAttribute("oldesbids", oldesbids);
|
model.addAttribute("ipHost", sysConfig.getIpHost());
|
model.addAttribute("gisHost", sysConfig.getGisHost());
|
|
return "ResManage/NewResRegister/ExtThemeMap";
|
}
|
|
/**
|
* 空间分析资源拓展页面
|
*/
|
@RequestMapping("/ExtSpaceServer")
|
public String ExtSpaceServer(Model model) {
|
Res_ExtSpaceServerWithBLOBs resExtSpaceServer = new Res_ExtSpaceServerWithBLOBs();
|
model.addAttribute("resExtSpaceServer", resExtSpaceServer);
|
model.addAttribute("resMainInfo", new Res_MainInfo());
|
model.addAttribute("content", resExtSpaceServer.getHelpurl());
|
if (SecurityUtils.getSubject().isPermitted("org_user_admin")) {
|
//判断当前用户是否是管理员,是管理员或是未提交的资源才可以修改资源相关信息
|
model.addAttribute("admin", true);
|
} else {
|
model.addAttribute("admin", false);
|
}
|
|
model.addAttribute("backstageWebRoot", sysConfig.getApiServer() + "/");
|
model.addAttribute("pubzyWebRoot", sysConfig.getPubzyWebRoot());
|
model.addAttribute("jspwebroot", sysConfig.getPubzyWebRoot().replace("javapubzy/", ""));
|
return "ResManage/NewResRegister/ExtSpaceServer";
|
}
|
|
/**
|
* 空间分析--空间服务参数页面
|
*/
|
@RequestMapping("/ExtSpaceServerParams")
|
public String ExtSpaceServerParams(Integer resMainInfoId, Model model) {
|
List<Res_SpacesParam> res_spacesParams = new ArrayList<>();
|
res_spacesParams = resSpacesParamService.selectByResSourceId(resMainInfoId);
|
model.addAttribute("res_spacesParams", res_spacesParams);
|
|
return "ResManage/NewResRegister/ExtSpaceServerParams";
|
}
|
|
/**
|
* 空间服务参数查看页面
|
* @param model
|
* @param paramid
|
* @param resourceid
|
*/
|
@RequestMapping("/SpaceParameters")
|
public String SpaceParameters(Model model, Integer paramid, Integer resourceid) {
|
model.addAttribute("resourceid", resourceid);
|
model.addAttribute("paramid", paramid);
|
model.addAttribute("pubzyWebRoot", sysConfig.getPubzyWebRoot());
|
return "ResManage/ResRegister/SpaceParameters";
|
}
|
|
/**
|
* 空间服务参数编辑页面
|
* @param model
|
* @param paramid
|
* @param resourceid
|
*/
|
@RequestMapping("/SpaceParameters_Edit")
|
public String SpaceParametersEdit(Model model, Integer paramid, Integer resourceid) {
|
Res_SpacesParam resSpacesParam = new Res_SpacesParam();
|
resSpacesParam.setResourceid(resourceid);
|
if (paramid != null) {
|
resSpacesParam = resSpacesParamService.selectByPrimaryKey(paramid);
|
}
|
model.addAttribute("resSpacesParam", resSpacesParam);
|
model.addAttribute("pubzyWebRoot", sysConfig.getPubzyWebRoot());
|
model.addAttribute("systemName", sysConfig.getAppFullName());
|
return "ResManage/ResRegister/SpaceParameters_Edit";
|
}
|
|
/**
|
* 三维模型资源拓展页面
|
*/
|
@RequestMapping("/Ext3D")
|
public String Ext3D(Model model) {
|
Res_Ext3D res_ext3D1 = new Res_Ext3D();
|
model.addAttribute("resExt3d", res_ext3D1);
|
Res_MainInfo res_mainInfo = new Res_MainInfo();
|
model.addAttribute("resMainInfo", res_mainInfo);
|
|
if (SecurityUtils.getSubject().isPermitted("org_user_admin")) {
|
//判断当前用户是否是管理员,是管理员或是未提交的资源才可以修改资源相关信息
|
model.addAttribute("admin", true);
|
} else {
|
model.addAttribute("admin", false);
|
}
|
model.addAttribute("ipHost", sysConfig.getIpHost());
|
model.addAttribute("gisHost", sysConfig.getGisHost());
|
|
model.addAttribute("backstageWebRoot", sysConfig.getApiServer() + "/");
|
model.addAttribute("pubzyWebRoot", sysConfig.getPubzyWebRoot());
|
model.addAttribute("ipHost", sysConfig.getIpHost());
|
model.addAttribute("gisHost", sysConfig.getGisHost());
|
return "ResManage/NewResRegister/Ext3D";
|
}
|
|
/**
|
* 业务图层资源拓展页面
|
*/
|
@RequestMapping("/ExtBusinessLayer")
|
public String ExtBusinessLayer(Integer resMainInfoId, Model model) {
|
Res_ExtMapUrl resExtMapUrl = new Res_ExtMapUrl();
|
Res_ExtBusinessLayer resExtBusinessLayer;
|
|
LinkedHashMap<String, String> typeandurlList = FieldUtils.getFieldListByKey("TypeAndURL");// 获取地理参考模型列表
|
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 + "]");
|
|
if (resMainInfoId != null) {
|
List<Res_ExtMapUrl> resExtMapUrlList = resExtMapUrlService.selectByCondition(resMainInfoId);
|
if (resExtMapUrlList.size() > 0) {
|
resExtMapUrl = resExtMapUrlList.get(0);
|
}
|
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 {
|
resExtBusinessLayer = new Res_ExtBusinessLayer();
|
Res_MainInfo res_mainInfo = new Res_MainInfo();
|
model.addAttribute("resMainInfo", res_mainInfo);
|
model.addAttribute("resExtBusinessLayer", resExtBusinessLayer);
|
}
|
} else {
|
resExtBusinessLayer = new Res_ExtBusinessLayer();
|
Res_MainInfo res_mainInfo = new Res_MainInfo();
|
model.addAttribute("resMainInfo", res_mainInfo);
|
model.addAttribute("resExtBusinessLayer", resExtBusinessLayer);
|
}
|
|
model.addAttribute("resExtMapUrl", resExtMapUrl);
|
LinkedHashMap<String, String> 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());
|
String oldesbids = resExtBusinessLayer != null ? resExtMapUrlService.queryRsbidsByResourceid(resMainInfoId) : "";
|
model.addAttribute("oldesbids", oldesbids);
|
model.addAttribute("ipHost", sysConfig.getIpHost());
|
model.addAttribute("gisHost", sysConfig.getGisHost());
|
|
return "ResManage/NewResRegister/ExtBusinessLayer";
|
}
|
|
/**
|
* ESB代理通用页面
|
*/
|
@RequestMapping("/ExtMapUrl")
|
public String ExtMapUrl(Integer resMainInfoId, Model model) {
|
Res_ExtMapUrl resExtMapUrl = resExtMapUrlService.selectByCondition(resMainInfoId).size() > 0 ? resExtMapUrlService.selectByCondition(resMainInfoId).get(0) : new Res_ExtMapUrl();
|
model.addAttribute("resExtMapUrl", resExtMapUrl);
|
if (resMainInfoId != null) {
|
Res_MainInfo res_mainInfo = resMainInfoService.selectByPrimaryKey(resMainInfoId);
|
model.addAttribute("resMainInfo", res_mainInfo);
|
} else {
|
Res_MainInfo res_mainInfo = new Res_MainInfo();
|
model.addAttribute("resMainInfo", res_mainInfo);
|
}
|
return "ResManage/NewResRegister/ExtMapUrl";
|
}
|
|
/**
|
* 资源向导编辑页面
|
*/
|
@RequestMapping("/ResEdit")
|
public String Edit(Model model, Long resMainInfoId) {
|
if (resMainInfoId != null) {
|
Res_MainInfo resMainInfo = resMainInfoService.selectByPrimaryKey(resMainInfoId.intValue());
|
HashMap<String, String> ResourceTypeList = FieldUtils.getFieldListByKey("ResourceType");// 获取资源类型列表
|
model.addAttribute("resourceclass", ResourceTypeList.get(resMainInfo.getResourceclass()));
|
}
|
String pubzyWebRoot = sysConfig.getPubzyWebRoot();
|
model.addAttribute("resMainInfoId", resMainInfoId);
|
model.addAttribute("pubzyWebRoot", pubzyWebRoot);
|
model.addAttribute("systemName", sysConfig.getAppFullName());
|
model.addAttribute("jspwebroot", pubzyWebRoot.replace("javapubzy/", ""));// 临时处理
|
|
return "ResManage/NewResRegister/Edit";
|
}
|
|
/**
|
* 资源类型选择页面
|
*/
|
@RequestMapping("/ResResourceClass")
|
public String ResResourceClass(Model model) {
|
String pubzyWebRoot = sysConfig.getPubzyWebRoot();
|
model.addAttribute("pubzyWebRoot", pubzyWebRoot);
|
model.addAttribute("systemName", sysConfig.getAppFullName());
|
model.addAttribute("jspwebroot", pubzyWebRoot.replace("javapubzy/", ""));// 临时处理
|
return "ResManage/NewResRegister/ResResourceClass";
|
}
|
|
/**
|
* 基本信息
|
*/
|
@RequestMapping("/MainInfo")
|
public String MainInfo(HttpServletRequest request, Model model, Long resMainInfoId) throws IOException {
|
Res_MainInfo res_mainInfo = new Res_MainInfo();
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
Res_Catalog res_catalog = new Res_Catalog();
|
String newDate = sdf.format(new Date());
|
String Imagelujin = null;
|
int auditstatus = -1;// 审核状态
|
// 获取当前登录人id name 还有对应的单位id name
|
Long userid = getUserId();
|
|
// 修改
|
if (resMainInfoId != null) {
|
res_mainInfo = resMainInfoService.selectByPrimaryKey(resMainInfoId.intValue());
|
String Pubdate = sdf.format(res_mainInfo.getPubdate());
|
if (res_mainInfo.getProductiontime() != null) {
|
String productiontimes = sdf.format(res_mainInfo.getProductiontime());
|
model.addAttribute("productiontime", productiontimes);
|
}
|
model.addAttribute("Pubdate", Pubdate);
|
if (res_mainInfo.getCatlogid() != null) {
|
res_catalog = resCatalogService.selectByPrimaryKey(res_mainInfo.getCatlogid());
|
if (res_catalog != null) {
|
model.addAttribute("catlogtitle", res_catalog.getTitle());
|
}
|
}
|
if (res_mainInfo.getImgurl() != null && res_mainInfo.getImgurl() != "") {
|
if (res_mainInfo.getImgurl().startsWith("Atkas")) {//图集
|
Imagelujin = "/image/" + res_mainInfo.getImgurl();
|
} else {
|
StringBuffer url = request.getRequestURL();
|
String ip = "/uploadPath/";
|
Imagelujin = ip + res_mainInfo.getImgurl();
|
}
|
}
|
// modified by qufangxu 信创环境下,若 res_mainInfo.getAdministrativeid() = ' ',会返回单点登录页面,具体原因未知。 解决办法:提前去除空格、制表符
|
String administrativeid = (String) res_mainInfo.getAdministrativeid();// 数据覆盖范围--行政区划Id
|
String finalValue = null;
|
if (StringUtils.isNotEmpty(administrativeid)){
|
finalValue = administrativeid.trim();
|
}
|
if (StringUtils.isNotEmpty(finalValue)) {
|
String getRegionInfourl = sysConfig.getApiServer() + "/api/org/region/getById/" + administrativeid;
|
String jsonStr = HttpOperateUtils.httpGet(getRegionInfourl.trim());
|
if (jsonStr != null && !jsonStr.isEmpty()) {
|
JSONObject item = JSONObject.parseObject(jsonStr);
|
String regionname = item.getString("regionname");
|
model.addAttribute("administrativename", regionname);
|
}
|
}
|
// 审核状态
|
if (res_mainInfo.getAuditstatus() != null) {
|
auditstatus = res_mainInfo.getAuditstatus();
|
}
|
model.addAttribute("chinesename", orgUserService.queryObject(res_mainInfo.getCreateuserid()).getChinesename());
|
if (res_mainInfo.getPubunitid() == 0) {
|
OrgUnit orgunit = orgUserService.getDefaultUnit(res_mainInfo.getCreateuserid());
|
model.addAttribute("unitname", orgunit.getUnitname());
|
res_mainInfo.setPubunitid(orgunit.getUnitid().intValue());
|
} else {
|
OrgUnit orgunit = orgUnitService.getUnitById(res_mainInfo.getPubunitid().longValue());
|
model.addAttribute("unitname", orgunit.getUnitname());
|
}
|
} else {
|
//新增
|
OrgUnit orgunit = orgUserService.getDefaultUnit(userid);
|
String unitname = "";
|
if (orgunit.getUnitid() != null) {
|
res_mainInfo.setPubunitid(orgunit.getUnitid().intValue());
|
unitname = orgunit.getUnitname();
|
}
|
res_mainInfo.setCreateuserid(userid);
|
// modified by qufangxu
|
res_mainInfo.setInsteadaudit(0);
|
model.addAttribute("loginname", getUser().getLoginname());
|
model.addAttribute("unitname", unitname);
|
model.addAttribute("Pubdate", newDate);
|
model.addAttribute("chinesename", getUser().getChinesename());
|
}
|
HashMap<String, String> ResourceTypeList = FieldUtils.getFieldListByKey("ResourceType");// 获取资源类型列表
|
//获取数据来源列表
|
LinkedHashMap<String, String> DataSourceList = FieldUtils.getDataSourceList();
|
HashMap<String, String> SharProtocolList = FieldUtils.getFieldListByKey("SharProtocol");// 获取共享协议列表
|
List<String> list = resMainInfoService.selectTopHotSearch();
|
String[] KeywordsList = new String[list.size()];// 获取关键字列表
|
for (int i = 0; i < list.size(); i++) {
|
KeywordsList[i] = list.get(i);
|
}
|
//换地址
|
if (res_mainInfo != null && res_mainInfo.getDesurl() != null && res_mainInfo.getDesurl().indexOf("diydes") != -1 && res_mainInfo.getDesurl().indexOf(res_mainInfo.getResourceid().toString()) != -1) {
|
String url = sysConfig.getUploadRootPath() + res_mainInfo.getDesurl();
|
res_mainInfo.setDesurl(url);
|
}
|
model.addAttribute("datasourcelist", DataSourceList);
|
model.addAttribute("mainInfo", res_mainInfo);
|
model.addAttribute("resMainInfoId", resMainInfoId);
|
model.addAttribute("ResourceTypeList", ResourceTypeList);
|
model.addAttribute("Imagelujin", Imagelujin);
|
model.addAttribute("auditstatus", auditstatus);
|
model.addAttribute("SharProtocolList", SharProtocolList);
|
model.addAttribute("KeywordsList", KeywordsList);
|
|
HashMap<String, String> UpdateTimesList = FieldUtils.getFieldListByKey("UpdateTimes");// 获取更新频率列表
|
model.addAttribute("UpdateTimesList", UpdateTimesList);
|
|
if (SecurityUtils.getSubject().isPermitted("org_user_admin")) {
|
//判断当前用户是否是管理员,是管理员或是未提交的资源才可以修改资源相关信息
|
model.addAttribute("admin", true);
|
} else {
|
model.addAttribute("admin", false);
|
}
|
return "ResManage/NewResRegister/MainInfo";
|
}
|
|
/**
|
* 访问附件管理数据图层信息页面
|
*/
|
@RequestMapping("/ResFiles")
|
public String ResFiles(int resMainInfoId, Model datamodel) {
|
List<Res_Files> List = resFilesService.selectDataListForResourceid(resMainInfoId);
|
return "ResManage/NewResRegister/ResFiles";
|
}
|
|
/**
|
* 插入资源编辑页面内容
|
*/
|
@RequestMapping("ziYuanInsert")
|
@ResponseBody
|
@LogAction("资源管理,资源发布,资源新增,新增|zy")
|
public String ziYuanInsert(MainInfoJoinRegister mainInfoJoinRegister) {
|
Res_MainInfo resMainInfo = mainInfoJoinRegister.getResMainInfo();
|
String shortPinYin = JpinyinUtils.changeToGetShortPinYin((String) resMainInfo.getTitle());// 获取拼音首字母
|
resMainInfo.setPingyinfiirst(shortPinYin);
|
resMainInfo.setAuditstatus(0);// 设置资源状态为未提交
|
resMainInfo.setResourcestatus(0);// 设置资源服务状态为正常
|
resMainInfo.setEspproxy(0);// 设置是否代理为0:false
|
resMainInfo.setDisplayby2d(0);// 设置是否支持二维展示为0:不支持
|
resMainInfo.setDisplayby3d(0);// 设置是否支持三维展示为0“不支持
|
resMainInfo.setPubdate(DateUtils.getFunllDate(resMainInfo.getPubdate()));
|
if (resMainInfo.getDesurl() != null && resMainInfo.getDesurl().indexOf("diydes") != -1) {//换地址
|
String url = resMainInfo.getDesurl().replace(sysConfig.getUploadRootPath(), "");
|
resMainInfo.setDesurl(url);
|
}
|
int result = resMainInfoService.insertSelective(resMainInfo);
|
if (result == 1) {//新增成功,插入拓展表信息
|
String leixin = resMainInfo.getResourceclass();
|
//alert ykm 2019/02/26
|
if(leixin.equals("KJ_SWMX") || leixin.equals("KJ_SWDX") || leixin.equals("KJ_SWYX")) leixin = "KJ_SW";
|
switch (leixin) {
|
case "SJKB":
|
saveDataBase(mainInfoJoinRegister.getResExtDataBase());
|
break;
|
case "JKFW":
|
saveInterFaceService(mainInfoJoinRegister.getResExtInterFaceService());
|
saveFileData(mainInfoJoinRegister.getResFiles(), mainInfoJoinRegister.getSavedsizenum(), mainInfoJoinRegister.getFiletype());
|
break;
|
case "SJWJ":
|
saveExtFileSource(mainInfoJoinRegister.getResExtFileSource(), mainInfoJoinRegister.getSavedsizenum());
|
saveFileSourceWay(mainInfoJoinRegister.getResMainInfo(), mainInfoJoinRegister.getExtMapUrlStr());
|
break;
|
case "YWJC":
|
saveExtIntegrate(mainInfoJoinRegister.getResExtIntegrate());
|
break;
|
case "KJ_JCDT":
|
saveBaseMap(mainInfoJoinRegister.getResExtBaseMap(), mainInfoJoinRegister.getXianshibiliStart(), mainInfoJoinRegister.getXianshibiliEnd(), mainInfoJoinRegister.getExtMapUrlStr());
|
break;
|
case "KJ_ZTDT":
|
saveThemeMap(mainInfoJoinRegister.getResExtThemeMap(), mainInfoJoinRegister.getExtMapUrlStr());
|
break;
|
case "KJ_KJFX":
|
saveSpaceServer(mainInfoJoinRegister.getResExtSpaceServerWithBLOBs());
|
saveFileData(mainInfoJoinRegister.getResFiles(), mainInfoJoinRegister.getSavedsizenum(), mainInfoJoinRegister.getFiletype());
|
break;
|
// case "KJ_SWMX":
|
case "KJ_SW": //三维类型,三维模型,三维地形,三维影像
|
save3D(mainInfoJoinRegister.getResExt3D());
|
break;
|
case "KJ_YWTC":
|
saveBusinessLayer(mainInfoJoinRegister.getResExtBusinessLayer(), mainInfoJoinRegister.getExtMapUrlStr());
|
break;
|
}
|
resMainInfo.setOrderid(resMainInfo.getResourceid());
|
resMainInfoService.updateByPrimaryKeySelective(resMainInfo);
|
Object resourceClass = resMainInfo.getResourceclass();
|
}
|
return "{'result':'" + result + "','ziyuanId':'" + resMainInfo.getResourceid() + "','ziyuanClass':'" + resMainInfo.getResourceclass() + "'}";
|
}
|
|
//保存数据文件
|
@ResponseBody
|
public int saveDataBase(Res_ExtDataBase record) {
|
Res_ExtDataBase resExtDataBase = resExtDataBaseService.selectByMainInfoId(record.getResourceid());
|
if (resExtDataBase == null) {
|
//添加
|
Res_ExtDataSource res_extDataSource = resExtDataSourceService.selectByPrimaryKey(record.getDatasourceid());
|
if (!res_extDataSource.getDatabasetype().equals("Oracle")) {
|
if (record.getSpacename() != null) {
|
record.setSpacename(null);
|
}
|
}
|
return resExtDataBaseService.insertSelective(record);
|
} else {
|
//更新
|
Res_ExtDataSource res_extDataSource = resExtDataSourceService.selectByPrimaryKey(record.getDatasourceid());
|
if (!res_extDataSource.getDatabasetype().equals("Oracle")) {
|
if (record.getSpacename() != null) {
|
record.setSpacename(null);
|
}
|
}
|
return resExtDataBaseService.updateByPrimaryKey(record);
|
}
|
}
|
|
//保存接口服务
|
@ResponseBody
|
public int saveInterFaceService(Res_ExtInterFaceService entity) {
|
Res_ExtInterFaceService res_extInterFaceService = resExtInterFaceService.selectByPrimaryKey(entity.getResourceid());
|
int result = 0;
|
if (res_extInterFaceService == null) {
|
resExtInterFaceService.insertSelective(entity);//添加
|
} else {
|
resExtInterFaceService.updateByPrimaryKeySelective(entity);//更新
|
}
|
return result;
|
}
|
|
//保存数据文件
|
@ResponseBody
|
public int saveExtFileSource(Res_ExtFileSource record, double savedsizenum) {
|
record.setFilesize(savedsizenum);
|
record.setServerurl(StringEscapeUtils.unescapeHtml(record.getServerurl()));
|
Res_ExtFileSource resExtFileSource = resExtFileSourceService.selectByPrimaryKey(record.getResourceid());
|
if (resExtFileSource == null) {
|
// 添加
|
if (record.getDownloadmodel().equals("FTP")) { // 把不属于FTP的字段设置为空
|
record.setGettype(null);
|
} else if (record.getDownloadmodel().equals("HTTP")) {
|
record.setFtpusername(null);
|
record.setFtppwd(null);
|
}
|
if (record.getSourcetype().equals("文件")) {
|
replaceRoute(record.getServerurl(), "temp");
|
record.setServerurl(record.getServerurl().replace("temp/", ""));
|
}
|
return resExtFileSourceService.insertSelective(record);
|
} else {
|
// 更新
|
if (record.getSourcetype().equals("文件")) {
|
replaceRoute(record.getServerurl(), "temp");
|
if (!record.getServerurl().equals("") && !resExtFileSource.getServerurl().equals("") && resExtFileSource.getStoragemode().equals("本地")) {
|
String path = resExtFileSource.getServerurl();
|
path = sysConfig.getUploadPath() + path;
|
File file = new File(path);
|
if (file.exists()) {
|
DelectEquealFile(record.getServerurl(), resExtFileSource.getServerurl());
|
}
|
}
|
record.setServerurl(record.getServerurl().replace("temp/", ""));
|
}
|
if (record.getDownloadmodel().equals("FTP")) {
|
record.setGettype(null);
|
} else if (record.getDownloadmodel().equals("HTTP")) {
|
record.setFtpusername(null);
|
record.setFtppwd(null);
|
}
|
// 如果文件资源类型改变则把原有的文件删除
|
if (!record.getSourcetype().equals(resExtFileSource.getSourcetype()) || record.getStoragemode().equals("远程")) {
|
String path = resExtFileSource.getServerurl();
|
if (resExtFileSource.getSourcetype().equals("文件夹") && resExtFileSource.getStoragemode().equals("本地")) {
|
path = sysConfig.getUploadPath() + path;
|
File file = new File(path);
|
if (file.exists()) {
|
DeleteFileUtils.deletefileUtils(path);
|
}
|
}
|
if (resExtFileSource.getSourcetype().equals("文件") && resExtFileSource.getStoragemode().equals("本地")) {
|
path = sysConfig.getUploadPath() + path;
|
File file = new File(path);
|
if (file.exists()) {
|
DeleteFileUtils.deletefileUtils(path);
|
}
|
}
|
}
|
return resExtFileSourceService.updateByPrimaryKey(record);
|
}
|
}
|
|
//保存业务集成
|
@ResponseBody
|
public int saveExtIntegrate(Res_ExtIntegrate record) {
|
Res_ExtIntegrate resExtIntegrate = resExtIntegrateService.selectByPrimaryKey(record.getResourceid());
|
if (record.getServerurl() != null && record.getServerurl().length() > 0) {
|
record.setServerurl(StringEscapeUtils.unescapeHtml(record.getServerurl()));
|
}
|
if (resExtIntegrate == null) {
|
//添加
|
if (record.getIntegratetype().equals("页面集成")) {
|
String showmodel = record.getShowmodel();
|
int id = record.getResourceid();
|
String url = record.getServerurl();
|
String type = record.getIntegratetype();
|
Res_ExtIntegrate res_extIntegrate = new Res_ExtIntegrate();
|
res_extIntegrate.setResourceid(id);
|
res_extIntegrate.setIntegratetype(type);
|
res_extIntegrate.setServerurl(url);
|
res_extIntegrate.setShowmodel(showmodel);
|
res_extIntegrate.setResolution(record.getResolution());
|
return resExtIntegrateService.insertSelective(res_extIntegrate);
|
}
|
if (record.getIntegratetype().equals("数据集成")) {
|
if (record.getShowmodel() != null) {
|
record.setShowmodel(null);
|
record.setResolution(null);
|
}
|
return resExtIntegrateService.insertSelective(record);
|
}
|
} else {
|
//更新
|
if (record.getIntegratetype().equals("页面集成")) {
|
String showmodel = record.getShowmodel();
|
int id = record.getResourceid();
|
String url = record.getServerurl();
|
String type = record.getIntegratetype();
|
Res_ExtIntegrate res_extIntegrate = new Res_ExtIntegrate();
|
res_extIntegrate.setResourceid(id);
|
res_extIntegrate.setIntegratetype(type);
|
res_extIntegrate.setServerurl(url);
|
res_extIntegrate.setShowmodel(showmodel);
|
res_extIntegrate.setResolution(record.getResolution());
|
return resExtIntegrateService.updateByPrimaryKeyWithBLOBs(res_extIntegrate);
|
}
|
if (record.getIntegratetype().equals("数据集成")) {
|
if (resExtIntegrate.getShowmodel() != null) { //集成类型改变,如果数据库的值不为空则清空
|
record.setShowmodel(null);
|
record.setResolution(null);
|
}
|
if (resExtIntegrate.getChartmodel() != null) {
|
record.setChartmodel(resExtIntegrate.getChartmodel());
|
}
|
if (resExtIntegrate.getChartheight() != null) {
|
record.setChartheight(resExtIntegrate.getChartheight());
|
}
|
if (resExtIntegrate.getChartwidth() != null) {
|
record.setChartwidth(resExtIntegrate.getChartwidth());
|
}
|
return resExtIntegrateService.updateByPrimaryKeyWithBLOBs(record);
|
}
|
}
|
return 0;
|
}
|
|
//保存基础底图
|
@ResponseBody
|
public int saveBaseMap(Res_ExtBaseMap record, String xianshibiliStart, String xianshibiliEnd, String extMapUrlStr) {
|
// 插入资源支持协议与地址表
|
resExtMapUrlService.deleteAndInsertMapUrlArray(record.getResourceid(), extMapUrlStr);
|
// 判断 id是否存在 存在就更新 不存在就 添加
|
Res_ExtBaseMap resExtBaseMap = resExtBaseMapService.selectByPrimaryKey(record.getResourceid());
|
if (!xianshibiliStart.isEmpty() && !xianshibiliEnd.isEmpty()) {
|
record.setDisplaylev(xianshibiliStart + "-" + xianshibiliEnd);
|
}
|
record.setResourceid(record.getResourceid());
|
if (resExtBaseMap == null) {
|
// 添加
|
if (!record.getBasemaptype().equals("影像")) { // 判断底图类型是否是影像,不是则令影像精度为空
|
record.setImageaccuracy(null);
|
}
|
return resExtBaseMapService.insertSelective(record);
|
} else {
|
// 更新
|
if (!record.getBasemaptype().equals("影像")) { // 判断底图类型是否是影像,不是则令影像精度为空
|
record.setImageaccuracy(null);
|
}
|
return resExtBaseMapService.updateByPrimaryKey(record);
|
}
|
}
|
|
//保存专题地图
|
@ResponseBody
|
public int saveThemeMap(Res_ExtThemeMap record, String extMapUrlStr) {
|
// 插入资源支持协议与地址表
|
resExtMapUrlService.deleteAndInsertMapUrlArray(record.getResourceid(), extMapUrlStr);
|
Res_ExtThemeMap resExtThemeMap = resExtThemeMapService.selectByPrimaryKey(record.getResourceid());
|
if (resExtThemeMap == null) {
|
//添加
|
if (!record.getLegendurl().isEmpty()) {
|
replaceRoute("temp/ResExtThemMapServer/" + record.getLegendurl(), "temp/");
|
}
|
return resExtThemeMapService.insertSelective(record);
|
} else {
|
//更新
|
String path = sysConfig.getUploadPath() + "ResExtThemMapServer/" + resExtThemeMap.getLegendurl();
|
File file = new File(path);
|
if (file.exists()) {
|
file.delete();
|
}
|
if (!record.getLegendurl().isEmpty()) {
|
replaceRoute("temp/ResExtThemMapServer/" + record.getLegendurl(), "temp/");
|
}
|
return resExtThemeMapService.updateByPrimaryKeyWithBLOBs(record);
|
}
|
}
|
|
//保存空间分析
|
@ResponseBody
|
public int saveSpaceServer(Res_ExtSpaceServerWithBLOBs record) {
|
Res_ExtSpaceServerWithBLOBs resExtSpaceServerWithBLOBs = resExtSpaceServerService.selectByPrimaryKey(record.getResourceid());
|
if (record.getHelpurl().length() != 0) {
|
record.setHelpurl(StringEscapeUtils.unescapeHtml(record.getHelpurl()));
|
}
|
if (resExtSpaceServerWithBLOBs == null) {
|
//添加
|
return resExtSpaceServerService.insertSelective(record);
|
} else {
|
//更新
|
return resExtSpaceServerService.updateByPrimaryKeyWithBLOBs(record);
|
}
|
}
|
|
//保存三维模型
|
@ResponseBody
|
public int save3D(Res_Ext3D record) {
|
Res_Ext3D res_ext3D = resExt3DService.selectByPrimaryKey(record.getResourceid());
|
if (res_ext3D == null) {
|
//添加
|
return resExt3DService.insertSelective(record);
|
} else {
|
//更新
|
return resExt3DService.updateByPrimaryKeySelective(record);
|
}
|
}
|
|
//保存业务图层
|
@ResponseBody
|
public int saveBusinessLayer(Res_ExtBusinessLayer record, String extMapUrlStr) {
|
// 插入资源支持协议与地址表
|
resExtMapUrlService.deleteAndInsertMapUrlArray(record.getResourceid(), extMapUrlStr);
|
// 判断 id是否存在 存在就更新 不存在就 添加
|
Res_ExtBusinessLayer resExtBusinessLayer = resExtBusinessLayerService.selectByPrimaryKey(record.getResourceid());
|
if (resExtBusinessLayer == null) {
|
// 添加
|
return resExtBusinessLayerService.insertSelective(record);
|
} else {
|
// 更新
|
return resExtBusinessLayerService.updateByPrimaryKeySelective(record);
|
}
|
}
|
|
//保存相关附件
|
@ResponseBody
|
public int saveFileData(Res_Files record, double savedsizenum, String filetype) {
|
record.setFilesize(savedsizenum);
|
record.setFiletype(filetype);
|
replaceRoute(record.getServerurl(), "temp");
|
record.setServerurl(record.getServerurl().replace("temp/", ""));
|
return resFilesService.insertSelective(record);
|
}
|
|
//保存数据文件展现方式
|
@ResponseBody
|
public int saveFileSourceWay(Res_MainInfo resMainInfo, String extMapUrlStr) {
|
// 删除id 对应的所有文件展示方式
|
try {
|
if (resMainInfo.getResourceid() != null) {
|
resFileSourceWayService.deleteByPrimaryKey(resMainInfo.getResourceid());
|
}
|
if (!extMapUrlStr.equals("")) {
|
String[] extMapUrlArray = extMapUrlStr.split("\\|");
|
// 插入资源支持协议与地址表
|
for (int i = 0; i < extMapUrlArray.length; i++) {
|
String[] extMapUrlArray2 = extMapUrlArray[i].split(",");
|
String Showway = extMapUrlArray2[0];
|
String url = extMapUrlArray2[1];
|
String remark = extMapUrlArray2[2];
|
Res_FileSource_Way resFileSourceWay = new Res_FileSource_Way();
|
resFileSourceWay.setShowway(Showway);
|
resFileSourceWay.setUrl(url);
|
resFileSourceWay.setRemark(remark);
|
resFileSourceWay.setResourceid(resMainInfo.getResourceid());
|
resFileSourceWay.setCreatedate(new Date());
|
resFileSourceWayService.insertSelective(resFileSourceWay);
|
}
|
}
|
return 1;
|
} catch (Exception e) {
|
return 0;
|
}
|
}
|
|
//替换路径
|
private void replaceRoute(@RequestBody String lujin, String replaceStr) {
|
String oldFileUrl = sysConfig.getUploadPath() + lujin.replace("/", "\\");
|
File oldFile = new File(oldFileUrl);
|
String NewFileUrl = sysConfig.getUploadPath() + lujin.replace(replaceStr, "").replace("/", "\\");
|
NewFileUrl = NewFileUrl.substring(0, NewFileUrl.lastIndexOf("\\")) + "\\";
|
File NewFile = new File(NewFileUrl);
|
if (!NewFile.exists()) { // 当前地址不为空,判断该路径是否存在,不存在则创建新的文件夹
|
File newfilePath = new File(NewFile + "\\"); // 创建对应的年月文件夹
|
newfilePath.mkdirs();
|
}
|
com.landtool.lanbase.common.utils.FileUtils.moveTotherFolders(oldFileUrl, NewFileUrl);
|
if (oldFile.exists()) {
|
oldFile.delete();
|
}
|
}
|
|
//删除相同文件
|
private void DelectEquealFile(@RequestBody String NEWString, String OLDString) {
|
String oldourl = OLDString.substring(OLDString.lastIndexOf("/"), OLDString.length());
|
String newurl = NEWString.substring(NEWString.lastIndexOf("/"), NEWString.length());
|
if (!oldourl.equals(newurl)) {
|
File OLDFile = new File(sysConfig.getUploadPath() + OLDString.replace("/", "\\"));
|
System.out.println(OLDFile);
|
OLDFile.delete();
|
}
|
}
|
|
/**
|
* 地图范围框选页面
|
*
|
* @param ResourceClass 资源类型(KJ_JCDT: 基础底图 KJ_ZTDT: 专题地图)
|
*/
|
@RequestMapping("/obtainExtentMapViewer")
|
public String obtainExtentMapViewer(String ResourceClass, Model model) {
|
model.addAttribute("ResourceClass", ResourceClass);//资源类型
|
model.addAttribute("pubzyWebRoot", sysConfig.getPubzyWebRoot());
|
model.addAttribute("obtainExtentMapUrl", sysConfig.getObtainExtentMapUrl());//框选地图底图URL
|
return "ResManage/NewResRegister/obtainExtentMapViewer";
|
}
|
}
|