|
@@ -1,5 +1,13 @@
|
|
package com.jeeplus.modules.sg.report.web;
|
|
package com.jeeplus.modules.sg.report.web;
|
|
|
|
|
|
|
|
+import com.github.abel533.echarts.axis.*;
|
|
|
|
+import com.github.abel533.echarts.code.Magic;
|
|
|
|
+import com.github.abel533.echarts.code.Tool;
|
|
|
|
+import com.github.abel533.echarts.code.Trigger;
|
|
|
|
+import com.github.abel533.echarts.feature.MagicType;
|
|
|
|
+import com.github.abel533.echarts.json.GsonOption;
|
|
|
|
+import com.github.abel533.echarts.series.Bar;
|
|
|
|
+import com.jeeplus.common.utils.StringUtils;
|
|
import com.jeeplus.core.persistence.Page;
|
|
import com.jeeplus.core.persistence.Page;
|
|
import com.jeeplus.modules.sg.report.entity.SgReport;
|
|
import com.jeeplus.modules.sg.report.entity.SgReport;
|
|
import com.jeeplus.modules.sg.report.service.ReportService;
|
|
import com.jeeplus.modules.sg.report.service.ReportService;
|
|
@@ -25,20 +33,47 @@ public class ReportController {
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 项目报表页面
|
|
|
|
|
|
+ * 施工单位项目报表页面
|
|
*/
|
|
*/
|
|
@RequestMapping(value = {"list", ""})
|
|
@RequestMapping(value = {"list", ""})
|
|
public String list(SgReport sgReport, Model model) {
|
|
public String list(SgReport sgReport, Model model) {
|
|
|
|
+ String status = sgReport.getStatus();
|
|
model.addAttribute("sgReport", sgReport);
|
|
model.addAttribute("sgReport", sgReport);
|
|
List<SgReport> list = reportService.findData();
|
|
List<SgReport> list = reportService.findData();
|
|
- List<SgReport> list1 = reportService.findList(sgReport);
|
|
|
|
|
|
+// List<SgReport> list1 = reportService.findList(sgReport);
|
|
model.addAttribute("list",list);
|
|
model.addAttribute("list",list);
|
|
- model.addAttribute("list1",list1);
|
|
|
|
- model.addAttribute("dataURL", "/echarts/bar/sample3/option");
|
|
|
|
|
|
+// model.addAttribute("list1",list1);
|
|
|
|
+ if(StringUtils.isNotBlank(status)) {
|
|
|
|
+ model.addAttribute("dataURL", "/sg/report/option?status=" + status);
|
|
|
|
+ }else {
|
|
|
|
+ model.addAttribute("dataURL", "/sg/report/option");
|
|
|
|
+ }
|
|
return "modules/sg/report/reportList";
|
|
return "modules/sg/report/reportList";
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
|
|
+ * 归口部门项目报表
|
|
|
|
+ */
|
|
|
|
+ @RequestMapping("/unitlist")
|
|
|
|
+ public String list1(SgReport sgReport, Model model) {
|
|
|
|
+ String status = sgReport.getStatus();
|
|
|
|
+ model.addAttribute("sgReport", sgReport);
|
|
|
|
+ List<SgReport> list = reportService.findUnitData();
|
|
|
|
+// List<SgReport> list1 = reportService.findList(sgReport);
|
|
|
|
+ model.addAttribute("list",list);
|
|
|
|
+// model.addAttribute("list1",list1);
|
|
|
|
+ if(StringUtils.isNotBlank(status)) {
|
|
|
|
+ model.addAttribute("dataURL", "/sg/report/unitoption?status=" + status);
|
|
|
|
+ }else {
|
|
|
|
+ model.addAttribute("dataURL", "/sg/report/unitoption");
|
|
|
|
+ }
|
|
|
|
+ return "modules/sg/report/reportList1";
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
* 项目报表数据
|
|
* 项目报表数据
|
|
*/
|
|
*/
|
|
@ResponseBody
|
|
@ResponseBody
|
|
@@ -50,4 +85,134 @@ public class ReportController {
|
|
return map;
|
|
return map;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @ResponseBody
|
|
|
|
+ @RequestMapping("option")
|
|
|
|
+ public GsonOption getOption(HttpServletRequest request){
|
|
|
|
+ String status = request.getParameter("status");
|
|
|
|
+ SgReport sgReport = new SgReport();
|
|
|
|
+ sgReport.setStatus(status);
|
|
|
|
+ List<SgReport> list = reportService.findList(sgReport);
|
|
|
|
+ String[] str = new String[list.size()];
|
|
|
|
+ int[] level1 = new int[list.size()];
|
|
|
|
+ int[] level2 = new int[list.size()];
|
|
|
|
+ int[] level3 = new int[list.size()];
|
|
|
|
+ int[] level4 = new int[list.size()];
|
|
|
|
+ for(int i=0;i<list.size();i++){
|
|
|
|
+ str[i] = list.get(i).getName();
|
|
|
|
+ level1[i] = list.get(i).getLevel1();
|
|
|
|
+ level2[i] = list.get(i).getLevel2();
|
|
|
|
+ level3[i] = list.get(i).getLevel3();
|
|
|
|
+ level4[i] = list.get(i).getLevel4();
|
|
|
|
+ }
|
|
|
|
+ GsonOption option = new GsonOption();
|
|
|
|
+// option.title("ECharts2 vs ECharts1", "Chrome下测试数据");
|
|
|
|
+ option.tooltip(Trigger.axis);
|
|
|
|
+ option.legend(
|
|
|
|
+ "1-7天", "8-14天", "15-21天",
|
|
|
|
+ "21天以上");
|
|
|
|
+ option.toolbox().show(true)
|
|
|
|
+ .feature(
|
|
|
|
+ Tool.mark, Tool.dataView,
|
|
|
|
+ new MagicType(Magic.line, Magic.bar),
|
|
|
|
+ Tool.restore, Tool.saveAsImage);
|
|
|
|
+ option.calculable(true);
|
|
|
|
+ option.grid().y(70).y2(30).x2(60).bottom(120);
|
|
|
|
+ CategoryAxis categoryAxis = new CategoryAxis();
|
|
|
|
+ for(int j=0;j<str.length;j++){
|
|
|
|
+ categoryAxis.data(str[j]);
|
|
|
|
+ }
|
|
|
|
+ option.xAxis(
|
|
|
|
+ categoryAxis.axisLabel(new AxisLabel().rotate(40).interval(0))
|
|
|
|
+// new CategoryAxis()
|
|
|
|
+// .axisLine(new AxisLine().show(false))
|
|
|
|
+// .axisTick(new AxisTick().show(false))
|
|
|
|
+// .axisLabel(new AxisLabel().show(false))
|
|
|
|
+// .splitArea(new SplitArea().show(false))
|
|
|
|
+// .axisLine(new AxisLine().show(false))
|
|
|
|
+// .data("Line", "Bar")
|
|
|
|
+ );
|
|
|
|
+ option.yAxis(new ValueAxis().axisLabel(new AxisLabel().formatter("{value} 个")));
|
|
|
|
+ Bar b1 = new Bar("1-7天");
|
|
|
|
+ b1.itemStyle().normal().color("rgba(193,35,43,0.5)").label().show(true);
|
|
|
|
+ Bar b2 = new Bar("8-14天");
|
|
|
|
+ b2.itemStyle().normal().color("rgba(181,195,52,1)").label().show(true).textStyle().color("#27727B");
|
|
|
|
+ Bar b3 = new Bar("15-21天");
|
|
|
|
+ b3.itemStyle().normal().color("rgba(252,206,16,1)").label().show(true).textStyle().color("#E87C25");
|
|
|
|
+ Bar b4 = new Bar("21天以上");
|
|
|
|
+ b4.itemStyle().normal().color("rgba(193,35,43,1)").label().show(true);
|
|
|
|
+ for (int k=0;k<list.size();k++){
|
|
|
|
+ b1.data(level1[k] );
|
|
|
|
+ b2.data(level2[k] );
|
|
|
|
+ b3.data(level3[k] );
|
|
|
|
+ b4.data(level4[k] );
|
|
|
|
+ }
|
|
|
|
+ option.series(b1, b2, b3, b4);
|
|
|
|
+ return option;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @ResponseBody
|
|
|
|
+ @RequestMapping("unitoption")
|
|
|
|
+ public GsonOption getOption1(HttpServletRequest request){
|
|
|
|
+ String status = request.getParameter("status");
|
|
|
|
+ SgReport sgReport = new SgReport();
|
|
|
|
+ sgReport.setStatus(status);
|
|
|
|
+ List<SgReport> list = reportService.findUnitList(sgReport);
|
|
|
|
+ String[] str = new String[list.size()];
|
|
|
|
+ int[] level1 = new int[list.size()];
|
|
|
|
+ int[] level2 = new int[list.size()];
|
|
|
|
+ int[] level3 = new int[list.size()];
|
|
|
|
+ int[] level4 = new int[list.size()];
|
|
|
|
+ for(int i=0;i<list.size();i++){
|
|
|
|
+ str[i] = list.get(i).getName();
|
|
|
|
+ level1[i] = list.get(i).getLevel1();
|
|
|
|
+ level2[i] = list.get(i).getLevel2();
|
|
|
|
+ level3[i] = list.get(i).getLevel3();
|
|
|
|
+ level4[i] = list.get(i).getLevel4();
|
|
|
|
+ }
|
|
|
|
+ GsonOption option = new GsonOption();
|
|
|
|
+// option.title("ECharts2 vs ECharts1", "Chrome下测试数据");
|
|
|
|
+ option.tooltip(Trigger.axis);
|
|
|
|
+ option.legend(
|
|
|
|
+ "1-7天", "8-14天", "15-21天",
|
|
|
|
+ "21天以上");
|
|
|
|
+ option.toolbox().show(true)
|
|
|
|
+ .feature(
|
|
|
|
+ Tool.mark, Tool.dataView,
|
|
|
|
+ new MagicType(Magic.line, Magic.bar),
|
|
|
|
+ Tool.restore, Tool.saveAsImage);
|
|
|
|
+ option.calculable(true);
|
|
|
|
+ option.grid().y(70).y2(30).x2(60).bottom(120);
|
|
|
|
+ CategoryAxis categoryAxis = new CategoryAxis();
|
|
|
|
+ for(int j=0;j<str.length;j++){
|
|
|
|
+ categoryAxis.data(str[j]);
|
|
|
|
+ }
|
|
|
|
+ option.xAxis(
|
|
|
|
+ categoryAxis.axisLabel(new AxisLabel().rotate(40).interval(0))
|
|
|
|
+// new CategoryAxis()
|
|
|
|
+// .axisLine(new AxisLine().show(false))
|
|
|
|
+// .axisTick(new AxisTick().show(false))
|
|
|
|
+// .axisLabel(new AxisLabel().show(false))
|
|
|
|
+// .splitArea(new SplitArea().show(false))
|
|
|
|
+// .axisLine(new AxisLine().show(false))
|
|
|
|
+// .data("Line", "Bar")
|
|
|
|
+ );
|
|
|
|
+ option.yAxis(new ValueAxis().axisLabel(new AxisLabel().formatter("{value} 个")));
|
|
|
|
+ Bar b1 = new Bar("1-7天");
|
|
|
|
+ b1.itemStyle().normal().color("rgba(193,35,43,0.5)").label().show(true);
|
|
|
|
+ Bar b2 = new Bar("8-14天");
|
|
|
|
+ b2.itemStyle().normal().color("rgba(181,195,52,1)").label().show(true).textStyle().color("#27727B");
|
|
|
|
+ Bar b3 = new Bar("15-21天");
|
|
|
|
+ b3.itemStyle().normal().color("rgba(252,206,16,1)").label().show(true).textStyle().color("#E87C25");
|
|
|
|
+ Bar b4 = new Bar("21天以上");
|
|
|
|
+ b4.itemStyle().normal().color("rgba(193,35,43,1)").label().show(true);
|
|
|
|
+ for (int k=0;k<list.size();k++){
|
|
|
|
+ b1.data(level1[k] );
|
|
|
|
+ b2.data(level2[k] );
|
|
|
|
+ b3.data(level3[k] );
|
|
|
|
+ b4.data(level4[k] );
|
|
|
|
+ }
|
|
|
|
+ option.series(b1, b2, b3, b4);
|
|
|
|
+ return option;
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|