diff --git a/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/pojo/param/eventReport/ExportParam.java b/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/pojo/param/eventReport/ExportParam.java index ef025f7..0fd7322 100644 --- a/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/pojo/param/eventReport/ExportParam.java +++ b/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/pojo/param/eventReport/ExportParam.java @@ -1,75 +1,75 @@ -package com.njcn.csharmonic.pojo.param.eventReport; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.io.Serializable; - -/** - * @author xxy - * @version 1.0.0 - * @date 2022年08月16日 19:37 - */ -@Data -public class ExportParam implements Serializable { - - @ApiModelProperty(name = "lineId",value = "监测点ID") - private String lineId; - - @ApiModelProperty(name = "searchBeginTime",value = "开始时间") - private String searchBeginTime; - - @ApiModelProperty(name = "searchEndTime",value = "结束时间") - private String searchEndTime; - - @ApiModelProperty(name = "lineName",value = "监测点名称") - private String lineName; - - @ApiModelProperty(name = "xq",value = "监测点详情",example = "true") - private boolean xq; - - @ApiModelProperty(name = "lb",value = "暂降事件列表",example = "true") - private boolean lb; - - @ApiModelProperty(name = "mdbg",value = "暂降密度表格",example = "false") - private boolean mdbg; - - @ApiModelProperty(name = "mdtx",value = "暂降密度图形",example = "false") - private boolean mdtx; - - @ApiModelProperty(name = "sjdITIC",value = "暂降时间点ITIC",example = "false") - private boolean sjdITIC; - - @ApiModelProperty(name = "sjdF47",value = "暂降时间点F47",example = "false") - private boolean sjdF47; - - @ApiModelProperty(name = "glfbfz",value = "概率分布暂降赋值",example = "false") - private boolean glfbfz; - - @ApiModelProperty(name = "glfbsj",value = "概率分布持续时间",example = "false") - private boolean glfbsj; - - @ApiModelProperty(name = "tjbg",value = "月份统计表格",example = "false") - private boolean tjbg; - - @ApiModelProperty(name = "tjtx",value = "月份统计图形",example = "false") - private boolean tjtx; - - @ApiModelProperty(name = "yybg",value = "暂降原因表格",example = "false") - private boolean yybg; - - @ApiModelProperty(name = "yytx",value = "暂降原因图形",example = "false") - private boolean yytx; - - @ApiModelProperty(name = "lxbg",value = "暂降类型表格",example = "false") - private boolean lxbg; - - @ApiModelProperty(name = "lxtx",value = "暂降类型图形",example = "false") - private boolean lxtx; - - @ApiModelProperty(name = "flag",value = "标识") - private Integer flag; - - @ApiModelProperty(name = "type",value = "系统区分(0:pq 1:pms)") - private Integer type; -} +//package com.njcn.csharmonic.pojo.param.eventReport; +// +//import io.swagger.annotations.ApiModelProperty; +//import lombok.Data; +// +//import java.io.Serializable; +// +///** +// * @author xxy +// * @version 1.0.0 +// * @date 2022年08月16日 19:37 +// */ +//@Data +//public class ExportParam implements Serializable { +// +// @ApiModelProperty(name = "lineId",value = "监测点ID") +// private String lineId; +// +// @ApiModelProperty(name = "searchBeginTime",value = "开始时间") +// private String searchBeginTime; +// +// @ApiModelProperty(name = "searchEndTime",value = "结束时间") +// private String searchEndTime; +// +// @ApiModelProperty(name = "lineName",value = "监测点名称") +// private String lineName; +// +// @ApiModelProperty(name = "xq",value = "监测点详情",example = "true") +// private boolean xq; +// +// @ApiModelProperty(name = "lb",value = "暂降事件列表",example = "true") +// private boolean lb; +// +// @ApiModelProperty(name = "mdbg",value = "暂降密度表格",example = "false") +// private boolean mdbg; +// +// @ApiModelProperty(name = "mdtx",value = "暂降密度图形",example = "false") +// private boolean mdtx; +// +// @ApiModelProperty(name = "sjdITIC",value = "暂降时间点ITIC",example = "false") +// private boolean sjdITIC; +// +// @ApiModelProperty(name = "sjdF47",value = "暂降时间点F47",example = "false") +// private boolean sjdF47; +// +// @ApiModelProperty(name = "glfbfz",value = "概率分布暂降赋值",example = "false") +// private boolean glfbfz; +// +// @ApiModelProperty(name = "glfbsj",value = "概率分布持续时间",example = "false") +// private boolean glfbsj; +// +// @ApiModelProperty(name = "tjbg",value = "月份统计表格",example = "false") +// private boolean tjbg; +// +// @ApiModelProperty(name = "tjtx",value = "月份统计图形",example = "false") +// private boolean tjtx; +// +// @ApiModelProperty(name = "yybg",value = "暂降原因表格",example = "false") +// private boolean yybg; +// +// @ApiModelProperty(name = "yytx",value = "暂降原因图形",example = "false") +// private boolean yytx; +// +// @ApiModelProperty(name = "lxbg",value = "暂降类型表格",example = "false") +// private boolean lxbg; +// +// @ApiModelProperty(name = "lxtx",value = "暂降类型图形",example = "false") +// private boolean lxtx; +// +// @ApiModelProperty(name = "flag",value = "标识") +// private Integer flag; +// +// @ApiModelProperty(name = "type",value = "系统区分(0:pq 1:pms)") +// private Integer type; +//} diff --git a/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/pojo/po/RmpEventDetailPO.java b/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/pojo/po/RmpEventDetailPO.java index fc44530..8b866e4 100644 --- a/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/pojo/po/RmpEventDetailPO.java +++ b/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/pojo/po/RmpEventDetailPO.java @@ -1,127 +1,127 @@ -package com.njcn.csharmonic.pojo.po; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.io.Serializable; -import java.time.LocalDateTime; - -/** - * 暂降明细实体类 - * - * @author yzh - * @since 2022-10-12 18:34:55 - */ -@Data -@TableName("r_mp_event_detail") -@ApiModel(value="RmpEventDetail对象") -public class RmpEventDetailPO implements Serializable { - private static final long serialVersionUID = 1L; - - @ApiModelProperty(value = "暂时事件ID") - @TableId(value = "event_id", type = IdType.ASSIGN_ID) - private String eventId; - - @ApiModelProperty(value = "监测点ID") - private String measurementPointId; - - @ApiModelProperty(value = "监测点ID(复制)") - @TableField("measurement_point_id") - private String lineId; - - @ApiModelProperty(value = "统计类型") - private String eventType; - - @ApiModelProperty(value = "暂降原因(Event_Reason)") - @TableField("advance_reason") - private String advanceReason; - - @ApiModelProperty(value = "暂降类型(Event_Type)") - @TableField("advance_type") - private String advanceType; - - @ApiModelProperty(value = "事件关联分析表Guid") - private String eventassIndex; - - @ApiModelProperty(value = "dq计算持续时间 ") - private Double dqTime; - - @ApiModelProperty(value = "特征值计算更新时间(外键PQS_Relevance的Time字段)") - private LocalDateTime dealTime; - - @ApiModelProperty(value = "默认事件个数为0") - private Integer num; - - @ApiModelProperty(value = "波形文件是否从装置招到本地(0:未招,1:已招)默认值为0") - private Integer fileFlag; - - @ApiModelProperty(value = "特征值计算标志(0,未处理;1,已处理; 2,已处理,无结果;3,计算失败)默认值为0") - private Integer dealFlag; - - @ApiModelProperty(value = "处理结果第一条事件发生时间(读comtra文件获取)") - private LocalDateTime firstTime; - - @ApiModelProperty(value = "处理结果第一条事件暂降类型(字典表PQS_Dicdata)") - private String firstType; - - @ApiModelProperty(value = "处理结果第一条事件发生时间毫秒(读comtra文件获取)") - private Double firstMs; - - @ApiModelProperty(value = "暂降能量") - private Double energy; - - @ApiModelProperty(value = "暂降严重度") - private Double severity; - - @ApiModelProperty(value = "暂降源与监测位置关系 Upper:上游;Lower :下游;Unknown :未知;为空则是未计算") - private String sagsource; - - @ApiModelProperty(value = "开始时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS") - private LocalDateTime startTime; - - @ApiModelProperty(value = "格式化开始时间") - @TableField(exist = false) - private String formatTime; - - - @ApiModelProperty(value = "持续时间,单位秒") - private Double duration; - - @ApiModelProperty(value = "特征幅值") - private Double featureAmplitude; - - @ApiModelProperty(value = "相别") - private String phase; - - @ApiModelProperty(value = "事件描述") - private String eventDescribe; - - @ApiModelProperty(value = "波形路径") - private String wavePath; - - @ApiModelProperty(value = "暂降核实原因") - @TableField("verify_reason") - private String verifyReason; - - @ApiModelProperty(value = "暂降核实原因详情") - @TableField("verify_reason_detail") - private String verifyReasonDetail; - - private Double transientValue; - - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @ApiModelProperty(value = "用于计算数量") - @TableField(exist = false) - private Integer count; - -} - +//package com.njcn.csharmonic.pojo.po; +// +//import com.baomidou.mybatisplus.annotation.IdType; +//import com.baomidou.mybatisplus.annotation.TableField; +//import com.baomidou.mybatisplus.annotation.TableId; +//import com.baomidou.mybatisplus.annotation.TableName; +//import com.fasterxml.jackson.annotation.JsonFormat; +//import io.swagger.annotations.ApiModel; +//import io.swagger.annotations.ApiModelProperty; +//import lombok.Data; +// +//import java.io.Serializable; +//import java.time.LocalDateTime; +// +///** +// * 暂降明细实体类 +// * +// * @author yzh +// * @since 2022-10-12 18:34:55 +// */ +//@Data +//@TableName("r_mp_event_detail") +//@ApiModel(value="RmpEventDetail对象") +//public class RmpEventDetailPO implements Serializable { +// private static final long serialVersionUID = 1L; +// +// @ApiModelProperty(value = "暂时事件ID") +// @TableId(value = "event_id", type = IdType.ASSIGN_ID) +// private String eventId; +// +// @ApiModelProperty(value = "监测点ID") +// private String measurementPointId; +// +// @ApiModelProperty(value = "监测点ID(复制)") +// @TableField("measurement_point_id") +// private String lineId; +// +// @ApiModelProperty(value = "统计类型") +// private String eventType; +// +// @ApiModelProperty(value = "暂降原因(Event_Reason)") +// @TableField("advance_reason") +// private String advanceReason; +// +// @ApiModelProperty(value = "暂降类型(Event_Type)") +// @TableField("advance_type") +// private String advanceType; +// +// @ApiModelProperty(value = "事件关联分析表Guid") +// private String eventassIndex; +// +// @ApiModelProperty(value = "dq计算持续时间 ") +// private Double dqTime; +// +// @ApiModelProperty(value = "特征值计算更新时间(外键PQS_Relevance的Time字段)") +// private LocalDateTime dealTime; +// +// @ApiModelProperty(value = "默认事件个数为0") +// private Integer num; +// +// @ApiModelProperty(value = "波形文件是否从装置招到本地(0:未招,1:已招)默认值为0") +// private Integer fileFlag; +// +// @ApiModelProperty(value = "特征值计算标志(0,未处理;1,已处理; 2,已处理,无结果;3,计算失败)默认值为0") +// private Integer dealFlag; +// +// @ApiModelProperty(value = "处理结果第一条事件发生时间(读comtra文件获取)") +// private LocalDateTime firstTime; +// +// @ApiModelProperty(value = "处理结果第一条事件暂降类型(字典表PQS_Dicdata)") +// private String firstType; +// +// @ApiModelProperty(value = "处理结果第一条事件发生时间毫秒(读comtra文件获取)") +// private Double firstMs; +// +// @ApiModelProperty(value = "暂降能量") +// private Double energy; +// +// @ApiModelProperty(value = "暂降严重度") +// private Double severity; +// +// @ApiModelProperty(value = "暂降源与监测位置关系 Upper:上游;Lower :下游;Unknown :未知;为空则是未计算") +// private String sagsource; +// +// @ApiModelProperty(value = "开始时间") +// @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS") +// private LocalDateTime startTime; +// +// @ApiModelProperty(value = "格式化开始时间") +// @TableField(exist = false) +// private String formatTime; +// +// +// @ApiModelProperty(value = "持续时间,单位秒") +// private Double duration; +// +// @ApiModelProperty(value = "特征幅值") +// private Double featureAmplitude; +// +// @ApiModelProperty(value = "相别") +// private String phase; +// +// @ApiModelProperty(value = "事件描述") +// private String eventDescribe; +// +// @ApiModelProperty(value = "波形路径") +// private String wavePath; +// +// @ApiModelProperty(value = "暂降核实原因") +// @TableField("verify_reason") +// private String verifyReason; +// +// @ApiModelProperty(value = "暂降核实原因详情") +// @TableField("verify_reason_detail") +// private String verifyReasonDetail; +// +// private Double transientValue; +// +// @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") +// private LocalDateTime createTime; +// +// @ApiModelProperty(value = "用于计算数量") +// @TableField(exist = false) +// private Integer count; +// +//} +// diff --git a/cs-harmonic/cs-harmonic-boot/pom.xml b/cs-harmonic/cs-harmonic-boot/pom.xml index ee659e7..b914250 100644 --- a/cs-harmonic/cs-harmonic-boot/pom.xml +++ b/cs-harmonic/cs-harmonic-boot/pom.xml @@ -146,9 +146,13 @@ com.njcn harmonic-common 1.0.0 - compile + + com.njcn + event-common + 1.0.0 + diff --git a/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/controller/EventMonitorReportController.java b/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/controller/CsEventMonitorReportController.java similarity index 68% rename from cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/controller/EventMonitorReportController.java rename to cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/controller/CsEventMonitorReportController.java index 3c2ea6e..8da616a 100644 --- a/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/controller/EventMonitorReportController.java +++ b/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/controller/CsEventMonitorReportController.java @@ -1,10 +1,16 @@ package com.njcn.csharmonic.controller; +import cn.hutool.core.bean.BeanUtil; import cn.hutool.extra.template.TemplateException; +import com.baomidou.dynamic.datasource.annotation.DS; import com.njcn.common.pojo.annotation.OperateInfo; import com.njcn.common.pojo.enums.common.LogEnum; -import com.njcn.csharmonic.pojo.param.eventReport.ExportParam; -import com.njcn.csharmonic.service.event.EventMonitorReportService; +import com.njcn.csdevice.api.CsLineFeignClient; +import com.njcn.csdevice.pojo.vo.LineDetailDataVO; +import com.njcn.csharmonic.service.event.CsEventMonitorReportService; +import com.njcn.event.common.pojo.dto.LineDetailDataCommDTO; +import com.njcn.event.common.service.EventMonitorReportService; +import com.njcn.event.pojo.param.ExportParam; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiOperation; @@ -32,16 +38,17 @@ import java.text.ParseException; @RestController @RequestMapping("/eventReport") @RequiredArgsConstructor -public class EventMonitorReportController { +public class CsEventMonitorReportController { - private final EventMonitorReportService eventMonitorReportService; + private final CsEventMonitorReportService monitorEventReportService; + private final CsLineFeignClient csLineFeignClient; @OperateInfo(info = LogEnum.BUSINESS_COMMON) @PostMapping("/getLineExport") @ApiOperation("监测点报告导出") @ApiImplicitParam(name = "exportParam", value = "监测点报告导出参数", required = true) public void getLineExport(@RequestBody @Validated ExportParam exportParam, HttpServletResponse response) throws IOException, InvalidFormatException, TemplateException, ParseException { - eventMonitorReportService.getLineExport(exportParam, response); + monitorEventReportService.getLineExport(exportParam, response); } } diff --git a/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/controller/CustomReportController.java b/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/controller/CustomReportController.java index c46392e..c48152d 100644 --- a/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/controller/CustomReportController.java +++ b/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/controller/CustomReportController.java @@ -13,6 +13,7 @@ import com.njcn.csharmonic.pojo.vo.ReportTreeVO; import com.njcn.csharmonic.pojo.vo.SysDeptTempVO; import com.njcn.csharmonic.service.CustomReportService; import com.njcn.harmonic.common.pojo.vo.ReportTemplateVO; +import com.njcn.harmonic.common.service.CustomReportTableService; import com.njcn.harmonic.pojo.param.ReportSearchParam; import com.njcn.harmonic.pojo.po.ExcelRptTemp; import com.njcn.web.controller.BaseController; @@ -44,6 +45,8 @@ public class CustomReportController extends BaseController { private final CustomReportService customReportService; + + /** * 替换报表数据并返回 * @author qijian diff --git a/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/controller/WordExportModelController.java b/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/controller/WordExportModelController.java index 37417bf..db4aaed 100644 --- a/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/controller/WordExportModelController.java +++ b/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/controller/WordExportModelController.java @@ -7,7 +7,7 @@ import com.njcn.csdevice.pojo.vo.LineDetailDataVO; import com.njcn.device.biz.pojo.po.Overlimit; import com.njcn.device.biz.pojo.po.PqsDeviceUnit; import com.njcn.harmonic.common.pojo.dto.DeviceUnitCommDTO; -import com.njcn.harmonic.common.pojo.dto.LineDetailDataCommVO; +import com.njcn.harmonic.common.pojo.dto.HarmLineDetailDataCommDTO; import com.njcn.harmonic.common.pojo.dto.OverLimitInfoCommDTO; import com.njcn.harmonic.common.service.MonitorHarmonicReportService; @@ -70,13 +70,13 @@ public class WordExportModelController extends BaseController { @RequestPart(value ="file",required = false) MultipartFile file) throws IOException { String methodDescribe = getMethodDescribe("exportWorld"); - LineDetailDataCommVO lineDetailDataCommVO; + HarmLineDetailDataCommDTO harmLineDetailDataCommDTO; OverLimitInfoCommDTO overLimitInfoCommDTO; DeviceUnitCommDTO deviceUnitCommDTO; Overlimit overLimit = new Overlimit(); LineDetailDataVO lineDto = csLineFeignClient.getLineDetailData(lineIndex).getData(); - lineDetailDataCommVO = BeanUtil.copyProperties(lineDto, LineDetailDataCommVO.class); + harmLineDetailDataCommDTO = BeanUtil.copyProperties(lineDto, HarmLineDetailDataCommDTO.class); List overLimitList = csLineFeignClient.getOverLimitData(Stream.of(lineIndex).collect(Collectors.toList())).getData(); overLimit = overLimitList.get(0); @@ -87,7 +87,7 @@ public class WordExportModelController extends BaseController { deviceUnitCommDTO = BeanUtil.copyProperties(pqsDeviceUnit, DeviceUnitCommDTO.class); - monitorHarmonicReportService.exportWorld(response, startTime, endTime, type, lineIndex, name, reportNumber, crmName, isUrl, file, lineDetailDataCommVO, overLimitInfoCommDTO,deviceUnitCommDTO); + monitorHarmonicReportService.exportWorld(response, startTime, endTime, type, lineIndex, name, reportNumber, crmName, isUrl, file, harmLineDetailDataCommDTO, overLimitInfoCommDTO,deviceUnitCommDTO); } diff --git a/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/mapper/RmpEventDetailMapper.java b/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/mapper/RmpEventDetailMapper.java index bcb039a..b0a6923 100644 --- a/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/mapper/RmpEventDetailMapper.java +++ b/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/mapper/RmpEventDetailMapper.java @@ -1,18 +1,18 @@ -package com.njcn.csharmonic.mapper; - -import com.baomidou.dynamic.datasource.annotation.DS; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.njcn.csharmonic.pojo.po.RmpEventDetailPO; -import org.apache.ibatis.annotations.Mapper; - -/** - * 暂态事件明细 - * - * @author yzh - * @date 2022/10/12 - */ -@Mapper -@DS("sjzx") -public interface RmpEventDetailMapper extends BaseMapper { - -} +//package com.njcn.csharmonic.mapper; +// +//import com.baomidou.dynamic.datasource.annotation.DS; +//import com.baomidou.mybatisplus.core.mapper.BaseMapper; +//import com.njcn.csharmonic.pojo.po.RmpEventDetailPO; +//import org.apache.ibatis.annotations.Mapper; +// +///** +// * 暂态事件明细 +// * +// * @author yzh +// * @date 2022/10/12 +// */ +//@Mapper +//@DS("sjzx") +//public interface RmpEventDetailMapper extends BaseMapper { +// +//} diff --git a/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/service/event/EventMonitorReportService.java b/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/service/event/CsEventMonitorReportService.java similarity index 76% rename from cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/service/event/EventMonitorReportService.java rename to cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/service/event/CsEventMonitorReportService.java index 792f6d1..5efc8f0 100644 --- a/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/service/event/EventMonitorReportService.java +++ b/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/service/event/CsEventMonitorReportService.java @@ -1,7 +1,8 @@ package com.njcn.csharmonic.service.event; import cn.hutool.extra.template.TemplateException; -import com.njcn.csharmonic.pojo.param.eventReport.ExportParam; +import com.njcn.event.common.pojo.dto.LineDetailDataCommDTO; +import com.njcn.event.pojo.param.ExportParam; import org.apache.poi.openxml4j.exceptions.InvalidFormatException; import javax.servlet.http.HttpServletResponse; @@ -14,7 +15,7 @@ import java.text.ParseException; * @author cdf * @date 2025/12/6 */ -public interface EventMonitorReportService { +public interface CsEventMonitorReportService { void getLineExport(ExportParam exportParam, HttpServletResponse response) throws InvalidFormatException, IOException, TemplateException, ParseException; diff --git a/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/service/event/EventReportService.java b/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/service/event/EventReportService.java index a6dd87c..3e5569e 100644 --- a/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/service/event/EventReportService.java +++ b/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/service/event/EventReportService.java @@ -1,80 +1,80 @@ -package com.njcn.csharmonic.service.event; - -import com.njcn.csharmonic.pojo.dto.eventReport.EventDetail; -import com.njcn.csharmonic.pojo.param.eventReport.StatisticsParam; -import com.njcn.csharmonic.pojo.vo.eventReport.*; - -import com.njcn.system.pojo.po.DictData; - -import java.text.ParseException; -import java.util.List; - -/** - * <监测点报表> - * - * @author wr - * @createTime: 2023-02-10 - */ -public interface EventReportService { - - /** - *获取Disdip表格(监测点报表专用) - * @param info influxdb查询结果(pqs_eventdetail表) - * @return - */ - List eventDisdip(List info); - - /** - * 获取IEC411数据 - * @param info influxdb查询结果(pqs_eventdetail表) - * @return - */ - List IEC411(List info); - - /** - * 获取IEC28数据 - * @param info influxdb查询结果(pqs_eventdetail表) - * @return - */ - List IEC28(List info); - - /** - *暂降幅值概率分布 - * @param info2 influxdb查询结果(pqs_eventdetail表) - * @return - */ - ProbabilityVO getProbabilityDistribution(List info2); - - - /** - * 获取点状表格数据2.1 - * @param info 结果集 - * @param reasonData 暂降原因 - * @param typeData 暂降类型 - * @return - */ - List getPlot(List info, List reasonData, List typeData); - - /** - * 获取详细数据对象 - * @param info - * @param reasonData - * @param typeData - * @return - */ - StatisticVO getStatistic(List info,List reasonData,ListtypeData); - - /** - * 获取密度点图 - * @param info - * @return - */ - Integer[][] getCoords(List info); - - /** - * 获取时间列表 - * @param statisticsParam - * @return - */ - List getReasonTypeTime(StatisticsParam statisticsParam) throws ParseException; -} +//package com.njcn.csharmonic.service.event; +// +//import com.njcn.csharmonic.pojo.dto.eventReport.EventDetail; +//import com.njcn.csharmonic.pojo.param.eventReport.StatisticsParam; +//import com.njcn.csharmonic.pojo.vo.eventReport.*; +// +//import com.njcn.system.pojo.po.DictData; +// +//import java.text.ParseException; +//import java.util.List; +// +///** +// * <监测点报表> +// * +// * @author wr +// * @createTime: 2023-02-10 +// */ +//public interface EventReportService { +// +// /** +// *获取Disdip表格(监测点报表专用) +// * @param info influxdb查询结果(pqs_eventdetail表) +// * @return +// */ +// List eventDisdip(List info); +// +// /** +// * 获取IEC411数据 +// * @param info influxdb查询结果(pqs_eventdetail表) +// * @return +// */ +// List IEC411(List info); +// +// /** +// * 获取IEC28数据 +// * @param info influxdb查询结果(pqs_eventdetail表) +// * @return +// */ +// List IEC28(List info); +// +// /** +// *暂降幅值概率分布 +// * @param info2 influxdb查询结果(pqs_eventdetail表) +// * @return +// */ +// ProbabilityVO getProbabilityDistribution(List info2); +// +// +// /** +// * 获取点状表格数据2.1 +// * @param info 结果集 +// * @param reasonData 暂降原因 +// * @param typeData 暂降类型 +// * @return +// */ +// List getPlot(List info, List reasonData, List typeData); +// +// /** +// * 获取详细数据对象 +// * @param info +// * @param reasonData +// * @param typeData +// * @return +// */ +// StatisticVO getStatistic(List info,List reasonData,ListtypeData); +// +// /** +// * 获取密度点图 +// * @param info +// * @return +// */ +// Integer[][] getCoords(List info); +// +// /** +// * 获取时间列表 +// * @param statisticsParam +// * @return +// */ +// List getReasonTypeTime(StatisticsParam statisticsParam) throws ParseException; +//} diff --git a/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/service/event/RmpEventDetailService.java b/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/service/event/RmpEventDetailService.java index 1f10675..2e5b7eb 100644 --- a/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/service/event/RmpEventDetailService.java +++ b/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/service/event/RmpEventDetailService.java @@ -1,15 +1,15 @@ -package com.njcn.csharmonic.service.event; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.njcn.csharmonic.pojo.po.RmpEventDetailPO; - -/** - * 暂态事件明细 - * - * @author yzh - * @date 2022/10/12 - */ - -public interface RmpEventDetailService extends IService { - -} +//package com.njcn.csharmonic.service.event; +// +//import com.baomidou.mybatisplus.extension.service.IService; +//import com.njcn.csharmonic.pojo.po.RmpEventDetailPO; +// +///** +// * 暂态事件明细 +// * +// * @author yzh +// * @date 2022/10/12 +// */ +// +//public interface RmpEventDetailService extends IService { +// +//} diff --git a/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/service/impl/CsEventPOServiceImpl.java b/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/service/impl/CsEventPOServiceImpl.java index 366c393..58cb3e7 100644 --- a/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/service/impl/CsEventPOServiceImpl.java +++ b/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/service/impl/CsEventPOServiceImpl.java @@ -23,27 +23,26 @@ import com.njcn.csdevice.pojo.vo.DataGroupEventVO; import com.njcn.csharmonic.enums.CsEventEnum; import com.njcn.csharmonic.enums.CsTransientEnum; import com.njcn.csharmonic.mapper.CsEventPOMapper; -import com.njcn.csharmonic.mapper.RmpEventDetailMapper; import com.njcn.csharmonic.param.CldEventParam; import com.njcn.csharmonic.param.CsEventUserQueryPage; import com.njcn.csharmonic.param.CsEventUserQueryParam; import com.njcn.csharmonic.param.DataParam; import com.njcn.csharmonic.pojo.param.EventStatisticParam; import com.njcn.csharmonic.pojo.po.CsEventPO; -import com.njcn.csharmonic.pojo.po.RmpEventDetailPO; import com.njcn.csharmonic.pojo.vo.CsEventVO; import com.njcn.csharmonic.pojo.vo.CsWarnDescVO; import com.njcn.csharmonic.pojo.vo.EventDetailVO; import com.njcn.csharmonic.pojo.vo.EventStatisticsVo; import com.njcn.csharmonic.service.CsEventPOService; import com.njcn.csharmonic.service.CsEventUserPOService; -import com.njcn.csharmonic.service.event.RmpEventDetailService; +import com.njcn.event.common.mapper.RmpEventDetailMapper; import com.njcn.event.file.component.WaveFileComponent; import com.njcn.event.file.component.WavePicComponent; import com.njcn.event.file.pojo.bo.WaveDataDetail; import com.njcn.event.file.pojo.dto.WaveDataDTO; import com.njcn.event.file.pojo.enums.WaveFileResponseEnum; import com.njcn.event.file.utils.WaveUtil; +import com.njcn.event.pojo.po.RmpEventDetailPO; import com.njcn.influx.pojo.constant.InfluxDBTableConstant; import com.njcn.influx.pojo.dto.EventDataSetDTO; import com.njcn.influx.service.EvtDataService; @@ -115,7 +114,6 @@ public class CsEventPOServiceImpl extends ServiceImpl Map convertKeysToUpperCase(Map originalMap) { + public Map convertKeysToUpperCase(Map originalMap) { Map newMap = new HashMap<>(); if (CollUtil.isNotEmpty(originalMap)) { for (Map.Entry entry : originalMap.entrySet()) { @@ -158,7 +161,9 @@ public class CustomReportServiceImpl implements CustomReportService { } if (Objects.isNull(reportSearchParam.getCustomType())) { //通用报表 - analyzeReport(reportSearchParam, excelRptTemp, response); + Map map = csLineFeignClient.getCustomDetailByLineId(reportSearchParam.getLineId()).getData(); + Map newMap = convertKeysToUpperCase(map); + customReportTableService.getCustomReport(reportSearchParam,newMap,response); } else { //浙江无线报表 analyzeReportZhejiang(reportSearchParam, excelRptTemp, response); diff --git a/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/service/impl/event/CsEventMonitorReportServiceImpl.java b/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/service/impl/event/CsEventMonitorReportServiceImpl.java new file mode 100644 index 0000000..a710620 --- /dev/null +++ b/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/service/impl/event/CsEventMonitorReportServiceImpl.java @@ -0,0 +1,48 @@ +package com.njcn.csharmonic.service.impl.event; + + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.extra.template.TemplateException; +import com.baomidou.dynamic.datasource.annotation.DS; +import com.njcn.csdevice.api.CsLineFeignClient; +import com.njcn.csdevice.pojo.vo.LineDetailDataVO; +import com.njcn.csharmonic.service.event.CsEventMonitorReportService; +import com.njcn.echarts.util.DrawPicUtil; +import com.njcn.event.common.pojo.dto.LineDetailDataCommDTO; +import com.njcn.event.common.service.CommMonitorEventReportService; +import com.njcn.event.pojo.param.ExportParam; +import com.njcn.system.api.DicDataFeignClient; +import lombok.RequiredArgsConstructor; +import org.apache.poi.openxml4j.exceptions.InvalidFormatException; +import org.springframework.stereotype.Service; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.text.ParseException; + + + +/** + * govern + * + * @author cdf + * @date 2025/12/6 + */ +@Service +@RequiredArgsConstructor +@DS("sjzx") +public class CsEventMonitorReportServiceImpl implements CsEventMonitorReportService { + + private final CommMonitorEventReportService monitorEventReportService; + + private final CsLineFeignClient csLineFeignClient; + + + + @Override + public void getLineExport(ExportParam exportParam,HttpServletResponse response) throws InvalidFormatException, IOException, TemplateException, ParseException { + LineDetailDataCommDTO lineDetailDataCommDTO = new LineDetailDataCommDTO(); + LineDetailDataVO lineDetailDataVO = csLineFeignClient.getLineDetailData(exportParam.getLineId()).getData(); + BeanUtil.copyProperties(lineDetailDataVO,lineDetailDataCommDTO); + monitorEventReportService.getLineExport(exportParam,lineDetailDataCommDTO, response); + } +} diff --git a/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/service/impl/event/EventMonitorReportServiceImpl.java b/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/service/impl/event/EventMonitorReportServiceImpl.java deleted file mode 100644 index 3dcace8..0000000 --- a/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/service/impl/event/EventMonitorReportServiceImpl.java +++ /dev/null @@ -1,592 +0,0 @@ -package com.njcn.csharmonic.service.impl.event; - - -import cn.hutool.core.util.ObjectUtil; -import cn.hutool.extra.template.TemplateException; -import com.njcn.common.pojo.enums.response.CommonResponseEnum; -import com.njcn.common.pojo.exception.BusinessException; -import com.njcn.common.pojo.response.HttpResult; -import com.njcn.csdevice.api.CsLineFeignClient; -import com.njcn.csdevice.pojo.vo.LineDetailDataVO; -import com.njcn.csharmonic.pojo.dto.eventReport.EventDetail; -import com.njcn.csharmonic.pojo.param.eventReport.ExportParam; -import com.njcn.csharmonic.pojo.param.eventReport.StatisticsParam; -import com.njcn.csharmonic.pojo.vo.eventReport.*; -import com.njcn.csharmonic.service.event.EventMonitorReportService; -import com.njcn.csharmonic.service.event.EventReportService; -import com.njcn.csharmonic.utils.eventReport.WordUtils; -import com.njcn.echarts.pojo.constant.PicCommonData; -import com.njcn.echarts.util.DrawPicUtil; -import com.njcn.system.api.DicDataFeignClient; -import com.njcn.system.enums.DicDataEnum; -import com.njcn.system.enums.DicDataTypeEnum; -import com.njcn.system.enums.EventResponseEnum; -import com.njcn.system.pojo.po.DictData; -import lombok.RequiredArgsConstructor; -import org.apache.poi.hssf.usermodel.HSSFCell; -import org.apache.poi.hssf.usermodel.HSSFCellStyle; -import org.apache.poi.openxml4j.exceptions.InvalidFormatException; -import org.apache.poi.util.Units; -import org.apache.poi.xwpf.usermodel.*; -import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTblWidth; -import org.openxmlformats.schemas.wordprocessingml.x2006.main.STTblWidth; -import org.springframework.stereotype.Service; - -import javax.servlet.ServletOutputStream; -import javax.servlet.http.HttpServletResponse; -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.math.BigDecimal; -import java.math.BigInteger; -import java.math.RoundingMode; -import java.net.URLEncoder; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.time.format.DateTimeFormatter; -import java.util.*; -import java.util.stream.Collectors; - - -/** - * govern - * - * @author cdf - * @date 2025/12/6 - */ -@Service -@RequiredArgsConstructor -public class EventMonitorReportServiceImpl implements EventMonitorReportService { - - private final DicDataFeignClient dicDataFeignClient; - - private final DrawPicUtil drawPicUtil; - - private final EventReportService eventReportService; - - private final CsLineFeignClient csLineFeignClient; - - - /** - * 监测点导出word - * - * @param exportParam . - * @param response . - * @throws InvalidFormatException . - * @throws IOException . - */ - @Override - public void getLineExport(ExportParam exportParam, HttpServletResponse response) throws IOException, InvalidFormatException, TemplateException, ParseException { - //创建word文档(poi生成word) - XWPFDocument doc = new XWPFDocument(); //创建Word文件 - //设置标题样式 - WordUtils.setHeadingStyle(doc); - XWPFParagraph p = doc.createParagraph(); //新建一个段落 - //设置对齐 - p.setAlignment(ParagraphAlignment.CENTER); - p.setVerticalAlignment(TextAlignment.CENTER); - XWPFRun r = p.createRun();//创建段落文本 - r.addBreak(); - r.addBreak(); - r.addBreak(); - r.addBreak(); - r.addBreak(); - r.addBreak(); -// r.setText("中国"); - r.setBold(true);//设置为粗体 - r.setFontSize(14);//字体大小 - r.addBreak(); - - p = doc.createParagraph(); //新建一个段落 - p.setAlignment(ParagraphAlignment.CENTER); - XWPFRun r1 = p.createRun();//创建段落文本 - r1.setText("电压暂降事件分析报告"); - r1.setBold(true);//设置为粗体 - r1.setFontSize(36);//字体大小 - r1.addBreak(); - r1.addBreak(); - r1.addBreak(); - r1.addBreak(); - r1.addBreak(); - r1.addBreak(); - r1.addBreak(); - - p = doc.createParagraph(); //新建一个段落 - p.setAlignment(ParagraphAlignment.CENTER); - XWPFRun r2 = p.createRun();//创建段落文本 - //获取当前时间 - Date date = new Date(); - SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy 年 MM 月 dd 日"); - String time = dateFormat.format(date); - - r2.setText("日期: " + time); - r2.setBold(true);//设置为粗体 - r2.setFontSize(14);//字体大小 - - r2.addBreak(); - r2.addBreak(); - r2.addBreak(); - - p = doc.createParagraph(); //新建一个段落 - p.setAlignment(ParagraphAlignment.CENTER); - XWPFRun r3 = p.createRun();//创建段落文本 - r3.setText("电压暂降事件区域报告"); - r3.setFontSize(24);//字体大小 - - p = doc.createParagraph(); //新建一个段落 - p.setAlignment(ParagraphAlignment.LEFT); - createTitle(doc, "1. 引言", "标题 1", 0, 15); - - p = doc.createParagraph(); //新建一个段落 - p.setAlignment(ParagraphAlignment.BOTH); - XWPFRun r5 = p.createRun();//创建段落文本 - r5.setText("对所选中区间内电压暂降事件进行分析,能够直观清晰查看响应的暂降事件信息。"); - r5.setFontSize(11);//字体大小 - - p = doc.createParagraph(); //新建一个段落 - p.setAlignment(ParagraphAlignment.LEFT); - createTitle(doc, "2. 报告分析对象", "标题 1", 0, 15); - - p = doc.createParagraph(); //新建一个段落 - p.setAlignment(ParagraphAlignment.BOTH); - XWPFRun r7 = p.createRun();//创建段落文本 - r7.setText(exportParam.getLineName()); - r7.setFontSize(11);//字体大小 - - p = doc.createParagraph(); //新建一个段落 - p.setAlignment(ParagraphAlignment.LEFT); - createTitle(doc, "3. 报告分析时间", "标题 1", 0, 15); - - p = doc.createParagraph(); //新建一个段落 - p.setAlignment(ParagraphAlignment.BOTH); - XWPFRun r9 = p.createRun();//创建段落文本 - r9.setText(exportParam.getSearchBeginTime() + " 至 " + exportParam.getSearchEndTime()); - r9.setFontSize(11);//字体大小 - - p = doc.createParagraph(); //新建一个段落 - p.setAlignment(ParagraphAlignment.LEFT); - createTitle(doc, "4. 总汇信息", "标题 1", 0, 15); - - //查询参数 - StatisticsParam param = new StatisticsParam(exportParam.getLineId(), exportParam.getSearchBeginTime(), exportParam.getSearchEndTime(), exportParam.getFlag()); - //获取暂降原因字典 - List reasonData = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.EVENT_REASON.getName()).getData(); - //获取暂降类型字典 - List typeData = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.EVENT_TYPE.getName()).getData(); - //influxdb查询结果(pqs_eventdetail表) - List info = info(param); - - //记录数 - int i = 1; - //1.监测点信息 - if (exportParam.isXq()) { - createTitle(doc, "4." + i + " 监测点信息", "标题 2", 200, 15); - XWPFTable table = createTable(doc); - XWPFParagraph centerParagraph = WordUtils.getCenterParagraph(doc); - if (exportParam.getType() == 0) { - HttpResult lineDetailData = csLineFeignClient.getLineDetailData(exportParam.getLineId()); - if (ObjectUtil.isNull(lineDetailData)) { - throw new BusinessException(CommonResponseEnum.NO_DATA); - } - insertRow(doc, table, centerParagraph, true, "项目", "描述"); - insertRow(doc, table, centerParagraph, false, "监测点名称", lineDetailData.getData().getLineName()); - insertRow(doc, table, centerParagraph, false, "电压等级", lineDetailData.getData().getScale()); - insertRow(doc, table, centerParagraph, false, "PT变比", lineDetailData.getData().getPt()); - insertRow(doc, table, centerParagraph, false, "CT变比", lineDetailData.getData().getCt()); - insertRow(doc, table, centerParagraph, false, "协议容量", lineDetailData.getData().getDealCapacity() + ""); - insertRow(doc, table, centerParagraph, false, "基准容量", lineDetailData.getData().getStandardCapacity() + ""); - insertRow(doc, table, centerParagraph, false, "设备容量", lineDetailData.getData().getDevCapacity() + ""); - insertRow(doc, table, centerParagraph, false, "最小短路容量", lineDetailData.getData().getShortCapacity() + ""); - insertRow(doc, table, centerParagraph, false, "接线方式", lineDetailData.getData().getPtType()); - } else { - /* HttpResult> monitorList = monitorClient.getMonitorList(Arrays.asList(exportParam.getLineId())); - if (ObjectUtil.isNull(monitorList)) { - throw new BusinessException(EventResponseEnum.NOT_FOUND); - } - insertRow(doc, table, centerParagraph, true, "项目", "描述"); - insertRow(doc, table, centerParagraph, false, "监测点名称", monitorList.getData().get(0).getName()); - insertRow(doc, table, centerParagraph, false, "电压等级", dicDataFeignClient.getDicDataById(monitorList.getData().get(0).getVoltageLevel()).getData().getName()); - insertRow(doc, table, centerParagraph, false, "PT变比", monitorList.getData().get(0).getPt1() + "/" + monitorList.getData().get(0).getPt2()); - insertRow(doc, table, centerParagraph, false, "CT变比", monitorList.getData().get(0).getCt1() + "/" + monitorList.getData().get(0).getCt2()); - insertRow(doc, table, centerParagraph, false, "协议容量", monitorList.getData().get(0).getUserAgreementCapacity() + ""); -// insertRow(doc, table, centerParagraph, false, "基准容量", monitorList.getData().get(0).getMinShortCircuitCapacity() + ""); - insertRow(doc, table, centerParagraph, false, "设备容量", monitorList.getData().get(0).getPowerSupplyEqCapacity() + ""); - insertRow(doc, table, centerParagraph, false, "最小短路容量", monitorList.getData().get(0).getMinShortCircuitCapacity() + ""); - insertRow(doc, table, centerParagraph, false, "接线方式", dicDataFeignClient.getDicDataById(monitorList.getData().get(0).getTerminalWiringMethod()).getData().getName()); - */ - } - i++; - } - //2.暂降事件暂降事件列表和暂降点图 - //2.1.判断列表和点图是否是要导出 - if (exportParam.isLb() || exportParam.isSjdF47() || exportParam.isSjdITIC()) { -// List plot = eventAnalysisService.getPlot(param); - List plot = eventReportService.getPlot(info, reasonData, typeData); - //暂降事件列表 - if (exportParam.isLb()) { - createTitle(doc, "4." + i + " 暂降事件列表", "标题 2", 200, 15); - XWPFTable table = createTable(doc); - XWPFParagraph centerParagraph = WordUtils.getCenterParagraph(doc); - insertRow(doc, table, centerParagraph, true, "序号", "暂降发生时刻", "暂降幅值(%)", "持续时间(s)", "暂降类型", "暂降原因", "严重度"); - for (int j = 0; j < plot.size(); j++) { - EventDetail eventDetail = plot.get(j); - String s = eventDetail.getStartTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS")); - - insertRow(doc, table, centerParagraph, false, j + 1 + "", s, BigDecimal.valueOf(eventDetail.getFeatureAmplitude() * 100).setScale(2, RoundingMode.HALF_UP).toString(), eventDetail.getDuration() + "", eventDetail.getAdvanceType(), eventDetail.getAdvanceReason(), eventDetail.getSeverity() + ""); - } - i++; - } - //暂降事件点图 - if (exportParam.isSjdF47() || exportParam.isSjdITIC()) { - ArrayList> ass = getAss(plot); - createTitle(doc, "4." + i + " 暂降事件点图", "标题 2", 200, 15); - int two = 1; - if (exportParam.isSjdITIC()) { - createTitle(doc, "4." + i + "." + two + " ITIC 曲线", "标题 3", 400, 15); - String itic = drawPicUtil.drawItic(ass); - createPic(doc, itic, "ITIC曲线"); - two++; - } - if (exportParam.isSjdF47()) { - createTitle(doc, "4." + i + "." + two + " F47 曲线", "标题 3", 400, 15); - String f47 = drawPicUtil.drawF47(ass); - createPic(doc, f47, "SEMI F47曲线"); - two++; - } - i++; - } - } - - - //3.暂降密度 - if (exportParam.isMdbg() || exportParam.isMdtx()) { - createTitle(doc, "4." + i + " 暂降密度", "标题 2", 200, 15); - int two = 1; - if (exportParam.isMdtx()) { - createTitle(doc, "4." + i + "." + two + " 暂降密度点图", "标题 3", 400, 15); - Integer[][] eventDensityData = eventReportService.getCoords(info); - String str = drawPicUtil.drawEventDensity(eventDensityData); - createPic(doc, str, "暂降密度图"); - two++; - } - if (exportParam.isMdbg()) { - XWPFParagraph centerParagraph = WordUtils.getCenterParagraph(doc); - createTitle(doc, "4." + i + "." + two + " DISDIP 表格:国际发配电联盟(UNIPEDE)", "标题 3", 400, 15); -// List eventDisdip = eventAnalysisService.eventDisdip(new StatisticsParam(exportParam.getLineId(), exportParam.getSearchBeginTime(), exportParam.getSearchEndTime(),exportParam.getFlag())); - List eventDisdip = eventReportService.eventDisdip(info); - - XWPFTable table1 = createTable(doc); - insertRow(doc, table1, centerParagraph, true, "剩余电压", "20ms", "100ms", "500ms", "1s", "3s", "20s", "60s", "180s"); - for (int j = 0; j < eventDisdip.size(); j++) { - DISDIPVO disdipvo = eventDisdip.get(j); - insertRow(doc, table1, centerParagraph, false, disdipvo.getName(), disdipvo.getTwentyMs(), disdipvo.getOneHundredMs(), disdipvo.getFiveHundredMs(), disdipvo.getOneS(), disdipvo.getThreeS(), disdipvo.getTwentyS(), disdipvo.getSixtyS(), disdipvo.getOneEightyS()); - } - two++; - createTitle(doc, "4." + i + "." + two + " IEC 61000-4-11:(用电终端的电压暂降抗度)", "标题 3", 400, 15); -// List iec411VOS = eventAnalysisService.IEC411(new StatisticsParam(exportParam.getLineId(), exportParam.getSearchBeginTime(), exportParam.getSearchEndTime(),exportParam.getFlag())); - List iec411VOS = eventReportService.IEC411(info); - XWPFTable table2 = createTable(doc); - insertRow(doc, table2, centerParagraph, true, "剩余电压", "10~20ms", "20~100ms", "0.1~0.2s", "0.2~0.5s", "0.5~1s", ">1s"); - for (int j = 0; j < iec411VOS.size(); j++) { - IEC411VO iec411VO = iec411VOS.get(j); - insertRow(doc, table2, centerParagraph, false, iec411VO.getName(), iec411VO.getTenTwentyMs(), iec411VO.getTwentyOneHundredMs(), iec411VO.getZeroPiontOneTwoS(), iec411VO.getZeroPiontTwoFiveS(), iec411VO.getZeroPiontFive1S(), iec411VO.getGreater1S()); - } - two++; - createTitle(doc, "4." + i + "." + two + " IEC 61000-2-8:(公共电网电压暂降测量统计)", "标题 3", 400, 15); -// List iec28VOS = eventAnalysisService.IEC28(new StatisticsParam(exportParam.getLineId(), exportParam.getSearchBeginTime(), exportParam.getSearchEndTime(),exportParam.getFlag())); - List iec28VOS = eventReportService.IEC28(info); - XWPFTable table3 = createTable(doc); - insertRow(doc, table3, centerParagraph, true, "剩余电压", "0.02~0.1s", "0.1~0.25s", "0.25~0.5s", "0.5s~1s", "1~3s", "3~20s", "20~60s", "60~180s"); - for (int j = 0; j < iec28VOS.size(); j++) { - IEC28VO iec28VO = iec28VOS.get(j); - insertRow(doc, table3, centerParagraph, false, iec28VO.getName(), iec28VO.getQ(), iec28VO.getW(), iec28VO.getE(), iec28VO.getR(), iec28VO.getT(), iec28VO.getY(), iec28VO.getU(), iec28VO.getI()); - } - two++; - } - i++; - } - //4.暂降幅值概率分布 - if (exportParam.isGlfbfz() || exportParam.isGlfbsj()) { - createTitle(doc, "4." + i + " 暂降幅值概率分布图", "标题 2", 200, 15); -// ProbabilityVO probabilityVO = eventAnalysisService.getProbabilityDistribution(new StatisticsParam(exportParam.getLineId(), exportParam.getSearchBeginTime(), exportParam.getSearchEndTime(),exportParam.getFlag())); - ProbabilityVO probabilityVO = eventReportService.getProbabilityDistribution(info); - int two = 1; - if (exportParam.isGlfbfz()) { - createTitle(doc, "4." + i + "." + two + " 暂降幅值的概率分函数", "标题 3", 400, 15); - List ybardata = probabilityVO.getPereventvalue(); - List ylinedata = probabilityVO.getEventvalue(); - String fz = drawPicUtil.drawEventAmplitude(ylinedata, ybardata); - createPic(doc, fz, "暂降幅值的概率分布函数"); - two++; - } - if (exportParam.isGlfbsj()) { - createTitle(doc, "4." + i + "." + two + " 持续时间的概率分函数", "标题 3", 400, 15); - List ybardata = probabilityVO.getPersisttime(); - List ylinedata = probabilityVO.getSisttime(); - String sj = drawPicUtil.drawPersistentTime(ylinedata, ybardata); - createPic(doc, sj, "持续时间的概率分布函数"); - two++; - } - i++; - } - - - //5.月份统计 - if (exportParam.isTjbg() || exportParam.isTjtx()) { - createTitle(doc, "4." + i + " 月份统计", "标题 2", 200, 15); - int two = 1; - List reasonTypeTime = eventReportService.getReasonTypeTime(param); - //暂时时间端按月查询不能查询 -// List reasonTypeTime = eventReportService.getReasonTypeTime(param,null); - if (exportParam.isTjtx()) { - createTitle(doc, "4." + i + "." + two + " 月份统计图", "标题 3", 400, 15); - List count = new ArrayList<>(); - List name = new ArrayList<>(); - if (exportParam.getFlag() == 0) { - for (TimeVO timeVO : reasonTypeTime) { - name.add(timeVO.getMonth() + ""); - count.add(Integer.parseInt(timeVO.getTimes())); - } - } else { - for (TimeVO timeVO : reasonTypeTime) { - name.add(timeVO.getDay() + ""); - count.add(Integer.parseInt(timeVO.getTimes())); - } - } - String yftj = drawPicUtil.drawMonth(name, count, reasonTypeTime.get(0).getYear(), exportParam.getFlag()); - createPic(doc, yftj, "月份统计图"); - two++; - } - if (exportParam.isTjbg()) { - XWPFParagraph centerParagraph = WordUtils.getCenterParagraph(doc); - createTitle(doc, "4." + i + "." + two + " 时间统计表格", "标题 3", 400, 15); - - XWPFTable table1 = createTable(doc); - if (exportParam.getFlag() == 0) { - insertRow(doc, table1, centerParagraph, true, "时间(月)", "电压暂降次数"); - } else { - insertRow(doc, table1, centerParagraph, true, "时间(天)", "电压暂降次数"); - } - if (exportParam.getFlag() == 0) { - for (int j = 0; j < reasonTypeTime.size(); j++) { - TimeVO timeVO = reasonTypeTime.get(j); - insertRow(doc, table1, centerParagraph, false, timeVO.getMonth(), timeVO.getTimes()); - } - } else { - for (int j = 0; j < reasonTypeTime.size(); j++) { - TimeVO timeVO = reasonTypeTime.get(j); - insertRow(doc, table1, centerParagraph, false,timeVO.getFulltime(), timeVO.getTimes()); - } - } - two++; - } - i++; - } - - - //6.原因统计 - //6.1整合提出查询语句 - Boolean fly = exportParam.isYybg() || exportParam.isYytx() || exportParam.isLxbg() || exportParam.isLxtx(); - if (fly) { - StatisticVO statistic = eventReportService.getStatistic(info, reasonData, typeData); - if (exportParam.isYybg() || exportParam.isYytx()) { - createTitle(doc, "4." + i + " 原因统计", "标题 2", 200, 15); -// StatisticVO statistic = eventAnalysisService.getStatistic(new StatisticsParam(exportParam.getLineId(), exportParam.getSearchBeginTime(), exportParam.getSearchEndTime(),exportParam.getFlag())); - int two = 1; - if (exportParam.isYytx()) { - createTitle(doc, "4." + i + "." + two + " 原因统计图", "标题 3", 400, 15); - List xdata = new ArrayList<>(); - List> reasonList = new ArrayList<>(); - - List reason = statistic.getReason(); - for (ReasonsVO reasonsVO : reason) { - Map map = new LinkedHashMap<>(); - map.put("value", reasonsVO.getTimes()); - map.put("name", reasonsVO.getReason()); - reasonList.add(map); - xdata.add(reasonsVO.getReason()); - } - String tr = drawPicUtil.drawReason(xdata, reasonList); - createPic(doc, tr, "暂降原因图"); - two++; - } - if (exportParam.isYybg()) { - XWPFParagraph centerParagraph = WordUtils.getCenterParagraph(doc); - createTitle(doc, "4." + i + "." + two + " 原因统计表格", "标题 3", 400, 15); - XWPFTable table1 = createTable(doc); - insertRow(doc, table1, centerParagraph, true, "暂降原因", "电压暂降次数"); - List reason = statistic.getReason(); - for (int j = 0; j < reason.size(); j++) { - ReasonsVO reasonsVO = reason.get(j); - insertRow(doc, table1, centerParagraph, false, reasonsVO.getReason(), reasonsVO.getTimes() + ""); - } - two++; - } - i++; - } - //7.类型统计 - if (exportParam.isLxbg() || exportParam.isLxtx()) { - createTitle(doc, "4." + i + " 类型统计", "标题 2", 200, 15); -// StatisticVO statistic = eventAnalysisService.getStatistic(new StatisticsParam(exportParam.getLineId(), exportParam.getSearchBeginTime(), exportParam.getSearchEndTime(),exportParam.getFlag())); - int two = 1; - if (exportParam.isLxtx()) { - createTitle(doc, "4." + i + "." + two + " 类型统计图", "标题 3", 400, 15); - List xdata = new ArrayList<>(); - List types = statistic.getTypes(); - - List> reasonList = new ArrayList<>(); - for (TypesVO type : types) { - Map map = new LinkedHashMap<>(); - map.put("value", type.getTimes()); - map.put("name", type.getType()); - reasonList.add(map); - xdata.add(type.getType()); - } - String tr = drawPicUtil.drawType(xdata, reasonList); - createPic(doc, tr, "暂降类型图"); - two++; - } - if (exportParam.isLxbg()) { - createTitle(doc, "4." + i + "." + two + " 类型统计表格", "标题 3", 400, 15); - XWPFParagraph centerParagraph = WordUtils.getCenterParagraph(doc); - XWPFTable table1 = createTable(doc); - insertRow(doc, table1, centerParagraph, true, "暂降原因", "电压暂降次数"); - List types = statistic.getTypes(); - for (int j = 0; j < types.size(); j++) { - TypesVO typesVO = types.get(j); - insertRow(doc, table1, centerParagraph, false, typesVO.getType(), typesVO.getTimes() + ""); - } - two++; - } - i++; - } - } - - - ServletOutputStream outputStream = response.getOutputStream(); - String fileName = URLEncoder.encode(exportParam.getLineName() + ".docx", "UTF-8"); - response.setHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\""); - response.setContentType("application/octet-stream;charset=UTF-8"); - doc.write(outputStream); - outputStream.close(); - } - - - /** - * 创建标题 - * - * @param document 文档 - * @param message 标题内容 - * @param style 标题等级 - * @param line 缩进 - * @param fontSize 字体大小 - */ - public void createTitle(XWPFDocument document, String message, String style, int line, int fontSize) { - XWPFParagraph summaeTableParagraph = WordUtils.getLeftParagraph(document); - summaeTableParagraph.setStyle(style); - summaeTableParagraph.setIndentationFirstLine(line); - XWPFRun summaeTableRun = summaeTableParagraph.createRun(); - WordUtils.addParagraph(summaeTableRun, "宋体", fontSize, "000000", message, false); - } - - /** - * 表格插入行数据 - * - * @param document 文档 - * @param table 表格 - * @param head 是否是表头 - * @param values 数据内容 - */ - public static void insertRow(XWPFDocument document, XWPFTable table, XWPFParagraph excelParagraph, boolean head, - String... values) { - if (head) { - XWPFTableRow summaTableRowOne = table.getRow(0); - WordUtils.setExcelHeadContent(excelParagraph, summaTableRowOne, values); - } else { - XWPFTableRow summaTableRowOne = table.createRow(); - WordUtils.setExcelContent(excelParagraph, summaTableRowOne, values); - } - } - - /** - * 创建图片在word中 - * - * @param document 文档 - * @param image 图片base64 - * @param name 图片名 - * @throws IOException - * @throws InvalidFormatException - */ - public void createPic(XWPFDocument document, String image, String name) throws IOException, InvalidFormatException, InvalidFormatException { - XWPFParagraph picParagraph = WordUtils.getCenterParagraph(document); - XWPFRun createRun = picParagraph.createRun(); - if (image.contains(PicCommonData.PNG_PREFIX)) { - image = image.replace(PicCommonData.PNG_PREFIX, ""); - } - byte[] bytes = Base64.getDecoder().decode(image); - InputStream in = new ByteArrayInputStream(bytes); - createRun.addPicture(in, 5, name, Units.toEMU(410), Units.toEMU(170)); - } - - - /** - * 创建表格 - * - * @param document - * @return - */ - public XWPFTable createTable(XWPFDocument document) { - XWPFTable summaTable = document.createTable(); - // 列宽自动分割 - CTTblWidth summaTableWidth = summaTable.getCTTbl().addNewTblPr().addNewTblW(); - summaTableWidth.setType(STTblWidth.DXA); - summaTableWidth.setW(BigInteger.valueOf(8160)); - return summaTable; - } - - public void setCellStyle(HSSFCell cellname, String value, HSSFCellStyle style) { - cellname.setCellValue(value); - cellname.setCellStyle(style); - } - - /** - * 监测点暂降事件点图赋值 - * - * @param plot - * @return - */ - private ArrayList> getAss(List plot) { - //TODO 666 - ArrayList> list = new ArrayList<>(); - for (EventDetail eventDetail : plot) { - ArrayList doubles = new ArrayList<>(); - doubles.add(eventDetail.getDuration()); - doubles.add(Double.parseDouble(String.valueOf(eventDetail.getFeatureAmplitude() * 100))); - list.add(doubles); - } - return list; - } - - /** - * influxdb查询结果集 - * - * @param statisticsParam - * @return - */ - private List info(StatisticsParam statisticsParam) { - //获取事件类型 - List dictType = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.EVENT_STATIS.getCode()).getData(); - List typeIds = dictType.stream().filter(x -> DicDataEnum.VOLTAGE_DIP.getCode().equals(x.getCode()) || DicDataEnum.SHORT_INTERRUPTIONS.getCode().equals(x.getCode())) - .map(DictData::getId).collect(Collectors.toList()); - //数据暂降查询 -/* List info = eventDetailService.list(new LambdaQueryWrapper() - .eq(RmpEventDetailPO::getMeasurementPointId, statisticsParam.getLineIndex()) - .in(RmpEventDetailPO::getEventType, typeIds) - .ge(StrUtil.isNotBlank(statisticsParam.getStartTime()), RmpEventDetailPO::getStartTime, DateUtil.beginOfDay(DateUtil.parse(statisticsParam.getStartTime()))) - .le(StrUtil.isNotBlank(statisticsParam.getEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(statisticsParam.getEndTime()))) - );*/ - - return new ArrayList<>(); - } - -} diff --git a/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/service/impl/event/EventReportServiceImpl.java b/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/service/impl/event/EventReportServiceImpl.java index 562e3fa..a768684 100644 --- a/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/service/impl/event/EventReportServiceImpl.java +++ b/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/service/impl/event/EventReportServiceImpl.java @@ -1,1257 +1,1257 @@ -package com.njcn.csharmonic.service.impl.event; - - -import cn.hutool.core.date.DateUtil; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.njcn.csharmonic.pojo.dto.eventReport.EventDetail; -import com.njcn.csharmonic.pojo.param.eventReport.StatisticsParam; -import com.njcn.csharmonic.pojo.vo.eventReport.*; -import com.njcn.csharmonic.service.event.EventReportService; -import com.njcn.influx.utils.InfluxDbUtils; -import com.njcn.system.api.DicDataFeignClient; -import com.njcn.system.enums.DicDataEnum; -import com.njcn.system.enums.DicDataTypeEnum; -import com.njcn.system.pojo.po.DictData; -import lombok.RequiredArgsConstructor; -import org.apache.commons.lang.StringUtils; -import org.influxdb.dto.QueryResult; -import org.springframework.stereotype.Service; - -import java.text.ParseException; -import java.time.LocalDate; -import java.time.format.DateTimeFormatter; -import java.time.temporal.ChronoUnit; -import java.util.*; -import java.util.stream.Collectors; - - -/** - * <功能描述> - * - * @author wr - * @createTime: 2023-02-10 - */ -@Service -@RequiredArgsConstructor -public class EventReportServiceImpl implements EventReportService { - - private final DicDataFeignClient dicDataFeignClient; - - @Override - public List eventDisdip(List info) { - List result = new ArrayList<>(); - int[][] arr = new int[5][8]; - for (int i = 0; i < 5; i++) { - for (int j = 0; j < 8; j++) { - arr[i][j] = 0; - } - } - for (int i = 0; i < info.size(); i++) { - Double eventvalue = info.get(i).getFeatureAmplitude(); - double persisttime = info.get(i).getDuration(); - if (eventvalue * 100 < 10) { - if (persisttime < 20) { - arr[4][0]++; - } else if (persisttime < 100) { - arr[4][1]++; - } else if (persisttime < 500) { - arr[4][2]++; - } else if (persisttime < 1000) { - arr[4][3]++; - } else if (persisttime < 3000) { - arr[4][4]++; - } else if (persisttime < 20000) { - arr[4][5]++; - } else if (persisttime < 60000) { - arr[4][6]++; - } else if (persisttime < 180000) { - arr[4][7]++; - } - } else if (eventvalue * 100 < 40) { - if (persisttime < 20) { - arr[3][0]++; - } else if (persisttime < 100) { - arr[3][1]++; - } else if (persisttime < 500) { - arr[3][2]++; - } else if (persisttime < 1000) { - arr[3][3]++; - } else if (persisttime < 3000) { - arr[3][4]++; - } else if (persisttime < 20000) { - arr[3][5]++; - } else if (persisttime < 60000) { - arr[3][6]++; - } else if (persisttime < 180000) { - arr[3][7]++; - } - } else if (eventvalue * 100 < 70) { - if (persisttime < 20) { - arr[2][0]++; - } else if (persisttime < 100) { - arr[2][1]++; - } else if (persisttime < 500) { - arr[2][2]++; - } else if (persisttime < 1000) { - arr[2][3]++; - } else if (persisttime < 3000) { - arr[2][4]++; - } else if (persisttime < 20000) { - arr[2][5]++; - } else if (persisttime < 60000) { - arr[2][6]++; - } else if (persisttime < 180000) { - arr[2][7]++; - } - } else if (eventvalue * 100 < 85) { - if (persisttime < 20) { - arr[1][0]++; - } else if (persisttime < 100) { - arr[1][1]++; - } else if (persisttime < 500) { - arr[1][2]++; - } else if (persisttime < 1000) { - arr[1][3]++; - } else if (persisttime < 3000) { - arr[1][4]++; - } else if (persisttime < 20000) { - arr[1][5]++; - } else if (persisttime < 60000) { - arr[1][6]++; - } else if (persisttime < 180000) { - arr[1][7]++; - } - } else if (eventvalue * 100 <= 90) { - if (persisttime < 20) { - arr[0][0]++; - } else if (persisttime < 100) { - arr[0][1]++; - } else if (persisttime < 500) { - arr[0][2]++; - } else if (persisttime < 1000) { - arr[0][3]++; - } else if (persisttime < 3000) { - arr[0][4]++; - } else if (persisttime < 20000) { - arr[0][5]++; - } else if (persisttime < 60000) { - arr[0][6]++; - } else if (persisttime < 180000) { - arr[0][7]++; - } - } - } - result.add(new DISDIPVO("90%", String.valueOf(arr[0][0]), String.valueOf(arr[0][1]), String.valueOf(arr[0][2]), String.valueOf(arr[0][3]), String.valueOf(arr[0][4]), String.valueOf(arr[0][5]), String.valueOf(arr[0][6]), String.valueOf(arr[0][7]))); - result.add(new DISDIPVO("85%", String.valueOf(arr[1][0]), String.valueOf(arr[1][1]), String.valueOf(arr[1][2]), String.valueOf(arr[1][3]), String.valueOf(arr[1][4]), String.valueOf(arr[1][5]), String.valueOf(arr[1][6]), String.valueOf(arr[1][7]))); - result.add(new DISDIPVO("70%", String.valueOf(arr[2][0]), String.valueOf(arr[2][1]), String.valueOf(arr[2][2]), String.valueOf(arr[2][3]), String.valueOf(arr[2][4]), String.valueOf(arr[2][5]), String.valueOf(arr[2][6]), String.valueOf(arr[2][7]))); - result.add(new DISDIPVO("40%", String.valueOf(arr[3][0]), String.valueOf(arr[3][1]), String.valueOf(arr[3][2]), String.valueOf(arr[3][3]), String.valueOf(arr[3][4]), String.valueOf(arr[3][5]), String.valueOf(arr[3][6]), String.valueOf(arr[3][7]))); - result.add(new DISDIPVO("10%", String.valueOf(arr[4][0]), String.valueOf(arr[4][1]), String.valueOf(arr[4][2]), String.valueOf(arr[4][3]), String.valueOf(arr[4][4]), String.valueOf(arr[4][5]), String.valueOf(arr[4][6]), String.valueOf(arr[4][7]))); - return result; - } - - @Override - public List IEC411(List info) { - List result = new ArrayList<>(); - int[][] arr = new int[3][6]; - for (int i = 0; i < 3; i++) { - for (int j = 0; j < 6; j++) { - arr[i][j] = 0; - } - } - for (int i = 0; i < info.size(); i++) { - Double eventvalue = info.get(i).getFeatureAmplitude(); - double persisttime = info.get(i).getDuration(); - if (eventvalue * 100 < 1) { - if (persisttime < 20 && persisttime >= 10) { - arr[2][0]++; - } else if (persisttime < 100) { - arr[2][1]++; - } else if (persisttime < 200) { - arr[2][2]++; - } else if (persisttime < 400) { - arr[2][3]++; - } else if (persisttime < 1000) { - arr[2][4]++; - } else { - arr[2][5]++; - } - } else if (eventvalue * 100 < 40) { - if (persisttime < 20 && persisttime >= 10) { - arr[1][0]++; - } else if (persisttime < 100) { - arr[1][1]++; - } else if (persisttime < 200) { - arr[1][2]++; - } else if (persisttime < 400) { - arr[1][3]++; - } else if (persisttime < 1000) { - arr[1][4]++; - } else { - arr[1][5]++; - } - } else if (eventvalue * 100 <= 70) { - if (persisttime < 20 && persisttime >= 10) { - arr[0][0]++; - } else if (persisttime < 100) { - arr[0][1]++; - } else if (persisttime < 200) { - arr[0][2]++; - } else if (persisttime < 400) { - arr[0][3]++; - } else if (persisttime < 1000) { - arr[0][4]++; - } else { - arr[0][5]++; - } - } - } - result.add(new IEC411VO("40~70%", String.valueOf(arr[0][0]), String.valueOf(arr[0][1]), String.valueOf(arr[0][2]), String.valueOf(arr[0][3]), String.valueOf(arr[0][4]), String.valueOf(arr[0][5]))); - result.add(new IEC411VO("1~40%", String.valueOf(arr[1][0]), String.valueOf(arr[1][1]), String.valueOf(arr[1][2]), String.valueOf(arr[1][3]), String.valueOf(arr[1][4]), String.valueOf(arr[1][5]))); - result.add(new IEC411VO("<1%", String.valueOf(arr[2][0]), String.valueOf(arr[2][1]), String.valueOf(arr[2][2]), String.valueOf(arr[2][3]), String.valueOf(arr[2][4]), String.valueOf(arr[2][5]))); - return result; - } - - @Override - public List IEC28(List info) { - List result = new ArrayList<>(); - int[][] arr = new int[17][8]; - for (int i = 0; i < 17; i++) { - for (int j = 0; j < 8; j++) { - arr[i][j] = 0; - } - } - for (int i = 0; i < info.size(); i++) { - Double eventvalue = info.get(i).getFeatureAmplitude(); - double persisttime = info.get(i).getDuration(); - if (eventvalue * 100 < 1 && eventvalue * 100 >= 0) { - if (persisttime > 10 && persisttime <= 100) { - arr[16][0]++; - } else if (persisttime <= 250) { - arr[16][1]++; - } else if (persisttime <= 500) { - arr[16][2]++; - } else if (persisttime <= 1000) { - arr[16][3]++; - } else if (persisttime <= 3000) { - arr[16][4]++; - } else if (persisttime <= 20000) { - arr[16][5]++; - } else if (persisttime <= 60000) { - arr[16][6]++; - } else if (persisttime <= 180000) { - arr[16][7]++; - } - } else if (eventvalue * 100 < 10) { - if (persisttime > 10 && persisttime <= 100) { - arr[15][0]++; - } else if (persisttime <= 250) { - arr[15][1]++; - } else if (persisttime <= 500) { - arr[15][2]++; - } else if (persisttime <= 1000) { - arr[15][3]++; - } else if (persisttime <= 3000) { - arr[15][4]++; - } else if (persisttime <= 20000) { - arr[15][5]++; - } else if (persisttime <= 60000) { - arr[15][6]++; - } else if (persisttime <= 180000) { - arr[15][7]++; - } - } else if (eventvalue * 100 < 20) { - if (persisttime > 10 && persisttime <= 100) { - arr[14][0]++; - } else if (persisttime <= 250) { - arr[14][1]++; - } else if (persisttime <= 500) { - arr[14][2]++; - } else if (persisttime <= 1000) { - arr[14][3]++; - } else if (persisttime <= 3000) { - arr[14][4]++; - } else if (persisttime <= 20000) { - arr[14][5]++; - } else if (persisttime <= 60000) { - arr[14][6]++; - } else if (persisttime <= 180000) { - arr[14][7]++; - } - } else if (eventvalue * 100 < 30) { - if (persisttime > 10 && persisttime <= 100) { - arr[13][0]++; - } else if (persisttime <= 250) { - arr[13][1]++; - } else if (persisttime <= 500) { - arr[13][2]++; - } else if (persisttime <= 1000) { - arr[13][3]++; - } else if (persisttime <= 3000) { - arr[13][4]++; - } else if (persisttime <= 20000) { - arr[13][5]++; - } else if (persisttime <= 60000) { - arr[13][6]++; - } else if (persisttime <= 180000) { - arr[13][7]++; - } - } else if (eventvalue * 100 < 40) { - if (persisttime > 10 && persisttime <= 100) { - arr[12][0]++; - } else if (persisttime <= 250) { - arr[12][1]++; - } else if (persisttime <= 500) { - arr[12][2]++; - } else if (persisttime <= 1000) { - arr[12][3]++; - } else if (persisttime <= 3000) { - arr[12][4]++; - } else if (persisttime <= 20000) { - arr[12][5]++; - } else if (persisttime <= 60000) { - arr[12][6]++; - } else if (persisttime <= 180000) { - arr[12][7]++; - } - } else if (eventvalue * 100 < 50) { - if (persisttime > 10 && persisttime <= 100) { - arr[11][0]++; - } else if (persisttime <= 250) { - arr[11][1]++; - } else if (persisttime <= 500) { - arr[11][2]++; - } else if (persisttime <= 1000) { - arr[11][3]++; - } else if (persisttime <= 3000) { - arr[11][4]++; - } else if (persisttime <= 20000) { - arr[11][5]++; - } else if (persisttime <= 60000) { - arr[11][6]++; - } else if (persisttime <= 180000) { - arr[11][7]++; - } - } else if (eventvalue * 100 < 60) { - if (persisttime > 10 && persisttime <= 100) { - arr[10][0]++; - } else if (persisttime <= 250) { - arr[10][1]++; - } else if (persisttime <= 500) { - arr[10][2]++; - } else if (persisttime <= 1000) { - arr[10][3]++; - } else if (persisttime <= 3000) { - arr[10][4]++; - } else if (persisttime <= 20000) { - arr[10][5]++; - } else if (persisttime <= 60000) { - arr[10][6]++; - } else if (persisttime <= 180000) { - arr[10][7]++; - } - } else if (eventvalue * 100 < 70) { - if (persisttime > 10 && persisttime <= 100) { - arr[9][0]++; - } else if (persisttime <= 250) { - arr[9][1]++; - } else if (persisttime <= 500) { - arr[9][2]++; - } else if (persisttime <= 1000) { - arr[9][3]++; - } else if (persisttime <= 3000) { - arr[9][4]++; - } else if (persisttime <= 20000) { - arr[9][5]++; - } else if (persisttime <= 60000) { - arr[9][6]++; - } else if (persisttime <= 180000) { - arr[9][7]++; - } - } else if (eventvalue * 100 < 80) { - if (persisttime > 10 && persisttime <= 100) { - arr[8][0]++; - } else if (persisttime <= 250) { - arr[8][1]++; - } else if (persisttime <= 500) { - arr[8][2]++; - } else if (persisttime <= 1000) { - arr[8][3]++; - } else if (persisttime <= 3000) { - arr[8][4]++; - } else if (persisttime <= 20000) { - arr[8][5]++; - } else if (persisttime <= 60000) { - arr[8][6]++; - } else if (persisttime <= 180000) { - arr[8][7]++; - } - } else if (eventvalue * 100 <= 90) { - if (persisttime > 10 && persisttime <= 100) { - arr[7][0]++; - } else if (persisttime <= 250) { - arr[7][1]++; - } else if (persisttime <= 500) { - arr[7][2]++; - } else if (persisttime <= 1000) { - arr[7][3]++; - } else if (persisttime <= 3000) { - arr[7][4]++; - } else if (persisttime <= 20000) { - arr[7][5]++; - } else if (persisttime <= 60000) { - arr[7][6]++; - } else if (persisttime <= 180000) { - arr[7][7]++; - } - } else if (eventvalue * 100 < 120 && eventvalue * 100 >= 110) { - if (persisttime > 10 && persisttime <= 100) { - arr[6][0]++; - } else if (persisttime <= 250) { - arr[6][1]++; - } else if (persisttime <= 500) { - arr[6][2]++; - } else if (persisttime <= 1000) { - arr[6][3]++; - } else if (persisttime <= 3000) { - arr[6][4]++; - } else if (persisttime <= 20000) { - arr[6][5]++; - } else if (persisttime <= 60000) { - arr[6][6]++; - } else if (persisttime <= 180000) { - arr[6][7]++; - } - } else if (eventvalue * 100 < 130) { - if (persisttime > 10 && persisttime <= 100) { - arr[5][0]++; - } else if (persisttime <= 250) { - arr[5][1]++; - } else if (persisttime <= 500) { - arr[5][2]++; - } else if (persisttime <= 1000) { - arr[5][3]++; - } else if (persisttime <= 3000) { - arr[5][4]++; - } else if (persisttime <= 20000) { - arr[5][5]++; - } else if (persisttime <= 60000) { - arr[5][6]++; - } else if (persisttime <= 180000) { - arr[5][7]++; - } - } else if (eventvalue * 100 < 140) { - if (persisttime > 10 && persisttime <= 100) { - arr[4][0]++; - } else if (persisttime <= 250) { - arr[4][1]++; - } else if (persisttime <= 500) { - arr[4][2]++; - } else if (persisttime <= 1000) { - arr[4][3]++; - } else if (persisttime <= 3000) { - arr[4][4]++; - } else if (persisttime <= 20000) { - arr[4][5]++; - } else if (persisttime <= 60000) { - arr[4][6]++; - } else if (persisttime <= 180000) { - arr[4][7]++; - } - } else if (eventvalue * 100 < 150) { - if (persisttime > 10 && persisttime <= 100) { - arr[3][0]++; - } else if (persisttime <= 250) { - arr[3][1]++; - } else if (persisttime <= 500) { - arr[3][2]++; - } else if (persisttime <= 1000) { - arr[3][3]++; - } else if (persisttime <= 3000) { - arr[3][4]++; - } else if (persisttime <= 20000) { - arr[3][5]++; - } else if (persisttime <= 60000) { - arr[3][6]++; - } else if (persisttime <= 180000) { - arr[3][7]++; - } - } else if (eventvalue * 100 < 160) { - if (persisttime > 10 && persisttime <= 100) { - arr[2][0]++; - } else if (persisttime <= 250) { - arr[2][1]++; - } else if (persisttime <= 500) { - arr[2][2]++; - } else if (persisttime <= 1000) { - arr[2][3]++; - } else if (persisttime <= 3000) { - arr[2][4]++; - } else if (persisttime <= 20000) { - arr[2][5]++; - } else if (persisttime <= 60000) { - arr[2][6]++; - } else if (persisttime <= 180000) { - arr[2][7]++; - } - } else if (eventvalue * 100 < 170) { - if (persisttime > 10 && persisttime <= 100) { - arr[1][0]++; - } else if (persisttime <= 250) { - arr[1][1]++; - } else if (persisttime <= 500) { - arr[1][2]++; - } else if (persisttime <= 1000) { - arr[1][3]++; - } else if (persisttime <= 3000) { - arr[1][4]++; - } else if (persisttime <= 20000) { - arr[1][5]++; - } else if (persisttime <= 60000) { - arr[1][6]++; - } else if (persisttime <= 180000) { - arr[1][7]++; - } - } else if (eventvalue * 100 <= 180) { - if (persisttime > 10 && persisttime <= 100) { - arr[0][0]++; - } else if (persisttime <= 250) { - arr[0][1]++; - } else if (persisttime <= 500) { - arr[0][2]++; - } else if (persisttime <= 1000) { - arr[0][3]++; - } else if (persisttime <= 3000) { - arr[0][4]++; - } else if (persisttime <= 20000) { - arr[0][5]++; - } else if (persisttime <= 60000) { - arr[0][6]++; - } else if (persisttime <= 180000) { - arr[0][7]++; - } - } - } - result.add(new IEC28VO("180>U>=170", String.valueOf(arr[0][0]), String.valueOf(arr[0][1]), String.valueOf(arr[0][2]), String.valueOf(arr[0][3]), String.valueOf(arr[0][4]), String.valueOf(arr[0][5]), String.valueOf(arr[0][6]), String.valueOf(arr[0][7]))); - result.add(new IEC28VO("170>U>=160", String.valueOf(arr[1][0]), String.valueOf(arr[1][1]), String.valueOf(arr[1][2]), String.valueOf(arr[1][3]), String.valueOf(arr[1][4]), String.valueOf(arr[1][5]), String.valueOf(arr[1][6]), String.valueOf(arr[1][7]))); - result.add(new IEC28VO("160>U>=150", String.valueOf(arr[2][0]), String.valueOf(arr[2][1]), String.valueOf(arr[2][2]), String.valueOf(arr[2][3]), String.valueOf(arr[2][4]), String.valueOf(arr[2][5]), String.valueOf(arr[2][6]), String.valueOf(arr[2][7]))); - result.add(new IEC28VO("150>U>=140", String.valueOf(arr[3][0]), String.valueOf(arr[3][1]), String.valueOf(arr[3][2]), String.valueOf(arr[3][3]), String.valueOf(arr[3][4]), String.valueOf(arr[3][5]), String.valueOf(arr[3][6]), String.valueOf(arr[3][7]))); - result.add(new IEC28VO("140>U>=130", String.valueOf(arr[4][0]), String.valueOf(arr[4][1]), String.valueOf(arr[4][2]), String.valueOf(arr[4][3]), String.valueOf(arr[4][4]), String.valueOf(arr[4][5]), String.valueOf(arr[4][6]), String.valueOf(arr[4][7]))); - result.add(new IEC28VO("130>U>=120", String.valueOf(arr[5][0]), String.valueOf(arr[5][1]), String.valueOf(arr[5][2]), String.valueOf(arr[5][3]), String.valueOf(arr[5][4]), String.valueOf(arr[5][5]), String.valueOf(arr[5][6]), String.valueOf(arr[5][7]))); - result.add(new IEC28VO("120>U>=110", String.valueOf(arr[6][0]), String.valueOf(arr[6][1]), String.valueOf(arr[6][2]), String.valueOf(arr[6][3]), String.valueOf(arr[6][4]), String.valueOf(arr[6][5]), String.valueOf(arr[6][6]), String.valueOf(arr[6][7]))); - result.add(new IEC28VO("90>U>=80", String.valueOf(arr[7][0]), String.valueOf(arr[7][1]), String.valueOf(arr[7][2]), String.valueOf(arr[7][3]), String.valueOf(arr[7][4]), String.valueOf(arr[7][5]), String.valueOf(arr[7][6]), String.valueOf(arr[7][7]))); - result.add(new IEC28VO("80>U>=70", String.valueOf(arr[8][0]), String.valueOf(arr[8][1]), String.valueOf(arr[8][2]), String.valueOf(arr[8][3]), String.valueOf(arr[8][4]), String.valueOf(arr[8][5]), String.valueOf(arr[8][6]), String.valueOf(arr[8][7]))); - result.add(new IEC28VO("70>U>=60", String.valueOf(arr[9][0]), String.valueOf(arr[9][1]), String.valueOf(arr[9][2]), String.valueOf(arr[9][3]), String.valueOf(arr[9][4]), String.valueOf(arr[9][5]), String.valueOf(arr[9][6]), String.valueOf(arr[9][7]))); - result.add(new IEC28VO("60>U>=50", String.valueOf(arr[10][0]), String.valueOf(arr[10][1]), String.valueOf(arr[10][2]), String.valueOf(arr[10][3]), String.valueOf(arr[10][4]), String.valueOf(arr[10][5]), String.valueOf(arr[10][6]), String.valueOf(arr[10][7]))); - result.add(new IEC28VO("50>U>=40", String.valueOf(arr[11][0]), String.valueOf(arr[11][1]), String.valueOf(arr[11][2]), String.valueOf(arr[11][3]), String.valueOf(arr[11][4]), String.valueOf(arr[11][5]), String.valueOf(arr[11][6]), String.valueOf(arr[11][7]))); - result.add(new IEC28VO("40>U>=30", String.valueOf(arr[12][0]), String.valueOf(arr[12][1]), String.valueOf(arr[12][2]), String.valueOf(arr[12][3]), String.valueOf(arr[12][4]), String.valueOf(arr[12][5]), String.valueOf(arr[12][6]), String.valueOf(arr[12][7]))); - result.add(new IEC28VO("30>U>=20", String.valueOf(arr[13][0]), String.valueOf(arr[13][1]), String.valueOf(arr[13][2]), String.valueOf(arr[13][3]), String.valueOf(arr[13][4]), String.valueOf(arr[13][5]), String.valueOf(arr[13][6]), String.valueOf(arr[13][7]))); - result.add(new IEC28VO("20>U>=10", String.valueOf(arr[14][0]), String.valueOf(arr[14][1]), String.valueOf(arr[14][2]), String.valueOf(arr[14][3]), String.valueOf(arr[14][4]), String.valueOf(arr[14][5]), String.valueOf(arr[14][6]), String.valueOf(arr[14][7]))); - result.add(new IEC28VO("10>U>=1", String.valueOf(arr[15][0]), String.valueOf(arr[15][1]), String.valueOf(arr[15][2]), String.valueOf(arr[15][3]), String.valueOf(arr[15][4]), String.valueOf(arr[15][5]), String.valueOf(arr[15][6]), String.valueOf(arr[15][7]))); - result.add(new IEC28VO("1>U>=0", String.valueOf(arr[16][0]), String.valueOf(arr[16][1]), String.valueOf(arr[16][2]), String.valueOf(arr[16][3]), String.valueOf(arr[16][4]), String.valueOf(arr[16][5]), String.valueOf(arr[16][6]), String.valueOf(arr[16][7]))); - return result; - } - - @Override - public ProbabilityVO getProbabilityDistribution(List info2) { - ProbabilityVO result = new ProbabilityVO(); - List info = new ArrayList<>(); - - //总数 - Integer count = 0; - for (EventDetail eventDetail : info2) { - //过滤掉大于0.9的数据 - if (eventDetail.getFeatureAmplitude() <= 0.9) { - count++; - info.add(eventDetail); - } - } - //计数map - HashMap countMap = new HashMap<>(); - countMap.put("<10", 0); - countMap.put("<20", 0); - countMap.put("<30", 0); - countMap.put("<40", 0); - countMap.put("<50", 0); - countMap.put("<60", 0); - countMap.put("<70", 0); - countMap.put("<80", 0); - countMap.put("<90", 0); - //分段计数 - HashMap subsectionMap = new HashMap<>(); - subsectionMap.put("0~10", 0); - subsectionMap.put("10~20", 0); - subsectionMap.put("20~30", 0); - subsectionMap.put("30~40", 0); - subsectionMap.put("40~50", 0); - subsectionMap.put("50~60", 0); - subsectionMap.put("60~70", 0); - subsectionMap.put("70~80", 0); - subsectionMap.put("80~90", 0); - //求数量 - for (EventDetail eventDetail : info) { - if (eventDetail.getFeatureAmplitude() < 0.1) { - countMap.put("<10", (countMap.get("<10") + 1)); - } - if (eventDetail.getFeatureAmplitude() < 0.2) { - countMap.put("<20", (countMap.get("<20") + 1)); - } - if (eventDetail.getFeatureAmplitude() < 0.3) { - countMap.put("<30", (countMap.get("<30") + 1)); - } - if (eventDetail.getFeatureAmplitude() < 0.4) { - countMap.put("<40", (countMap.get("<40") + 1)); - } - if (eventDetail.getFeatureAmplitude() < 0.5) { - countMap.put("<50", (countMap.get("<50") + 1)); - } - if (eventDetail.getFeatureAmplitude() < 0.6) { - countMap.put("<60", (countMap.get("<60") + 1)); - } - if (eventDetail.getFeatureAmplitude() < 0.7) { - countMap.put("<70", (countMap.get("<70") + 1)); - } - if (eventDetail.getFeatureAmplitude() < 0.8) { - countMap.put("<80", (countMap.get("<80") + 1)); - } - if (eventDetail.getFeatureAmplitude() < 0.9) { - countMap.put("<90", (countMap.get("<90") + 1)); - } - } - //求每段数量 - for (EventDetail eventDetail : info) { - if (eventDetail.getFeatureAmplitude() < 0.1) { - subsectionMap.put("0~10", (subsectionMap.get("0~10") + 1)); - } else if (eventDetail.getFeatureAmplitude() > 0.1 && eventDetail.getFeatureAmplitude() < 0.2) { - subsectionMap.put("10~20", (subsectionMap.get("10~20") + 1)); - } else if (eventDetail.getFeatureAmplitude() > 0.2 && eventDetail.getFeatureAmplitude() < 0.3) { - subsectionMap.put("20~30", (subsectionMap.get("20~30") + 1)); - } else if (eventDetail.getFeatureAmplitude() > 0.3 && eventDetail.getFeatureAmplitude() < 0.4) { - subsectionMap.put("30~40", (subsectionMap.get("30~40") + 1)); - } else if (eventDetail.getFeatureAmplitude() > 0.4 && eventDetail.getFeatureAmplitude() < 0.5) { - subsectionMap.put("40~50", (subsectionMap.get("40~50") + 1)); - } else if (eventDetail.getFeatureAmplitude() > 0.5 && eventDetail.getFeatureAmplitude() < 0.6) { - subsectionMap.put("50~60", (subsectionMap.get("50~60") + 1)); - } else if (eventDetail.getFeatureAmplitude() > 0.6 && eventDetail.getFeatureAmplitude() < 0.7) { - subsectionMap.put("60~70", (subsectionMap.get("60~70") + 1)); - } else if (eventDetail.getFeatureAmplitude() > 0.7 && eventDetail.getFeatureAmplitude() < 0.8) { - subsectionMap.put("70~80", (subsectionMap.get("70~80") + 1)); - } else if (eventDetail.getFeatureAmplitude() > 0.8 && eventDetail.getFeatureAmplitude() < 0.9) { - subsectionMap.put("80~90", (subsectionMap.get("80~90") + 1)); - } - } - //求概率并求pereventvalue - List pereventvalue = new ArrayList<>(); - Set subsectionSet = subsectionMap.keySet(); - List strings1 = new ArrayList<>(); - strings1.add("0~10"); - strings1.add("10~20"); - strings1.add("20~30"); - strings1.add("30~40"); - strings1.add("40~50"); - strings1.add("50~60"); - strings1.add("60~70"); - strings1.add("70~80"); - strings1.add("80~90"); - for (int i = 0; i < strings1.size(); i++) { - for (String s : subsectionSet) { - if (strings1.get(i).equals(s)) { - if (subsectionMap.get(s) == 0) { - pereventvalue.add(".00"); - break; - } - if (subsectionMap.get(s) / count.doubleValue() == 1.0) { - pereventvalue.add("100.00"); - } else { - String s1 = String.format("%.4f", (subsectionMap.get(s) / count.doubleValue())); - pereventvalue.add(s1.substring(2, 4) + "." + s1.substring(4, 6)); - } - } - } - } - result.setPereventvalue(pereventvalue); - //求eventvalue - List eventvalue = new ArrayList<>(); - List strings = new ArrayList<>(); - strings.add("<10"); - strings.add("<20"); - strings.add("<30"); - strings.add("<40"); - strings.add("<50"); - strings.add("<60"); - strings.add("<70"); - strings.add("<80"); - strings.add("<90"); - Set countSet = countMap.keySet(); - //保证顺序 - for (int i = 0; i < strings.size(); i++) { - for (String s : countSet) { - if (strings.get(i).equals(s)) { - if (countMap.get(s) == 0) { - eventvalue.add(".00"); - break; - } - if (countMap.get(s) / count.floatValue() == 1.0) { - eventvalue.add("100.00"); - } else { - String s1 = String.format("%.4f", (countMap.get(s) / count.doubleValue())); - eventvalue.add(s1.substring(2, 4) + "." + s1.substring(4, 6)); - } - } - } - } - eventvalue.add("100.00"); - result.setEventvalue(eventvalue); - //时间 - HashMap timeMap = new HashMap<>(); - timeMap.put("<0.1", 0); - timeMap.put("<0.25", 0); - timeMap.put("<0.5", 0); - timeMap.put("<1", 0); - timeMap.put("<3", 0); - timeMap.put("<20", 0); - timeMap.put("<60", 0); - timeMap.put("<180", 0); - //求不同时间段的总数 - for (EventDetail eventDetail : info) { - Double persistTime = eventDetail.getDuration(); - if (persistTime / 1000 < 0.1) { - timeMap.put("<0.1", timeMap.get("<0.1") + 1); - } else if (persistTime / 1000 > 0.1 && persistTime / 1000 < 0.25) { - timeMap.put("<0.25", timeMap.get("<0.25") + 1); - } else if (persistTime / 1000 > 0.25 && persistTime / 1000 < 0.5) { - timeMap.put("<0.5", timeMap.get("<0.5") + 1); - } else if (persistTime / 1000 > 0.5 && persistTime / 1000 < 1) { - timeMap.put("<1", timeMap.get("<1") + 1); - } else if (persistTime / 1000 > 1 && persistTime / 1000 < 3) { - timeMap.put("<3", timeMap.get("<3") + 1); - } else if (persistTime / 1000 > 3 && persistTime / 1000 < 20) { - timeMap.put("<20", timeMap.get("<20") + 1); - } else if (persistTime / 1000 > 20 && persistTime / 1000 < 60) { - timeMap.put("<60", timeMap.get("<60") + 1); - } else if (persistTime / 1000 > 60 && persistTime / 1000 < 180) { - timeMap.put("<180", timeMap.get("<180") + 1); - } - } - List strings2 = new ArrayList<>(); - strings2.add("<0.1"); - strings2.add("<0.25"); - strings2.add("<0.5"); - strings2.add("<1"); - strings2.add("<3"); - strings2.add("<20"); - strings2.add("<60"); - strings2.add("<180"); - //求persisttime - List persisttime = new ArrayList<>(); - Set timeSet = timeMap.keySet(); - for (int i = 0; i < strings2.size(); i++) { - for (String s : timeSet) { - if (strings2.get(i).equals(s)) { - if (timeMap.get(s) == 0) { - persisttime.add(".00"); - break; - } - if (timeMap.get(s) / count.floatValue() == 1.0) { - persisttime.add("100.00"); - } else { - String s1 = String.format("%.4f", (timeMap.get(s) / count.doubleValue())); - persisttime.add(s1.substring(2, 4) + "." + s1.substring(4, 6)); - } - } - } - } - result.setPersisttime(persisttime); - - HashMap timeMap2 = new HashMap<>(); - timeMap2.put("<0.1", 0); - timeMap2.put("<0.25", 0); - timeMap2.put("<0.5", 0); - timeMap2.put("<1", 0); - timeMap2.put("<3", 0); - timeMap2.put("<20", 0); - timeMap2.put("<60", 0); - timeMap2.put("<180", 0); - //求sisttime - List sisttime = new ArrayList<>(); - for (EventDetail eventDetail : info) { - Double persistTime = eventDetail.getDuration(); - if (persistTime / 1000 < 0.1) { - timeMap2.put("<0.1", timeMap2.get("<0.1") + 1); - } - if (persistTime / 1000 < 0.25) { - timeMap2.put("<0.25", timeMap2.get("<0.25") + 1); - } - if (persistTime / 1000 < 0.5) { - timeMap2.put("<0.5", timeMap2.get("<0.5") + 1); - } - if (persistTime / 1000 < 1) { - timeMap2.put("<1", timeMap2.get("<1") + 1); - } - if (persistTime / 1000 < 3) { - timeMap2.put("<3", timeMap2.get("<3") + 1); - } - if (persistTime / 1000 < 20) { - timeMap2.put("<20", timeMap2.get("<20") + 1); - } - if (persistTime / 1000 < 60) { - timeMap2.put("<60", timeMap2.get("<60") + 1); - } - if (persistTime / 1000 < 180) { - timeMap2.put("<180", timeMap2.get("<180") + 1); - } - } - Set time2Set = timeMap2.keySet(); - for (int i = 0; i < strings2.size(); i++) { - for (String s : time2Set) { - if (strings2.get(i).equals(s)) { - if (timeMap2.get(s) == 0) { - sisttime.add(".00"); - break; - } - if (timeMap2.get(s) / count.floatValue() == 1.0) { - sisttime.add("100.00"); - } else { - String s1 = String.format("%.4f", (timeMap2.get(s) / count.doubleValue())); - sisttime.add(s1.substring(2, 4) + "." + s1.substring(4, 6)); - } - } - } - } - sisttime.add("100.00"); - result.setSisttime(sisttime); - return result; - } - - - /** - * 暂降事件点图 - * - * @author wr - */ - @Override - public List getPlot(List info, List reasonData, List typeData) { - //添加detail - for (EventDetail detail : info) { - for (DictData data : reasonData) { - if (data.getId().equals(detail.getAdvanceReason())) { - detail.setAdvanceReason(data.getName()); - } - } - for (DictData data : typeData) { - if (data.getId().equals(detail.getAdvanceType())) { - detail.setAdvanceType(data.getName()); - } - } - } - return info; - } - - @Override - public StatisticVO getStatistic(List info, List reasonData, List typeData) { - StatisticVO result = new StatisticVO(); - List list = new ArrayList<>(); - List reasonsVOS = new ArrayList<>(); - List typesVOS = new ArrayList<>(); - - HashMap reasonMap = new HashMap<>(); - HashMap typeMap = new HashMap<>(); - //添加detail - for (EventDetail detail : info) { - for (DictData data : reasonData) { - reasonMap.put(data.getName(), 0); - if (data.getId().equals(detail.getAdvanceReason())) { - detail.setAdvanceReason(data.getName()); - } - } - for (DictData data : typeData) { - typeMap.put(data.getName(), 0); - if (data.getId().equals(detail.getAdvanceType())) { - detail.setAdvanceType(data.getName()); - } - } - list.add(detail); - } - - //添加reason到map - for (EventDetail data : list) { - if (reasonMap.get(data.getAdvanceReason()) != null) { - reasonMap.put(data.getAdvanceReason(), reasonMap.get(data.getAdvanceReason()) + 1); - } - } - //添加type到map - for (EventDetail data : list) { - if (typeMap.get(data.getAdvanceType()) != null) { - typeMap.put(data.getAdvanceType(), typeMap.get(data.getAdvanceType()) + 1); - } - } - Set reasonKeyset = reasonMap.keySet(); - Set typeKeyset = typeMap.keySet(); - for (String s : reasonKeyset) { - reasonsVOS.add(new ReasonsVO(s, reasonMap.get(s), null)); - } - for (String s : typeKeyset) { - typesVOS.add(new TypesVO(s, typeMap.get(s))); - } - result.setTypes(typesVOS); - result.setReason(reasonsVOS); - return result; - } - - - @Override - public Integer[][] getCoords(List info) { - Integer[][] eventDensityData = new Integer[90][3]; - for (int i = 0; i < 10; i++) { -// eventDensityData[i] = new Integer[]{i % 10, i % 9, 0}; - for (int j = 0; j < 9; j++) { - eventDensityData[i * 9 + j] = new Integer[]{i, j % 9, 0}; - } - } - for (int i = 0; i < info.size(); i++) { - Integer index = null; - if (info.get(i).getFeatureAmplitude() >= 0 && info.get(i).getFeatureAmplitude() <= 0.1) { - if (info.get(i).getDuration() / 1000 > 0 && info.get(i).getDuration() / 1000 <= 0.020) { - index = 0; - } else if (info.get(i).getDuration() / 1000 <= 0.040 && info.get(i).getDuration() / 1000 > 0.020) { - index = 1; - } else if (info.get(i).getDuration() / 1000 <= 0.060 && info.get(i).getDuration() / 1000 > 0.040) { - index = 2; - } else if (info.get(i).getDuration() / 1000 <= 0.080 && info.get(i).getDuration() / 1000 > 0.060) { - index = 3; - } else if (info.get(i).getDuration() / 1000 <= 0.120 && info.get(i).getDuration() / 1000 > 0.080) { - index = 4; - } else if (info.get(i).getDuration() / 1000 > 0.120 && info.get(i).getDuration() / 1000 < 0.200) { - index = 5; - } else if (info.get(i).getDuration() / 1000 >= 0.200 && info.get(i).getDuration() / 1000 < 0.400) { - index = 6; - } else if (info.get(i).getDuration() / 1000 >= 0.400 && info.get(i).getDuration() / 1000 < 0.600) { - index = 7; - } else if (info.get(i).getDuration() / 1000 >= 0.600 && info.get(i).getDuration() / 1000 <= 1.200) { - index = 8; - } - } else if (info.get(i).getFeatureAmplitude() > 0.1 && info.get(i).getFeatureAmplitude() <= 0.2) { - if (info.get(i).getDuration() / 1000 > 0 && info.get(i).getDuration() / 1000 <= 0.020) { - index = 9; - } else if (info.get(i).getDuration() / 1000 <= 0.040 && info.get(i).getDuration() / 1000 > 0.020) { - index = 10; - } else if (info.get(i).getDuration() / 1000 <= 0.060 && info.get(i).getDuration() / 1000 > 0.040) { - index = 11; - } else if (info.get(i).getDuration() / 1000 <= 0.080 && info.get(i).getDuration() / 1000 > 0.060) { - index = 12; - } else if (info.get(i).getDuration() / 1000 <= 0.120 && info.get(i).getDuration() / 1000 > 0.080) { - index = 13; - } else if (info.get(i).getDuration() / 1000 > 0.120 && info.get(i).getDuration() / 1000 < 0.200) { - index = 14; - } else if (info.get(i).getDuration() / 1000 >= 0.200 && info.get(i).getDuration() / 1000 < 0.400) { - index = 15; - } else if (info.get(i).getDuration() / 1000 >= 0.400 && info.get(i).getDuration() / 1000 < 0.600) { - index = 16; - } else if (info.get(i).getDuration() / 1000 >= 0.600 && info.get(i).getDuration() / 1000 <= 1.200) { - index = 17; - } - } else if (info.get(i).getFeatureAmplitude() > 0.2 && info.get(i).getFeatureAmplitude() <= 0.3) { - if (info.get(i).getDuration() / 1000 > 0 && info.get(i).getDuration() / 1000 <= 0.020) { - index = 18; - } else if (info.get(i).getDuration() / 1000 <= 0.040 && info.get(i).getDuration() / 1000 > 0.020) { - index = 19; - } else if (info.get(i).getDuration() / 1000 <= 0.060 && info.get(i).getDuration() / 1000 > 0.040) { - index = 20; - } else if (info.get(i).getDuration() / 1000 <= 0.080 && info.get(i).getDuration() / 1000 > 0.060) { - index = 21; - } else if (info.get(i).getDuration() / 1000 <= 0.120 && info.get(i).getDuration() / 1000 > 0.080) { - index = 22; - } else if (info.get(i).getDuration() / 1000 > 0.120 && info.get(i).getDuration() / 1000 < 0.200) { - index = 23; - } else if (info.get(i).getDuration() / 1000 >= 0.200 && info.get(i).getDuration() / 1000 < 0.400) { - index = 24; - } else if (info.get(i).getDuration() / 1000 >= 0.400 && info.get(i).getDuration() / 1000 < 0.600) { - index = 25; - } else if (info.get(i).getDuration() / 1000 >= 0.600 && info.get(i).getDuration() / 1000 <= 1.200) { - index = 26; - } - } else if (info.get(i).getFeatureAmplitude() > 0.3 && info.get(i).getFeatureAmplitude() <= 0.4) { - if (info.get(i).getDuration() / 1000 > 0 && info.get(i).getDuration() / 1000 <= 0.020) { - index = 27; - } else if (info.get(i).getDuration() / 1000 <= 0.040 && info.get(i).getDuration() / 1000 > 0.020) { - index = 28; - } else if (info.get(i).getDuration() / 1000 <= 0.060 && info.get(i).getDuration() / 1000 > 0.040) { - index = 29; - } else if (info.get(i).getDuration() / 1000 <= 0.080 && info.get(i).getDuration() / 1000 > 0.060) { - index = 30; - } else if (info.get(i).getDuration() / 1000 <= 0.120 && info.get(i).getDuration() / 1000 > 0.080) { - index = 31; - } else if (info.get(i).getDuration() / 1000 > 0.120 && info.get(i).getDuration() / 1000 < 0.200) { - index = 32; - } else if (info.get(i).getDuration() / 1000 >= 0.200 && info.get(i).getDuration() / 1000 < 0.400) { - index = 33; - } else if (info.get(i).getDuration() / 1000 >= 0.400 && info.get(i).getDuration() / 1000 < 0.600) { - index = 34; - } else if (info.get(i).getDuration() / 1000 >= 0.600 && info.get(i).getDuration() / 1000 <= 1.200) { - index = 35; - } - } else if (info.get(i).getFeatureAmplitude() > 0.4 && info.get(i).getFeatureAmplitude() <= 0.5) { - if (info.get(i).getDuration() / 1000 > 0 && info.get(i).getDuration() / 1000 <= 0.020) { - index = 36; - } else if (info.get(i).getDuration() / 1000 <= 0.040 && info.get(i).getDuration() / 1000 > 0.020) { - index = 37; - } else if (info.get(i).getDuration() / 1000 <= 0.060 && info.get(i).getDuration() / 1000 > 0.040) { - index = 38; - } else if (info.get(i).getDuration() / 1000 <= 0.080 && info.get(i).getDuration() / 1000 > 0.060) { - index = 39; - } else if (info.get(i).getDuration() / 1000 <= 0.120 && info.get(i).getDuration() / 1000 > 0.080) { - index = 40; - } else if (info.get(i).getDuration() / 1000 > 0.120 && info.get(i).getDuration() / 1000 < 0.200) { - index = 41; - } else if (info.get(i).getDuration() / 1000 >= 0.200 && info.get(i).getDuration() / 1000 < 0.400) { - index = 42; - } else if (info.get(i).getDuration() / 1000 >= 0.400 && info.get(i).getDuration() / 1000 < 0.600) { - index = 43; - } else if (info.get(i).getDuration() / 1000 >= 0.600 && info.get(i).getDuration() / 1000 <= 1.200) { - index = 44; - } - } else if (info.get(i).getFeatureAmplitude() > 0.5 && info.get(i).getFeatureAmplitude() <= 0.6) { - if (info.get(i).getDuration() / 1000 > 0 && info.get(i).getDuration() / 1000 <= 0.020) { - index = 45; - } else if (info.get(i).getDuration() / 1000 <= 0.040 && info.get(i).getDuration() / 1000 > 0.020) { - index = 46; - } else if (info.get(i).getDuration() / 1000 <= 0.060 && info.get(i).getDuration() / 1000 > 0.040) { - index = 47; - } else if (info.get(i).getDuration() / 1000 <= 0.080 && info.get(i).getDuration() / 1000 > 0.060) { - index = 48; - } else if (info.get(i).getDuration() / 1000 <= 0.120 && info.get(i).getDuration() / 1000 > 0.080) { - index = 49; - } else if (info.get(i).getDuration() / 1000 > 0.120 && info.get(i).getDuration() / 1000 < 0.200) { - index = 50; - } else if (info.get(i).getDuration() / 1000 >= 0.200 && info.get(i).getDuration() / 1000 < 0.400) { - index = 51; - } else if (info.get(i).getDuration() / 1000 >= 0.400 && info.get(i).getDuration() / 1000 < 0.600) { - index = 52; - } else if (info.get(i).getDuration() / 1000 >= 0.600 && info.get(i).getDuration() / 1000 <= 1.200) { - index = 53; - } - } else if (info.get(i).getFeatureAmplitude() > 0.6 && info.get(i).getFeatureAmplitude() <= 0.7) { - if (info.get(i).getDuration() / 1000 > 0 && info.get(i).getDuration() / 1000 <= 0.020) { - index = 54; - } else if (info.get(i).getDuration() / 1000 <= 0.040 && info.get(i).getDuration() / 1000 > 0.020) { - index = 55; - } else if (info.get(i).getDuration() / 1000 <= 0.060 && info.get(i).getDuration() / 1000 > 0.040) { - index = 56; - } else if (info.get(i).getDuration() / 1000 <= 0.080 && info.get(i).getDuration() / 1000 > 0.060) { - index = 57; - } else if (info.get(i).getDuration() / 1000 <= 0.120 && info.get(i).getDuration() / 1000 > 0.080) { - index = 58; - } else if (info.get(i).getDuration() / 1000 > 0.120 && info.get(i).getDuration() / 1000 < 0.200) { - index = 59; - } else if (info.get(i).getDuration() / 1000 >= 0.200 && info.get(i).getDuration() / 1000 < 0.400) { - index = 60; - } else if (info.get(i).getDuration() / 1000 >= 0.400 && info.get(i).getDuration() / 1000 < 0.600) { - index = 61; - } else if (info.get(i).getDuration() / 1000 >= 0.600 && info.get(i).getDuration() / 1000 <= 1.200) { - index = 62; - } - } else if (info.get(i).getFeatureAmplitude() > 0.7 && info.get(i).getFeatureAmplitude() <= 0.8) { - if (info.get(i).getDuration() / 1000 > 0 && info.get(i).getDuration() / 1000 <= 0.020) { - index = 63; - } else if (info.get(i).getDuration() / 1000 <= 0.040 && info.get(i).getDuration() / 1000 > 0.020) { - index = 64; - } else if (info.get(i).getDuration() / 1000 <= 0.060 && info.get(i).getDuration() / 1000 > 0.040) { - index = 65; - } else if (info.get(i).getDuration() / 1000 <= 0.080 && info.get(i).getDuration() / 1000 > 0.060) { - index = 66; - } else if (info.get(i).getDuration() / 1000 <= 0.120 && info.get(i).getDuration() / 1000 > 0.080) { - index = 67; - } else if (info.get(i).getDuration() / 1000 > 0.120 && info.get(i).getDuration() / 1000 < 0.200) { - index = 68; - } else if (info.get(i).getDuration() / 1000 >= 0.200 && info.get(i).getDuration() / 1000 < 0.400) { - index = 69; - } else if (info.get(i).getDuration() / 1000 >= 0.400 && info.get(i).getDuration() / 1000 < 0.600) { - index = 70; - } else if (info.get(i).getDuration() / 1000 >= 0.600 && info.get(i).getDuration() / 1000 <= 1.200) { - index = 71; - } - } else if (info.get(i).getFeatureAmplitude() > 0.8 && info.get(i).getFeatureAmplitude() <= 0.9) { - if (info.get(i).getDuration() / 1000 > 0 && info.get(i).getDuration() / 1000 <= 0.020) { - index = 72; - } else if (info.get(i).getDuration() / 1000 <= 0.040 && info.get(i).getDuration() / 1000 > 0.020) { - index = 73; - } else if (info.get(i).getDuration() / 1000 <= 0.060 && info.get(i).getDuration() / 1000 > 0.040) { - index = 74; - } else if (info.get(i).getDuration() / 1000 <= 0.080 && info.get(i).getDuration() / 1000 > 0.060) { - index = 75; - } else if (info.get(i).getDuration() / 1000 <= 0.120 && info.get(i).getDuration() / 1000 > 0.080) { - index = 76; - } else if (info.get(i).getDuration() / 1000 > 0.120 && info.get(i).getDuration() / 1000 < 0.200) { - index = 77; - } else if (info.get(i).getDuration() / 1000 >= 0.200 && info.get(i).getDuration() / 1000 < 0.400) { - index = 78; - } else if (info.get(i).getDuration() / 1000 >= 0.400 && info.get(i).getDuration() / 1000 < 0.600) { - index = 79; - } else if (info.get(i).getDuration() / 1000 >= 0.600 && info.get(i).getDuration() / 1000 <= 1.200) { - index = 80; - } - } else { - if (info.get(i).getDuration() / 1000 > 0 && info.get(i).getDuration() / 1000 <= 0.020) { - index = 81; - } else if (info.get(i).getDuration() / 1000 <= 0.040 && info.get(i).getDuration() / 1000 > 0.020) { - index = 82; - } else if (info.get(i).getDuration() / 1000 <= 0.060 && info.get(i).getDuration() / 1000 > 0.040) { - index = 83; - } else if (info.get(i).getDuration() / 1000 <= 0.080 && info.get(i).getDuration() / 1000 > 0.060) { - index = 84; - } else if (info.get(i).getDuration() / 1000 <= 0.120 && info.get(i).getDuration() / 1000 > 0.080) { - index = 85; - } else if (info.get(i).getDuration() / 1000 > 0.120 && info.get(i).getDuration() / 1000 < 0.200) { - index = 86; - } else if (info.get(i).getDuration() / 1000 >= 0.200 && info.get(i).getDuration() / 1000 < 0.400) { - index = 87; - } else if (info.get(i).getDuration() / 1000 >= 0.400 && info.get(i).getDuration() / 1000 < 0.600) { - index = 88; - } else if (info.get(i).getDuration() / 1000 >= 0.600 && info.get(i).getDuration() / 1000 <= 1.200) { - index = 89; - } - } - if (Objects.nonNull(index)) { - Integer[] temNumber = eventDensityData[index]; - temNumber[2] = temNumber[2] + 1; - } - } - return eventDensityData; - } - - - /** - * 暂降原因类型和时间 - * - * @param statisticsParam - * @return - * @author xxy - */ - @Override - public List getReasonTypeTime(StatisticsParam statisticsParam) throws ParseException { - //获取暂降字典信息 - List data = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.EVENT_STATIS.getCode()).getData(); - List typeList = data.stream().filter(it->it.getCode().equals(DicDataEnum.VOLTAGE_DIP.getCode()) || it.getCode().equals(DicDataEnum.SHORT_INTERRUPTIONS.getCode())).map(DictData::getId).collect(Collectors.toList()); - List list = new ArrayList<>(); - //参数 - StringBuilder builder1 = new StringBuilder(); - StringBuilder builder2 = new StringBuilder(); - QueryResult query = null; - //获取时间字符串 - String startTime = statisticsParam.getStartTime(); - String endTime = statisticsParam.getEndTime(); - Integer startDays = Integer.parseInt(startTime.substring(8, 10)); - Integer endDays = Integer.parseInt(endTime.substring(8, 10)); - Integer startMonth = Integer.parseInt(startTime.substring(5, 7)); - Integer endMonth = Integer.parseInt(endTime.substring(5, 7)); - Integer startYear = Integer.parseInt(startTime.substring(0, 4)); - Integer endYear = Integer.parseInt(endTime.substring(0, 4)); - /* if (statisticsParam.getFlag() == 0) { - while (startYear != endYear && startMonth != endMonth) { - builder1.delete(0, builder1.length()); - builder2.delete(0, builder2.length()); - builder1.append(startYear).append("-").append(startMonth).append("-").append(startDays); - if (startMonth + 1 == 13) { - builder2.append(startYear + 1).append("-").append(1).append("-").append(startDays); - } else { - builder2.append(startYear).append("-").append(startMonth + 1).append("-").append(startDays); - } - - List eventDetailList = eventDetailService.list(new LambdaQueryWrapper() - .eq(RmpEventDetailPO::getMeasurementPointId, statisticsParam.getLineIndex()) - .in(RmpEventDetailPO::getEventType,typeList) - .ge(StringUtils.isNotBlank(statisticsParam.getStartTime()), RmpEventDetailPO::getStartTime, DateUtil.beginOfDay(DateUtil.parse(statisticsParam.getStartTime()))) - .le(StringUtils.isNotBlank(statisticsParam.getEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(statisticsParam.getEndTime()))) - ); - long count = eventDetailList.stream().filter(x -> typeList.contains(x.getEventType())).count(); - if (startMonth < 10) { - list.add(new TimeVO(null, null, "", "0" + startMonth.toString(), count + "", startYear.toString(), startYear.toString() + "-" + "0" + startMonth.toString())); - } else { - list.add(new TimeVO(null, null, "", startMonth.toString(), count + "", startYear.toString(), startYear.toString() + "-" + startMonth.toString())); - } - startMonth++; - if (startMonth == 13) { - startYear++; - startMonth = 1; - } - } - builder1.delete(0, builder1.length()); - builder2.delete(0, builder2.length()); - builder1.append(startYear).append("-").append(startMonth).append("-").append(startDays); - builder2.append(startYear).append("-").append(startMonth).append("-").append(endDays); -// query = MonitorQuery(new StatisticsParam(statisticsParam.getLineIndex(),builder1.toString(), builder2.toString(), statisticsParam.getFlag())); -// InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper(); -// List eventDetailList = influxDBResultMapper.toPOJO(query, EventDetail.class); -// long count1 = eventDetailList.stream().filter(x -> x.getWaveType() == 1).count(); - List eventDetailList = eventDetailService.list(new LambdaQueryWrapper() - .eq(RmpEventDetailPO::getMeasurementPointId, statisticsParam.getLineIndex()) - .in(RmpEventDetailPO::getEventType, typeList) - .ge(StringUtils.isNotBlank(statisticsParam.getStartTime()), RmpEventDetailPO::getStartTime, DateUtil.beginOfDay(DateUtil.parse(statisticsParam.getStartTime()))) - .le(StringUtils.isNotBlank(statisticsParam.getEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(statisticsParam.getEndTime()))) - ); - long count1 = eventDetailList.stream().filter(x -> typeList.contains(x.getEventType())).count(); - if (startMonth < 10) { - list.add(new TimeVO(null, null, "", "0" + startMonth.toString(), count1 + "", startYear.toString(), startYear.toString() + "-" + "0" + startMonth.toString())); - } else { - list.add(new TimeVO(null, null, "", startMonth.toString(), count1 + "", startYear.toString(), startYear.toString() + "-" + startMonth.toString())); - } - return list; - } else { - - List eventDetailList = eventDetailService.list(new LambdaQueryWrapper() - .eq(RmpEventDetailPO::getMeasurementPointId, statisticsParam.getLineIndex()) - .in(RmpEventDetailPO::getEventType, typeList) - .ge(StringUtils.isNotBlank(statisticsParam.getStartTime()), RmpEventDetailPO::getStartTime, DateUtil.beginOfDay(DateUtil.parse(statisticsParam.getStartTime()))) - .le(StringUtils.isNotBlank(statisticsParam.getEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(statisticsParam.getEndTime()))) - ); - - Map> map = eventDetailList.stream().filter(x -> typeList.contains(x.getEventType())) - .peek(t -> t.setFormatTime(t.getStartTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")))) - .collect(Collectors.groupingBy(RmpEventDetailPO::getFormatTime)); - Set keySet = map.keySet(); - LocalDate parse1 = LocalDate.parse(startTime); - LocalDate parse2 = LocalDate.parse(endTime); - while (!parse1.equals(parse2.plus(1, ChronoUnit.DAYS))) { - if (keySet.contains(parse1.toString())) { -// List eventDetailNews = map.get(parse1.toString()); - List eventDetailNews = map.get(parse1.toString()); - TimeVO timeVO = new TimeVO(); - timeVO.setTimes(eventDetailNews.size() + ""); - if (parse1.getDayOfMonth() < 10) { - timeVO.setDay("0" + parse1.getDayOfMonth() + ""); - } else { - timeVO.setDay(parse1.getDayOfMonth() + ""); - } - timeVO.setYear(parse1.getYear() + ""); - if (parse1.getMonthValue() < 10) { - timeVO.setMonth("0" + parse1.getMonthValue() + ""); - } else { - timeVO.setMonth(parse1.getMonthValue() + ""); - } - timeVO.setFulltime(parse1.toString()); - list.add(timeVO); - } else { - TimeVO timeVO = new TimeVO(); - timeVO.setTimes("0"); - if (parse1.getDayOfMonth() < 10) { - timeVO.setDay("0" + parse1.getDayOfMonth() + ""); - } else { - timeVO.setDay(parse1.getDayOfMonth() + ""); - } - timeVO.setYear(parse1.getYear() + ""); - if (parse1.getMonthValue() < 10) { - timeVO.setMonth("0" + parse1.getMonthValue() + ""); - } else { - timeVO.setMonth(parse1.getMonthValue() + ""); - } - timeVO.setFulltime(parse1.toString()); - list.add(timeVO); - } - parse1 = parse1.plus(1, ChronoUnit.DAYS); - } - return list; - }*/ - - return list; - } - -} +//package com.njcn.csharmonic.service.impl.event; +// +// +//import cn.hutool.core.date.DateUtil; +//import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +//import com.njcn.csharmonic.pojo.dto.eventReport.EventDetail; +//import com.njcn.csharmonic.pojo.param.eventReport.StatisticsParam; +//import com.njcn.csharmonic.pojo.vo.eventReport.*; +//import com.njcn.csharmonic.service.event.EventReportService; +//import com.njcn.influx.utils.InfluxDbUtils; +//import com.njcn.system.api.DicDataFeignClient; +//import com.njcn.system.enums.DicDataEnum; +//import com.njcn.system.enums.DicDataTypeEnum; +//import com.njcn.system.pojo.po.DictData; +//import lombok.RequiredArgsConstructor; +//import org.apache.commons.lang.StringUtils; +//import org.influxdb.dto.QueryResult; +//import org.springframework.stereotype.Service; +// +//import java.text.ParseException; +//import java.time.LocalDate; +//import java.time.format.DateTimeFormatter; +//import java.time.temporal.ChronoUnit; +//import java.util.*; +//import java.util.stream.Collectors; +// +// +///** +// * <功能描述> +// * +// * @author wr +// * @createTime: 2023-02-10 +// */ +//@Service +//@RequiredArgsConstructor +//public class EventReportServiceImpl implements EventReportService { +// +// private final DicDataFeignClient dicDataFeignClient; +// +// @Override +// public List eventDisdip(List info) { +// List result = new ArrayList<>(); +// int[][] arr = new int[5][8]; +// for (int i = 0; i < 5; i++) { +// for (int j = 0; j < 8; j++) { +// arr[i][j] = 0; +// } +// } +// for (int i = 0; i < info.size(); i++) { +// Double eventvalue = info.get(i).getFeatureAmplitude(); +// double persisttime = info.get(i).getDuration(); +// if (eventvalue * 100 < 10) { +// if (persisttime < 20) { +// arr[4][0]++; +// } else if (persisttime < 100) { +// arr[4][1]++; +// } else if (persisttime < 500) { +// arr[4][2]++; +// } else if (persisttime < 1000) { +// arr[4][3]++; +// } else if (persisttime < 3000) { +// arr[4][4]++; +// } else if (persisttime < 20000) { +// arr[4][5]++; +// } else if (persisttime < 60000) { +// arr[4][6]++; +// } else if (persisttime < 180000) { +// arr[4][7]++; +// } +// } else if (eventvalue * 100 < 40) { +// if (persisttime < 20) { +// arr[3][0]++; +// } else if (persisttime < 100) { +// arr[3][1]++; +// } else if (persisttime < 500) { +// arr[3][2]++; +// } else if (persisttime < 1000) { +// arr[3][3]++; +// } else if (persisttime < 3000) { +// arr[3][4]++; +// } else if (persisttime < 20000) { +// arr[3][5]++; +// } else if (persisttime < 60000) { +// arr[3][6]++; +// } else if (persisttime < 180000) { +// arr[3][7]++; +// } +// } else if (eventvalue * 100 < 70) { +// if (persisttime < 20) { +// arr[2][0]++; +// } else if (persisttime < 100) { +// arr[2][1]++; +// } else if (persisttime < 500) { +// arr[2][2]++; +// } else if (persisttime < 1000) { +// arr[2][3]++; +// } else if (persisttime < 3000) { +// arr[2][4]++; +// } else if (persisttime < 20000) { +// arr[2][5]++; +// } else if (persisttime < 60000) { +// arr[2][6]++; +// } else if (persisttime < 180000) { +// arr[2][7]++; +// } +// } else if (eventvalue * 100 < 85) { +// if (persisttime < 20) { +// arr[1][0]++; +// } else if (persisttime < 100) { +// arr[1][1]++; +// } else if (persisttime < 500) { +// arr[1][2]++; +// } else if (persisttime < 1000) { +// arr[1][3]++; +// } else if (persisttime < 3000) { +// arr[1][4]++; +// } else if (persisttime < 20000) { +// arr[1][5]++; +// } else if (persisttime < 60000) { +// arr[1][6]++; +// } else if (persisttime < 180000) { +// arr[1][7]++; +// } +// } else if (eventvalue * 100 <= 90) { +// if (persisttime < 20) { +// arr[0][0]++; +// } else if (persisttime < 100) { +// arr[0][1]++; +// } else if (persisttime < 500) { +// arr[0][2]++; +// } else if (persisttime < 1000) { +// arr[0][3]++; +// } else if (persisttime < 3000) { +// arr[0][4]++; +// } else if (persisttime < 20000) { +// arr[0][5]++; +// } else if (persisttime < 60000) { +// arr[0][6]++; +// } else if (persisttime < 180000) { +// arr[0][7]++; +// } +// } +// } +// result.add(new DISDIPVO("90%", String.valueOf(arr[0][0]), String.valueOf(arr[0][1]), String.valueOf(arr[0][2]), String.valueOf(arr[0][3]), String.valueOf(arr[0][4]), String.valueOf(arr[0][5]), String.valueOf(arr[0][6]), String.valueOf(arr[0][7]))); +// result.add(new DISDIPVO("85%", String.valueOf(arr[1][0]), String.valueOf(arr[1][1]), String.valueOf(arr[1][2]), String.valueOf(arr[1][3]), String.valueOf(arr[1][4]), String.valueOf(arr[1][5]), String.valueOf(arr[1][6]), String.valueOf(arr[1][7]))); +// result.add(new DISDIPVO("70%", String.valueOf(arr[2][0]), String.valueOf(arr[2][1]), String.valueOf(arr[2][2]), String.valueOf(arr[2][3]), String.valueOf(arr[2][4]), String.valueOf(arr[2][5]), String.valueOf(arr[2][6]), String.valueOf(arr[2][7]))); +// result.add(new DISDIPVO("40%", String.valueOf(arr[3][0]), String.valueOf(arr[3][1]), String.valueOf(arr[3][2]), String.valueOf(arr[3][3]), String.valueOf(arr[3][4]), String.valueOf(arr[3][5]), String.valueOf(arr[3][6]), String.valueOf(arr[3][7]))); +// result.add(new DISDIPVO("10%", String.valueOf(arr[4][0]), String.valueOf(arr[4][1]), String.valueOf(arr[4][2]), String.valueOf(arr[4][3]), String.valueOf(arr[4][4]), String.valueOf(arr[4][5]), String.valueOf(arr[4][6]), String.valueOf(arr[4][7]))); +// return result; +// } +// +// @Override +// public List IEC411(List info) { +// List result = new ArrayList<>(); +// int[][] arr = new int[3][6]; +// for (int i = 0; i < 3; i++) { +// for (int j = 0; j < 6; j++) { +// arr[i][j] = 0; +// } +// } +// for (int i = 0; i < info.size(); i++) { +// Double eventvalue = info.get(i).getFeatureAmplitude(); +// double persisttime = info.get(i).getDuration(); +// if (eventvalue * 100 < 1) { +// if (persisttime < 20 && persisttime >= 10) { +// arr[2][0]++; +// } else if (persisttime < 100) { +// arr[2][1]++; +// } else if (persisttime < 200) { +// arr[2][2]++; +// } else if (persisttime < 400) { +// arr[2][3]++; +// } else if (persisttime < 1000) { +// arr[2][4]++; +// } else { +// arr[2][5]++; +// } +// } else if (eventvalue * 100 < 40) { +// if (persisttime < 20 && persisttime >= 10) { +// arr[1][0]++; +// } else if (persisttime < 100) { +// arr[1][1]++; +// } else if (persisttime < 200) { +// arr[1][2]++; +// } else if (persisttime < 400) { +// arr[1][3]++; +// } else if (persisttime < 1000) { +// arr[1][4]++; +// } else { +// arr[1][5]++; +// } +// } else if (eventvalue * 100 <= 70) { +// if (persisttime < 20 && persisttime >= 10) { +// arr[0][0]++; +// } else if (persisttime < 100) { +// arr[0][1]++; +// } else if (persisttime < 200) { +// arr[0][2]++; +// } else if (persisttime < 400) { +// arr[0][3]++; +// } else if (persisttime < 1000) { +// arr[0][4]++; +// } else { +// arr[0][5]++; +// } +// } +// } +// result.add(new IEC411VO("40~70%", String.valueOf(arr[0][0]), String.valueOf(arr[0][1]), String.valueOf(arr[0][2]), String.valueOf(arr[0][3]), String.valueOf(arr[0][4]), String.valueOf(arr[0][5]))); +// result.add(new IEC411VO("1~40%", String.valueOf(arr[1][0]), String.valueOf(arr[1][1]), String.valueOf(arr[1][2]), String.valueOf(arr[1][3]), String.valueOf(arr[1][4]), String.valueOf(arr[1][5]))); +// result.add(new IEC411VO("<1%", String.valueOf(arr[2][0]), String.valueOf(arr[2][1]), String.valueOf(arr[2][2]), String.valueOf(arr[2][3]), String.valueOf(arr[2][4]), String.valueOf(arr[2][5]))); +// return result; +// } +// +// @Override +// public List IEC28(List info) { +// List result = new ArrayList<>(); +// int[][] arr = new int[17][8]; +// for (int i = 0; i < 17; i++) { +// for (int j = 0; j < 8; j++) { +// arr[i][j] = 0; +// } +// } +// for (int i = 0; i < info.size(); i++) { +// Double eventvalue = info.get(i).getFeatureAmplitude(); +// double persisttime = info.get(i).getDuration(); +// if (eventvalue * 100 < 1 && eventvalue * 100 >= 0) { +// if (persisttime > 10 && persisttime <= 100) { +// arr[16][0]++; +// } else if (persisttime <= 250) { +// arr[16][1]++; +// } else if (persisttime <= 500) { +// arr[16][2]++; +// } else if (persisttime <= 1000) { +// arr[16][3]++; +// } else if (persisttime <= 3000) { +// arr[16][4]++; +// } else if (persisttime <= 20000) { +// arr[16][5]++; +// } else if (persisttime <= 60000) { +// arr[16][6]++; +// } else if (persisttime <= 180000) { +// arr[16][7]++; +// } +// } else if (eventvalue * 100 < 10) { +// if (persisttime > 10 && persisttime <= 100) { +// arr[15][0]++; +// } else if (persisttime <= 250) { +// arr[15][1]++; +// } else if (persisttime <= 500) { +// arr[15][2]++; +// } else if (persisttime <= 1000) { +// arr[15][3]++; +// } else if (persisttime <= 3000) { +// arr[15][4]++; +// } else if (persisttime <= 20000) { +// arr[15][5]++; +// } else if (persisttime <= 60000) { +// arr[15][6]++; +// } else if (persisttime <= 180000) { +// arr[15][7]++; +// } +// } else if (eventvalue * 100 < 20) { +// if (persisttime > 10 && persisttime <= 100) { +// arr[14][0]++; +// } else if (persisttime <= 250) { +// arr[14][1]++; +// } else if (persisttime <= 500) { +// arr[14][2]++; +// } else if (persisttime <= 1000) { +// arr[14][3]++; +// } else if (persisttime <= 3000) { +// arr[14][4]++; +// } else if (persisttime <= 20000) { +// arr[14][5]++; +// } else if (persisttime <= 60000) { +// arr[14][6]++; +// } else if (persisttime <= 180000) { +// arr[14][7]++; +// } +// } else if (eventvalue * 100 < 30) { +// if (persisttime > 10 && persisttime <= 100) { +// arr[13][0]++; +// } else if (persisttime <= 250) { +// arr[13][1]++; +// } else if (persisttime <= 500) { +// arr[13][2]++; +// } else if (persisttime <= 1000) { +// arr[13][3]++; +// } else if (persisttime <= 3000) { +// arr[13][4]++; +// } else if (persisttime <= 20000) { +// arr[13][5]++; +// } else if (persisttime <= 60000) { +// arr[13][6]++; +// } else if (persisttime <= 180000) { +// arr[13][7]++; +// } +// } else if (eventvalue * 100 < 40) { +// if (persisttime > 10 && persisttime <= 100) { +// arr[12][0]++; +// } else if (persisttime <= 250) { +// arr[12][1]++; +// } else if (persisttime <= 500) { +// arr[12][2]++; +// } else if (persisttime <= 1000) { +// arr[12][3]++; +// } else if (persisttime <= 3000) { +// arr[12][4]++; +// } else if (persisttime <= 20000) { +// arr[12][5]++; +// } else if (persisttime <= 60000) { +// arr[12][6]++; +// } else if (persisttime <= 180000) { +// arr[12][7]++; +// } +// } else if (eventvalue * 100 < 50) { +// if (persisttime > 10 && persisttime <= 100) { +// arr[11][0]++; +// } else if (persisttime <= 250) { +// arr[11][1]++; +// } else if (persisttime <= 500) { +// arr[11][2]++; +// } else if (persisttime <= 1000) { +// arr[11][3]++; +// } else if (persisttime <= 3000) { +// arr[11][4]++; +// } else if (persisttime <= 20000) { +// arr[11][5]++; +// } else if (persisttime <= 60000) { +// arr[11][6]++; +// } else if (persisttime <= 180000) { +// arr[11][7]++; +// } +// } else if (eventvalue * 100 < 60) { +// if (persisttime > 10 && persisttime <= 100) { +// arr[10][0]++; +// } else if (persisttime <= 250) { +// arr[10][1]++; +// } else if (persisttime <= 500) { +// arr[10][2]++; +// } else if (persisttime <= 1000) { +// arr[10][3]++; +// } else if (persisttime <= 3000) { +// arr[10][4]++; +// } else if (persisttime <= 20000) { +// arr[10][5]++; +// } else if (persisttime <= 60000) { +// arr[10][6]++; +// } else if (persisttime <= 180000) { +// arr[10][7]++; +// } +// } else if (eventvalue * 100 < 70) { +// if (persisttime > 10 && persisttime <= 100) { +// arr[9][0]++; +// } else if (persisttime <= 250) { +// arr[9][1]++; +// } else if (persisttime <= 500) { +// arr[9][2]++; +// } else if (persisttime <= 1000) { +// arr[9][3]++; +// } else if (persisttime <= 3000) { +// arr[9][4]++; +// } else if (persisttime <= 20000) { +// arr[9][5]++; +// } else if (persisttime <= 60000) { +// arr[9][6]++; +// } else if (persisttime <= 180000) { +// arr[9][7]++; +// } +// } else if (eventvalue * 100 < 80) { +// if (persisttime > 10 && persisttime <= 100) { +// arr[8][0]++; +// } else if (persisttime <= 250) { +// arr[8][1]++; +// } else if (persisttime <= 500) { +// arr[8][2]++; +// } else if (persisttime <= 1000) { +// arr[8][3]++; +// } else if (persisttime <= 3000) { +// arr[8][4]++; +// } else if (persisttime <= 20000) { +// arr[8][5]++; +// } else if (persisttime <= 60000) { +// arr[8][6]++; +// } else if (persisttime <= 180000) { +// arr[8][7]++; +// } +// } else if (eventvalue * 100 <= 90) { +// if (persisttime > 10 && persisttime <= 100) { +// arr[7][0]++; +// } else if (persisttime <= 250) { +// arr[7][1]++; +// } else if (persisttime <= 500) { +// arr[7][2]++; +// } else if (persisttime <= 1000) { +// arr[7][3]++; +// } else if (persisttime <= 3000) { +// arr[7][4]++; +// } else if (persisttime <= 20000) { +// arr[7][5]++; +// } else if (persisttime <= 60000) { +// arr[7][6]++; +// } else if (persisttime <= 180000) { +// arr[7][7]++; +// } +// } else if (eventvalue * 100 < 120 && eventvalue * 100 >= 110) { +// if (persisttime > 10 && persisttime <= 100) { +// arr[6][0]++; +// } else if (persisttime <= 250) { +// arr[6][1]++; +// } else if (persisttime <= 500) { +// arr[6][2]++; +// } else if (persisttime <= 1000) { +// arr[6][3]++; +// } else if (persisttime <= 3000) { +// arr[6][4]++; +// } else if (persisttime <= 20000) { +// arr[6][5]++; +// } else if (persisttime <= 60000) { +// arr[6][6]++; +// } else if (persisttime <= 180000) { +// arr[6][7]++; +// } +// } else if (eventvalue * 100 < 130) { +// if (persisttime > 10 && persisttime <= 100) { +// arr[5][0]++; +// } else if (persisttime <= 250) { +// arr[5][1]++; +// } else if (persisttime <= 500) { +// arr[5][2]++; +// } else if (persisttime <= 1000) { +// arr[5][3]++; +// } else if (persisttime <= 3000) { +// arr[5][4]++; +// } else if (persisttime <= 20000) { +// arr[5][5]++; +// } else if (persisttime <= 60000) { +// arr[5][6]++; +// } else if (persisttime <= 180000) { +// arr[5][7]++; +// } +// } else if (eventvalue * 100 < 140) { +// if (persisttime > 10 && persisttime <= 100) { +// arr[4][0]++; +// } else if (persisttime <= 250) { +// arr[4][1]++; +// } else if (persisttime <= 500) { +// arr[4][2]++; +// } else if (persisttime <= 1000) { +// arr[4][3]++; +// } else if (persisttime <= 3000) { +// arr[4][4]++; +// } else if (persisttime <= 20000) { +// arr[4][5]++; +// } else if (persisttime <= 60000) { +// arr[4][6]++; +// } else if (persisttime <= 180000) { +// arr[4][7]++; +// } +// } else if (eventvalue * 100 < 150) { +// if (persisttime > 10 && persisttime <= 100) { +// arr[3][0]++; +// } else if (persisttime <= 250) { +// arr[3][1]++; +// } else if (persisttime <= 500) { +// arr[3][2]++; +// } else if (persisttime <= 1000) { +// arr[3][3]++; +// } else if (persisttime <= 3000) { +// arr[3][4]++; +// } else if (persisttime <= 20000) { +// arr[3][5]++; +// } else if (persisttime <= 60000) { +// arr[3][6]++; +// } else if (persisttime <= 180000) { +// arr[3][7]++; +// } +// } else if (eventvalue * 100 < 160) { +// if (persisttime > 10 && persisttime <= 100) { +// arr[2][0]++; +// } else if (persisttime <= 250) { +// arr[2][1]++; +// } else if (persisttime <= 500) { +// arr[2][2]++; +// } else if (persisttime <= 1000) { +// arr[2][3]++; +// } else if (persisttime <= 3000) { +// arr[2][4]++; +// } else if (persisttime <= 20000) { +// arr[2][5]++; +// } else if (persisttime <= 60000) { +// arr[2][6]++; +// } else if (persisttime <= 180000) { +// arr[2][7]++; +// } +// } else if (eventvalue * 100 < 170) { +// if (persisttime > 10 && persisttime <= 100) { +// arr[1][0]++; +// } else if (persisttime <= 250) { +// arr[1][1]++; +// } else if (persisttime <= 500) { +// arr[1][2]++; +// } else if (persisttime <= 1000) { +// arr[1][3]++; +// } else if (persisttime <= 3000) { +// arr[1][4]++; +// } else if (persisttime <= 20000) { +// arr[1][5]++; +// } else if (persisttime <= 60000) { +// arr[1][6]++; +// } else if (persisttime <= 180000) { +// arr[1][7]++; +// } +// } else if (eventvalue * 100 <= 180) { +// if (persisttime > 10 && persisttime <= 100) { +// arr[0][0]++; +// } else if (persisttime <= 250) { +// arr[0][1]++; +// } else if (persisttime <= 500) { +// arr[0][2]++; +// } else if (persisttime <= 1000) { +// arr[0][3]++; +// } else if (persisttime <= 3000) { +// arr[0][4]++; +// } else if (persisttime <= 20000) { +// arr[0][5]++; +// } else if (persisttime <= 60000) { +// arr[0][6]++; +// } else if (persisttime <= 180000) { +// arr[0][7]++; +// } +// } +// } +// result.add(new IEC28VO("180>U>=170", String.valueOf(arr[0][0]), String.valueOf(arr[0][1]), String.valueOf(arr[0][2]), String.valueOf(arr[0][3]), String.valueOf(arr[0][4]), String.valueOf(arr[0][5]), String.valueOf(arr[0][6]), String.valueOf(arr[0][7]))); +// result.add(new IEC28VO("170>U>=160", String.valueOf(arr[1][0]), String.valueOf(arr[1][1]), String.valueOf(arr[1][2]), String.valueOf(arr[1][3]), String.valueOf(arr[1][4]), String.valueOf(arr[1][5]), String.valueOf(arr[1][6]), String.valueOf(arr[1][7]))); +// result.add(new IEC28VO("160>U>=150", String.valueOf(arr[2][0]), String.valueOf(arr[2][1]), String.valueOf(arr[2][2]), String.valueOf(arr[2][3]), String.valueOf(arr[2][4]), String.valueOf(arr[2][5]), String.valueOf(arr[2][6]), String.valueOf(arr[2][7]))); +// result.add(new IEC28VO("150>U>=140", String.valueOf(arr[3][0]), String.valueOf(arr[3][1]), String.valueOf(arr[3][2]), String.valueOf(arr[3][3]), String.valueOf(arr[3][4]), String.valueOf(arr[3][5]), String.valueOf(arr[3][6]), String.valueOf(arr[3][7]))); +// result.add(new IEC28VO("140>U>=130", String.valueOf(arr[4][0]), String.valueOf(arr[4][1]), String.valueOf(arr[4][2]), String.valueOf(arr[4][3]), String.valueOf(arr[4][4]), String.valueOf(arr[4][5]), String.valueOf(arr[4][6]), String.valueOf(arr[4][7]))); +// result.add(new IEC28VO("130>U>=120", String.valueOf(arr[5][0]), String.valueOf(arr[5][1]), String.valueOf(arr[5][2]), String.valueOf(arr[5][3]), String.valueOf(arr[5][4]), String.valueOf(arr[5][5]), String.valueOf(arr[5][6]), String.valueOf(arr[5][7]))); +// result.add(new IEC28VO("120>U>=110", String.valueOf(arr[6][0]), String.valueOf(arr[6][1]), String.valueOf(arr[6][2]), String.valueOf(arr[6][3]), String.valueOf(arr[6][4]), String.valueOf(arr[6][5]), String.valueOf(arr[6][6]), String.valueOf(arr[6][7]))); +// result.add(new IEC28VO("90>U>=80", String.valueOf(arr[7][0]), String.valueOf(arr[7][1]), String.valueOf(arr[7][2]), String.valueOf(arr[7][3]), String.valueOf(arr[7][4]), String.valueOf(arr[7][5]), String.valueOf(arr[7][6]), String.valueOf(arr[7][7]))); +// result.add(new IEC28VO("80>U>=70", String.valueOf(arr[8][0]), String.valueOf(arr[8][1]), String.valueOf(arr[8][2]), String.valueOf(arr[8][3]), String.valueOf(arr[8][4]), String.valueOf(arr[8][5]), String.valueOf(arr[8][6]), String.valueOf(arr[8][7]))); +// result.add(new IEC28VO("70>U>=60", String.valueOf(arr[9][0]), String.valueOf(arr[9][1]), String.valueOf(arr[9][2]), String.valueOf(arr[9][3]), String.valueOf(arr[9][4]), String.valueOf(arr[9][5]), String.valueOf(arr[9][6]), String.valueOf(arr[9][7]))); +// result.add(new IEC28VO("60>U>=50", String.valueOf(arr[10][0]), String.valueOf(arr[10][1]), String.valueOf(arr[10][2]), String.valueOf(arr[10][3]), String.valueOf(arr[10][4]), String.valueOf(arr[10][5]), String.valueOf(arr[10][6]), String.valueOf(arr[10][7]))); +// result.add(new IEC28VO("50>U>=40", String.valueOf(arr[11][0]), String.valueOf(arr[11][1]), String.valueOf(arr[11][2]), String.valueOf(arr[11][3]), String.valueOf(arr[11][4]), String.valueOf(arr[11][5]), String.valueOf(arr[11][6]), String.valueOf(arr[11][7]))); +// result.add(new IEC28VO("40>U>=30", String.valueOf(arr[12][0]), String.valueOf(arr[12][1]), String.valueOf(arr[12][2]), String.valueOf(arr[12][3]), String.valueOf(arr[12][4]), String.valueOf(arr[12][5]), String.valueOf(arr[12][6]), String.valueOf(arr[12][7]))); +// result.add(new IEC28VO("30>U>=20", String.valueOf(arr[13][0]), String.valueOf(arr[13][1]), String.valueOf(arr[13][2]), String.valueOf(arr[13][3]), String.valueOf(arr[13][4]), String.valueOf(arr[13][5]), String.valueOf(arr[13][6]), String.valueOf(arr[13][7]))); +// result.add(new IEC28VO("20>U>=10", String.valueOf(arr[14][0]), String.valueOf(arr[14][1]), String.valueOf(arr[14][2]), String.valueOf(arr[14][3]), String.valueOf(arr[14][4]), String.valueOf(arr[14][5]), String.valueOf(arr[14][6]), String.valueOf(arr[14][7]))); +// result.add(new IEC28VO("10>U>=1", String.valueOf(arr[15][0]), String.valueOf(arr[15][1]), String.valueOf(arr[15][2]), String.valueOf(arr[15][3]), String.valueOf(arr[15][4]), String.valueOf(arr[15][5]), String.valueOf(arr[15][6]), String.valueOf(arr[15][7]))); +// result.add(new IEC28VO("1>U>=0", String.valueOf(arr[16][0]), String.valueOf(arr[16][1]), String.valueOf(arr[16][2]), String.valueOf(arr[16][3]), String.valueOf(arr[16][4]), String.valueOf(arr[16][5]), String.valueOf(arr[16][6]), String.valueOf(arr[16][7]))); +// return result; +// } +// +// @Override +// public ProbabilityVO getProbabilityDistribution(List info2) { +// ProbabilityVO result = new ProbabilityVO(); +// List info = new ArrayList<>(); +// +// //总数 +// Integer count = 0; +// for (EventDetail eventDetail : info2) { +// //过滤掉大于0.9的数据 +// if (eventDetail.getFeatureAmplitude() <= 0.9) { +// count++; +// info.add(eventDetail); +// } +// } +// //计数map +// HashMap countMap = new HashMap<>(); +// countMap.put("<10", 0); +// countMap.put("<20", 0); +// countMap.put("<30", 0); +// countMap.put("<40", 0); +// countMap.put("<50", 0); +// countMap.put("<60", 0); +// countMap.put("<70", 0); +// countMap.put("<80", 0); +// countMap.put("<90", 0); +// //分段计数 +// HashMap subsectionMap = new HashMap<>(); +// subsectionMap.put("0~10", 0); +// subsectionMap.put("10~20", 0); +// subsectionMap.put("20~30", 0); +// subsectionMap.put("30~40", 0); +// subsectionMap.put("40~50", 0); +// subsectionMap.put("50~60", 0); +// subsectionMap.put("60~70", 0); +// subsectionMap.put("70~80", 0); +// subsectionMap.put("80~90", 0); +// //求数量 +// for (EventDetail eventDetail : info) { +// if (eventDetail.getFeatureAmplitude() < 0.1) { +// countMap.put("<10", (countMap.get("<10") + 1)); +// } +// if (eventDetail.getFeatureAmplitude() < 0.2) { +// countMap.put("<20", (countMap.get("<20") + 1)); +// } +// if (eventDetail.getFeatureAmplitude() < 0.3) { +// countMap.put("<30", (countMap.get("<30") + 1)); +// } +// if (eventDetail.getFeatureAmplitude() < 0.4) { +// countMap.put("<40", (countMap.get("<40") + 1)); +// } +// if (eventDetail.getFeatureAmplitude() < 0.5) { +// countMap.put("<50", (countMap.get("<50") + 1)); +// } +// if (eventDetail.getFeatureAmplitude() < 0.6) { +// countMap.put("<60", (countMap.get("<60") + 1)); +// } +// if (eventDetail.getFeatureAmplitude() < 0.7) { +// countMap.put("<70", (countMap.get("<70") + 1)); +// } +// if (eventDetail.getFeatureAmplitude() < 0.8) { +// countMap.put("<80", (countMap.get("<80") + 1)); +// } +// if (eventDetail.getFeatureAmplitude() < 0.9) { +// countMap.put("<90", (countMap.get("<90") + 1)); +// } +// } +// //求每段数量 +// for (EventDetail eventDetail : info) { +// if (eventDetail.getFeatureAmplitude() < 0.1) { +// subsectionMap.put("0~10", (subsectionMap.get("0~10") + 1)); +// } else if (eventDetail.getFeatureAmplitude() > 0.1 && eventDetail.getFeatureAmplitude() < 0.2) { +// subsectionMap.put("10~20", (subsectionMap.get("10~20") + 1)); +// } else if (eventDetail.getFeatureAmplitude() > 0.2 && eventDetail.getFeatureAmplitude() < 0.3) { +// subsectionMap.put("20~30", (subsectionMap.get("20~30") + 1)); +// } else if (eventDetail.getFeatureAmplitude() > 0.3 && eventDetail.getFeatureAmplitude() < 0.4) { +// subsectionMap.put("30~40", (subsectionMap.get("30~40") + 1)); +// } else if (eventDetail.getFeatureAmplitude() > 0.4 && eventDetail.getFeatureAmplitude() < 0.5) { +// subsectionMap.put("40~50", (subsectionMap.get("40~50") + 1)); +// } else if (eventDetail.getFeatureAmplitude() > 0.5 && eventDetail.getFeatureAmplitude() < 0.6) { +// subsectionMap.put("50~60", (subsectionMap.get("50~60") + 1)); +// } else if (eventDetail.getFeatureAmplitude() > 0.6 && eventDetail.getFeatureAmplitude() < 0.7) { +// subsectionMap.put("60~70", (subsectionMap.get("60~70") + 1)); +// } else if (eventDetail.getFeatureAmplitude() > 0.7 && eventDetail.getFeatureAmplitude() < 0.8) { +// subsectionMap.put("70~80", (subsectionMap.get("70~80") + 1)); +// } else if (eventDetail.getFeatureAmplitude() > 0.8 && eventDetail.getFeatureAmplitude() < 0.9) { +// subsectionMap.put("80~90", (subsectionMap.get("80~90") + 1)); +// } +// } +// //求概率并求pereventvalue +// List pereventvalue = new ArrayList<>(); +// Set subsectionSet = subsectionMap.keySet(); +// List strings1 = new ArrayList<>(); +// strings1.add("0~10"); +// strings1.add("10~20"); +// strings1.add("20~30"); +// strings1.add("30~40"); +// strings1.add("40~50"); +// strings1.add("50~60"); +// strings1.add("60~70"); +// strings1.add("70~80"); +// strings1.add("80~90"); +// for (int i = 0; i < strings1.size(); i++) { +// for (String s : subsectionSet) { +// if (strings1.get(i).equals(s)) { +// if (subsectionMap.get(s) == 0) { +// pereventvalue.add(".00"); +// break; +// } +// if (subsectionMap.get(s) / count.doubleValue() == 1.0) { +// pereventvalue.add("100.00"); +// } else { +// String s1 = String.format("%.4f", (subsectionMap.get(s) / count.doubleValue())); +// pereventvalue.add(s1.substring(2, 4) + "." + s1.substring(4, 6)); +// } +// } +// } +// } +// result.setPereventvalue(pereventvalue); +// //求eventvalue +// List eventvalue = new ArrayList<>(); +// List strings = new ArrayList<>(); +// strings.add("<10"); +// strings.add("<20"); +// strings.add("<30"); +// strings.add("<40"); +// strings.add("<50"); +// strings.add("<60"); +// strings.add("<70"); +// strings.add("<80"); +// strings.add("<90"); +// Set countSet = countMap.keySet(); +// //保证顺序 +// for (int i = 0; i < strings.size(); i++) { +// for (String s : countSet) { +// if (strings.get(i).equals(s)) { +// if (countMap.get(s) == 0) { +// eventvalue.add(".00"); +// break; +// } +// if (countMap.get(s) / count.floatValue() == 1.0) { +// eventvalue.add("100.00"); +// } else { +// String s1 = String.format("%.4f", (countMap.get(s) / count.doubleValue())); +// eventvalue.add(s1.substring(2, 4) + "." + s1.substring(4, 6)); +// } +// } +// } +// } +// eventvalue.add("100.00"); +// result.setEventvalue(eventvalue); +// //时间 +// HashMap timeMap = new HashMap<>(); +// timeMap.put("<0.1", 0); +// timeMap.put("<0.25", 0); +// timeMap.put("<0.5", 0); +// timeMap.put("<1", 0); +// timeMap.put("<3", 0); +// timeMap.put("<20", 0); +// timeMap.put("<60", 0); +// timeMap.put("<180", 0); +// //求不同时间段的总数 +// for (EventDetail eventDetail : info) { +// Double persistTime = eventDetail.getDuration(); +// if (persistTime / 1000 < 0.1) { +// timeMap.put("<0.1", timeMap.get("<0.1") + 1); +// } else if (persistTime / 1000 > 0.1 && persistTime / 1000 < 0.25) { +// timeMap.put("<0.25", timeMap.get("<0.25") + 1); +// } else if (persistTime / 1000 > 0.25 && persistTime / 1000 < 0.5) { +// timeMap.put("<0.5", timeMap.get("<0.5") + 1); +// } else if (persistTime / 1000 > 0.5 && persistTime / 1000 < 1) { +// timeMap.put("<1", timeMap.get("<1") + 1); +// } else if (persistTime / 1000 > 1 && persistTime / 1000 < 3) { +// timeMap.put("<3", timeMap.get("<3") + 1); +// } else if (persistTime / 1000 > 3 && persistTime / 1000 < 20) { +// timeMap.put("<20", timeMap.get("<20") + 1); +// } else if (persistTime / 1000 > 20 && persistTime / 1000 < 60) { +// timeMap.put("<60", timeMap.get("<60") + 1); +// } else if (persistTime / 1000 > 60 && persistTime / 1000 < 180) { +// timeMap.put("<180", timeMap.get("<180") + 1); +// } +// } +// List strings2 = new ArrayList<>(); +// strings2.add("<0.1"); +// strings2.add("<0.25"); +// strings2.add("<0.5"); +// strings2.add("<1"); +// strings2.add("<3"); +// strings2.add("<20"); +// strings2.add("<60"); +// strings2.add("<180"); +// //求persisttime +// List persisttime = new ArrayList<>(); +// Set timeSet = timeMap.keySet(); +// for (int i = 0; i < strings2.size(); i++) { +// for (String s : timeSet) { +// if (strings2.get(i).equals(s)) { +// if (timeMap.get(s) == 0) { +// persisttime.add(".00"); +// break; +// } +// if (timeMap.get(s) / count.floatValue() == 1.0) { +// persisttime.add("100.00"); +// } else { +// String s1 = String.format("%.4f", (timeMap.get(s) / count.doubleValue())); +// persisttime.add(s1.substring(2, 4) + "." + s1.substring(4, 6)); +// } +// } +// } +// } +// result.setPersisttime(persisttime); +// +// HashMap timeMap2 = new HashMap<>(); +// timeMap2.put("<0.1", 0); +// timeMap2.put("<0.25", 0); +// timeMap2.put("<0.5", 0); +// timeMap2.put("<1", 0); +// timeMap2.put("<3", 0); +// timeMap2.put("<20", 0); +// timeMap2.put("<60", 0); +// timeMap2.put("<180", 0); +// //求sisttime +// List sisttime = new ArrayList<>(); +// for (EventDetail eventDetail : info) { +// Double persistTime = eventDetail.getDuration(); +// if (persistTime / 1000 < 0.1) { +// timeMap2.put("<0.1", timeMap2.get("<0.1") + 1); +// } +// if (persistTime / 1000 < 0.25) { +// timeMap2.put("<0.25", timeMap2.get("<0.25") + 1); +// } +// if (persistTime / 1000 < 0.5) { +// timeMap2.put("<0.5", timeMap2.get("<0.5") + 1); +// } +// if (persistTime / 1000 < 1) { +// timeMap2.put("<1", timeMap2.get("<1") + 1); +// } +// if (persistTime / 1000 < 3) { +// timeMap2.put("<3", timeMap2.get("<3") + 1); +// } +// if (persistTime / 1000 < 20) { +// timeMap2.put("<20", timeMap2.get("<20") + 1); +// } +// if (persistTime / 1000 < 60) { +// timeMap2.put("<60", timeMap2.get("<60") + 1); +// } +// if (persistTime / 1000 < 180) { +// timeMap2.put("<180", timeMap2.get("<180") + 1); +// } +// } +// Set time2Set = timeMap2.keySet(); +// for (int i = 0; i < strings2.size(); i++) { +// for (String s : time2Set) { +// if (strings2.get(i).equals(s)) { +// if (timeMap2.get(s) == 0) { +// sisttime.add(".00"); +// break; +// } +// if (timeMap2.get(s) / count.floatValue() == 1.0) { +// sisttime.add("100.00"); +// } else { +// String s1 = String.format("%.4f", (timeMap2.get(s) / count.doubleValue())); +// sisttime.add(s1.substring(2, 4) + "." + s1.substring(4, 6)); +// } +// } +// } +// } +// sisttime.add("100.00"); +// result.setSisttime(sisttime); +// return result; +// } +// +// +// /** +// * 暂降事件点图 +// * +// * @author wr +// */ +// @Override +// public List getPlot(List info, List reasonData, List typeData) { +// //添加detail +// for (EventDetail detail : info) { +// for (DictData data : reasonData) { +// if (data.getId().equals(detail.getAdvanceReason())) { +// detail.setAdvanceReason(data.getName()); +// } +// } +// for (DictData data : typeData) { +// if (data.getId().equals(detail.getAdvanceType())) { +// detail.setAdvanceType(data.getName()); +// } +// } +// } +// return info; +// } +// +// @Override +// public StatisticVO getStatistic(List info, List reasonData, List typeData) { +// StatisticVO result = new StatisticVO(); +// List list = new ArrayList<>(); +// List reasonsVOS = new ArrayList<>(); +// List typesVOS = new ArrayList<>(); +// +// HashMap reasonMap = new HashMap<>(); +// HashMap typeMap = new HashMap<>(); +// //添加detail +// for (EventDetail detail : info) { +// for (DictData data : reasonData) { +// reasonMap.put(data.getName(), 0); +// if (data.getId().equals(detail.getAdvanceReason())) { +// detail.setAdvanceReason(data.getName()); +// } +// } +// for (DictData data : typeData) { +// typeMap.put(data.getName(), 0); +// if (data.getId().equals(detail.getAdvanceType())) { +// detail.setAdvanceType(data.getName()); +// } +// } +// list.add(detail); +// } +// +// //添加reason到map +// for (EventDetail data : list) { +// if (reasonMap.get(data.getAdvanceReason()) != null) { +// reasonMap.put(data.getAdvanceReason(), reasonMap.get(data.getAdvanceReason()) + 1); +// } +// } +// //添加type到map +// for (EventDetail data : list) { +// if (typeMap.get(data.getAdvanceType()) != null) { +// typeMap.put(data.getAdvanceType(), typeMap.get(data.getAdvanceType()) + 1); +// } +// } +// Set reasonKeyset = reasonMap.keySet(); +// Set typeKeyset = typeMap.keySet(); +// for (String s : reasonKeyset) { +// reasonsVOS.add(new ReasonsVO(s, reasonMap.get(s), null)); +// } +// for (String s : typeKeyset) { +// typesVOS.add(new TypesVO(s, typeMap.get(s))); +// } +// result.setTypes(typesVOS); +// result.setReason(reasonsVOS); +// return result; +// } +// +// +// @Override +// public Integer[][] getCoords(List info) { +// Integer[][] eventDensityData = new Integer[90][3]; +// for (int i = 0; i < 10; i++) { +//// eventDensityData[i] = new Integer[]{i % 10, i % 9, 0}; +// for (int j = 0; j < 9; j++) { +// eventDensityData[i * 9 + j] = new Integer[]{i, j % 9, 0}; +// } +// } +// for (int i = 0; i < info.size(); i++) { +// Integer index = null; +// if (info.get(i).getFeatureAmplitude() >= 0 && info.get(i).getFeatureAmplitude() <= 0.1) { +// if (info.get(i).getDuration() / 1000 > 0 && info.get(i).getDuration() / 1000 <= 0.020) { +// index = 0; +// } else if (info.get(i).getDuration() / 1000 <= 0.040 && info.get(i).getDuration() / 1000 > 0.020) { +// index = 1; +// } else if (info.get(i).getDuration() / 1000 <= 0.060 && info.get(i).getDuration() / 1000 > 0.040) { +// index = 2; +// } else if (info.get(i).getDuration() / 1000 <= 0.080 && info.get(i).getDuration() / 1000 > 0.060) { +// index = 3; +// } else if (info.get(i).getDuration() / 1000 <= 0.120 && info.get(i).getDuration() / 1000 > 0.080) { +// index = 4; +// } else if (info.get(i).getDuration() / 1000 > 0.120 && info.get(i).getDuration() / 1000 < 0.200) { +// index = 5; +// } else if (info.get(i).getDuration() / 1000 >= 0.200 && info.get(i).getDuration() / 1000 < 0.400) { +// index = 6; +// } else if (info.get(i).getDuration() / 1000 >= 0.400 && info.get(i).getDuration() / 1000 < 0.600) { +// index = 7; +// } else if (info.get(i).getDuration() / 1000 >= 0.600 && info.get(i).getDuration() / 1000 <= 1.200) { +// index = 8; +// } +// } else if (info.get(i).getFeatureAmplitude() > 0.1 && info.get(i).getFeatureAmplitude() <= 0.2) { +// if (info.get(i).getDuration() / 1000 > 0 && info.get(i).getDuration() / 1000 <= 0.020) { +// index = 9; +// } else if (info.get(i).getDuration() / 1000 <= 0.040 && info.get(i).getDuration() / 1000 > 0.020) { +// index = 10; +// } else if (info.get(i).getDuration() / 1000 <= 0.060 && info.get(i).getDuration() / 1000 > 0.040) { +// index = 11; +// } else if (info.get(i).getDuration() / 1000 <= 0.080 && info.get(i).getDuration() / 1000 > 0.060) { +// index = 12; +// } else if (info.get(i).getDuration() / 1000 <= 0.120 && info.get(i).getDuration() / 1000 > 0.080) { +// index = 13; +// } else if (info.get(i).getDuration() / 1000 > 0.120 && info.get(i).getDuration() / 1000 < 0.200) { +// index = 14; +// } else if (info.get(i).getDuration() / 1000 >= 0.200 && info.get(i).getDuration() / 1000 < 0.400) { +// index = 15; +// } else if (info.get(i).getDuration() / 1000 >= 0.400 && info.get(i).getDuration() / 1000 < 0.600) { +// index = 16; +// } else if (info.get(i).getDuration() / 1000 >= 0.600 && info.get(i).getDuration() / 1000 <= 1.200) { +// index = 17; +// } +// } else if (info.get(i).getFeatureAmplitude() > 0.2 && info.get(i).getFeatureAmplitude() <= 0.3) { +// if (info.get(i).getDuration() / 1000 > 0 && info.get(i).getDuration() / 1000 <= 0.020) { +// index = 18; +// } else if (info.get(i).getDuration() / 1000 <= 0.040 && info.get(i).getDuration() / 1000 > 0.020) { +// index = 19; +// } else if (info.get(i).getDuration() / 1000 <= 0.060 && info.get(i).getDuration() / 1000 > 0.040) { +// index = 20; +// } else if (info.get(i).getDuration() / 1000 <= 0.080 && info.get(i).getDuration() / 1000 > 0.060) { +// index = 21; +// } else if (info.get(i).getDuration() / 1000 <= 0.120 && info.get(i).getDuration() / 1000 > 0.080) { +// index = 22; +// } else if (info.get(i).getDuration() / 1000 > 0.120 && info.get(i).getDuration() / 1000 < 0.200) { +// index = 23; +// } else if (info.get(i).getDuration() / 1000 >= 0.200 && info.get(i).getDuration() / 1000 < 0.400) { +// index = 24; +// } else if (info.get(i).getDuration() / 1000 >= 0.400 && info.get(i).getDuration() / 1000 < 0.600) { +// index = 25; +// } else if (info.get(i).getDuration() / 1000 >= 0.600 && info.get(i).getDuration() / 1000 <= 1.200) { +// index = 26; +// } +// } else if (info.get(i).getFeatureAmplitude() > 0.3 && info.get(i).getFeatureAmplitude() <= 0.4) { +// if (info.get(i).getDuration() / 1000 > 0 && info.get(i).getDuration() / 1000 <= 0.020) { +// index = 27; +// } else if (info.get(i).getDuration() / 1000 <= 0.040 && info.get(i).getDuration() / 1000 > 0.020) { +// index = 28; +// } else if (info.get(i).getDuration() / 1000 <= 0.060 && info.get(i).getDuration() / 1000 > 0.040) { +// index = 29; +// } else if (info.get(i).getDuration() / 1000 <= 0.080 && info.get(i).getDuration() / 1000 > 0.060) { +// index = 30; +// } else if (info.get(i).getDuration() / 1000 <= 0.120 && info.get(i).getDuration() / 1000 > 0.080) { +// index = 31; +// } else if (info.get(i).getDuration() / 1000 > 0.120 && info.get(i).getDuration() / 1000 < 0.200) { +// index = 32; +// } else if (info.get(i).getDuration() / 1000 >= 0.200 && info.get(i).getDuration() / 1000 < 0.400) { +// index = 33; +// } else if (info.get(i).getDuration() / 1000 >= 0.400 && info.get(i).getDuration() / 1000 < 0.600) { +// index = 34; +// } else if (info.get(i).getDuration() / 1000 >= 0.600 && info.get(i).getDuration() / 1000 <= 1.200) { +// index = 35; +// } +// } else if (info.get(i).getFeatureAmplitude() > 0.4 && info.get(i).getFeatureAmplitude() <= 0.5) { +// if (info.get(i).getDuration() / 1000 > 0 && info.get(i).getDuration() / 1000 <= 0.020) { +// index = 36; +// } else if (info.get(i).getDuration() / 1000 <= 0.040 && info.get(i).getDuration() / 1000 > 0.020) { +// index = 37; +// } else if (info.get(i).getDuration() / 1000 <= 0.060 && info.get(i).getDuration() / 1000 > 0.040) { +// index = 38; +// } else if (info.get(i).getDuration() / 1000 <= 0.080 && info.get(i).getDuration() / 1000 > 0.060) { +// index = 39; +// } else if (info.get(i).getDuration() / 1000 <= 0.120 && info.get(i).getDuration() / 1000 > 0.080) { +// index = 40; +// } else if (info.get(i).getDuration() / 1000 > 0.120 && info.get(i).getDuration() / 1000 < 0.200) { +// index = 41; +// } else if (info.get(i).getDuration() / 1000 >= 0.200 && info.get(i).getDuration() / 1000 < 0.400) { +// index = 42; +// } else if (info.get(i).getDuration() / 1000 >= 0.400 && info.get(i).getDuration() / 1000 < 0.600) { +// index = 43; +// } else if (info.get(i).getDuration() / 1000 >= 0.600 && info.get(i).getDuration() / 1000 <= 1.200) { +// index = 44; +// } +// } else if (info.get(i).getFeatureAmplitude() > 0.5 && info.get(i).getFeatureAmplitude() <= 0.6) { +// if (info.get(i).getDuration() / 1000 > 0 && info.get(i).getDuration() / 1000 <= 0.020) { +// index = 45; +// } else if (info.get(i).getDuration() / 1000 <= 0.040 && info.get(i).getDuration() / 1000 > 0.020) { +// index = 46; +// } else if (info.get(i).getDuration() / 1000 <= 0.060 && info.get(i).getDuration() / 1000 > 0.040) { +// index = 47; +// } else if (info.get(i).getDuration() / 1000 <= 0.080 && info.get(i).getDuration() / 1000 > 0.060) { +// index = 48; +// } else if (info.get(i).getDuration() / 1000 <= 0.120 && info.get(i).getDuration() / 1000 > 0.080) { +// index = 49; +// } else if (info.get(i).getDuration() / 1000 > 0.120 && info.get(i).getDuration() / 1000 < 0.200) { +// index = 50; +// } else if (info.get(i).getDuration() / 1000 >= 0.200 && info.get(i).getDuration() / 1000 < 0.400) { +// index = 51; +// } else if (info.get(i).getDuration() / 1000 >= 0.400 && info.get(i).getDuration() / 1000 < 0.600) { +// index = 52; +// } else if (info.get(i).getDuration() / 1000 >= 0.600 && info.get(i).getDuration() / 1000 <= 1.200) { +// index = 53; +// } +// } else if (info.get(i).getFeatureAmplitude() > 0.6 && info.get(i).getFeatureAmplitude() <= 0.7) { +// if (info.get(i).getDuration() / 1000 > 0 && info.get(i).getDuration() / 1000 <= 0.020) { +// index = 54; +// } else if (info.get(i).getDuration() / 1000 <= 0.040 && info.get(i).getDuration() / 1000 > 0.020) { +// index = 55; +// } else if (info.get(i).getDuration() / 1000 <= 0.060 && info.get(i).getDuration() / 1000 > 0.040) { +// index = 56; +// } else if (info.get(i).getDuration() / 1000 <= 0.080 && info.get(i).getDuration() / 1000 > 0.060) { +// index = 57; +// } else if (info.get(i).getDuration() / 1000 <= 0.120 && info.get(i).getDuration() / 1000 > 0.080) { +// index = 58; +// } else if (info.get(i).getDuration() / 1000 > 0.120 && info.get(i).getDuration() / 1000 < 0.200) { +// index = 59; +// } else if (info.get(i).getDuration() / 1000 >= 0.200 && info.get(i).getDuration() / 1000 < 0.400) { +// index = 60; +// } else if (info.get(i).getDuration() / 1000 >= 0.400 && info.get(i).getDuration() / 1000 < 0.600) { +// index = 61; +// } else if (info.get(i).getDuration() / 1000 >= 0.600 && info.get(i).getDuration() / 1000 <= 1.200) { +// index = 62; +// } +// } else if (info.get(i).getFeatureAmplitude() > 0.7 && info.get(i).getFeatureAmplitude() <= 0.8) { +// if (info.get(i).getDuration() / 1000 > 0 && info.get(i).getDuration() / 1000 <= 0.020) { +// index = 63; +// } else if (info.get(i).getDuration() / 1000 <= 0.040 && info.get(i).getDuration() / 1000 > 0.020) { +// index = 64; +// } else if (info.get(i).getDuration() / 1000 <= 0.060 && info.get(i).getDuration() / 1000 > 0.040) { +// index = 65; +// } else if (info.get(i).getDuration() / 1000 <= 0.080 && info.get(i).getDuration() / 1000 > 0.060) { +// index = 66; +// } else if (info.get(i).getDuration() / 1000 <= 0.120 && info.get(i).getDuration() / 1000 > 0.080) { +// index = 67; +// } else if (info.get(i).getDuration() / 1000 > 0.120 && info.get(i).getDuration() / 1000 < 0.200) { +// index = 68; +// } else if (info.get(i).getDuration() / 1000 >= 0.200 && info.get(i).getDuration() / 1000 < 0.400) { +// index = 69; +// } else if (info.get(i).getDuration() / 1000 >= 0.400 && info.get(i).getDuration() / 1000 < 0.600) { +// index = 70; +// } else if (info.get(i).getDuration() / 1000 >= 0.600 && info.get(i).getDuration() / 1000 <= 1.200) { +// index = 71; +// } +// } else if (info.get(i).getFeatureAmplitude() > 0.8 && info.get(i).getFeatureAmplitude() <= 0.9) { +// if (info.get(i).getDuration() / 1000 > 0 && info.get(i).getDuration() / 1000 <= 0.020) { +// index = 72; +// } else if (info.get(i).getDuration() / 1000 <= 0.040 && info.get(i).getDuration() / 1000 > 0.020) { +// index = 73; +// } else if (info.get(i).getDuration() / 1000 <= 0.060 && info.get(i).getDuration() / 1000 > 0.040) { +// index = 74; +// } else if (info.get(i).getDuration() / 1000 <= 0.080 && info.get(i).getDuration() / 1000 > 0.060) { +// index = 75; +// } else if (info.get(i).getDuration() / 1000 <= 0.120 && info.get(i).getDuration() / 1000 > 0.080) { +// index = 76; +// } else if (info.get(i).getDuration() / 1000 > 0.120 && info.get(i).getDuration() / 1000 < 0.200) { +// index = 77; +// } else if (info.get(i).getDuration() / 1000 >= 0.200 && info.get(i).getDuration() / 1000 < 0.400) { +// index = 78; +// } else if (info.get(i).getDuration() / 1000 >= 0.400 && info.get(i).getDuration() / 1000 < 0.600) { +// index = 79; +// } else if (info.get(i).getDuration() / 1000 >= 0.600 && info.get(i).getDuration() / 1000 <= 1.200) { +// index = 80; +// } +// } else { +// if (info.get(i).getDuration() / 1000 > 0 && info.get(i).getDuration() / 1000 <= 0.020) { +// index = 81; +// } else if (info.get(i).getDuration() / 1000 <= 0.040 && info.get(i).getDuration() / 1000 > 0.020) { +// index = 82; +// } else if (info.get(i).getDuration() / 1000 <= 0.060 && info.get(i).getDuration() / 1000 > 0.040) { +// index = 83; +// } else if (info.get(i).getDuration() / 1000 <= 0.080 && info.get(i).getDuration() / 1000 > 0.060) { +// index = 84; +// } else if (info.get(i).getDuration() / 1000 <= 0.120 && info.get(i).getDuration() / 1000 > 0.080) { +// index = 85; +// } else if (info.get(i).getDuration() / 1000 > 0.120 && info.get(i).getDuration() / 1000 < 0.200) { +// index = 86; +// } else if (info.get(i).getDuration() / 1000 >= 0.200 && info.get(i).getDuration() / 1000 < 0.400) { +// index = 87; +// } else if (info.get(i).getDuration() / 1000 >= 0.400 && info.get(i).getDuration() / 1000 < 0.600) { +// index = 88; +// } else if (info.get(i).getDuration() / 1000 >= 0.600 && info.get(i).getDuration() / 1000 <= 1.200) { +// index = 89; +// } +// } +// if (Objects.nonNull(index)) { +// Integer[] temNumber = eventDensityData[index]; +// temNumber[2] = temNumber[2] + 1; +// } +// } +// return eventDensityData; +// } +// +// +// /** +// * 暂降原因类型和时间 +// * +// * @param statisticsParam +// * @return +// * @author xxy +// */ +// @Override +// public List getReasonTypeTime(StatisticsParam statisticsParam) throws ParseException { +// //获取暂降字典信息 +// List data = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.EVENT_STATIS.getCode()).getData(); +// List typeList = data.stream().filter(it->it.getCode().equals(DicDataEnum.VOLTAGE_DIP.getCode()) || it.getCode().equals(DicDataEnum.SHORT_INTERRUPTIONS.getCode())).map(DictData::getId).collect(Collectors.toList()); +// List list = new ArrayList<>(); +// //参数 +// StringBuilder builder1 = new StringBuilder(); +// StringBuilder builder2 = new StringBuilder(); +// QueryResult query = null; +// //获取时间字符串 +// String startTime = statisticsParam.getStartTime(); +// String endTime = statisticsParam.getEndTime(); +// Integer startDays = Integer.parseInt(startTime.substring(8, 10)); +// Integer endDays = Integer.parseInt(endTime.substring(8, 10)); +// Integer startMonth = Integer.parseInt(startTime.substring(5, 7)); +// Integer endMonth = Integer.parseInt(endTime.substring(5, 7)); +// Integer startYear = Integer.parseInt(startTime.substring(0, 4)); +// Integer endYear = Integer.parseInt(endTime.substring(0, 4)); +// /* if (statisticsParam.getFlag() == 0) { +// while (startYear != endYear && startMonth != endMonth) { +// builder1.delete(0, builder1.length()); +// builder2.delete(0, builder2.length()); +// builder1.append(startYear).append("-").append(startMonth).append("-").append(startDays); +// if (startMonth + 1 == 13) { +// builder2.append(startYear + 1).append("-").append(1).append("-").append(startDays); +// } else { +// builder2.append(startYear).append("-").append(startMonth + 1).append("-").append(startDays); +// } +// +// List eventDetailList = eventDetailService.list(new LambdaQueryWrapper() +// .eq(RmpEventDetailPO::getMeasurementPointId, statisticsParam.getLineIndex()) +// .in(RmpEventDetailPO::getEventType,typeList) +// .ge(StringUtils.isNotBlank(statisticsParam.getStartTime()), RmpEventDetailPO::getStartTime, DateUtil.beginOfDay(DateUtil.parse(statisticsParam.getStartTime()))) +// .le(StringUtils.isNotBlank(statisticsParam.getEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(statisticsParam.getEndTime()))) +// ); +// long count = eventDetailList.stream().filter(x -> typeList.contains(x.getEventType())).count(); +// if (startMonth < 10) { +// list.add(new TimeVO(null, null, "", "0" + startMonth.toString(), count + "", startYear.toString(), startYear.toString() + "-" + "0" + startMonth.toString())); +// } else { +// list.add(new TimeVO(null, null, "", startMonth.toString(), count + "", startYear.toString(), startYear.toString() + "-" + startMonth.toString())); +// } +// startMonth++; +// if (startMonth == 13) { +// startYear++; +// startMonth = 1; +// } +// } +// builder1.delete(0, builder1.length()); +// builder2.delete(0, builder2.length()); +// builder1.append(startYear).append("-").append(startMonth).append("-").append(startDays); +// builder2.append(startYear).append("-").append(startMonth).append("-").append(endDays); +//// query = MonitorQuery(new StatisticsParam(statisticsParam.getLineIndex(),builder1.toString(), builder2.toString(), statisticsParam.getFlag())); +//// InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper(); +//// List eventDetailList = influxDBResultMapper.toPOJO(query, EventDetail.class); +//// long count1 = eventDetailList.stream().filter(x -> x.getWaveType() == 1).count(); +// List eventDetailList = eventDetailService.list(new LambdaQueryWrapper() +// .eq(RmpEventDetailPO::getMeasurementPointId, statisticsParam.getLineIndex()) +// .in(RmpEventDetailPO::getEventType, typeList) +// .ge(StringUtils.isNotBlank(statisticsParam.getStartTime()), RmpEventDetailPO::getStartTime, DateUtil.beginOfDay(DateUtil.parse(statisticsParam.getStartTime()))) +// .le(StringUtils.isNotBlank(statisticsParam.getEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(statisticsParam.getEndTime()))) +// ); +// long count1 = eventDetailList.stream().filter(x -> typeList.contains(x.getEventType())).count(); +// if (startMonth < 10) { +// list.add(new TimeVO(null, null, "", "0" + startMonth.toString(), count1 + "", startYear.toString(), startYear.toString() + "-" + "0" + startMonth.toString())); +// } else { +// list.add(new TimeVO(null, null, "", startMonth.toString(), count1 + "", startYear.toString(), startYear.toString() + "-" + startMonth.toString())); +// } +// return list; +// } else { +// +// List eventDetailList = eventDetailService.list(new LambdaQueryWrapper() +// .eq(RmpEventDetailPO::getMeasurementPointId, statisticsParam.getLineIndex()) +// .in(RmpEventDetailPO::getEventType, typeList) +// .ge(StringUtils.isNotBlank(statisticsParam.getStartTime()), RmpEventDetailPO::getStartTime, DateUtil.beginOfDay(DateUtil.parse(statisticsParam.getStartTime()))) +// .le(StringUtils.isNotBlank(statisticsParam.getEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(statisticsParam.getEndTime()))) +// ); +// +// Map> map = eventDetailList.stream().filter(x -> typeList.contains(x.getEventType())) +// .peek(t -> t.setFormatTime(t.getStartTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")))) +// .collect(Collectors.groupingBy(RmpEventDetailPO::getFormatTime)); +// Set keySet = map.keySet(); +// LocalDate parse1 = LocalDate.parse(startTime); +// LocalDate parse2 = LocalDate.parse(endTime); +// while (!parse1.equals(parse2.plus(1, ChronoUnit.DAYS))) { +// if (keySet.contains(parse1.toString())) { +//// List eventDetailNews = map.get(parse1.toString()); +// List eventDetailNews = map.get(parse1.toString()); +// TimeVO timeVO = new TimeVO(); +// timeVO.setTimes(eventDetailNews.size() + ""); +// if (parse1.getDayOfMonth() < 10) { +// timeVO.setDay("0" + parse1.getDayOfMonth() + ""); +// } else { +// timeVO.setDay(parse1.getDayOfMonth() + ""); +// } +// timeVO.setYear(parse1.getYear() + ""); +// if (parse1.getMonthValue() < 10) { +// timeVO.setMonth("0" + parse1.getMonthValue() + ""); +// } else { +// timeVO.setMonth(parse1.getMonthValue() + ""); +// } +// timeVO.setFulltime(parse1.toString()); +// list.add(timeVO); +// } else { +// TimeVO timeVO = new TimeVO(); +// timeVO.setTimes("0"); +// if (parse1.getDayOfMonth() < 10) { +// timeVO.setDay("0" + parse1.getDayOfMonth() + ""); +// } else { +// timeVO.setDay(parse1.getDayOfMonth() + ""); +// } +// timeVO.setYear(parse1.getYear() + ""); +// if (parse1.getMonthValue() < 10) { +// timeVO.setMonth("0" + parse1.getMonthValue() + ""); +// } else { +// timeVO.setMonth(parse1.getMonthValue() + ""); +// } +// timeVO.setFulltime(parse1.toString()); +// list.add(timeVO); +// } +// parse1 = parse1.plus(1, ChronoUnit.DAYS); +// } +// return list; +// }*/ +// +// return list; +// } +// +//} diff --git a/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/service/impl/event/RmpEventDetailServiceImpl.java b/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/service/impl/event/RmpEventDetailServiceImpl.java index ff0626a..abdac3c 100644 --- a/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/service/impl/event/RmpEventDetailServiceImpl.java +++ b/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/service/impl/event/RmpEventDetailServiceImpl.java @@ -1,28 +1,28 @@ -package com.njcn.csharmonic.service.impl.event; - -import com.baomidou.dynamic.datasource.annotation.DS; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.njcn.csharmonic.mapper.RmpEventDetailMapper; -import com.njcn.csharmonic.pojo.po.RmpEventDetailPO; -import com.njcn.csharmonic.service.event.RmpEventDetailService; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; - - -/** - * 暂态事件明细 - * - * @author yzh - * @date 2022/10/12 - */ -@Service -@Slf4j -@RequiredArgsConstructor -@DS("sjzx") -public class RmpEventDetailServiceImpl extends ServiceImpl implements RmpEventDetailService { - - -} - - +//package com.njcn.csharmonic.service.impl.event; +// +//import com.baomidou.dynamic.datasource.annotation.DS; +//import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +//import com.njcn.csharmonic.mapper.RmpEventDetailMapper; +//import com.njcn.csharmonic.pojo.po.RmpEventDetailPO; +//import com.njcn.csharmonic.service.event.RmpEventDetailService; +//import lombok.RequiredArgsConstructor; +//import lombok.extern.slf4j.Slf4j; +//import org.springframework.stereotype.Service; +// +// +///** +// * 暂态事件明细 +// * +// * @author yzh +// * @date 2022/10/12 +// */ +//@Service +//@Slf4j +//@RequiredArgsConstructor +//@DS("sjzx") +//public class RmpEventDetailServiceImpl extends ServiceImpl implements RmpEventDetailService { +// +// +//} +// +//