yq 4 роки тому
батько
коміт
6202de656c

+ 11 - 3
fiveep-controller/src/main/java/com/bizmatics/controller/web/HtAnalogDataController.java

@@ -41,13 +41,21 @@ public class HtAnalogDataController {
 
     /**
      * 今日/昨日用电趋势
-     * @param startTime 开始时间
      * @param siteId 站点id
      * @return
      */
     @GetMapping("eptrendIco")
-    public ApiResult<List<CommonIcoVO>> getTrendByDate(@RequestParam Date startTime,@RequestParam(required = false) Integer siteId){
-        return ApiResult.success(htAnalogDataService.selectTrendByDate(startTime,siteId));
+    public ApiResult<List<CommonIcoVO>> getTrendByDate(@RequestParam(required = false) Integer siteId){
+        return ApiResult.success(htAnalogDataService.selectTrendByDate(siteId));
+    }
+
+    /**
+     * 当月用电趋势图
+     * @return
+     */
+    @GetMapping("eptrendIcoMonth")
+    public ApiResult<CommonIcoVO> getTrendByMonth(){
+        return ApiResult.success(htAnalogDataService.selectTrendByMonth());
     }
 
 

+ 3 - 0
fiveep-model/src/main/java/com/bizmatics/model/Device.java

@@ -1,6 +1,7 @@
 package com.bizmatics.model;
 
 import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import java.time.LocalDateTime;
 import java.io.Serializable;
@@ -71,11 +72,13 @@ public class Device implements Serializable {
      */
     private Integer enable;
 
+    @TableField(exist = false)
     private Integer deviceStatus;
 
     /**
      * 站点里面字段信息
      */
+    @TableField(exist = false)
     private String installedCapacity;
 
 }

+ 8 - 2
fiveep-service/src/main/java/com/bizmatics/service/HtAnalogDataService.java

@@ -28,11 +28,17 @@ public interface HtAnalogDataService extends CrudService<HtAnalogData> {
 
     /**
      * 用电趋势图
-     * @param date
      * @param siteId
      * @return
      */
-    List<CommonIcoVO> selectTrendByDate(Date date,Integer siteId);
+    List<CommonIcoVO> selectTrendByDate(Integer siteId);
+
+
+    /**
+     * 用电趋势图
+     * @return
+     */
+    CommonIcoVO selectTrendByMonth();
 
 
 

+ 20 - 1
fiveep-service/src/main/java/com/bizmatics/service/impl/HtAnalogDataServiceImpl.java

@@ -89,7 +89,8 @@ public class HtAnalogDataServiceImpl extends AbstractCrudService<HtAnalogDataMap
 
 
     @Override
-    public List<CommonIcoVO> selectTrendByDate(Date date,Integer siteId) {
+    public List<CommonIcoVO> selectTrendByDate(Integer siteId) {
+        Date date = new Date();
         List<CommonIcoVO> list = new ArrayList<>();
         List<Integer> idList = getSiteIdList(siteId);
         list.add(getTrendOne("today", idList, DateUtils.getDayStartTime(date), date));
@@ -97,6 +98,24 @@ public class HtAnalogDataServiceImpl extends AbstractCrudService<HtAnalogDataMap
         return list;
     }
 
+    @Override
+    public CommonIcoVO selectTrendByMonth() {
+        List<Integer> siteIdList = getSiteIdList(null);
+        Date date = new Date();
+        List<Object> objects = new ArrayList<>();
+        List<Object> dateList = new ArrayList<>();
+        List<HadDataLog> hadDataLogList = getByToday(DateUtils.getFirstDayOfMonth(date), date);
+        for (int i = 1; i <= Integer.parseInt(DateUtils.getDay(date)); i++) {
+            Date setDays = DateUtils.setDays(date, i);
+            Date dayStartTime = DateUtils.getDayStartTime(setDays);
+            Date dayEndTime = DateUtils.getDayEndTime(setDays);
+            objects.add(getEpp(hadDataLogList,siteIdList,dayStartTime,dayEndTime));
+            dateList.add(DateUtils.getDay(setDays));
+        }
+        CommonIcoVO.builder().name("当月趋势图").list(objects).listDate(dateList).build();
+        return null;
+    }
+
     public CommonIcoVO getTrendOne(String name,List<Integer> idList,Date startTime,Date endTime){
         List<HadDataLog> list = getByToday(startTime, endTime);
         List<Object> objects = new ArrayList<>();