From 1578b0aad5939ff38de31350f65703ae60c2eb1b Mon Sep 17 00:00:00 2001
From: VVT789 <sdxt_0802@163.com>
Date: 星期二, 11 二月 2025 14:41:18 +0800
Subject: [PATCH] 添加综合指标统计(月、年)接口

---
 zhitan-admin/src/main/java/com/zhitan/web/controller/comprehensivestatistics/MonthlyComprehensiveController.java |  205 ++++++
 zhitan-system/src/main/resources/mapper/comprehensivestatistics/MonthlyComprehensiveMapper.xml                   |  101 +++
 zhitan-system/src/main/java/com/zhitan/comprehensivestatistics/domain/DailyReport.java                           |  321 ++++++++++
 zhitan-system/src/main/java/com/zhitan/comprehensivestatistics/mapper/MonthlyComprehensiveMapper.java            |   51 +
 zhitan-system/src/main/resources/mapper/comprehensivestatistics/YearComprehensiveMapper.xml                      |   81 ++
 zhitan-system/src/main/java/com/zhitan/comprehensivestatistics/domain/MonthlyComprehensive.java                  |  415 +++++++++++++
 zhitan-system/src/main/java/com/zhitan/comprehensivestatistics/service/impl/MonthlyComprehensiveServiceImpl.java |   42 +
 zhitan-admin/src/main/java/com/zhitan/web/controller/comprehensivestatistics/YearComprehensiveController.java    |  152 +++++
 zhitan-system/src/main/java/com/zhitan/comprehensivestatistics/service/impl/YearComprehensiveServiceImpl.java    |   68 ++
 zhitan-system/src/main/java/com/zhitan/comprehensivestatistics/domain/YearComperhensive.java                     |  214 +++++++
 zhitan-system/src/main/java/com/zhitan/comprehensivestatistics/service/ImonthlyComprehensive.java                |   41 +
 zhitan-system/src/main/java/com/zhitan/comprehensivestatistics/service/IyearComprehensive.java                   |   42 +
 zhitan-system/src/main/java/com/zhitan/comprehensivestatistics/mapper/YearComprehensiveMapper.java               |   51 +
 13 files changed, 1,784 insertions(+), 0 deletions(-)

diff --git a/zhitan-admin/src/main/java/com/zhitan/web/controller/comprehensivestatistics/MonthlyComprehensiveController.java b/zhitan-admin/src/main/java/com/zhitan/web/controller/comprehensivestatistics/MonthlyComprehensiveController.java
new file mode 100644
index 0000000..8e41cf7
--- /dev/null
+++ b/zhitan-admin/src/main/java/com/zhitan/web/controller/comprehensivestatistics/MonthlyComprehensiveController.java
@@ -0,0 +1,205 @@
+package com.zhitan.web.controller.comprehensivestatistics;
+
+import com.zhitan.common.core.controller.BaseController;
+import com.zhitan.common.core.domain.AjaxResult;
+import com.zhitan.common.utils.poi.ExcelUtil;
+import com.zhitan.comprehensivestatistics.domain.MonthlyComprehensive;
+import com.zhitan.comprehensivestatistics.service.ImonthlyComprehensive;
+import com.zhitan.model.domain.ModelNode;
+import com.zhitan.model.service.IModelNodeService;
+import com.zhitan.realtimedata.domain.DataItem;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.lang3.ObjectUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.lang.reflect.Field;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+/**
+ * electricityPriceController
+ *
+ * @author sys
+ * @date 2020-02-18
+ */
+@Slf4j
+@RestController
+@RequestMapping("/comprehensive/monthlyComprehensive")
+@Api(value = "缁煎悎鎸囨爣鍒嗘瀽锛堟湀锛塩ontroller",tags = {"缁煎悎鎸囨爣鍒嗘瀽"})
+public class MonthlyComprehensiveController extends BaseController {
+
+    @Autowired
+    private IModelNodeService modelNodeService;
+    @Autowired
+    private ImonthlyComprehensive monthlyComprehensive;
+
+    /*鍏ㄥ巶鑳借�楃粺璁�*/
+    @ApiOperation(value = "鑾峰彇缁煎悎鎸囨爣鍒嗘瀽锛堟湀锛夊垪琛�")
+    @GetMapping("/list")
+    public AjaxResult list(DataItem dataItem) {
+        try {
+
+            Map tableColumn =new HashMap<>();//琛ㄦ暟鎹�
+            List<MonthlyComprehensive> dataList=new ArrayList<>();
+            DateFormat df = new SimpleDateFormat("yyyy-MM");
+            SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+            String aa= df.format(dataItem.getDataTime());
+            String bb="";
+            int i = 1;
+            String beginTime=aa+"-01 00:00:00";
+            dataItem.setBeginTime(sf.parse(beginTime));
+            String endTime=aa+"-"+Integer.valueOf(getLastDayOfMonth(aa).substring(getLastDayOfMonth(aa).length()-2))+" 00:00:00";
+            dataItem.setEndTime(sf.parse(endTime));
+            while (i <= Integer.parseInt(getLastDayOfMonth(aa).substring(getLastDayOfMonth(aa).length() - 2))) {
+                if (i > 9) {
+                    bb = aa + "-" + i + " 00:00:00";
+                } else {
+                    bb = aa + "-0" + i + " 00:00:00";
+                }
+                MonthlyComprehensive report = new MonthlyComprehensive();
+                report.setDataTime(sf.parse(bb));
+                report.setValue("value" + i);
+                dataList.add(report);
+                tableColumn.put("value" + i, String.valueOf(i) + "鏃�");
+                i++;
+            }
+
+            MonthlyComprehensive reportList = new MonthlyComprehensive();
+            List<Map> table = new ArrayList<>();
+            table.add(tableColumn);
+            reportList.setTablehead(table);
+
+            ModelNode modelNode = modelNodeService.getModelNodeByModelCodeByIndexCode(dataItem.getIndexCode());
+            if (ObjectUtils.isEmpty(modelNode)) {
+                return AjaxResult.success(reportList);
+            }
+            List<MonthlyComprehensive> list = monthlyComprehensive.getMonthlyComprehensiveList(modelNode.getNodeId(),
+                    dataList, dataItem.getBeginTime(), dataItem.getEndTime(), dataItem.getTimeType(), dataItem.getIndexStorageId());
+            int count = Integer.parseInt(getLastDayOfMonth(aa).substring(getLastDayOfMonth(aa).length() - 2));
+            list.forEach(monthlyReport -> monthlyReport.setCount(count));
+            reportList.setTabledata(list);
+
+            return AjaxResult.success(reportList);
+        } catch (Exception ex) {
+            logger.error("鑾峰彇鍑洪敊锛�", ex);
+            return AjaxResult.error("鑾峰彇鍑洪敊!");
+        }
+    }
+/**/
+    /**
+     * 鍏ㄥ巶缁煎悎鑳借�楃粺璁″浘
+     */
+    @GetMapping("/listChart")
+    @ApiOperation(value = "鑾峰彇缁煎悎鎸囨爣鍒嗘瀽鍥捐〃锛堟湀锛夋暟鎹�")
+    public AjaxResult listChart(DataItem dataItem) throws ParseException {
+        DateFormat df = new SimpleDateFormat("yyyy-MM");
+        SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        String aa= df.format(dataItem.getDataTime());
+        String beginTime=aa+"-01 00:00:00";
+        dataItem.setBeginTime(sf.parse(beginTime));
+        String endTime=aa+"-"+Integer.valueOf(getLastDayOfMonth(aa).substring(getLastDayOfMonth(aa).length()-2))+" 00:00:00";
+        dataItem.setEndTime(sf.parse(endTime));
+        List<MonthlyComprehensive> list = monthlyComprehensive.getListChart(dataItem.getIndexId(),dataItem.getBeginTime(),dataItem.getEndTime(), dataItem.getTimeType(),dataItem.getIndexStorageId());
+        return AjaxResult.success(list);
+    }
+    public static String getLastDayOfMonth(String yearMonth) {
+        int year = Integer.parseInt(yearMonth.split("-")[0]);  //骞�
+        int month = Integer.parseInt(yearMonth.split("-")[1]); //鏈�
+        Calendar cal = Calendar.getInstance();
+        // 璁剧疆骞翠唤
+        cal.set(Calendar.YEAR, year);
+        // 璁剧疆鏈堜唤
+        // cal.set(Calendar.MONTH, month - 1);
+        cal.set(Calendar.MONTH, month); //璁剧疆褰撳墠鏈堢殑涓婁竴涓湀
+        // 鑾峰彇鏌愭湀鏈�澶уぉ鏁�
+        //int lastDay = cal.getActualMaximum(Calendar.DATE);
+        int lastDay = cal.getMinimum(Calendar.DATE); //鑾峰彇鏈堜唤涓殑鏈�灏忓�硷紝鍗崇涓�澶�
+        // 璁剧疆鏃ュ巻涓湀浠界殑鏈�澶уぉ鏁�
+        //cal.set(Calendar.DAY_OF_MONTH, lastDay);
+        cal.set(Calendar.DAY_OF_MONTH, lastDay - 1); //涓婃湀鐨勭涓�澶╁噺鍘�1灏辨槸褰撴湀鐨勬渶鍚庝竴澶�
+        // 鏍煎紡鍖栨棩鏈�
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+        return sdf.format(cal.getTime());
+    }
+    /*缁煎悎鏈堟姤琛ㄥ鍑�*/
+//    @Log(title = "缁煎悎鏈堟姤琛ㄥ鍑�", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    @ApiOperation(value = "缁煎悎鏈堟姤琛ㄥ鍑�")
+    public AjaxResult export(DataItem dataItem) {
+        try {
+
+            Map tableColumn =new HashMap<>();//琛ㄦ暟鎹�
+            List<MonthlyComprehensive> dataList=new ArrayList<>();
+            DateFormat df = new SimpleDateFormat("yyyy-MM");
+            SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+            String aa= df.format(dataItem.getDataTime());
+            String bb="";
+            int i = 1;
+            String beginTime=aa+"-01 00:00:00";
+            dataItem.setBeginTime(sf.parse(beginTime));
+            String endTime=aa+"-"+Integer.valueOf(getLastDayOfMonth(aa).substring(getLastDayOfMonth(aa).length()-2))+" 00:00:00";
+            dataItem.setEndTime(sf.parse(endTime));
+            while (i <= Integer.parseInt(getLastDayOfMonth(aa).substring(getLastDayOfMonth(aa).length() - 2))) {
+                if (i > 9) {
+                    bb = aa + "-" + i + " 00:00:00";
+                } else {
+                    bb = aa + "-0" + i + " 00:00:00";
+                }
+                MonthlyComprehensive report = new MonthlyComprehensive();
+                report.setDataTime(sf.parse(bb));
+                report.setValue("value" + i);
+                dataList.add(report);
+                tableColumn.put("value" + i, i + "鏃�");
+                i++;
+            }
+
+            MonthlyComprehensive reportList = new MonthlyComprehensive();
+            List<Map> table = new ArrayList<>();
+            table.add(tableColumn);
+            reportList.setTablehead(table);
+
+            ModelNode modelNode = modelNodeService.getModelNodeByModelCodeByIndexCode(dataItem.getIndexCode());
+            if (ObjectUtils.isEmpty(modelNode)) {
+                return AjaxResult.success(reportList);
+            }
+            List<MonthlyComprehensive> list = monthlyComprehensive.getMonthlyComprehensiveList(modelNode.getNodeId(), dataList,
+                    dataItem.getBeginTime(), dataItem.getEndTime(), dataItem.getTimeType(), dataItem.getIndexStorageId());
+            int count = Integer.parseInt(getLastDayOfMonth(aa).substring(getLastDayOfMonth(aa).length() - 2));
+            list.forEach(monthlyReport -> monthlyReport.setCount(count));
+            if (CollectionUtils.isNotEmpty(list)) {
+                list.forEach(this::valueRep);
+            }
+            ExcelUtil<MonthlyComprehensive> util = new ExcelUtil<>(MonthlyComprehensive.class);
+            return util.exportExcel(list, "缁煎悎鎸囨爣鍒嗘瀽鏈�");
+        } catch (Exception ex) {
+            logger.error("鑾峰彇鍑洪敊锛�", ex);
+            return AjaxResult.error("鑾峰彇鍑洪敊!");
+        }
+    }
+    public void valueRep(Object dr){
+        Field[] fields = dr.getClass().getDeclaredFields();
+        for(Field field:fields){
+            field.setAccessible(true);
+            Object obj = field.getType();
+            if(field.getType().getName().equals("java.lang.Double")){
+                String name = field.getName();
+                try {
+                    if(ObjectUtils.isEmpty(field.get(dr)))
+                    {
+                        field.set(dr,0.00);
+                    }
+                } catch (IllegalAccessException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+    }
+}
diff --git a/zhitan-admin/src/main/java/com/zhitan/web/controller/comprehensivestatistics/YearComprehensiveController.java b/zhitan-admin/src/main/java/com/zhitan/web/controller/comprehensivestatistics/YearComprehensiveController.java
new file mode 100644
index 0000000..32f4443
--- /dev/null
+++ b/zhitan-admin/src/main/java/com/zhitan/web/controller/comprehensivestatistics/YearComprehensiveController.java
@@ -0,0 +1,152 @@
+package com.zhitan.web.controller.comprehensivestatistics;
+
+import com.zhitan.common.annotation.Log;
+import com.zhitan.common.core.controller.BaseController;
+import com.zhitan.common.core.domain.AjaxResult;
+import com.zhitan.common.enums.BusinessType;
+import com.zhitan.common.utils.poi.ExcelUtil;
+import com.zhitan.comprehensivestatistics.domain.YearComperhensive;
+import com.zhitan.comprehensivestatistics.service.IyearComprehensive;
+import com.zhitan.model.domain.ModelNode;
+import com.zhitan.model.service.IModelNodeService;
+import com.zhitan.realtimedata.domain.DataItem;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.lang3.ObjectUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.lang.reflect.Field;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * electricityPriceController
+ *
+ * @author sys
+ * @date 2020-02-18
+ */
+@RestController
+@RequestMapping("/comprehensive/yearComprehensive")
+@Api(value = "缁煎悎鎸囨爣鍒嗘瀽锛堝勾锛塩ontroller",tags = {"缁煎悎鎸囨爣鍒嗘瀽"})
+public class YearComprehensiveController extends BaseController {
+
+    @Autowired
+    private IModelNodeService modelNodeService;
+    @Autowired
+    private IyearComprehensive yearComprehensive;
+
+    /*鍏ㄥ巶鑳借�楃粺璁�*/
+    @GetMapping("/list")
+    @ApiOperation(value = "鑾峰彇缁煎悎鎸囨爣鍒嗘瀽锛堝勾锛夊垪琛�")
+    public AjaxResult list(DataItem dataItem) {
+        try {
+            ModelNode modelNode = modelNodeService.getModelNodeByModelCodeByIndexCode(dataItem.getIndexCode());
+            if (ObjectUtils.isEmpty(modelNode)) {
+                return AjaxResult.success("鏆傛棤鏁版嵁");
+            }
+            List<YearComperhensive> dataList = new ArrayList<>();
+            DateFormat df = new SimpleDateFormat("yyyy");
+            SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+            String aa= df.format(dataItem.getBeginTime());
+            String bb="";
+            int i = 1;
+            while (i <= 12) {
+                if(i>9){
+                    bb=aa+"-"+i+"-01 00:00:00";
+                }else{
+                    bb=aa+"-0"+i+"-01 00:00:00";
+                }
+                YearComperhensive report = new YearComperhensive();
+                report.setDataTime(sf.parse(bb));
+                report.setValue("value"+i);
+                dataList.add(report);
+                i++;
+            }
+            List<YearComperhensive> list = yearComprehensive.getYearComprehensiveList(modelNode.getNodeId(),
+                    dataList,dataItem.getBeginTime(), dataItem.getEndTime(), dataItem.getTimeType(),dataItem.getIndexStorageId());
+            return AjaxResult.success(list);
+        } catch (Exception ex) {
+            logger.error("鑾峰彇鍑洪敊锛�", ex);
+            return AjaxResult.error("鑾峰彇鍑洪敊!");
+        }
+    }
+
+    /**
+     * 鍏ㄥ巶缁煎悎鑳借�楃粺璁″浘
+     */
+    @GetMapping("/listChart")
+    @ApiOperation(value = "鑾峰彇缁煎悎鎸囨爣鍒嗘瀽鍥捐〃锛堝勾锛夋暟鎹�")
+    public AjaxResult listChart(DataItem dataItem){
+        List<YearComperhensive> list = yearComprehensive.getListChart(dataItem.getIndexId(),dataItem.getBeginTime(),dataItem.getEndTime(), dataItem.getTimeType(),dataItem.getIndexStorageId());
+        return AjaxResult.success(list);
+    }
+
+    /**
+     * 瀵煎嚭宸ュ簭鍗曡�楃粺璁℃寚鏍囪缃姛鑳藉垪琛�
+     */
+    @Log(title = "缁煎悎鎶ヨ〃", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    @ApiOperation(value = "缁煎悎骞存姤琛ㄥ鍑�")
+    public AjaxResult export(DataItem dataItem) {
+        try {
+            ModelNode modelNode = modelNodeService.getModelNodeByModelCodeByIndexCode(dataItem.getIndexCode());
+            if (ObjectUtils.isEmpty(modelNode)) {
+                return AjaxResult.success("鏆傛棤鏁版嵁");
+            }
+            List<YearComperhensive> dataList = new ArrayList<>();
+            DateFormat df = new SimpleDateFormat("yyyy");
+            SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+            String aa = df.format(dataItem.getBeginTime());
+            String bb = "";
+            int i = 1;
+            while (i <= 12) {
+                if(i>9){
+                    bb=aa+"-"+i+"-01 00:00:00";
+                }else{
+                    bb=aa+"-0"+i+"-01 00:00:00";
+                }
+                YearComperhensive report=new YearComperhensive();
+                report.setDataTime(sf.parse(bb));
+                report.setValue("value"+i);
+                dataList.add(report);
+                i++;
+            }
+            List<YearComperhensive> list = yearComprehensive.getYearComprehensiveList(modelNode.getNodeId(),
+                    dataList,dataItem.getBeginTime(),dataItem.getEndTime(), dataItem.getTimeType(),dataItem.getIndexStorageId());
+            if(CollectionUtils.isNotEmpty(list)){
+                list.forEach(this::valueRep);
+            }
+            ExcelUtil<YearComperhensive> util = new ExcelUtil<>(YearComperhensive.class);
+            return util.exportExcel(list, "缁煎悎鎸囨爣鍒嗘瀽骞�");
+        } catch (Exception ex) {
+            logger.error("鑾峰彇鍑洪敊锛�", ex);
+            return AjaxResult.error("鑾峰彇鍑洪敊!");
+        }
+    }
+
+    public void valueRep(Object dr){
+        Field[] fields = dr.getClass().getDeclaredFields();
+        for(Field field:fields){
+            field.setAccessible(true);
+            Object obj = field.getType();
+            if(field.getType().getName().equals("java.lang.Double")){
+                String name = field.getName();
+                try {
+                    if(ObjectUtils.isEmpty(field.get(dr)))
+                    {
+                        field.set(dr,0.00);
+                    }
+                } catch (IllegalAccessException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+    }
+
+}
diff --git a/zhitan-system/src/main/java/com/zhitan/comprehensivestatistics/domain/DailyReport.java b/zhitan-system/src/main/java/com/zhitan/comprehensivestatistics/domain/DailyReport.java
new file mode 100644
index 0000000..4bd3d04
--- /dev/null
+++ b/zhitan-system/src/main/java/com/zhitan/comprehensivestatistics/domain/DailyReport.java
@@ -0,0 +1,321 @@
+package com.zhitan.comprehensivestatistics.domain;
+
+
+import com.zhitan.common.annotation.Excel;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ *
+ * @author sys
+ * @date 2020-03-25
+ */
+public class DailyReport implements Serializable {
+    private static final long serialVersionUID = 1L;
+    private String indexId;
+    @Excel(name = "鎸囨爣鍚嶇О")
+    private String indexName;
+    private String value;
+    private Date dataTime;
+    private String timeType;
+    @Excel(name = "0鏃�")
+    private Double value0;
+    @Excel(name = "1鏃�")
+    private Double value1;
+    @Excel(name = "2鏃�")
+    private Double value2;
+    @Excel(name = "3鏃�")
+    private Double value3;
+    @Excel(name = "4鏃�")
+    private Double value4;
+    @Excel(name = "5鏃�")
+    private Double value5;
+    @Excel(name = "6鏃�")
+    private Double value6;
+    @Excel(name = "7鏃�")
+    private Double value7;
+    @Excel(name = "8鏃�")
+    private Double value8;
+    @Excel(name = "9鏃�")
+    private Double value9;
+    @Excel(name = "10鏃�")
+    private Double value10;
+    @Excel(name = "11鏃�")
+    private Double value11;
+    @Excel(name = "12鏃�")
+    private Double value12;
+    @Excel(name = "13鏃�")
+    private Double value13;
+    @Excel(name = "14鏃�")
+    private Double value14;
+    @Excel(name = "15鏃�")
+    private Double value15;
+    @Excel(name = "16鏃�")
+    private Double value16;
+    @Excel(name = "17鏃�")
+    private Double value17;
+    @Excel(name = "18鏃�")
+    private Double value18;
+    @Excel(name = "19鏃�")
+    private Double value19;
+    @Excel(name = "20鏃�")
+    private Double value20;
+    @Excel(name = "21鏃�")
+    private Double value21;
+    @Excel(name = "22鏃�")
+    private Double value22;
+    @Excel(name = "23鏃�")
+    private Double value23;
+    private List<Map> tablehead =new ArrayList<>();
+    private List<DailyReport> tabledata =new ArrayList<>();
+    public String getIndexId() {
+        return indexId;
+    }
+
+    public void setIndexId(String indexId) {
+        this.indexId = indexId;
+    }
+
+    public String getIndexName() {
+        return indexName;
+    }
+
+    public void setIndexName(String indexName) {
+        this.indexName = indexName;
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+    public void setValue(String value) {
+        this.value = value;
+    }
+
+    public String getTimeType() {
+        return timeType;
+    }
+
+    public void setTimeType(String timeType) {
+        this.timeType = timeType;
+    }
+
+    public Date getDataTime() {
+        return dataTime;
+    }
+
+    public void setDataTime(Date dataTime) {
+        this.dataTime = dataTime;
+    }
+
+    public Double getValue1() {
+        return value1;
+    }
+
+    public void setValue1(Double value1) {
+        this.value1 = value1;
+    }
+
+    public Double getValue2() {
+        return value2;
+    }
+
+    public void setValue2(Double value2) {
+        this.value2 = value2;
+    }
+
+    public Double getValue3() {
+        return value3;
+    }
+
+    public void setValue3(Double value3) {
+        this.value3 = value3;
+    }
+
+    public Double getValue4() {
+        return value4;
+    }
+
+    public void setValue4(Double value4) {
+        this.value4 = value4;
+    }
+
+    public Double getValue5() {
+        return value5;
+    }
+
+    public void setValue5(Double value5) {
+        this.value5 = value5;
+    }
+
+    public Double getValue6() {
+        return value6;
+    }
+
+    public void setValue6(Double value6) {
+        this.value6 = value6;
+    }
+
+    public Double getValue7() {
+        return value7;
+    }
+
+    public void setValue7(Double value7) {
+        this.value7 = value7;
+    }
+
+    public Double getValue8() {
+        return value8;
+    }
+
+    public void setValue8(Double value8) {
+        this.value8 = value8;
+    }
+
+    public Double getValue9() {
+        return value9;
+    }
+
+    public void setValue9(Double value9) {
+        this.value9 = value9;
+    }
+
+    public Double getValue10() {
+        return value10;
+    }
+
+    public void setValue10(Double value10) {
+        this.value10 = value10;
+    }
+
+    public Double getValue11() {
+        return value11;
+    }
+
+    public void setValue11(Double value11) {
+        this.value11 = value11;
+    }
+
+    public Double getValue12() {
+        return value12;
+    }
+
+    public void setValue12(Double value12) {
+        this.value12 = value12;
+    }
+
+    public Double getValue13() {
+        return value13;
+    }
+
+    public void setValue13(Double value13) {
+        this.value13 = value13;
+    }
+
+    public Double getValue14() {
+        return value14;
+    }
+
+    public void setValue14(Double value14) {
+        this.value14 = value14;
+    }
+
+    public Double getValue15() {
+        return value15;
+    }
+
+    public void setValue15(Double value15) {
+        this.value15 = value15;
+    }
+
+    public Double getValue16() {
+        return value16;
+    }
+
+    public void setValue16(Double value16) {
+        this.value16 = value16;
+    }
+
+    public Double getValue17() {
+        return value17;
+    }
+
+    public void setValue17(Double value17) {
+        this.value17 = value17;
+    }
+
+    public Double getValue18() {
+        return value18;
+    }
+
+    public void setValue18(Double value18) {
+        this.value18 = value18;
+    }
+
+    public Double getValue19() {
+        return value19;
+    }
+
+    public void setValue19(Double value19) {
+        this.value19 = value19;
+    }
+
+    public Double getValue20() {
+        return value20;
+    }
+
+    public void setValue20(Double value20) {
+        this.value20 = value20;
+    }
+
+    public Double getValue21() {
+        return value21;
+    }
+
+    public void setValue21(Double value21) {
+        this.value21 = value21;
+    }
+
+    public Double getValue22() {
+        return value22;
+    }
+
+    public void setValue22(Double value22) {
+        this.value22 = value22;
+    }
+
+    public Double getValue23() {
+        return value23;
+    }
+
+    public void setValue23(Double value23) {
+        this.value23 = value23;
+    }
+
+    public Double getValue0() {
+        return value0;
+    }
+
+    public void setValue0(Double value0) {
+        this.value0 = value0;
+    }
+
+    public List<Map> getTablehead() {
+        return tablehead;
+    }
+
+    public void setTablehead(List<Map> tablehead) {
+        this.tablehead = tablehead;
+    }
+    public List<DailyReport> getTabledata() {
+        return tabledata;
+    }
+
+    public void setTabledata(List<DailyReport> tabledata) {
+        this.tabledata = tabledata;
+    }
+}
diff --git a/zhitan-system/src/main/java/com/zhitan/comprehensivestatistics/domain/MonthlyComprehensive.java b/zhitan-system/src/main/java/com/zhitan/comprehensivestatistics/domain/MonthlyComprehensive.java
new file mode 100644
index 0000000..4f29498
--- /dev/null
+++ b/zhitan-system/src/main/java/com/zhitan/comprehensivestatistics/domain/MonthlyComprehensive.java
@@ -0,0 +1,415 @@
+package com.zhitan.comprehensivestatistics.domain;
+
+import com.zhitan.common.annotation.Excel;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 
+ * @author sys
+ * @date 2020-12-31
+ */
+public class MonthlyComprehensive implements Serializable {
+    private static final long serialVersionUID = 1L;
+    private String indexId;
+    @Excel(name = "鎸囨爣鍚嶇О")
+    private String indexName;
+    private String value;
+    private Date dataTime;
+    private String timeType;
+    private String unitId;
+    @Excel(name = "1鏃�")
+    private Double value1;
+    @Excel(name = "2鏃�")
+    private Double value2;
+    @Excel(name = "3鏃�")
+    private Double value3;
+    @Excel(name = "4鏃�")
+    private Double value4;
+    @Excel(name = "5鏃�")
+    private Double value5;
+    @Excel(name = "6鏃�")
+    private Double value6;
+    @Excel(name = "7鏃�")
+    private Double value7;
+    @Excel(name = "8鏃�")
+    private Double value8;
+    @Excel(name = "9鏃�")
+    private Double value9;
+    @Excel(name = "10鏃�")
+    private Double value10;
+    @Excel(name = "11鏃�")
+    private Double value11;
+    @Excel(name = "12鏃�")
+    private Double value12;
+    @Excel(name = "13鏃�")
+    private Double value13;
+    @Excel(name = "14鏃�")
+    private Double value14;
+    @Excel(name = "15鏃�")
+    private Double value15;
+    @Excel(name = "16鏃�")
+    private Double value16;
+    @Excel(name = "17鏃�")
+    private Double value17;
+    @Excel(name = "18鏃�")
+    private Double value18;
+    @Excel(name = "19鏃�")
+    private Double value19;
+    @Excel(name = "20鏃�")
+    private Double value20;
+    @Excel(name = "21鏃�")
+    private Double value21;
+    @Excel(name = "22鏃�")
+    private Double value22;
+    @Excel(name = "23鏃�")
+    private Double value23;
+    @Excel(name = "24鏃�")
+    private Double value24;
+    @Excel(name = "25鏃�")
+    private Double value25;
+    @Excel(name = "26鏃�")
+    private Double value26;
+    @Excel(name = "27鏃�")
+    private Double value27;
+    @Excel(name = "28鏃�")
+    private Double value28;
+    @Excel(name = "29鏃�")
+    private Double value29;
+    @Excel(name = "30鏃�")
+    private Double value30;
+    @Excel(name = "31鏃�")
+    private Double value31;
+    private String timeCode;
+    private Integer count;
+    private List<Map> tablehead =new ArrayList<>();
+    private List<MonthlyComprehensive> tabledata =new ArrayList<>();
+    public String getIndexId() {
+        return indexId;
+    }
+
+    public void setIndexId(String indexId) {
+        this.indexId = indexId;
+    }
+
+    public String getIndexName() {
+        return indexName;
+    }
+
+    public void setIndexName(String indexName) {
+        this.indexName = indexName;
+    }
+    public String getUnitId() {
+        return unitId;
+    }
+
+    public void setUnitId(String unitId) {
+        this.unitId = unitId;
+    }
+    public String getValue() {
+        return value;
+    }
+
+    public void setValue(String value) {
+        this.value = value;
+    }
+
+    public String getTimeType() {
+        return timeType;
+    }
+
+    public void setTimeType(String timeType) {
+        this.timeType = timeType;
+    }
+
+    public Date getDataTime() {
+        return dataTime;
+    }
+
+    public void setDataTime(Date dataTime) {
+        this.dataTime = dataTime;
+    }
+
+    public Double getValue1() {
+        return value1;
+    }
+
+    public void setValue1(Double value1) {
+        this.value1 = value1;
+    }
+
+    public Double getValue2() {
+        return value2;
+    }
+
+    public void setValue2(Double value2) {
+        this.value2 = value2;
+    }
+
+    public Double getValue3() {
+        return value3;
+    }
+
+    public void setValue3(Double value3) {
+        this.value3 = value3;
+    }
+
+    public Double getValue4() {
+        return value4;
+    }
+
+    public void setValue4(Double value4) {
+        this.value4 = value4;
+    }
+
+    public Double getValue5() {
+        return value5;
+    }
+
+    public void setValue5(Double value5) {
+        this.value5 = value5;
+    }
+
+    public Double getValue6() {
+        return value6;
+    }
+
+    public void setValue6(Double value6) {
+        this.value6 = value6;
+    }
+
+    public Double getValue7() {
+        return value7;
+    }
+
+    public void setValue7(Double value7) {
+        this.value7 = value7;
+    }
+
+    public Double getValue8() {
+        return value8;
+    }
+
+    public void setValue8(Double value8) {
+        this.value8 = value8;
+    }
+
+    public Double getValue9() {
+        return value9;
+    }
+
+    public void setValue9(Double value9) {
+        this.value9 = value9;
+    }
+
+    public Double getValue10() {
+        return value10;
+    }
+
+    public void setValue10(Double value10) {
+        this.value10 = value10;
+    }
+
+    public Double getValue11() {
+        return value11;
+    }
+
+    public void setValue11(Double value11) {
+        this.value11 = value11;
+    }
+
+    public Double getValue12() {
+        return value12;
+    }
+
+    public void setValue12(Double value12) {
+        this.value12 = value12;
+    }
+
+    public Double getValue13() {
+        return value13;
+    }
+
+    public void setValue13(Double value13) {
+        this.value13 = value13;
+    }
+
+    public Double getValue14() {
+        return value14;
+    }
+
+    public void setValue14(Double value14) {
+        this.value14 = value14;
+    }
+
+    public Double getValue15() {
+        return value15;
+    }
+
+    public void setValue15(Double value15) {
+        this.value15 = value15;
+    }
+
+    public Double getValue16() {
+        return value16;
+    }
+
+    public void setValue16(Double value16) {
+        this.value16 = value16;
+    }
+
+    public Double getValue17() {
+        return value17;
+    }
+
+    public void setValue17(Double value17) {
+        this.value17 = value17;
+    }
+
+    public Double getValue18() {
+        return value18;
+    }
+
+    public void setValue18(Double value18) {
+        this.value18 = value18;
+    }
+
+    public Double getValue19() {
+        return value19;
+    }
+
+    public void setValue19(Double value19) {
+        this.value19 = value19;
+    }
+
+    public Double getValue20() {
+        return value20;
+    }
+
+    public void setValue20(Double value20) {
+        this.value20 = value20;
+    }
+
+    public Double getValue21() {
+        return value21;
+    }
+
+    public void setValue21(Double value21) {
+        this.value21 = value21;
+    }
+
+    public Double getValue22() {
+        return value22;
+    }
+
+    public void setValue22(Double value22) {
+        this.value22 = value22;
+    }
+
+    public Double getValue23() {
+        return value23;
+    }
+
+    public void setValue23(Double value23) {
+        this.value23 = value23;
+    }
+
+    public Double getValue24() {
+        return value24;
+    }
+
+    public void setValue24(Double value24) {
+        this.value24 = value24;
+    }
+
+    public Double getValue25() {
+        return value25;
+    }
+
+    public void setValue25(Double value25) {
+        this.value25 = value25;
+    }
+
+    public Double getValue26() {
+        return value26;
+    }
+
+    public void setValue26(Double value26) {
+        this.value26 = value26;
+    }
+
+    public Double getValue27() {
+        return value27;
+    }
+
+    public void setValue27(Double value27) {
+        this.value27 = value27;
+    }
+
+    public Double getValue28() {
+        return value28;
+    }
+
+    public void setValue28(Double value28) {
+        this.value28 = value28;
+    }
+
+    public Double getValue29() {
+        return value29;
+    }
+
+    public void setValue29(Double value29) {
+        this.value29 = value29;
+    }
+
+    public Double getValue30() {
+        return value30;
+    }
+
+    public void setValue30(Double value30) {
+        this.value30 = value30;
+    }
+
+    public Double getValue31() {
+        return value31;
+    }
+
+    public void setValue31(Double value31) {
+        this.value31 = value31;
+    }
+
+    public List<Map> getTablehead() {
+        return tablehead;
+    }
+
+    public void setTablehead(List<Map> tablehead) {
+        this.tablehead = tablehead;
+    }
+    public List<MonthlyComprehensive> getTabledata() {
+        return tabledata;
+    }
+
+    public void setTabledata(List<MonthlyComprehensive> tabledata) {
+        this.tabledata = tabledata;
+    }
+
+    public String getTimeCode() {
+        return timeCode;
+    }
+
+    public void setTimeCode(String timeCode) {
+        this.timeCode = timeCode;
+    }
+
+    public Integer getCount() {
+        return count;
+    }
+
+    public void setCount(Integer count) {
+        this.count = count;
+    }
+}
diff --git a/zhitan-system/src/main/java/com/zhitan/comprehensivestatistics/domain/YearComperhensive.java b/zhitan-system/src/main/java/com/zhitan/comprehensivestatistics/domain/YearComperhensive.java
new file mode 100644
index 0000000..aa177cd
--- /dev/null
+++ b/zhitan-system/src/main/java/com/zhitan/comprehensivestatistics/domain/YearComperhensive.java
@@ -0,0 +1,214 @@
+package com.zhitan.comprehensivestatistics.domain;
+
+import com.zhitan.common.annotation.Excel;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 
+ * @author sys
+ * @date 2020-03-25
+ */
+public class YearComperhensive implements Serializable {
+    private static final long serialVersionUID = 1L;
+    private String indexId;
+    @Excel(name = "鎸囨爣鍚嶇О")
+    private String indexName;
+    private String value;
+    private Date dataTime;
+    private String timeType;
+    private String unitId;
+    @Excel(name = "1鏈�")
+    private Double value1;
+    @Excel(name = "2鏈�")
+    private Double value2;
+    @Excel(name = "3鏈�")
+    private Double value3;
+    @Excel(name = "4鏈�")
+    private Double value4;
+    @Excel(name = "5鏈�")
+    private Double value5;
+    @Excel(name = "6鏈�")
+    private Double value6;
+    @Excel(name = "7鏈�")
+    private Double value7;
+    @Excel(name = "8鏈�")
+    private Double value8;
+    @Excel(name = "9鏈�")
+    private Double value9;
+    @Excel(name = "10鏈�")
+    private Double value10;
+    @Excel(name = "11鏈�")
+    private Double value11;
+    @Excel(name = "12鏈�")
+    private Double value12;
+    private String timeCode;
+    private List<Map> tablehead =new ArrayList<>();
+    private List<DailyReport> tabledata =new ArrayList<>();
+    public String getIndexId() {
+        return indexId;
+    }
+
+    public void setIndexId(String indexId) {
+        this.indexId = indexId;
+    }
+
+    public String getIndexName() {
+        return indexName;
+    }
+
+    public void setIndexName(String indexName) {
+        this.indexName = indexName;
+    }
+    public String getUnitId() {
+        return unitId;
+    }
+
+    public void setUnitId(String unitId) {
+        this.unitId = unitId;
+    }
+    public String getValue() {
+        return value;
+    }
+
+    public void setValue(String value) {
+        this.value = value;
+    }
+
+    public String getTimeType() {
+        return timeType;
+    }
+
+    public void setTimeType(String timeType) {
+        this.timeType = timeType;
+    }
+
+    public Date getDataTime() {
+        return dataTime;
+    }
+
+    public void setDataTime(Date dataTime) {
+        this.dataTime = dataTime;
+    }
+
+    public Double getValue1() {
+        return value1;
+    }
+
+    public void setValue1(Double value1) {
+        this.value1 = value1;
+    }
+
+    public Double getValue2() {
+        return value2;
+    }
+
+    public void setValue2(Double value2) {
+        this.value2 = value2;
+    }
+
+    public Double getValue3() {
+        return value3;
+    }
+
+    public void setValue3(Double value3) {
+        this.value3 = value3;
+    }
+
+    public Double getValue4() {
+        return value4;
+    }
+
+    public void setValue4(Double value4) {
+        this.value4 = value4;
+    }
+
+    public Double getValue5() {
+        return value5;
+    }
+
+    public void setValue5(Double value5) {
+        this.value5 = value5;
+    }
+
+    public Double getValue6() {
+        return value6;
+    }
+
+    public void setValue6(Double value6) {
+        this.value6 = value6;
+    }
+
+    public Double getValue7() {
+        return value7;
+    }
+
+    public void setValue7(Double value7) {
+        this.value7 = value7;
+    }
+
+    public Double getValue8() {
+        return value8;
+    }
+
+    public void setValue8(Double value8) {
+        this.value8 = value8;
+    }
+
+    public Double getValue9() {
+        return value9;
+    }
+
+    public void setValue9(Double value9) {
+        this.value9 = value9;
+    }
+
+    public Double getValue10() {
+        return value10;
+    }
+
+    public void setValue10(Double value10) {
+        this.value10 = value10;
+    }
+
+    public Double getValue11() {
+        return value11;
+    }
+
+    public void setValue11(Double value11) {
+        this.value11 = value11;
+    }
+
+    public Double getValue12() {
+        return value12;
+    }
+
+    public void setValue12(Double value12) {
+        this.value12 = value12;
+    }
+    public String getTimeCode() {
+        return timeCode;
+    }
+
+    public void setTimeCode(String timeCode) {
+        this.timeCode = timeCode;
+    }
+    public List<Map> getTablehead() {
+        return tablehead;
+    }
+
+    public void setTablehead(List<Map> tablehead) {
+        this.tablehead = tablehead;
+    }
+    public List<DailyReport> getTabledata() {
+        return tabledata;
+    }
+
+    public void setTabledata(List<DailyReport> tabledata) {
+        this.tabledata = tabledata;
+    }
+}
diff --git a/zhitan-system/src/main/java/com/zhitan/comprehensivestatistics/mapper/MonthlyComprehensiveMapper.java b/zhitan-system/src/main/java/com/zhitan/comprehensivestatistics/mapper/MonthlyComprehensiveMapper.java
new file mode 100644
index 0000000..ca9a75c
--- /dev/null
+++ b/zhitan-system/src/main/java/com/zhitan/comprehensivestatistics/mapper/MonthlyComprehensiveMapper.java
@@ -0,0 +1,51 @@
+package com.zhitan.comprehensivestatistics.mapper;
+
+import com.zhitan.common.enums.TimeType;
+import com.zhitan.comprehensivestatistics.domain.MonthlyComprehensive;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 鍏ㄥ巶缁煎悎鑳借�楃粺璁� 鏈�
+ *
+ * @author sys
+ * @date 2020-03-25
+ */
+public interface MonthlyComprehensiveMapper {
+    /**
+     * 鑾峰彇缁煎悎鎸囨爣鍒嗘瀽锛堟湀锛夊垪琛�
+     *
+     * @param nodeId
+     * @param dataList
+     * @param beginTime
+     * @param endTime
+     * @param timeType
+     * @param indexStorageId
+     * @return
+     */
+    public List<MonthlyComprehensive> getMonthlyComprehensiveList(@Param("nodeId") String nodeId,
+                                                                  @Param("dataList") List<MonthlyComprehensive> dataList,
+                                                                  @Param("beginTime") Date beginTime,
+                                                                  @Param("endTime") Date endTime,
+                                                                  @Param("timeType") TimeType timeType,
+                                                                  @Param("indexStorageId") String indexStorageId);
+
+    /**
+     * 鑾峰彇缁煎悎鎸囨爣鍒嗘瀽鍥捐〃锛堟湀锛夋暟鎹�
+     *
+     * @param indexId
+     * @param beginTime
+     * @param endTime
+     * @param timeType
+     * @param indexStorageId
+     * @return
+     */
+    List<MonthlyComprehensive> getListChart(@Param("indexId") String indexId,
+                                            @Param("beginTime") Date beginTime,
+                                            @Param("endTime") Date endTime,
+                                            @Param("timeType") TimeType timeType,
+                                            @Param("indexStorageId") String indexStorageId);
+
+}
diff --git a/zhitan-system/src/main/java/com/zhitan/comprehensivestatistics/mapper/YearComprehensiveMapper.java b/zhitan-system/src/main/java/com/zhitan/comprehensivestatistics/mapper/YearComprehensiveMapper.java
new file mode 100644
index 0000000..7293dd7
--- /dev/null
+++ b/zhitan-system/src/main/java/com/zhitan/comprehensivestatistics/mapper/YearComprehensiveMapper.java
@@ -0,0 +1,51 @@
+package com.zhitan.comprehensivestatistics.mapper;
+
+import com.zhitan.common.enums.TimeType;
+import com.zhitan.comprehensivestatistics.domain.YearComperhensive;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 鍏ㄥ巶缁煎悎鑳借�楃粺璁� 骞�
+ * 
+ * @author sys
+ * @date 2020-03-25
+ */
+public interface YearComprehensiveMapper {
+    /**
+     * 鑾峰彇骞存暟鎹�
+     *
+     * @param nodeId
+     * @param dataList
+     * @param beginTime
+     * @param endTime
+     * @param timeType
+     * @param indexStorageId
+     * @return
+     */
+    public List<YearComperhensive> getYearComprehensiveList(@Param("nodeId") String nodeId,
+                                                            @Param("dataList") List<YearComperhensive> dataList,
+                                                            @Param("beginTime") Date beginTime,
+                                                            @Param("endTime") Date endTime,
+                                                            @Param("timeType") TimeType timeType,
+                                                            @Param("indexStorageId") String indexStorageId);
+
+    /**
+     * 鑾峰彇骞存暟鎹�-chart
+     *
+     * @param indexId
+     * @param beginTime
+     * @param endTime
+     * @param timeType
+     * @param indexStorageId
+     * @return
+     */
+    List<YearComperhensive> getListChart(@Param("indexId") String indexId,
+                                            @Param("beginTime") Date beginTime,
+                                            @Param("endTime") Date endTime,
+                                            @Param("timeType") TimeType timeType,
+                                            @Param("indexStorageId") String indexStorageId);
+
+}
diff --git a/zhitan-system/src/main/java/com/zhitan/comprehensivestatistics/service/ImonthlyComprehensive.java b/zhitan-system/src/main/java/com/zhitan/comprehensivestatistics/service/ImonthlyComprehensive.java
new file mode 100644
index 0000000..13221a0
--- /dev/null
+++ b/zhitan-system/src/main/java/com/zhitan/comprehensivestatistics/service/ImonthlyComprehensive.java
@@ -0,0 +1,41 @@
+package com.zhitan.comprehensivestatistics.service;
+
+
+import com.zhitan.common.enums.TimeType;
+import com.zhitan.comprehensivestatistics.domain.MonthlyComprehensive;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 鍏ㄥ巶缁煎悎鑳借�楃粺璁� 鏈�
+ * 
+ * @author sys
+ * @date 2020-03-25
+ */
+public interface ImonthlyComprehensive {
+    /**
+     * 鍏ㄥ巶缁煎悎鑳借�楃粺璁� 鏈�
+     *
+     * @param nodeId
+     * @param dataList
+     * @param beginTime
+     * @param endTime
+     * @param timeType
+     * @param indexStorageId
+     * @return
+     */
+    List<MonthlyComprehensive> getMonthlyComprehensiveList(String nodeId, List<MonthlyComprehensive> dataList, Date beginTime, Date endTime, TimeType timeType, String indexStorageId);
+
+    /**
+     * 鍏ㄥ巶缁煎悎鑳借�楃粺璁� 鏈�
+     *
+     * @param indexId
+     * @param beginTime
+     * @param endTime
+     * @param timeType
+     * @param indexStorageId
+     * @return
+     */
+    List<MonthlyComprehensive> getListChart(String indexId, Date beginTime, Date endTime, TimeType timeType, String indexStorageId);
+}
diff --git a/zhitan-system/src/main/java/com/zhitan/comprehensivestatistics/service/IyearComprehensive.java b/zhitan-system/src/main/java/com/zhitan/comprehensivestatistics/service/IyearComprehensive.java
new file mode 100644
index 0000000..2c3a979
--- /dev/null
+++ b/zhitan-system/src/main/java/com/zhitan/comprehensivestatistics/service/IyearComprehensive.java
@@ -0,0 +1,42 @@
+package com.zhitan.comprehensivestatistics.service;
+
+
+import com.zhitan.common.enums.TimeType;
+import com.zhitan.comprehensivestatistics.domain.YearComperhensive;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 鍏ㄥ巶缁煎悎鑳借�楃粺璁� 骞�
+ * 
+ * @author sys
+ * @date 2020-03-25
+ */
+public interface IyearComprehensive {
+    /**
+     * 鑾峰彇缁煎悎鎸囨爣鍒嗘瀽锛堝勾锛夊垪琛�
+     *
+     * @param nodeId
+     * @param dataList
+     * @param beginTime
+     * @param endTime
+     * @param timeType
+     * @param indexStorageId
+     * @return
+     */
+    List<YearComperhensive> getYearComprehensiveList(String nodeId, List<YearComperhensive> dataList,
+                                                            Date beginTime, Date endTime, TimeType timeType, String indexStorageId);
+
+    /**
+     * 鑾峰彇缁煎悎鎸囨爣鍒嗘瀽锛堝勾锛夊浘琛ㄦ暟鎹�
+     *
+     * @param indexId
+     * @param beginTime
+     * @param endTime
+     * @param timeType
+     * @param indexStorageId
+     * @return
+     */
+    List<YearComperhensive> getListChart(String indexId, Date beginTime, Date endTime, TimeType timeType, String indexStorageId);
+}
diff --git a/zhitan-system/src/main/java/com/zhitan/comprehensivestatistics/service/impl/MonthlyComprehensiveServiceImpl.java b/zhitan-system/src/main/java/com/zhitan/comprehensivestatistics/service/impl/MonthlyComprehensiveServiceImpl.java
new file mode 100644
index 0000000..04beef7
--- /dev/null
+++ b/zhitan-system/src/main/java/com/zhitan/comprehensivestatistics/service/impl/MonthlyComprehensiveServiceImpl.java
@@ -0,0 +1,42 @@
+package com.zhitan.comprehensivestatistics.service.impl;
+
+import com.zhitan.common.enums.TimeType;
+import com.zhitan.comprehensivestatistics.domain.MonthlyComprehensive;
+import com.zhitan.comprehensivestatistics.mapper.MonthlyComprehensiveMapper;
+import com.zhitan.comprehensivestatistics.service.ImonthlyComprehensive;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 涓氬姟灞傚鐞�
+ * 
+ * @author sys
+ * @date 2020-03-25
+ */
+@Service
+public class MonthlyComprehensiveServiceImpl implements ImonthlyComprehensive {
+    @Resource
+    private MonthlyComprehensiveMapper monthMapper;
+
+    public List<MonthlyComprehensive> getMonthlyComprehensiveList(String nodeId, List<MonthlyComprehensive> dataList,
+                                                                  Date beginTime, Date endTime, TimeType timeType, String indexStorageId){
+        if (StringUtils.isNotEmpty(nodeId)) {
+            return monthMapper.getMonthlyComprehensiveList(nodeId, dataList, beginTime, endTime, timeType, indexStorageId);
+        }
+        return Collections.emptyList();
+    }
+
+    @Override
+    public List<MonthlyComprehensive> getListChart(String indexId, Date beginTime, Date endTime, TimeType timeType, String indexStorageId){
+        if (indexId != null && !indexId.isEmpty()) {
+            return monthMapper.getListChart(indexId,beginTime,endTime,timeType,indexStorageId);
+        }
+        return Collections.emptyList();
+    }
+}
diff --git a/zhitan-system/src/main/java/com/zhitan/comprehensivestatistics/service/impl/YearComprehensiveServiceImpl.java b/zhitan-system/src/main/java/com/zhitan/comprehensivestatistics/service/impl/YearComprehensiveServiceImpl.java
new file mode 100644
index 0000000..df2ac97
--- /dev/null
+++ b/zhitan-system/src/main/java/com/zhitan/comprehensivestatistics/service/impl/YearComprehensiveServiceImpl.java
@@ -0,0 +1,68 @@
+package com.zhitan.comprehensivestatistics.service.impl;
+
+import cn.hutool.core.date.DateUtil;
+import com.zhitan.common.constant.CommonConst;
+import com.zhitan.common.enums.TimeType;
+import com.zhitan.common.utils.DateTimeUtil;
+import com.zhitan.comprehensivestatistics.domain.YearComperhensive;
+import com.zhitan.comprehensivestatistics.mapper.YearComprehensiveMapper;
+import com.zhitan.comprehensivestatistics.service.IyearComprehensive;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.lang3.ObjectUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * 涓氬姟灞傚鐞�
+ * 
+ * @author sys
+ * @date 2020-03-25
+ */
+@Service
+public class YearComprehensiveServiceImpl implements IyearComprehensive {
+    @Resource
+    private YearComprehensiveMapper yearMapper;
+
+    @Override
+    public List<YearComperhensive> getYearComprehensiveList(String nodeId, List<YearComperhensive> dataList,
+                                                            Date beginTime, Date endTime, TimeType timeType, String indexStorageId){
+        if (StringUtils.isNotEmpty(nodeId)) {
+            return yearMapper.getYearComprehensiveList(nodeId, dataList, beginTime, endTime, timeType, indexStorageId);
+        }
+        return Collections.emptyList();
+    }
+    @Override
+    public List<YearComperhensive> getListChart(String indexId, Date beginTime, Date endTime, TimeType timeType, String indexStorageId){
+        List<YearComperhensive> dataList = new ArrayList<>();
+        if (StringUtils.isNotEmpty(indexId)) {
+            List<YearComperhensive> listChart = yearMapper.getListChart(indexId, beginTime, endTime, timeType, indexStorageId);
+            if (CollectionUtils.isNotEmpty(listChart)) {
+                Date date = new Date();
+                YearComperhensive first = listChart.get(CommonConst.DIGIT_0);
+                Map<String, YearComperhensive> listChartMap = yearMapper.getListChart(indexId, beginTime, endTime, timeType, indexStorageId)
+                        .stream().collect(Collectors.toMap(YearComperhensive::getTimeCode, prot -> prot));
+                while (beginTime.before(date)) {
+                    YearComperhensive yearComperhensive = new YearComperhensive();
+                    String format = CommonConst.WORD_M + DateUtil.format(beginTime, DateTimeUtil.COMMON_PATTERN_MONTH);
+                    YearComperhensive item = listChartMap.get(format);
+                    if (ObjectUtils.isNotEmpty(item)) {
+                        yearComperhensive = item;
+                    } else {
+                        yearComperhensive.setTimeCode(format);
+                        yearComperhensive.setIndexId(indexId);
+                        yearComperhensive.setTimeType(timeType.name());
+                        yearComperhensive.setUnitId(first.getUnitId());
+                        yearComperhensive.setIndexName(first.getIndexName());
+                    }
+                    dataList.add(yearComperhensive);
+                    beginTime = DateUtil.offsetMonth(beginTime, CommonConst.DIGIT_1);
+                }
+            }
+        }
+        return dataList;
+    }
+}
diff --git a/zhitan-system/src/main/resources/mapper/comprehensivestatistics/MonthlyComprehensiveMapper.xml b/zhitan-system/src/main/resources/mapper/comprehensivestatistics/MonthlyComprehensiveMapper.xml
new file mode 100644
index 0000000..7de48b9
--- /dev/null
+++ b/zhitan-system/src/main/resources/mapper/comprehensivestatistics/MonthlyComprehensiveMapper.xml
@@ -0,0 +1,101 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.zhitan.comprehensivestatistics.mapper.MonthlyComprehensiveMapper">
+    <resultMap id="dataItemMap" type="com.zhitan.comprehensivestatistics.domain.MonthlyComprehensive">
+        <result column="index_id" property="indexId"/>
+        <result column="index_name" property="indexName"/>
+        <result column="time_type" property="timeType"/>
+        <result column="time_code" property="timeCode"/>
+        <result column="unit_id" property="unitId"/>
+        <result column="value1" property="value1"/>
+        <result column="value2" property="value2"/>
+        <result column="value3" property="value3"/>
+        <result column="value4" property="value4"/>
+        <result column="value5" property="value5"/>
+        <result column="value6" property="value6"/>
+        <result column="value7" property="value7"/>
+        <result column="value8" property="value8"/>
+        <result column="value9" property="value9"/>
+        <result column="value10" property="value10"/>
+        <result column="value11" property="value11"/>
+        <result column="value12" property="value12"/>
+        <result column="value13" property="value13"/>
+        <result column="value14" property="value14"/>
+        <result column="value15" property="value15"/>
+        <result column="value16" property="value16"/>
+        <result column="value17" property="value17"/>
+        <result column="value18" property="value18"/>
+        <result column="value19" property="value19"/>
+        <result column="value20" property="value20"/>
+        <result column="value21" property="value21"/>
+        <result column="value22" property="value22"/>
+        <result column="value23" property="value23"/>
+        <result column="value24" property="value24"/>
+        <result column="value25" property="value25"/>
+        <result column="value26" property="value26"/>
+        <result column="value27" property="value27"/>
+        <result column="value28" property="value28"/>
+        <result column="value29" property="value29"/>
+        <result column="value30" property="value30"/>
+        <result column="value31" property="value31"/>
+    </resultMap>
+    <!--鍏ㄥ巶鑳借�楃粺璁�-->
+    <select id="getMonthlyComprehensiveList" resultMap="dataItemMap">
+        SELECT
+            aa.index_id,
+            aa.index_name,
+        <foreach item="item" index="index" collection="dataList">
+            COALESCE ( MAX ( CASE WHEN data_time = #{item.dataTime} THEN "value" END ), null ) AS ${item.value},
+        </foreach>
+            aa.time_type,
+            aa.order_num orderNum
+        FROM
+        (
+            SELECT
+                ni.index_id,
+                ei."name" AS "index_name",
+                di."value",
+                di.data_time,
+                di.time_type,
+                mn.order_num
+            FROM
+                model_node mn
+                LEFT JOIN node_index ni ON ni.node_id = mn.node_id
+                LEFT JOIN energy_index ei ON ei.index_id = ni.index_id
+                LEFT JOIN data_item di ON ni.index_id = di.index_id
+            WHERE
+                mn.parent_id = #{nodeId}
+                AND di.data_time >= #{beginTime}
+                AND di.data_time &lt;= #{endTime}
+                AND di.time_type = #{timeType}
+            <if test="indexStorageId !='' and indexStorageId !=null">
+                and ei.energy_id=#{indexStorageId}
+            </if>
+        ) aa
+        GROUP BY
+        aa.index_id, aa.index_name, aa.time_type, aa.order_num
+        ORDER BY aa.order_num ASC
+    </select>
+
+    <select id="getListChart" resultMap="dataItemMap">
+        SELECT
+            di.index_id,
+            ci.name AS "index_name",
+            ci.unit_id,
+            di."value",
+            di.data_time,
+            di.time_type,
+            di.time_code
+        FROM
+        data_item di LEFT JOIN energy_index ci ON di.index_id = ci.index_id
+        WHERE
+            di.index_id =#{indexId}
+            AND di.data_time &lt;= #{endTime}
+            AND di.data_time >= #{beginTime}
+            AND di.time_type = #{timeType}
+        ORDER BY
+            di.time_code;
+    </select>
+</mapper>
diff --git a/zhitan-system/src/main/resources/mapper/comprehensivestatistics/YearComprehensiveMapper.xml b/zhitan-system/src/main/resources/mapper/comprehensivestatistics/YearComprehensiveMapper.xml
new file mode 100644
index 0000000..e36e03c
--- /dev/null
+++ b/zhitan-system/src/main/resources/mapper/comprehensivestatistics/YearComprehensiveMapper.xml
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.zhitan.comprehensivestatistics.mapper.YearComprehensiveMapper">
+    <resultMap id="dataItemMap" type="com.zhitan.comprehensivestatistics.domain.YearComperhensive">
+        <result column="index_id" property="indexId"/>
+        <result column="index_name" property="indexName"/>
+        <result column="time_type" property="timeType"/>
+        <result column="time_code" property="timeCode"/>
+        <result column="unit_id" property="unitId"/>
+        <result column="value1" property="value1"/>
+        <result column="value2" property="value2"/>
+        <result column="value3" property="value3"/>
+        <result column="value4" property="value4"/>
+        <result column="value5" property="value5"/>
+        <result column="value6" property="value6"/>
+        <result column="value7" property="value7"/>
+        <result column="value8" property="value8"/>
+        <result column="value9" property="value9"/>
+        <result column="value10" property="value10"/>
+        <result column="value11" property="value11"/>
+        <result column="value12" property="value12"/>
+    </resultMap>
+    <!--鍏ㄥ巶鑳借�楃粺璁�-->
+    <select id="getYearComprehensiveList" resultMap="dataItemMap">
+        SELECT
+            aa.index_id,
+            aa.index_name,
+            <foreach item="item" index="index" collection="dataList">
+                COALESCE ( MAX ( CASE WHEN data_time = #{item.dataTime} THEN "value" END ), null ) AS ${item.value},
+            </foreach>
+            aa.time_type,
+            aa.order_num orderNum
+        FROM
+        (
+            SELECT
+                ni.index_id,
+                ei."name" AS "index_name",
+                di."value",
+                di.data_time,
+                di.time_type,
+                mn.order_num
+            FROM
+                model_node mn
+                LEFT JOIN node_index ni ON ni.node_id = mn.node_id
+                LEFT JOIN energy_index ei ON ei.index_id = ni.index_id
+                LEFT JOIN data_item di ON ni.index_id = di.index_id
+            WHERE
+                mn.parent_id = #{nodeId}
+                AND di.data_time >= #{beginTime}
+                AND di.data_time &lt;= #{endTime}
+                AND di.time_type = #{timeType}
+            <if test="indexStorageId !='' and indexStorageId !=null">
+                and ei.energy_id=#{indexStorageId}
+            </if>
+        ) aa
+        GROUP BY aa.index_id, aa.index_name, aa.time_type, aa.order_num
+        ORDER BY aa.order_num ASC
+    </select>
+
+    <select id="getListChart" resultMap="dataItemMap">
+        SELECT
+            di.index_id,
+            ci.name AS "index_name",
+            ci.unit_id,
+            di."value",
+            di.data_time,
+            di.time_type,
+            di.time_code
+        FROM
+        data_item di LEFT JOIN energy_index ci ON di.index_id = ci.index_id
+        WHERE
+            di.index_id =#{indexId}
+            AND di.data_time &lt; #{endTime}
+            AND di.data_time >= #{beginTime}
+            AND di.time_type = #{timeType}
+        ORDER BY
+            di.time_code;
+    </select>
+</mapper>

--
Gitblit v1.9.3