package com.landtool.lanbase.modules.res.controller;
|
|
import java.io.File;
|
import java.io.UnsupportedEncodingException;
|
import java.net.URLEncoder;
|
import java.text.SimpleDateFormat;
|
import java.util.HashMap;
|
import java.util.Iterator;
|
import java.util.LinkedHashMap;
|
import java.util.LinkedList;
|
import java.util.List;
|
import java.util.Map;
|
|
import org.apache.shiro.authz.annotation.Logical;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
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.PathVariable;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
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_ActionRecord;
|
import com.landtool.lanbase.modules.res.entity.Res_Catalog;
|
import com.landtool.lanbase.modules.res.entity.Res_MainInfo;
|
import com.landtool.lanbase.modules.res.entity.UserDefined.CatlogJoinActionrecord;
|
import com.landtool.lanbase.modules.res.entity.UserDefined.MainInfoJoinActionRecord;
|
import com.landtool.lanbase.modules.res.entity.UserDefined.MainInfoJoinApplyRecommend;
|
import com.landtool.lanbase.modules.res.service.DiTuFuWuService;
|
import com.landtool.lanbase.modules.res.service.ResActionRecordService;
|
import com.landtool.lanbase.modules.res.service.ResApplyRecommendService;
|
import com.landtool.lanbase.modules.res.service.ResCatalogService;
|
import com.landtool.lanbase.modules.res.service.ResMainInfoService;
|
import com.landtool.lanbase.modules.sys.controller.AbstractController;
|
import com.landtool.lanbase.modules.sys.entity.SysFieldvalue;
|
import com.landtool.lanbase.modules.sys.service.SysFieldvalueService;
|
|
/**
|
* 地图服务
|
*/
|
@Controller
|
@RequestMapping("res/ditufuwu")
|
public class DiTuFuWuController extends AbstractController {
|
@Autowired
|
private SysTemPropertyConfig sysConfig;
|
|
@Autowired
|
private ResMainInfoService resMainInfoService;
|
|
@Autowired
|
private ResCatalogService resCatalogService;
|
|
@Autowired
|
private DiTuFuWuService diTuFuWuService;
|
|
@Autowired
|
private ResActionRecordService resActionRecordService;
|
|
@Autowired
|
private SysFieldvalueService FieldUtils;
|
|
@Autowired
|
private OrgUnitService orgUnitService;
|
|
@Autowired
|
private OrgUserService orgUserService;
|
|
@Autowired
|
private ResApplyRecommendService resApplyRecommendService;
|
|
@Autowired
|
private SysFieldvalueService sysFieldvalueService;
|
|
/**
|
* 地图服务 - 主页
|
*/
|
@RequestMapping("/indexbak")
|
public String index(Model model) {
|
// 资源使用情况
|
List<CatlogJoinActionrecord> List = resCatalogService.SelectMuLuCount(getMapResourceClass());
|
StringBuilder BianMu = new StringBuilder();
|
BianMu.append("[");
|
StringBuilder Liulan = new StringBuilder();
|
Liulan.append("[");
|
StringBuilder ShouCang = new StringBuilder();
|
ShouCang.append("[");
|
boolean HasShouCang = false;
|
boolean HasLiuLan = false;
|
List<Res_Catalog> MuLus = resCatalogService.selectResCatalogToParentid(0);
|
for (Res_Catalog MuLu : MuLus) {
|
Integer sc = 0;
|
Integer ll = 0;
|
for (CatlogJoinActionrecord Model : List) {
|
if (Model.catlogcode.substring(0,2).equals(MuLu.getCatlogcode()) ){
|
if (Model.ActionType.equals("收藏")) {
|
sc = Model.Count+sc;
|
} else {
|
ll = Model.Count+ll;
|
}
|
}
|
}
|
if (sc != 0 || ll != 0) {
|
BianMu.append("'" + MuLu.getTitle() + "'" + ",");
|
ShouCang.append(sc + ",");
|
Liulan.append(ll + ",");
|
}
|
}
|
BianMu.deleteCharAt(BianMu.length() - 1);
|
ShouCang.deleteCharAt(ShouCang.length() - 1);
|
Liulan.deleteCharAt(Liulan.length() - 1);
|
BianMu.append("]");
|
ShouCang.append("]");
|
Liulan.append("]");
|
model.addAttribute("BianMu", BianMu.toString());
|
model.addAttribute("ShouCang", ShouCang.toString());
|
model.addAttribute("Liulan", Liulan.toString());
|
model.addAttribute("backstageWebRoot", sysConfig.getApiServer() + "/");
|
model.addAttribute("pubzyWebRoot", sysConfig.getPubzyWebRoot());
|
model.addAttribute("systemName", sysConfig.getAppFullName());
|
model.addAttribute("gisPortal", sysConfig.getGisPortal());
|
model.addAttribute("userId", String.valueOf(getUserId()));
|
Long userid = getUserId();
|
Long unitId = orgUserService.getDefaultUnit(userid).getUnitid();
|
Map<String, Object> paramMap = new HashMap<String, Object>();
|
paramMap.put("appuserid", userid);
|
paramMap.put("appunitid", unitId);
|
paramMap.put("isDiTuFuwu", getMapResourceClass());
|
List<Res_MainInfo> resourceList = resApplyRecommendService.getAllRecommend(paramMap);
|
int recordCount = resourceList != null ? resourceList.size() : 0; // 记录总数
|
model.addAttribute("totalpNum", recordCount);
|
model.addAttribute("totalrNum", getMainInfoRecommendCount());
|
return "ditufuwu/index";
|
}
|
|
/**
|
* 获取热搜最多的关键字
|
*/
|
@ResponseBody
|
@GetMapping("/getTopHotSearchKey")
|
public Result getTopHotSearchKey() {
|
StringBuilder str = new StringBuilder();
|
List<String> list = resMainInfoService.selectTopHotSearch();
|
str.append("[");
|
|
List<Map<String, Object>> maps = new LinkedList<>();
|
for (int i = 0; i < list.size(); i++) {
|
Map<String, Object> map = new HashMap<>();
|
map.put("keyword", list.get(i));
|
maps.add(map);
|
}
|
return Result.ok().put("result", maps);
|
}
|
|
/**
|
* 地图服务 - 主页 - 热门搜索(保存搜索关键字)
|
*/
|
@ResponseBody
|
@RequestMapping("/saveHotSearch")
|
public void saveHotSearch(String searchKey) {
|
if(!"".equals(searchKey.trim())) {
|
String keyword = resMainInfoService.selectHotSearch(searchKey);
|
if (keyword == null) {
|
resMainInfoService.insertHotSearch(searchKey);
|
} else {
|
resMainInfoService.updateHotSearch(searchKey);
|
}
|
}
|
}
|
|
/**
|
* 访问排行 - 获取 N 条记录
|
*/
|
@ResponseBody
|
@RequestMapping("/getTopListFWPH")
|
public Result getTopListFWPH() {
|
List<Res_MainInfo> list = resActionRecordService.getTopList(10, "浏览", -1l, getMapResourceClass());
|
StringBuilder str = new StringBuilder();
|
str.append("[");
|
|
List<Map<String, Object>> maps = new LinkedList<>();
|
for (int i = 0; i < list.size(); i++) {
|
Map<String, Object> map = new HashMap<>();
|
map.put("title", list.get(i).getTitle());
|
map.put("fulltitle", list.get(i).getTitle());
|
map.put("resourceid", list.get(i).getResourceid());
|
maps.add(map);
|
|
// if (i != 0) {
|
// str.append(",");
|
// }
|
// str.append("{");
|
// String title = list.get(i).getTitle();
|
// if (list.get(i).getTitle().length() > 13) {
|
// title = CommonUtils.subStringUtils(title, 26);
|
// }
|
// str.append("'title':'" + title + "',");
|
// str.append("'fulltitle':'" + list.get(i).getTitle() + "',");
|
// str.append("'resourceid':'" + list.get(i).getResourceid() + "',");
|
// str.append("}");
|
}
|
return Result.ok().put("result", maps);
|
}
|
|
/**
|
* 我的收藏 - 更多页面
|
*/
|
@RequestMapping("/wodeshoucanggd")
|
public String wodeshoucanggd(Model model) {
|
// 获取下拉框目录
|
model.addAttribute("resourceTypeList", getWoDeDiTuClass("ResourceType"));
|
model.addAttribute("pubzyWebRoot", sysConfig.getPubzyWebRoot());
|
model.addAttribute("systemName", sysConfig.getAppFullName());
|
model.addAttribute("backstageWebRoot", sysConfig.getApiServer() + "/");
|
model.addAttribute("gisPortal", sysConfig.getGisPortal());
|
return "ditufuwu/wodeshoucanggd";
|
}
|
|
/**
|
* 我的收藏 - 更多页面,获取列表数据
|
*/
|
@ResponseBody
|
@RequestMapping("/getWoDeShouCangGD")
|
public Result getWoDeShouCangGD(Res_MainInfo resMainInfo, PageBean pageBean) {
|
Page<Res_MainInfo> page = PageHelper.startPage(pageBean.getPage(), pageBean.getLimit());
|
MainInfoJoinActionRecord record = new MainInfoJoinActionRecord();
|
|
record.setUserid(getUserId());
|
record.setActiontype("收藏");
|
record.setTitle(resMainInfo.getTitle());
|
record.setResourceclass(resMainInfo.getResourceclass());
|
record.setPubdateBegin(resMainInfo.getPubdateBegin());
|
record.setPubdatefinish(resMainInfo.getPubdatefinish());
|
|
Map<String, Object> paramMap = new HashMap<String, Object>();
|
paramMap.put("userid", getUserId());
|
paramMap.put("isDiTuFuwu", getMapResourceClass());
|
paramMap.put("title", resMainInfo.getTitle());
|
String type = "收藏";
|
paramMap.put("actiontype", type);
|
paramMap.put("resourceclass", resMainInfo.getResourceclass());
|
paramMap.put("pubdateBegin", resMainInfo.getPubdateBegin());
|
paramMap.put("pubdatefinish", resMainInfo.getPubdatefinish());
|
List<MainInfoJoinActionRecord> mainInfoJoinCatalogList = resActionRecordService.getListWDSC(paramMap);
|
int countNums = (int) ((Page) mainInfoJoinCatalogList).getTotal();
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
PageBean<MainInfoJoinActionRecord> pageData = new PageBean<>(pageBean.getPage(), pageBean.getLimit(), countNums);
|
pageData.setItems(mainInfoJoinCatalogList);
|
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 < mainInfoJoinCatalogList.size(); i++) {
|
String unitname = orgUnitService.getUnitName((long) mainInfoJoinCatalogList.get(i).getPubunitid());
|
leixin = ResourceTypeList.get(mainInfoJoinCatalogList.get(i).getResourceclass());
|
Map<String, Object> map = new HashMap<>();
|
map.put("resourceid", mainInfoJoinCatalogList.get(i).getResourceid());
|
map.put("title", mainInfoJoinCatalogList.get(i).getTitle());
|
map.put("resourceclass", leixin);
|
map.put("pubdate", sdf.format(mainInfoJoinCatalogList.get(i).getPubdate()));
|
map.put("pubunitname", unitname);
|
map.put("shoucangdate", sdf.format(mainInfoJoinCatalogList.get(i).getActiontime()));
|
maps.add(map);
|
|
}
|
return Result.ok().put("totalCount", countNums).put("topics", maps);
|
}
|
|
/**
|
* 访问排行 - 更多页面
|
*/
|
@RequestMapping("/fangwenpaihanggd")
|
public String fangwenpaihanggd(Model model) {
|
// 获取下拉框目录
|
model.addAttribute("ResourceTypeList", getWoDeDiTuClass("ResourceType"));
|
model.addAttribute("pubzyWebRoot", sysConfig.getPubzyWebRoot());
|
model.addAttribute("systemName", sysConfig.getAppFullName());
|
model.addAttribute("backstageWebRoot", sysConfig.getApiServer() + "/");
|
model.addAttribute("gisPortal", sysConfig.getGisPortal());
|
return "ditufuwu/fangwenpaihanggd";
|
}
|
|
/**
|
* 访问排行 - 更多页面,获取列表数据
|
*/
|
@ResponseBody
|
@RequestMapping("getFangWenPaiHangGD")
|
public Result getFangWenPaiHangGD(Res_MainInfo resMainInfo, PageBean pageBean) {
|
Page<Res_MainInfo> page = PageHelper.startPage(pageBean.getPage(), pageBean.getLimit());
|
|
Map<String, Object> paramMap = new HashMap<String, Object>();
|
paramMap.put("isDiTuFuwu", getMapResourceClass());
|
paramMap.put("title", resMainInfo.getTitle());
|
paramMap.put("resourceclass", resMainInfo.getResourceclass());
|
paramMap.put("pubdateBegin", resMainInfo.getPubdateBegin());
|
paramMap.put("pubdatefinish", resMainInfo.getPubdatefinish());
|
List<Res_MainInfo> mainInfoJoinCatalogList = resActionRecordService.getListFWPH(paramMap);
|
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 = "";
|
|
List<Map<String, Object>> maps = new LinkedList<>();
|
for (Integer i = 0; i < mainInfoJoinCatalogList.size(); i++) {
|
leixin = ResourceTypeList.get(mainInfoJoinCatalogList.get(i).getResourceclass());
|
String unitname = orgUnitService.getUnitName((long) mainInfoJoinCatalogList.get(i).getPubunitid());
|
Map<String, Object> map = new HashMap<>();
|
map.put("resourceid", mainInfoJoinCatalogList.get(i).getResourceid());
|
map.put("title", mainInfoJoinCatalogList.get(i).getTitle());
|
map.put("resourceclass", leixin);
|
map.put("pubdate", sdf.format(mainInfoJoinCatalogList.get(i).getPubdate()));
|
map.put("pubunitid", unitname);
|
map.put("fangwenpaihang", mainInfoJoinCatalogList.get(i).gett());
|
maps.add(map);
|
}
|
return Result.ok().put("totalCount", countNums).put("topics", maps);
|
}
|
|
/**
|
* 最新资源 - 获取 N 条记录
|
*/
|
@ResponseBody
|
@RequestMapping("/getTopListZXZY")
|
public Result getTopListZXZY() {
|
Map<String, Object> paramMap = new HashMap<String, Object>();
|
paramMap.put("isDiTuFuwu", getMapResourceClass());
|
paramMap.put("num", "8");
|
paramMap.put("userid", getUserId());
|
List<Res_MainInfo> list = diTuFuWuService.getZuiXinZiYuan(paramMap);
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
StringBuilder str = new StringBuilder();
|
str.append("[");
|
|
List<Map<String, Object>> maps = new LinkedList<>();
|
for (int i = 0; i < list.size(); i++) {
|
Map<String, Object> map = new HashMap<>();
|
map.put("title", list.get(i).getTitle());
|
map.put("fulltitle", list.get(i).getTitle());
|
map.put("resourceid", list.get(i).getResourceid());
|
map.put("pubdate", sdf.format(list.get(i).getPubdate()));
|
maps.add(map);
|
|
}
|
return Result.ok().put("result", maps);
|
}
|
|
/**
|
* 最新资源 - 更多页面
|
*/
|
@RequestMapping("/zuixinziyuangd")
|
public String zuixinziyuangd(Model model) {
|
// 获取下拉框目录
|
model.addAttribute("resourceTypeList", getWoDeDiTuClass("ResourceType"));
|
model.addAttribute("pubzyWebRoot", sysConfig.getPubzyWebRoot());
|
model.addAttribute("systemName", sysConfig.getAppFullName());
|
model.addAttribute("backstageWebRoot", sysConfig.getApiServer() + "/");
|
model.addAttribute("gisPortal", sysConfig.getGisPortal());
|
return "ditufuwu/zuixinziyuangd";
|
}
|
|
/**
|
* 最新资源 - 更多页面,获取列表数据
|
*/
|
@ResponseBody
|
@RequestMapping("/getZuiXinZiYuanGD")
|
public Result getZuiXinZiYuanGD(Res_MainInfo resMainInfo, PageBean pageBean) {
|
Page<Res_MainInfo> page = PageHelper.startPage(pageBean.getPage(), pageBean.getLimit());
|
Map<String, Object> paramMap = new HashMap<String, Object>();
|
paramMap.put("isDiTuFuwu", getMapResourceClass());
|
paramMap.put("title", resMainInfo.getTitle());
|
paramMap.put("resourceclass", resMainInfo.getResourceclass());
|
paramMap.put("pubdateBegin", resMainInfo.getPubdateBegin());
|
paramMap.put("pubdatefinish", resMainInfo.getPubdatefinish());
|
List<Res_MainInfo> resourceList = diTuFuWuService.getZuiXinZiYuanGD(paramMap); // 查询记录
|
int recordCount = (int) ((Page) resourceList).getTotal(); // 记录总数
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
PageBean<Res_MainInfo> pageData = new PageBean<>(pageBean.getPage(), pageBean.getLimit(), recordCount);
|
pageData.setItems(resourceList); // 设置分页
|
LinkedHashMap<String, String> resourceTypeList = FieldUtils.getFieldListByKey("ResourceType"); // 获取资源类型
|
// 创建 ExtJS 列表
|
|
List<Map<String, Object>> maps = new LinkedList<>();
|
for (Integer i = 0; i < resourceList.size(); i++) {
|
String unitname = orgUnitService.getUnitName((long) resourceList.get(i).getPubunitid());
|
Map<String, Object> map = new HashMap<>();
|
map.put("resourceid", resourceList.get(i).getResourceid());
|
map.put("title", resourceList.get(i).getTitle());
|
map.put("resourceclass", resourceTypeList.get(resourceList.get(i).getResourceclass()));
|
map.put("pubdate", sdf.format(resourceList.get(i).getPubdate()));
|
map.put("pubunitid", unitname);
|
maps.add(map);
|
}
|
return Result.ok().put("totalCount", recordCount).put("topics", maps);
|
}
|
|
/**
|
* 我的收藏夹 - 获取 N 条记录
|
*/
|
@ResponseBody
|
@RequestMapping("/getTopListWDSCJ")
|
public Result getTopListWDSCJ() {
|
Res_ActionRecord record = new Res_ActionRecord();
|
record.setUserid(getUserId());
|
record.setActiontype("收藏");
|
record.setIsDiTuFuwu(getMapResourceClass());
|
List<MainInfoJoinActionRecord> list = resActionRecordService.selectByActiontype(record);
|
// List<Res_MainInfo> list = resActionRecordService.getTopList(5, "收藏", getUserId(), getMapResourceClass());
|
StringBuilder str = new StringBuilder();
|
str.append("[");
|
|
List<Map<String, Object>> maps = new LinkedList<>();
|
for (int i = 0; i < list.size(); i++) {
|
Map<String, Object> map = new HashMap<>();
|
map.put("title", list.get(i).getTitle());
|
map.put("fulltitle", list.get(i).getTitle());
|
map.put("resourceid", list.get(i).getResourceid());
|
maps.add(map);
|
}
|
return Result.ok().put("result", maps);
|
}
|
|
// 获取地图服务的类型代码
|
private String getMapResourceClass() {
|
LinkedHashMap<String, String> resourceTypeList = FieldUtils.getFieldListByKey("ResourceType");
|
Iterator<Map.Entry<String, String>> iter = resourceTypeList.entrySet().iterator();
|
String dituTypes = "";
|
while (iter.hasNext()) {
|
Map.Entry entry = (Map.Entry) iter.next();
|
Object key = entry.getKey();
|
if (key.toString().startsWith("KJ_")) {
|
dituTypes += "'" + key.toString() + "',";
|
}
|
}
|
dituTypes = dituTypes.length() > 0 ? dituTypes.substring(0, dituTypes.length() - 1) : dituTypes;
|
return dituTypes;
|
}
|
|
public LinkedHashMap<String, String> getWoDeDiTuClass(String key) {
|
LinkedHashMap<String, String> map = new LinkedHashMap<String, String>();
|
List<SysFieldvalue> permsList = sysFieldvalueService.queryListByKey(key);
|
if (permsList != null) {
|
for (int i = 0; i < permsList.size(); i++) {
|
SysFieldvalue item = permsList.get(i);
|
if (item.getVcode().toString().startsWith("KJ_")) {
|
map.put(item.getVcode(), item.getVtext());
|
}
|
}
|
}
|
return map;
|
}
|
|
/**
|
* 我的申请资源 - 获取 N 条记录
|
*/
|
@ResponseBody
|
@RequestMapping("/getTopWDZY/{num}")
|
public Result getTopWDZY(@PathVariable(name = "num") Integer num) {
|
Integer appuserid = Math.toIntExact(getUserId());
|
Map<String, Object> paramMap = new HashMap<String, Object>();
|
paramMap.put("appuserid", appuserid);
|
paramMap.put("isDiTuFuwu", getMapResourceClass());
|
paramMap.put("num", num);
|
List<MainInfoJoinApplyRecommend> wdzyList = diTuFuWuService.getWoDeZiYuan(paramMap);
|
StringBuilder str = new StringBuilder();
|
str.append("[");
|
List<Map<String, Object>> maps = new LinkedList<>();
|
for (int i = 0; i < wdzyList.size(); i++) {
|
Map<String, Object> map = new HashMap<>();
|
map.put("title", wdzyList.get(i).getTitle());
|
map.put("fulltitle", wdzyList.get(i).getTitle());
|
map.put("auditresult", wdzyList.get(i).getAuditresult());
|
map.put("resourceid", wdzyList.get(i).getResourceid());
|
maps.add(map);
|
}
|
return Result.ok().put("result", maps);
|
}
|
|
/**
|
* 申请资源更多页面
|
*/
|
@RequestMapping("/ShenQingZiYuanGD")
|
public String ShenQingZiYuanGD(Model model) {
|
//获取下拉框目录
|
model.addAttribute("ResourceTypeList", getWoDeDiTuClass("ResourceType"));
|
model.addAttribute("pubzyWebRoot", sysConfig.getPubzyWebRoot());
|
model.addAttribute("systemName", sysConfig.getAppFullName());
|
model.addAttribute("gisPortal", sysConfig.getGisPortal());
|
return "ditufuwu/ShenQingZiYuanGD";
|
}
|
|
/**
|
* 我的申请资源 - 更多列表
|
* @param resMainInfo
|
* @param pageBean
|
* @return
|
*/
|
@ResponseBody
|
@RequestMapping("/getWoDeSQZiYuan")
|
public Result getWoDeSQZiYuan(Res_MainInfo resMainInfo, PageBean pageBean, Integer auditresult) {
|
Page<Res_MainInfo> page = PageHelper.startPage(pageBean.getPage(), pageBean.getLimit());
|
MainInfoJoinApplyRecommend record = new MainInfoJoinApplyRecommend();
|
|
Long userid = getUserId();
|
Long unitId = orgUserService.getDefaultUnit(userid).getUnitid();
|
Map<String, Object> paramMap = new HashMap<String, Object>();
|
paramMap.put("appuserid", userid);
|
paramMap.put("appunitid", unitId);
|
paramMap.put("isDiTuFuwu", getMapResourceClass());
|
paramMap.put("title", resMainInfo.getTitle());
|
paramMap.put("auditresult", auditresult);
|
paramMap.put("resourceclass", resMainInfo.getResourceclass());
|
paramMap.put("pubdateBegin", resMainInfo.getPubdateBegin());
|
paramMap.put("pubdatefinish", resMainInfo.getPubdatefinish());
|
List<MainInfoJoinApplyRecommend> mainInfoJoinCatalogList = diTuFuWuService.getWoDeSQZiYuan(paramMap);
|
int countNums = (int) ((Page) mainInfoJoinCatalogList).getTotal();
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
PageBean<MainInfoJoinApplyRecommend> pageData = new PageBean<>(pageBean.getPage(), pageBean.getLimit(), countNums);
|
pageData.setItems(mainInfoJoinCatalogList);
|
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 < mainInfoJoinCatalogList.size(); i++) {
|
Integer shenqingStatus = mainInfoJoinCatalogList.get(i).getAuditresult();
|
String shenqingStatusStr = "";
|
if (shenqingStatus != null) {
|
switch (shenqingStatus) {
|
case 0:
|
shenqingStatusStr = "未批复";
|
break;
|
case 1:
|
shenqingStatusStr = "已通过";
|
break;
|
case 2:
|
shenqingStatusStr = "未通过";
|
break;
|
}
|
} else {
|
shenqingStatusStr = "未批复";
|
}
|
leixin = ResourceTypeList.get(mainInfoJoinCatalogList.get(i).getResourceclass());
|
String unitname = orgUnitService.getUnitName((long) mainInfoJoinCatalogList.get(i).getPubunitid());
|
Map<String, Object> map = new HashMap<>();
|
map.put("resourceid", mainInfoJoinCatalogList.get(i).getResourceid());
|
map.put("appid", mainInfoJoinCatalogList.get(i).getAppid());
|
map.put("title", mainInfoJoinCatalogList.get(i).getTitle());
|
map.put("resourceclass", leixin);
|
map.put("shenqingdate", sdf.format(mainInfoJoinCatalogList.get(i).getAppdate()));
|
map.put("pubunitid", unitname);
|
map.put("shenqingstatus", shenqingStatusStr);
|
maps.add(map);
|
}
|
return Result.ok().put("totalCount", countNums).put("topics", maps);
|
}
|
|
/**
|
* 资源推荐更多页面--弃用
|
*/
|
@RequestMapping("ZiYuanTuiJianGD")
|
public String ZiYuanTuiJianGD(Model model) {
|
model.addAttribute("pubzyWebRoot", sysConfig.getPubzyWebRoot());
|
model.addAttribute("gisPortal", sysConfig.getGisPortal());
|
return "ditufuwu/ZiYuanTuiJianGD";
|
}
|
|
/**
|
* 资源推荐更多页面
|
*/
|
@RequestMapping("ziyuantuijian")
|
public String ziyuantuijian(Model model) {
|
// 获取下拉框目录
|
model.addAttribute("resourceTypeList", getWoDeDiTuClass("ResourceType"));
|
model.addAttribute("pubzyWebRoot", sysConfig.getPubzyWebRoot());
|
model.addAttribute("systemName", sysConfig.getAppFullName());
|
model.addAttribute("gisPortal", sysConfig.getGisPortal());
|
return "ditufuwu/ziyuantuijian";
|
}
|
|
/**
|
* 推荐资源 - 更多页面,获取列表数据
|
*/
|
@ResponseBody
|
@RequestMapping("/getTuiJianZiYuan")
|
public String getTuiJianZiYuan(Res_MainInfo resMainInfo, PageBean pageBean, boolean isDiTuFuwu) {
|
Page<Res_MainInfo> page = PageHelper.startPage(pageBean.getPage(), pageBean.getLimit());
|
Long userid = getUserId();
|
Long unitId = orgUserService.getDefaultUnit(userid).getUnitid();
|
Map<String, Object> paramMap = new HashMap<String, Object>();
|
paramMap.put("appuserid", userid);
|
paramMap.put("appunitid", unitId);
|
if (isDiTuFuwu) {
|
paramMap.put("isDiTuFuwu", getMapResourceClass());
|
} else {
|
paramMap.put("isDiTuFuwu", null);
|
}
|
paramMap.put("title", resMainInfo.getTitle());
|
paramMap.put("resourceclass", resMainInfo.getResourceclass());
|
paramMap.put("pubdateBegin", resMainInfo.getPubdateBegin());
|
List<Res_MainInfo> resourceList = resApplyRecommendService.getAllRecommend(paramMap);
|
int recordCount = (int) ((Page) resourceList).getTotal(); // 记录总数
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
PageBean<Res_MainInfo> pageData = new PageBean<>(pageBean.getPage(), pageBean.getLimit(), recordCount);
|
pageData.setItems(resourceList); // 设置分页
|
LinkedHashMap<String, String> resourceTypeList = FieldUtils.getFieldListByKey("ResourceType"); // 获取资源类型
|
// 创建 ExtJS 列表
|
StringBuilder rsb = new StringBuilder();
|
rsb.append("{'totalCount':'" + recordCount);
|
rsb.append("','topics':[");
|
for (Integer i = 0; i < resourceList.size(); i++) {
|
String unitname = orgUnitService.getUnitName((long) resourceList.get(i).getPubunitid());
|
|
if (i != 0) {
|
rsb.append(",");
|
}
|
rsb.append("{'resourceid':'" + resourceList.get(i).getResourceid() + "'"); // 资源id
|
rsb.append(",'title':'" + resourceList.get(i).getTitle() + "'"); // 资源名称
|
rsb.append(",'resourceclass':'" + resourceTypeList.get(resourceList.get(i).getResourceclass()) + "'"); // 资源类型
|
rsb.append(",'pubdate':'" + sdf.format(resourceList.get(i).getPubdate()) + "'"); // 发布时间
|
rsb.append(",'pubunitid':'" + unitname + "'"); // 发布单位名称
|
rsb.append("}");
|
}
|
rsb.append("]}");
|
return rsb.toString();
|
}
|
|
/**
|
* 定向推送(换一批)
|
*/
|
@ResponseBody
|
@RequestMapping("/getTuiJianZiYuanByIndex")
|
public Result getTuiJianZiYuanByIndex(Res_MainInfo resMainInfo, PageBean pageBean, boolean isDiTuFuwu) {
|
Page<Res_MainInfo> page = PageHelper.startPage(pageBean.getPage(), pageBean.getLimit());
|
Long userid = getUserId();
|
Long unitId = orgUserService.getDefaultUnit(userid).getUnitid();
|
Map<String, Object> paramMap = new HashMap<String, Object>();
|
paramMap.put("appuserid", userid);
|
paramMap.put("appunitid", unitId);
|
if (isDiTuFuwu) {
|
paramMap.put("isDiTuFuwu", getMapResourceClass());
|
} else {
|
paramMap.put("isDiTuFuwu", null);
|
}
|
List<Res_MainInfo> resourceList = resApplyRecommendService.getAllRecommend(paramMap);
|
int recordCount = (int) ((Page) resourceList).getTotal(); // 记录总数
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
PageBean<Res_MainInfo> pageData = new PageBean<>(pageBean.getPage(), pageBean.getLimit(), recordCount);
|
pageData.setItems(resourceList); // 设置分页
|
LinkedHashMap<String, String> resourceTypeList = FieldUtils.getFieldListByKey("ResourceType"); // 获取资源类型
|
// 创建 ExtJS 列表
|
StringBuilder rsb = new StringBuilder();
|
rsb.append("[");
|
|
List<Map<String, Object>> maps = new LinkedList<>();
|
for (Integer i = 0; i < resourceList.size(); i++) {
|
String unitname = orgUnitService.getUnitName((long) resourceList.get(i).getPubunitid());
|
Map<String, Object> map = new HashMap<>();
|
map.put("title", resourceList.get(i).getTitle());
|
map.put("resourceid", resourceList.get(i).getResourceid()); // 资源id
|
String description = resourceList.get(i).getDescription();
|
if (description != null && description.length() > 60) {
|
description = description.substring(0, 60) + "...";
|
try {
|
description = URLEncoder.encode(description, "utf-8").replace("+", "%20");
|
} catch (UnsupportedEncodingException e) {
|
e.printStackTrace();
|
}
|
map.put("description", description);
|
} else {
|
try {
|
if(description != null)
|
description = URLEncoder.encode(description, "utf-8").replace("+", "%20");
|
else description = "";
|
} catch (UnsupportedEncodingException e) {
|
e.printStackTrace();
|
}
|
map.put("description", description);
|
}
|
String fulldescription = resourceList.get(i).getDescription();
|
try {
|
if (fulldescription != null)
|
fulldescription = URLEncoder.encode(fulldescription, "utf-8").replace("+", "%20");
|
else fulldescription = "";
|
} catch (UnsupportedEncodingException e) {
|
e.printStackTrace();
|
}
|
map.put("fulldescription", fulldescription);
|
String path = null;
|
if (resourceList.get(i).getImgurl() != null && !resourceList.get(i).getImgurl().isEmpty()) {
|
if(resourceList.get(i).getImgurl().startsWith("Atkas")){//图集
|
path = "/image/" + resourceList.get(i).getImgurl();
|
File file = new File(System.getProperty("user.dir")+ "\\src\\main\\resources\\static" + ("/image/"+resourceList.get(i).getImgurl()).replace("/","\\"));
|
if (!file.exists()) { //判断物理路径是否存在,不存在则默认
|
path = "/image/classimg/" + resourceList.get(i).getResourceclass() + ".gif";
|
}
|
}else{
|
path = "/uploadPath/" + resourceList.get(i).getImgurl();
|
String filepath = sysConfig.getUploadPath() + resourceList.get(i).getImgurl();
|
File file = new File(filepath);
|
if (!file.exists()) { //判断物理路径是否存在,不存在则默认
|
path = "/image/classimg/" + resourceList.get(i).getResourceclass() + ".gif";
|
}
|
}
|
} else {
|
path = "/image/classimg/" + resourceList.get(i).getResourceclass() + ".gif";
|
}
|
map.put("imgurl", path);
|
maps.add(map);
|
}
|
return Result.ok().put("result", maps);
|
}
|
|
/**
|
* 资源推荐
|
*/
|
@ResponseBody
|
@RequestMapping("/getMainInfoRecommends")
|
public Result getMainInfoRecommends(Res_MainInfo resMainInfo, PageBean pageBean, boolean isDiTuFuwu) {
|
Long userid = getUserId();
|
Long unitId = orgUserService.getDefaultUnit(userid).getUnitid();
|
StringBuilder rsb = new StringBuilder();
|
//获取关键字
|
List<String> keyWords = resActionRecordService.selectKeyWordsByUserid(Integer.parseInt(userid.toString()));
|
|
List<Map<String, Object>> maps = new LinkedList<>();
|
if (keyWords != null && keyWords.size() > 0) {
|
// String keywordStrs = "";
|
// for (String k : keyWords) {
|
// if (k.indexOf(",") != -1) {
|
// String[] newks = k.split(",");
|
// for (String newk : newks) {
|
// if (keywordStrs.indexOf("'" + newk + "',") == -1) keywordStrs += "'" + newk + "',";
|
// }
|
// } else {
|
// if (keywordStrs.indexOf("'" + k + "',") == -1) keywordStrs += "'" + k + "',";
|
// }
|
// }
|
Map<String, Object> paramMap = new HashMap<String, Object>();
|
// paramMap.put("keywords", keywordStrs.substring(0, keywordStrs.length() - 1));
|
paramMap.put("userid", userid);
|
if (isDiTuFuwu) {
|
paramMap.put("isDiTuFuwu", getMapResourceClass());
|
} else {
|
paramMap.put("isDiTuFuwu", null);
|
}
|
Page<Res_MainInfo> page = PageHelper.startPage(pageBean.getPage(), pageBean.getLimit());
|
List<Res_MainInfo> resourceList = resActionRecordService.selectMainInfoRecommends(paramMap);
|
int recordCount = (int) ((Page) resourceList).getTotal(); // 记录总数
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
PageBean<Res_MainInfo> pageData = new PageBean<>(pageBean.getPage(), pageBean.getLimit(), recordCount);
|
pageData.setItems(resourceList); // 设置分页
|
LinkedHashMap<String, String> resourceTypeList = FieldUtils.getFieldListByKey("ResourceType"); // 获取资源类型
|
// rsb.append("[");
|
|
|
for (Integer i = 0; i < resourceList.size(); i++) {
|
String unitname = orgUnitService.getUnitName((long) resourceList.get(i).getPubunitid());
|
String description = resourceList.get(i).getDescription();
|
Map<String, Object> map = new HashMap<>();
|
|
if (description != null && description.length() > 60) {
|
description = description.substring(0, 60) + "...";
|
try {
|
description = URLEncoder.encode(description, "utf-8").replace("+", "%20");
|
} catch (UnsupportedEncodingException e) {
|
e.printStackTrace();
|
}
|
map.put("description", description);
|
} else {
|
try {
|
if(description != null)
|
description = URLEncoder.encode(description, "utf-8").replace("+", "%20");
|
else description = "";
|
} catch (UnsupportedEncodingException e) {
|
e.printStackTrace();
|
}
|
map.put("description", description);
|
}
|
String fulldescription = resourceList.get(i).getDescription();
|
try {
|
if(fulldescription != null)
|
fulldescription = URLEncoder.encode(fulldescription, "utf-8").replace("+", "%20");
|
else fulldescription = "";
|
} catch (UnsupportedEncodingException e) {
|
e.printStackTrace();
|
}
|
String path = null;
|
if (resourceList.get(i).getImgurl() != null && !resourceList.get(i).getImgurl().isEmpty()) {
|
if(resourceList.get(i).getImgurl().startsWith("Atkas")){//图集
|
path = "/image/" + resourceList.get(i).getImgurl();
|
File file = new File(System.getProperty("user.dir")+ "\\src\\main\\resources\\static" + ("/image/"+resourceList.get(i).getImgurl()).replace("/","\\"));
|
if (!file.exists()) { //判断物理路径是否存在,不存在则默认
|
path = "/image/classimg/" + resourceList.get(i).getResourceclass() + ".gif";
|
}
|
}else {
|
path = "/uploadPath/" + resourceList.get(i).getImgurl();
|
String filepath = sysConfig.getUploadPath() + resourceList.get(i).getImgurl();
|
File file = new File(filepath);
|
if (!file.exists()) { //判断物理路径是否存在,不存在则默认
|
path = "/image/classimg/" + resourceList.get(i).getResourceclass() + ".gif";
|
}
|
}
|
} else {
|
path = "/image/classimg/" + resourceList.get(i).getResourceclass() + ".gif";
|
}
|
|
map.put("title", resourceList.get(i).getTitle());
|
map.put("resourceid", resourceList.get(i).getResourceid());
|
map.put("fulldescription", fulldescription);
|
map.put("imgurl", path);
|
map.put("resourceclass", resourceList.get(i).getResourceclass());
|
maps.add(map);
|
|
}
|
}
|
return Result.ok().put("result", maps);
|
}
|
|
/**
|
* 资源推荐
|
*/
|
private int getMainInfoRecommendCount() {
|
Long userid = getUserId();
|
Long unitId = orgUserService.getDefaultUnit(userid).getUnitid();
|
int count = 0;
|
//获取关键字
|
List<String> keyWords = resActionRecordService.selectKeyWordsByUserid(Integer.parseInt(userid.toString()));
|
if (keyWords != null && keyWords.size() > 0) {
|
// String keywordStrs = "";
|
// for (String k : keyWords) {
|
// if (k.indexOf(",") != -1) {
|
// String[] newks = k.split(",");
|
// for (String newk : newks) {
|
// if (keywordStrs.indexOf("'" + newk + "',") == -1) keywordStrs += "'" + newk + "',";
|
// }
|
// } else {
|
// if (keywordStrs.indexOf("'" + k + "',") == -1) keywordStrs += "'" + k + "',";
|
// }
|
// }
|
Map<String, Object> paramMap = new HashMap<String, Object>();
|
// paramMap.put("keywords", keywordStrs.substring(0, keywordStrs.length() - 1));
|
paramMap.put("userid", userid);
|
paramMap.put("isDiTuFuwu", getMapResourceClass());
|
List<Res_MainInfo> resourceList = resActionRecordService.selectMainInfoRecommends(paramMap);
|
count = resourceList != null && resourceList.size() > 0 ? count = resourceList.size() : 0;
|
}
|
return count;
|
}
|
|
/**
|
* 新设计
|
*/
|
|
/**
|
* 地图服务 - 主页
|
*/
|
@RequestMapping("/index")
|
@RequiresPermissions(value = {"res:ditufuwu:index"}, logical = Logical.OR)
|
public String indexnew(Model model) {
|
//判断角色是否有访问该页面权限
|
|
// 资源使用情况
|
List<CatlogJoinActionrecord> List = resCatalogService.SelectMuLuCount(getMapResourceClass());
|
StringBuilder BianMu = new StringBuilder();
|
BianMu.append("[");
|
StringBuilder Liulan = new StringBuilder();
|
Liulan.append("[");
|
StringBuilder ShouCang = new StringBuilder();
|
ShouCang.append("[");
|
boolean HasShouCang = false;
|
boolean HasLiuLan = false;
|
List<Res_Catalog> MuLus = resCatalogService.selectResCatalogToParentid(0);
|
for (Res_Catalog MuLu : MuLus) {
|
Integer sc = 0;
|
Integer ll = 0;
|
for (CatlogJoinActionrecord Model : List) {
|
if (Model.catlogcode.substring(0,2).equals(MuLu.getCatlogcode()) ){
|
if (Model.ActionType.equals("收藏")) {
|
sc = Model.Count+sc;
|
} else {
|
ll = Model.Count+ll;
|
}
|
}
|
}
|
if (sc != 0 || ll != 0) {
|
BianMu.append("'" + MuLu.getTitle() + "'" + ",");
|
ShouCang.append(sc + ",");
|
Liulan.append(ll + ",");
|
}
|
}
|
BianMu.deleteCharAt(BianMu.length() - 1);
|
ShouCang.deleteCharAt(ShouCang.length() - 1);
|
Liulan.deleteCharAt(Liulan.length() - 1);
|
BianMu.append("]");
|
ShouCang.append("]");
|
Liulan.append("]");
|
model.addAttribute("BianMu", BianMu.toString());
|
model.addAttribute("ShouCang", ShouCang.toString());
|
model.addAttribute("Liulan", Liulan.toString());
|
model.addAttribute("backstageWebRoot", sysConfig.getApiServer() + "/");
|
model.addAttribute("pubzyWebRoot", sysConfig.getPubzyWebRoot());
|
model.addAttribute("systemName", sysConfig.getAppFullName());
|
model.addAttribute("gisPortal", sysConfig.getGisPortal());
|
model.addAttribute("userId", String.valueOf(getUserId()));
|
Long userid = getUserId();
|
Long unitId = orgUserService.getDefaultUnit(userid).getUnitid();
|
Map<String, Object> paramMap = new HashMap<String, Object>();
|
paramMap.put("appuserid", userid);
|
paramMap.put("appunitid", unitId);
|
paramMap.put("isDiTuFuwu", getMapResourceClass());
|
List<Res_MainInfo> resourceList = resApplyRecommendService.getAllRecommend(paramMap);
|
int recordCount = resourceList != null ? resourceList.size() : 0; // 记录总数
|
model.addAttribute("totalpNum", recordCount);
|
model.addAttribute("totalrNum", getMainInfoRecommendCount());
|
|
model.addAttribute("logourl","ditufuwutitle");
|
return "ditufuwu/New/index";
|
}
|
}
|