package com.landtool.lanbase.modules.res.controller; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.serializer.SerializerFeature; import com.github.pagehelper.Page; import com.github.pagehelper.PageHelper; import com.landtool.lanbase.common.annotation.LogAction; import com.landtool.lanbase.common.utils.CommonUtils; import com.landtool.lanbase.common.utils.HttpOperateUtils; import com.landtool.lanbase.common.utils.Result; import com.landtool.lanbase.common.utils.TimeIntervalUtil; 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_ActionRecord; import com.landtool.lanbase.modules.res.entity.Res_MainInfo; import com.landtool.lanbase.modules.res.entity.UserDefined.MainInfoJoinActionRecord; import com.landtool.lanbase.modules.res.service.ResActionRecordService; import com.landtool.lanbase.modules.res.service.ResMainInfoService; import com.landtool.lanbase.modules.sys.controller.AbstractController; import com.landtool.lanbase.modules.sys.entity.SysSysteminfo; import com.landtool.lanbase.modules.sys.service.SysFieldvalueService; 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.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.sql.Timestamp; import java.text.SimpleDateFormat; import java.util.*; @Controller @RequestMapping("/res") public class ResActionRecordController extends AbstractController { @Autowired private ResActionRecordService resActionRecordService; @Autowired private ResMainInfoService resMainInfoService; @Autowired private SysTemPropertyConfig sysConfig; @Autowired private SysFieldvalueService fieldUtils; @Autowired private OrgUnitService orgUnitService; @Autowired private OrgUserService orgUserService; /** * 根据ID删除相关信息 */ @ResponseBody @RequestMapping("/resActionRecord/deleteByPrimaryKey") public int deleteByPrimaryKey(Integer actionid) { return resActionRecordService.deleteByPrimaryKey(actionid); } /** * 新增资源操作记录信息(所有字段不能为空) */ @ResponseBody @RequestMapping("/resActionRecord/insert") public int insert(Res_ActionRecord record) { return resActionRecordService.insert(record); } /** * 新增资源操作记录信息(可只插入必填字段) */ @ResponseBody @RequestMapping("/resActionRecord/insertSelective") public int insertSelective(Res_ActionRecord record) { return resActionRecordService.insertSelective(record); } /** * 根据Id查询相关信息 */ @ResponseBody @RequestMapping("/resActionRecord/selectByPrimaryKey") public Res_ActionRecord selectByPrimaryKey(Long actionid) { return resActionRecordService.selectByPrimaryKey(actionid); } /** * 根据Id更新部分字段 */ @ResponseBody @RequestMapping("/resActionRecord/updateByPrimaryKeySelective") public int updateByPrimaryKeySelective(Res_ActionRecord record) { return resActionRecordService.updateByPrimaryKeySelective(record); } /** * 根据ID更新所有字段 */ @ResponseBody @RequestMapping("/resActionRecord/updateByPrimaryKey") public int updateByPrimaryKey(Res_ActionRecord record) { return resActionRecordService.updateByPrimaryKey(record); } /** * @param record * @param actiontype * @return java.lang.String * @Description:根据操作类型查询相关信息列表 * @author ykm * */ @ResponseBody @RequestMapping("/resActionRecord/selectByActiontype") public Result selectByActiontype(Res_ActionRecord record, String actiontype) { record.setUserid(getUserId()); record.setActiontype(actiontype); List list = resActionRecordService.selectByActiontype(record); //浏览足迹 StringBuilder str = new StringBuilder(); // str.append("["); SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); List> maps = new LinkedList<>(); for (int i = 0; i < list.size(); i++) { Date actiontime = list.get(i).getActiontime(); //获取用户某笔记录的操作时间 String resulttime = sd.format(actiontime); //类型转换 String finaltime = TimeIntervalUtil.getInterval(resulttime); //执行时间间隔区间计算 // str.append("{"); String title = list.get(i).getTitle(); if (list.get(i).getTitle().length() > 15) { title = CommonUtils.subStringUtils(title, 30); } Map map = new HashMap<>(); map.put("title",title); map.put("fulltitle",list.get(i).getTitle()); map.put("resourceid",list.get(i).getResourceid()); map.put("finaltime",finaltime); maps.add(map); } // str.append("]"); // return str.toString(); return Result.ok().put("result",maps); } /** * @param resActionRecord * @param checked * @return java.lang.String * @Description:资源操作记录(浏览、下载、调用、收藏) * @author Xiexx */ @ResponseBody @RequestMapping("/resActionRecord/registerActionRecord") public String registerActionRecord(Res_ActionRecord resActionRecord, Boolean checked, HttpServletRequest request, Model model) { Timestamp audittime = new Timestamp(new Date().getTime());//获取当前时间 int row = 0;//操作数据库记录数 boolean success = false;//操作状态 String msg = "";//操作返回消息 int shoucangCount = 0; //收藏次数返回 try { if (resActionRecord.getActiontype().equals("收藏")) { resActionRecord.setUserid(getUserId()); Res_ActionRecord res_actionRecord = resActionRecordService.getUserActionRecord(resActionRecord); if (checked) { //用户收藏 if (res_actionRecord == null) { //无用户收藏该资源记录 resActionRecord.setUserid(getUserId()); //resActionRecord.setAppid(43);//系统ID resActionRecord.setActiontime(audittime); resActionRecord.setIp(request.getRemoteAddr()); row = resActionRecordService.insertSelective(resActionRecord); } else { //存在用户收藏该资源记录--更新操作时间 res_actionRecord.setActiontime(audittime); row = resActionRecordService.updateByPrimaryKeySelective(res_actionRecord); } success = true; msg = "收藏成功!"; } else { //用户取消收藏 if (res_actionRecord != null) { row = resActionRecordService.deleteByPrimaryKey(res_actionRecord.getActionid()); } success = true; msg = "取消收藏成功!"; } shoucangCount = resActionRecordService.selectResourceCount(resActionRecord); } else if (resActionRecord.getActiontype().equals("浏览")) { resActionRecord.setUserid(getUserId()); //resActionRecord.setAppid(43);//系统ID resActionRecord.setActiontime(audittime); resActionRecord.setIp(request.getRemoteAddr()); row = resActionRecordService.insertSelective(resActionRecord); } else { resActionRecord.setUserid(getUserId()); //resActionRecord.setAppid(43);//系统ID resActionRecord.setActiontime(audittime); resActionRecord.setIp(request.getRemoteAddr()); row = resActionRecordService.insertSelective(resActionRecord); success = true; msg = "操作成功!"; } } catch (Exception e) { return "{success:false, msg:'操作失败!提示:" + e.getMessage() + "', shoucangCount:'" + shoucangCount + "'}"; } return "{success:" + success + ", msg:'" + msg + "', shoucangCount:'" + shoucangCount + "'}"; } /** * @param * @return * @Description: * @author ykm * @date 2018/3/31 16:47 */ @ResponseBody @RequestMapping("/resActionRecord/selectFangWenPaiHang") public Result selectFangWenPaiHang() { List list = resActionRecordService.selectFangWenPaiHang(); List> maps = new LinkedList<>(); for (int i = 0; i < list.size(); i++) { Map 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); } //访问排行导出 @ResponseBody @RequestMapping("resActionRecord/FangWenPaiHangexcel") public String FangWenPaiHangexcel(HttpServletResponse response, Res_MainInfo resMainInfo) { List mainInfoJoinCatalogList = resMainInfoService.selectResMainInfoFangWenPaiHang(resMainInfo); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); LinkedHashMap ResourceTypeList = fieldUtils.getFieldListByKey("ResourceType");//获取资源类型列表 StringBuilder rsb = new StringBuilder(); String leixin = ""; // rsb.append("{'totalCount':'" + ""); // rsb.append("','topics':["); List> 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());// obj1.getString("unitname"); Map 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); } rsb.append("]}"); String a[] = {"资源id", "资源名称", "资源类型", "发布单位", "发布时间", "访问次数"}; try { String Filename = Excel.FWPHgoing(response, a, JSON.toJSONString(maps, SerializerFeature.WriteMapNullValue), sysConfig.getUploadPath() + "excel\\"); String path2 = "/uploadPath/excel/"; String desFile = path2 + Filename; System.out.println(desFile); return desFile; } catch (IOException e) { e.printStackTrace(); return null; } } /** * 查询我的收藏列表功能 */ @ResponseBody @RequestMapping("/resActionRecord/selectWoDeShouCangJiaGD") public Result selectWoDeShouCangJiaGD(Res_MainInfo resMainInfo, PageBean pageBean) { Page 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()); List mainInfoJoinCatalogList = resActionRecordService.selectResMainInfoWodeShouCang(record); int countNums = (int) ((Page) mainInfoJoinCatalogList).getTotal(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); PageBean pageData = new PageBean<>(pageBean.getPage(), pageBean.getLimit(), countNums); pageData.setItems(mainInfoJoinCatalogList); LinkedHashMap ResourceTypeList = fieldUtils.getFieldListByKey("ResourceType");//获取资源类型列表 StringBuilder rsb = new StringBuilder(); String leixin = ""; //修改因英文单引号 '和双引号" 导致的错误 alert ykm 2019/01/08 List> 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 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("topics",maps).put("totalCount",countNums); } //我的收藏导出 @ResponseBody @RequestMapping("resActionRecord/WoDeShouCangexcel") public String WoDeShouCangexcel(HttpServletResponse response, Res_MainInfo resMainInfo) { 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()); List mainInfoJoinCatalogList = resActionRecordService.selectResMainInfoWodeShouCang(record); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); LinkedHashMap ResourceTypeList = fieldUtils.getFieldListByKey("ResourceType");//获取资源类型列表 StringBuilder rsb = new StringBuilder(); String leixin = ""; //修改因英文单引号 '和双引号" 导致的错误 alert ykm 2019/01/08 List> 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 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); } String a[] = {"资源id", "资源名称", "资源类型", "发布单位", "收藏时间"}; try { String Filename = Excel.SCgoing(response, a, JSON.toJSONString(maps, SerializerFeature.WriteMapNullValue), sysConfig.getUploadPath() + "excel\\"); String path2 = "/uploadPath/excel/"; String desFile = path2 + Filename; System.out.println(desFile); return desFile; } catch (IOException e) { e.printStackTrace(); return null; } } /** * 最新资源更多页面 */ @RequestMapping("/resActionRecord/ZuiXinZiYuanGD") public String ZuiXinZiYuanGD(Model model) { //获取下拉框目录 LinkedHashMap ResourceTypeList = fieldUtils.getFieldListByKey("ResourceType");//获取资源类型列表 model.addAttribute("ResourceTypeList", ResourceTypeList); model.addAttribute("systemName", sysConfig.getAppFullName()); model.addAttribute("pubzyWebRoot", sysConfig.getPubzyWebRoot()); model.addAttribute("backstageWebRoot", sysConfig.getApiServer() + "/"); model.addAttribute("gisPortal", sysConfig.getGisPortal()); return "ResActionRecord/ZuiXinZiYuanGD"; } /** * 查询最新资源列表功能 */ @ResponseBody @RequestMapping("/resActionRecord/selectZuiXinZiYuanGD") public Result selectZuiXinZiYuanGD(Res_MainInfo resMainInfo, PageBean pageBean) { Page page = PageHelper.startPage(pageBean.getPage(), pageBean.getLimit()); List mainInfoJoinCatalogList = resActionRecordService.selectResMainInfoZuiXinZiYuan(resMainInfo); int countNums = (int) ((Page) mainInfoJoinCatalogList).getTotal(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); PageBean pageData = new PageBean<>(pageBean.getPage(), pageBean.getLimit(), countNums); pageData.setItems(mainInfoJoinCatalogList); LinkedHashMap ResourceTypeList = fieldUtils.getFieldListByKey("ResourceType");//获取资源类型列表 String leixin = ""; List> 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 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); maps.add(map); } return Result.ok().put("totalCount", countNums).put("topics", maps); } //最新资源导出 @ResponseBody @RequestMapping("resActionRecord/ZuiXinZiYuanexcel") public String ZuiXinZiYuanexcel(HttpServletResponse response, Res_MainInfo resMainInfo) { List mainInfoJoinCatalogList = resActionRecordService.selectResMainInfoZuiXinZiYuan(resMainInfo); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); LinkedHashMap ResourceTypeList = fieldUtils.getFieldListByKey("ResourceType");//获取资源类型列表 String leixin = ""; List> 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 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); maps.add(map); } String a[] = {"资源id", "资源名称", "资源类型", "发布单位", "发布时间"}; try { String Filename = Excel.ZXgoing(response, a, JSON.toJSONString(maps, SerializerFeature.WriteMapNullValue), sysConfig.getUploadPath() + "excel\\"); String path2 = "/uploadPath/excel/"; String desFile = path2 + Filename; System.out.println(desFile); return desFile; } catch (IOException e) { e.printStackTrace(); return null; } } /** * 申请资源更多页面 */ @RequestMapping("/resActionRecord/ShenQingZiYuanGD") public String ShenQingZiYuanGD(Model model) { //获取下拉框目录 LinkedHashMap ResourceTypeList = fieldUtils.getFieldListByKey("ResourceType");//获取资源类型列表 model.addAttribute("ResourceTypeList", ResourceTypeList); model.addAttribute("pubzyWebRoot", sysConfig.getPubzyWebRoot()); model.addAttribute("systemName", sysConfig.getAppFullName()); model.addAttribute("backstageWebRoot", sysConfig.getApiServer() + "/"); model.addAttribute("gisPortal", sysConfig.getGisPortal()); return "ResActionRecord/ShenQingZiYuanGD"; } // ============================================================================ // 后台管理 // ============================================================================ /** * 后台管理 - 列表页面 */ @RequestMapping("/manage/actionrecord/index") public String index(Model model) { model.addAttribute("pubzyWebRoot", sysConfig.getPubzyWebRoot()); model.addAttribute("systemName", sysConfig.getAppFullName()); return "manage/actionrecord/index"; } /** * 后台管理 - 获取列表 */ @ResponseBody @RequestMapping("/manage/actionrecord/getlist") @LogAction("运维监控,资源操作日志,资源操作日志查询,查询") public Result getList(MainInfoJoinActionRecord resActionRecord, PageBean pageBean) { PageHelper.startPage(pageBean.getPage(), pageBean.getLimit()); // 查询当前登陆用户是否是超级管理员 是:查所有 不是:查自己的 if (!SecurityUtils.getSubject().isPermitted("org_user_admin")) { // 如果是超级管理员,不添加用户id,查询所有。如果不是 添加id 查询单个 resActionRecord.setExistpermission(getUserId().toString()); } List list = resActionRecordService.selectActionRecordJoinMainInfo(resActionRecord); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); int countNums = (int) ((Page) list).getTotal(); PageBean pageData = new PageBean<>(pageBean.getPage(), pageBean.getLimit(), countNums); pageData.setItems(list); List> maps = new LinkedList<>(); for (Integer i = 0; i < list.size(); i++) { // 查询id对应的name String auditname = ""; String username = ""; if (list.get(i).getUserid() != null) { OrgUser eobj = orgUserService.queryObject(list.get(i).getUserid()); username = eobj != null ? eobj.getChinesename() : ""; } Map map = new HashMap<>(); map.put("resourceid", list.get(i).getResourceid()); map.put("actionid", list.get(i).getActionid()); map.put("title", list.get(i).getTitle()); map.put("username", username); map.put("actiontime", sdf.format(list.get(i).getActiontime())); map.put("actiontype", list.get(i).getActiontype()); map.put("appfullname", getAppFullNameById(list.get(i).getAppid())); map.put("ip", (list.get(i).getIp() != null && !list.get(i).getIp().isEmpty() ? list.get(i).getIp() : "")); maps.add(map); } return Result.ok().put("totalCount", countNums).put("topics", maps); } //获取系统名称 private String getAppFullNameById(Integer id) { String appname = ""; if (id != null) { try { String url = sysConfig.getApiServer() + "/api/sys/systeminfo/getSysteminfoById/" + id; SysSysteminfo info = HttpOperateUtils.getJsonObject(url, SysSysteminfo.class); if (info != null) { appname = info.getAppfullname(); } } catch (IOException e) { e.printStackTrace(); } } return appname; } /** * 获取应用程序的资源调用次数 */ @ResponseBody @RequestMapping("/manage/actionrecord/selectAppCount") public Result selectAppCount(Integer resourceid, PageBean pageBean) { Map map = new HashMap<>(); PageHelper.startPage(pageBean.getPage(), pageBean.getLimit()); String ids = getAppIdList(); map.put("resourceid", resourceid); map.put("actiontype", "调用"); map.put("ids", ids.substring(1,ids.length()-1)); List list = resActionRecordService.queryAppByResourceid(map); int countNums = (int) ((Page) list).getTotal(); //int countNums = list.size(); PageBean pageData = new PageBean<>(pageBean.getPage(), pageBean.getLimit(), countNums); pageData.setItems(list); List> maps = new LinkedList<>(); for(Res_ActionRecord actionRecord : list) { // 统计该资源的调用次数 int countResult = resActionRecordService.selectResourceCount(actionRecord); String appname = getAppFullNameById(actionRecord.getAppid()); if(appname != null && !appname.equals("")) { Map tmap = new HashMap<>(); tmap.put("count", countResult); tmap.put("resourceid", actionRecord.getResourceid()); tmap.put("appfullname", appname); maps.add(tmap); } } return Result.ok().put("totalCount", countNums).put("topics", maps); } @RequestMapping("/manage/actionrecord/appcount") public String appcount(Model model, Integer resourceid) { model.addAttribute("pubzyWebRoot", sysConfig.getPubzyWebRoot()); model.addAttribute("resourceid", resourceid); return "manage/applyrecommend/AppCount"; } @RequestMapping("/manage/actionrecord/apptotalcount") public String apptotalcount(Model model) { model.addAttribute("pubzyWebRoot", sysConfig.getPubzyWebRoot()); return "manage/actionrecord/AppTotalCount"; } @RequestMapping("/manage/actionrecord/appresource") public String appresource(Model model, Integer appid) { model.addAttribute("pubzyWebRoot", sysConfig.getPubzyWebRoot()); model.addAttribute("appid", appid); return "manage/actionrecord/AppResource"; } @ResponseBody @RequestMapping("/manage/actionrecord/selectAppTotalCount") public Result selectAppTotalCount(PageBean pageBean) { PageHelper.startPage(pageBean.getPage(), pageBean.getLimit()); String ids = getAppIdList(); Map param = new HashMap<>(); param.put("ids", ids.substring(1,ids.length()-1)); List list = resActionRecordService.queryAppActionCount(param); int countNums = (int) ((Page) list).getTotal(); //int countNums = list.size(); PageBean pageData = new PageBean<>(pageBean.getPage(), pageBean.getLimit(), countNums); pageData.setItems(list); List> maps = new LinkedList<>(); for(Res_ActionRecord actionRecord : list) { // 统计该资源的调用次数 String appname = getAppFullNameById(actionRecord.getAppid()); if(appname != null && !appname.equals("")) { Map tmap = new HashMap<>(); tmap.put("count", actionRecord.getActioncount()); tmap.put("appid", actionRecord.getAppid()); tmap.put("appfullname", appname); maps.add(tmap); } } return Result.ok().put("totalCount", countNums).put("topics", maps); } //获取系统id private String getAppIdList() { String ids = ""; try { String url = sysConfig.getApiServer() + "/api/sys/systeminfo/getSysteminfoIdList"; ids = HttpOperateUtils.httpGet(url); } catch (IOException e) { e.printStackTrace(); } return ids; } @ResponseBody @RequestMapping("/manage/actionrecord/selectResourceByAppid") public Result selectResourceByAppid(PageBean pageBean, Integer appid) { PageHelper.startPage(pageBean.getPage(), pageBean.getLimit()); Map param = new HashMap<>(); param.put("appid", appid); List list = resActionRecordService.queryResourceByAppid(param); int countNums = (int) ((Page) list).getTotal(); PageBean pageData = new PageBean<>(pageBean.getPage(), pageBean.getLimit(), countNums); pageData.setItems(list); List> maps = new LinkedList<>(); for(Res_ActionRecord actionRecord : list) { // 统计该资源的调用次数 Map tmap = new HashMap<>(); tmap.put("count", actionRecord.getActioncount()); tmap.put("resourceid", actionRecord.getResourceid()); tmap.put("title", actionRecord.getResourcename()); maps.add(tmap); } return Result.ok().put("totalCount", countNums).put("topics", maps); } }