package com.zbooksoft.gdmis.controller; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.ruili.wcp.common.JSONUtil; import com.ruili.wcp.data.entity.config.DesktopLayout; import com.ruili.wcp.data.vo.config.DesktopLayoutVO; import com.ruili.wcp.service.config.DesktopLayoutService; import org.apache.shiro.authz.annotation.RequiresUser; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.servlet.ModelAndView; import java.sql.Array; import java.util.*; /** * @Description: 借阅 * @Author: zhai * @Date: 2024/8/28 **/ @Controller @RequestMapping("/screen") public class ScreenController { @Autowired DesktopLayoutService desktopLayoutService; private static final Logger logger = LoggerFactory.getLogger(ScreenController.class); @RequestMapping @RequiresUser public ModelAndView index(Long layoutId) { ModelAndView mav = new ModelAndView("/gh/screen/desktop"); DesktopLayout layout = this.desktopLayoutService.getById(layoutId); List rowList = JSONUtil.string2Obj(layout.getRowLayout(), ArrayList.class, new Class[]{DesktopLayoutVO.class}); mav.addObject("layout", layout); mav.addObject("rowList", rowList); return mav; } // 获取条件搜索的饼状图数据 @RequestMapping("/getSearchConditionEchartsPie") @ResponseBody public Object getSearchConditionEchartsPie() { JSONArray sourceList = new JSONArray(); HashMap map = new HashMap<>(); map.put("name", "原始资料"); map.put("value", 120); sourceList.add(map); HashMap map1 = new HashMap<>(); map1.put("name", "成果资料"); map1.put("value", 40); sourceList.add(map1); HashMap map2 = new HashMap<>(); map2.put("name", "实物资料"); map2.put("value", 70); sourceList.add(map2); return sourceList; } // 获取条件搜索的饼状图数据 @RequestMapping("/getBorrowEchartsPie") @ResponseBody public Object getBorrowEchartsPie() { HashMap result = new HashMap<>(); // 纸质借阅数据 JSONArray paperList = new JSONArray(); paperList.add(createDataMap("非密", 100)); paperList.add(createDataMap("内部", 80)); paperList.add(createDataMap("秘密", 60)); paperList.add(createDataMap("机密", 40)); // 电子借阅数据 JSONArray electronicList = new JSONArray(); electronicList.add(createDataMap("非密", 40)); electronicList.add(createDataMap("内部", 120)); electronicList.add(createDataMap("秘密", 70)); electronicList.add(createDataMap("机密", 50)); result.put("paperData", paperList); result.put("electronicData", electronicList); return result; } private HashMap createDataMap(String name, int value) { HashMap map = new HashMap<>(); map.put("name", name); map.put("value", value); return map; } // 获取条件搜索的柱状图数据 @RequestMapping("/getSearchConditionEchartsHistogram") @ResponseBody public Object getSearchConditionEchartsHistogram() { List xAxisData = new ArrayList(); xAxisData.add("海洋区域地质调查"); xAxisData.add("海岸带地质矿产调查"); xAxisData.add("大陆架地质矿产调查"); xAxisData.add("国际海底地质矿产调查"); xAxisData.add("极地地质调查"); xAxisData.add("其他海洋地质调查"); xAxisData.add("水工环地质勘查"); xAxisData.add("地质科学研究"); xAxisData.add("技术方法研究"); List seriesList = new ArrayList(); List yList = new ArrayList(); yList.add(10); yList.add(20); yList.add(80); yList.add(0); yList.add(30); yList.add(10); yList.add(40); yList.add(50); yList.add(60); JSONObject job = new JSONObject(); job.put("name", "档案数量"); job.put("type", "bar"); job.put("data", yList); seriesList.add(job); JSONObject json = new JSONObject(); json.put("xAxisData", xAxisData); json.put("seriesList", seriesList); return json; } // 获取条件搜索的柱状图数据 @RequestMapping("/getSearchCondition") @ResponseBody public Object getSearchCondition() { List xAxisData = new ArrayList(); xAxisData.add("一月"); xAxisData.add("二月"); xAxisData.add("三月"); xAxisData.add("四月"); xAxisData.add("五月"); xAxisData.add("六月"); xAxisData.add("七月"); xAxisData.add("八月"); xAxisData.add("九月"); xAxisData.add("十月"); xAxisData.add("十一月"); xAxisData.add("十二月"); List seriesList = new ArrayList(); List yList = new ArrayList(); yList.add(10); yList.add(20); yList.add(80); yList.add(0); yList.add(30); yList.add(15); yList.add(10); yList.add(40); yList.add(50); yList.add(60); yList.add(100); yList.add(60); JSONObject job = new JSONObject(); job.put("name", "档案数量"); job.put("type", "line"); job.put("data", yList); job.put("smooth", true); seriesList.add(job); JSONObject json = new JSONObject(); json.put("xAxisData", xAxisData); json.put("seriesList", seriesList); return json; } // 获取条件搜索的柱状图数据 @RequestMapping("/getSearchConditionByDeptName") @ResponseBody public Object getSearchConditionByDeptName() { List xAxisData = new ArrayList(); xAxisData.add("地质资料馆"); List seriesList = new ArrayList(); List yList = new ArrayList(); yList.add(45); JSONObject job = new JSONObject(); job.put("name", "档案数量"); job.put("type", "bar"); job.put("data", yList); seriesList.add(job); JSONObject json = new JSONObject(); json.put("xAxisData", xAxisData); json.put("seriesList", seriesList); return json; } // 获取条件搜索的柱状图数据 @RequestMapping("/getBorrowConditionByDeptName") @ResponseBody public Object getBorrowConditionByDeptName() { List xAxisData = new ArrayList(); xAxisData.add("杭州子书科技"); xAxisData.add("测试部门"); xAxisData.add("档案部门"); List seriesList = new ArrayList(); List yList = new ArrayList(); yList.add(45); JSONObject job = new JSONObject(); job.put("name", "原始"); job.put("type", "bar"); int[] data = {150, 120, 180}; job.put("data", data); seriesList.add(job); JSONObject job1 = new JSONObject(); job1.put("name", "成果"); job1.put("type", "bar"); int[] data1 = {200, 250, 180}; job1.put("data", data1); seriesList.add(job1); JSONObject job2 = new JSONObject(); job2.put("name", "实物"); job2.put("type", "bar"); int[] data2 = {200, 250, 180}; job2.put("data", data2); seriesList.add(job2); JSONObject json = new JSONObject(); json.put("xAxisData", xAxisData); json.put("seriesList", seriesList); return json; } }