diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/StatisticsController.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/StatisticsController.java index bc3a359..5162297 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/StatisticsController.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/StatisticsController.java @@ -2,8 +2,10 @@ import com.newfiber.common.core.web.controller.BaseController; import com.newfiber.common.core.web.domain.Result; +import com.newfiber.termite.domain.request.statistic.ProjectStatisticRequest; import com.newfiber.termite.domain.request.statistic.SiteWarnDailySeqStatisticRequest; import com.newfiber.termite.domain.request.statistic.SiteWarnTotalCountStatisticRequest; +import com.newfiber.termite.domain.response.statistic.ProjectStatistic; import com.newfiber.termite.domain.response.statistic.SiteDailyWarnCount; import com.newfiber.termite.domain.response.statistic.SiteTotalWarnCount; import com.newfiber.termite.service.IStatisticsService; @@ -47,4 +49,12 @@ return success(response); } + /** + */ + @GetMapping("/project_statistic") + @ApiOperation(value = "项目信息统计", position = 50) + public Result siteWarnTotalCountStatistic(ProjectStatisticRequest request) { + return success(new ProjectStatistic()); + } + } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/StatisticsController.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/StatisticsController.java index bc3a359..5162297 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/StatisticsController.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/StatisticsController.java @@ -2,8 +2,10 @@ import com.newfiber.common.core.web.controller.BaseController; import com.newfiber.common.core.web.domain.Result; +import com.newfiber.termite.domain.request.statistic.ProjectStatisticRequest; import com.newfiber.termite.domain.request.statistic.SiteWarnDailySeqStatisticRequest; import com.newfiber.termite.domain.request.statistic.SiteWarnTotalCountStatisticRequest; +import com.newfiber.termite.domain.response.statistic.ProjectStatistic; import com.newfiber.termite.domain.response.statistic.SiteDailyWarnCount; import com.newfiber.termite.domain.response.statistic.SiteTotalWarnCount; import com.newfiber.termite.service.IStatisticsService; @@ -47,4 +49,12 @@ return success(response); } + /** + */ + @GetMapping("/project_statistic") + @ApiOperation(value = "项目信息统计", position = 50) + public Result siteWarnTotalCountStatistic(ProjectStatisticRequest request) { + return success(new ProjectStatistic()); + } + } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/statistic/ProjectStatisticRequest.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/statistic/ProjectStatisticRequest.java new file mode 100644 index 0000000..f1d8541 --- /dev/null +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/statistic/ProjectStatisticRequest.java @@ -0,0 +1,20 @@ +package com.newfiber.termite.domain.request.statistic; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * + * @author X.K + * @date 2024-05-27 + */ +@Data +public class ProjectStatisticRequest { + + /** + * 用户编号 + */ + @ApiModelProperty(value = "用户编号") + private Long userId; + +} diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/StatisticsController.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/StatisticsController.java index bc3a359..5162297 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/StatisticsController.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/StatisticsController.java @@ -2,8 +2,10 @@ import com.newfiber.common.core.web.controller.BaseController; import com.newfiber.common.core.web.domain.Result; +import com.newfiber.termite.domain.request.statistic.ProjectStatisticRequest; import com.newfiber.termite.domain.request.statistic.SiteWarnDailySeqStatisticRequest; import com.newfiber.termite.domain.request.statistic.SiteWarnTotalCountStatisticRequest; +import com.newfiber.termite.domain.response.statistic.ProjectStatistic; import com.newfiber.termite.domain.response.statistic.SiteDailyWarnCount; import com.newfiber.termite.domain.response.statistic.SiteTotalWarnCount; import com.newfiber.termite.service.IStatisticsService; @@ -47,4 +49,12 @@ return success(response); } + /** + */ + @GetMapping("/project_statistic") + @ApiOperation(value = "项目信息统计", position = 50) + public Result siteWarnTotalCountStatistic(ProjectStatisticRequest request) { + return success(new ProjectStatistic()); + } + } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/statistic/ProjectStatisticRequest.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/statistic/ProjectStatisticRequest.java new file mode 100644 index 0000000..f1d8541 --- /dev/null +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/statistic/ProjectStatisticRequest.java @@ -0,0 +1,20 @@ +package com.newfiber.termite.domain.request.statistic; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * + * @author X.K + * @date 2024-05-27 + */ +@Data +public class ProjectStatisticRequest { + + /** + * 用户编号 + */ + @ApiModelProperty(value = "用户编号") + private Long userId; + +} diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/response/statistic/ProjectStatistic.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/response/statistic/ProjectStatistic.java new file mode 100644 index 0000000..43bf747 --- /dev/null +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/response/statistic/ProjectStatistic.java @@ -0,0 +1,33 @@ +package com.newfiber.termite.domain.response.statistic; + +import io.swagger.annotations.ApiModelProperty; +import java.util.List; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * + * @author X.K + * @date 2024-05-27 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class ProjectStatistic { + + @ApiModelProperty(value = "项目总数") + private Integer projectCount; + + @ApiModelProperty(value = "设备总数") + private Integer deviceCount; + + @ApiModelProperty(value = "告警项目总数") + private Integer warnProjectCount; + + @ApiModelProperty(value = "告警设备总数") + private Integer warnDeviceCount; + + private List projectStatisticDetailList; + +} diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/StatisticsController.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/StatisticsController.java index bc3a359..5162297 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/StatisticsController.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/StatisticsController.java @@ -2,8 +2,10 @@ import com.newfiber.common.core.web.controller.BaseController; import com.newfiber.common.core.web.domain.Result; +import com.newfiber.termite.domain.request.statistic.ProjectStatisticRequest; import com.newfiber.termite.domain.request.statistic.SiteWarnDailySeqStatisticRequest; import com.newfiber.termite.domain.request.statistic.SiteWarnTotalCountStatisticRequest; +import com.newfiber.termite.domain.response.statistic.ProjectStatistic; import com.newfiber.termite.domain.response.statistic.SiteDailyWarnCount; import com.newfiber.termite.domain.response.statistic.SiteTotalWarnCount; import com.newfiber.termite.service.IStatisticsService; @@ -47,4 +49,12 @@ return success(response); } + /** + */ + @GetMapping("/project_statistic") + @ApiOperation(value = "项目信息统计", position = 50) + public Result siteWarnTotalCountStatistic(ProjectStatisticRequest request) { + return success(new ProjectStatistic()); + } + } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/statistic/ProjectStatisticRequest.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/statistic/ProjectStatisticRequest.java new file mode 100644 index 0000000..f1d8541 --- /dev/null +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/statistic/ProjectStatisticRequest.java @@ -0,0 +1,20 @@ +package com.newfiber.termite.domain.request.statistic; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * + * @author X.K + * @date 2024-05-27 + */ +@Data +public class ProjectStatisticRequest { + + /** + * 用户编号 + */ + @ApiModelProperty(value = "用户编号") + private Long userId; + +} diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/response/statistic/ProjectStatistic.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/response/statistic/ProjectStatistic.java new file mode 100644 index 0000000..43bf747 --- /dev/null +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/response/statistic/ProjectStatistic.java @@ -0,0 +1,33 @@ +package com.newfiber.termite.domain.response.statistic; + +import io.swagger.annotations.ApiModelProperty; +import java.util.List; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * + * @author X.K + * @date 2024-05-27 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class ProjectStatistic { + + @ApiModelProperty(value = "项目总数") + private Integer projectCount; + + @ApiModelProperty(value = "设备总数") + private Integer deviceCount; + + @ApiModelProperty(value = "告警项目总数") + private Integer warnProjectCount; + + @ApiModelProperty(value = "告警设备总数") + private Integer warnDeviceCount; + + private List projectStatisticDetailList; + +} diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/response/statistic/ProjectStatisticDetail.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/response/statistic/ProjectStatisticDetail.java new file mode 100644 index 0000000..41c808a --- /dev/null +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/response/statistic/ProjectStatisticDetail.java @@ -0,0 +1,43 @@ +package com.newfiber.termite.domain.response.statistic; + +import io.swagger.annotations.ApiModelProperty; +import java.util.Date; +import lombok.AllArgsConstructor; +import lombok.Data; + +/** + * + * @author X.K + * @date 2024-05-27 + */ +@Data +@AllArgsConstructor +public class ProjectStatisticDetail { + + /** + * 项目编码 + */ + @ApiModelProperty(value = "项目编码") + private String projectCode; + + /** + * 项目名称 + */ + @ApiModelProperty(value = "项目名称") + private String projectName; + + /** + * 首次报警时间(连续3次手动确认则报警) + */ + @ApiModelProperty(value = "首次报警时间(连续3次手动确认则报警)") + private Date firstWarnDatetime; + + @ApiModelProperty(value = "设备总数") + private Integer deviceCount; + + @ApiModelProperty(value = "实时告警设备总数") + private Integer warnCountRealtime; + + @ApiModelProperty(value = "历史告警设备总数") + private Integer warnCountHistory; +} diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/StatisticsController.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/StatisticsController.java index bc3a359..5162297 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/StatisticsController.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/StatisticsController.java @@ -2,8 +2,10 @@ import com.newfiber.common.core.web.controller.BaseController; import com.newfiber.common.core.web.domain.Result; +import com.newfiber.termite.domain.request.statistic.ProjectStatisticRequest; import com.newfiber.termite.domain.request.statistic.SiteWarnDailySeqStatisticRequest; import com.newfiber.termite.domain.request.statistic.SiteWarnTotalCountStatisticRequest; +import com.newfiber.termite.domain.response.statistic.ProjectStatistic; import com.newfiber.termite.domain.response.statistic.SiteDailyWarnCount; import com.newfiber.termite.domain.response.statistic.SiteTotalWarnCount; import com.newfiber.termite.service.IStatisticsService; @@ -47,4 +49,12 @@ return success(response); } + /** + */ + @GetMapping("/project_statistic") + @ApiOperation(value = "项目信息统计", position = 50) + public Result siteWarnTotalCountStatistic(ProjectStatisticRequest request) { + return success(new ProjectStatistic()); + } + } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/statistic/ProjectStatisticRequest.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/statistic/ProjectStatisticRequest.java new file mode 100644 index 0000000..f1d8541 --- /dev/null +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/statistic/ProjectStatisticRequest.java @@ -0,0 +1,20 @@ +package com.newfiber.termite.domain.request.statistic; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * + * @author X.K + * @date 2024-05-27 + */ +@Data +public class ProjectStatisticRequest { + + /** + * 用户编号 + */ + @ApiModelProperty(value = "用户编号") + private Long userId; + +} diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/response/statistic/ProjectStatistic.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/response/statistic/ProjectStatistic.java new file mode 100644 index 0000000..43bf747 --- /dev/null +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/response/statistic/ProjectStatistic.java @@ -0,0 +1,33 @@ +package com.newfiber.termite.domain.response.statistic; + +import io.swagger.annotations.ApiModelProperty; +import java.util.List; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * + * @author X.K + * @date 2024-05-27 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class ProjectStatistic { + + @ApiModelProperty(value = "项目总数") + private Integer projectCount; + + @ApiModelProperty(value = "设备总数") + private Integer deviceCount; + + @ApiModelProperty(value = "告警项目总数") + private Integer warnProjectCount; + + @ApiModelProperty(value = "告警设备总数") + private Integer warnDeviceCount; + + private List projectStatisticDetailList; + +} diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/response/statistic/ProjectStatisticDetail.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/response/statistic/ProjectStatisticDetail.java new file mode 100644 index 0000000..41c808a --- /dev/null +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/response/statistic/ProjectStatisticDetail.java @@ -0,0 +1,43 @@ +package com.newfiber.termite.domain.response.statistic; + +import io.swagger.annotations.ApiModelProperty; +import java.util.Date; +import lombok.AllArgsConstructor; +import lombok.Data; + +/** + * + * @author X.K + * @date 2024-05-27 + */ +@Data +@AllArgsConstructor +public class ProjectStatisticDetail { + + /** + * 项目编码 + */ + @ApiModelProperty(value = "项目编码") + private String projectCode; + + /** + * 项目名称 + */ + @ApiModelProperty(value = "项目名称") + private String projectName; + + /** + * 首次报警时间(连续3次手动确认则报警) + */ + @ApiModelProperty(value = "首次报警时间(连续3次手动确认则报警)") + private Date firstWarnDatetime; + + @ApiModelProperty(value = "设备总数") + private Integer deviceCount; + + @ApiModelProperty(value = "实时告警设备总数") + private Integer warnCountRealtime; + + @ApiModelProperty(value = "历史告警设备总数") + private Integer warnCountHistory; +} diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/StatisticsServiceImpl.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/StatisticsServiceImpl.java index 63c30ac..f444c65 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/StatisticsServiceImpl.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/StatisticsServiceImpl.java @@ -31,8 +31,7 @@ private IDeviceMonitoringDataService deviceMonitoringDataService; @Override - public Map> warnDailySeqStatistic( - SiteWarnDailySeqStatisticRequest request) { + public Map> warnDailySeqStatistic(SiteWarnDailySeqStatisticRequest request) { List deviceMonitoringDataList = deviceMonitoringDataService.selectList(request.getProjectCode(), EExistsAnt.True); List dateList = deviceMonitoringDataList.stream().map(t -> t.getDate().split(" ")[0]).distinct().sorted().collect(Collectors.toList()); Map> response = new TreeMap<>(); @@ -68,9 +67,32 @@ Map> siteDeviceMonitoringDataMap = deviceMonitoringDataList.stream().collect(Collectors.groupingBy(DeviceMonitoringData::getSn)); for(Entry> entry : siteDeviceMonitoringDataMap.entrySet()){ + List enableDeviceMonitoringDataList = new ArrayList<>(); + Map> siteDailyDeviceMonitoringDataMap = entry.getValue().stream().collect(Collectors.groupingBy(t -> t.getDate().split(" ")[0])); + + for(Entry> dailyEntry : siteDailyDeviceMonitoringDataMap.entrySet()){ + if(dailyEntry.getValue().size() > 5){ + enableDeviceMonitoringDataList.addAll(dailyEntry.getValue()); + } + } + DeviceMonitoringData deviceMonitoringData = entry.getValue().get(0); siteTotalWarnCountList.add(new SiteTotalWarnCount(entry.getKey(), deviceMonitoringData.getLocation(), - entry.getValue().size(), deviceMonitoringData.getLocationType(), deviceMonitoringData.getLonandlat())); + enableDeviceMonitoringDataList.size(), deviceMonitoringData.getLocationType(), deviceMonitoringData.getLonandlat())); + } + + // TODO + String template = "{%s, %s, %s}"; + Map> stringListMap = siteTotalWarnCountList.stream().collect(Collectors.groupingBy(t -> t.getLocation().split("-")[0])); + for(Entry> entry : stringListMap.entrySet()){ + List arrayList = new ArrayList<>(); + System.out.println(entry.getKey()); + for(SiteTotalWarnCount siteTotalWarnCount : entry.getValue()){ + String lon = siteTotalWarnCount.getLonandlat().split(",")[0].substring(0, 10); + String lat = siteTotalWarnCount.getLonandlat().split(",")[1].substring(0, 9); + arrayList.add(String.format(template, lon, lat, siteTotalWarnCount.getCount())); + } + System.out.println("{" + String.join(",", arrayList) + "}"); } return siteTotalWarnCountList;