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 488474c..df7bbdb 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 @@ -23,12 +23,15 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import java.time.LocalDate; import java.util.*; import javax.annotation.Resource; import org.springframework.beans.BeanUtils; +import org.springframework.format.annotation.DateTimeFormat; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import javax.validation.constraints.NotNull; @@ -116,9 +119,9 @@ */ @GetMapping("/SnWarinTotalDays") @ApiOperation(value = "查询设备累计告警天数", position = 60) - public Result snWarinTotalDays(SnWarinTotalDaysRequestInfo request){ - SnWarinTotalDaysResponseInfo warinTotalDaysResponseInfo = statisticsService.snWarinTotalDays(request); - return success(warinTotalDaysResponseInfo); + public Result> snWarinTotalDays(SnWarinTotalDaysRequestInfo request,@RequestParam("date") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDate date){ + List warinTotalDaysResponseInfoList = statisticsService.snWarinTotalDays(request,date); + return success(warinTotalDaysResponseInfoList); } } 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 488474c..df7bbdb 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 @@ -23,12 +23,15 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import java.time.LocalDate; import java.util.*; import javax.annotation.Resource; import org.springframework.beans.BeanUtils; +import org.springframework.format.annotation.DateTimeFormat; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import javax.validation.constraints.NotNull; @@ -116,9 +119,9 @@ */ @GetMapping("/SnWarinTotalDays") @ApiOperation(value = "查询设备累计告警天数", position = 60) - public Result snWarinTotalDays(SnWarinTotalDaysRequestInfo request){ - SnWarinTotalDaysResponseInfo warinTotalDaysResponseInfo = statisticsService.snWarinTotalDays(request); - return success(warinTotalDaysResponseInfo); + public Result> snWarinTotalDays(SnWarinTotalDaysRequestInfo request,@RequestParam("date") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDate date){ + List warinTotalDaysResponseInfoList = statisticsService.snWarinTotalDays(request,date); + return success(warinTotalDaysResponseInfoList); } } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/SnWarinTotalDaysRequestInfo.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/SnWarinTotalDaysRequestInfo.java index 33b5a79..a96eecb 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/SnWarinTotalDaysRequestInfo.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/SnWarinTotalDaysRequestInfo.java @@ -4,24 +4,19 @@ import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; import java.util.Date; @Data public class SnWarinTotalDaysRequestInfo { - /** - * 开始时间 - */ - @ApiModelProperty(name = "startTime", value = "开始时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private Date startTime; /** - * 结束时间 + * */ - @ApiModelProperty(name = "endTime", value = "结束时间") + @ApiModelProperty(name = "endTime", value = "监测时间") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private Date endTime; + private Date date; /** * 设备编号 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 488474c..df7bbdb 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 @@ -23,12 +23,15 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import java.time.LocalDate; import java.util.*; import javax.annotation.Resource; import org.springframework.beans.BeanUtils; +import org.springframework.format.annotation.DateTimeFormat; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import javax.validation.constraints.NotNull; @@ -116,9 +119,9 @@ */ @GetMapping("/SnWarinTotalDays") @ApiOperation(value = "查询设备累计告警天数", position = 60) - public Result snWarinTotalDays(SnWarinTotalDaysRequestInfo request){ - SnWarinTotalDaysResponseInfo warinTotalDaysResponseInfo = statisticsService.snWarinTotalDays(request); - return success(warinTotalDaysResponseInfo); + public Result> snWarinTotalDays(SnWarinTotalDaysRequestInfo request,@RequestParam("date") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDate date){ + List warinTotalDaysResponseInfoList = statisticsService.snWarinTotalDays(request,date); + return success(warinTotalDaysResponseInfoList); } } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/SnWarinTotalDaysRequestInfo.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/SnWarinTotalDaysRequestInfo.java index 33b5a79..a96eecb 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/SnWarinTotalDaysRequestInfo.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/SnWarinTotalDaysRequestInfo.java @@ -4,24 +4,19 @@ import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; import java.util.Date; @Data public class SnWarinTotalDaysRequestInfo { - /** - * 开始时间 - */ - @ApiModelProperty(name = "startTime", value = "开始时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private Date startTime; /** - * 结束时间 + * */ - @ApiModelProperty(name = "endTime", value = "结束时间") + @ApiModelProperty(name = "endTime", value = "监测时间") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private Date endTime; + private Date date; /** * 设备编号 diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/response/SnWarinTotalDaysResponseInfo.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/response/SnWarinTotalDaysResponseInfo.java index a32d479..88149b2 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/response/SnWarinTotalDaysResponseInfo.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/response/SnWarinTotalDaysResponseInfo.java @@ -1,14 +1,23 @@ package com.newfiber.termite.domain.response; +import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import java.util.Date; + @Data public class SnWarinTotalDaysResponseInfo { /** - * 累计告警天数 + * 连续告警天数 */ @ApiModelProperty(value = "累计告警天数") private Integer count; + + /** + * 告警时间 + */ + + private String formatteddate; } 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 488474c..df7bbdb 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 @@ -23,12 +23,15 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import java.time.LocalDate; import java.util.*; import javax.annotation.Resource; import org.springframework.beans.BeanUtils; +import org.springframework.format.annotation.DateTimeFormat; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import javax.validation.constraints.NotNull; @@ -116,9 +119,9 @@ */ @GetMapping("/SnWarinTotalDays") @ApiOperation(value = "查询设备累计告警天数", position = 60) - public Result snWarinTotalDays(SnWarinTotalDaysRequestInfo request){ - SnWarinTotalDaysResponseInfo warinTotalDaysResponseInfo = statisticsService.snWarinTotalDays(request); - return success(warinTotalDaysResponseInfo); + public Result> snWarinTotalDays(SnWarinTotalDaysRequestInfo request,@RequestParam("date") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDate date){ + List warinTotalDaysResponseInfoList = statisticsService.snWarinTotalDays(request,date); + return success(warinTotalDaysResponseInfoList); } } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/SnWarinTotalDaysRequestInfo.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/SnWarinTotalDaysRequestInfo.java index 33b5a79..a96eecb 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/SnWarinTotalDaysRequestInfo.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/SnWarinTotalDaysRequestInfo.java @@ -4,24 +4,19 @@ import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; import java.util.Date; @Data public class SnWarinTotalDaysRequestInfo { - /** - * 开始时间 - */ - @ApiModelProperty(name = "startTime", value = "开始时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private Date startTime; /** - * 结束时间 + * */ - @ApiModelProperty(name = "endTime", value = "结束时间") + @ApiModelProperty(name = "endTime", value = "监测时间") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private Date endTime; + private Date date; /** * 设备编号 diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/response/SnWarinTotalDaysResponseInfo.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/response/SnWarinTotalDaysResponseInfo.java index a32d479..88149b2 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/response/SnWarinTotalDaysResponseInfo.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/response/SnWarinTotalDaysResponseInfo.java @@ -1,14 +1,23 @@ package com.newfiber.termite.domain.response; +import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import java.util.Date; + @Data public class SnWarinTotalDaysResponseInfo { /** - * 累计告警天数 + * 连续告警天数 */ @ApiModelProperty(value = "累计告警天数") private Integer count; + + /** + * 告警时间 + */ + + private String formatteddate; } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/mapper/DeviceMonitoringDataMapper.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/mapper/DeviceMonitoringDataMapper.java index e985408..b930ce7 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/mapper/DeviceMonitoringDataMapper.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/mapper/DeviceMonitoringDataMapper.java @@ -40,6 +40,6 @@ List listWarinTotalDays(@Param("projectCode") String projectCode); - SnWarinTotalDaysResponseInfo snWarinTotalDays(SnWarinTotalDaysRequestInfo request); + List snWarinTotalDays(SnWarinTotalDaysRequestInfo request); } 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 488474c..df7bbdb 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 @@ -23,12 +23,15 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import java.time.LocalDate; import java.util.*; import javax.annotation.Resource; import org.springframework.beans.BeanUtils; +import org.springframework.format.annotation.DateTimeFormat; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import javax.validation.constraints.NotNull; @@ -116,9 +119,9 @@ */ @GetMapping("/SnWarinTotalDays") @ApiOperation(value = "查询设备累计告警天数", position = 60) - public Result snWarinTotalDays(SnWarinTotalDaysRequestInfo request){ - SnWarinTotalDaysResponseInfo warinTotalDaysResponseInfo = statisticsService.snWarinTotalDays(request); - return success(warinTotalDaysResponseInfo); + public Result> snWarinTotalDays(SnWarinTotalDaysRequestInfo request,@RequestParam("date") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDate date){ + List warinTotalDaysResponseInfoList = statisticsService.snWarinTotalDays(request,date); + return success(warinTotalDaysResponseInfoList); } } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/SnWarinTotalDaysRequestInfo.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/SnWarinTotalDaysRequestInfo.java index 33b5a79..a96eecb 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/SnWarinTotalDaysRequestInfo.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/SnWarinTotalDaysRequestInfo.java @@ -4,24 +4,19 @@ import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; import java.util.Date; @Data public class SnWarinTotalDaysRequestInfo { - /** - * 开始时间 - */ - @ApiModelProperty(name = "startTime", value = "开始时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private Date startTime; /** - * 结束时间 + * */ - @ApiModelProperty(name = "endTime", value = "结束时间") + @ApiModelProperty(name = "endTime", value = "监测时间") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private Date endTime; + private Date date; /** * 设备编号 diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/response/SnWarinTotalDaysResponseInfo.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/response/SnWarinTotalDaysResponseInfo.java index a32d479..88149b2 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/response/SnWarinTotalDaysResponseInfo.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/response/SnWarinTotalDaysResponseInfo.java @@ -1,14 +1,23 @@ package com.newfiber.termite.domain.response; +import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import java.util.Date; + @Data public class SnWarinTotalDaysResponseInfo { /** - * 累计告警天数 + * 连续告警天数 */ @ApiModelProperty(value = "累计告警天数") private Integer count; + + /** + * 告警时间 + */ + + private String formatteddate; } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/mapper/DeviceMonitoringDataMapper.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/mapper/DeviceMonitoringDataMapper.java index e985408..b930ce7 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/mapper/DeviceMonitoringDataMapper.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/mapper/DeviceMonitoringDataMapper.java @@ -40,6 +40,6 @@ List listWarinTotalDays(@Param("projectCode") String projectCode); - SnWarinTotalDaysResponseInfo snWarinTotalDays(SnWarinTotalDaysRequestInfo request); + List snWarinTotalDays(SnWarinTotalDaysRequestInfo request); } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/IDeviceMonitoringDataService.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/IDeviceMonitoringDataService.java index 6979698..496807a 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/IDeviceMonitoringDataService.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/IDeviceMonitoringDataService.java @@ -8,6 +8,9 @@ import com.newfiber.termite.domain.response.SnWarinTotalDaysResponseInfo; import com.newfiber.termite.domain.response.WarnMonitoringResponseInfo; import com.newfiber.termite.enums.EExistsAnt; + +import java.time.LocalDate; +import java.time.LocalTime; import java.util.List; /** @@ -105,6 +108,6 @@ * @param request 查询参数 * @return 累计天数 */ - SnWarinTotalDaysResponseInfo snWarinTotalDays(SnWarinTotalDaysRequestInfo request); + List snWarinTotalDays(SnWarinTotalDaysRequestInfo request,LocalDate date); } 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 488474c..df7bbdb 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 @@ -23,12 +23,15 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import java.time.LocalDate; import java.util.*; import javax.annotation.Resource; import org.springframework.beans.BeanUtils; +import org.springframework.format.annotation.DateTimeFormat; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import javax.validation.constraints.NotNull; @@ -116,9 +119,9 @@ */ @GetMapping("/SnWarinTotalDays") @ApiOperation(value = "查询设备累计告警天数", position = 60) - public Result snWarinTotalDays(SnWarinTotalDaysRequestInfo request){ - SnWarinTotalDaysResponseInfo warinTotalDaysResponseInfo = statisticsService.snWarinTotalDays(request); - return success(warinTotalDaysResponseInfo); + public Result> snWarinTotalDays(SnWarinTotalDaysRequestInfo request,@RequestParam("date") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDate date){ + List warinTotalDaysResponseInfoList = statisticsService.snWarinTotalDays(request,date); + return success(warinTotalDaysResponseInfoList); } } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/SnWarinTotalDaysRequestInfo.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/SnWarinTotalDaysRequestInfo.java index 33b5a79..a96eecb 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/SnWarinTotalDaysRequestInfo.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/SnWarinTotalDaysRequestInfo.java @@ -4,24 +4,19 @@ import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; import java.util.Date; @Data public class SnWarinTotalDaysRequestInfo { - /** - * 开始时间 - */ - @ApiModelProperty(name = "startTime", value = "开始时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private Date startTime; /** - * 结束时间 + * */ - @ApiModelProperty(name = "endTime", value = "结束时间") + @ApiModelProperty(name = "endTime", value = "监测时间") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private Date endTime; + private Date date; /** * 设备编号 diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/response/SnWarinTotalDaysResponseInfo.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/response/SnWarinTotalDaysResponseInfo.java index a32d479..88149b2 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/response/SnWarinTotalDaysResponseInfo.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/response/SnWarinTotalDaysResponseInfo.java @@ -1,14 +1,23 @@ package com.newfiber.termite.domain.response; +import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import java.util.Date; + @Data public class SnWarinTotalDaysResponseInfo { /** - * 累计告警天数 + * 连续告警天数 */ @ApiModelProperty(value = "累计告警天数") private Integer count; + + /** + * 告警时间 + */ + + private String formatteddate; } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/mapper/DeviceMonitoringDataMapper.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/mapper/DeviceMonitoringDataMapper.java index e985408..b930ce7 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/mapper/DeviceMonitoringDataMapper.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/mapper/DeviceMonitoringDataMapper.java @@ -40,6 +40,6 @@ List listWarinTotalDays(@Param("projectCode") String projectCode); - SnWarinTotalDaysResponseInfo snWarinTotalDays(SnWarinTotalDaysRequestInfo request); + List snWarinTotalDays(SnWarinTotalDaysRequestInfo request); } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/IDeviceMonitoringDataService.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/IDeviceMonitoringDataService.java index 6979698..496807a 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/IDeviceMonitoringDataService.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/IDeviceMonitoringDataService.java @@ -8,6 +8,9 @@ import com.newfiber.termite.domain.response.SnWarinTotalDaysResponseInfo; import com.newfiber.termite.domain.response.WarnMonitoringResponseInfo; import com.newfiber.termite.enums.EExistsAnt; + +import java.time.LocalDate; +import java.time.LocalTime; import java.util.List; /** @@ -105,6 +108,6 @@ * @param request 查询参数 * @return 累计天数 */ - SnWarinTotalDaysResponseInfo snWarinTotalDays(SnWarinTotalDaysRequestInfo request); + List snWarinTotalDays(SnWarinTotalDaysRequestInfo request,LocalDate date); } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/IStatisticsService.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/IStatisticsService.java index 3700216..5018b7e 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/IStatisticsService.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/IStatisticsService.java @@ -13,6 +13,8 @@ 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 java.time.LocalDate; import java.util.List; import java.util.Map; @@ -37,6 +39,6 @@ List listWarinTotalDays(WarnMonitoringRequest request); - SnWarinTotalDaysResponseInfo snWarinTotalDays(SnWarinTotalDaysRequestInfo requestfo); + List snWarinTotalDays(SnWarinTotalDaysRequestInfo requestfo,LocalDate date); } 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 488474c..df7bbdb 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 @@ -23,12 +23,15 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import java.time.LocalDate; import java.util.*; import javax.annotation.Resource; import org.springframework.beans.BeanUtils; +import org.springframework.format.annotation.DateTimeFormat; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import javax.validation.constraints.NotNull; @@ -116,9 +119,9 @@ */ @GetMapping("/SnWarinTotalDays") @ApiOperation(value = "查询设备累计告警天数", position = 60) - public Result snWarinTotalDays(SnWarinTotalDaysRequestInfo request){ - SnWarinTotalDaysResponseInfo warinTotalDaysResponseInfo = statisticsService.snWarinTotalDays(request); - return success(warinTotalDaysResponseInfo); + public Result> snWarinTotalDays(SnWarinTotalDaysRequestInfo request,@RequestParam("date") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDate date){ + List warinTotalDaysResponseInfoList = statisticsService.snWarinTotalDays(request,date); + return success(warinTotalDaysResponseInfoList); } } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/SnWarinTotalDaysRequestInfo.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/SnWarinTotalDaysRequestInfo.java index 33b5a79..a96eecb 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/SnWarinTotalDaysRequestInfo.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/SnWarinTotalDaysRequestInfo.java @@ -4,24 +4,19 @@ import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; import java.util.Date; @Data public class SnWarinTotalDaysRequestInfo { - /** - * 开始时间 - */ - @ApiModelProperty(name = "startTime", value = "开始时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private Date startTime; /** - * 结束时间 + * */ - @ApiModelProperty(name = "endTime", value = "结束时间") + @ApiModelProperty(name = "endTime", value = "监测时间") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private Date endTime; + private Date date; /** * 设备编号 diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/response/SnWarinTotalDaysResponseInfo.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/response/SnWarinTotalDaysResponseInfo.java index a32d479..88149b2 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/response/SnWarinTotalDaysResponseInfo.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/response/SnWarinTotalDaysResponseInfo.java @@ -1,14 +1,23 @@ package com.newfiber.termite.domain.response; +import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import java.util.Date; + @Data public class SnWarinTotalDaysResponseInfo { /** - * 累计告警天数 + * 连续告警天数 */ @ApiModelProperty(value = "累计告警天数") private Integer count; + + /** + * 告警时间 + */ + + private String formatteddate; } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/mapper/DeviceMonitoringDataMapper.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/mapper/DeviceMonitoringDataMapper.java index e985408..b930ce7 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/mapper/DeviceMonitoringDataMapper.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/mapper/DeviceMonitoringDataMapper.java @@ -40,6 +40,6 @@ List listWarinTotalDays(@Param("projectCode") String projectCode); - SnWarinTotalDaysResponseInfo snWarinTotalDays(SnWarinTotalDaysRequestInfo request); + List snWarinTotalDays(SnWarinTotalDaysRequestInfo request); } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/IDeviceMonitoringDataService.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/IDeviceMonitoringDataService.java index 6979698..496807a 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/IDeviceMonitoringDataService.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/IDeviceMonitoringDataService.java @@ -8,6 +8,9 @@ import com.newfiber.termite.domain.response.SnWarinTotalDaysResponseInfo; import com.newfiber.termite.domain.response.WarnMonitoringResponseInfo; import com.newfiber.termite.enums.EExistsAnt; + +import java.time.LocalDate; +import java.time.LocalTime; import java.util.List; /** @@ -105,6 +108,6 @@ * @param request 查询参数 * @return 累计天数 */ - SnWarinTotalDaysResponseInfo snWarinTotalDays(SnWarinTotalDaysRequestInfo request); + List snWarinTotalDays(SnWarinTotalDaysRequestInfo request,LocalDate date); } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/IStatisticsService.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/IStatisticsService.java index 3700216..5018b7e 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/IStatisticsService.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/IStatisticsService.java @@ -13,6 +13,8 @@ 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 java.time.LocalDate; import java.util.List; import java.util.Map; @@ -37,6 +39,6 @@ List listWarinTotalDays(WarnMonitoringRequest request); - SnWarinTotalDaysResponseInfo snWarinTotalDays(SnWarinTotalDaysRequestInfo requestfo); + List snWarinTotalDays(SnWarinTotalDaysRequestInfo requestfo,LocalDate date); } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/DeviceMonitoringDataServiceImpl.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/DeviceMonitoringDataServiceImpl.java index 4aec141..8f25064 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/DeviceMonitoringDataServiceImpl.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/DeviceMonitoringDataServiceImpl.java @@ -15,8 +15,11 @@ import com.newfiber.termite.enums.EHeatingFlag; import com.newfiber.termite.mapper.DeviceMonitoringDataMapper; import com.newfiber.termite.service.IDeviceMonitoringDataService; -import java.util.List; -import java.util.Optional; + +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; +import java.util.*; +import java.util.stream.Collectors; import javax.annotation.Resource; import org.springframework.beans.BeanUtils; import org.springframework.data.mongodb.core.MongoTemplate; @@ -145,8 +148,53 @@ } @Override - public SnWarinTotalDaysResponseInfo snWarinTotalDays(SnWarinTotalDaysRequestInfo request) { - return deviceMonitoringDataMapper.snWarinTotalDays(request); + public List snWarinTotalDays(SnWarinTotalDaysRequestInfo request,LocalDate date) { + + List warinTotalDaysResponseInfos = deviceMonitoringDataMapper.snWarinTotalDays(request); + if (warinTotalDaysResponseInfos.size() == 0||warinTotalDaysResponseInfos.isEmpty()) { + SnWarinTotalDaysResponseInfo snWarinTotalDaysResponseInfo = new SnWarinTotalDaysResponseInfo(); + snWarinTotalDaysResponseInfo.setCount(0); + warinTotalDaysResponseInfos.add(snWarinTotalDaysResponseInfo); + return warinTotalDaysResponseInfos; + } else { + List formattedDates = warinTotalDaysResponseInfos.stream() + .map(SnWarinTotalDaysResponseInfo::getFormatteddate) + .collect(Collectors.toList()); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); + List filteredDates = formattedDates.stream() + .map(dateString -> LocalDate.parse(dateString, formatter)) + .filter(localDate -> !localDate.isAfter(date)) + .sorted() // 对筛选后的日期进行排序 + .collect(Collectors.toList()); + List streaks = new ArrayList<>(); + if (!filteredDates.isEmpty()) { + int currentStreak = 1; + for (int i = 1; i < filteredDates.size(); i++) { + if (filteredDates.get(i).minusDays(1).equals(filteredDates.get(i - 1))) { + currentStreak++; + } else { + streaks.add(currentStreak); + currentStreak = 1; + } + } + streaks.add(currentStreak); + } + List snWarinTotalDaysResponseInfos = new ArrayList<>(); + SnWarinTotalDaysResponseInfo snWarinTotalDaysResponseInfo = new SnWarinTotalDaysResponseInfo(); + if(!streaks.isEmpty()){ + snWarinTotalDaysResponseInfo.setCount(streaks.get(streaks.size()-1)); + }else{ + snWarinTotalDaysResponseInfo.setCount(1); + } + snWarinTotalDaysResponseInfos.add(snWarinTotalDaysResponseInfo); + return snWarinTotalDaysResponseInfos; + + } + } } -} + + + + + 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 488474c..df7bbdb 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 @@ -23,12 +23,15 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import java.time.LocalDate; import java.util.*; import javax.annotation.Resource; import org.springframework.beans.BeanUtils; +import org.springframework.format.annotation.DateTimeFormat; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import javax.validation.constraints.NotNull; @@ -116,9 +119,9 @@ */ @GetMapping("/SnWarinTotalDays") @ApiOperation(value = "查询设备累计告警天数", position = 60) - public Result snWarinTotalDays(SnWarinTotalDaysRequestInfo request){ - SnWarinTotalDaysResponseInfo warinTotalDaysResponseInfo = statisticsService.snWarinTotalDays(request); - return success(warinTotalDaysResponseInfo); + public Result> snWarinTotalDays(SnWarinTotalDaysRequestInfo request,@RequestParam("date") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDate date){ + List warinTotalDaysResponseInfoList = statisticsService.snWarinTotalDays(request,date); + return success(warinTotalDaysResponseInfoList); } } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/SnWarinTotalDaysRequestInfo.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/SnWarinTotalDaysRequestInfo.java index 33b5a79..a96eecb 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/SnWarinTotalDaysRequestInfo.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/SnWarinTotalDaysRequestInfo.java @@ -4,24 +4,19 @@ import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; import java.util.Date; @Data public class SnWarinTotalDaysRequestInfo { - /** - * 开始时间 - */ - @ApiModelProperty(name = "startTime", value = "开始时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private Date startTime; /** - * 结束时间 + * */ - @ApiModelProperty(name = "endTime", value = "结束时间") + @ApiModelProperty(name = "endTime", value = "监测时间") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private Date endTime; + private Date date; /** * 设备编号 diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/response/SnWarinTotalDaysResponseInfo.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/response/SnWarinTotalDaysResponseInfo.java index a32d479..88149b2 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/response/SnWarinTotalDaysResponseInfo.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/response/SnWarinTotalDaysResponseInfo.java @@ -1,14 +1,23 @@ package com.newfiber.termite.domain.response; +import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import java.util.Date; + @Data public class SnWarinTotalDaysResponseInfo { /** - * 累计告警天数 + * 连续告警天数 */ @ApiModelProperty(value = "累计告警天数") private Integer count; + + /** + * 告警时间 + */ + + private String formatteddate; } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/mapper/DeviceMonitoringDataMapper.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/mapper/DeviceMonitoringDataMapper.java index e985408..b930ce7 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/mapper/DeviceMonitoringDataMapper.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/mapper/DeviceMonitoringDataMapper.java @@ -40,6 +40,6 @@ List listWarinTotalDays(@Param("projectCode") String projectCode); - SnWarinTotalDaysResponseInfo snWarinTotalDays(SnWarinTotalDaysRequestInfo request); + List snWarinTotalDays(SnWarinTotalDaysRequestInfo request); } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/IDeviceMonitoringDataService.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/IDeviceMonitoringDataService.java index 6979698..496807a 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/IDeviceMonitoringDataService.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/IDeviceMonitoringDataService.java @@ -8,6 +8,9 @@ import com.newfiber.termite.domain.response.SnWarinTotalDaysResponseInfo; import com.newfiber.termite.domain.response.WarnMonitoringResponseInfo; import com.newfiber.termite.enums.EExistsAnt; + +import java.time.LocalDate; +import java.time.LocalTime; import java.util.List; /** @@ -105,6 +108,6 @@ * @param request 查询参数 * @return 累计天数 */ - SnWarinTotalDaysResponseInfo snWarinTotalDays(SnWarinTotalDaysRequestInfo request); + List snWarinTotalDays(SnWarinTotalDaysRequestInfo request,LocalDate date); } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/IStatisticsService.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/IStatisticsService.java index 3700216..5018b7e 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/IStatisticsService.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/IStatisticsService.java @@ -13,6 +13,8 @@ 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 java.time.LocalDate; import java.util.List; import java.util.Map; @@ -37,6 +39,6 @@ List listWarinTotalDays(WarnMonitoringRequest request); - SnWarinTotalDaysResponseInfo snWarinTotalDays(SnWarinTotalDaysRequestInfo requestfo); + List snWarinTotalDays(SnWarinTotalDaysRequestInfo requestfo,LocalDate date); } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/DeviceMonitoringDataServiceImpl.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/DeviceMonitoringDataServiceImpl.java index 4aec141..8f25064 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/DeviceMonitoringDataServiceImpl.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/DeviceMonitoringDataServiceImpl.java @@ -15,8 +15,11 @@ import com.newfiber.termite.enums.EHeatingFlag; import com.newfiber.termite.mapper.DeviceMonitoringDataMapper; import com.newfiber.termite.service.IDeviceMonitoringDataService; -import java.util.List; -import java.util.Optional; + +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; +import java.util.*; +import java.util.stream.Collectors; import javax.annotation.Resource; import org.springframework.beans.BeanUtils; import org.springframework.data.mongodb.core.MongoTemplate; @@ -145,8 +148,53 @@ } @Override - public SnWarinTotalDaysResponseInfo snWarinTotalDays(SnWarinTotalDaysRequestInfo request) { - return deviceMonitoringDataMapper.snWarinTotalDays(request); + public List snWarinTotalDays(SnWarinTotalDaysRequestInfo request,LocalDate date) { + + List warinTotalDaysResponseInfos = deviceMonitoringDataMapper.snWarinTotalDays(request); + if (warinTotalDaysResponseInfos.size() == 0||warinTotalDaysResponseInfos.isEmpty()) { + SnWarinTotalDaysResponseInfo snWarinTotalDaysResponseInfo = new SnWarinTotalDaysResponseInfo(); + snWarinTotalDaysResponseInfo.setCount(0); + warinTotalDaysResponseInfos.add(snWarinTotalDaysResponseInfo); + return warinTotalDaysResponseInfos; + } else { + List formattedDates = warinTotalDaysResponseInfos.stream() + .map(SnWarinTotalDaysResponseInfo::getFormatteddate) + .collect(Collectors.toList()); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); + List filteredDates = formattedDates.stream() + .map(dateString -> LocalDate.parse(dateString, formatter)) + .filter(localDate -> !localDate.isAfter(date)) + .sorted() // 对筛选后的日期进行排序 + .collect(Collectors.toList()); + List streaks = new ArrayList<>(); + if (!filteredDates.isEmpty()) { + int currentStreak = 1; + for (int i = 1; i < filteredDates.size(); i++) { + if (filteredDates.get(i).minusDays(1).equals(filteredDates.get(i - 1))) { + currentStreak++; + } else { + streaks.add(currentStreak); + currentStreak = 1; + } + } + streaks.add(currentStreak); + } + List snWarinTotalDaysResponseInfos = new ArrayList<>(); + SnWarinTotalDaysResponseInfo snWarinTotalDaysResponseInfo = new SnWarinTotalDaysResponseInfo(); + if(!streaks.isEmpty()){ + snWarinTotalDaysResponseInfo.setCount(streaks.get(streaks.size()-1)); + }else{ + snWarinTotalDaysResponseInfo.setCount(1); + } + snWarinTotalDaysResponseInfos.add(snWarinTotalDaysResponseInfo); + return snWarinTotalDaysResponseInfos; + + } + } } -} + + + + + 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 90f7565..56912aa 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 @@ -5,6 +5,7 @@ import com.newfiber.termite.domain.DeviceMonitoringData; import com.newfiber.termite.domain.ProjectInfo; import com.newfiber.termite.domain.request.SnWarinTotalDaysRequestInfo; +import com.newfiber.termite.domain.request.TermiteInfoQueryRequest; import com.newfiber.termite.domain.request.WarnMonitoringRequest; import com.newfiber.termite.domain.request.WarnMonthAlarmsRequest; import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoQueryRequest; @@ -13,12 +14,7 @@ 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.SnWarinTotalDaysResponseInfo; -import com.newfiber.termite.domain.response.WarnMonitoringResponse; -import com.newfiber.termite.domain.response.WarnMonitoringResponseDaysInfo; -import com.newfiber.termite.domain.response.WarnMonitoringResponseInfo; -import com.newfiber.termite.domain.response.WarnMonthAlarmsResponse; -import com.newfiber.termite.domain.response.WarnMonthAlarmsResponseInfo; +import com.newfiber.termite.domain.response.*; import com.newfiber.termite.domain.response.statistic.MonitoringWarnResponseStatistics; import com.newfiber.termite.domain.response.statistic.ProjectStatistic; import com.newfiber.termite.domain.response.statistic.ProjectStatisticDetail; @@ -26,12 +22,8 @@ import com.newfiber.termite.domain.response.statistic.SiteTotalWarnCount; import com.newfiber.termite.enums.EBusinessBaseRedisKey; import com.newfiber.termite.enums.EExistsAnt; -import com.newfiber.termite.service.IDeviceInfoService; -import com.newfiber.termite.service.IDeviceMonitoringDataRealtimeService; -import com.newfiber.termite.service.IDeviceMonitoringDataService; -import com.newfiber.termite.service.IMonitoringWarnRecordService; -import com.newfiber.termite.service.IProjectInfoService; -import com.newfiber.termite.service.IStatisticsService; +import com.newfiber.termite.service.*; + import java.math.BigDecimal; import java.math.RoundingMode; import java.time.LocalDate; @@ -77,6 +69,10 @@ @Resource private RedisService redisService; + + @Resource + private ITermiteService termiteService; + @Override public Map> warnDailySeqStatistic(SiteWarnDailySeqStatisticRequest request) { List deviceMonitoringDataList = deviceMonitoringDataService.selectList(request.getProjectCode(), EExistsAnt.True); @@ -275,7 +271,12 @@ warnMonitoringRequest.setProjectCode(request.getProjectCode()); WarnMonitoringResponse warnMonitoringResponse = this.warnMonitoring(warnMonitoringRequest); //累计告警站点数 - Long countDay = (warnMonitoringResponse.getWarnmoitoringCountDay() != null) ? warnMonitoringResponse.getWarnmoitoringCountDay() : 0L; + TermiteInfoQueryRequest termiteInfoQueryRequest = new TermiteInfoQueryRequest(); + termiteInfoQueryRequest.setProjectCode(request.getProjectCode()); + List termiteInfoResponses=termiteService.querytermiteData(termiteInfoQueryRequest); + int size = termiteInfoResponses.size(); + long countDay = (long) size; + Long WarncountDay = (warnMonitoringResponse.getWarnmoitoringCountDay() != null) ? warnMonitoringResponse.getWarnmoitoringCountDay() : 0L; LocalDate now = LocalDate.now(); int currentYear = now.getYear(); List stringx = new ArrayList<>(); @@ -309,13 +310,12 @@ percentage = BigDecimal.ZERO; warnMonthAlarmsResponse.setDeviceCountProportion(percentage.doubleValue()); }else{ - percentage = new BigDecimal(((double) countDay) / warnMonitoringResponse.getWarnmoitoringListInfo().size()) + percentage = new BigDecimal(((double) WarncountDay) / countDay) .multiply(BigDecimal.valueOf(100)) .setScale(2, RoundingMode.HALF_UP); warnMonthAlarmsResponse.setDeviceCountProportion(percentage.doubleValue()); } - long warnMonitorlong=warnMonitoringResponse.getWarnmoitoringListInfo().size(); - warnMonthAlarmsResponse.setWarnDeviceCount(warnMonitorlong); + warnMonthAlarmsResponse.setWarnDeviceCount(countDay); return warnMonthAlarmsResponse; } @@ -340,15 +340,15 @@ //累计告警天数统计,并计算百分比 Map durationToSnCount = new HashMap<>(); - List allDurationRanges = Arrays.asList("无告警", "2-3天", "4-6天", "7-15天", ">15天"); + List allDurationRanges = Arrays.asList("无告警", "1-3天", "4-6天", "7-15天", ">15天"); allDurationRanges.forEach(range -> durationToSnCount.put(range, 0L)); listWarinTotalDays.forEach(info -> { int day = info.getCountDays(); String key; - if (day <= 1) { + if (day < 1) { key = "无告警"; - } else if (day >= 2 && day <= 3) { - key = "2-3天"; + } else if (day >= 1 && day <= 3) { + key = "1-3天"; } else if (day >= 4 && day <= 6) { key = "4-6天"; } else if (day >= 7 && day <= 15) { @@ -388,8 +388,8 @@ } @Override - public SnWarinTotalDaysResponseInfo snWarinTotalDays(SnWarinTotalDaysRequestInfo request) { - return deviceMonitoringDataService.snWarinTotalDays(request); + public List snWarinTotalDays(SnWarinTotalDaysRequestInfo request,LocalDate date) { + return deviceMonitoringDataService.snWarinTotalDays(request,date); } } 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 488474c..df7bbdb 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 @@ -23,12 +23,15 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import java.time.LocalDate; import java.util.*; import javax.annotation.Resource; import org.springframework.beans.BeanUtils; +import org.springframework.format.annotation.DateTimeFormat; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import javax.validation.constraints.NotNull; @@ -116,9 +119,9 @@ */ @GetMapping("/SnWarinTotalDays") @ApiOperation(value = "查询设备累计告警天数", position = 60) - public Result snWarinTotalDays(SnWarinTotalDaysRequestInfo request){ - SnWarinTotalDaysResponseInfo warinTotalDaysResponseInfo = statisticsService.snWarinTotalDays(request); - return success(warinTotalDaysResponseInfo); + public Result> snWarinTotalDays(SnWarinTotalDaysRequestInfo request,@RequestParam("date") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDate date){ + List warinTotalDaysResponseInfoList = statisticsService.snWarinTotalDays(request,date); + return success(warinTotalDaysResponseInfoList); } } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/SnWarinTotalDaysRequestInfo.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/SnWarinTotalDaysRequestInfo.java index 33b5a79..a96eecb 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/SnWarinTotalDaysRequestInfo.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/SnWarinTotalDaysRequestInfo.java @@ -4,24 +4,19 @@ import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; import java.util.Date; @Data public class SnWarinTotalDaysRequestInfo { - /** - * 开始时间 - */ - @ApiModelProperty(name = "startTime", value = "开始时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private Date startTime; /** - * 结束时间 + * */ - @ApiModelProperty(name = "endTime", value = "结束时间") + @ApiModelProperty(name = "endTime", value = "监测时间") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private Date endTime; + private Date date; /** * 设备编号 diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/response/SnWarinTotalDaysResponseInfo.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/response/SnWarinTotalDaysResponseInfo.java index a32d479..88149b2 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/response/SnWarinTotalDaysResponseInfo.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/response/SnWarinTotalDaysResponseInfo.java @@ -1,14 +1,23 @@ package com.newfiber.termite.domain.response; +import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import java.util.Date; + @Data public class SnWarinTotalDaysResponseInfo { /** - * 累计告警天数 + * 连续告警天数 */ @ApiModelProperty(value = "累计告警天数") private Integer count; + + /** + * 告警时间 + */ + + private String formatteddate; } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/mapper/DeviceMonitoringDataMapper.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/mapper/DeviceMonitoringDataMapper.java index e985408..b930ce7 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/mapper/DeviceMonitoringDataMapper.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/mapper/DeviceMonitoringDataMapper.java @@ -40,6 +40,6 @@ List listWarinTotalDays(@Param("projectCode") String projectCode); - SnWarinTotalDaysResponseInfo snWarinTotalDays(SnWarinTotalDaysRequestInfo request); + List snWarinTotalDays(SnWarinTotalDaysRequestInfo request); } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/IDeviceMonitoringDataService.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/IDeviceMonitoringDataService.java index 6979698..496807a 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/IDeviceMonitoringDataService.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/IDeviceMonitoringDataService.java @@ -8,6 +8,9 @@ import com.newfiber.termite.domain.response.SnWarinTotalDaysResponseInfo; import com.newfiber.termite.domain.response.WarnMonitoringResponseInfo; import com.newfiber.termite.enums.EExistsAnt; + +import java.time.LocalDate; +import java.time.LocalTime; import java.util.List; /** @@ -105,6 +108,6 @@ * @param request 查询参数 * @return 累计天数 */ - SnWarinTotalDaysResponseInfo snWarinTotalDays(SnWarinTotalDaysRequestInfo request); + List snWarinTotalDays(SnWarinTotalDaysRequestInfo request,LocalDate date); } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/IStatisticsService.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/IStatisticsService.java index 3700216..5018b7e 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/IStatisticsService.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/IStatisticsService.java @@ -13,6 +13,8 @@ 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 java.time.LocalDate; import java.util.List; import java.util.Map; @@ -37,6 +39,6 @@ List listWarinTotalDays(WarnMonitoringRequest request); - SnWarinTotalDaysResponseInfo snWarinTotalDays(SnWarinTotalDaysRequestInfo requestfo); + List snWarinTotalDays(SnWarinTotalDaysRequestInfo requestfo,LocalDate date); } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/DeviceMonitoringDataServiceImpl.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/DeviceMonitoringDataServiceImpl.java index 4aec141..8f25064 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/DeviceMonitoringDataServiceImpl.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/DeviceMonitoringDataServiceImpl.java @@ -15,8 +15,11 @@ import com.newfiber.termite.enums.EHeatingFlag; import com.newfiber.termite.mapper.DeviceMonitoringDataMapper; import com.newfiber.termite.service.IDeviceMonitoringDataService; -import java.util.List; -import java.util.Optional; + +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; +import java.util.*; +import java.util.stream.Collectors; import javax.annotation.Resource; import org.springframework.beans.BeanUtils; import org.springframework.data.mongodb.core.MongoTemplate; @@ -145,8 +148,53 @@ } @Override - public SnWarinTotalDaysResponseInfo snWarinTotalDays(SnWarinTotalDaysRequestInfo request) { - return deviceMonitoringDataMapper.snWarinTotalDays(request); + public List snWarinTotalDays(SnWarinTotalDaysRequestInfo request,LocalDate date) { + + List warinTotalDaysResponseInfos = deviceMonitoringDataMapper.snWarinTotalDays(request); + if (warinTotalDaysResponseInfos.size() == 0||warinTotalDaysResponseInfos.isEmpty()) { + SnWarinTotalDaysResponseInfo snWarinTotalDaysResponseInfo = new SnWarinTotalDaysResponseInfo(); + snWarinTotalDaysResponseInfo.setCount(0); + warinTotalDaysResponseInfos.add(snWarinTotalDaysResponseInfo); + return warinTotalDaysResponseInfos; + } else { + List formattedDates = warinTotalDaysResponseInfos.stream() + .map(SnWarinTotalDaysResponseInfo::getFormatteddate) + .collect(Collectors.toList()); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); + List filteredDates = formattedDates.stream() + .map(dateString -> LocalDate.parse(dateString, formatter)) + .filter(localDate -> !localDate.isAfter(date)) + .sorted() // 对筛选后的日期进行排序 + .collect(Collectors.toList()); + List streaks = new ArrayList<>(); + if (!filteredDates.isEmpty()) { + int currentStreak = 1; + for (int i = 1; i < filteredDates.size(); i++) { + if (filteredDates.get(i).minusDays(1).equals(filteredDates.get(i - 1))) { + currentStreak++; + } else { + streaks.add(currentStreak); + currentStreak = 1; + } + } + streaks.add(currentStreak); + } + List snWarinTotalDaysResponseInfos = new ArrayList<>(); + SnWarinTotalDaysResponseInfo snWarinTotalDaysResponseInfo = new SnWarinTotalDaysResponseInfo(); + if(!streaks.isEmpty()){ + snWarinTotalDaysResponseInfo.setCount(streaks.get(streaks.size()-1)); + }else{ + snWarinTotalDaysResponseInfo.setCount(1); + } + snWarinTotalDaysResponseInfos.add(snWarinTotalDaysResponseInfo); + return snWarinTotalDaysResponseInfos; + + } + } } -} + + + + + 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 90f7565..56912aa 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 @@ -5,6 +5,7 @@ import com.newfiber.termite.domain.DeviceMonitoringData; import com.newfiber.termite.domain.ProjectInfo; import com.newfiber.termite.domain.request.SnWarinTotalDaysRequestInfo; +import com.newfiber.termite.domain.request.TermiteInfoQueryRequest; import com.newfiber.termite.domain.request.WarnMonitoringRequest; import com.newfiber.termite.domain.request.WarnMonthAlarmsRequest; import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoQueryRequest; @@ -13,12 +14,7 @@ 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.SnWarinTotalDaysResponseInfo; -import com.newfiber.termite.domain.response.WarnMonitoringResponse; -import com.newfiber.termite.domain.response.WarnMonitoringResponseDaysInfo; -import com.newfiber.termite.domain.response.WarnMonitoringResponseInfo; -import com.newfiber.termite.domain.response.WarnMonthAlarmsResponse; -import com.newfiber.termite.domain.response.WarnMonthAlarmsResponseInfo; +import com.newfiber.termite.domain.response.*; import com.newfiber.termite.domain.response.statistic.MonitoringWarnResponseStatistics; import com.newfiber.termite.domain.response.statistic.ProjectStatistic; import com.newfiber.termite.domain.response.statistic.ProjectStatisticDetail; @@ -26,12 +22,8 @@ import com.newfiber.termite.domain.response.statistic.SiteTotalWarnCount; import com.newfiber.termite.enums.EBusinessBaseRedisKey; import com.newfiber.termite.enums.EExistsAnt; -import com.newfiber.termite.service.IDeviceInfoService; -import com.newfiber.termite.service.IDeviceMonitoringDataRealtimeService; -import com.newfiber.termite.service.IDeviceMonitoringDataService; -import com.newfiber.termite.service.IMonitoringWarnRecordService; -import com.newfiber.termite.service.IProjectInfoService; -import com.newfiber.termite.service.IStatisticsService; +import com.newfiber.termite.service.*; + import java.math.BigDecimal; import java.math.RoundingMode; import java.time.LocalDate; @@ -77,6 +69,10 @@ @Resource private RedisService redisService; + + @Resource + private ITermiteService termiteService; + @Override public Map> warnDailySeqStatistic(SiteWarnDailySeqStatisticRequest request) { List deviceMonitoringDataList = deviceMonitoringDataService.selectList(request.getProjectCode(), EExistsAnt.True); @@ -275,7 +271,12 @@ warnMonitoringRequest.setProjectCode(request.getProjectCode()); WarnMonitoringResponse warnMonitoringResponse = this.warnMonitoring(warnMonitoringRequest); //累计告警站点数 - Long countDay = (warnMonitoringResponse.getWarnmoitoringCountDay() != null) ? warnMonitoringResponse.getWarnmoitoringCountDay() : 0L; + TermiteInfoQueryRequest termiteInfoQueryRequest = new TermiteInfoQueryRequest(); + termiteInfoQueryRequest.setProjectCode(request.getProjectCode()); + List termiteInfoResponses=termiteService.querytermiteData(termiteInfoQueryRequest); + int size = termiteInfoResponses.size(); + long countDay = (long) size; + Long WarncountDay = (warnMonitoringResponse.getWarnmoitoringCountDay() != null) ? warnMonitoringResponse.getWarnmoitoringCountDay() : 0L; LocalDate now = LocalDate.now(); int currentYear = now.getYear(); List stringx = new ArrayList<>(); @@ -309,13 +310,12 @@ percentage = BigDecimal.ZERO; warnMonthAlarmsResponse.setDeviceCountProportion(percentage.doubleValue()); }else{ - percentage = new BigDecimal(((double) countDay) / warnMonitoringResponse.getWarnmoitoringListInfo().size()) + percentage = new BigDecimal(((double) WarncountDay) / countDay) .multiply(BigDecimal.valueOf(100)) .setScale(2, RoundingMode.HALF_UP); warnMonthAlarmsResponse.setDeviceCountProportion(percentage.doubleValue()); } - long warnMonitorlong=warnMonitoringResponse.getWarnmoitoringListInfo().size(); - warnMonthAlarmsResponse.setWarnDeviceCount(warnMonitorlong); + warnMonthAlarmsResponse.setWarnDeviceCount(countDay); return warnMonthAlarmsResponse; } @@ -340,15 +340,15 @@ //累计告警天数统计,并计算百分比 Map durationToSnCount = new HashMap<>(); - List allDurationRanges = Arrays.asList("无告警", "2-3天", "4-6天", "7-15天", ">15天"); + List allDurationRanges = Arrays.asList("无告警", "1-3天", "4-6天", "7-15天", ">15天"); allDurationRanges.forEach(range -> durationToSnCount.put(range, 0L)); listWarinTotalDays.forEach(info -> { int day = info.getCountDays(); String key; - if (day <= 1) { + if (day < 1) { key = "无告警"; - } else if (day >= 2 && day <= 3) { - key = "2-3天"; + } else if (day >= 1 && day <= 3) { + key = "1-3天"; } else if (day >= 4 && day <= 6) { key = "4-6天"; } else if (day >= 7 && day <= 15) { @@ -388,8 +388,8 @@ } @Override - public SnWarinTotalDaysResponseInfo snWarinTotalDays(SnWarinTotalDaysRequestInfo request) { - return deviceMonitoringDataService.snWarinTotalDays(request); + public List snWarinTotalDays(SnWarinTotalDaysRequestInfo request,LocalDate date) { + return deviceMonitoringDataService.snWarinTotalDays(request,date); } } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/resources/mapper/termite/DeviceMonitoringDataMapper.xml b/newfiber-termites/newfiber-termites-dataup/src/main/resources/mapper/termite/DeviceMonitoringDataMapper.xml index 6a1ffa3..f8c78f0 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/resources/mapper/termite/DeviceMonitoringDataMapper.xml +++ b/newfiber-termites/newfiber-termites-dataup/src/main/resources/mapper/termite/DeviceMonitoringDataMapper.xml @@ -117,21 +117,10 @@