diff --git a/pqs-algorithm/algorithm-api/main/java/com/njcn/algorithm/pojo/param/AppLineTopologyDiagramAddParm.java b/pqs-algorithm/algorithm-api/main/java/com/njcn/algorithm/pojo/param/AppLineTopologyDiagramAddParm.java new file mode 100644 index 000000000..1915881c9 --- /dev/null +++ b/pqs-algorithm/algorithm-api/main/java/com/njcn/algorithm/pojo/param/AppLineTopologyDiagramAddParm.java @@ -0,0 +1,37 @@ +package com.njcn.algorithm.pojo.param; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +/** + * + * Description: + * 接口文档访问地址:http://serverIP:port/swagger-ui.html + * Date: 2023/3/27 10:18【需求编号】 + * + * @author clam + * @version V1.0.0 + */ + +/** + * 项目拓扑图关系表 + */ +@Data +public class AppLineTopologyDiagramAddParm { + /** + * 拓扑图Id + */ + @ApiModelProperty(value="拓扑图Id") + @NotBlank(message="拓扑图Id不能为空!") + private String id; + + /** + * 监测点ID + */ + @ApiModelProperty(value="监测点ID") + @NotBlank(message="监测点ID不能为空!") + private String lineId; + +} \ No newline at end of file diff --git a/pqs-algorithm/algorithm-api/main/java/com/njcn/algorithm/pojo/param/AppLineTopologyDiagramAuditParm.java b/pqs-algorithm/algorithm-api/main/java/com/njcn/algorithm/pojo/param/AppLineTopologyDiagramAuditParm.java new file mode 100644 index 000000000..7704d7c1a --- /dev/null +++ b/pqs-algorithm/algorithm-api/main/java/com/njcn/algorithm/pojo/param/AppLineTopologyDiagramAuditParm.java @@ -0,0 +1,43 @@ +package com.njcn.algorithm.pojo.param; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +/** + * + * Description: + * 接口文档访问地址:http://serverIP:port/swagger-ui.html + * Date: 2023/3/27 10:18【需求编号】 + * + * @author clam + * @version V1.0.0 + */ + +/** + * 项目拓扑图关系表 + */ +@Data +public class AppLineTopologyDiagramAuditParm { + /** + * 拓扑图Id + */ + @ApiModelProperty(value="拓扑图Id") + @NotBlank(message="拓扑图Id不能为空!") + private String id; + + /** + * 监测点ID + */ + @ApiModelProperty(value="监测点ID") + @NotBlank(message="监测点ID不能为空!") + private String lineId; + + /** + * 0:删除 1:正常 + */ + @ApiModelProperty(value="删除标志位") + private String status; + +} \ No newline at end of file diff --git a/pqs-algorithm/algorithm-api/main/java/com/njcn/algorithm/pojo/param/CsEquipmentDeliveryAddParm.java b/pqs-algorithm/algorithm-api/main/java/com/njcn/algorithm/pojo/param/CsEquipmentDeliveryAddParm.java new file mode 100644 index 000000000..4bdd596a3 --- /dev/null +++ b/pqs-algorithm/algorithm-api/main/java/com/njcn/algorithm/pojo/param/CsEquipmentDeliveryAddParm.java @@ -0,0 +1,122 @@ +package com.njcn.algorithm.pojo.param; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.util.Date; + +/** + * + * Description: + * 接口文档访问地址:http://serverIP:port/swagger-ui.html + * Date: 2023/3/30 16:23【需求编号】 + * + * @author clam + * @version V1.0.0 + */ + +/** + * 设备出厂表 + */ +@Data +public class CsEquipmentDeliveryAddParm{ + + + /** + * 装置名称 + */ + @ApiModelProperty(value="装置名称") + @NotBlank(message="装置名称不能为空!") + private String name; + + /** + * 网关识别码 + */ + @ApiModelProperty(value="网关识别码") + @NotBlank(message="网关识别码不能为空!") + private String ndid; + + /** + * 装置mac地址 + */ + @ApiModelProperty(value="装置mac地址") + @NotBlank(message="装置mac地址不能为空!") + private String mac; + + /** + * 装置用途(治理、监测...) + */ + @ApiModelProperty(value="装置用途") + @NotBlank(message="装置用途不能为空!") + private String devUse; + + /** + * 装置类型(直连设备、网关设备) + */ + @ApiModelProperty(value="装置类型") + @NotBlank(message="装置类型不能为空!") + private String devType; + + /** + * 装置型号(pqs588、pqs680...) + */ + @ApiModelProperty(value="装置型号") + @NotBlank(message="装置型号不能为空!") + private String devModel; + + /** + * 装置程序版本 + */ + @ApiModelProperty(value="装置程序版本") + @NotBlank(message="装置程序版本不能为空!") + private String programVersion; + + /** + * 调试人员 + */ + @ApiModelProperty(value="调试人员") + @NotBlank(message="调试人员不能为空!") + private String debugPerson; + + /** + * 出厂日期 + */ + @ApiModelProperty(value="出厂日期") + @NotNull(message="出厂日期不能为空!") + @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8") + private Date producteTime; + + /** + * 检修日期 + */ + @ApiModelProperty(value="检修日期") + @NotNull(message="检修日期不能为空!") + @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8") + private Date checkTime; + + /** + * 调试日期 + */ + @ApiModelProperty(value="调试日期") + @NotNull(message="调试日期不能为空!") + @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8") + private Date debugTime; + + /** + * 合同号 + */ + @ApiModelProperty(value="合同号") + private String cntractNo; + + /** + * 营销经理 + */ + @ApiModelProperty(value="营销经理") + private String salesManager; + + + +} \ No newline at end of file diff --git a/pqs-algorithm/algorithm-api/main/java/com/njcn/algorithm/pojo/po/AppLineTopologyDiagramPO.java b/pqs-algorithm/algorithm-api/main/java/com/njcn/algorithm/pojo/po/AppLineTopologyDiagramPO.java index aff6173ea..37a4dce0a 100644 --- a/pqs-algorithm/algorithm-api/main/java/com/njcn/algorithm/pojo/po/AppLineTopologyDiagramPO.java +++ b/pqs-algorithm/algorithm-api/main/java/com/njcn/algorithm/pojo/po/AppLineTopologyDiagramPO.java @@ -28,9 +28,9 @@ public class AppLineTopologyDiagramPO extends BaseEntity { private String id; /** - * 拓扑图名称 + * 监测点ID */ - @TableField(value = "line_id") + @MppMultiId(value = "line_id") private String lineId; /** diff --git a/pqs-algorithm/algorithm-api/main/java/com/njcn/algorithm/pojo/po/CsEquipmentDeliveryPO.java b/pqs-algorithm/algorithm-api/main/java/com/njcn/algorithm/pojo/po/CsEquipmentDeliveryPO.java new file mode 100644 index 000000000..ab9c0a3c2 --- /dev/null +++ b/pqs-algorithm/algorithm-api/main/java/com/njcn/algorithm/pojo/po/CsEquipmentDeliveryPO.java @@ -0,0 +1,116 @@ +package com.njcn.algorithm.pojo.po; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.njcn.db.bo.BaseEntity; +import lombok.Data; + +import java.util.Date; + +/** + * + * Description: + * 接口文档访问地址:http://serverIP:port/swagger-ui.html + * Date: 2023/3/30 16:23【需求编号】 + * + * @author clam + * @version V1.0.0 + */ +/** + * 设备出厂表 + */ +@Data +@TableName(value = "cs_equipment_delivery") +public class CsEquipmentDeliveryPO extends BaseEntity { + /** + * id + */ + @TableField(value = "id") + private String id; + + /** + * 装置名称 + */ + @TableField(value = "name") + private String name; + + /** + * 网关识别码 + */ + @TableField(value = "ndid") + private String ndid; + + /** + * 装置mac地址 + */ + @TableField(value = "mac") + private String mac; + + /** + * 装置用途(治理、监测...) + */ + @TableField(value = "dev_use") + private String devUse; + + /** + * 装置类型(直连设备、网关设备) + */ + @TableField(value = "dev_type") + private String devType; + + /** + * 装置型号(pqs588、pqs680...) + */ + @TableField(value = "dev_model") + private String devModel; + + /** + * 装置程序版本 + */ + @TableField(value = "program_version") + private String programVersion; + + /** + * 调试人员 + */ + @TableField(value = "debug_person") + private String debugPerson; + + /** + * 出厂日期 + */ + @TableField(value = "producte_time") + private Date producteTime; + + /** + * 检修日期 + */ + @TableField(value = "check_time") + private Date checkTime; + + /** + * 调试日期 + */ + @TableField(value = "debug_time") + private Date debugTime; + + /** + * 合同号 + */ + @TableField(value = "cntract_no") + private String cntractNo; + + /** + * 营销经理 + */ + @TableField(value = "sales_manager") + private String salesManager; + + /** + * 状态(0:删除 1:正常) + */ + @TableField(value = "status") + private Integer status; + + +} \ No newline at end of file diff --git a/pqs-algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/controller/Equipment/EquipmentDeliveryController.java b/pqs-algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/controller/Equipment/EquipmentDeliveryController.java new file mode 100644 index 000000000..6ded751f2 --- /dev/null +++ b/pqs-algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/controller/Equipment/EquipmentDeliveryController.java @@ -0,0 +1,60 @@ +package com.njcn.algorithm.controller.Equipment; + +import com.njcn.algorithm.pojo.param.CsEquipmentDeliveryAddParm; +import com.njcn.algorithm.service.CsEquipmentDeliveryService; +import com.njcn.common.pojo.annotation.OperateInfo; +import com.njcn.common.pojo.enums.common.LogEnum; +import com.njcn.common.pojo.enums.response.CommonResponseEnum; +import com.njcn.common.pojo.response.HttpResult; +import com.njcn.common.utils.HttpResultUtil; +import com.njcn.web.controller.BaseController; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +/** + * Description: + * 接口文档访问地址:http://serverIP:port/swagger-ui.html + * Date: 2023/3/27 15:31【需求编号】 + * + * @author clam + * @version V1.0.0 + */ +@Slf4j +@RestController +@RequestMapping("/EquipmentDelivery") +@Api(tags = " 出厂设备") +@AllArgsConstructor +public class EquipmentDeliveryController extends BaseController { + + private final CsEquipmentDeliveryService csEquipmentDeliveryService; + + @OperateInfo(info = LogEnum.BUSINESS_COMMON) + @PostMapping("/addEquipmentDelivery") + @ApiOperation("新增出厂设备") + @ApiImplicitParam(name = "csEquipmentDeliveryAddParm", value = "新增项目参数", required = true) + public HttpResult addEquipmentDelivery(@RequestBody @Validated CsEquipmentDeliveryAddParm csEquipmentDeliveryAddParm){ + String methodDescribe = getMethodDescribe("addEquipmentDelivery"); + + Boolean flag = csEquipmentDeliveryService.save (csEquipmentDeliveryAddParm); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe); + } + + + @OperateInfo(info = LogEnum.BUSINESS_COMMON) + @PostMapping("/AuditEquipmentDelivery") + @ApiOperation("删除出厂设备") + public HttpResult AuditEquipmentDelivery(@RequestParam("id")String id ){ + String methodDescribe = getMethodDescribe("AuditEquipmentDelivery"); + + Boolean flag = csEquipmentDeliveryService.AuditEquipmentDelivery(id); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe); + } + + + +} diff --git a/pqs-algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/controller/project/LineTopologyDiagramController.java b/pqs-algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/controller/project/LineTopologyDiagramController.java index a812f5958..27e2d4269 100644 --- a/pqs-algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/controller/project/LineTopologyDiagramController.java +++ b/pqs-algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/controller/project/LineTopologyDiagramController.java @@ -1,9 +1,24 @@ package com.njcn.algorithm.controller.project; +import com.njcn.algorithm.pojo.param.AppLineTopologyDiagramAddParm; +import com.njcn.algorithm.pojo.param.AppLineTopologyDiagramAuditParm; +import com.njcn.algorithm.pojo.po.AppLineTopologyDiagramPO; +import com.njcn.algorithm.service.AppLineTopologyDiagramService; +import com.njcn.common.pojo.annotation.OperateInfo; +import com.njcn.common.pojo.enums.common.LogEnum; +import com.njcn.common.pojo.enums.response.CommonResponseEnum; +import com.njcn.common.pojo.response.HttpResult; +import com.njcn.common.utils.HttpResultUtil; import com.njcn.web.controller.BaseController; import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.BeanUtils; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -22,5 +37,31 @@ import org.springframework.web.bind.annotation.RestController; @AllArgsConstructor public class LineTopologyDiagramController extends BaseController { + private AppLineTopologyDiagramService appLineTopologyDiagramService; + + @OperateInfo(info = LogEnum.BUSINESS_COMMON) + @PostMapping("/addLineDiagram") + @ApiOperation("新增拓扑图-监测点绑定") + @ApiImplicitParam(name = "appLineTopologyDiagramAddParm", value = "新增拓扑图参数", required = true) + public HttpResult addLineDiagram(@RequestBody @Validated AppLineTopologyDiagramAddParm appLineTopologyDiagramAddParm){ + String methodDescribe = getMethodDescribe("addLineDiagram"); + AppLineTopologyDiagramPO appLineTopologyDiagramPO = new AppLineTopologyDiagramPO(); + BeanUtils.copyProperties (appLineTopologyDiagramAddParm,appLineTopologyDiagramPO); + appLineTopologyDiagramPO.setStatus ("1"); + Boolean flag = appLineTopologyDiagramService.save (appLineTopologyDiagramPO); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe); + } + + @OperateInfo(info = LogEnum.BUSINESS_COMMON) + @PostMapping("/auditLineDiagram") + @ApiOperation("修改/删除拓扑图-监测点绑定") + @ApiImplicitParam(name = "appLineTopologyDiagramAuditParm", value = "修改/删除拓扑图参数", required = true) + public HttpResult auditLineDiagram(@RequestBody@Validated AppLineTopologyDiagramAuditParm appLineTopologyDiagramAuditParm){ + String methodDescribe = getMethodDescribe("auditLineDiagram"); + AppLineTopologyDiagramPO appLineTopologyDiagramPO = new AppLineTopologyDiagramPO(); + BeanUtils.copyProperties (appLineTopologyDiagramAuditParm,appLineTopologyDiagramPO); + Boolean flag = appLineTopologyDiagramService.update (appLineTopologyDiagramPO,null); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe); + } } diff --git a/pqs-algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/mapper/CsEquipmentDeliveryMapper.java b/pqs-algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/mapper/CsEquipmentDeliveryMapper.java new file mode 100644 index 000000000..427de4676 --- /dev/null +++ b/pqs-algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/mapper/CsEquipmentDeliveryMapper.java @@ -0,0 +1,16 @@ +package com.njcn.algorithm.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.njcn.algorithm.pojo.po.CsEquipmentDeliveryPO; + +/** + * + * Description: + * 接口文档访问地址:http://serverIP:port/swagger-ui.html + * Date: 2023/3/30 16:23【需求编号】 + * + * @author clam + * @version V1.0.0 + */ +public interface CsEquipmentDeliveryMapper extends BaseMapper { +} \ No newline at end of file diff --git a/pqs-algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/mapper/mapping/CsEquipmentDeliveryMapper.xml b/pqs-algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/mapper/mapping/CsEquipmentDeliveryMapper.xml new file mode 100644 index 000000000..803ea227d --- /dev/null +++ b/pqs-algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/mapper/mapping/CsEquipmentDeliveryMapper.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id, `name`, ndid, mac, dev_use, dev_type, dev_model, program_version, debug_person, + producte_time, check_time, debug_time, cntract_no, sales_manager, `status`, create_by, + create_time, update_by, update_time + + \ No newline at end of file diff --git a/pqs-algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/service/CsEquipmentDeliveryService.java b/pqs-algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/service/CsEquipmentDeliveryService.java new file mode 100644 index 000000000..0b9734ea9 --- /dev/null +++ b/pqs-algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/service/CsEquipmentDeliveryService.java @@ -0,0 +1,33 @@ +package com.njcn.algorithm.service; + +import com.njcn.algorithm.pojo.param.CsEquipmentDeliveryAddParm; +import com.njcn.algorithm.pojo.po.CsEquipmentDeliveryPO; +import com.baomidou.mybatisplus.extension.service.IService; + /** + * + * Description: + * 接口文档访问地址:http://serverIP:port/swagger-ui.html + * Date: 2023/3/30 16:23【需求编号】 + * + * @author clam + * @version V1.0.0 + */ +public interface CsEquipmentDeliveryService extends IService{ + + /** + * @Description: save + * @Param: [csEquipmentDeliveryAddParm] + * @return: java.lang.Boolean + * @Author: clam + * @Date: 2023/3/31 + */ + Boolean save(CsEquipmentDeliveryAddParm csEquipmentDeliveryAddParm); + /** + * @Description: AuditEquipmentDelivery + * @Param: [id] + * @return: java.lang.Boolean + * @Author: clam + * @Date: 2023/3/31 + */ + Boolean AuditEquipmentDelivery(String id); + } diff --git a/pqs-algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/service/impl/CsEquipmentDeliveryServiceImpl.java b/pqs-algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/service/impl/CsEquipmentDeliveryServiceImpl.java new file mode 100644 index 000000000..73a155fad --- /dev/null +++ b/pqs-algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/service/impl/CsEquipmentDeliveryServiceImpl.java @@ -0,0 +1,41 @@ +package com.njcn.algorithm.service.impl; + +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.njcn.algorithm.mapper.CsEquipmentDeliveryMapper; +import com.njcn.algorithm.pojo.param.CsEquipmentDeliveryAddParm; +import com.njcn.algorithm.pojo.po.CsEquipmentDeliveryPO; +import com.njcn.algorithm.service.CsEquipmentDeliveryService; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Service; +/** + * + * Description: + * 接口文档访问地址:http://serverIP:port/swagger-ui.html + * Date: 2023/3/30 16:23【需求编号】 + * + * @author clam + * @version V1.0.0 + */ +@Service +public class CsEquipmentDeliveryServiceImpl extends ServiceImpl implements CsEquipmentDeliveryService{ + + @Override + public Boolean save(CsEquipmentDeliveryAddParm csEquipmentDeliveryAddParm) { + CsEquipmentDeliveryPO csEquipmentDeliveryPO = new CsEquipmentDeliveryPO(); + + BeanUtils.copyProperties (csEquipmentDeliveryAddParm,csEquipmentDeliveryPO); + csEquipmentDeliveryPO.setStatus (1); + boolean save = this.save (csEquipmentDeliveryPO); + return save; + } + + @Override + public Boolean AuditEquipmentDelivery(String id) { + UpdateWrapper wrapper = new UpdateWrapper(); + wrapper.eq ("id", id); + wrapper.set ("status", "1"); + boolean update = this.update (wrapper); + return update; + } +} diff --git a/pqs-common/common-swagger/src/main/java/com/njcn/swagger/config/Knife4jSwaggerConfig.java b/pqs-common/common-swagger/src/main/java/com/njcn/swagger/config/Knife4jSwaggerConfig.java index 74382c846..3b01c66e6 100644 --- a/pqs-common/common-swagger/src/main/java/com/njcn/swagger/config/Knife4jSwaggerConfig.java +++ b/pqs-common/common-swagger/src/main/java/com/njcn/swagger/config/Knife4jSwaggerConfig.java @@ -64,7 +64,8 @@ public class Knife4jSwaggerConfig { "com.njcn.energy.controller", "com.njcn.quality.controller", "com.njcn.process.controller", - "com.njcn.advance.controller" + "com.njcn.advance.controller", + "com.njcn.algorithm.controller" ) .collect(Collectors.toList()); List grantTypes = new ArrayList<>(); diff --git a/pqs-common/common-web/src/main/java/com/njcn/web/utils/ComAssesUtil.java b/pqs-common/common-web/src/main/java/com/njcn/web/utils/ComAssesUtil.java index 7050190b8..e3ae32e17 100644 --- a/pqs-common/common-web/src/main/java/com/njcn/web/utils/ComAssesUtil.java +++ b/pqs-common/common-web/src/main/java/com/njcn/web/utils/ComAssesUtil.java @@ -87,7 +87,7 @@ public class ComAssesUtil { if (getBysxf()) { //G和F得出综合权重A if (getZhqzf()) { - //A[0] = 0.28;A[1] = 0.23;A[2] = 0.13;A[3] = 0.16;A[4] = 0.08;A[5] = 0.12; + A[0] = 0.28f;A[1] = 0.23f;A[2] = 0.13f;A[3] = 0.16f;A[4] = 0.08f;A[5] = 0.12f; for (i = 0; i < GRADE_NUM; i++) { B[i] = 0; for (j = 0; j < ST_QT_NUM; j++) { diff --git a/pqs-device/pq-device/pq-device-api/pom.xml b/pqs-device/pq-device/pq-device-api/pom.xml index 298cb18f3..71287e8cc 100644 --- a/pqs-device/pq-device/pq-device-api/pom.xml +++ b/pqs-device/pq-device/pq-device-api/pom.xml @@ -22,5 +22,9 @@ common-device-biz ${project.version} + + com.github.jeffreyning + mybatisplus-plus + diff --git a/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/param/LargeScreenParam.java b/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/param/LargeScreenParam.java index deb3f5060..3f64cf1ff 100644 --- a/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/param/LargeScreenParam.java +++ b/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/param/LargeScreenParam.java @@ -1,21 +1,13 @@ package com.njcn.device.pq.pojo.param; import com.njcn.common.pojo.constant.PatternRegex; -import com.njcn.common.pojo.dto.SimpleDTO; -import com.njcn.device.biz.enums.LineFlagEnum; -import com.njcn.web.constant.ValidMessage; -import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; -import org.hibernate.validator.constraints.Range; - import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; + import javax.validation.constraints.Pattern; import java.io.Serializable; -import java.util.List; + /** * @version 1.0.0 @@ -37,4 +29,4 @@ public class LargeScreenParam implements Serializable { @Pattern(regexp = PatternRegex.TIME_FORMAT, message = "时间格式错误") private String searchEndTime; -} +} \ No newline at end of file diff --git a/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/po/RStatIntegrityD.java b/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/po/RStatIntegrityD.java index 4923aa97e..ab1d25648 100644 --- a/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/po/RStatIntegrityD.java +++ b/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/po/RStatIntegrityD.java @@ -1,6 +1,7 @@ package com.njcn.device.pq.pojo.po; import com.baomidou.mybatisplus.annotation.TableName; +import com.github.jeffreyning.mybatisplus.anno.MppMultiId; import com.njcn.db.bo.BaseEntity; import java.io.Serializable; import java.time.LocalDateTime; @@ -23,8 +24,10 @@ public class RStatIntegrityD { private static final long serialVersionUID = 1L; + @MppMultiId private LocalDateTime timeId; + @MppMultiId private String lineIndex; private Integer dueTime; diff --git a/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/po/RStatOnlinerateD.java b/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/po/RStatOnlinerateD.java index 639934583..6380f4d05 100644 --- a/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/po/RStatOnlinerateD.java +++ b/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/po/RStatOnlinerateD.java @@ -1,6 +1,7 @@ package com.njcn.device.pq.pojo.po; import com.baomidou.mybatisplus.annotation.TableName; +import com.github.jeffreyning.mybatisplus.anno.MppMultiId; import com.njcn.db.bo.BaseEntity; import java.io.Serializable; import java.time.LocalDateTime; @@ -21,9 +22,9 @@ import lombok.Setter; public class RStatOnlinerateD extends BaseEntity { private static final long serialVersionUID = 1L; - + @MppMultiId private LocalDateTime timeId; - + @MppMultiId private String devIndex; private Integer onlineMin; diff --git a/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/vo/AreaDownVO.java b/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/vo/AreaDownVO.java new file mode 100644 index 000000000..4cfa6ddee --- /dev/null +++ b/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/vo/AreaDownVO.java @@ -0,0 +1,25 @@ +package com.njcn.device.pq.pojo.vo; + +import com.njcn.device.pq.pojo.param.MonitoringPointScaleParam; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @version 1.0.0 + * @author: zbj + * @date: 2023/03/31 + */ +@Data +public class AreaDownVO implements Serializable { + + private static final long serialVersionUID = 1L; + /** + * 部门信息 + */ + @ApiModelProperty("部门信息") + private List param; + +} diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/controller/LargeScreenController.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/controller/LargeScreenController.java index 69bf53884..ab9de1877 100644 --- a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/controller/LargeScreenController.java +++ b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/controller/LargeScreenController.java @@ -53,10 +53,10 @@ public class LargeScreenController extends BaseController { @OperateInfo(info = LogEnum.BUSINESS_COMMON) @PostMapping("/getLoadType") @ApiOperation("监测点规模(负荷类型)") - @ApiImplicitParam(name = "getLoadType", value = "监测点规模(负荷类型)", required = true) + @ApiImplicitParam(name = "largeScreenParam", value = "监测点规模(负荷类型)", required = true) public HttpResult getLoadType(@RequestBody @Validated LargeScreenParam largeScreenParam) { String methodDescribe = getMethodDescribe("getLoadType"); MonitoringPointScaleVO result = largeScreenService.getLoadType(largeScreenParam); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe); } -} \ No newline at end of file +} diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/controller/TerminalBaseController.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/controller/TerminalBaseController.java index 3e1ffebe0..fb99708cd 100644 --- a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/controller/TerminalBaseController.java +++ b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/controller/TerminalBaseController.java @@ -3,6 +3,7 @@ package com.njcn.device.pq.controller; import cn.afterturn.easypoi.excel.ExcelExportUtil; import cn.afterturn.easypoi.excel.entity.ExportParams; import cn.hutool.core.collection.CollectionUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.njcn.common.pojo.annotation.OperateInfo; import com.njcn.common.pojo.constant.OperateType; import com.njcn.common.pojo.enums.common.LogEnum; @@ -12,14 +13,23 @@ import com.njcn.common.pojo.response.HttpResult; import com.njcn.common.utils.HttpResultUtil; import com.njcn.common.utils.LogUtil; import com.njcn.device.pq.enums.DeviceResponseEnum; +import com.njcn.device.pq.mapper.LineDetailMapper; +import com.njcn.device.pq.mapper.LineMapper; +import com.njcn.device.pq.mapper.OverlimitMapper; +import com.njcn.device.pq.mapper.VoltageMapper; import com.njcn.device.pq.pojo.bo.DeviceType; import com.njcn.device.pq.pojo.bo.excel.TerminalBaseExcel; import com.njcn.device.pq.pojo.param.*; import com.njcn.device.pq.pojo.po.Line; +import com.njcn.device.pq.pojo.po.LineDetail; +import com.njcn.device.pq.pojo.po.Overlimit; +import com.njcn.device.pq.pojo.po.Voltage; import com.njcn.device.pq.pojo.vo.TerminalBaseVO; import com.njcn.device.pq.pojo.vo.TerminalVO; import com.njcn.device.pq.service.TerminalBaseService; import com.njcn.poi.util.PoiUtil; +import com.njcn.system.api.DicDataFeignClient; +import com.njcn.system.pojo.po.DictData; import com.njcn.web.controller.BaseController; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -31,6 +41,7 @@ import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import springfox.documentation.annotations.ApiIgnore; +import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; import java.util.ArrayList; @@ -54,6 +65,22 @@ public class TerminalBaseController extends BaseController { private final TerminalBaseService terminalBaseService; + + private final LineDetailMapper lineDetailMapper; + + + private final OverlimitMapper overlimitMapper; + + + private final DicDataFeignClient dicDataFeignClient; + + + private final LineMapper lineMapper; + + + private final VoltageMapper voltageMapper; + + /** * 终端新增操作 * @@ -272,4 +299,37 @@ public class TerminalBaseController extends BaseController { } + + /** + * 重新计算限值 + * + * @author cdf + * @date 2022/5/17 + */ + @ApiOperation("监测点-重新计算限值") + @GetMapping(value = "updatePqOverLimit") + public HttpResult updatePqOverLimit() { + String methodDescribe = getMethodDescribe("updatePqOverLimit"); + + List lineDetailList = lineDetailMapper.selectList(new LambdaQueryWrapper<>()); + + int count = 0; + for(LineDetail lineDetail:lineDetailList){ + overlimitMapper.deleteById(lineDetail.getId()); + Line line = lineMapper.selectById(lineDetail.getId()); + if(Objects.nonNull(line)) { + Voltage voltage = voltageMapper.selectById(line.getPid()); + //监测点限值 + HttpResult scaleResult = dicDataFeignClient.getDicDataById(voltage.getScale()); + if (Objects.isNull(scaleResult.getData())) { + throw new BusinessException(CommonResponseEnum.DIC_DATA); + } + Overlimit overlimit = new Overlimit(line.getId(), scaleResult.getData().getName(), lineDetail.getShortCapacity(), lineDetail.getStandardCapacity(), lineDetail.getDealCapacity(), lineDetail.getDevCapacity()); + overlimitMapper.insert(overlimit); + count++; + } + } + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, count, methodDescribe); + } + } diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/LogManageServiceImpl.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/LogManageServiceImpl.java index 5c3d8cb0a..3e0298973 100644 --- a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/LogManageServiceImpl.java +++ b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/LogManageServiceImpl.java @@ -105,7 +105,7 @@ public class LogManageServiceImpl implements LogManageService { if (!CollectionUtils.isEmpty(eventDetailData)) { for (EventPushLogs pushLogs: eventPushLogs) { for (EventDetail eventDetail: eventDetailData) { - if (pushLogs.getLineId().equals(eventDetail.getLineId()) && pushLogs.getTimeId().equals(eventDetail.getTimeId())) { + if (pushLogs.getLineId().equals(eventDetail.getLineId()) && pushLogs.getTimeId().equals(eventDetail.getStartTime())) { EventLogVO event = logManageMapper.getEventLogData(pushLogs.getLineId()); if (Objects.isNull(event)) { continue; @@ -119,11 +119,11 @@ public class LogManageServiceImpl implements LogManageService { eventLogVO.setLine(event.getLine()); eventLogVO.setSubstation(event.getSubstation()); eventLogVO.setPowerCompany(event.getPowerCompany()); - Double e = eventDetail.getEventValue(); + Double e = eventDetail.getFeatureAmplitude(); BigDecimal bd = new BigDecimal(e); e= bd.setScale(2, BigDecimal.ROUND_DOWN).doubleValue(); eventLogVO.setEventValue(String.valueOf(e*100)); - double i = eventDetail.getPersistTime() / 1000; + double i = eventDetail.getDuration() / 1000; eventLogVO.setPersistTime(String.valueOf(i)); eventLogVO.setCreatTime(pushLogs.getCreateTime()); eventLogVO.setCreatTimed(pushLogs.getCreateTime()); diff --git a/pqs-event/event-api/src/main/java/com/njcn/event/pojo/param/TransientParam.java b/pqs-event/event-api/src/main/java/com/njcn/event/pojo/param/TransientParam.java index 9870dc488..c14c3cd60 100644 --- a/pqs-event/event-api/src/main/java/com/njcn/event/pojo/param/TransientParam.java +++ b/pqs-event/event-api/src/main/java/com/njcn/event/pojo/param/TransientParam.java @@ -45,7 +45,7 @@ public class TransientParam extends DeviceInfoParam.BusinessParam { private BigDecimal severityMin; @ApiModelProperty("触发类型") - private List waveType; + private List waveType; @ApiModelProperty("暂降原因") private List eventReason; diff --git a/pqs-event/event-api/src/main/java/com/njcn/event/pojo/po/EventDetail.java b/pqs-event/event-api/src/main/java/com/njcn/event/pojo/po/EventDetail.java index 8bfb9fe2a..d55e2db07 100644 --- a/pqs-event/event-api/src/main/java/com/njcn/event/pojo/po/EventDetail.java +++ b/pqs-event/event-api/src/main/java/com/njcn/event/pojo/po/EventDetail.java @@ -1,14 +1,17 @@ package com.njcn.event.pojo.po; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.datatype.jsr310.ser.InstantSerializer; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; import org.influxdb.annotation.Column; import org.influxdb.annotation.Measurement; import java.math.BigDecimal; import java.time.Instant; +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.util.concurrent.TimeUnit; /** * @author denghuajun @@ -20,81 +23,90 @@ import java.time.Instant; @Measurement(name = "pqs_eventdetail") public class EventDetail { - @Column(name = "line_id") - private String lineId; + @Column(name = "line_id") + private String lineId; - @Column(name = "time") - @JsonSerialize(using = InstantSerializer.class) - private Instant timeId; + @Column(name = "time") + @ApiModelProperty(value = "开始时间") + @JsonSerialize(using = InstantSerializer.class) + private Instant startTime; - @Column(name = "event_describe") - private String eventDescribe; + @Column(name = "event_describe") + @ApiModelProperty(value = "事件描述") + private String eventDescribe; - @Column(name = "wave_type") - private Integer waveType; + @Column(name = "wave_type") + @ApiModelProperty(value = "统计类型") + private String eventType; - @Column(name = "persist_time") - private Double persistTime; + @Column(name = "persist_time") + @ApiModelProperty(value = "持续时间,单位秒") + private Double duration; - @Column(name = "event_value") - private Double eventValue; + @Column(name = "event_value") + @ApiModelProperty(value = "特征幅值") + private Double featureAmplitude; - @Column(name = "event_reason") - private String eventReason; + @Column(name = "event_reason") + @ApiModelProperty(value = "暂降原因(Event_Reason)") + private String advanceReason; - @Column(name = "event_type") - private String eventType; + @Column(name = "event_type") + @ApiModelProperty(value = "暂降类型(Event_Type)") + private String advanceType; - @Column(name = "eventass_index") - private String eventassIndex; + @Column(name = "eventass_index") + private String eventassIndex; - @Column(name = "dq_time") - private Integer dqTime; + @Column(name = "dq_time") + private Integer dqTime; - @Column(name = "deal_time") - private String dealTime; + @Column(name = "deal_time") + private String dealTime; - @Column(name = "deal_flag") - private Integer dealFlag; + @Column(name = "deal_flag") + private Integer dealFlag; - @Column(name = "num") - private Integer num; + @Column(name = "num") + private Integer num; - @Column(name = "file_flag") - private Integer fileFlag; + @Column(name = "file_flag") + private Integer fileFlag; - @Column(name = "first_time") - private String firstTime; + @Column(name = "first_time") + private String firstTime; - @Column(name = "first_type") - private String firstType; + @Column(name = "first_type") + private String firstType; - @Column(name = "first_ms") - private Integer firstMs; + @Column(name = "first_ms") + private Integer firstMs; - @Column(name = "wave_name") - private String waveName; + @Column(name = "wave_name") + @ApiModelProperty(value = "波形路径") + private String wavePath; - @Column(name = "energy") - private Double energy; + @Column(name = "energy") + private Double energy; - @Column(name = "severity") - private Double severity; + @Column(name = "severity") + private Double severity; - @Column(name = "sagsource") - private String sagSource; + @Column(name = "sagsource") + private String sagSource; - @Column(name = "create_time") - private String createTime; + @Column(name = "create_time") + private String createTime; - private String lineName; + private String lineName; - private BigDecimal lat; + private BigDecimal lat; - private BigDecimal lng; + private BigDecimal lng; - private String gdName; + private String gdName; + + private String subName; - private String subName; } diff --git a/pqs-event/event-api/src/main/java/com/njcn/event/pojo/po/EventDetailNew.java b/pqs-event/event-api/src/main/java/com/njcn/event/pojo/po/EventDetailNew.java index 3c20a7693..bc2e48afd 100644 --- a/pqs-event/event-api/src/main/java/com/njcn/event/pojo/po/EventDetailNew.java +++ b/pqs-event/event-api/src/main/java/com/njcn/event/pojo/po/EventDetailNew.java @@ -1,8 +1,8 @@ package com.njcn.event.pojo.po; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; import org.influxdb.annotation.Column; -import org.influxdb.annotation.Measurement; import java.math.BigDecimal; @@ -13,87 +13,98 @@ import java.math.BigDecimal; */ @Data -@Measurement(name = "pqs_eventdetail") +//@Measurement(name = "pqs_eventdetail") public class EventDetailNew { - @Column(name = "line_id") - private String lineId; + @Column(name = "line_id") + private String lineId; - @Column(name = "time") - private String timeId; + @Column(name = "time") + @ApiModelProperty(value = "开始时间") + private String startTime; - @Column(name = "event_describe") - private String eventDescribe; + @Column(name = "event_describe") + @ApiModelProperty(value = "事件描述") + private String eventDescribe; - @Column(name = "wave_type") - private String waveType; + @Column(name = "wave_type") + @ApiModelProperty(value = "统计类型") + private String eventType; - @Column(name = "persist_time") - private Double persistTime; + @Column(name = "persist_time") + @ApiModelProperty(value = "持续时间,单位秒") + private Double duration; - @Column(name = "event_value") - private Double eventValue; + @Column(name = "event_value") + @ApiModelProperty(value = "特征幅值") + private Double featureAmplitude; - @Column(name = "event_reason") - private String eventReason; + @Column(name = "event_reason") + @ApiModelProperty(value = "暂降原因(Event_Reason)") + private String advanceReason; - @Column(name = "event_type") - private String eventType; + @Column(name = "event_type") + @ApiModelProperty(value = "暂降类型(Event_Type)") + private String advanceType; - @Column(name = "eventass_index") - private String eventassIndex; + @Column(name = "eventass_index") + private String eventassIndex; - @Column(name = "dq_time") - private Integer dqTime; + @Column(name = "dq_time") + private Integer dqTime; - @Column(name = "deal_time") - private String dealTime; + @Column(name = "deal_time") + private String dealTime; - @Column(name = "deal_flag") - private Integer dealFlag; + @Column(name = "deal_flag") + private Integer dealFlag; - @Column(name = "num") - private Integer num; + @Column(name = "num") + private Integer num; - @Column(name = "file_flag") - private Integer fileFlag; + @Column(name = "file_flag") + private Integer fileFlag; - @Column(name = "first_time") - private String firstTime; + @Column(name = "first_time") + private String firstTime; - @Column(name = "first_type") - private String firstType; + @Column(name = "first_type") + private String firstType; - @Column(name = "first_ms") - private Integer firstMs; + @Column(name = "first_ms") + private Integer firstMs; - @Column(name = "wave_name") - private String waveName; + @Column(name = "wave_name") + @ApiModelProperty(value = "波形路径") + private String wavePath; - @Column(name = "energy") - private Double energy; + @Column(name = "energy") + private Double energy; - @Column(name = "severity") - private Double severity; + @Column(name = "severity") + private Double severity; - @Column(name = "sagsource") - private String sagSource; + @Column(name = "sagsource") + private String sagSource; - @Column(name = "create_time") - private String createTime; + @Column(name = "create_time") + private String createTime; - private String lineName; + private String lineName; - private BigDecimal lat; + private BigDecimal lat; - private BigDecimal lng; + private BigDecimal lng; - private String gdName; + private String gdName; - private String subName; + private String subName; - private String ip; + private String ip; - private String scale; + private String scale; + + @ApiModelProperty(value = "暂时事件ID") + private String eventId; } diff --git a/pqs-event/event-api/src/main/java/com/njcn/event/pojo/po/RmpEventDetailPO.java b/pqs-event/event-api/src/main/java/com/njcn/event/pojo/po/RmpEventDetailPO.java index 75d7e330f..859a3bb86 100644 --- a/pqs-event/event-api/src/main/java/com/njcn/event/pojo/po/RmpEventDetailPO.java +++ b/pqs-event/event-api/src/main/java/com/njcn/event/pojo/po/RmpEventDetailPO.java @@ -1,6 +1,5 @@ package com.njcn.event.pojo.po; -import cn.hutool.core.date.DateTime; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; @@ -10,15 +9,12 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.EqualsAndHashCode; -import org.influxdb.annotation.Column; import java.io.Serializable; -import java.math.BigDecimal; import java.time.LocalDateTime; -import java.util.Date; /** - * (RMpEventDetail)实体类 + * (influxdb 转 mysql 专用)实体类 * * @author yzh * @since 2022-10-12 18:34:55 @@ -37,12 +33,20 @@ public class RmpEventDetailPO implements Serializable { @ApiModelProperty(value = "监测点ID") private String measurementPointId; - @ApiModelProperty(value = "事件类型") + @ApiModelProperty(value = "监测点ID(复制)") + @TableField("measurement_point_id") + private String lineId; + + @ApiModelProperty(value = "统计类型") private String eventType; - @ApiModelProperty(value = "暂降原因(字典表PQS_Dicdata)") - @TableField("Event_Reason") - private String eventReason; + @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; @@ -82,7 +86,8 @@ public class RmpEventDetailPO implements Serializable { @ApiModelProperty(value = "开始时间") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS",timezone = "GMT+8") - private Date startTime; + private String startTime; + @ApiModelProperty(value = "持续时间,单位秒") private Double duration; @@ -99,14 +104,10 @@ public class RmpEventDetailPO implements Serializable { @ApiModelProperty(value = "波形路径") private String wavePath; - @ApiModelProperty(value = "波形名称") - @TableField("wave_path") - private String waveName; - - private String phasicType; - private Double transientValue; + private String createTime; + } diff --git a/pqs-event/event-api/src/main/java/com/njcn/event/pojo/vo/WaveTypeVO.java b/pqs-event/event-api/src/main/java/com/njcn/event/pojo/vo/WaveTypeVO.java index c304eaa4a..76b1cc49c 100644 --- a/pqs-event/event-api/src/main/java/com/njcn/event/pojo/vo/WaveTypeVO.java +++ b/pqs-event/event-api/src/main/java/com/njcn/event/pojo/vo/WaveTypeVO.java @@ -130,7 +130,7 @@ public class WaveTypeVO{ private String eventDescribe; @Column(name = "wave_type") - private Integer waveType; + private String waveType; @Column(name = "persist_time") private Double persistTime; diff --git a/pqs-event/event-boot/src/main/java/com/njcn/event/controller/majornetwork/AreaStatisticalController.java b/pqs-event/event-boot/src/main/java/com/njcn/event/controller/majornetwork/AreaStatisticalController.java index a61ec9763..09151b0e5 100644 --- a/pqs-event/event-boot/src/main/java/com/njcn/event/controller/majornetwork/AreaStatisticalController.java +++ b/pqs-event/event-boot/src/main/java/com/njcn/event/controller/majornetwork/AreaStatisticalController.java @@ -21,7 +21,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; /** - * 区域统计 + * 区域概览 * * @author : zhaojun * @version : 1.0.0 @@ -30,7 +30,7 @@ import org.springframework.web.bind.annotation.RestController; @Slf4j @RestController @RequestMapping("/areaStatistics") -@Api(tags = "区域统计") +@Api(tags = "区域概览") @AllArgsConstructor public class AreaStatisticalController extends BaseController { diff --git a/pqs-event/event-boot/src/main/java/com/njcn/event/controller/majornetwork/LargeScreenController.java b/pqs-event/event-boot/src/main/java/com/njcn/event/controller/majornetwork/LargeScreenController.java new file mode 100644 index 000000000..f87c3f92f --- /dev/null +++ b/pqs-event/event-boot/src/main/java/com/njcn/event/controller/majornetwork/LargeScreenController.java @@ -0,0 +1,51 @@ +package com.njcn.event.controller.majornetwork; + +import com.njcn.common.pojo.annotation.OperateInfo; +import com.njcn.common.pojo.enums.common.LogEnum; +import com.njcn.common.pojo.enums.response.CommonResponseEnum; +import com.njcn.common.pojo.response.HttpResult; +import com.njcn.common.utils.HttpResultUtil; +import com.njcn.device.pq.pojo.param.LargeScreenParam; +import com.njcn.device.pq.pojo.vo.AreaDownVO; +import com.njcn.device.pq.pojo.vo.MonitoringPointScaleVO; + +import com.njcn.event.service.majornetwork.LargeScreenService; +import com.njcn.web.controller.BaseController; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * @version 1.0.0 + * @author: zbj + * @date: 2023/03/31 + */ +@Slf4j +@Api(tags = "大屏") +@RestController +@RequestMapping("/largeScreen") +@RequiredArgsConstructor +public class LargeScreenController extends BaseController { + + private final LargeScreenService largeScreenService; + + /** + * 监测点规模 + */ + @OperateInfo(info = LogEnum.BUSINESS_COMMON) + @PostMapping("/getAreaDownStatistics") + @ApiOperation("区域暂降统计") + @ApiImplicitParam(name = "largeScreenParam", value = "区域暂降统计", required = true) + public HttpResult getAreaDownStatistics(@RequestBody @Validated LargeScreenParam largeScreenParam) { + String methodDescribe = getMethodDescribe("getAreaDownStatistics"); + AreaDownVO result = largeScreenService.getAreaDownStatistics(largeScreenParam); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe); + } +} diff --git a/pqs-event/event-boot/src/main/java/com/njcn/event/influxdb/PqsEventDetailQuery.java b/pqs-event/event-boot/src/main/java/com/njcn/event/influxdb/PqsEventDetailQuery.java index d3884b9f3..0993e2f55 100644 --- a/pqs-event/event-boot/src/main/java/com/njcn/event/influxdb/PqsEventDetailQuery.java +++ b/pqs-event/event-boot/src/main/java/com/njcn/event/influxdb/PqsEventDetailQuery.java @@ -156,7 +156,7 @@ public class PqsEventDetailQuery extends QueryBuilder { */ public static BiFunction> getBetweenTimeEventDetailList(List eventDetailList) { return (beginTime, endTime) -> eventDetailList.stream().filter(eventDetail -> { - Instant timeId = eventDetail.getTimeId(); + Instant timeId = eventDetail.getStartTime(); return timeId.isAfter(beginTime.toInstant()) && timeId.isBefore(endTime.toInstant()); }).collect(Collectors.toList()); } diff --git a/pqs-event/event-boot/src/main/java/com/njcn/event/mapper/majornetwork/LargeScreenMapper.java b/pqs-event/event-boot/src/main/java/com/njcn/event/mapper/majornetwork/LargeScreenMapper.java new file mode 100644 index 000000000..c8cbca97c --- /dev/null +++ b/pqs-event/event-boot/src/main/java/com/njcn/event/mapper/majornetwork/LargeScreenMapper.java @@ -0,0 +1,16 @@ +package com.njcn.event.mapper.majornetwork; + +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; + +/** + * @version 1.0.0 + * @author: zbj + * @date: 2023/03/31 + */ +public interface LargeScreenMapper { + + Map selectDownCount(@Param("lineIds") List lineIds, @Param("startTime") String startTime, @Param("endTime") String endTime); +} diff --git a/pqs-event/event-boot/src/main/java/com/njcn/event/mapper/majornetwork/mapping/LargeScreenMapper.xml b/pqs-event/event-boot/src/main/java/com/njcn/event/mapper/majornetwork/mapping/LargeScreenMapper.xml new file mode 100644 index 000000000..75dd78923 --- /dev/null +++ b/pqs-event/event-boot/src/main/java/com/njcn/event/mapper/majornetwork/mapping/LargeScreenMapper.xml @@ -0,0 +1,22 @@ + + + + + + diff --git a/pqs-event/event-boot/src/main/java/com/njcn/event/service/distribution/Impl/PwEventCategoryDetailsServiceImpl.java b/pqs-event/event-boot/src/main/java/com/njcn/event/service/distribution/Impl/PwEventCategoryDetailsServiceImpl.java index dd1be07f7..f31b7955c 100644 --- a/pqs-event/event-boot/src/main/java/com/njcn/event/service/distribution/Impl/PwEventCategoryDetailsServiceImpl.java +++ b/pqs-event/event-boot/src/main/java/com/njcn/event/service/distribution/Impl/PwEventCategoryDetailsServiceImpl.java @@ -341,10 +341,11 @@ public class PwEventCategoryDetailsServiceImpl implements PwEventCategoryDetails eventFeatureAmplitudeCurve.setFeatureAmplitude(dto.getFeatureAmplitude()); eventFeatureAmplitudeCurve.setDuration(dto.getDuration()); - Instant instant = dto.getStartTime().toInstant(); - ZoneId zoneId = ZoneId.systemDefault(); - - eventFeatureAmplitudeCurve.setStartTime(LocalDateTime.ofInstant(instant, zoneId)); +// Instant instant = dto.getStartTime().toInstant(); +// ZoneId zoneId = ZoneId.systemDefault(); +// +// eventFeatureAmplitudeCurve.setStartTime(LocalDateTime.ofInstant(instant, zoneId)); + eventFeatureAmplitudeCurve.setStartTime(LocalDateTime.parse( dto.getStartTime())); return eventFeatureAmplitudeCurve; }) diff --git a/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/EventDetailService.java b/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/EventDetailService.java index ae92597e3..cafbafdb9 100644 --- a/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/EventDetailService.java +++ b/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/EventDetailService.java @@ -37,5 +37,5 @@ public interface EventDetailService extends IService { /** * 根据监测点集合以及分页信息获取暂降事件 */ - List getEventDetailLimit(List lineIndexes, String startTime, String endTime, Integer pageSize, Integer pageNum, List waveType); + List getEventDetailLimit(List lineIndexes, String startTime, String endTime, Integer pageSize, Integer pageNum, List waveType); } \ No newline at end of file diff --git a/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/AreaAnalysisServiceImpl.java b/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/AreaAnalysisServiceImpl.java index 69fb33841..ee0d6c10f 100644 --- a/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/AreaAnalysisServiceImpl.java +++ b/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/AreaAnalysisServiceImpl.java @@ -1,6 +1,12 @@ package com.njcn.event.service.majornetwork.Impl; +import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.StrUtil; +import com.alibaba.nacos.shaded.org.checkerframework.checker.units.qual.C; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.njcn.db.bo.BaseEntity; import com.njcn.device.pq.api.GeneralDeviceInfoClient; import com.njcn.device.pq.api.LineFeignClient; import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO; @@ -8,14 +14,18 @@ import com.njcn.device.pq.pojo.param.DeviceInfoParam; import com.njcn.device.pq.pojo.vo.AreaLineInfoVO; import com.njcn.event.influxdb.PqsEventDetailQuery; import com.njcn.event.pojo.po.EventDetail; +import com.njcn.event.pojo.po.RStatEventY; +import com.njcn.event.pojo.po.RmpEventDetailPO; import com.njcn.event.pojo.vo.AreaAnalysisVO; import com.njcn.event.pojo.vo.VoltageToleranceCurveVO; import com.njcn.event.pojo.vo.VoltageToleranceCurveVO.VoltageToleranceCurveDataList; import com.njcn.event.service.majornetwork.AreaAnalysisService; +import com.njcn.event.service.majornetwork.EventDetailService; import com.njcn.system.api.DicDataFeignClient; import com.njcn.system.enums.DicDataTypeEnum; import com.njcn.system.pojo.po.DictData; import lombok.RequiredArgsConstructor; +import lombok.Value; import org.influxdb.querybuilder.clauses.Clause; import org.springframework.stereotype.Service; @@ -45,7 +55,7 @@ public class AreaAnalysisServiceImpl implements AreaAnalysisService { private final LineFeignClient lineFeignClient; private final PqsEventDetailQuery pqsEventDetailQuery; - + private final EventDetailService eventDetailService; @Override public AreaAnalysisVO getEventReason(DeviceInfoParam.BusinessParam deviceInfoParam) { AreaAnalysisVO areaAnalysisVO = new AreaAnalysisVO(); @@ -55,7 +65,17 @@ public class AreaAnalysisServiceImpl implements AreaAnalysisService { List generalDeviceDTOList = generalDeviceInfoClient.getPracticalAllDeviceInfo(deviceInfoParam).getData(); List lineIds = getAllLineIdList(generalDeviceDTOList); - List reasonList = assData(dicReasonList, lineIds, deviceInfoParam.getSearchBeginTime(), deviceInfoParam.getSearchEndTime(), "event_reason"); + //查询数据 +// List reasonList = assData(dicReasonList, lineIds, deviceInfoParam.getSearchBeginTime(), deviceInfoParam.getSearchEndTime(), "event_reason"); + List info = eventDetailService.list(new LambdaQueryWrapper() + .in(RmpEventDetailPO::getMeasurementPointId, lineIds) + .in(RmpEventDetailPO::getAdvanceReason, dicReasonList.stream().map(DictData::getId).collect(Collectors.toList())) + .in(RmpEventDetailPO::getAdvanceType, dicTypeList.stream().map(DictData::getId).collect(Collectors.toList())) + .ge(StrUtil.isNotBlank(deviceInfoParam.getSearchBeginTime()), RmpEventDetailPO::getStartTime, DateUtil.beginOfDay(DateUtil.parse(deviceInfoParam.getSearchBeginTime()))) + .le(StrUtil.isNotBlank(deviceInfoParam.getSearchEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(deviceInfoParam.getSearchEndTime()))) + ); + List reasonList = assDataPQ(info, dicReasonList); + //暂降类型特殊处理 DictData dictData = dicReasonList.stream().filter(item->"短路故障".equals(item.getName())).findFirst().get(); @@ -72,7 +92,8 @@ public class AreaAnalysisServiceImpl implements AreaAnalysisService { stringListMap.put("相间故障",dicIdsXi); stringListMap.put("未知",dicIdsOther); - List typeList = assReason(stringListMap,lineIds,deviceInfoParam.getSearchBeginTime(), deviceInfoParam.getSearchEndTime(),dictData.getId()); +// List typeList = assReason(stringListMap,lineIds,deviceInfoParam.getSearchBeginTime(), deviceInfoParam.getSearchEndTime(),dictData.getId()); + List typeList = assReasonPQ(stringListMap, info, dictData.getId()); areaAnalysisVO.setReason(reasonList); areaAnalysisVO.setType(typeList); @@ -107,9 +128,17 @@ public class AreaAnalysisServiceImpl implements AreaAnalysisService { getBaseLineAreaInfo.parallelStream().collect(Collectors.toConcurrentMap(AreaLineInfoVO::getLineId, Function.identity())); - List eventDetailList = pqsEventDetailQuery.selectList(Arrays.asList("time","line_id", "persist_time", "event_value"), - lineIdOr(lineIds), timeAnd(beginOfDay(deviceInfoParam.getSearchBeginTime()), - endOfDay(deviceInfoParam.getSearchEndTime()))); +// List eventDetailList = pqsEventDetailQuery.selectList(Arrays.asList("time","line_id", "persist_time", "event_value"), +// lineIdOr(lineIds), timeAnd(beginOfDay(deviceInfoParam.getSearchBeginTime()), +// endOfDay(deviceInfoParam.getSearchEndTime()))); + + //数据暂降查询 + List infoPo = eventDetailService.list(new LambdaQueryWrapper() + .in(RmpEventDetailPO::getMeasurementPointId, lineIds) + .ge(StrUtil.isNotBlank(deviceInfoParam.getSearchBeginTime()), RmpEventDetailPO::getStartTime,DateUtil.beginOfDay(DateUtil.parse(deviceInfoParam.getSearchBeginTime()))) + .le(StrUtil.isNotBlank(deviceInfoParam.getSearchEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(deviceInfoParam.getSearchEndTime()))) + ); + List eventDetailList= BeanUtil.copyToList(infoPo,EventDetail.class); if (CollUtil.isEmpty(eventDetailList)) { return VoltageToleranceCurveVO.empty(); } @@ -120,9 +149,9 @@ public class AreaAnalysisServiceImpl implements AreaAnalysisService { VoltageToleranceCurveDataList voltageToleranceCurve = new VoltageToleranceCurveDataList(); voltageToleranceCurve.setLineId(dto.getLineId()); - voltageToleranceCurve.setPersistTime(dto.getPersistTime()); - voltageToleranceCurve.setEventValue(dto.getEventValue()); - voltageToleranceCurve.setTime(LocalDateTime.ofInstant(dto.getTimeId(), ZoneId.systemDefault())); + voltageToleranceCurve.setPersistTime(dto.getDuration()); + voltageToleranceCurve.setEventValue(dto.getFeatureAmplitude()); + voltageToleranceCurve.setTime(LocalDateTime.ofInstant(dto.getStartTime(), ZoneId.systemDefault())); voltageToleranceCurve.setGdName(info.getGdName()); voltageToleranceCurve.setSubName(info.getSubName()); return voltageToleranceCurve; @@ -143,6 +172,65 @@ public class AreaAnalysisServiceImpl implements AreaAnalysisService { return generalDeviceDTOList.stream().flatMap(dto -> dto.getLineIndexes().stream()).collect(Collectors.toList()); } + private List assDataPQ(List info,List dicReasonList) { + List reasonList = new ArrayList<>(); + //根据暂降原因分组 + Map reasonMap = dicReasonList.stream().collect(Collectors.toMap(DictData::getId,DictData::getName)); + //将数据进行分组 + Map infoMap = info.stream().collect(Collectors.groupingBy( + x->{ + return reasonMap.get(x.getAdvanceReason()); + }, Collectors.counting())); + + //排除不存在的字典数据集合 + List notDicData = dicReasonList.stream().filter(r -> !infoMap.containsKey(r.getName())) + .collect(Collectors.toList()); + AreaAnalysisVO.Children allType ; + if(CollUtil.isNotEmpty(notDicData)){ + for (DictData notDicDatum : notDicData) { + allType = new AreaAnalysisVO.Children(); + allType.setName(notDicDatum.getName()); + allType.setValue(0); + reasonList.add(allType); + } + } + Integer allCount = 0; + for (String s : infoMap.keySet()) { + allType = new AreaAnalysisVO.Children(); + allType.setName(s); + int count = Math.toIntExact(infoMap.get(s)); + allType.setValue(count); + allCount += count; + reasonList.add(allType); + } + AreaAnalysisVO.Children zj = new AreaAnalysisVO.Children(); + zj.setName("总计"); + zj.setValue(allCount); + reasonList.add(zj); + return reasonList; + } + + private List assReasonPQ(Map> stringListMap, List info, String typeId){ + List reasonList = new ArrayList<>(); + + List reasons = info.stream().filter(x -> typeId.equals(x.getAdvanceReason())).collect(Collectors.toList()); + Integer allCount = 0; + for (Map.Entry> stringListEntry : stringListMap.entrySet()) { + List value = stringListEntry.getValue(); + Integer count = Math.toIntExact(reasons.stream().filter(x -> value.contains(x)).count()); + AreaAnalysisVO.Children allType = new AreaAnalysisVO.Children(); + allType.setName(stringListEntry.getKey()); + allType.setValue(count); + allCount += count; + reasonList.add(allType); + } + + AreaAnalysisVO.Children allType = new AreaAnalysisVO.Children(); + allType.setName("总计"); + allType.setValue(allCount); + reasonList.add(allType); + return reasonList; + } private List assData(List dicList, List lineIds, String startTime, String endTime, String type) { List reasonList = new ArrayList<>(); diff --git a/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/AreaInfoServiceImpl.java b/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/AreaInfoServiceImpl.java index 2a8243de4..f410acb02 100644 --- a/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/AreaInfoServiceImpl.java +++ b/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/AreaInfoServiceImpl.java @@ -91,32 +91,7 @@ public class AreaInfoServiceImpl implements AreaInfoService { } } - //查询监测点未处理暂态事件 -// StringBuilder lineIdsStr = InfluxDBCommUtils.assToInfluxParam(lineIds); -// -// String stringResult = "SELECT count(eventass_index) FROM " + Param.EVENT_DETAIL + Param.WHERE + "time >= '" + deviceInfoParam.getSearchBeginTime() + InfluxDBPublicParam.START_TIME + "' and " + "time <= '" + deviceInfoParam.getSearchEndTime() + InfluxDBPublicParam.END_TIME + "' and " + lineIdsStr + " and eventass_index = '' group by line_id" + InfluxDBPublicParam.TIME_ZONE; -// // 结果集 -// QueryResult result = influxDbUtils.query(stringResult); -// if (!result.hasError()) { -// List list = result.getResults().get(0).getSeries(); -// -// for (AreaLineInfoVO areaLineInfoVO : resList) { -// boolean flag = false; -// if(CollectionUtil.isNotEmpty(list)) { -// for (QueryResult.Series tem : list) { -// String lineId = tem.getTags().get("line_id"); -// if (areaLineInfoVO.getLineId().equals(lineId)) { -// areaLineInfoVO.setNoDealCount(Double.valueOf(tem.getValues().get(0).get(1).toString()).intValue()); -// flag = true; -// break; -// } -// } -// } -// if (!flag) { -// areaLineInfoVO.setNoDealCount(0); -// } -// } -// } + //组装成变电站 if (CollectionUtil.isNotEmpty(resList)) { Map> map = resList.stream().collect(Collectors.groupingBy(AreaLineInfoVO::getSubId)); @@ -164,9 +139,9 @@ public class AreaInfoServiceImpl implements AreaInfoService { //监测点id eventDetailNew.setLineId(eventDetail.getMeasurementPointId()); //持续时间 - eventDetailNew.setPersistTime(eventDetail.getDuration()); + eventDetailNew.setDuration(eventDetail.getDuration()); //特征幅值 - eventDetailNew.setEventValue(eventDetail.getFeatureAmplitude()); + eventDetailNew.setFeatureAmplitude(eventDetail.getFeatureAmplitude()); if(lineMap.containsKey(eventDetail.getMeasurementPointId())){ AreaLineInfoVO areaLineInfoVO = lineMap.get(eventDetail.getMeasurementPointId()); eventDetailNew.setLineName(areaLineInfoVO.getLineName()); @@ -177,28 +152,6 @@ public class AreaInfoServiceImpl implements AreaInfoService { } -// //查询监测点未处理暂态事件 -// StringBuilder lineIdsStr = InfluxDBCommUtils.assToInfluxParam(lineIds); -// -// String stringResult = "SELECT * FROM " + Param.EVENT_DETAIL + Param.WHERE + lineIdsStr + "and eventass_index = '' order by time desc limit 100" + InfluxDBPublicParam.TIME_ZONE; -// // 结果集 -// QueryResult result = influxDbUtils.query(stringResult); -// // 结果集映射到对象中 -// InfluxDBResultMapperCn influxDBResultMapper = new InfluxDBResultMapperCn(); -// resList = influxDBResultMapper.toPOJO(result, EventDetailNew.class); -// //对未处理暂降事件的监测点替换成中文名称 -// if (CollectionUtil.isNotEmpty(resList)) { -// for (EventDetailNew eventDetail : resList) { -// for (AreaLineInfoVO tem : lineList) { -// if (eventDetail.getLineId().equals(tem.getLineId())) { -// eventDetail.setLineName(tem.getLineName()); -// eventDetail.setLng(tem.getLng()); -// eventDetail.setLat(tem.getLat()); -// break; -// } -// } -// } -// } } return resList; } @@ -217,9 +170,9 @@ public class AreaInfoServiceImpl implements AreaInfoService { //监测点id eventDetailNew.setLineId(eventDetail.getMeasurementPointId()); //持续时间 - eventDetailNew.setPersistTime(eventDetail.getDuration()); + eventDetailNew.setDuration(eventDetail.getDuration()); //特征幅值 - eventDetailNew.setEventValue(eventDetail.getFeatureAmplitude()); + eventDetailNew.setFeatureAmplitude(eventDetail.getFeatureAmplitude()); if(CollectionUtil.isNotEmpty(lineList)){ resList = resList.stream().peek(item->{ item.setGdName(lineList.get(0).getGdName()); @@ -230,22 +183,7 @@ public class AreaInfoServiceImpl implements AreaInfoService { } } -// String stringResult = "SELECT * FROM " + Param.EVENT_DETAIL + Param.WHERE + "line_id = '"+id+"' and eventass_index = '' order by time desc limit 100" + InfluxDBPublicParam.TIME_ZONE; -// // 结果集 -// QueryResult result = influxDbUtils.query(stringResult); -// // 结果集映射到对象中 -// InfluxDBResultMapperCn influxDBResultMapper = new InfluxDBResultMapperCn(); -// List resList = influxDBResultMapper.toPOJO(result, EventDetailNew.class); -// List lineList = lineFeignClient.getBaseLineAreaInfo(Stream.of(id).collect(Collectors.toList())).getData(); - -// if(CollectionUtil.isNotEmpty(lineList)){ -// resList = resList.stream().peek(item->{ -// item.setGdName(lineList.get(0).getGdName()); -// item.setSubName(lineList.get(0).getSubName()); -// item.setLineName(lineList.get(0).getLineName()); -// }).collect(Collectors.toList()); -// } return resList; } diff --git a/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/AreaLineServiceImpl.java b/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/AreaLineServiceImpl.java index 841a5da79..701486025 100644 --- a/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/AreaLineServiceImpl.java +++ b/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/AreaLineServiceImpl.java @@ -1,7 +1,10 @@ package com.njcn.event.service.majornetwork.Impl; +import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.njcn.common.pojo.enums.common.ServerEnum; import com.njcn.device.pq.api.GeneralDeviceInfoClient; import com.njcn.device.pq.api.LineFeignClient; @@ -14,10 +17,12 @@ import com.njcn.event.influxdb.PqsOnlinerateQuery; import com.njcn.event.mapper.majornetwork.PqDeviceMapper; import com.njcn.event.pojo.po.PqDevice; import com.njcn.event.pojo.po.PqsOnlinerate; +import com.njcn.event.pojo.po.RmpEventDetailPO; import com.njcn.event.pojo.vo.*; import com.njcn.event.pojo.vo.TerminalRunningStatisticsVO.TerminalRunningInfoVO; import com.njcn.event.pojo.vo.TerminalRunningStatisticsVO.TerminalRunningVO; import com.njcn.event.service.majornetwork.AreaLineService; +import com.njcn.event.service.majornetwork.EventDetailService; import com.njcn.influxdb.param.InfluxDBPublicParam; import com.njcn.influxdb.utils.InfluxDbUtils; import com.njcn.system.pojo.enums.StatisticsEnum; @@ -56,6 +61,8 @@ public class AreaLineServiceImpl implements AreaLineService { private final PqsOnlinerateQuery pqsOnlinerateQuery; private final PqDeviceMapper pqDeviceMapper; + private final EventDetailService eventDetailService; + @Override public AreaLineVO getAreaLineVO(DeviceInfoParam deviceInfoParam) { @@ -161,7 +168,14 @@ public class AreaLineServiceImpl implements AreaLineService { // 获取暂降数据 if (lineIndexs.size() > 0) { int tail = 0; - List eventdetailList = getContion(deviceInfoParam, lineIndexs); +// List eventdetailList = getContion(deviceInfoParam, lineIndexs); + //数据暂降查询 + List info = eventDetailService.list(new LambdaQueryWrapper() + .in(RmpEventDetailPO::getMeasurementPointId, lineIndexs) + .ge(StrUtil.isNotBlank(deviceInfoParam.getSearchBeginTime()), RmpEventDetailPO::getStartTime,DateUtil.beginOfDay(DateUtil.parse(deviceInfoParam.getSearchBeginTime()))) + .le(StrUtil.isNotBlank(deviceInfoParam.getSearchEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(deviceInfoParam.getSearchEndTime()))) + ); + List eventdetailList= BeanUtil.copyToList(info,EventHeatDeatilVO.class); if (eventdetailList.size() > 0) { List lineIds = eventdetailList.stream().map(EventHeatDeatilVO::getLineId).collect(Collectors.toList()); List areaAnalysisVOList = lineFeignClient.getBaseLineAreaInfo(lineIds).getData(); @@ -216,7 +230,13 @@ public class AreaLineServiceImpl implements AreaLineService { if (lineIndexs.size() > 0) { int tail = 0; EventSeverityValueVO eventSeverityValueVO = new EventSeverityValueVO(); - List eventdetailList = getContion(deviceInfoParam, lineIndexs); +// List eventdetailList = getContion(deviceInfoParam, lineIndexs); + List info = eventDetailService.list(new LambdaQueryWrapper() + .in(RmpEventDetailPO::getMeasurementPointId, lineIndexs) + .ge(StrUtil.isNotBlank(deviceInfoParam.getSearchBeginTime()), RmpEventDetailPO::getStartTime,DateUtil.beginOfDay(DateUtil.parse(deviceInfoParam.getSearchBeginTime()))) + .le(StrUtil.isNotBlank(deviceInfoParam.getSearchEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(deviceInfoParam.getSearchEndTime()))) + ); + List eventdetailList= BeanUtil.copyToList(info,EventHeatDeatilVO.class); if (eventdetailList.size() > 0) { for (int eventNum = 0; eventNum < eventdetailList.size(); eventNum++) { tail += eventdetailList.get(eventNum).getCount(); diff --git a/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/AreaStatisticalServiceImpl.java b/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/AreaStatisticalServiceImpl.java index b089e7bae..497c4a99a 100644 --- a/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/AreaStatisticalServiceImpl.java +++ b/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/AreaStatisticalServiceImpl.java @@ -1,15 +1,19 @@ package com.njcn.event.service.majornetwork.Impl; +import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.date.DateField; import cn.hutool.core.date.DatePattern; import cn.hutool.core.date.DateTime; import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.njcn.device.pq.api.GeneralDeviceInfoClient; import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO; import com.njcn.device.pq.pojo.param.DeviceInfoParam; import com.njcn.event.influxdb.PqsEventDetailQuery; import com.njcn.event.pojo.po.EventDetail; +import com.njcn.event.pojo.po.RmpEventDetailPO; import com.njcn.event.pojo.vo.AreaCalculationVO; import com.njcn.event.pojo.vo.AreaStatisticalVO; import com.njcn.event.pojo.vo.AreaStatisticalVO.AreaStatisticsVO; @@ -18,7 +22,11 @@ import com.njcn.event.pojo.vo.AreaStatisticalVO.VoltageStatisticsVO; import com.njcn.event.pojo.vo.MonthCalculationVO; import com.njcn.event.pojo.vo.VoltageLevelCalculationVO; import com.njcn.event.service.majornetwork.AreaStatisticalService; +import com.njcn.event.service.majornetwork.EventDetailService; +import com.njcn.system.api.DicDataFeignClient; +import com.njcn.system.enums.DicDataEnum; import com.njcn.system.pojo.enums.StatisticsEnum; +import com.njcn.system.pojo.po.DictData; import lombok.RequiredArgsConstructor; import org.influxdb.querybuilder.clauses.Clause; import org.springframework.stereotype.Service; @@ -47,6 +55,9 @@ public class AreaStatisticalServiceImpl implements AreaStatisticalService { private final PqsEventDetailQuery pqsEventDetailQuery; + private final EventDetailService eventDetailService; + private final DicDataFeignClient dicDataFeignClient; + /** * 获取暂降区域 电压等级 月份统计 * @@ -55,6 +66,9 @@ public class AreaStatisticalServiceImpl implements AreaStatisticalService { */ @Override public AreaStatisticalVO getAreaCalculation(DeviceInfoParam.BusinessParam deviceInfoParam) { + //获取录波字典信息 + DictData data = dicDataFeignClient.getDicDataByCode(DicDataEnum.RECORDING_WAVE.getCode()).getData(); + // 获取指定部门下的监测点集合 List generalDeviceDTOList = generalDeviceInfoClient.getPracticalAllDeviceInfo(deviceInfoParam).getData(); if (CollUtil.isEmpty(generalDeviceDTOList)) { @@ -65,10 +79,20 @@ public class AreaStatisticalServiceImpl implements AreaStatisticalService { return AreaStatisticalVO.empty(); } - List clauseList = new ArrayList<>(timeAnd(beginOfDay(deviceInfoParam.getSearchBeginTime()), endOfDay(deviceInfoParam.getSearchEndTime()))); - clauseList.add(ne("wave_type",5)); - List eventDetailList = pqsEventDetailQuery.selectList(Arrays.asList("line_id", "eventass_index"), - lineIdOr(lineIds),clauseList); +// List clauseList = new ArrayList<>(timeAnd(beginOfDay(deviceInfoParam.getSearchBeginTime()), endOfDay(deviceInfoParam.getSearchEndTime()))); +// clauseList.add(ne("wave_type",5)); +// List cc = pqsEventDetailQuery.selectList(Arrays.asList("line_id", "eventass_index"), +// lineIdOr(lineIds),clauseList); + + //数据暂降查询 + List info = eventDetailService.list(new LambdaQueryWrapper() + .in(RmpEventDetailPO::getMeasurementPointId, lineIds) + //todo 是否缺少录波 + .eq(RmpEventDetailPO::getEventType, data.getId()) + .ge(StrUtil.isNotBlank(deviceInfoParam.getSearchBeginTime()), RmpEventDetailPO::getStartTime,DateUtil.beginOfDay(DateUtil.parse(deviceInfoParam.getSearchBeginTime()))) + .le(StrUtil.isNotBlank(deviceInfoParam.getSearchEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(deviceInfoParam.getSearchEndTime()))) + ); + List eventDetailList = BeanUtil.copyToList(info,EventDetail.class); if (CollUtil.isEmpty(eventDetailList)) { return AreaStatisticalVO.empty(); } diff --git a/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/EventAnalysisServiceImpl.java b/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/EventAnalysisServiceImpl.java index 01b834875..0cc6413a5 100644 --- a/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/EventAnalysisServiceImpl.java +++ b/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/EventAnalysisServiceImpl.java @@ -1,6 +1,7 @@ package com.njcn.event.service.majornetwork.Impl; import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.ObjectUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; @@ -146,13 +147,14 @@ public class EventAnalysisServiceImpl implements EventAnalysisService { @Override public List getCoords(StatisticsParam statisticsParam) { List result = new ArrayList<>(); + // QueryResult query = MonitorQuery(statisticsParam); // InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper(); // List info = influxDBResultMapper.toPOJO(query, EventDetail.class); //查询监测点未处理暂态事件 List info = eventDetailService.list(new LambdaQueryWrapper() - .in(RmpEventDetailPO::getMeasurementPointId, statisticsParam.getLineIndex()) + .eq(RmpEventDetailPO::getMeasurementPointId, statisticsParam.getLineIndex()) .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()))) ); @@ -388,8 +390,8 @@ public class EventAnalysisServiceImpl implements EventAnalysisService { } } for (int i = 0; i < info.size(); i++) { - Double eventvalue = info.get(i).getEventValue(); - double persisttime = info.get(i).getPersistTime(); + Double eventvalue = info.get(i).getFeatureAmplitude(); + double persisttime = info.get(i).getDuration(); if (eventvalue * 100 < 10) { if (persisttime < 20) { arr[4][0]++; @@ -500,7 +502,7 @@ public class EventAnalysisServiceImpl implements EventAnalysisService { //查询监测点未处理暂态事件 List info = eventDetailService.list(new LambdaQueryWrapper() - .in(RmpEventDetailPO::getMeasurementPointId, statisticsParam.getLineIndex()) + .eq(RmpEventDetailPO::getMeasurementPointId, statisticsParam.getLineIndex()) .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()))) ); @@ -576,8 +578,8 @@ public class EventAnalysisServiceImpl implements EventAnalysisService { } } for (int i = 0; i < info.size(); i++) { - Double eventvalue = info.get(i).getEventValue(); - double persisttime = info.get(i).getPersistTime(); + 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]++; @@ -941,6 +943,7 @@ public class EventAnalysisServiceImpl implements EventAnalysisService { } else { builder2.append(startYear).append("-").append(startMonth + 1).append("-").append(startDays); } + // query = MonitorQuery(new StatisticsParam(statisticsParam.getLineIndex(),builder1.toString(), builder2.toString(), statisticsParam.getFlag())); // InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper(); // List eventDetailList = influxDBResultMapper.toPOJO(query, EventDetail.class); @@ -996,7 +999,7 @@ public class EventAnalysisServiceImpl implements EventAnalysisService { ); Map> map = eventDetailList.stream().filter(x -> data.getId().equals(x.getEventType())) - .collect(Collectors.groupingBy(s -> DateUtil.format(s.getStartTime(), "yyyy-MM-dd"))); + .collect(Collectors.groupingBy(s -> s.getStartTime().substring(0, 10))); Set keySet = map.keySet(); LocalDate parse1 = LocalDate.parse(startTime); @@ -1049,46 +1052,59 @@ public class EventAnalysisServiceImpl implements EventAnalysisService { List list = new ArrayList<>(); List reasonsVOS = new ArrayList<>(); List typesVOS = new ArrayList<>(); - List info = new ArrayList<>(); - QueryResult query = MonitorQuery(statisticsParam); - InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper(); - info = influxDBResultMapper.toPOJO(query, EventDetail.class); +// List info = new ArrayList<>(); +// QueryResult query = MonitorQuery(statisticsParam); +// InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper(); +// info = influxDBResultMapper.toPOJO(query, EventDetail.class); + //数据暂降查询 + List info = eventDetailService.list(new LambdaQueryWrapper() + .eq(RmpEventDetailPO::getMeasurementPointId, statisticsParam.getLineIndex()) + .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()))) + ); + HttpResult> reason = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.EVENT_REASON.getName()); HttpResult> type = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.EVENT_TYPE.getName()); List reasonData = reason.getData(); List typeData = type.getData(); - + //获取暂降字典信息 + DictData dataDto = dicDataFeignClient.getDicDataByCode(DicDataEnum.VOLTAGE_DIP.getCode()).getData(); HashMap reasonMap = new HashMap<>(); HashMap typeMap = new HashMap<>(); + + //添加detail - for (EventDetail detail : info) { - if (detail.getWaveType() == 1) { + for (RmpEventDetailPO detail : info) { + EventDetail details = null; + if (dataDto.getId() .equals(detail.getEventType())) { for (DictData data : reasonData) { reasonMap.put(data.getName(),0); - if (detail.getEventReason().equals(data.getId())) { - detail.setEventReason(data.getName()); + if (detail.getAdvanceReason().equals(data.getId())) { + details=BeanUtil.copyProperties(detail,EventDetail.class); + details.setAdvanceReason(data.getName()); } } for (DictData data : typeData) { typeMap.put(data.getName(),0); - if (detail.getEventType().equals(data.getId())) { - detail.setEventType(data.getName()); + if (detail.getAdvanceType().equals(data.getId())) { + details=BeanUtil.copyProperties(detail,EventDetail.class); + detail.setAdvanceType(data.getName()); } } - list.add(detail); + list.add(details); } } //添加reason到map for (EventDetail data : list) { - if (reasonMap.get(data.getEventReason()) != null) { - reasonMap.put(data.getEventReason(), reasonMap.get(data.getEventReason()) + 1); + 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.getEventType()) != null) { - typeMap.put(data.getEventType(), typeMap.get(data.getEventType()) + 1); + if (typeMap.get(data.getAdvanceType()) != null) { + typeMap.put(data.getAdvanceType(), typeMap.get(data.getAdvanceType()) + 1); } } Set reasonKeyset = reasonMap.keySet(); @@ -1116,14 +1132,21 @@ public class EventAnalysisServiceImpl implements EventAnalysisService { public ProbabilityVO getProbabilityDistribution(StatisticsParam statisticsParam) { ProbabilityVO result = new ProbabilityVO(); List info = new ArrayList<>(); - QueryResult query = MonitorQuery(statisticsParam); - InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper(); - List info2 = influxDBResultMapper.toPOJO(query, EventDetail.class); +// QueryResult query = MonitorQuery(statisticsParam); +// InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper(); +// List info2 = influxDBResultMapper.toPOJO(query, EventDetail.class); + //数据暂降查询 + List infos = eventDetailService.list(new LambdaQueryWrapper() + .eq(RmpEventDetailPO::getMeasurementPointId, statisticsParam.getLineIndex()) + .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()))) + ); + List info2 = BeanUtil.copyToList(infos, EventDetail.class); //总数 Integer count = 0; for (EventDetail eventDetail : info2) { //过滤掉大于0.9的数据 - if (eventDetail.getEventValue() <= 0.9) { + if (eventDetail.getFeatureAmplitude() <= 0.9) { count++; info.add(eventDetail); } @@ -1152,53 +1175,53 @@ public class EventAnalysisServiceImpl implements EventAnalysisService { subsectionMap.put("80~90", 0); //求数量 for (EventDetail eventDetail : info) { - if (eventDetail.getEventValue() < 0.1) { + if (eventDetail.getFeatureAmplitude() < 0.1) { countMap.put("<10", (countMap.get("<10") + 1)); } - if (eventDetail.getEventValue() < 0.2) { + if (eventDetail.getFeatureAmplitude() < 0.2) { countMap.put("<20", (countMap.get("<20") + 1)); } - if (eventDetail.getEventValue() < 0.3) { + if (eventDetail.getFeatureAmplitude() < 0.3) { countMap.put("<30", (countMap.get("<30") + 1)); } - if (eventDetail.getEventValue() < 0.4) { + if (eventDetail.getFeatureAmplitude() < 0.4) { countMap.put("<40", (countMap.get("<40") + 1)); } - if (eventDetail.getEventValue() < 0.5) { + if (eventDetail.getFeatureAmplitude() < 0.5) { countMap.put("<50", (countMap.get("<50") + 1)); } - if (eventDetail.getEventValue() < 0.6) { + if (eventDetail.getFeatureAmplitude() < 0.6) { countMap.put("<60", (countMap.get("<60") + 1)); } - if (eventDetail.getEventValue() < 0.7) { + if (eventDetail.getFeatureAmplitude() < 0.7) { countMap.put("<70", (countMap.get("<70") + 1)); } - if (eventDetail.getEventValue() < 0.8) { + if (eventDetail.getFeatureAmplitude() < 0.8) { countMap.put("<80", (countMap.get("<80") + 1)); } - if (eventDetail.getEventValue() < 0.9) { + if (eventDetail.getFeatureAmplitude() < 0.9) { countMap.put("<90", (countMap.get("<90") + 1)); } } //求每段数量 for (EventDetail eventDetail : info) { - if (eventDetail.getEventValue() < 0.1) { + if (eventDetail.getFeatureAmplitude() < 0.1) { subsectionMap.put("0~10", (subsectionMap.get("0~10") + 1)); - } else if (eventDetail.getEventValue() > 0.1 && eventDetail.getEventValue() < 0.2) { + } else if (eventDetail.getFeatureAmplitude() > 0.1 && eventDetail.getFeatureAmplitude() < 0.2) { subsectionMap.put("10~20", (subsectionMap.get("10~20") + 1)); - } else if (eventDetail.getEventValue() > 0.2 && eventDetail.getEventValue() < 0.3) { + } else if (eventDetail.getFeatureAmplitude() > 0.2 && eventDetail.getFeatureAmplitude() < 0.3) { subsectionMap.put("20~30", (subsectionMap.get("20~30") + 1)); - } else if (eventDetail.getEventValue() > 0.3 && eventDetail.getEventValue() < 0.4) { + } else if (eventDetail.getFeatureAmplitude() > 0.3 && eventDetail.getFeatureAmplitude() < 0.4) { subsectionMap.put("30~40", (subsectionMap.get("30~40") + 1)); - } else if (eventDetail.getEventValue() > 0.4 && eventDetail.getEventValue() < 0.5) { + } else if (eventDetail.getFeatureAmplitude() > 0.4 && eventDetail.getFeatureAmplitude() < 0.5) { subsectionMap.put("40~50", (subsectionMap.get("40~50") + 1)); - } else if (eventDetail.getEventValue() > 0.5 && eventDetail.getEventValue() < 0.6) { + } else if (eventDetail.getFeatureAmplitude() > 0.5 && eventDetail.getFeatureAmplitude() < 0.6) { subsectionMap.put("50~60", (subsectionMap.get("50~60") + 1)); - } else if (eventDetail.getEventValue() > 0.6 && eventDetail.getEventValue() < 0.7) { + } else if (eventDetail.getFeatureAmplitude() > 0.6 && eventDetail.getFeatureAmplitude() < 0.7) { subsectionMap.put("60~70", (subsectionMap.get("60~70") + 1)); - } else if (eventDetail.getEventValue() > 0.7 && eventDetail.getEventValue() < 0.8) { + } else if (eventDetail.getFeatureAmplitude() > 0.7 && eventDetail.getFeatureAmplitude() < 0.8) { subsectionMap.put("70~80", (subsectionMap.get("70~80") + 1)); - } else if (eventDetail.getEventValue() > 0.8 && eventDetail.getEventValue() < 0.9) { + } else if (eventDetail.getFeatureAmplitude() > 0.8 && eventDetail.getFeatureAmplitude() < 0.9) { subsectionMap.put("80~90", (subsectionMap.get("80~90") + 1)); } } @@ -1276,7 +1299,7 @@ public class EventAnalysisServiceImpl implements EventAnalysisService { timeMap.put("<180", 0); //求不同时间段的总数 for (EventDetail eventDetail : info) { - Double persistTime = eventDetail.getPersistTime(); + 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) { @@ -1337,7 +1360,7 @@ public class EventAnalysisServiceImpl implements EventAnalysisService { //求sisttime List sisttime = new ArrayList<>(); for (EventDetail eventDetail : info) { - Double persistTime = eventDetail.getPersistTime(); + Double persistTime = eventDetail.getDuration(); if (persistTime / 1000 < 0.1) { timeMap2.put("<0.1", timeMap2.get("<0.1") + 1); } @@ -1415,7 +1438,7 @@ public class EventAnalysisServiceImpl implements EventAnalysisService { // } //查询监测点未处理暂态事件 List eventDetails = eventDetailService.list(new LambdaQueryWrapper() - .in(RmpEventDetailPO::getMeasurementPointId, statisticsParam.getLineIndex()) + .eq(RmpEventDetailPO::getMeasurementPointId, statisticsParam.getLineIndex()) .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()))) ); @@ -1433,21 +1456,21 @@ public class EventAnalysisServiceImpl implements EventAnalysisService { //监测点id eventDetailNew.setLineId(eventDetail.getMeasurementPointId()); //持续时间 - eventDetailNew.setPersistTime(eventDetail.getDuration()); + eventDetailNew.setDuration(eventDetail.getDuration()); //特征幅值 - eventDetailNew.setEventValue(eventDetail.getFeatureAmplitude()); + eventDetailNew.setFeatureAmplitude(eventDetail.getFeatureAmplitude()); //波形路径 - eventDetailNew.setWaveName(eventDetail.getWavePath()); + eventDetailNew.setWavePath(eventDetail.getWavePath()); if(data.getId().equals(eventDetail.getEventType())){ - if (reasonMap.containsKey(eventDetail.getEventReason())) { + if (reasonMap.containsKey(eventDetail.getAdvanceReason())) { //暂降原因 - DictData dictData = reasonMap.get(eventDetail.getEventReason()); - eventDetailNew.setEventReason(dictData.getName()); + DictData dictData = reasonMap.get(eventDetail.getAdvanceReason()); + eventDetailNew.setAdvanceReason(dictData.getName()); } - if (typeMap.containsKey(eventDetail.getEventType())) { + if (typeMap.containsKey(eventDetail.getAdvanceType())) { //事件类型 - DictData dictData = typeMap.get(eventDetail.getEventType()); - eventDetailNew.setEventType(dictData.getName()); + DictData dictData = typeMap.get(eventDetail.getAdvanceType()); + eventDetailNew.setAdvanceType(dictData.getName()); } } @@ -1466,244 +1489,295 @@ public class EventAnalysisServiceImpl implements EventAnalysisService { @Override public Page getMonitorEventAnalyseQuery(EventBaseParam eventBaseParam) { - //提前创建结果集合 - List eventDetailList = new ArrayList<>(); + //数据暂降查询 + Page pageInfo = eventDetailService.page(new Page<>(eventBaseParam.getPageNum(), eventBaseParam.getPageSize()), new LambdaQueryWrapper() + .eq(RmpEventDetailPO::getMeasurementPointId, eventBaseParam.getLineId()) + .ge(StringUtils.isNotBlank(eventBaseParam.getSearchBeginTime()), RmpEventDetailPO::getStartTime,DateUtil.beginOfDay(DateUtil.parse(eventBaseParam.getSearchBeginTime()))) + .le(StringUtils.isNotBlank(eventBaseParam.getSearchEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(eventBaseParam.getSearchEndTime()))) - //创建line_id集合,将入参line_id塞进去 - List lineIds = new ArrayList<>(); - lineIds.add(eventBaseParam.getLineId()); - - //提前创建total - StringBuilder stringTotal = new StringBuilder(); - - - //查询参数不为空,进行条件填充 - if (ObjectUtil.isNotNull(eventBaseParam.getSearchValue())) { - //查询sql语句 - StringBuilder stringResult = new StringBuilder(Param.SELECT).append(Param.EVENT_DETAIL).append(Param.WHERE). - append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(eventBaseParam.getSearchBeginTime()))).append("' and ").append("time <= '").append(DateUtil.endOfDay(DateUtil.parse(eventBaseParam.getSearchEndTime()))).append("' and ") - .append("line_id= '").append(eventBaseParam.getLineId()).append("'"); - - //套用公式(page-1)*pageSize - int i = (eventBaseParam.getPageNum() - 1) * eventBaseParam.getPageSize(); - //拼接分页sql - stringResult.append("LIMIT ").append(eventBaseParam.getPageSize()).append(" OFFSET ").append(i).append(" tz('Asia/Shanghai')"); - - - //查询sql语句总条数 - stringTotal = new StringBuilder("SELECT COUNT(num) as aa FROM ").append(Param.EVENT_DETAIL).append(" WHERE ").append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(eventBaseParam.getSearchBeginTime()))).append("' and ") - .append("time <= '").append(DateUtil.endOfDay(DateUtil.parse(eventBaseParam.getSearchEndTime()))).append("' and "); - stringTotal.append("line_id= '").append(eventBaseParam.getLineId()).append("' tz('Asia/Shanghai')"); - - //结果集 - QueryResult result = influxDbUtils.query(stringResult.toString()); - //总条数 - QueryResult resultTotal = influxDbUtils.query(stringTotal.toString()); - - //结果集映射到对象中 - InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper(); - eventDetailList = influxDBResultMapper.toPOJO(result, WaveTypeVO.class); - - - //获取关于监测点发电站相关信息 - HttpResult> baseLineAreaInfo = lineFeignClient.getBaseLineAreaInfo(lineIds); - System.out.println(baseLineAreaInfo); - //将返回的封装好的结果集进行还原成集合 - List areaLineList = baseLineAreaInfo.getData(); - - - //将监测点发电机相关信息copy到准备好的VO对象中 - for (WaveTypeVO waveTypeVO : eventDetailList) { - if (waveTypeVO.getLineId() != null) { - for (AreaLineInfoVO lineInfoVO : areaLineList) { - if (waveTypeVO.getLineId().equals(lineInfoVO.getLineId())) { - waveTypeVO.setSubName(lineInfoVO.getSubName()); - waveTypeVO.setLineId(lineInfoVO.getLineId()); - waveTypeVO.setLineName(lineInfoVO.getLineName()); - waveTypeVO.setGdId(lineInfoVO.getGdId()); - waveTypeVO.setGdName(lineInfoVO.getGdName()); - waveTypeVO.setVoltageId(lineInfoVO.getVoltageId()); - waveTypeVO.setNoDealCount(lineInfoVO.getNoDealCount()); - waveTypeVO.setCt1(lineInfoVO.getCt1()); - waveTypeVO.setCt2(lineInfoVO.getCt2()); - waveTypeVO.setPt1(lineInfoVO.getPt1()); - waveTypeVO.setPt2(lineInfoVO.getPt2()); - waveTypeVO.setRunFlag(lineInfoVO.getRunFlag()); - waveTypeVO.setComFlag(lineInfoVO.getComFlag()); - waveTypeVO.setIp(lineInfoVO.getIp()); - waveTypeVO.setLat(lineInfoVO.getLat()); - waveTypeVO.setLng(lineInfoVO.getLng()); - waveTypeVO.setManufacturer(lineInfoVO.getManufacturer()); - waveTypeVO.setVoltageScale(lineInfoVO.getVoltageScale()); - } - } - } else { - //抛出异常,当前监测点id为空 - throw new BusinessException(EventResponseEnum.EVENT_NOT_FOUND); - } - } - - //使用字典表对暂态类型和暂态原因进行转换 - HttpResult> reason = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.EVENT_REASON.getName()); - HttpResult> type = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.EVENT_TYPE.getName()); - //获取字典数据暂态原因集合 - List eventReasonList = reason.getData(); - //System.out.println(eventReasonList); - //获取字典数据暂态类型集合 - List eventTypeList = type.getData(); - //System.out.println(eventTypeList); - - - //查询字典表替换事件原因与事件类型的字符串 - for (WaveTypeVO eventDetail : eventDetailList) { - if (eventDetail.getEventReason() != null) { - for (DictData dictData : eventReasonList) { - //将字典数据id与VO中属性eventReason对应的字符串进行比较 - if (eventDetail.getEventReason().equals(dictData.getId())) { - eventDetail.setEventReason(dictData.getName()); - } - } - } else { - //抛出异常,当前暂态原因为空 - throw new BusinessException(EventResponseEnum.EVENT_REASON_NOT_FOUND); - } - } - - for (WaveTypeVO eventDetail : eventDetailList) { - if (eventDetail.getEventType() != null) { - for (DictData dictData : eventTypeList) { - //将字典数据id与VO中属性eventType对应的字符串进行比较 - if (eventDetail.getEventType().equals(dictData.getId())) { - eventDetail.setEventType(dictData.getName()); - } - } - } else { - //抛出异常,当前暂态类型为空 - throw new BusinessException(EventResponseEnum.EVENT_TYPE_NOT_FOUND); - } - } - Page page = new Page<>(); - page.setTotal(eventDetailList.size()); - page.setRecords(eventDetailList); - page.setCurrent(eventBaseParam.getPageNum()); - page.setSize(eventBaseParam.getPageSize()); - return page; - - - } else { - StringBuilder stringResult = new StringBuilder(Param.SELECT).append(Param.EVENT_DETAIL).append(Param.WHERE). - append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(eventBaseParam.getSearchBeginTime()))).append("' and ").append("time <= '").append(DateUtil.endOfDay(DateUtil.parse(eventBaseParam.getSearchEndTime()))).append("' and ") - .append("line_id= '").append(eventBaseParam.getLineId()).append("'"); - - - int i = (eventBaseParam.getPageNum() - 1) * eventBaseParam.getPageSize(); - - stringResult.append("LIMIT ").append(eventBaseParam.getPageSize()).append(" OFFSET ").append(i).append(" tz('Asia/Shanghai')"); - - //查询sql语句总条数 - stringTotal = new StringBuilder("SELECT COUNT(num) as aa FROM ").append(Param.EVENT_DETAIL).append(" WHERE ").append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(eventBaseParam.getSearchBeginTime()))).append("' and ") - .append("time <= '").append(DateUtil.endOfDay(DateUtil.parse(eventBaseParam.getSearchEndTime()))).append("' and "); - stringTotal.append("line_id= '").append(eventBaseParam.getLineId()).append("' tz('Asia/Shanghai')"); - - - //结果集 - QueryResult result = influxDbUtils.query(stringResult.toString()); - //总条数 - QueryResult resultTotal = influxDbUtils.query(stringTotal.toString()); - - //结果集映射到对象中 - InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper(); - eventDetailList = influxDBResultMapper.toPOJO(result, WaveTypeVO.class); - - - //获取关于监测点发电站相关信息 - HttpResult> baseLineAreaInfo = lineFeignClient.getBaseLineAreaInfo(lineIds); - System.out.println(baseLineAreaInfo); - //将返回的封装好的结果集进行还原成集合 - List areaLineList = baseLineAreaInfo.getData(); - - - //将监测点发电机相关信息copy到准备好的VO对象中 - for (WaveTypeVO waveTypeVO : eventDetailList) { - if (waveTypeVO.getLineId() != null) { - for (AreaLineInfoVO lineInfoVO : areaLineList) { - if (waveTypeVO.getLineId().equals(lineInfoVO.getLineId())) { - waveTypeVO.setSubName(lineInfoVO.getSubName()); - waveTypeVO.setLineId(lineInfoVO.getLineId()); - waveTypeVO.setLineName(lineInfoVO.getLineName()); - waveTypeVO.setGdId(lineInfoVO.getGdId()); - waveTypeVO.setGdName(lineInfoVO.getGdName()); - waveTypeVO.setVoltageId(lineInfoVO.getVoltageId()); - waveTypeVO.setNoDealCount(lineInfoVO.getNoDealCount()); - waveTypeVO.setCt1(lineInfoVO.getCt1()); - waveTypeVO.setCt2(lineInfoVO.getCt2()); - waveTypeVO.setPt1(lineInfoVO.getPt1()); - waveTypeVO.setPt2(lineInfoVO.getPt2()); - waveTypeVO.setRunFlag(lineInfoVO.getRunFlag()); - waveTypeVO.setComFlag(lineInfoVO.getComFlag()); - waveTypeVO.setIp(lineInfoVO.getIp()); - waveTypeVO.setLat(lineInfoVO.getLat()); - waveTypeVO.setLng(lineInfoVO.getLng()); - waveTypeVO.setManufacturer(lineInfoVO.getManufacturer()); - waveTypeVO.setVoltageScale(lineInfoVO.getVoltageScale()); - } - } - } else { - //抛出异常,当前监测点id为空 - throw new BusinessException(EventResponseEnum.EVENT_NOT_FOUND); - } - } - - - //使用字典表对暂态类型和暂态原因进行转换 - HttpResult> reason = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.EVENT_REASON.getName()); - HttpResult> type = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.EVENT_TYPE.getName()); - //获取字典数据暂态原因集合 - List eventReasonList = reason.getData(); - //System.out.println(eventReasonList); - //获取字典数据暂态类型集合 - List eventTypeList = type.getData(); - //System.out.println(eventTypeList); - - - //查询字典表替换事件原因与事件类型的字符串 - for (WaveTypeVO eventDetail : eventDetailList) { - if (eventDetail.getEventReason() != null) { - for (DictData dictData : eventReasonList) { - //将字典数据id与VO中属性eventReason对应的字符串进行比较 - if (eventDetail.getEventReason().equals(dictData.getId())) { - eventDetail.setEventReason(dictData.getName()); - break; - } - } - } else { - //抛出异常,当前暂态原因为空 - throw new BusinessException(EventResponseEnum.EVENT_REASON_NOT_FOUND); - } - - if (eventDetail.getEventType() != null) { - for (DictData dictData : eventTypeList) { - //将字典数据id与VO中属性eventType对应的字符串进行比较 - if (eventDetail.getEventType().equals(dictData.getId())) { - eventDetail.setEventType(dictData.getName()); - break; - } - } - } else { - //抛出异常,当前暂态类型为空 - throw new BusinessException(EventResponseEnum.EVENT_TYPE_NOT_FOUND); - } - } - - - Page page = new Page<>(); - long total = eventDetailList.size(); - page.setTotal(total); - page.setRecords(eventDetailList); - page.setCurrent(eventBaseParam.getPageNum()); - page.setSize(eventBaseParam.getPageSize()); - return page; + ); + //获取关于监测点发电站相关信息 + List areaLineList = lineFeignClient.getBaseLineAreaInfo(Arrays.asList(eventBaseParam.getLineId())).getData(); + if(CollectionUtil.isNotEmpty(areaLineList)){ + throw new BusinessException(EventResponseEnum.NOT_FOUND); } + List waveTypeVOS = new ArrayList<>(); + + List records = pageInfo.getRecords(); + WaveTypeVO waveTypeVO; + //将监测点发电机相关信息copy到准备好的VO对象中 + for (RmpEventDetailPO record : records) { + waveTypeVO=BeanUtil.copyProperties(record,WaveTypeVO.class); + if (waveTypeVO.getLineId() != null) { + for (AreaLineInfoVO lineInfoVO : areaLineList) { + if (waveTypeVO.getLineId().equals(lineInfoVO.getLineId())) { + waveTypeVO.setSubName(lineInfoVO.getSubName()); + waveTypeVO.setLineId(lineInfoVO.getLineId()); + waveTypeVO.setLineName(lineInfoVO.getLineName()); + waveTypeVO.setGdId(lineInfoVO.getGdId()); + waveTypeVO.setGdName(lineInfoVO.getGdName()); + waveTypeVO.setVoltageId(lineInfoVO.getVoltageId()); + waveTypeVO.setNoDealCount(lineInfoVO.getNoDealCount()); + waveTypeVO.setCt1(lineInfoVO.getCt1()); + waveTypeVO.setCt2(lineInfoVO.getCt2()); + waveTypeVO.setPt1(lineInfoVO.getPt1()); + waveTypeVO.setPt2(lineInfoVO.getPt2()); + waveTypeVO.setRunFlag(lineInfoVO.getRunFlag()); + waveTypeVO.setComFlag(lineInfoVO.getComFlag()); + waveTypeVO.setIp(lineInfoVO.getIp()); + waveTypeVO.setLat(lineInfoVO.getLat()); + waveTypeVO.setLng(lineInfoVO.getLng()); + waveTypeVO.setManufacturer(lineInfoVO.getManufacturer()); + waveTypeVO.setVoltageScale(lineInfoVO.getVoltageScale()); + waveTypeVOS.add(waveTypeVO); + } + } + } else { + //抛出异常,当前监测点id为空 + throw new BusinessException(EventResponseEnum.EVENT_NOT_FOUND); + } + } + Page page=BeanUtil.copyProperties(pageInfo,Page.class); + page.setRecords(waveTypeVOS); + return page; +// //提前创建结果集合 +// List eventDetailList = new ArrayList<>(); +// +// //创建line_id集合,将入参line_id塞进去 +// List lineIds = new ArrayList<>(); +// lineIds.add(eventBaseParam.getLineId()); +// +// //提前创建total +// StringBuilder stringTotal = new StringBuilder(); +// +// +// //查询参数不为空,进行条件填充 +// if (ObjectUtil.isNotNull(eventBaseParam.getSearchValue())) { +// //查询sql语句 +// StringBuilder stringResult = new StringBuilder(Param.SELECT).append(Param.EVENT_DETAIL).append(Param.WHERE). +// append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(eventBaseParam.getSearchBeginTime()))).append("' and ").append("time <= '").append(DateUtil.endOfDay(DateUtil.parse(eventBaseParam.getSearchEndTime()))).append("' and ") +// .append("line_id= '").append(eventBaseParam.getLineId()).append("'"); +// +// //套用公式(page-1)*pageSize +// int i = (eventBaseParam.getPageNum() - 1) * eventBaseParam.getPageSize(); +// //拼接分页sql +// stringResult.append("LIMIT ").append(eventBaseParam.getPageSize()).append(" OFFSET ").append(i).append(" tz('Asia/Shanghai')"); +// +// +// //查询sql语句总条数 +// stringTotal = new StringBuilder("SELECT COUNT(num) as aa FROM ").append(Param.EVENT_DETAIL).append(" WHERE ").append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(eventBaseParam.getSearchBeginTime()))).append("' and ") +// .append("time <= '").append(DateUtil.endOfDay(DateUtil.parse(eventBaseParam.getSearchEndTime()))).append("' and "); +// stringTotal.append("line_id= '").append(eventBaseParam.getLineId()).append("' tz('Asia/Shanghai')"); +// +// //结果集 +// QueryResult result = influxDbUtils.query(stringResult.toString()); +// //总条数 +// QueryResult resultTotal = influxDbUtils.query(stringTotal.toString()); +// +// //结果集映射到对象中 +// InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper(); +// eventDetailList = influxDBResultMapper.toPOJO(result, WaveTypeVO.class); +// +// +// //获取关于监测点发电站相关信息 +// HttpResult> baseLineAreaInfo = lineFeignClient.getBaseLineAreaInfo(lineIds); +// System.out.println(baseLineAreaInfo); +// //将返回的封装好的结果集进行还原成集合 +// List areaLineList = baseLineAreaInfo.getData(); +// +// +// //将监测点发电机相关信息copy到准备好的VO对象中 +// for (WaveTypeVO waveTypeVO : eventDetailList) { +// if (waveTypeVO.getLineId() != null) { +// for (AreaLineInfoVO lineInfoVO : areaLineList) { +// if (waveTypeVO.getLineId().equals(lineInfoVO.getLineId())) { +// waveTypeVO.setSubName(lineInfoVO.getSubName()); +// waveTypeVO.setLineId(lineInfoVO.getLineId()); +// waveTypeVO.setLineName(lineInfoVO.getLineName()); +// waveTypeVO.setGdId(lineInfoVO.getGdId()); +// waveTypeVO.setGdName(lineInfoVO.getGdName()); +// waveTypeVO.setVoltageId(lineInfoVO.getVoltageId()); +// waveTypeVO.setNoDealCount(lineInfoVO.getNoDealCount()); +// waveTypeVO.setCt1(lineInfoVO.getCt1()); +// waveTypeVO.setCt2(lineInfoVO.getCt2()); +// waveTypeVO.setPt1(lineInfoVO.getPt1()); +// waveTypeVO.setPt2(lineInfoVO.getPt2()); +// waveTypeVO.setRunFlag(lineInfoVO.getRunFlag()); +// waveTypeVO.setComFlag(lineInfoVO.getComFlag()); +// waveTypeVO.setIp(lineInfoVO.getIp()); +// waveTypeVO.setLat(lineInfoVO.getLat()); +// waveTypeVO.setLng(lineInfoVO.getLng()); +// waveTypeVO.setManufacturer(lineInfoVO.getManufacturer()); +// waveTypeVO.setVoltageScale(lineInfoVO.getVoltageScale()); +// } +// } +// } else { +// //抛出异常,当前监测点id为空 +// throw new BusinessException(EventResponseEnum.EVENT_NOT_FOUND); +// } +// } +// +// //使用字典表对暂态类型和暂态原因进行转换 +// HttpResult> reason = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.EVENT_REASON.getName()); +// HttpResult> type = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.EVENT_TYPE.getName()); +// //获取字典数据暂态原因集合 +// List eventReasonList = reason.getData(); +// //System.out.println(eventReasonList); +// //获取字典数据暂态类型集合 +// List eventTypeList = type.getData(); +// //System.out.println(eventTypeList); +// +// +// //查询字典表替换事件原因与事件类型的字符串 +// for (WaveTypeVO eventDetail : eventDetailList) { +// if (eventDetail.getEventReason() != null) { +// for (DictData dictData : eventReasonList) { +// //将字典数据id与VO中属性eventReason对应的字符串进行比较 +// if (eventDetail.getEventReason().equals(dictData.getId())) { +// eventDetail.setEventReason(dictData.getName()); +// } +// } +// } else { +// //抛出异常,当前暂态原因为空 +// throw new BusinessException(EventResponseEnum.EVENT_REASON_NOT_FOUND); +// } +// } +// +// for (WaveTypeVO eventDetail : eventDetailList) { +// if (eventDetail.getEventType() != null) { +// for (DictData dictData : eventTypeList) { +// //将字典数据id与VO中属性eventType对应的字符串进行比较 +// if (eventDetail.getEventType().equals(dictData.getId())) { +// eventDetail.setEventType(dictData.getName()); +// } +// } +// } else { +// //抛出异常,当前暂态类型为空 +// throw new BusinessException(EventResponseEnum.EVENT_TYPE_NOT_FOUND); +// } +// } +// Page page = new Page<>(); +// page.setTotal(eventDetailList.size()); +// page.setRecords(eventDetailList); +// page.setCurrent(eventBaseParam.getPageNum()); +// page.setSize(eventBaseParam.getPageSize()); +// return page; +// +// +// } else { +// StringBuilder stringResult = new StringBuilder(Param.SELECT).append(Param.EVENT_DETAIL).append(Param.WHERE). +// append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(eventBaseParam.getSearchBeginTime()))).append("' and ").append("time <= '").append(DateUtil.endOfDay(DateUtil.parse(eventBaseParam.getSearchEndTime()))).append("' and ") +// .append("line_id= '").append(eventBaseParam.getLineId()).append("'"); +// +// +// int i = (eventBaseParam.getPageNum() - 1) * eventBaseParam.getPageSize(); +// +// stringResult.append("LIMIT ").append(eventBaseParam.getPageSize()).append(" OFFSET ").append(i).append(" tz('Asia/Shanghai')"); +// +// //查询sql语句总条数 +// stringTotal = new StringBuilder("SELECT COUNT(num) as aa FROM ").append(Param.EVENT_DETAIL).append(" WHERE ").append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(eventBaseParam.getSearchBeginTime()))).append("' and ") +// .append("time <= '").append(DateUtil.endOfDay(DateUtil.parse(eventBaseParam.getSearchEndTime()))).append("' and "); +// stringTotal.append("line_id= '").append(eventBaseParam.getLineId()).append("' tz('Asia/Shanghai')"); +// +// +// //结果集 +// QueryResult result = influxDbUtils.query(stringResult.toString()); +// //总条数 +// QueryResult resultTotal = influxDbUtils.query(stringTotal.toString()); +// +// //结果集映射到对象中 +// InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper(); +// eventDetailList = influxDBResultMapper.toPOJO(result, WaveTypeVO.class); +// +// +// //获取关于监测点发电站相关信息 +// HttpResult> baseLineAreaInfo = lineFeignClient.getBaseLineAreaInfo(lineIds); +// System.out.println(baseLineAreaInfo); +// //将返回的封装好的结果集进行还原成集合 +// List areaLineList = baseLineAreaInfo.getData(); +// +// +// //将监测点发电机相关信息copy到准备好的VO对象中 +// for (WaveTypeVO waveTypeVO : eventDetailList) { +// if (waveTypeVO.getLineId() != null) { +// for (AreaLineInfoVO lineInfoVO : areaLineList) { +// if (waveTypeVO.getLineId().equals(lineInfoVO.getLineId())) { +// waveTypeVO.setSubName(lineInfoVO.getSubName()); +// waveTypeVO.setLineId(lineInfoVO.getLineId()); +// waveTypeVO.setLineName(lineInfoVO.getLineName()); +// waveTypeVO.setGdId(lineInfoVO.getGdId()); +// waveTypeVO.setGdName(lineInfoVO.getGdName()); +// waveTypeVO.setVoltageId(lineInfoVO.getVoltageId()); +// waveTypeVO.setNoDealCount(lineInfoVO.getNoDealCount()); +// waveTypeVO.setCt1(lineInfoVO.getCt1()); +// waveTypeVO.setCt2(lineInfoVO.getCt2()); +// waveTypeVO.setPt1(lineInfoVO.getPt1()); +// waveTypeVO.setPt2(lineInfoVO.getPt2()); +// waveTypeVO.setRunFlag(lineInfoVO.getRunFlag()); +// waveTypeVO.setComFlag(lineInfoVO.getComFlag()); +// waveTypeVO.setIp(lineInfoVO.getIp()); +// waveTypeVO.setLat(lineInfoVO.getLat()); +// waveTypeVO.setLng(lineInfoVO.getLng()); +// waveTypeVO.setManufacturer(lineInfoVO.getManufacturer()); +// waveTypeVO.setVoltageScale(lineInfoVO.getVoltageScale()); +// } +// } +// } else { +// //抛出异常,当前监测点id为空 +// throw new BusinessException(EventResponseEnum.EVENT_NOT_FOUND); +// } +// } +// +// +// //使用字典表对暂态类型和暂态原因进行转换 +// HttpResult> reason = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.EVENT_REASON.getName()); +// HttpResult> type = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.EVENT_TYPE.getName()); +// //获取字典数据暂态原因集合 +// List eventReasonList = reason.getData(); +// //System.out.println(eventReasonList); +// //获取字典数据暂态类型集合 +// List eventTypeList = type.getData(); +// //System.out.println(eventTypeList); +// +// +// //查询字典表替换事件原因与事件类型的字符串 +// for (WaveTypeVO eventDetail : eventDetailList) { +// if (eventDetail.getEventReason() != null) { +// for (DictData dictData : eventReasonList) { +// //将字典数据id与VO中属性eventReason对应的字符串进行比较 +// if (eventDetail.getEventReason().equals(dictData.getId())) { +// eventDetail.setEventReason(dictData.getName()); +// break; +// } +// } +// } else { +// //抛出异常,当前暂态原因为空 +// throw new BusinessException(EventResponseEnum.EVENT_REASON_NOT_FOUND); +// } +// +// if (eventDetail.getEventType() != null) { +// for (DictData dictData : eventTypeList) { +// //将字典数据id与VO中属性eventType对应的字符串进行比较 +// if (eventDetail.getEventType().equals(dictData.getId())) { +// eventDetail.setEventType(dictData.getName()); +// break; +// } +// } +// } else { +// //抛出异常,当前暂态类型为空 +// throw new BusinessException(EventResponseEnum.EVENT_TYPE_NOT_FOUND); +// } +// } +// +// +// Page page = new Page<>(); +// long total = eventDetailList.size(); +// page.setTotal(total); +// page.setRecords(eventDetailList); +// page.setCurrent(eventBaseParam.getPageNum()); +// page.setSize(eventBaseParam.getPageSize()); +// return page; +// } } @@ -1782,11 +1856,11 @@ public class EventAnalysisServiceImpl implements EventAnalysisService { //根据监测点id获取监测点详情 LineDetailDataVO lineDetailData = lineFeignClient.getLineDetailData(lineId.get(i)).getData(); EventDetail eventDetailByTime = eventDetailService.getEventDetailByTime(lineId.get(i), timeId.get(i)); - if (Objects.isNull(lineDetailData.getIp()) && Objects.isNull(eventDetailByTime.getWaveName())) { + if (Objects.isNull(lineDetailData.getIp()) && Objects.isNull(eventDetailByTime.getWavePath())) { throw new BusinessException(EventResponseEnum.EVENT_NOT_FOUND); } String ip = lineDetailData.getIp(); - String waveName = eventDetailByTime.getWaveName(); + String waveName = eventDetailByTime.getWavePath(); // TODO 1 File srcCFGFile = new File(generalInfo.getBusinessWavePath() + File.separator + ip + File.separator + waveName + ".CFG"); diff --git a/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/EventDetailServiceImpl.java b/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/EventDetailServiceImpl.java index e45ddeab0..347cd1bd5 100644 --- a/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/EventDetailServiceImpl.java +++ b/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/EventDetailServiceImpl.java @@ -1,6 +1,10 @@ package com.njcn.event.service.majornetwork.Impl; +import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.njcn.event.mapper.majornetwork.EventDetailMapper; import com.njcn.event.pojo.po.EventDetail; @@ -32,18 +36,26 @@ public class EventDetailServiceImpl extends ServiceImpl getEventDetailData(String id, String startTime, String endTime) { - //组装sql语句 - StringBuilder stringBuilder = new StringBuilder(); - stringBuilder.append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(startTime))).append("' and ").append("time <= '").append(DateUtil.endOfDay(DateUtil.parse(endTime))).append("' and "); - //sql语句 - stringBuilder.append("line_id ='").append(id).append("'").append(" tz('Asia/Shanghai')"); + //数据暂降查询 + List info = this.list(new LambdaQueryWrapper() + .eq(RmpEventDetailPO::getMeasurementPointId, id) + .ge(StrUtil.isNotBlank(startTime), RmpEventDetailPO::getStartTime,DateUtil.beginOfDay(DateUtil.parse(startTime))) + .le(StrUtil.isNotBlank(endTime), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(endTime))) + ); + return BeanUtil.copyToList(info, EventDetail.class); - String sql = "select * from pqs_eventdetail where " + stringBuilder; - //获取暂降事件 - QueryResult result = influxDbUtils.query(sql); - InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper(); - List eventDetailList = influxDBResultMapper.toPOJO(result, EventDetail.class); - return eventDetailList; +// //组装sql语句 +// StringBuilder stringBuilder = new StringBuilder(); +// stringBuilder.append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(startTime))).append("' and ").append("time <= '").append(DateUtil.endOfDay(DateUtil.parse(endTime))).append("' and "); +// //sql语句 +// stringBuilder.append("line_id ='").append(id).append("'").append(" tz('Asia/Shanghai')"); +// +// String sql = "select * from pqs_eventdetail where " + stringBuilder; +// //获取暂降事件 +// QueryResult result = influxDbUtils.query(sql); +// InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper(); +// List eventDetailList = influxDBResultMapper.toPOJO(result, EventDetail.class); +// return eventDetailList; } @Override @@ -99,38 +111,47 @@ public class EventDetailServiceImpl extends ServiceImpl getEventDetailLimit(List lineIndexes, String startTime, String endTime, Integer pageSize, Integer pageNum, List waveType) { - //组装sql语句 - StringBuilder stringBuilder = new StringBuilder(); - stringBuilder.append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(startTime))).append("' and ").append("time <= '").append(DateUtil.endOfDay(DateUtil.parse(endTime))).append("' and ("); - for (int i = 0; i < lineIndexes.size(); i++) { - if (lineIndexes.size() - i != 1) { - stringBuilder.append("line_id ='").append(lineIndexes.get(i)).append("' or "); - } else { - stringBuilder.append("line_id ='").append(lineIndexes.get(i)).append("' "); - } - } - stringBuilder.append(") and ("); - for (int i = 0; i < waveType.size(); i++) { - if (waveType.size() - i != 1) { - stringBuilder.append("wave_type ='").append(waveType.get(i)).append("' or "); - } else { - stringBuilder.append("wave_type ='").append(waveType.get(i)).append("' "); - } - } - stringBuilder.append(") order by time desc"); - int i = (pageNum - 1)*pageSize; - stringBuilder.append(" LIMIT ").append(pageSize).append(" OFFSET ").append(i).append(" tz('Asia/Shanghai')"); - //sql语句 - String sql = "SELECT * FROM pqs_eventdetail WHERE " + stringBuilder; - System.out.println(sql); - //结果集 - QueryResult result = influxDbUtils.query(sql); - //结果集映射到对象中 - InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper(); - List eventDetailList = influxDBResultMapper.toPOJO(result, EventDetail.class); + public List getEventDetailLimit(List lineIndexes, String startTime, String endTime, Integer pageSize, Integer pageNum, List waveType) { - return eventDetailList; + Page pageInfo = this.page(new Page<>(pageNum, pageSize), new LambdaQueryWrapper() + .in(RmpEventDetailPO::getMeasurementPointId, lineIndexes) + .ge(StrUtil.isNotBlank(startTime), RmpEventDetailPO::getStartTime,DateUtil.beginOfDay(DateUtil.parse(startTime))) + .le(StrUtil.isNotBlank(endTime), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(endTime))) + ); + + return BeanUtil.copyToList(pageInfo.getRecords(), EventDetail.class); + +// //组装sql语句 +// StringBuilder stringBuilder = new StringBuilder(); +// stringBuilder.append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(startTime))).append("' and ").append("time <= '").append(DateUtil.endOfDay(DateUtil.parse(endTime))).append("' and ("); +// for (int i = 0; i < lineIndexes.size(); i++) { +// if (lineIndexes.size() - i != 1) { +// stringBuilder.append("line_id ='").append(lineIndexes.get(i)).append("' or "); +// } else { +// stringBuilder.append("line_id ='").append(lineIndexes.get(i)).append("' "); +// } +// } +// stringBuilder.append(") and ("); +// for (int i = 0; i < waveType.size(); i++) { +// if (waveType.size() - i != 1) { +// stringBuilder.append("wave_type ='").append(waveType.get(i)).append("' or "); +// } else { +// stringBuilder.append("wave_type ='").append(waveType.get(i)).append("' "); +// } +// } +// stringBuilder.append(") order by time desc"); +// int i = (pageNum - 1)*pageSize; +// stringBuilder.append(" LIMIT ").append(pageSize).append(" OFFSET ").append(i).append(" tz('Asia/Shanghai')"); +// //sql语句 +// String sql = "SELECT * FROM pqs_eventdetail WHERE " + stringBuilder; +// System.out.println(sql); +// //结果集 +// QueryResult result = influxDbUtils.query(sql); +// //结果集映射到对象中 +// InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper(); +// List eventDetailList = influxDBResultMapper.toPOJO(result, EventDetail.class); +// +// return eventDetailList; } } diff --git a/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/EventDistributionStatisticsServiceImpl.java b/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/EventDistributionStatisticsServiceImpl.java index 839234dec..9b5aa9cee 100644 --- a/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/EventDistributionStatisticsServiceImpl.java +++ b/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/EventDistributionStatisticsServiceImpl.java @@ -325,8 +325,8 @@ public class EventDistributionStatisticsServiceImpl implements EventDistribution eventFeatureAmplitudeCurve.setFeatureAmplitude(dto.getFeatureAmplitude()); eventFeatureAmplitudeCurve.setDuration(dto.getDuration()); - eventFeatureAmplitudeCurve.setStartTime(LocalDateTime.ofInstant(dto.getStartTime().toInstant(), ZoneId.systemDefault())); - +// eventFeatureAmplitudeCurve.setStartTime(LocalDateTime.ofInstant(dto.getStartTime().toInstant(), ZoneId.systemDefault())); + eventFeatureAmplitudeCurve.setStartTime(LocalDateTime.parse( dto.getStartTime())); return eventFeatureAmplitudeCurve; }) //.sorted(VoltageToleranceCurveDataList.sortAscTime()) diff --git a/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/EventReportServiceImpl.java b/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/EventReportServiceImpl.java index 952559ded..3d45b8fb6 100644 --- a/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/EventReportServiceImpl.java +++ b/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/EventReportServiceImpl.java @@ -46,8 +46,8 @@ public class EventReportServiceImpl implements EventReportService { } } for (int i = 0; i < info.size(); i++) { - Double eventvalue = info.get(i).getEventValue(); - double persisttime = info.get(i).getPersistTime(); + Double eventvalue = info.get(i).getFeatureAmplitude(); + double persisttime = info.get(i).getDuration(); if (eventvalue * 100 < 10) { if (persisttime < 20) { arr[4][0]++; @@ -158,8 +158,8 @@ public class EventReportServiceImpl implements EventReportService { } } for (int i = 0; i < info.size(); i++) { - Double eventvalue = info.get(i).getEventValue(); - double persisttime = info.get(i).getPersistTime(); + Double eventvalue = info.get(i).getFeatureAmplitude(); + double persisttime = info.get(i).getDuration(); if (eventvalue * 100 < 1) { if (persisttime < 20 && persisttime >= 10) { arr[2][0]++; @@ -220,8 +220,8 @@ public class EventReportServiceImpl implements EventReportService { } } for (int i = 0; i < info.size(); i++) { - Double eventvalue = info.get(i).getEventValue(); - double persisttime = info.get(i).getPersistTime(); + 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]++; @@ -559,7 +559,7 @@ public class EventReportServiceImpl implements EventReportService { Integer count = 0; for (EventDetail eventDetail : info2) { //过滤掉大于0.9的数据 - if (eventDetail.getEventValue() <= 0.9) { + if (eventDetail.getFeatureAmplitude() <= 0.9) { count++; info.add(eventDetail); } @@ -588,53 +588,53 @@ public class EventReportServiceImpl implements EventReportService { subsectionMap.put("80~90", 0); //求数量 for (EventDetail eventDetail : info) { - if (eventDetail.getEventValue() < 0.1) { + if (eventDetail.getFeatureAmplitude() < 0.1) { countMap.put("<10", (countMap.get("<10") + 1)); } - if (eventDetail.getEventValue() < 0.2) { + if (eventDetail.getFeatureAmplitude() < 0.2) { countMap.put("<20", (countMap.get("<20") + 1)); } - if (eventDetail.getEventValue() < 0.3) { + if (eventDetail.getFeatureAmplitude() < 0.3) { countMap.put("<30", (countMap.get("<30") + 1)); } - if (eventDetail.getEventValue() < 0.4) { + if (eventDetail.getFeatureAmplitude() < 0.4) { countMap.put("<40", (countMap.get("<40") + 1)); } - if (eventDetail.getEventValue() < 0.5) { + if (eventDetail.getFeatureAmplitude() < 0.5) { countMap.put("<50", (countMap.get("<50") + 1)); } - if (eventDetail.getEventValue() < 0.6) { + if (eventDetail.getFeatureAmplitude() < 0.6) { countMap.put("<60", (countMap.get("<60") + 1)); } - if (eventDetail.getEventValue() < 0.7) { + if (eventDetail.getFeatureAmplitude() < 0.7) { countMap.put("<70", (countMap.get("<70") + 1)); } - if (eventDetail.getEventValue() < 0.8) { + if (eventDetail.getFeatureAmplitude() < 0.8) { countMap.put("<80", (countMap.get("<80") + 1)); } - if (eventDetail.getEventValue() < 0.9) { + if (eventDetail.getFeatureAmplitude() < 0.9) { countMap.put("<90", (countMap.get("<90") + 1)); } } //求每段数量 for (EventDetail eventDetail : info) { - if (eventDetail.getEventValue() < 0.1) { + if (eventDetail.getFeatureAmplitude() < 0.1) { subsectionMap.put("0~10", (subsectionMap.get("0~10") + 1)); - } else if (eventDetail.getEventValue() > 0.1 && eventDetail.getEventValue() < 0.2) { + } else if (eventDetail.getFeatureAmplitude() > 0.1 && eventDetail.getFeatureAmplitude() < 0.2) { subsectionMap.put("10~20", (subsectionMap.get("10~20") + 1)); - } else if (eventDetail.getEventValue() > 0.2 && eventDetail.getEventValue() < 0.3) { + } else if (eventDetail.getFeatureAmplitude() > 0.2 && eventDetail.getFeatureAmplitude() < 0.3) { subsectionMap.put("20~30", (subsectionMap.get("20~30") + 1)); - } else if (eventDetail.getEventValue() > 0.3 && eventDetail.getEventValue() < 0.4) { + } else if (eventDetail.getFeatureAmplitude() > 0.3 && eventDetail.getFeatureAmplitude() < 0.4) { subsectionMap.put("30~40", (subsectionMap.get("30~40") + 1)); - } else if (eventDetail.getEventValue() > 0.4 && eventDetail.getEventValue() < 0.5) { + } else if (eventDetail.getFeatureAmplitude() > 0.4 && eventDetail.getFeatureAmplitude() < 0.5) { subsectionMap.put("40~50", (subsectionMap.get("40~50") + 1)); - } else if (eventDetail.getEventValue() > 0.5 && eventDetail.getEventValue() < 0.6) { + } else if (eventDetail.getFeatureAmplitude() > 0.5 && eventDetail.getFeatureAmplitude() < 0.6) { subsectionMap.put("50~60", (subsectionMap.get("50~60") + 1)); - } else if (eventDetail.getEventValue() > 0.6 && eventDetail.getEventValue() < 0.7) { + } else if (eventDetail.getFeatureAmplitude() > 0.6 && eventDetail.getFeatureAmplitude() < 0.7) { subsectionMap.put("60~70", (subsectionMap.get("60~70") + 1)); - } else if (eventDetail.getEventValue() > 0.7 && eventDetail.getEventValue() < 0.8) { + } else if (eventDetail.getFeatureAmplitude() > 0.7 && eventDetail.getFeatureAmplitude() < 0.8) { subsectionMap.put("70~80", (subsectionMap.get("70~80") + 1)); - } else if (eventDetail.getEventValue() > 0.8 && eventDetail.getEventValue() < 0.9) { + } else if (eventDetail.getFeatureAmplitude() > 0.8 && eventDetail.getFeatureAmplitude() < 0.9) { subsectionMap.put("80~90", (subsectionMap.get("80~90") + 1)); } } @@ -712,7 +712,7 @@ public class EventReportServiceImpl implements EventReportService { timeMap.put("<180", 0); //求不同时间段的总数 for (EventDetail eventDetail : info) { - Double persistTime = eventDetail.getPersistTime(); + 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) { @@ -773,7 +773,7 @@ public class EventReportServiceImpl implements EventReportService { //求sisttime List sisttime = new ArrayList<>(); for (EventDetail eventDetail : info) { - Double persistTime = eventDetail.getPersistTime(); + Double persistTime = eventDetail.getDuration(); if (persistTime / 1000 < 0.1) { timeMap2.put("<0.1", timeMap2.get("<0.1") + 1); } @@ -850,7 +850,7 @@ public class EventReportServiceImpl implements EventReportService { query = MonitorQuery(new StatisticsParam(statisticsParam.getLineIndex(),builder1.toString(), builder2.toString(), statisticsParam.getFlag())); InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper(); List eventDetailList = influxDBResultMapper.toPOJO(query, EventDetail.class); - long count = eventDetailList.stream().filter(x -> x.getWaveType() == 1).count(); + long count = eventDetailList.stream().filter(x -> x.getEventType() == "1").count(); if (startMonth < 10) { list.add(new TimeVO(null, null,"", "0" + startMonth.toString(), count+"", startYear.toString(), startYear.toString()+"-"+"0"+startMonth.toString())); } else { @@ -869,7 +869,7 @@ public class EventReportServiceImpl implements EventReportService { 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(); + long count1 = eventDetailList.stream().filter(x -> x.getEventType() == "1").count(); if (startMonth < 10) { list.add(new TimeVO(null, null,"", "0" + startMonth.toString(), count1+"", startYear.toString(), startYear.toString()+"-"+"0"+startMonth.toString())); } else { @@ -882,7 +882,7 @@ public class EventReportServiceImpl implements EventReportService { InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper(); List eventDetailList = influxDBResultMapper.toPOJO(monitorQuery, EventDetailNew.class); - Map> map = eventDetailList.stream().filter(x -> x.getWaveType()=="1").collect(Collectors.groupingBy(s -> s.getTimeId().substring(0, 10))); + Map> map = eventDetailList.stream().filter(x -> x.getEventType()=="1").collect(Collectors.groupingBy(s -> s.getStartTime().substring(0, 10))); Set keySet = map.keySet(); LocalDate parse1 = LocalDate.parse(startTime); @@ -938,13 +938,13 @@ public class EventReportServiceImpl implements EventReportService { //添加detail for (EventDetail detail : info) { for (DictData data : reasonData) { - if (detail.getEventReason().equals(data.getId())) { - detail.setEventReason(data.getName()); + if (detail.getAdvanceReason().equals(data.getId())) { + detail.setAdvanceReason(data.getName()); } } for (DictData data : typeData) { - if (detail.getEventType().equals(data.getId())) { - detail.setEventType(data.getName()); + if (detail.getAdvanceType().equals(data.getId())) { + detail.setAdvanceType(data.getName()); } } } @@ -964,14 +964,14 @@ public class EventReportServiceImpl implements EventReportService { for (EventDetail detail : info) { for (DictData data : reasonData) { reasonMap.put(data.getName(),0); - if (detail.getEventReason().equals(data.getId())) { - detail.setEventReason(data.getName()); + if (detail.getAdvanceReason().equals(data.getId())) { + detail.setAdvanceReason(data.getName()); } } for (DictData data : typeData) { typeMap.put(data.getName(),0); - if (detail.getEventType().equals(data.getId())) { - detail.setEventType(data.getName()); + if (detail.getAdvanceType().equals(data.getId())) { + detail.setAdvanceType(data.getName()); } } list.add(detail); @@ -979,14 +979,14 @@ public class EventReportServiceImpl implements EventReportService { //添加reason到map for (EventDetail data : list) { - if (reasonMap.get(data.getEventReason()) != null) { - reasonMap.put(data.getEventReason(), reasonMap.get(data.getEventReason()) + 1); + 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.getEventType()) != null) { - typeMap.put(data.getEventType(), typeMap.get(data.getEventType()) + 1); + if (typeMap.get(data.getAdvanceType()) != null) { + typeMap.put(data.getAdvanceType(), typeMap.get(data.getAdvanceType()) + 1); } } Set reasonKeyset = reasonMap.keySet(); diff --git a/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/LargeScreenServiceImpl.java b/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/LargeScreenServiceImpl.java new file mode 100644 index 000000000..745ee2fac --- /dev/null +++ b/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/LargeScreenServiceImpl.java @@ -0,0 +1,100 @@ +package com.njcn.event.service.majornetwork.Impl; + +import com.njcn.common.pojo.dto.SimpleDTO; +import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO; +import com.njcn.device.pq.pojo.param.DeviceInfoParam; +import com.njcn.device.pq.pojo.param.LargeScreenParam; +import com.njcn.device.pq.pojo.param.MonitoringPointScaleParam; +import com.njcn.device.pq.pojo.vo.AreaDownVO; +import com.njcn.device.pq.pojo.vo.MonitoringPointScaleVO; +import com.njcn.event.mapper.majornetwork.LargeScreenMapper; +import com.njcn.event.service.majornetwork.LargeScreenService; +import com.njcn.system.pojo.enums.StatisticsEnum; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import com.njcn.device.pq.api.GeneralDeviceInfoClient; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +/** + * @version 1.0.0 + * @author: zbj + * @date: 2023/03/31 + */ +@Slf4j +@Service +@RequiredArgsConstructor +public class LargeScreenServiceImpl implements LargeScreenService { + + private final GeneralDeviceInfoClient generalDeviceInfoClient; + + private final LargeScreenMapper largeScreenMapper; + + /** + * 区域暂降统计 + */ + @Override + public AreaDownVO getAreaDownStatistics(LargeScreenParam largeScreenParam) { + //创建返回VO + AreaDownVO result = new AreaDownVO(); + ArrayList list = new ArrayList<>(); + DeviceInfoParam.BusinessParam deviceInfoParam = new DeviceInfoParam.BusinessParam(); + //部门索引 + deviceInfoParam.setDeptIndex(largeScreenParam.getDeptIndex()); + //统计类型 + SimpleDTO simpleDTO = new SimpleDTO(); + simpleDTO.setCode(String.valueOf(StatisticsEnum.POWER_NETWORK)); + deviceInfoParam.setStatisticalType(simpleDTO); + //添加时间 + deviceInfoParam.setSearchBeginTime(largeScreenParam.getSearchBeginTime()); + deviceInfoParam.setSearchEndTime(largeScreenParam.getSearchEndTime()); + //添加服务名 + deviceInfoParam.setServerName("event-boot"); + // 获取所有数据 + List generalDeviceDTOList = generalDeviceInfoClient.getPracticalAllDeviceInfo(deviceInfoParam).getData(); + + for (GeneralDeviceDTO generalDeviceDTO : generalDeviceDTOList) { + if (generalDeviceDTO.getLineIndexes().size() == 0){ + MonitoringPointScaleParam param = new MonitoringPointScaleParam(); + param.setName(generalDeviceDTO.getName()); + param.setIndex(generalDeviceDTO.getIndex()); + param.setCount(0); + list.add(param); + }else{ + Map map = largeScreenMapper.selectDownCount(generalDeviceDTO.getLineIndexes(),largeScreenParam.getSearchBeginTime(), largeScreenParam.getSearchEndTime()); + MonitoringPointScaleParam param = new MonitoringPointScaleParam(); + param.setName(generalDeviceDTO.getName()); + param.setIndex(generalDeviceDTO.getIndex()); + String s = map.get("count").toString(); + int count = Integer.parseInt(s); + param.setCount(count); + list.add(param); + } + } + result.setParam(list); + return result; + /* //获取所有监测点集合 + List lineIds = generalDeviceDTOList.stream().flatMap(dto -> dto.getLineIndexes().stream()).collect(Collectors.toList()); + List> maps = largeScreenMapper.selectDownCount(lineIds); + + Map countMap = new HashMap<>(); + for (Map map : maps) { + for (GeneralDeviceDTO generalDeviceDTO : generalDeviceDTOList) { + for (String lineIndex : generalDeviceDTO.getLineIndexes()) { + if (map.get("id").equals(lineIndex)){ + if(countMap.containsKey(generalDeviceDTO.getName())){ + countMap.put(generalDeviceDTO.getName(),countMap.get(generalDeviceDTO.getName())+1); + break; + }else { + countMap.put(generalDeviceDTO.getName(),1); + break; + } + } + } + } + }*/ + + } +} diff --git a/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/ReportServiceImpl.java b/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/ReportServiceImpl.java index 2a21afb99..49ad27b76 100644 --- a/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/ReportServiceImpl.java +++ b/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/ReportServiceImpl.java @@ -1,7 +1,11 @@ package com.njcn.event.service.majornetwork.Impl; +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; import cn.hutool.json.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.date.DateUtil; @@ -41,8 +45,10 @@ import com.njcn.event.pojo.param.*; import com.njcn.event.pojo.po.EventDetail; import com.njcn.event.pojo.po.EventDetailNew; import com.njcn.event.pojo.po.Eventass; +import com.njcn.event.pojo.po.RmpEventDetailPO; import com.njcn.event.pojo.vo.*; import com.njcn.event.service.majornetwork.EventAnalysisService; +import com.njcn.event.service.majornetwork.EventDetailService; import com.njcn.event.service.majornetwork.EventReportService; import com.njcn.event.service.majornetwork.ReportService; import com.njcn.event.utils.EchartsUtil; @@ -61,6 +67,7 @@ import com.njcn.user.api.DeptFeignClient; import freemarker.template.TemplateException; import lombok.RequiredArgsConstructor; import net.sf.json.JSONArray; +import org.apache.commons.lang.StringUtils; import org.apache.poi.hssf.usermodel.*; import org.apache.poi.openxml4j.exceptions.InvalidFormatException; import org.apache.poi.ss.usermodel.ClientAnchor; @@ -124,51 +131,79 @@ public class ReportServiceImpl implements ReportService { private final PmsGeneralDeviceInfoClient pmsGeneralDeviceInfoClient; private final MonitorClient monitorClient; + private final EventDetailService eventDetailService; public List getED(DeviceInfoParam.BusinessParam businessParam) { List info = new ArrayList<>(); - QueryResult queryResult = new QueryResult(); - List ids = new ArrayList<>(); List deviceDTOList = generalDeviceInfoClient.getPracticalAllDeviceInfo(businessParam).getData(); - List> collect = deviceDTOList.stream().map(x -> x.getLineIndexes()).collect(Collectors.toList()); - collect.stream().forEach(a -> a.forEach(x -> ids.add(x))); - StringBuilder stringBuilder = new StringBuilder(Param.SELECT + Param.EVENT_DETAIL); - stringBuilder.append(Param.WHERE); - for (String id : ids) { - stringBuilder.append("line_id = '").append(id + "' ").append("or "); + List lineIds = deviceDTOList.stream().flatMap(dto -> dto.getLineIndexes().stream()).collect(Collectors.toList()); + if(CollectionUtil.isNotEmpty(lineIds)){ + //数据暂降查询 + List eventDetails = eventDetailService.list(new LambdaQueryWrapper() + .in(RmpEventDetailPO::getMeasurementPointId, lineIds) + .ge(StrUtil.isNotBlank(businessParam.getSearchBeginTime()), RmpEventDetailPO::getStartTime,DateUtil.beginOfDay(DateUtil.parse(businessParam.getSearchBeginTime()))) + .le(StrUtil.isNotBlank(businessParam.getSearchEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(businessParam.getSearchEndTime()))) + ); + info = BeanUtil.copyToList(eventDetails, EventDetail.class); + }else{ + throw new BusinessException(DeviceResponseEnum.DEPT_LINE_EMPTY); } - String substring = stringBuilder.substring(0, stringBuilder.length() - 3); - queryResult = influxDbUtils.query(substring.toString()); - //结果集映射到对象中 - InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper(); - List eventDetailList = influxDBResultMapper.toPOJO(queryResult, EventDetail.class); - eventDetailList.stream().forEach(a -> { - info.add(a); - }); + +// QueryResult queryResult = new QueryResult(); +// List ids = new ArrayList<>(); +// List deviceDTOList = generalDeviceInfoClient.getPracticalAllDeviceInfo(businessParam).getData(); +// List> collect = deviceDTOList.stream().map(x -> x.getLineIndexes()).collect(Collectors.toList()); +// collect.stream().forEach(a -> a.forEach(x -> ids.add(x))); +// StringBuilder stringBuilder = new StringBuilder(Param.SELECT + Param.EVENT_DETAIL); +// stringBuilder.append(Param.WHERE); +// for (String id : ids) { +// stringBuilder.append("line_id = '").append(id + "' ").append("or "); +// } +// String substring = stringBuilder.substring(0, stringBuilder.length() - 3); +// queryResult = influxDbUtils.query(substring.toString()); +// //结果集映射到对象中 +// InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper(); +// List eventDetailList = influxDBResultMapper.toPOJO(queryResult, EventDetail.class); +// eventDetailList.stream().forEach(a -> { +// info.add(a); +// }); return info; } public List getED2(DeviceInfoParam.BusinessParam businessParam) { List info = new ArrayList<>(); - QueryResult queryResult = new QueryResult(); List deviceDTOList = generalDeviceInfoClient.getPracticalAllDeviceInfo(businessParam).getData(); - for (GeneralDeviceDTO dto : deviceDTOList) { - StringBuilder stringBuilder = new StringBuilder(Param.SELECT + Param.EVENT_DETAIL); - if (dto.getLineIndexes().size() > 0) { - stringBuilder.append(Param.WHERE); - dto.getLineIndexes().stream().forEach(line -> { - stringBuilder.append("line_id = '").append(line + "' ").append("or "); - }); - String substring = stringBuilder.substring(0, stringBuilder.length() - 3); - queryResult = influxDbUtils.query(substring.toString()); - //结果集映射到对象中 - InfluxDBResultMapperCn influxDBResultMapper = new InfluxDBResultMapperCn(); - List eventDetailList = influxDBResultMapper.toPOJO(queryResult, EventDetailNew.class); - eventDetailList.stream().forEach(a -> { - info.add(a); - }); - } + List lineIds = deviceDTOList.stream().flatMap(dto -> dto.getLineIndexes().stream()).collect(Collectors.toList()); + if(CollectionUtil.isNotEmpty(lineIds)){ + //数据暂降查询 + List eventDetails = eventDetailService.list(new LambdaQueryWrapper() + .in(RmpEventDetailPO::getMeasurementPointId, lineIds) + .ge(StrUtil.isNotBlank(businessParam.getSearchBeginTime()), RmpEventDetailPO::getStartTime,DateUtil.beginOfDay(DateUtil.parse(businessParam.getSearchBeginTime()))) + .le(StrUtil.isNotBlank(businessParam.getSearchEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(businessParam.getSearchEndTime()))) + ); + info = BeanUtil.copyToList(eventDetails, EventDetailNew.class); + }else{ + throw new BusinessException(DeviceResponseEnum.DEPT_LINE_EMPTY); } + +// QueryResult queryResult = new QueryResult(); +// for (GeneralDeviceDTO dto : deviceDTOList) { +// StringBuilder stringBuilder = new StringBuilder(Param.SELECT + Param.EVENT_DETAIL); +// if (dto.getLineIndexes().size() > 0) { +// stringBuilder.append(Param.WHERE); +// dto.getLineIndexes().stream().forEach(line -> { +// stringBuilder.append("line_id = '").append(line + "' ").append("or "); +// }); +// String substring = stringBuilder.substring(0, stringBuilder.length() - 3); +// queryResult = influxDbUtils.query(substring.toString()); +// //结果集映射到对象中 +// InfluxDBResultMapperCn influxDBResultMapper = new InfluxDBResultMapperCn(); +// List eventDetailList = influxDBResultMapper.toPOJO(queryResult, EventDetailNew.class); +// eventDetailList.stream().forEach(a -> { +// info.add(a); +// }); +// } +// } return info; } @@ -180,29 +215,46 @@ public class ReportServiceImpl implements ReportService { */ @Override public List getGeneralSituation(DeviceInfoParam.BusinessParam businessParam) { + //获取事件类型 + List dictType = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.EVENT_STATIS.getCode()).getData(); + if(CollectionUtil.isEmpty(dictType)){ + return new ArrayList<>(); + } + Map dictMap = dictType.stream().collect(Collectors.toMap(DictData::getId, DictData::getCode)); + + //查区域 HttpResult> info = generalDeviceInfoClient.getPracticalAllDeviceInfo(businessParam); List data = info.getData(); //所有根据line_id查询出来的数据 HashMap> map = new HashMap<>(); //循环查找所有数据 - QueryResult queryResult = new QueryResult(); +// QueryResult queryResult = new QueryResult(); ArrayList list = new ArrayList<>(); for (GeneralDeviceDTO dto : data) { list.add(new GeneralVO(dto.getName(), 0, 0, 0, 0, 0)); - queryResult = null; - StringBuilder stringBuilder = new StringBuilder(Param.SELECT).append(Param.EVENT_DETAIL); + +// queryResult = null; +// StringBuilder stringBuilder = new StringBuilder(Param.SELECT).append(Param.EVENT_DETAIL); List lineIndexes = dto.getLineIndexes(); if (lineIndexes.size() > 0) { - stringBuilder.append(Param.WHERE); - lineIndexes.stream().forEach(line -> { - stringBuilder.append("line_id = '").append(line + "' ").append("or "); - }); - String substring = stringBuilder.substring(0, stringBuilder.length() - 3); - queryResult = influxDbUtils.query(substring.toString()); - //结果集映射到对象中 - InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper(); - List eventDetailList = influxDBResultMapper.toPOJO(queryResult, EventDetail.class); + //数据暂降查询 + List eventDetails = eventDetailService.list(new LambdaQueryWrapper() + .in(RmpEventDetailPO::getMeasurementPointId,lineIndexes) + .ge(StrUtil.isNotBlank(businessParam.getSearchBeginTime()), RmpEventDetailPO::getStartTime,DateUtil.beginOfDay(DateUtil.parse(businessParam.getSearchBeginTime()))) + .le(StrUtil.isNotBlank(businessParam.getSearchEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(businessParam.getSearchEndTime()))) + ); + List eventDetailList= BeanUtil.copyToList(eventDetails,EventDetail.class); + +// stringBuilder.append(Param.WHERE); +// lineIndexes.stream().forEach(line -> { +// stringBuilder.append("line_id = '").append(line + "' ").append("or "); +// }); +// String substring = stringBuilder.substring(0, stringBuilder.length() - 3); +// queryResult = influxDbUtils.query(substring.toString()); +// //结果集映射到对象中 +// InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper(); +// List eventDetailList = influxDBResultMapper.toPOJO(queryResult, EventDetail.class); map.put(dto.getName(), eventDetailList); } else { List eventDetailList = new ArrayList<>(); @@ -215,23 +267,12 @@ public class ReportServiceImpl implements ReportService { for (String s : keySet) { GeneralVO generalVO = list.get(i); if (map.get(s).size() > 0 && generalVO.getName().equals(s)) { - map.get(s).stream().forEach(res -> { - Integer waveType = res.getWaveType(); - switch (waveType) { - case 1: { - generalVO.setSagsCount(generalVO.getSagsCount() + 1); - break; - } - case 2: { - generalVO.setUpCount(generalVO.getUpCount() + 1); - break; - } - case 3: { - generalVO.setBreakCount(generalVO.getBreakCount() + 1); - break; - } - } - }); + long count1 = map.get(s).stream().filter(x -> DicDataEnum.VOLTAGE_DIP.getCode().equals(dictMap.get(x.getEventType()))).count(); + long count2 = map.get(s).stream().filter(x -> DicDataEnum.VOLTAGE_RISE.getCode().equals(dictMap.get(x.getEventType()))).count(); + long count3 = map.get(s).stream().filter(x -> DicDataEnum.SHORT_INTERRUPTIONS.getCode().equals(dictMap.get(x.getEventType()))).count(); + generalVO.setSagsCount((int) count1); + generalVO.setUpCount((int) count2); + generalVO.setBreakCount((int) count3); } } } @@ -256,30 +297,43 @@ public class ReportServiceImpl implements ReportService { */ @Override public List getVoltage(DeviceInfoParam.BusinessParam businessParam) { - //获取所有数据 + //获取事件类型 + List dictType = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.EVENT_STATIS.getCode()).getData(); + if(CollectionUtil.isEmpty(dictType)){ + return new ArrayList<>(); + } + Map dictMap = dictType.stream().collect(Collectors.toMap(DictData::getId, DictData::getCode)); //查电压 HttpResult> info = generalDeviceInfoClient.getPracticalAllDeviceInfo(businessParam); List data = info.getData(); //所有根据line_id查询出来的数据 HashMap> map = new HashMap<>(); //循环查找所有数据 - QueryResult queryResult = new QueryResult(); +// QueryResult queryResult = new QueryResult(); ArrayList list = new ArrayList<>(); for (GeneralDeviceDTO dto : data) { list.add(new GeneralVO(dto.getName(), 0, 0, 0, 0, 0)); - queryResult = null; - StringBuilder stringBuilder = new StringBuilder(Param.SELECT + Param.EVENT_DETAIL); +// queryResult = null; +// StringBuilder stringBuilder = new StringBuilder(Param.SELECT + Param.EVENT_DETAIL); List lineIndexes = dto.getLineIndexes(); if (lineIndexes.size() > 0) { - stringBuilder.append(Param.WHERE); - lineIndexes.stream().forEach(line -> { - stringBuilder.append("line_id = '").append(line + "' ").append("or "); - }); - String substring = stringBuilder.substring(0, stringBuilder.length() - 3); - queryResult = influxDbUtils.query(substring.toString()); - //结果集映射到对象中 - InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper(); - List eventDetailList = influxDBResultMapper.toPOJO(queryResult, EventDetail.class); + //数据暂降查询 + List eventDetails = eventDetailService.list(new LambdaQueryWrapper() + .in(RmpEventDetailPO::getMeasurementPointId,lineIndexes) + .ge(StrUtil.isNotBlank(businessParam.getSearchBeginTime()), RmpEventDetailPO::getStartTime,DateUtil.beginOfDay(DateUtil.parse(businessParam.getSearchBeginTime()))) + .le(StrUtil.isNotBlank(businessParam.getSearchEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(businessParam.getSearchEndTime()))) + ); + List eventDetailList= BeanUtil.copyToList(eventDetails,EventDetail.class); + +// stringBuilder.append(Param.WHERE); +// lineIndexes.stream().forEach(line -> { +// stringBuilder.append("line_id = '").append(line + "' ").append("or "); +// }); +// String substring = stringBuilder.substring(0, stringBuilder.length() - 3); +// queryResult = influxDbUtils.query(substring.toString()); +// //结果集映射到对象中 +// InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper(); +// List eventDetailList = influxDBResultMapper.toPOJO(queryResult, EventDetail.class); map.put(dto.getName(), eventDetailList); } else { List eventDetailList = new ArrayList<>(); @@ -292,29 +346,12 @@ public class ReportServiceImpl implements ReportService { for (String s : keySet) { GeneralVO generalVO = list.get(i); if (map.get(s).size() > 0 && generalVO.getName().equals(s)) { - long count1 = map.get(s).stream().filter(x -> x.getWaveType() == 1).count(); - long count2 = map.get(s).stream().filter(x -> x.getWaveType() == 2).count(); - long count3 = map.get(s).stream().filter(x -> x.getWaveType() == 3).count(); + long count1 = map.get(s).stream().filter(x -> DicDataEnum.VOLTAGE_DIP.getCode().equals(dictMap.get(x.getEventType()))).count(); + long count2 = map.get(s).stream().filter(x -> DicDataEnum.VOLTAGE_RISE.getCode().equals(dictMap.get(x.getEventType()))).count(); + long count3 = map.get(s).stream().filter(x -> DicDataEnum.SHORT_INTERRUPTIONS.getCode().equals(dictMap.get(x.getEventType()))).count(); generalVO.setSagsCount((int) count1); generalVO.setUpCount((int) count2); generalVO.setBreakCount((int) count3); -// map.get(s).stream().forEach(res -> { -// Integer waveType = res.getWaveType(); -// switch (waveType) { -// case 1: { -// generalVO.setSagsCount(generalVO.getSagsCount() + 1); -// break; -// } -// case 2: { -// generalVO.setUpCount(generalVO.getUpCount() + 1); -// break; -// } -// case 3: { -// generalVO.setBreakCount(generalVO.getBreakCount() + 1); -// break; -// } -// } -// }); } } } @@ -346,7 +383,13 @@ public class ReportServiceImpl implements ReportService { //根据严重度进行排序并取前二十个数据 info.sort(((o1, o2) -> o1.getSeverity().compareTo(o2.getSeverity()))); Collections.reverse(info); - List details = info.subList(0, 20); + List details=new ArrayList<>(); + if(info.size()>20){ + details = info.subList(0, 20); + }else{ + details=info; + } + //遍历集合得到id集合 for (EventDetailNew detail : details) { idlist.add(detail.getLineId()); @@ -377,6 +420,9 @@ public class ReportServiceImpl implements ReportService { */ @Override public List getReason(DeviceInfoParam.BusinessParam businessParam) { + //获取暂降字典信息 + DictData dictData = dicDataFeignClient.getDicDataByCode(DicDataEnum.VOLTAGE_DIP.getCode()).getData(); + List result = new ArrayList<>(); List info = getED(businessParam); //获取字典表 @@ -389,10 +435,10 @@ public class ReportServiceImpl implements ReportService { } //替值 for (EventDetail eventDetail : info) { - if (eventDetail.getWaveType() == 1) { + if (dictData.getId().equals(eventDetail.getEventType())) { for (DictData datum : data) { - if (datum.getId().equals(eventDetail.getEventReason())) { - eventDetail.setEventReason(datum.getName()); + if (datum.getId().equals(eventDetail.getAdvanceReason())) { + eventDetail.setAdvanceReason(datum.getName()); } } } @@ -401,7 +447,7 @@ public class ReportServiceImpl implements ReportService { Set keySet = count.keySet(); for (EventDetail eventDetail : info) { for (String s : keySet) { - if (s.equals(eventDetail.getEventReason())) { + if (s.equals(eventDetail.getAdvanceReason())) { count.put(s, count.get(s) + 1); } } @@ -430,19 +476,17 @@ public class ReportServiceImpl implements ReportService { @Override public Page getContinueTime(WaveTypeParam waveTypeParam) { List result = new ArrayList<>(); - List count = getED2(waveTypeParam); - StringBuilder stringBuilder = new StringBuilder(Param.SELECT + Param.EVENT_DETAIL + Param.WHERE + " "); List deviceDTOList = generalDeviceInfoClient.getPracticalAllDeviceInfo(waveTypeParam).getData(); List lineIds = deviceDTOList.stream().flatMap(list -> list.getLineIndexes().stream()).collect(Collectors.toList()); if (CollectionUtil.isEmpty(lineIds)) { throw new BusinessException(DeviceResponseEnum.DEPT_LINE_EMPTY); } - StringBuilder lineSting = InfluxDBCommUtils.assToInfluxParam(lineIds); - Integer s = (waveTypeParam.getPageNum() - 1) * waveTypeParam.getPageSize(); - stringBuilder.append(lineSting).append("limit ").append(waveTypeParam.getPageSize() + " offset " + s + Param.TZ_ASIA_SHANGHAI); - QueryResult query = influxDbUtils.query(stringBuilder.toString()); - InfluxDBResultMapperCn influxDBResultMapper = new InfluxDBResultMapperCn(); - List info = influxDBResultMapper.toPOJO(query, EventDetailNew.class); + Page pageInfo = eventDetailService.page(new Page<>(waveTypeParam.getPageNum(), waveTypeParam.getPageSize()), new LambdaQueryWrapper() + .in(RmpEventDetailPO::getMeasurementPointId, lineIds) + .ge(StringUtils.isNotBlank(waveTypeParam.getSearchBeginTime()), RmpEventDetailPO::getStartTime,DateUtil.beginOfDay(DateUtil.parse(waveTypeParam.getSearchBeginTime()))) + .le(StringUtils.isNotBlank(waveTypeParam.getSearchEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(waveTypeParam.getSearchEndTime()))) + ); + List info =BeanUtil.copyToList(pageInfo.getRecords(),EventDetailNew.class); if (CollectionUtil.isNotEmpty(info)) { ArrayList idlist = new ArrayList<>(); for (EventDetailNew eventDetail : info) { @@ -470,12 +514,58 @@ public class ReportServiceImpl implements ReportService { } } } - Page page = new Page<>(); - page.setTotal(count.size()); + Page page = BeanUtil.copyProperties(pageInfo,Page.class); page.setRecords(result); - page.setCurrent(waveTypeParam.getPageNum()); - page.setSize(waveTypeParam.getPageSize()); return page; + + +// List count = getED2(waveTypeParam); +// StringBuilder stringBuilder = new StringBuilder(Param.SELECT + Param.EVENT_DETAIL + Param.WHERE + " "); +// List deviceDTOList = generalDeviceInfoClient.getPracticalAllDeviceInfo(waveTypeParam).getData(); +// List lineIds = deviceDTOList.stream().flatMap(list -> list.getLineIndexes().stream()).collect(Collectors.toList()); +// if (CollectionUtil.isEmpty(lineIds)) { +// throw new BusinessException(DeviceResponseEnum.DEPT_LINE_EMPTY); +// } +// StringBuilder lineSting = InfluxDBCommUtils.assToInfluxParam(lineIds); +// Integer s = (waveTypeParam.getPageNum() - 1) * waveTypeParam.getPageSize(); +// stringBuilder.append(lineSting).append("limit ").append(waveTypeParam.getPageSize() + " offset " + s + Param.TZ_ASIA_SHANGHAI); +// QueryResult query = influxDbUtils.query(stringBuilder.toString()); +// InfluxDBResultMapperCn influxDBResultMapper = new InfluxDBResultMapperCn(); +// +// List info = influxDBResultMapper.toPOJO(query, EventDetailNew.class); +// if (CollectionUtil.isNotEmpty(info)) { +// ArrayList idlist = new ArrayList<>(); +// for (EventDetailNew eventDetail : info) { +// DetailVO vo = new DetailVO(); +// BeanUtils.copyProperties(eventDetail, vo); +// result.add(vo); +// idlist.add(eventDetail.getLineId()); +// } +// HttpResult> AreaInfo = lineFeignClient.getBaseLineAreaInfo(idlist); +// List data = AreaInfo.getData(); +// for (DetailVO detailVO : result) { +// for (AreaLineInfoVO vo : data) { +// if (vo.getLineId().equals(detailVO.getLineId())) { +// BeanUtils.copyProperties(vo, detailVO); +// } +// } +// } +// HttpResult> reason = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.EVENT_TYPE.getName()); +// List type = reason.getData(); +// for (DetailVO detailVO : result) { +// for (DictData dictData : type) { +// if (dictData.getId().equals(detailVO.getEventType())) { +// detailVO.setEventType(dictData.getName()); +// } +// } +// } +// } +// Page page = new Page<>(); +// page.setTotal(count.size()); +// page.setRecords(result); +// page.setCurrent(waveTypeParam.getPageNum()); +// page.setSize(waveTypeParam.getPageSize()); +// return page; } /** @@ -487,24 +577,20 @@ public class ReportServiceImpl implements ReportService { @Override public Page getSagTimes(WaveTypeParam waveTypeParam) { List result = new ArrayList<>(); - List count = getED2(waveTypeParam); - StringBuilder stringBuilder = new StringBuilder(Param.SELECT + Param.EVENT_DETAIL + Param.WHERE + " 1=1 "); + //获取暂降字典信息 + DictData dictdata = dicDataFeignClient.getDicDataByCode(DicDataEnum.VOLTAGE_DIP.getCode()).getData(); + List deviceDTOList = generalDeviceInfoClient.getPracticalAllDeviceInfo(waveTypeParam).getData(); - String substring = ""; - for (GeneralDeviceDTO dto : deviceDTOList) { - if (dto.getLineIndexes().size() > 0) { - stringBuilder.append(" or "); - dto.getLineIndexes().stream().forEach(line -> { - stringBuilder.append("line_id = '").append(line + "' ").append("or "); - }); - stringBuilder.delete(stringBuilder.length() - 3, stringBuilder.length() + 1); - } + List lineIds = deviceDTOList.stream().flatMap(list -> list.getLineIndexes().stream()).collect(Collectors.toList()); + if (CollectionUtil.isEmpty(lineIds)) { + throw new BusinessException(DeviceResponseEnum.DEPT_LINE_EMPTY); } - Integer i = (waveTypeParam.getPageNum() - 1) * waveTypeParam.getPageSize(); - substring = stringBuilder.toString() + "limit " + waveTypeParam.getPageSize() + " offset " + i + Param.TZ_ASIA_SHANGHAI; - QueryResult query = influxDbUtils.query(substring); - InfluxDBResultMapperCn influxDBResultMapper = new InfluxDBResultMapperCn(); - List info = influxDBResultMapper.toPOJO(query, EventDetailNew.class); + Page pageInfo = eventDetailService.page(new Page<>(waveTypeParam.getPageNum(), waveTypeParam.getPageSize()), new LambdaQueryWrapper() + .in(RmpEventDetailPO::getMeasurementPointId, lineIds) + .ge(StringUtils.isNotBlank(waveTypeParam.getSearchBeginTime()), RmpEventDetailPO::getStartTime,DateUtil.beginOfDay(DateUtil.parse(waveTypeParam.getSearchBeginTime()))) + .le(StringUtils.isNotBlank(waveTypeParam.getSearchEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(waveTypeParam.getSearchEndTime()))) + ); + List info =BeanUtil.copyToList(pageInfo.getRecords(),EventDetailNew.class); HashMap countMap = new HashMap<>(); for (EventDetailNew eventDetail : info) { countMap.put(eventDetail.getLineId(), 0); @@ -514,7 +600,7 @@ public class ReportServiceImpl implements ReportService { ArrayList idlist = new ArrayList<>(); for (EventDetailNew eventDetail : info) { for (String s : keySet) { - if (eventDetail.getLineId().equals(s) && eventDetail.getWaveType() == "1") { + if (eventDetail.getLineId().equals(s) && dictdata.getId().equals(eventDetail.getEventType()) ) { countMap.put(s, countMap.get(s) + 1); } } @@ -537,12 +623,67 @@ public class ReportServiceImpl implements ReportService { } } } - Page page = new Page<>(); - page.setTotal(count.size()); + Page page = BeanUtil.copyProperties(pageInfo,Page.class); page.setRecords(result); - page.setCurrent(waveTypeParam.getPageNum()); - page.setSize(waveTypeParam.getPageSize()); return page; + + +// List count = getED2(waveTypeParam); +// StringBuilder stringBuilder = new StringBuilder(Param.SELECT + Param.EVENT_DETAIL + Param.WHERE + " 1=1 "); +// List deviceDTOList = generalDeviceInfoClient.getPracticalAllDeviceInfo(waveTypeParam).getData(); +// String substring = ""; +// for (GeneralDeviceDTO dto : deviceDTOList) { +// if (dto.getLineIndexes().size() > 0) { +// stringBuilder.append(" or "); +// dto.getLineIndexes().stream().forEach(line -> { +// stringBuilder.append("line_id = '").append(line + "' ").append("or "); +// }); +// stringBuilder.delete(stringBuilder.length() - 3, stringBuilder.length() + 1); +// } +// } +// Integer i = (waveTypeParam.getPageNum() - 1) * waveTypeParam.getPageSize(); +// substring = stringBuilder.toString() + "limit " + waveTypeParam.getPageSize() + " offset " + i + Param.TZ_ASIA_SHANGHAI; +// QueryResult query = influxDbUtils.query(substring); +// InfluxDBResultMapperCn influxDBResultMapper = new InfluxDBResultMapperCn(); +// List info = influxDBResultMapper.toPOJO(query, EventDetailNew.class); +// HashMap countMap = new HashMap<>(); +// for (EventDetailNew eventDetail : info) { +// countMap.put(eventDetail.getLineId(), 0); +// } +// Set keySet = countMap.keySet(); +// //id集合 +// ArrayList idlist = new ArrayList<>(); +// for (EventDetailNew eventDetail : info) { +// for (String s : keySet) { +// if (eventDetail.getLineId().equals(s) && eventDetail.getWaveType() == "1") { +// countMap.put(s, countMap.get(s) + 1); +// } +// } +// DetailVO vo = new DetailVO(); +// BeanUtils.copyProperties(eventDetail, vo); +// result.add(vo); +// idlist.add(eventDetail.getLineId()); +// } +// HttpResult> AreaInfo = lineFeignClient.getBaseLineAreaInfo(idlist); +// List data = AreaInfo.getData(); +// for (DetailVO detailVO : result) { +// for (AreaLineInfoVO vo : data) { +// if (vo.getLineId().equals(detailVO.getLineId())) { +// BeanUtils.copyProperties(vo, detailVO); +// } +// } +// for (String s : keySet) { +// if (s.equals(detailVO.getLineId())) { +// detailVO.setTimes(countMap.get(s)); +// } +// } +// } +// Page page = new Page<>(); +// page.setTotal(count.size()); +// page.setRecords(result); +// page.setCurrent(waveTypeParam.getPageNum()); +// page.setSize(waveTypeParam.getPageSize()); +// return page; } /** @@ -554,24 +695,20 @@ public class ReportServiceImpl implements ReportService { @Override public Page getUpTimes(WaveTypeParam waveTypeParam) { List result = new ArrayList<>(); - List count = getED2(waveTypeParam); - StringBuilder stringBuilder = new StringBuilder(Param.SELECT + Param.EVENT_DETAIL + Param.WHERE + " 1=1 "); + //获取暂升字典信息 + DictData dictdata = dicDataFeignClient.getDicDataByCode(DicDataEnum.VOLTAGE_RISE.getCode()).getData(); + List deviceDTOList = generalDeviceInfoClient.getPracticalAllDeviceInfo(waveTypeParam).getData(); - String substring = ""; - for (GeneralDeviceDTO dto : deviceDTOList) { - if (dto.getLineIndexes().size() > 0) { - stringBuilder.append(" or "); - dto.getLineIndexes().stream().forEach(line -> { - stringBuilder.append("line_id = '").append(line + "' ").append("or "); - }); - stringBuilder.delete(stringBuilder.length() - 3, stringBuilder.length() + 1); - } + List lineIds = deviceDTOList.stream().flatMap(list -> list.getLineIndexes().stream()).collect(Collectors.toList()); + if (CollectionUtil.isEmpty(lineIds)) { + throw new BusinessException(DeviceResponseEnum.DEPT_LINE_EMPTY); } - Integer i = (waveTypeParam.getPageNum() - 1) * waveTypeParam.getPageSize(); - substring = stringBuilder.toString() + "limit " + waveTypeParam.getPageSize() + " offset " + i + Param.TZ_ASIA_SHANGHAI; - QueryResult query = influxDbUtils.query(substring); - InfluxDBResultMapperCn influxDBResultMapper = new InfluxDBResultMapperCn(); - List info = influxDBResultMapper.toPOJO(query, EventDetailNew.class); + Page pageInfo = eventDetailService.page(new Page<>(waveTypeParam.getPageNum(), waveTypeParam.getPageSize()), new LambdaQueryWrapper() + .in(RmpEventDetailPO::getMeasurementPointId, lineIds) + .ge(StringUtils.isNotBlank(waveTypeParam.getSearchBeginTime()), RmpEventDetailPO::getStartTime,DateUtil.beginOfDay(DateUtil.parse(waveTypeParam.getSearchBeginTime()))) + .le(StringUtils.isNotBlank(waveTypeParam.getSearchEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(waveTypeParam.getSearchEndTime()))) + ); + List info =BeanUtil.copyToList(pageInfo.getRecords(),EventDetailNew.class); HashMap countMap = new HashMap<>(); for (EventDetailNew eventDetail : info) { countMap.put(eventDetail.getLineId(), 0); @@ -581,7 +718,7 @@ public class ReportServiceImpl implements ReportService { ArrayList idlist = new ArrayList<>(); for (EventDetailNew eventDetail : info) { for (String s : keySet) { - if (eventDetail.getLineId().equals(s) && eventDetail.getWaveType() == "2") { + if (eventDetail.getLineId().equals(s) && dictdata.getId().equals(eventDetail.getEventType())) { countMap.put(s, countMap.get(s) + 1); } } @@ -604,12 +741,66 @@ public class ReportServiceImpl implements ReportService { } } } - Page page = new Page<>(); - page.setTotal(count.size()); + Page page = BeanUtil.copyProperties(pageInfo,Page.class); page.setRecords(result); - page.setCurrent(waveTypeParam.getPageNum()); - page.setSize(waveTypeParam.getPageSize()); return page; + +// List count = getED2(waveTypeParam); +// StringBuilder stringBuilder = new StringBuilder(Param.SELECT + Param.EVENT_DETAIL + Param.WHERE + " 1=1 "); +// List deviceDTOList = generalDeviceInfoClient.getPracticalAllDeviceInfo(waveTypeParam).getData(); +// String substring = ""; +// for (GeneralDeviceDTO dto : deviceDTOList) { +// if (dto.getLineIndexes().size() > 0) { +// stringBuilder.append(" or "); +// dto.getLineIndexes().stream().forEach(line -> { +// stringBuilder.append("line_id = '").append(line + "' ").append("or "); +// }); +// stringBuilder.delete(stringBuilder.length() - 3, stringBuilder.length() + 1); +// } +// } +// Integer i = (waveTypeParam.getPageNum() - 1) * waveTypeParam.getPageSize(); +// substring = stringBuilder.toString() + "limit " + waveTypeParam.getPageSize() + " offset " + i + Param.TZ_ASIA_SHANGHAI; +// QueryResult query = influxDbUtils.query(substring); +// InfluxDBResultMapperCn influxDBResultMapper = new InfluxDBResultMapperCn(); +// List info = influxDBResultMapper.toPOJO(query, EventDetailNew.class); +// HashMap countMap = new HashMap<>(); +// for (EventDetailNew eventDetail : info) { +// countMap.put(eventDetail.getLineId(), 0); +// } +// Set keySet = countMap.keySet(); +// //id集合 +// ArrayList idlist = new ArrayList<>(); +// for (EventDetailNew eventDetail : info) { +// for (String s : keySet) { +// if (eventDetail.getLineId().equals(s) && eventDetail.getWaveType() == "2") { +// countMap.put(s, countMap.get(s) + 1); +// } +// } +// DetailVO vo = new DetailVO(); +// BeanUtils.copyProperties(eventDetail, vo); +// result.add(vo); +// idlist.add(eventDetail.getLineId()); +// } +// HttpResult> AreaInfo = lineFeignClient.getBaseLineAreaInfo(idlist); +// List data = AreaInfo.getData(); +// for (DetailVO detailVO : result) { +// for (AreaLineInfoVO vo : data) { +// if (vo.getLineId().equals(detailVO.getLineId())) { +// BeanUtils.copyProperties(vo, detailVO); +// } +// } +// for (String s : keySet) { +// if (s.equals(detailVO.getLineId())) { +// detailVO.setTimes(countMap.get(s)); +// } +// } +// } +// Page page = new Page<>(); +// page.setTotal(count.size()); +// page.setRecords(result); +// page.setCurrent(waveTypeParam.getPageNum()); +// page.setSize(waveTypeParam.getPageSize()); +// return page; } /** @@ -621,24 +812,21 @@ public class ReportServiceImpl implements ReportService { @Override public Page getBreakTimes(WaveTypeParam waveTypeParam) { List result = new ArrayList<>(); - List count = getED2(waveTypeParam); - StringBuilder stringBuilder = new StringBuilder(Param.SELECT + Param.EVENT_DETAIL + Param.WHERE + " 1=1 "); + + //获取中断字典信息 + DictData dictdata = dicDataFeignClient.getDicDataByCode(DicDataEnum.SHORT_INTERRUPTIONS.getCode()).getData(); + List deviceDTOList = generalDeviceInfoClient.getPracticalAllDeviceInfo(waveTypeParam).getData(); - String substring = ""; - for (GeneralDeviceDTO dto : deviceDTOList) { - if (dto.getLineIndexes().size() > 0) { - stringBuilder.append(" or "); - dto.getLineIndexes().stream().forEach(line -> { - stringBuilder.append("line_id = '").append(line + "' ").append("or "); - }); - stringBuilder.delete(stringBuilder.length() - 3, stringBuilder.length() + 1); - } + List lineIds = deviceDTOList.stream().flatMap(list -> list.getLineIndexes().stream()).collect(Collectors.toList()); + if (CollectionUtil.isEmpty(lineIds)) { + throw new BusinessException(DeviceResponseEnum.DEPT_LINE_EMPTY); } - Integer i = (waveTypeParam.getPageNum() - 1) * waveTypeParam.getPageSize(); - substring = stringBuilder.toString() + "limit " + waveTypeParam.getPageSize() + " offset " + i + Param.TZ_ASIA_SHANGHAI; - QueryResult query = influxDbUtils.query(substring); - InfluxDBResultMapperCn influxDBResultMapper = new InfluxDBResultMapperCn(); - List info = influxDBResultMapper.toPOJO(query, EventDetailNew.class); + Page pageInfo = eventDetailService.page(new Page<>(waveTypeParam.getPageNum(), waveTypeParam.getPageSize()), new LambdaQueryWrapper() + .in(RmpEventDetailPO::getMeasurementPointId, lineIds) + .ge(StringUtils.isNotBlank(waveTypeParam.getSearchBeginTime()), RmpEventDetailPO::getStartTime,DateUtil.beginOfDay(DateUtil.parse(waveTypeParam.getSearchBeginTime()))) + .le(StringUtils.isNotBlank(waveTypeParam.getSearchEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(waveTypeParam.getSearchEndTime()))) + ); + List info =BeanUtil.copyToList(pageInfo.getRecords(),EventDetailNew.class); HashMap countMap = new HashMap<>(); for (EventDetailNew eventDetail : info) { countMap.put(eventDetail.getLineId(), 0); @@ -648,7 +836,7 @@ public class ReportServiceImpl implements ReportService { ArrayList idlist = new ArrayList<>(); for (EventDetailNew eventDetail : info) { for (String s : keySet) { - if (eventDetail.getLineId().equals(s) && eventDetail.getWaveType() == "3") { + if (eventDetail.getLineId().equals(s) && dictdata.getId().equals(eventDetail.getEventType())) { countMap.put(s, countMap.get(s) + 1); } } @@ -671,12 +859,67 @@ public class ReportServiceImpl implements ReportService { } } } - Page page = new Page<>(); - page.setTotal(count.size()); + Page page = BeanUtil.copyProperties(pageInfo,Page.class); page.setRecords(result); - page.setCurrent(waveTypeParam.getPageNum()); - page.setSize(waveTypeParam.getPageSize()); return page; + + +// List count = getED2(waveTypeParam); +// StringBuilder stringBuilder = new StringBuilder(Param.SELECT + Param.EVENT_DETAIL + Param.WHERE + " 1=1 "); +// List deviceDTOList = generalDeviceInfoClient.getPracticalAllDeviceInfo(waveTypeParam).getData(); +// String substring = ""; +// for (GeneralDeviceDTO dto : deviceDTOList) { +// if (dto.getLineIndexes().size() > 0) { +// stringBuilder.append(" or "); +// dto.getLineIndexes().stream().forEach(line -> { +// stringBuilder.append("line_id = '").append(line + "' ").append("or "); +// }); +// stringBuilder.delete(stringBuilder.length() - 3, stringBuilder.length() + 1); +// } +// } +// Integer i = (waveTypeParam.getPageNum() - 1) * waveTypeParam.getPageSize(); +// substring = stringBuilder.toString() + "limit " + waveTypeParam.getPageSize() + " offset " + i + Param.TZ_ASIA_SHANGHAI; +// QueryResult query = influxDbUtils.query(substring); +// InfluxDBResultMapperCn influxDBResultMapper = new InfluxDBResultMapperCn(); +// List info = influxDBResultMapper.toPOJO(query, EventDetailNew.class); +// HashMap countMap = new HashMap<>(); +// for (EventDetailNew eventDetail : info) { +// countMap.put(eventDetail.getLineId(), 0); +// } +// Set keySet = countMap.keySet(); +// //id集合 +// ArrayList idlist = new ArrayList<>(); +// for (EventDetailNew eventDetail : info) { +// for (String s : keySet) { +// if (eventDetail.getLineId().equals(s) && eventDetail.getWaveType() == "3") { +// countMap.put(s, countMap.get(s) + 1); +// } +// } +// DetailVO vo = new DetailVO(); +// BeanUtils.copyProperties(eventDetail, vo); +// result.add(vo); +// idlist.add(eventDetail.getLineId()); +// } +// HttpResult> AreaInfo = lineFeignClient.getBaseLineAreaInfo(idlist); +// List data = AreaInfo.getData(); +// for (DetailVO detailVO : result) { +// for (AreaLineInfoVO vo : data) { +// if (vo.getLineId().equals(detailVO.getLineId())) { +// BeanUtils.copyProperties(vo, detailVO); +// } +// } +// for (String s : keySet) { +// if (s.equals(detailVO.getLineId())) { +// detailVO.setTimes(countMap.get(s)); +// } +// } +// } +// Page page = new Page<>(); +// page.setTotal(count.size()); +// page.setRecords(result); +// page.setCurrent(waveTypeParam.getPageNum()); +// page.setSize(waveTypeParam.getPageSize()); +// return page; } @Override @@ -1117,11 +1360,11 @@ public class ReportServiceImpl implements ReportService { insertRow(doc, table, centerParagraph, true, "序号", "暂降发生时刻", "暂降赋值(%)", "持续时间(s)", "暂降类型", "暂降原因", "严重度"); for (int j = 0; j < plot.size(); j++) { EventDetail eventDetail = plot.get(j); - long l = eventDetail.getTimeId().toEpochMilli(); + long l = eventDetail.getStartTime().toEpochMilli(); Date date1 = new Date(l); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); String s = simpleDateFormat.format(date1); - insertRow(doc, table, centerParagraph, false, j + 1 + "", s, eventDetail.getEventValue() + "", eventDetail.getPersistTime() / 1000.0 + "", eventDetail.getEventType(), eventDetail.getEventReason(), eventDetail.getSeverity() + ""); + insertRow(doc, table, centerParagraph, false, j + 1 + "", s, eventDetail.getFeatureAmplitude() + "", eventDetail.getDuration() / 1000.0 + "", eventDetail.getAdvanceType(), eventDetail.getAdvanceReason(), eventDetail.getSeverity() + ""); } i++; } @@ -1357,8 +1600,8 @@ public class ReportServiceImpl implements ReportService { ArrayList> list = new ArrayList<>(); for (EventDetail eventDetail : plot) { ArrayList doubles = new ArrayList<>(); - doubles.add(Double.parseDouble(eventDetail.getPersistTime() / 1000 + "")); - doubles.add(Double.parseDouble(String.valueOf(eventDetail.getEventValue() * 100))); + doubles.add(Double.parseDouble(eventDetail.getDuration() / 1000 + "")); + doubles.add(Double.parseDouble(String.valueOf(eventDetail.getFeatureAmplitude() * 100))); list.add(doubles); } return list; @@ -1371,17 +1614,30 @@ public class ReportServiceImpl implements ReportService { * @return */ private List info(StatisticsParam statisticsParam) { - //构建sql语句 - StringBuffer stringResult = new StringBuffer(); - stringResult.append(Param.SELECT).append(Param.EVENT_DETAIL).append(Param.WHERE) - .append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(statisticsParam.getStartTime())) + "'") - .append(" and time <= '").append(DateUtil.beginOfDay(DateUtil.parse(statisticsParam.getEndTime())) + "'") - .append(" and line_id = '").append(statisticsParam.getLineIndex() + "'") - .append(" and (wave_type = 1 or wave_type = 3)").append(Param.TZ_ASIA_SHANGHAI); - //结果集映射到对象中 - QueryResult query = influxDbUtils.query(stringResult.toString()); - InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper(); - return influxDBResultMapper.toPOJO(query, EventDetail.class); + //获取事件类型 + 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 BeanUtil.copyToList(info,EventDetail.class); +// //构建sql语句 +// StringBuffer stringResult = new StringBuffer(); +// stringResult.append(Param.SELECT).append(Param.EVENT_DETAIL).append(Param.WHERE) +// .append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(statisticsParam.getStartTime())) + "'") +// .append(" and time <= '").append(DateUtil.beginOfDay(DateUtil.parse(statisticsParam.getEndTime())) + "'") +// .append(" and line_id = '").append(statisticsParam.getLineIndex() + "'") +// .append(" and (wave_type = 1 or wave_type = 3)").append(Param.TZ_ASIA_SHANGHAI); +// //结果集映射到对象中 +// QueryResult query = influxDbUtils.query(stringResult.toString()); +// InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper(); +// return influxDBResultMapper.toPOJO(query, EventDetail.class); } @@ -1681,777 +1937,115 @@ public class ReportServiceImpl implements ReportService { */ @Override public Page getEventReport(WaveTypeParam deviceInfoParam) { + Page page = new Page<>(); List generalDeviceDTOList = generalDeviceInfoClient.getPracticalAllDeviceInfo(deviceInfoParam).getData(); List lineIds = generalDeviceDTOList.stream().flatMap(dto -> dto.getLineIndexes().stream()).collect(Collectors.toList()); - //TODO 添加进去一个假的line_id - lineIds.add("6973ca7ea5dd4b0328496e4e1b871447"); - - InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper(); - - //建立封装sql查询结果的集合 - List eventDetailList = new ArrayList<>(); - - //提前创建total - StringBuilder stringTotal = new StringBuilder(); - QueryResult resultTotal = new QueryResult(); - - //提前创建好统计在线离线的实体类,这样if和else都能访问到,并且只需要创建一个对象 LineBaseQueryParam lineBaseQueryParam = new LineBaseQueryParam(); + lineBaseQueryParam.setLineIds(lineIds); + lineBaseQueryParam.setComFlag(deviceInfoParam.getComFlag()); + lineBaseQueryParam.setSearchValue(deviceInfoParam.getSearchValue()); - //提前创建查询框结果集合 - List resultList = new ArrayList<>(); + //调用查询监测点的方法 + List data = lineFeignClient.getRichLineInfo(lineBaseQueryParam).getData(); + //监测点集合 + List ids = data.stream().map(AreaLineInfoVO::getLineId).collect(Collectors.toList()); - //提前创建进行过查询过后的line_id集合 - List lineIdList = new ArrayList<>(); - - //TODO 在线,没有搜索框的值 - if (deviceInfoParam.getComFlag().equals(1) && Objects.isNull(deviceInfoParam.getSearchValue())) { - - lineBaseQueryParam.setLineIds(lineIds); - lineBaseQueryParam.setComFlag(deviceInfoParam.getComFlag()); - - //调用方法查看哪些在线 - List onOrUnLine = lineFeignClient.getOnOrUnLine(lineBaseQueryParam).getData(); - - - //调用创建好的line_id拼接工具 - StringBuilder stringBuilder = InfluxDBCommUtils.assToInfluxParam(onOrUnLine); - - //判断当前检测点集合是否为空 - if (CollectionUtil.isNotEmpty(onOrUnLine)) { - - //触发类型为空 - if (Objects.isNull(deviceInfoParam.getWaveType())) { - - - StringBuilder stringResult = new StringBuilder(Param.SELECT).append(Param.EVENT_DETAIL).append(Param.WHERE). - append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(deviceInfoParam.getSearchBeginTime()))).append("' and ").append("time <= '") - .append(DateUtil.endOfDay(DateUtil.parse(deviceInfoParam.getSearchEndTime()))) - .append("' and ").append(stringBuilder); - - - //套用公式(page-1)*pageSize - int i1 = (deviceInfoParam.getPageNum() - 1) * deviceInfoParam.getPageSize(); - //拼接分页sql - stringResult.append(" LIMIT ").append(deviceInfoParam.getPageSize()).append(" OFFSET ").append(i1).append(" tz('Asia/Shanghai')"); - - //查询sql语句总条数 - stringTotal = new StringBuilder("SELECT COUNT(num) as aa FROM ").append(Param.EVENT_DETAIL).append(" WHERE ").append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(deviceInfoParam.getSearchBeginTime()))).append("' and ") - .append("time <= '").append(DateUtil.endOfDay(DateUtil.parse(deviceInfoParam.getSearchEndTime()))).append("' and "); - stringTotal.append(stringBuilder).append(" tz('Asia/Shanghai')"); - - //结果集 - QueryResult result = influxDbUtils.query(stringResult.toString()); - //总条数 - resultTotal = influxDbUtils.query(stringTotal.toString()); - - //结果集映射到对象中 - eventDetailList = influxDBResultMapper.toPOJO(result, WaveTypeVO.class); - - //如果集合中没有对象则返回空page - if (eventDetailList.size() == 0) { - return new Page<>(); - } - - - //触发类型不为空 - } else if (Objects.nonNull(deviceInfoParam.getWaveType())) { - - - StringBuilder stringResult = new StringBuilder(Param.SELECT).append(Param.EVENT_DETAIL).append(Param.WHERE). - append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(deviceInfoParam.getSearchBeginTime()))).append("' and ").append("time <= '") - .append(DateUtil.endOfDay(DateUtil.parse(deviceInfoParam.getSearchEndTime()))) - .append("' and ").append(stringBuilder).append(" and ").append("wave_type = ") - .append(deviceInfoParam.getWaveType()); - - - //套用公式(page-1)*pageSize - int i1 = (deviceInfoParam.getPageNum() - 1) * deviceInfoParam.getPageSize(); - //拼接分页sql - stringResult.append(" LIMIT ").append(deviceInfoParam.getPageSize()).append(" OFFSET ").append(i1).append(" tz('Asia/Shanghai')"); - - - //查询sql语句总条数 - stringTotal = new StringBuilder("SELECT COUNT(num) as aa FROM ").append(Param.EVENT_DETAIL).append(" WHERE ").append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(deviceInfoParam.getSearchBeginTime()))).append("' and ") - .append("time <= '").append(DateUtil.endOfDay(DateUtil.parse(deviceInfoParam.getSearchEndTime()))).append("' and "); - stringTotal.append(stringBuilder).append(" tz('Asia/Shanghai')"); - - //结果集 - QueryResult result = influxDbUtils.query(stringResult.toString()); - //总条数 - resultTotal = influxDbUtils.query(stringTotal.toString()); - - - //结果集映射到对象中 - eventDetailList = influxDBResultMapper.toPOJO(result, WaveTypeVO.class); - - - //如果集合中没有对象则返回空page - if (eventDetailList.size() == 0) { - return new Page<>(); - } - - - } - - - //获取关于监测点发电站相关信息 - HttpResult> baseLineAreaInfo = lineFeignClient.getBaseLineAreaInfo(lineIds); - System.out.println(baseLineAreaInfo); - //将返回的封装好的结果集进行还原成集合 - List areaLineList = baseLineAreaInfo.getData(); - - - //将监测点发电机相关信息copy到准备好的VO对象中 - for (WaveTypeVO waveTypeVO : eventDetailList) { - if (waveTypeVO.getLineId() != null) { - for (AreaLineInfoVO lineInfoVO : areaLineList) { - if (waveTypeVO.getLineId().equals(lineInfoVO.getLineId())) { - waveTypeVO.setSubName(lineInfoVO.getSubName()); - waveTypeVO.setLineId(lineInfoVO.getLineId()); - waveTypeVO.setLineName(lineInfoVO.getLineName()); - waveTypeVO.setGdId(lineInfoVO.getGdId()); - waveTypeVO.setGdName(lineInfoVO.getGdName()); - waveTypeVO.setVoltageId(lineInfoVO.getVoltageId()); - waveTypeVO.setNoDealCount(lineInfoVO.getNoDealCount()); - waveTypeVO.setCt1(lineInfoVO.getCt1()); - waveTypeVO.setCt2(lineInfoVO.getCt2()); - waveTypeVO.setPt1(lineInfoVO.getPt1()); - waveTypeVO.setPt2(lineInfoVO.getPt2()); - waveTypeVO.setRunFlag(lineInfoVO.getRunFlag()); - waveTypeVO.setComFlag(lineInfoVO.getComFlag()); - waveTypeVO.setIp(lineInfoVO.getIp()); - waveTypeVO.setLat(lineInfoVO.getLat()); - waveTypeVO.setLng(lineInfoVO.getLng()); - waveTypeVO.setManufacturer(lineInfoVO.getManufacturer()); - waveTypeVO.setVoltageScale(lineInfoVO.getVoltageScale()); - } - } - } - } - - - //使用字典表对暂态类型和暂态原因进行转换 - HttpResult> reason = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.EVENT_REASON.getName()); - HttpResult> type = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.EVENT_TYPE.getName()); - //获取字典数据暂态原因集合 - List eventReasonList = reason.getData(); - System.out.println(eventReasonList); - //获取字典数据暂态类型集合 - List eventTypeList = type.getData(); - System.out.println(eventTypeList); - - for (WaveTypeVO waveTypeVO : eventDetailList) { - if (waveTypeVO.getEventReason() != null) { - for (DictData dictData : eventReasonList) { - //将字典数据id与VO中属性eventReason对应的字符串进行比较 - if (waveTypeVO.getEventReason().equals(dictData.getId())) { - waveTypeVO.setEventReason(dictData.getName()); - } - } - } else { - //抛出异常,当前暂态原因为空 - throw new BusinessException(EventResponseEnum.EVENT_REASON_NOT_FOUND); - } - } - - for (WaveTypeVO waveTypeVO : eventDetailList) { - if (waveTypeVO.getEventType() != null) { - for (DictData dictData : eventTypeList) { - //将字典数据id与VO中属性eventType对应的字符串进行比较 - if (waveTypeVO.getEventType().equals(dictData.getId())) { - waveTypeVO.setEventType(dictData.getName()); - } - } - } else { - //抛出异常,当前暂态类型为空 - throw new BusinessException(EventResponseEnum.EVENT_TYPE_NOT_FOUND); - } - } - } else { - //返回空page对象 - return new Page<>(); + if (CollUtil.isNotEmpty(ids)) { + Page pageInfo = eventDetailService.page(new Page<>(deviceInfoParam.getPageNum(), deviceInfoParam.getPageSize()), new LambdaQueryWrapper() + .in(RmpEventDetailPO::getMeasurementPointId, ids) + .eq(StrUtil.isNotBlank(deviceInfoParam.getWaveType()), RmpEventDetailPO::getEventType, deviceInfoParam.getWaveType()) + .ge(StringUtils.isNotBlank(deviceInfoParam.getSearchBeginTime()), RmpEventDetailPO::getStartTime, DateUtil.beginOfDay(DateUtil.parse(deviceInfoParam.getSearchBeginTime()))) + .le(StringUtils.isNotBlank(deviceInfoParam.getSearchEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(deviceInfoParam.getSearchEndTime()))) + ); + //集合拷贝 + List eventDetailList = BeanUtil.copyToList(pageInfo.getRecords(), WaveTypeVO.class); + if (CollUtil.isEmpty(eventDetailList)) { + return page; } - Page page = new Page<>(); - long total = new BigDecimal(resultTotal.getResults().get(0).getSeries().get(0).getValues().get(0).get(1).toString()).longValue(); - page.setTotal(total); + + //获取关于监测点发电站相关信息 + HttpResult> baseLineAreaInfo = lineFeignClient.getBaseLineAreaInfo(lineIds); + + //将返回的封装好的结果集进行还原成集合 + List areaLineList = baseLineAreaInfo.getData(); + + + //将监测点发电机相关信息copy到准备好的VO对象中 + for (WaveTypeVO waveTypeVO : eventDetailList) { + if (waveTypeVO.getLineId() != null) { + for (AreaLineInfoVO lineInfoVO : areaLineList) { + if (waveTypeVO.getLineId().equals(lineInfoVO.getLineId())) { + waveTypeVO.setSubName(lineInfoVO.getSubName()); + waveTypeVO.setLineId(lineInfoVO.getLineId()); + waveTypeVO.setLineName(lineInfoVO.getLineName()); + waveTypeVO.setGdId(lineInfoVO.getGdId()); + waveTypeVO.setGdName(lineInfoVO.getGdName()); + waveTypeVO.setVoltageId(lineInfoVO.getVoltageId()); + waveTypeVO.setNoDealCount(lineInfoVO.getNoDealCount()); + waveTypeVO.setCt1(lineInfoVO.getCt1()); + waveTypeVO.setCt2(lineInfoVO.getCt2()); + waveTypeVO.setPt1(lineInfoVO.getPt1()); + waveTypeVO.setPt2(lineInfoVO.getPt2()); + waveTypeVO.setRunFlag(lineInfoVO.getRunFlag()); + waveTypeVO.setComFlag(lineInfoVO.getComFlag()); + waveTypeVO.setIp(lineInfoVO.getIp()); + waveTypeVO.setLat(lineInfoVO.getLat()); + waveTypeVO.setLng(lineInfoVO.getLng()); + waveTypeVO.setManufacturer(lineInfoVO.getManufacturer()); + waveTypeVO.setVoltageScale(lineInfoVO.getVoltageScale()); + } + } + } + } + + + //使用字典表对暂态类型和暂态原因进行转换 + HttpResult> reason = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.EVENT_REASON.getName()); + HttpResult> type = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.EVENT_TYPE.getName()); + //获取字典数据暂态原因集合 + List eventReasonList = reason.getData(); + //获取字典数据暂态类型集合 + List eventTypeList = type.getData(); + + for (WaveTypeVO waveTypeVO : eventDetailList) { + if (waveTypeVO.getEventReason() != null) { + for (DictData dictData : eventReasonList) { + //将字典数据id与VO中属性eventReason对应的字符串进行比较 + if (waveTypeVO.getEventReason().equals(dictData.getId())) { + waveTypeVO.setEventReason(dictData.getName()); + } + } + } else { + //抛出异常,当前暂态原因为空 + throw new BusinessException(EventResponseEnum.EVENT_REASON_NOT_FOUND); + } + } + + for (WaveTypeVO waveTypeVO : eventDetailList) { + if (waveTypeVO.getEventType() != null) { + for (DictData dictData : eventTypeList) { + //将字典数据id与VO中属性eventType对应的字符串进行比较 + if (waveTypeVO.getEventType().equals(dictData.getId())) { + waveTypeVO.setEventType(dictData.getName()); + } + } + } else { + //抛出异常,当前暂态类型为空 + throw new BusinessException(EventResponseEnum.EVENT_TYPE_NOT_FOUND); + } + } + + page=BeanUtil.copyProperties(pageInfo,Page.class); page.setRecords(eventDetailList); - page.setCurrent(deviceInfoParam.getPageNum()); - page.setSize(deviceInfoParam.getPageSize()); - return page; - - //TODO 在线,有搜索框的值 - } else if (deviceInfoParam.getComFlag().equals(1) && Objects.nonNull(deviceInfoParam.getSearchValue())) { - - //传入监测点集合和在线离线 - lineBaseQueryParam.setLineIds(lineIds); - lineBaseQueryParam.setComFlag(deviceInfoParam.getComFlag()); - //搜索框的值也传进去 - lineBaseQueryParam.setSearchValue(deviceInfoParam.getSearchValue()); - - //返回对象结果集合 - resultList = lineFeignClient.getRichLineInfo(lineBaseQueryParam).getData(); - - //进行循环遍历将line_id塞入集合 - for (AreaLineInfoVO areaLineInfoVO : resultList) { - lineIdList.add(areaLineInfoVO.getLineId()); - } - - //上面的方法已经将判断在线离线和搜索框结果一起返回了 - //调用方法查看哪些在线 - //List onOrUnLine = lineFeignClient.getOnOrUnLine(lineBaseQueryParam).getData(); - - //使用工具类替代fori循环,不然进行不了分页 - //调用创建好的line_id拼接工具,如:where id = '1' or id = '2' - StringBuilder stringBuilder = InfluxDBCommUtils.assToInfluxParam(lineIdList); - - //判断当前检测点集合是否为空 - if (CollectionUtil.isNotEmpty(lineIdList)) { - - //触发类型为空 - if (Objects.isNull(deviceInfoParam.getWaveType())) { - - - StringBuilder stringResult = new StringBuilder(Param.SELECT).append(Param.EVENT_DETAIL).append(Param.WHERE). - append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(deviceInfoParam.getSearchBeginTime()))).append("' and ").append("time <= '") - .append(DateUtil.endOfDay(DateUtil.parse(deviceInfoParam.getSearchEndTime()))) - .append("' and ").append(stringBuilder); - - - //套用公式(page-1)*pageSize - int i1 = (deviceInfoParam.getPageNum() - 1) * deviceInfoParam.getPageSize(); - //拼接分页sql - stringResult.append(" LIMIT ").append(deviceInfoParam.getPageSize()).append(" OFFSET ").append(i1).append(" tz('Asia/Shanghai')"); - - //查询sql语句总条数 - stringTotal = new StringBuilder("SELECT COUNT(num) as aa FROM ").append(Param.EVENT_DETAIL).append(" WHERE ").append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(deviceInfoParam.getSearchBeginTime()))).append("' and ") - .append("time <= '").append(DateUtil.endOfDay(DateUtil.parse(deviceInfoParam.getSearchEndTime()))).append("' and "); - stringTotal.append(stringBuilder).append(" tz('Asia/Shanghai')"); - - //结果集 - QueryResult result = influxDbUtils.query(stringResult.toString()); - //总条数 - resultTotal = influxDbUtils.query(stringTotal.toString()); - - //结果集映射到对象中 - eventDetailList = influxDBResultMapper.toPOJO(result, WaveTypeVO.class); - - - //如果集合中没有对象则返回空page - if (eventDetailList.size() == 0) { - return new Page<>(); - } - - - //触发类型不为空 - } else if (Objects.nonNull(deviceInfoParam.getWaveType())) { - - - StringBuilder stringResult = new StringBuilder(Param.SELECT).append(Param.EVENT_DETAIL).append(Param.WHERE). - append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(deviceInfoParam.getSearchBeginTime()))).append("' and ").append("time <= '") - .append(DateUtil.endOfDay(DateUtil.parse(deviceInfoParam.getSearchEndTime()))) - .append("' and ").append(stringBuilder).append(" and ").append("wave_type = ") - .append(deviceInfoParam.getWaveType()); - - - //套用公式(page-1)*pageSize - int i1 = (deviceInfoParam.getPageNum() - 1) * deviceInfoParam.getPageSize(); - //拼接分页sql - stringResult.append(" LIMIT ").append(deviceInfoParam.getPageSize()).append(" OFFSET ").append(i1).append(" tz('Asia/Shanghai')"); - - - //查询sql语句总条数 - stringTotal = new StringBuilder("SELECT COUNT(num) as aa FROM ").append(Param.EVENT_DETAIL).append(" WHERE ").append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(deviceInfoParam.getSearchBeginTime()))).append("' and ") - .append("time <= '").append(DateUtil.endOfDay(DateUtil.parse(deviceInfoParam.getSearchEndTime()))).append("' and "); - stringTotal.append(stringBuilder).append(" tz('Asia/Shanghai')"); - - //结果集 - QueryResult result = influxDbUtils.query(stringResult.toString()); - //总条数 - resultTotal = influxDbUtils.query(stringTotal.toString()); - - - //结果集映射到对象中 - eventDetailList = influxDBResultMapper.toPOJO(result, WaveTypeVO.class); - - - //如果集合中没有对象则返回空page - if (eventDetailList.size() == 0) { - return new Page<>(); - } - - } - - - //获取关于监测点发电站相关信息 - HttpResult> baseLineAreaInfo = lineFeignClient.getBaseLineAreaInfo(lineIds); - System.out.println(baseLineAreaInfo); - //将返回的封装好的结果集进行还原成集合 - List areaLineList = baseLineAreaInfo.getData(); - - - //将监测点发电机相关信息copy到准备好的VO对象中 - for (WaveTypeVO waveTypeVO : eventDetailList) { - if (waveTypeVO.getLineId() != null) { - for (AreaLineInfoVO lineInfoVO : areaLineList) { - if (waveTypeVO.getLineId().equals(lineInfoVO.getLineId())) { - waveTypeVO.setSubName(lineInfoVO.getSubName()); - waveTypeVO.setLineId(lineInfoVO.getLineId()); - waveTypeVO.setLineName(lineInfoVO.getLineName()); - waveTypeVO.setGdId(lineInfoVO.getGdId()); - waveTypeVO.setGdName(lineInfoVO.getGdName()); - waveTypeVO.setVoltageId(lineInfoVO.getVoltageId()); - waveTypeVO.setNoDealCount(lineInfoVO.getNoDealCount()); - waveTypeVO.setCt1(lineInfoVO.getCt1()); - waveTypeVO.setCt2(lineInfoVO.getCt2()); - waveTypeVO.setPt1(lineInfoVO.getPt1()); - waveTypeVO.setPt2(lineInfoVO.getPt2()); - waveTypeVO.setRunFlag(lineInfoVO.getRunFlag()); - waveTypeVO.setComFlag(lineInfoVO.getComFlag()); - waveTypeVO.setIp(lineInfoVO.getIp()); - waveTypeVO.setLat(lineInfoVO.getLat()); - waveTypeVO.setLng(lineInfoVO.getLng()); - waveTypeVO.setManufacturer(lineInfoVO.getManufacturer()); - waveTypeVO.setVoltageScale(lineInfoVO.getVoltageScale()); - } - } - } else { - //抛出异常,当前监测点id为空 - throw new BusinessException(EventResponseEnum.EVENT_NOT_FOUND); - } - } - - - //使用字典表对暂态类型和暂态原因进行转换 - HttpResult> reason = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.EVENT_REASON.getName()); - HttpResult> type = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.EVENT_TYPE.getName()); - //获取字典数据暂态原因集合 - List eventReasonList = reason.getData(); - System.out.println(eventReasonList); - //获取字典数据暂态类型集合 - List eventTypeList = type.getData(); - System.out.println(eventTypeList); - - for (WaveTypeVO waveTypeVO : eventDetailList) { - if (waveTypeVO.getEventReason() != null) { - for (DictData dictData : eventReasonList) { - //将字典数据id与VO中属性eventReason对应的字符串进行比较 - if (waveTypeVO.getEventReason().equals(dictData.getId())) { - waveTypeVO.setEventReason(dictData.getName()); - } - } - } else { - //抛出异常,当前暂态原因为空 - throw new BusinessException(EventResponseEnum.EVENT_REASON_NOT_FOUND); - } - } - - for (WaveTypeVO waveTypeVO : eventDetailList) { - if (waveTypeVO.getEventType() != null) { - for (DictData dictData : eventTypeList) { - //将字典数据id与VO中属性eventType对应的字符串进行比较 - if (waveTypeVO.getEventType().equals(dictData.getId())) { - waveTypeVO.setEventType(dictData.getName()); - } - } - } else { - //抛出异常,当前暂态类型为空 - throw new BusinessException(EventResponseEnum.EVENT_TYPE_NOT_FOUND); - } - } - } else { - //集合没有id,返回空对象 - return new Page<>(); - - } - Page page = new Page<>(); - long total = new BigDecimal(resultTotal.getResults().get(0).getSeries().get(0).getValues().get(0).get(1).toString()).longValue(); - page.setTotal(total); - page.setRecords(eventDetailList); - page.setCurrent(deviceInfoParam.getPageNum()); - page.setSize(deviceInfoParam.getPageSize()); - return page; - - - //TODO 不在线,并且没有搜索框的值 - } else if (deviceInfoParam.getComFlag().equals(0) && Objects.isNull(deviceInfoParam.getSearchValue())) { - - //set参数,查询不在线人数 - lineBaseQueryParam.setLineIds(lineIds); - lineBaseQueryParam.setComFlag(deviceInfoParam.getComFlag()); - - //调用方法查看哪些离线 - List unLine = lineFeignClient.getOnOrUnLine(lineBaseQueryParam).getData(); - - - //使用工具类替代fori循环,不然进行不了分页 - //调用创建好的line_id拼接工具,如:where id = '1' or id = '2' - StringBuilder stringBuilder = InfluxDBCommUtils.assToInfluxParam(unLine); - - //判断当前检测点集合是否为空 - if (CollectionUtil.isNotEmpty(unLine)) { - - //触发类型为空 - if (Objects.isNull(deviceInfoParam.getWaveType())) { - - - StringBuilder stringResult = new StringBuilder(Param.SELECT).append(Param.EVENT_DETAIL).append(Param.WHERE). - append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(deviceInfoParam.getSearchBeginTime()))).append("' and ").append("time <= '") - .append(DateUtil.endOfDay(DateUtil.parse(deviceInfoParam.getSearchEndTime()))) - .append("' and ").append(stringBuilder); - - - //套用公式(page-1)*pageSize - int i1 = (deviceInfoParam.getPageNum() - 1) * deviceInfoParam.getPageSize(); - //拼接分页sql - stringResult.append(" LIMIT ").append(deviceInfoParam.getPageSize()).append(" OFFSET ").append(i1).append(" tz('Asia/Shanghai')"); - - - //查询sql语句总条数 - stringTotal = new StringBuilder("SELECT COUNT(num) as aa FROM ").append(Param.EVENT_DETAIL).append(" WHERE ").append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(deviceInfoParam.getSearchBeginTime()))).append("' and ") - .append("time <= '").append(DateUtil.endOfDay(DateUtil.parse(deviceInfoParam.getSearchEndTime()))).append("' and "); - stringTotal.append(stringBuilder).append(" tz('Asia/Shanghai')"); - - //结果集 - QueryResult result = influxDbUtils.query(stringResult.toString()); - //总条数 - resultTotal = influxDbUtils.query(stringTotal.toString()); - - - //结果集映射到对象中 - eventDetailList = influxDBResultMapper.toPOJO(result, WaveTypeVO.class); - - - //如果集合中没有对象则返回空page - if (eventDetailList.size() == 0) { - return new Page<>(); - } - - //触发类型不为空 - } else if (Objects.nonNull(deviceInfoParam.getWaveType())) { - - - StringBuilder stringResult = new StringBuilder(Param.SELECT).append(Param.EVENT_DETAIL).append(Param.WHERE). - append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(deviceInfoParam.getSearchBeginTime()))).append("' and ").append("time <= '") - .append(DateUtil.endOfDay(DateUtil.parse(deviceInfoParam.getSearchEndTime()))) - .append("' and ").append(stringBuilder).append(" and ").append("wave_type = ") - .append(deviceInfoParam.getWaveType()); - - - //套用公式(page-1)*pageSize - int i1 = (deviceInfoParam.getPageNum() - 1) * deviceInfoParam.getPageSize(); - //拼接分页sql - stringResult.append(" LIMIT ").append(deviceInfoParam.getPageSize()).append(" OFFSET ").append(i1).append(" tz('Asia/Shanghai')"); - - - //查询sql语句总条数 - stringTotal = new StringBuilder("SELECT COUNT(num) as aa FROM ").append(Param.EVENT_DETAIL).append(" WHERE ").append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(deviceInfoParam.getSearchBeginTime()))).append("' and ") - .append("time <= '").append(DateUtil.endOfDay(DateUtil.parse(deviceInfoParam.getSearchEndTime()))).append("' and "); - stringTotal.append(stringBuilder).append(" tz('Asia/Shanghai')"); - - //结果集 - QueryResult result = influxDbUtils.query(stringResult.toString()); - //总条数 - resultTotal = influxDbUtils.query(stringTotal.toString()); - - - //结果集映射到对象中 - eventDetailList = influxDBResultMapper.toPOJO(result, WaveTypeVO.class); - - - //如果集合中没有对象则返回空page - if (eventDetailList.size() == 0) { - return new Page<>(); - } - - } - - - //获取关于监测点发电站相关信息 - HttpResult> baseLineAreaInfo = lineFeignClient.getBaseLineAreaInfo(lineIds); - System.out.println(baseLineAreaInfo); - //将返回的封装好的结果集进行还原成集合 - List areaLineList = baseLineAreaInfo.getData(); - - - //将监测点发电机相关信息copy到准备好的VO对象中 - for (WaveTypeVO waveTypeVO : eventDetailList) { - if (waveTypeVO.getLineId() != null) { - for (AreaLineInfoVO lineInfoVO : areaLineList) { - if (waveTypeVO.getLineId().equals(lineInfoVO.getLineId())) { - waveTypeVO.setSubName(lineInfoVO.getSubName()); - waveTypeVO.setLineId(lineInfoVO.getLineId()); - waveTypeVO.setLineName(lineInfoVO.getLineName()); - waveTypeVO.setGdId(lineInfoVO.getGdId()); - waveTypeVO.setGdName(lineInfoVO.getGdName()); - waveTypeVO.setVoltageId(lineInfoVO.getVoltageId()); - waveTypeVO.setNoDealCount(lineInfoVO.getNoDealCount()); - waveTypeVO.setCt1(lineInfoVO.getCt1()); - waveTypeVO.setCt2(lineInfoVO.getCt2()); - waveTypeVO.setPt1(lineInfoVO.getPt1()); - waveTypeVO.setPt2(lineInfoVO.getPt2()); - waveTypeVO.setRunFlag(lineInfoVO.getRunFlag()); - waveTypeVO.setComFlag(lineInfoVO.getComFlag()); - waveTypeVO.setIp(lineInfoVO.getIp()); - waveTypeVO.setLat(lineInfoVO.getLat()); - waveTypeVO.setLng(lineInfoVO.getLng()); - waveTypeVO.setManufacturer(lineInfoVO.getManufacturer()); - waveTypeVO.setVoltageScale(lineInfoVO.getVoltageScale()); - } - } - } - } - - - //使用字典表对暂态类型和暂态原因进行转换 - HttpResult> reason = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.EVENT_REASON.getName()); - HttpResult> type = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.EVENT_TYPE.getName()); - //获取字典数据暂态原因集合 - List eventReasonList = reason.getData(); - System.out.println(eventReasonList); - //获取字典数据暂态类型集合 - List eventTypeList = type.getData(); - System.out.println(eventTypeList); - - for (WaveTypeVO waveTypeVO : eventDetailList) { - if (waveTypeVO.getEventReason() != null) { - for (DictData dictData : eventReasonList) { - //将字典数据id与VO中属性eventReason对应的字符串进行比较 - if (waveTypeVO.getEventReason().equals(dictData.getId())) { - waveTypeVO.setEventReason(dictData.getName()); - break; - } - } - } else { - //抛出异常,当前暂态原因为空 - throw new BusinessException(EventResponseEnum.EVENT_REASON_NOT_FOUND); - } - } - - for (WaveTypeVO waveTypeVO : eventDetailList) { - if (waveTypeVO.getEventType() != null) { - for (DictData dictData : eventTypeList) { - //将字典数据id与VO中属性eventType对应的字符串进行比较 - if (waveTypeVO.getEventType().equals(dictData.getId())) { - waveTypeVO.setEventType(dictData.getName()); - break; - } - } - } else { - //抛出异常,当前暂态类型为空 - throw new BusinessException(EventResponseEnum.EVENT_TYPE_NOT_FOUND); - } - } - } else { - //当前id未查询到结果,new 空对象返回 - return new Page<>(); - - } - Page page = new Page<>(); - long total = new BigDecimal(resultTotal.getResults().get(0).getSeries().get(0).getValues().get(0).get(1).toString()).longValue(); - page.setTotal(total); - page.setRecords(eventDetailList); - page.setCurrent(deviceInfoParam.getPageNum()); - page.setSize(deviceInfoParam.getPageSize()); - return page; - - - //TODO 不在线,并且有搜索框的值 - } else { - - //传入监测点集合和在线离线 - lineBaseQueryParam.setLineIds(lineIds); - lineBaseQueryParam.setComFlag(deviceInfoParam.getComFlag()); - //搜索框的值也传进去 - lineBaseQueryParam.setSearchValue(deviceInfoParam.getSearchValue()); - - //返回对象结果集合 - resultList = lineFeignClient.getRichLineInfo(lineBaseQueryParam).getData(); - - //进行循环遍历将line_id塞入集合 - for (AreaLineInfoVO areaLineInfoVO : resultList) { - lineIdList.add(areaLineInfoVO.getLineId()); - } - - //上面的方法已经将判断在线离线和搜索框结果一起返回了 - //调用方法查看哪些在线 - //List unLine = lineFeignClient.getOnOrUnLine(lineBaseQueryParam).getData(); - - //使用工具类替代fori循环,不然进行不了分页 - //调用创建好的line_id拼接工具,如:where id = '1' or id = '2' - StringBuilder stringBuilder = InfluxDBCommUtils.assToInfluxParam(lineIdList); - - //判断当前检测点集合是否为空 - if (CollectionUtil.isNotEmpty(lineIdList)) { - - //触发类型为空 - if (Objects.isNull(deviceInfoParam.getWaveType())) { - - - StringBuilder stringResult = new StringBuilder(Param.SELECT).append(Param.EVENT_DETAIL).append(Param.WHERE). - append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(deviceInfoParam.getSearchBeginTime()))).append("' and ").append("time <= '") - .append(DateUtil.endOfDay(DateUtil.parse(deviceInfoParam.getSearchEndTime()))) - .append("' and ").append(stringBuilder); - - - //套用公式(page-1)*pageSize - int i1 = (deviceInfoParam.getPageNum() - 1) * deviceInfoParam.getPageSize(); - //拼接分页sql - stringResult.append(" LIMIT ").append(deviceInfoParam.getPageSize()).append(" OFFSET ").append(i1).append(" tz('Asia/Shanghai')"); - - - //查询sql语句总条数 - stringTotal = new StringBuilder("SELECT COUNT(num) as aa FROM ").append(Param.EVENT_DETAIL).append(" WHERE ").append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(deviceInfoParam.getSearchBeginTime()))).append("' and ") - .append("time <= '").append(DateUtil.endOfDay(DateUtil.parse(deviceInfoParam.getSearchEndTime()))).append("' and "); - stringTotal.append(stringBuilder).append(" tz('Asia/Shanghai')"); - - //结果集 - QueryResult result = influxDbUtils.query(stringResult.toString()); - //总条数 - resultTotal = influxDbUtils.query(stringTotal.toString()); - - - //结果集映射到对象中 - eventDetailList = influxDBResultMapper.toPOJO(result, WaveTypeVO.class); - - - //如果集合中没有对象则返回空page - if (eventDetailList.size() == 0) { - return new Page<>(); - } - - //触发类型不为空 - } else if (Objects.nonNull(deviceInfoParam.getWaveType())) { - - - StringBuilder stringResult = new StringBuilder(Param.SELECT).append(Param.EVENT_DETAIL).append(Param.WHERE). - append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(deviceInfoParam.getSearchBeginTime()))).append("' and ").append("time <= '") - .append(DateUtil.endOfDay(DateUtil.parse(deviceInfoParam.getSearchEndTime()))) - .append("' and ").append(stringBuilder).append(" and ").append("wave_type = ") - .append(deviceInfoParam.getWaveType()); - - - //套用公式(page-1)*pageSize - int i1 = (deviceInfoParam.getPageNum() - 1) * deviceInfoParam.getPageSize(); - //拼接分页sql - stringResult.append(" LIMIT ").append(deviceInfoParam.getPageSize()).append(" OFFSET ").append(i1).append(" tz('Asia/Shanghai')"); - - - //查询sql语句总条数 - stringTotal = new StringBuilder("SELECT COUNT(num) as aa FROM ").append(Param.EVENT_DETAIL).append(" WHERE ").append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(deviceInfoParam.getSearchBeginTime()))).append("' and ") - .append("time <= '").append(DateUtil.endOfDay(DateUtil.parse(deviceInfoParam.getSearchEndTime()))).append("' and "); - stringTotal.append(stringBuilder).append(" tz('Asia/Shanghai')"); - - //结果集 - QueryResult result = influxDbUtils.query(stringResult.toString()); - //总条数 - resultTotal = influxDbUtils.query(stringTotal.toString()); - - - //结果集映射到对象中 - eventDetailList = influxDBResultMapper.toPOJO(result, WaveTypeVO.class); - - - //如果集合中没有对象则返回空page - if (eventDetailList.size() == 0) { - return new Page<>(); - } - - } - - - //获取关于监测点发电站相关信息 - HttpResult> baseLineAreaInfo = lineFeignClient.getBaseLineAreaInfo(lineIds); - System.out.println(baseLineAreaInfo); - //将返回的封装好的结果集进行还原成集合 - List areaLineList = baseLineAreaInfo.getData(); - - - //将监测点发电机相关信息copy到准备好的VO对象中 - for (WaveTypeVO waveTypeVO : eventDetailList) { - if (waveTypeVO.getLineId() != null) { - for (AreaLineInfoVO lineInfoVO : areaLineList) { - if (waveTypeVO.getLineId().equals(lineInfoVO.getLineId())) { - waveTypeVO.setSubName(lineInfoVO.getSubName()); - waveTypeVO.setLineId(lineInfoVO.getLineId()); - waveTypeVO.setLineName(lineInfoVO.getLineName()); - waveTypeVO.setGdId(lineInfoVO.getGdId()); - waveTypeVO.setGdName(lineInfoVO.getGdName()); - waveTypeVO.setVoltageId(lineInfoVO.getVoltageId()); - waveTypeVO.setNoDealCount(lineInfoVO.getNoDealCount()); - waveTypeVO.setCt1(lineInfoVO.getCt1()); - waveTypeVO.setCt2(lineInfoVO.getCt2()); - waveTypeVO.setPt1(lineInfoVO.getPt1()); - waveTypeVO.setPt2(lineInfoVO.getPt2()); - waveTypeVO.setRunFlag(lineInfoVO.getRunFlag()); - waveTypeVO.setComFlag(lineInfoVO.getComFlag()); - waveTypeVO.setIp(lineInfoVO.getIp()); - waveTypeVO.setLat(lineInfoVO.getLat()); - waveTypeVO.setLng(lineInfoVO.getLng()); - waveTypeVO.setManufacturer(lineInfoVO.getManufacturer()); - waveTypeVO.setVoltageScale(lineInfoVO.getVoltageScale()); - } - } - } - } - - - //使用字典表对暂态类型和暂态原因进行转换 - HttpResult> reason = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.EVENT_REASON.getName()); - HttpResult> type = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.EVENT_TYPE.getName()); - //获取字典数据暂态原因集合 - List eventReasonList = reason.getData(); - System.out.println(eventReasonList); - //获取字典数据暂态类型集合 - List eventTypeList = type.getData(); - System.out.println(eventTypeList); - - for (WaveTypeVO waveTypeVO : eventDetailList) { - if (waveTypeVO.getEventReason() != null) { - for (DictData dictData : eventReasonList) { - //将字典数据id与VO中属性eventReason对应的字符串进行比较 - if (waveTypeVO.getEventReason().equals(dictData.getId())) { - waveTypeVO.setEventReason(dictData.getName()); - break; - } - } - } else { - //抛出异常,当前暂态原因为空 - throw new BusinessException(EventResponseEnum.EVENT_REASON_NOT_FOUND); - } - } - - for (WaveTypeVO waveTypeVO : eventDetailList) { - if (waveTypeVO.getEventType() != null) { - for (DictData dictData : eventTypeList) { - //将字典数据id与VO中属性eventType对应的字符串进行比较 - if (waveTypeVO.getEventType().equals(dictData.getId())) { - waveTypeVO.setEventType(dictData.getName()); - break; - } - } - } else { - //抛出异常,当前暂态类型为空 - throw new BusinessException(EventResponseEnum.EVENT_TYPE_NOT_FOUND); - } - } - } else { - //如果集合中没有对象则返回空page - return new Page<>(); - } - Page page = new Page<>(); - long total = new BigDecimal(resultTotal.getResults().get(0).getSeries().get(0).getValues().get(0).get(1).toString()).longValue(); - page.setTotal(total); - page.setRecords(eventDetailList); - page.setCurrent(deviceInfoParam.getPageNum()); - page.setSize(deviceInfoParam.getPageSize()); - return page; } + return page; } + + /** * 获取区域报告 * @@ -2469,7 +2063,7 @@ public class ReportServiceImpl implements ReportService { //事件统计表格(部门查询) List generalDeviceDTOList = generalDeviceInfoClient.getPracticalAllDeviceInfo(areaReportParam).getData(); //测试id - generalDeviceDTOList.get(9).getLineIndexes().add("97ec50b62c84d39d1e15d83e61e06844"); +// generalDeviceDTOList.get(9).getLineIndexes().add("97ec50b62c84d39d1e15d83e61e06844"); //这是总的监测点id List lineIds = generalDeviceDTOList.stream().flatMap(dto -> dto.getLineIndexes().stream()).collect(Collectors.toList()); @@ -2785,11 +2379,11 @@ public class ReportServiceImpl implements ReportService { Date date1 = DateUtil.parse(timeId); int day = Integer.parseInt(String.format("%td",date1));*/ - dayCount.add(DateUtil.format(DateUtil.parse(eventDetail.getTimeId()), fmt)); + dayCount.add(DateUtil.format(DateUtil.parse(eventDetail.getStartTime()), fmt)); //创建对象 AreaEventMonthParam timeParam = new AreaEventMonthParam(); - timeParam.setDayOrMonth(DateUtil.format(DateUtil.parse(eventDetail.getTimeId()), fmt)); + timeParam.setDayOrMonth(DateUtil.format(DateUtil.parse(eventDetail.getStartTime()), fmt)); timeParam.setEventAssIndex(eventDetail.getEventassIndex()); timeList.add(timeParam); } @@ -2930,11 +2524,11 @@ public class ReportServiceImpl implements ReportService { /* String timeId = eventDetail.getTimeId(); Date date1 = DateUtil.parse(timeId); int day = Integer.parseInt(String.format("%td",date1));*/ - dayCount.add(DateUtil.formatDate(DateUtil.parse(eventDetail.getTimeId()))); + dayCount.add(DateUtil.formatDate(DateUtil.parse(eventDetail.getStartTime()))); //创建对象 AreaEventMonthParam timeParam = new AreaEventMonthParam(); - timeParam.setDayOrMonth(DateUtil.formatDate(DateUtil.parse(eventDetail.getTimeId()))); + timeParam.setDayOrMonth(DateUtil.formatDate(DateUtil.parse(eventDetail.getStartTime()))); timeParam.setEventAssIndex(eventDetail.getEventassIndex()); timeList.add(timeParam); } @@ -4725,12 +4319,12 @@ public class ReportServiceImpl implements ReportService { List obs = new ArrayList<>(); ArrayList> list = new ArrayList<>(); for (EventDetailNew eventDetail : detailList) { - obs.add(new OB(Double.parseDouble(eventDetail.getPersistTime() / 1000 + "") - , Double.parseDouble(eventDetail.getEventValue() * 100 + ""))); + obs.add(new OB(Double.parseDouble(eventDetail.getDuration() / 1000 + "") + , Double.parseDouble(eventDetail.getFeatureAmplitude() * 100 + ""))); ArrayList doubles = new ArrayList<>(); - doubles.add(Double.parseDouble(eventDetail.getPersistTime() / 1000 + "")); - doubles.add(Double.parseDouble(String.valueOf(eventDetail.getEventValue() * 100))); + doubles.add(Double.parseDouble(eventDetail.getDuration() / 1000 + "")); + doubles.add(Double.parseDouble(String.valueOf(eventDetail.getFeatureAmplitude() * 100))); list.add(doubles); } @@ -4810,11 +4404,11 @@ public class ReportServiceImpl implements ReportService { ArrayList> list = new ArrayList<>(); for (EventDetailNew eventDetail : detailList) { - obs.add(new OB(Double.parseDouble(eventDetail.getPersistTime() / 1000 + ""), Double.parseDouble(eventDetail.getEventValue() * 100 + ""))); + obs.add(new OB(Double.parseDouble(eventDetail.getDuration() / 1000 + ""), Double.parseDouble(eventDetail.getFeatureAmplitude() * 100 + ""))); ArrayList doubles = new ArrayList<>(); - doubles.add(Double.parseDouble(eventDetail.getPersistTime() / 1000 + "")); - doubles.add(Double.parseDouble(String.valueOf(eventDetail.getEventValue() * 100))); + doubles.add(Double.parseDouble(eventDetail.getDuration() / 1000 + "")); + doubles.add(Double.parseDouble(String.valueOf(eventDetail.getFeatureAmplitude() * 100))); list.add(doubles); } @@ -5217,13 +4811,14 @@ public class ReportServiceImpl implements ReportService { //将时间数存入集合Map集合(主数据) for (EventDetailNew detail : eventList) { - timeCount.put(detail.getEventassIndex(), detail.getTimeId()); + timeCount.put(detail.getEventassIndex(), detail.getStartTime()); } //时间拼接 event_time=getEventassIndex StringBuilder stringBuilder = InfluxDBCommUtils.assToInfluxParamAndName(new ArrayList<>(timeCount.keySet()), "event_time"); - StringBuilder stringResult1 = new StringBuilder(Param.SELECT).append("pqs_eventass").append(Param.WHERE). - append("event_time = '").append(stringBuilder).append("' "); + StringBuilder stringResult1 = new StringBuilder(Param.SELECT).append("pqs_eventass").append(Param.WHERE) + .append(stringBuilder); +// .append("event_time = '").append(stringBuilder).append("' "); //结果集 QueryResult result1 = influxDbUtils.query(stringResult1.toString()); @@ -5323,7 +4918,7 @@ public class ReportServiceImpl implements ReportService { Map resultMap = new HashMap<>(); //优化数据(根据暂降原因,进行分组统计有多少条数据,key:暂降原因id,value:次数) - Map reasonMapCount = eventDetailList.stream().collect(Collectors.groupingBy(EventDetailNew::getEventReason, Collectors.counting())); + Map reasonMapCount = eventDetailList.stream().collect(Collectors.groupingBy(EventDetailNew::getAdvanceReason, Collectors.counting())); //将数据重新整合为(key:暂降原因的名称,value:暂降原因测次数) reasonMap.forEach((key, value) -> { if (reasonMapCount.containsKey(key)) { @@ -5598,26 +5193,28 @@ public class ReportServiceImpl implements ReportService { //如果集合中有id将id进行拼接 if (CollectionUtil.isNotEmpty(lineIndexes)) { - StringBuilder stringBuilder = InfluxDBCommUtils.assToInfluxParam(lineIndexes); + //数据统计 + Integer eventDetailCount = getEventDetailCount(areaReportParam,lineIndexes); + areaCount1.put(generalDeviceDTO.getName(),eventDetailCount); - - //查询sql语句总条数 - StringBuilder stringTotal = new StringBuilder("SELECT COUNT(num) as aa FROM ").append(Param.EVENT_DETAIL).append(" WHERE ").append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(areaReportParam.getSearchBeginTime()))).append("' and ") - .append("time <= '").append(DateUtil.endOfDay(DateUtil.parse(areaReportParam.getSearchEndTime()))).append("' and "); - stringTotal.append(stringBuilder).append(" and ").append("(wave_type = 0 or wave_type = 1 or wave_type = 2 or wave_type = 3 or wave_type = 4)").append(" tz('Asia/Shanghai')"); - - //总条数 - QueryResult resultTotal = influxDbUtils.query(stringTotal.toString()); - - - if (ObjectUtil.isNull(resultTotal.getResults().get(0).getSeries())) { - areaCount1.put(generalDeviceDTO.getName(), 0); - - } else { - double count = Double.valueOf(resultTotal.getResults().get(0).getSeries().get(0).getValues().get(0).get(1).toString()); - - areaCount1.put(generalDeviceDTO.getName(), Integer.valueOf((int) count)); - } +// StringBuilder stringBuilder = InfluxDBCommUtils.assToInfluxParam(lineIndexes); +// //查询sql语句总条数 +// StringBuilder stringTotal = new StringBuilder("SELECT COUNT(num) as aa FROM ").append(Param.EVENT_DETAIL).append(" WHERE ").append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(areaReportParam.getSearchBeginTime()))).append("' and ") +// .append("time <= '").append(DateUtil.endOfDay(DateUtil.parse(areaReportParam.getSearchEndTime()))).append("' and "); +// stringTotal.append(stringBuilder).append(" and ").append("(wave_type = 0 or wave_type = 1 or wave_type = 2 or wave_type = 3 or wave_type = 4)").append(" tz('Asia/Shanghai')"); +// +// //总条数 +// QueryResult resultTotal = influxDbUtils.query(stringTotal.toString()); +// +// +// if (ObjectUtil.isNull(resultTotal.getResults().get(0).getSeries())) { +// areaCount1.put(generalDeviceDTO.getName(), 0); +// +// } else { +// double count = Double.valueOf(resultTotal.getResults().get(0).getSeries().get(0).getValues().get(0).get(1).toString()); +// +// areaCount1.put(generalDeviceDTO.getName(), Integer.valueOf((int) count)); +// } } else { //为空put 0 @@ -5674,10 +5271,10 @@ public class ReportServiceImpl implements ReportService { pmsDeviceInfoParam.setStatisticalType(areaReportParam.getStatisticalType()); //获取主网台账信息 List generalDeviceDTOList = pmsGeneralDeviceInfoClient.getPmsDeviceInfoWithInOrg(pmsDeviceInfoParam).getData(); - if(areaReportParam.getDeptIndex().equals("0d52f9f6e43ec0ee83013cd32da93f66")){ - //测试id - generalDeviceDTOList.get(0).getMonitorIdList().add("97ec50b62c84d39d1e15d83e61e06844"); - } +// if(areaReportParam.getDeptIndex().equals("0d52f9f6e43ec0ee83013cd32da93f66")){ +// //测试id +// generalDeviceDTOList.get(0).getMonitorIdList().add("97ec50b62c84d39d1e15d83e61e06844"); +// } //这是总的监测点id List lineIds = generalDeviceDTOList.stream().flatMap(dto -> dto.getMonitorIdList().stream()).collect(Collectors.toList()); @@ -5997,11 +5594,11 @@ public class ReportServiceImpl implements ReportService { Date date1 = DateUtil.parse(timeId); int day = Integer.parseInt(String.format("%td",date1));*/ - dayCount.add(DateUtil.format(DateUtil.parse(eventDetail.getTimeId()), fmt)); + dayCount.add(DateUtil.format(DateUtil.parse(eventDetail.getStartTime()), fmt)); //创建对象 AreaEventMonthParam timeParam = new AreaEventMonthParam(); - timeParam.setDayOrMonth(DateUtil.format(DateUtil.parse(eventDetail.getTimeId()), fmt)); + timeParam.setDayOrMonth(DateUtil.format(DateUtil.parse(eventDetail.getStartTime()), fmt)); timeParam.setEventAssIndex(eventDetail.getEventassIndex()); timeList.add(timeParam); } @@ -6142,11 +5739,11 @@ public class ReportServiceImpl implements ReportService { /* String timeId = eventDetail.getTimeId(); Date date1 = DateUtil.parse(timeId); int day = Integer.parseInt(String.format("%td",date1));*/ - dayCount.add(DateUtil.formatDate(DateUtil.parse(eventDetail.getTimeId()))); + dayCount.add(DateUtil.formatDate(DateUtil.parse(eventDetail.getStartTime()))); //创建对象 AreaEventMonthParam timeParam = new AreaEventMonthParam(); - timeParam.setDayOrMonth(DateUtil.formatDate(DateUtil.parse(eventDetail.getTimeId()))); + timeParam.setDayOrMonth(DateUtil.formatDate(DateUtil.parse(eventDetail.getStartTime()))); timeParam.setEventAssIndex(eventDetail.getEventassIndex()); timeList.add(timeParam); } @@ -7937,12 +7534,12 @@ public class ReportServiceImpl implements ReportService { List obs = new ArrayList<>(); ArrayList> list = new ArrayList<>(); for (EventDetailNew eventDetail : detailList) { - obs.add(new OB(Double.parseDouble(eventDetail.getPersistTime() / 1000 + "") - , Double.parseDouble(eventDetail.getEventValue() * 100 + ""))); + obs.add(new OB(Double.parseDouble(eventDetail.getDuration() / 1000 + "") + , Double.parseDouble(eventDetail.getFeatureAmplitude() * 100 + ""))); ArrayList doubles = new ArrayList<>(); - doubles.add(Double.parseDouble(eventDetail.getPersistTime() / 1000 + "")); - doubles.add(Double.parseDouble(String.valueOf(eventDetail.getEventValue() * 100))); + doubles.add(Double.parseDouble(eventDetail.getDuration() / 1000 + "")); + doubles.add(Double.parseDouble(String.valueOf(eventDetail.getFeatureAmplitude() * 100))); list.add(doubles); } @@ -8022,11 +7619,11 @@ public class ReportServiceImpl implements ReportService { ArrayList> list = new ArrayList<>(); for (EventDetailNew eventDetail : detailList) { - obs.add(new OB(Double.parseDouble(eventDetail.getPersistTime() / 1000 + ""), Double.parseDouble(eventDetail.getEventValue() * 100 + ""))); + obs.add(new OB(Double.parseDouble(eventDetail.getDuration() / 1000 + ""), Double.parseDouble(eventDetail.getFeatureAmplitude() * 100 + ""))); ArrayList doubles = new ArrayList<>(); - doubles.add(Double.parseDouble(eventDetail.getPersistTime() / 1000 + "")); - doubles.add(Double.parseDouble(String.valueOf(eventDetail.getEventValue() * 100))); + doubles.add(Double.parseDouble(eventDetail.getDuration() / 1000 + "")); + doubles.add(Double.parseDouble(String.valueOf(eventDetail.getFeatureAmplitude() * 100))); list.add(doubles); } @@ -8429,7 +8026,7 @@ public class ReportServiceImpl implements ReportService { //将时间数存入集合Map集合(主数据) for (EventDetailNew detail : eventList) { - timeCount.put(detail.getEventassIndex(), detail.getTimeId()); + timeCount.put(detail.getEventassIndex(), detail.getStartTime()); } //时间拼接 event_time=getEventassIndex @@ -8535,7 +8132,7 @@ public class ReportServiceImpl implements ReportService { Map resultMap = new HashMap<>(); //优化数据(根据暂降原因,进行分组统计有多少条数据,key:暂降原因id,value:次数) - Map reasonMapCount = eventDetailList.stream().collect(Collectors.groupingBy(EventDetailNew::getEventReason, Collectors.counting())); + Map reasonMapCount = eventDetailList.stream().collect(Collectors.groupingBy(EventDetailNew::getAdvanceReason, Collectors.counting())); //将数据重新整合为(key:暂降原因的名称,value:暂降原因测次数) reasonMap.forEach((key, value) -> { if (reasonMapCount.containsKey(key)) { @@ -8810,26 +8407,30 @@ public class ReportServiceImpl implements ReportService { //如果集合中有id将id进行拼接 if (CollectionUtil.isNotEmpty(lineIndexes)) { - StringBuilder stringBuilder = InfluxDBCommUtils.assToInfluxParam(lineIndexes); + //数据统计 + Integer eventDetailCount = getEventDetailCount(areaReportParam,lineIndexes); + areaCount1.put(generalDeviceDTO.getName(),eventDetailCount); - - //查询sql语句总条数 - StringBuilder stringTotal = new StringBuilder("SELECT COUNT(num) as aa FROM ").append(Param.EVENT_DETAIL).append(" WHERE ").append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(areaReportParam.getSearchBeginTime()))).append("' and ") - .append("time <= '").append(DateUtil.endOfDay(DateUtil.parse(areaReportParam.getSearchEndTime()))).append("' and "); - stringTotal.append(stringBuilder).append(" and ").append("(wave_type = 0 or wave_type = 1 or wave_type = 2 or wave_type = 3 or wave_type = 4)").append(" tz('Asia/Shanghai')"); - - //总条数 - QueryResult resultTotal = influxDbUtils.query(stringTotal.toString()); - - - if (ObjectUtil.isNull(resultTotal.getResults().get(0).getSeries())) { - areaCount1.put(generalDeviceDTO.getName(), 0); - - } else { - double count = Double.valueOf(resultTotal.getResults().get(0).getSeries().get(0).getValues().get(0).get(1).toString()); - - areaCount1.put(generalDeviceDTO.getName(), Integer.valueOf((int) count)); - } +// StringBuilder stringBuilder = InfluxDBCommUtils.assToInfluxParam(lineIndexes); +// +// +// //查询sql语句总条数 +// StringBuilder stringTotal = new StringBuilder("SELECT COUNT(num) as aa FROM ").append(Param.EVENT_DETAIL).append(" WHERE ").append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(areaReportParam.getSearchBeginTime()))).append("' and ") +// .append("time <= '").append(DateUtil.endOfDay(DateUtil.parse(areaReportParam.getSearchEndTime()))).append("' and "); +// stringTotal.append(stringBuilder).append(" and ").append("(wave_type = 0 or wave_type = 1 or wave_type = 2 or wave_type = 3 or wave_type = 4)").append(" tz('Asia/Shanghai')"); +// +// //总条数 +// QueryResult resultTotal = influxDbUtils.query(stringTotal.toString()); +// +// +// if (ObjectUtil.isNull(resultTotal.getResults().get(0).getSeries())) { +// areaCount1.put(generalDeviceDTO.getName(), 0); +// +// } else { +// double count = Double.valueOf(resultTotal.getResults().get(0).getSeries().get(0).getValues().get(0).get(1).toString()); +// +// areaCount1.put(generalDeviceDTO.getName(), Integer.valueOf((int) count)); +// } } else { //为空put 0 @@ -8889,8 +8490,8 @@ public class ReportServiceImpl implements ReportService { } } for (int i = 0; i < areaTableParam.getInfo().size(); i++) { - Double eventvalue = areaTableParam.getInfo().get(i).getEventValue(); - double persisttime = areaTableParam.getInfo().get(i).getPersistTime(); + Double eventvalue = areaTableParam.getInfo().get(i).getFeatureAmplitude(); + double persisttime = areaTableParam.getInfo().get(i).getDuration(); if (eventvalue * 100 < 1 && eventvalue * 100 >= 0) { if (persisttime > 10 && persisttime <= 100) { arr[16][0]++; @@ -9229,8 +8830,8 @@ public class ReportServiceImpl implements ReportService { } } for (int i = 0; i < areaTableParam.getInfo().size(); i++) { - Double eventvalue = areaTableParam.getInfo().get(i).getEventValue(); - double persisttime = areaTableParam.getInfo().get(i).getPersistTime(); + Double eventvalue = areaTableParam.getInfo().get(i).getFeatureAmplitude(); + double persisttime = areaTableParam.getInfo().get(i).getDuration(); if (eventvalue * 100 < 1) { if (persisttime < 20 && persisttime >= 10) { arr[2][0]++; @@ -9291,8 +8892,8 @@ public class ReportServiceImpl implements ReportService { } } for (int i = 0; i < areaTableParam.getInfo().size(); i++) { - Double eventvalue = areaTableParam.getInfo().get(i).getEventValue(); - double persisttime = areaTableParam.getInfo().get(i).getPersistTime(); + Double eventvalue = areaTableParam.getInfo().get(i).getFeatureAmplitude(); + double persisttime = areaTableParam.getInfo().get(i).getDuration(); if (eventvalue * 100 < 10) { if (persisttime < 20) { arr[4][0]++; @@ -9446,7 +9047,7 @@ public class ReportServiceImpl implements ReportService { Integer count = 0; for (EventDetailNew eventDetail : areaTableParam.getInfo()) { //过滤掉大于0.9的数据 - if (eventDetail.getEventValue() <= 0.9) { + if (eventDetail.getFeatureAmplitude() <= 0.9) { count++; info.add(eventDetail); } @@ -9475,53 +9076,53 @@ public class ReportServiceImpl implements ReportService { subsectionMap.put("80~90", 0); //求数量 for (EventDetailNew eventDetail : info) { - if (eventDetail.getEventValue() < 0.1) { + if (eventDetail.getFeatureAmplitude() < 0.1) { countMap.put("<10", (countMap.get("<10") + 1)); } - if (eventDetail.getEventValue() < 0.2) { + if (eventDetail.getFeatureAmplitude() < 0.2) { countMap.put("<20", (countMap.get("<20") + 1)); } - if (eventDetail.getEventValue() < 0.3) { + if (eventDetail.getFeatureAmplitude() < 0.3) { countMap.put("<30", (countMap.get("<30") + 1)); } - if (eventDetail.getEventValue() < 0.4) { + if (eventDetail.getFeatureAmplitude() < 0.4) { countMap.put("<40", (countMap.get("<40") + 1)); } - if (eventDetail.getEventValue() < 0.5) { + if (eventDetail.getFeatureAmplitude() < 0.5) { countMap.put("<50", (countMap.get("<50") + 1)); } - if (eventDetail.getEventValue() < 0.6) { + if (eventDetail.getFeatureAmplitude() < 0.6) { countMap.put("<60", (countMap.get("<60") + 1)); } - if (eventDetail.getEventValue() < 0.7) { + if (eventDetail.getFeatureAmplitude() < 0.7) { countMap.put("<70", (countMap.get("<70") + 1)); } - if (eventDetail.getEventValue() < 0.8) { + if (eventDetail.getFeatureAmplitude() < 0.8) { countMap.put("<80", (countMap.get("<80") + 1)); } - if (eventDetail.getEventValue() < 0.9) { + if (eventDetail.getFeatureAmplitude() < 0.9) { countMap.put("<90", (countMap.get("<90") + 1)); } } //求每段数量 for (EventDetailNew eventDetail : info) { - if (eventDetail.getEventValue() < 0.1) { + if (eventDetail.getFeatureAmplitude() < 0.1) { subsectionMap.put("0~10", (subsectionMap.get("0~10") + 1)); - } else if (eventDetail.getEventValue() > 0.1 && eventDetail.getEventValue() < 0.2) { + } else if (eventDetail.getFeatureAmplitude() > 0.1 && eventDetail.getFeatureAmplitude() < 0.2) { subsectionMap.put("10~20", (subsectionMap.get("10~20") + 1)); - } else if (eventDetail.getEventValue() > 0.2 && eventDetail.getEventValue() < 0.3) { + } else if (eventDetail.getFeatureAmplitude() > 0.2 && eventDetail.getFeatureAmplitude() < 0.3) { subsectionMap.put("20~30", (subsectionMap.get("20~30") + 1)); - } else if (eventDetail.getEventValue() > 0.3 && eventDetail.getEventValue() < 0.4) { + } else if (eventDetail.getFeatureAmplitude() > 0.3 && eventDetail.getFeatureAmplitude() < 0.4) { subsectionMap.put("30~40", (subsectionMap.get("30~40") + 1)); - } else if (eventDetail.getEventValue() > 0.4 && eventDetail.getEventValue() < 0.5) { + } else if (eventDetail.getFeatureAmplitude() > 0.4 && eventDetail.getFeatureAmplitude() < 0.5) { subsectionMap.put("40~50", (subsectionMap.get("40~50") + 1)); - } else if (eventDetail.getEventValue() > 0.5 && eventDetail.getEventValue() < 0.6) { + } else if (eventDetail.getFeatureAmplitude() > 0.5 && eventDetail.getFeatureAmplitude() < 0.6) { subsectionMap.put("50~60", (subsectionMap.get("50~60") + 1)); - } else if (eventDetail.getEventValue() > 0.6 && eventDetail.getEventValue() < 0.7) { + } else if (eventDetail.getFeatureAmplitude() > 0.6 && eventDetail.getFeatureAmplitude() < 0.7) { subsectionMap.put("60~70", (subsectionMap.get("60~70") + 1)); - } else if (eventDetail.getEventValue() > 0.7 && eventDetail.getEventValue() < 0.8) { + } else if (eventDetail.getFeatureAmplitude() > 0.7 && eventDetail.getFeatureAmplitude() < 0.8) { subsectionMap.put("70~80", (subsectionMap.get("70~80") + 1)); - } else if (eventDetail.getEventValue() > 0.8 && eventDetail.getEventValue() < 0.9) { + } else if (eventDetail.getFeatureAmplitude() > 0.8 && eventDetail.getFeatureAmplitude() < 0.9) { subsectionMap.put("80~90", (subsectionMap.get("80~90") + 1)); } } @@ -9599,7 +9200,7 @@ public class ReportServiceImpl implements ReportService { timeMap.put("<180", 0); //求不同时间段的总数 for (EventDetailNew eventDetail : info) { - Double persistTime = eventDetail.getPersistTime(); + 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) { @@ -9660,7 +9261,7 @@ public class ReportServiceImpl implements ReportService { //求sisttime List sisttime = new ArrayList<>(); for (EventDetailNew eventDetail : info) { - Double persistTime = eventDetail.getPersistTime(); + Double persistTime = eventDetail.getDuration(); if (persistTime / 1000 < 0.1) { timeMap2.put("<0.1", timeMap2.get("<0.1") + 1); } @@ -9914,19 +9515,73 @@ public class ReportServiceImpl implements ReportService { * @return */ private List getEventDetailListInfo(AreaReportParam areaReportParam, List lineIds) { - StringBuilder stringBuilder = InfluxDBCommUtils.assToInfluxParam(lineIds); - //查询sql语句总条数 - StringBuilder stringResult = new StringBuilder("SELECT * FROM ").append(Param.EVENT_DETAIL).append(" WHERE ").append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(areaReportParam.getSearchBeginTime()))).append("' and ") - .append("time <= '").append(DateUtil.endOfDay(DateUtil.parse(areaReportParam.getSearchEndTime()))).append("' and "); - stringResult.append(stringBuilder).append(" and ").append("(wave_type = 0 or wave_type = 1 or wave_type = 2 or wave_type = 3 or wave_type = 4)").append(" tz('Asia/Shanghai')"); - // 结果集 - QueryResult result = influxDbUtils.query(stringResult.toString()); - //结果集映射到对象中 - InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper(); - return influxDBResultMapper.toPOJO(result, EventDetailNew.class); + //获取事件类型(短时中断 电压暂降 电压暂升 扰动 其他) + 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()) + || DicDataEnum.DISTURBANCE.getCode().equals(x.getCode()) + || DicDataEnum.OTHER.getCode().equals(x.getCode()) + || DicDataEnum.VOLTAGE_RISE.getCode().equals(x.getCode()) + ) + .map(DictData::getId).collect(Collectors.toList()); + + //数据暂降查询 + List info = eventDetailService.list(new LambdaQueryWrapper() + .in(RmpEventDetailPO::getMeasurementPointId, lineIds) + .in(RmpEventDetailPO::getEventType, typeIds) + .ge(StrUtil.isNotBlank(areaReportParam.getSearchBeginTime()), RmpEventDetailPO::getStartTime,DateUtil.beginOfDay(DateUtil.parse(areaReportParam.getSearchBeginTime()))) + .le(StrUtil.isNotBlank(areaReportParam.getSearchEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(areaReportParam.getSearchEndTime()))) + ); + if(CollUtil.isEmpty(info)){ + throw new BusinessException(EventResponseEnum.NOT_FOUND); + } + return BeanUtil.copyToList(info,EventDetailNew.class); + +// StringBuilder stringBuilder = InfluxDBCommUtils.assToInfluxParam(lineIds); +// //查询sql语句总条数 +// StringBuilder stringResult = new StringBuilder("SELECT * FROM ").append(Param.EVENT_DETAIL).append(" WHERE ").append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(areaReportParam.getSearchBeginTime()))).append("' and ") +// .append("time <= '").append(DateUtil.endOfDay(DateUtil.parse(areaReportParam.getSearchEndTime()))).append("' and "); +// stringResult.append(stringBuilder).append(" and ").append("(wave_type = 0 or wave_type = 1 or wave_type = 2 or wave_type = 3 or wave_type = 4)").append(" tz('Asia/Shanghai')"); +// // 结果集 +// QueryResult result = influxDbUtils.query(stringResult.toString()); +// //结果集映射到对象中 +// InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper(); +// return influxDBResultMapper.toPOJO(result, EventDetailNew.class); } + /** + * wr(热力图数据统计) + * + * @param lineIds 监测点集合 + * @return + */ + private Integer getEventDetailCount(AreaReportParam areaReportParam, List lineIds) { + + //获取事件类型(短时中断 电压暂降 电压暂升 扰动 其他) + 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()) + || DicDataEnum.DISTURBANCE.getCode().equals(x.getCode()) + || DicDataEnum.OTHER.getCode().equals(x.getCode()) + || DicDataEnum.VOLTAGE_RISE.getCode().equals(x.getCode()) + ) + .map(DictData::getId).collect(Collectors.toList()); + + //数据暂降查询 + int count = eventDetailService.count(new LambdaQueryWrapper() + .in(RmpEventDetailPO::getMeasurementPointId, lineIds) + .in(RmpEventDetailPO::getEventType, typeIds) + .ge(StrUtil.isNotBlank(areaReportParam.getSearchBeginTime()), RmpEventDetailPO::getStartTime, DateUtil.beginOfDay(DateUtil.parse(areaReportParam.getSearchBeginTime()))) + .le(StrUtil.isNotBlank(areaReportParam.getSearchEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(areaReportParam.getSearchEndTime()))) + ); + + return count; + } + + + + /** * wr(公共查询条数) * @@ -9934,6 +9589,7 @@ public class ReportServiceImpl implements ReportService { * @return */ private QueryResult getEventDetailListInfoNum(AreaReportParam areaReportParam, List lineIds) { + StringBuilder stringBuilder = InfluxDBCommUtils.assToInfluxParam(lineIds); //查询sql语句总条数 StringBuilder stringTotal = new StringBuilder("SELECT COUNT(num) as aa FROM ").append(Param.EVENT_DETAIL).append(" WHERE ").append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(areaReportParam.getSearchBeginTime()))).append("' and ") diff --git a/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/TransientServiceImpl.java b/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/TransientServiceImpl.java index afdede6f0..e0ea6e897 100644 --- a/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/TransientServiceImpl.java +++ b/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/TransientServiceImpl.java @@ -1,8 +1,10 @@ package com.njcn.event.service.majornetwork.Impl; +import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.njcn.common.config.GeneralInfo; import com.njcn.common.pojo.enums.common.ServerEnum; @@ -43,6 +45,7 @@ import com.njcn.system.api.DicDataFeignClient; import com.njcn.system.enums.DicDataTypeEnum; import com.njcn.system.pojo.po.DictData; import lombok.AllArgsConstructor; +import org.apache.commons.lang.StringUtils; import org.influxdb.dto.QueryResult; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; @@ -126,41 +129,41 @@ public class TransientServiceImpl implements TransientService { TransientVO transientVO = new TransientVO(); transientVO.setId(eventDetail.getLineId()); transientVO.setNumber(i++); - transientVO.setWaveName(eventDetail.getWaveName()); - Instant timeId = eventDetail.getTimeId(); + transientVO.setWaveName(eventDetail.getWavePath()); + Instant timeId = eventDetail.getStartTime(); ZoneId zoneId = ZoneId.systemDefault(); LocalDateTime localDateTime = LocalDateTime.ofInstant(timeId, zoneId); DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS"); String format = dateTimeFormatter.format(localDateTime); transientVO.setTime(format); - switch (eventDetail.getWaveType()) { - case 0: + switch (eventDetail.getEventType()) { + case 0+"": transientVO.setTrigType("扰动"); break; - case 1: + case 1+"": transientVO.setTrigType("暂降"); break; - case 2: + case 2+"": transientVO.setTrigType("暂升"); break; - case 3: + case 3+"": transientVO.setTrigType("中断"); break; - case 4: + case 4+"": transientVO.setTrigType("其他"); break; - case 5: + case 5+"": transientVO.setTrigType("录波"); break; } - Double eventValue = new BigDecimal(eventDetail.getEventValue()).setScale(3, BigDecimal.ROUND_HALF_UP).doubleValue(); + Double eventValue = new BigDecimal(eventDetail.getFeatureAmplitude()).setScale(3, BigDecimal.ROUND_HALF_UP).doubleValue(); transientVO.setEventValue(new BigDecimal(eventValue * 100).setScale(0, BigDecimal.ROUND_HALF_UP).doubleValue()); transientVO.setEventValues(100 - transientVO.getEventValue()); - transientVO.setPersistTime((Float.parseFloat(eventDetail.getPersistTime().toString())) / 1000); + transientVO.setPersistTime((Float.parseFloat(eventDetail.getDuration().toString())) / 1000); - transientVO.setYZD(getYZD(Float.parseFloat(eventDetail.getPersistTime().toString()), - Float.parseFloat(eventDetail.getEventValue().toString())) + transientVO.setYZD(getYZD(Float.parseFloat(eventDetail.getDuration().toString()), + Float.parseFloat(eventDetail.getFeatureAmplitude().toString())) ); transientVOS.add(transientVO); } @@ -297,17 +300,31 @@ public class TransientServiceImpl implements TransientService { if (!CollectionUtils.isEmpty(generalDeviceDTOList)) { //获取按终端分类的监测点索引集合 List lineList = generalDeviceDTOList.stream().flatMap(dto -> dto.getLineIndexes().stream()).collect(Collectors.toList()); + if(CollUtil.isNotEmpty(lineList)){ + Page pageInfo = eventDetailService.page(new Page<>(transientParam.getPageNum(), transientParam.getPageSize()), new LambdaQueryWrapper() + .in(RmpEventDetailPO::getMeasurementPointId, lineList) + .ge(StringUtils.isNotBlank(transientParam.getSearchBeginTime()), RmpEventDetailPO::getStartTime,DateUtil.beginOfDay(DateUtil.parse(transientParam.getSearchBeginTime()))) + .le(StringUtils.isNotBlank(transientParam.getSearchEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(transientParam.getSearchEndTime()))) - if (!CollectionUtils.isEmpty(lineList)) { - StringBuilder stringBuilder = InfluxDBCommUtils.assToInfluxParam(lineList); - //influxDB查询待分页数据总量 - Long total = getTransientDetail(stringBuilder, transientParam); - page.setTotal(total); - //分页总页数 - int pages = (int) Math.ceil(transientParam.getPageNum() * 1.0 / transientParam.getPageSize()); - page.setPages(pages); - //influxDB分页查询 - List eventDetailData = getTransientDetailLimit(lineList, transientParam); + //暂态幅值最小值 + .ge(Objects.nonNull(transientParam.getEventValueMin()),RmpEventDetailPO::getFeatureAmplitude, transientParam.getEventValueMin()) + .le(Objects.nonNull(transientParam.getEventValueMax()),RmpEventDetailPO::getFeatureAmplitude, transientParam.getEventValueMax()) + //持续时间最小值 + .ge(Objects.nonNull(transientParam.getPersistMin()),RmpEventDetailPO::getDuration, transientParam.getPersistMin()) + .le(Objects.nonNull(transientParam.getPersistMax()),RmpEventDetailPO::getDuration, transientParam.getPersistMax()) + //严重度最小值 + .ge(Objects.nonNull(transientParam.getSeverityMin()),RmpEventDetailPO::getSeverity, transientParam.getSeverityMin()) + .le(Objects.nonNull(transientParam.getSeverityMax()),RmpEventDetailPO::getSeverity, transientParam.getSeverityMax()) + //波形文件 + .eq(Objects.nonNull(transientParam.getFileFlag()),RmpEventDetailPO::getFileFlag, transientParam.getFileFlag()) + //事件 + .in(CollUtil.isNotEmpty(transientParam.getWaveType()),RmpEventDetailPO::getEventType, transientParam.getWaveType()) + .in(CollUtil.isNotEmpty(transientParam.getEventReason()),RmpEventDetailPO::getAdvanceReason, transientParam.getEventReason()) + .in(CollUtil.isNotEmpty(transientParam.getEventType()),RmpEventDetailPO::getAdvanceType, transientParam.getEventType()) + .orderByDesc(RmpEventDetailPO::getStartTime) + ); + List eventDetailData=BeanUtil.copyToList(pageInfo.getRecords(),EventDetailNew.class); + page= BeanUtil.copyProperties(pageInfo,Page.class); if (CollUtil.isNotEmpty(eventDetailData)) { List lineIds = eventDetailData.stream().map(EventDetailNew::getLineId).collect(Collectors.toList()); @@ -333,15 +350,15 @@ public class TransientServiceImpl implements TransientService { } for (DictData dictData : reasonList) { - if (eventDetail.getEventReason().equals(dictData.getId())) { - eventDetail.setEventReason(dictData.getName()); + if (eventDetail.getAdvanceReason().equals(dictData.getId())) { + eventDetail.setAdvanceReason(dictData.getName()); break; } } for (DictData dictData : typeList) { - if (eventDetail.getEventType().equals(dictData.getId())) { - eventDetail.setEventType(dictData.getName()); + if (eventDetail.getAdvanceType().equals(dictData.getId())) { + eventDetail.setAdvanceType(dictData.getName()); break; } } @@ -354,6 +371,68 @@ public class TransientServiceImpl implements TransientService { } + + + + + + +// if (!CollectionUtils.isEmpty(lineList)) { +// StringBuilder stringBuilder = InfluxDBCommUtils.assToInfluxParam(lineList); +// //influxDB查询待分页数据总量 +// Long total = getTransientDetail(stringBuilder, transientParam); +// page.setTotal(total); +// //分页总页数 +// int pages = (int) Math.ceil(transientParam.getPageNum() * 1.0 / transientParam.getPageSize()); +// page.setPages(pages); +// //influxDB分页查询 +// List eventDetailData = getTransientDetailLimit(lineList, transientParam); +// +// if (CollUtil.isNotEmpty(eventDetailData)) { +// List lineIds = eventDetailData.stream().map(EventDetailNew::getLineId).collect(Collectors.toList()); +// lineIds = lineIds.stream().distinct().collect(Collectors.toList()); +// +// List r = lineFeignClient.getBaseLineAreaInfo(lineIds).getData(); +// List reasonList = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.EVENT_REASON.getName()).getData(); +// List typeList = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.EVENT_TYPE.getName()).getData(); +// +// +// for (EventDetailNew eventDetail : eventDetailData) { +// for (AreaLineInfoVO areaLineInfoVO : r) { +// if (eventDetail.getLineId().equals(areaLineInfoVO.getLineId())) { +// eventDetail.setLineId(areaLineInfoVO.getLineId()); +// eventDetail.setLineName(areaLineInfoVO.getLineName()); +// eventDetail.setGdName(areaLineInfoVO.getGdName()); +// eventDetail.setSubName(areaLineInfoVO.getSubName()); +// eventDetail.setIp(areaLineInfoVO.getIp()); +// eventDetail.setScale(areaLineInfoVO.getVoltageScale()); +// eventDetail.setIp(areaLineInfoVO.getIp()); +// break; +// } +// } +// +// for (DictData dictData : reasonList) { +// if (eventDetail.getEventReason().equals(dictData.getId())) { +// eventDetail.setEventReason(dictData.getName()); +// break; +// } +// } +// +// for (DictData dictData : typeList) { +// if (eventDetail.getEventType().equals(dictData.getId())) { +// eventDetail.setEventType(dictData.getName()); +// break; +// } +// } +// } +// +// +// //当前页数据 +// page.setRecords(eventDetailData); +// } +// +// } + } return page; } @@ -476,7 +555,7 @@ public class TransientServiceImpl implements TransientService { LineDetailDataVO lineDetailData = lineFeignClient.getLineDetailData(lineId.get(i)).getData(); EventDetail eventDetailByTime = eventDetailService.getEventDetailByTime(lineId.get(i), timeId.get(i)); String ip = lineDetailData.getIp(); - String waveName = eventDetailByTime.getWaveName(); + String waveName = eventDetailByTime.getWavePath(); if (StrUtil.isBlank(ip) && StrUtil.isBlank(waveName)) { throw new BusinessException(EventResponseEnum.EVENT_NOT_FOUND); } diff --git a/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/LargeScreenService.java b/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/LargeScreenService.java new file mode 100644 index 000000000..2e3a2454b --- /dev/null +++ b/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/LargeScreenService.java @@ -0,0 +1,16 @@ +package com.njcn.event.service.majornetwork; + +import com.njcn.device.pq.pojo.param.LargeScreenParam; +import com.njcn.device.pq.pojo.vo.AreaDownVO; + + +/** + * @version 1.0.0 + * @author: zbj + * @date: 2023/03/31 + */ +public interface LargeScreenService { + + AreaDownVO getAreaDownStatistics(LargeScreenParam largeScreenParam); + +} diff --git a/pqs-prepare/prepare-api/src/main/java/com/njcn/prepare/harmonic/pojo/po/RStatAssesDPO.java b/pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/po/day/RStatAssesDPO.java similarity index 95% rename from pqs-prepare/prepare-api/src/main/java/com/njcn/prepare/harmonic/pojo/po/RStatAssesDPO.java rename to pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/po/day/RStatAssesDPO.java index 59fc8f3bb..40f1c3a31 100644 --- a/pqs-prepare/prepare-api/src/main/java/com/njcn/prepare/harmonic/pojo/po/RStatAssesDPO.java +++ b/pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/po/day/RStatAssesDPO.java @@ -1,4 +1,4 @@ -package com.njcn.prepare.harmonic.pojo.po; +package com.njcn.harmonic.pojo.po.day; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; diff --git a/pqs-prepare/prepare-api/src/main/java/com/njcn/prepare/harmonic/pojo/po/RStatComassesDPO.java b/pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/po/day/RStatComassesDPO.java similarity index 98% rename from pqs-prepare/prepare-api/src/main/java/com/njcn/prepare/harmonic/pojo/po/RStatComassesDPO.java rename to pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/po/day/RStatComassesDPO.java index d209685f7..dacbf5dea 100644 --- a/pqs-prepare/prepare-api/src/main/java/com/njcn/prepare/harmonic/pojo/po/RStatComassesDPO.java +++ b/pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/po/day/RStatComassesDPO.java @@ -1,4 +1,4 @@ -package com.njcn.prepare.harmonic.pojo.po; +package com.njcn.harmonic.pojo.po.day; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; diff --git a/pqs-prepare/prepare-api/src/main/java/com/njcn/prepare/harmonic/pojo/po/RStatDataFlickerDPO.java b/pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/po/day/RStatDataFlickerDPO.java similarity index 91% rename from pqs-prepare/prepare-api/src/main/java/com/njcn/prepare/harmonic/pojo/po/RStatDataFlickerDPO.java rename to pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/po/day/RStatDataFlickerDPO.java index b1d1b27ad..95574f499 100644 --- a/pqs-prepare/prepare-api/src/main/java/com/njcn/prepare/harmonic/pojo/po/RStatDataFlickerDPO.java +++ b/pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/po/day/RStatDataFlickerDPO.java @@ -1,7 +1,6 @@ -package com.njcn.prepare.harmonic.pojo.po; +package com.njcn.harmonic.pojo.po.day; import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.github.jeffreyning.mybatisplus.anno.MppMultiId; import lombok.Data; diff --git a/pqs-prepare/prepare-api/src/main/java/com/njcn/prepare/harmonic/pojo/po/RStatDataFlucDPO.java b/pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/po/day/RStatDataFlucDPO.java similarity index 95% rename from pqs-prepare/prepare-api/src/main/java/com/njcn/prepare/harmonic/pojo/po/RStatDataFlucDPO.java rename to pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/po/day/RStatDataFlucDPO.java index fe132ea9f..2cd52cf1f 100644 --- a/pqs-prepare/prepare-api/src/main/java/com/njcn/prepare/harmonic/pojo/po/RStatDataFlucDPO.java +++ b/pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/po/day/RStatDataFlucDPO.java @@ -1,4 +1,4 @@ -package com.njcn.prepare.harmonic.pojo.po; +package com.njcn.harmonic.pojo.po.day; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; diff --git a/pqs-prepare/prepare-api/src/main/java/com/njcn/prepare/harmonic/pojo/po/RStatDataHarmphasicIDPO.java b/pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/po/day/RStatDataHarmphasicIDPO.java similarity index 98% rename from pqs-prepare/prepare-api/src/main/java/com/njcn/prepare/harmonic/pojo/po/RStatDataHarmphasicIDPO.java rename to pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/po/day/RStatDataHarmphasicIDPO.java index 92ba9399f..b32e22b48 100644 --- a/pqs-prepare/prepare-api/src/main/java/com/njcn/prepare/harmonic/pojo/po/RStatDataHarmphasicIDPO.java +++ b/pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/po/day/RStatDataHarmphasicIDPO.java @@ -1,4 +1,4 @@ -package com.njcn.prepare.harmonic.pojo.po; +package com.njcn.harmonic.pojo.po.day; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; diff --git a/pqs-prepare/prepare-api/src/main/java/com/njcn/prepare/harmonic/pojo/po/RStatDataHarmphasicVDPO.java b/pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/po/day/RStatDataHarmphasicVDPO.java similarity index 98% rename from pqs-prepare/prepare-api/src/main/java/com/njcn/prepare/harmonic/pojo/po/RStatDataHarmphasicVDPO.java rename to pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/po/day/RStatDataHarmphasicVDPO.java index 0181eacfa..297d7a577 100644 --- a/pqs-prepare/prepare-api/src/main/java/com/njcn/prepare/harmonic/pojo/po/RStatDataHarmphasicVDPO.java +++ b/pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/po/day/RStatDataHarmphasicVDPO.java @@ -1,4 +1,4 @@ -package com.njcn.prepare.harmonic.pojo.po; +package com.njcn.harmonic.pojo.po.day; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; diff --git a/pqs-prepare/prepare-api/src/main/java/com/njcn/prepare/harmonic/pojo/po/RStatDataHarmpowerPDPO.java b/pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/po/day/RStatDataHarmpowerPDPO.java similarity index 97% rename from pqs-prepare/prepare-api/src/main/java/com/njcn/prepare/harmonic/pojo/po/RStatDataHarmpowerPDPO.java rename to pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/po/day/RStatDataHarmpowerPDPO.java index 4c76ad230..a84bfaede 100644 --- a/pqs-prepare/prepare-api/src/main/java/com/njcn/prepare/harmonic/pojo/po/RStatDataHarmpowerPDPO.java +++ b/pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/po/day/RStatDataHarmpowerPDPO.java @@ -1,10 +1,9 @@ -package com.njcn.prepare.harmonic.pojo.po; +package com.njcn.harmonic.pojo.po.day; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.github.jeffreyning.mybatisplus.anno.MppMultiId; import lombok.Data; -import org.influxdb.annotation.Column; import java.io.Serializable; import java.util.Date; diff --git a/pqs-prepare/prepare-api/src/main/java/com/njcn/prepare/harmonic/pojo/po/RStatDataHarmpowerQDPO.java b/pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/po/day/RStatDataHarmpowerQDPO.java similarity index 98% rename from pqs-prepare/prepare-api/src/main/java/com/njcn/prepare/harmonic/pojo/po/RStatDataHarmpowerQDPO.java rename to pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/po/day/RStatDataHarmpowerQDPO.java index 3a3670dca..56b036a90 100644 --- a/pqs-prepare/prepare-api/src/main/java/com/njcn/prepare/harmonic/pojo/po/RStatDataHarmpowerQDPO.java +++ b/pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/po/day/RStatDataHarmpowerQDPO.java @@ -1,4 +1,4 @@ -package com.njcn.prepare.harmonic.pojo.po; +package com.njcn.harmonic.pojo.po.day; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; diff --git a/pqs-prepare/prepare-api/src/main/java/com/njcn/prepare/harmonic/pojo/po/RStatDataHarmpowerSDPO.java b/pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/po/day/RStatDataHarmpowerSDPO.java similarity index 98% rename from pqs-prepare/prepare-api/src/main/java/com/njcn/prepare/harmonic/pojo/po/RStatDataHarmpowerSDPO.java rename to pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/po/day/RStatDataHarmpowerSDPO.java index ee4a7c1f2..56be16689 100644 --- a/pqs-prepare/prepare-api/src/main/java/com/njcn/prepare/harmonic/pojo/po/RStatDataHarmpowerSDPO.java +++ b/pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/po/day/RStatDataHarmpowerSDPO.java @@ -1,4 +1,4 @@ -package com.njcn.prepare.harmonic.pojo.po; +package com.njcn.harmonic.pojo.po.day; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; diff --git a/pqs-prepare/prepare-api/src/main/java/com/njcn/prepare/harmonic/pojo/po/RStatDataHarmrateIDPO.java b/pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/po/day/RStatDataHarmrateIDPO.java similarity index 98% rename from pqs-prepare/prepare-api/src/main/java/com/njcn/prepare/harmonic/pojo/po/RStatDataHarmrateIDPO.java rename to pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/po/day/RStatDataHarmrateIDPO.java index 2ab255ede..13554b5a4 100644 --- a/pqs-prepare/prepare-api/src/main/java/com/njcn/prepare/harmonic/pojo/po/RStatDataHarmrateIDPO.java +++ b/pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/po/day/RStatDataHarmrateIDPO.java @@ -1,4 +1,4 @@ -package com.njcn.prepare.harmonic.pojo.po; +package com.njcn.harmonic.pojo.po.day; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; diff --git a/pqs-prepare/prepare-api/src/main/java/com/njcn/prepare/harmonic/pojo/po/RStatDataHarmrateVDPO.java b/pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/po/day/RStatDataHarmrateVDPO.java similarity index 98% rename from pqs-prepare/prepare-api/src/main/java/com/njcn/prepare/harmonic/pojo/po/RStatDataHarmrateVDPO.java rename to pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/po/day/RStatDataHarmrateVDPO.java index af8217445..eb173bb45 100644 --- a/pqs-prepare/prepare-api/src/main/java/com/njcn/prepare/harmonic/pojo/po/RStatDataHarmrateVDPO.java +++ b/pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/po/day/RStatDataHarmrateVDPO.java @@ -1,4 +1,4 @@ -package com.njcn.prepare.harmonic.pojo.po; +package com.njcn.harmonic.pojo.po.day; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; diff --git a/pqs-prepare/prepare-api/src/main/java/com/njcn/prepare/harmonic/pojo/po/RStatDataIDPO.java b/pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/po/day/RStatDataIDPO.java similarity index 98% rename from pqs-prepare/prepare-api/src/main/java/com/njcn/prepare/harmonic/pojo/po/RStatDataIDPO.java rename to pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/po/day/RStatDataIDPO.java index a709ef67c..f3112f71a 100644 --- a/pqs-prepare/prepare-api/src/main/java/com/njcn/prepare/harmonic/pojo/po/RStatDataIDPO.java +++ b/pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/po/day/RStatDataIDPO.java @@ -1,4 +1,4 @@ -package com.njcn.prepare.harmonic.pojo.po; +package com.njcn.harmonic.pojo.po.day; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; diff --git a/pqs-prepare/prepare-api/src/main/java/com/njcn/prepare/harmonic/pojo/po/RStatDataInharmIDPO.java b/pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/po/day/RStatDataInharmIDPO.java similarity index 98% rename from pqs-prepare/prepare-api/src/main/java/com/njcn/prepare/harmonic/pojo/po/RStatDataInharmIDPO.java rename to pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/po/day/RStatDataInharmIDPO.java index e0ed40f03..cf10af062 100644 --- a/pqs-prepare/prepare-api/src/main/java/com/njcn/prepare/harmonic/pojo/po/RStatDataInharmIDPO.java +++ b/pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/po/day/RStatDataInharmIDPO.java @@ -1,4 +1,4 @@ -package com.njcn.prepare.harmonic.pojo.po; +package com.njcn.harmonic.pojo.po.day; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; diff --git a/pqs-prepare/prepare-api/src/main/java/com/njcn/prepare/harmonic/pojo/po/RStatDataInharmVDPO.java b/pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/po/day/RStatDataInharmVDPO.java similarity index 98% rename from pqs-prepare/prepare-api/src/main/java/com/njcn/prepare/harmonic/pojo/po/RStatDataInharmVDPO.java rename to pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/po/day/RStatDataInharmVDPO.java index 00cbe8f1a..d662f0285 100644 --- a/pqs-prepare/prepare-api/src/main/java/com/njcn/prepare/harmonic/pojo/po/RStatDataInharmVDPO.java +++ b/pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/po/day/RStatDataInharmVDPO.java @@ -1,4 +1,4 @@ -package com.njcn.prepare.harmonic.pojo.po; +package com.njcn.harmonic.pojo.po.day; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; diff --git a/pqs-prepare/prepare-api/src/main/java/com/njcn/prepare/harmonic/pojo/po/RStatDataPltDPO.java b/pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/po/day/RStatDataPltDPO.java similarity index 95% rename from pqs-prepare/prepare-api/src/main/java/com/njcn/prepare/harmonic/pojo/po/RStatDataPltDPO.java rename to pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/po/day/RStatDataPltDPO.java index 2c80c385f..c454907ac 100644 --- a/pqs-prepare/prepare-api/src/main/java/com/njcn/prepare/harmonic/pojo/po/RStatDataPltDPO.java +++ b/pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/po/day/RStatDataPltDPO.java @@ -1,4 +1,4 @@ -package com.njcn.prepare.harmonic.pojo.po; +package com.njcn.harmonic.pojo.po.day; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; diff --git a/pqs-prepare/prepare-api/src/main/java/com/njcn/prepare/harmonic/pojo/po/RStatDataVDPO.java b/pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/po/day/RStatDataVDPO.java similarity index 99% rename from pqs-prepare/prepare-api/src/main/java/com/njcn/prepare/harmonic/pojo/po/RStatDataVDPO.java rename to pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/po/day/RStatDataVDPO.java index fb98c1a2f..0ba178cf3 100644 --- a/pqs-prepare/prepare-api/src/main/java/com/njcn/prepare/harmonic/pojo/po/RStatDataVDPO.java +++ b/pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/po/day/RStatDataVDPO.java @@ -1,4 +1,4 @@ -package com.njcn.prepare.harmonic.pojo.po; +package com.njcn.harmonic.pojo.po.day; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; diff --git a/pqs-prepare/prepare-api/src/main/java/com/njcn/prepare/harmonic/pojo/po/RStatLimitRateDPO.java b/pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/po/day/RStatLimitRateDPO.java similarity index 99% rename from pqs-prepare/prepare-api/src/main/java/com/njcn/prepare/harmonic/pojo/po/RStatLimitRateDPO.java rename to pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/po/day/RStatLimitRateDPO.java index d7b7f5c0d..9524db5eb 100644 --- a/pqs-prepare/prepare-api/src/main/java/com/njcn/prepare/harmonic/pojo/po/RStatLimitRateDPO.java +++ b/pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/po/day/RStatLimitRateDPO.java @@ -1,4 +1,4 @@ -package com.njcn.prepare.harmonic.pojo.po; +package com.njcn.harmonic.pojo.po.day; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; diff --git a/pqs-prepare/prepare-api/src/main/java/com/njcn/prepare/harmonic/pojo/po/RStatLimitTargetDPO.java b/pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/po/day/RStatLimitTargetDPO.java similarity index 99% rename from pqs-prepare/prepare-api/src/main/java/com/njcn/prepare/harmonic/pojo/po/RStatLimitTargetDPO.java rename to pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/po/day/RStatLimitTargetDPO.java index 9655484b2..d943f960c 100644 --- a/pqs-prepare/prepare-api/src/main/java/com/njcn/prepare/harmonic/pojo/po/RStatLimitTargetDPO.java +++ b/pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/po/day/RStatLimitTargetDPO.java @@ -1,9 +1,8 @@ -package com.njcn.prepare.harmonic.pojo.po; +package com.njcn.harmonic.pojo.po.day; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.github.jeffreyning.mybatisplus.anno.MppMultiId; -import com.njcn.harmonic.pojo.po.LimitRate; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; diff --git a/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/service/impl/HistoryResultServiceImpl.java b/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/service/impl/HistoryResultServiceImpl.java index aa3162ae1..b0f2837ce 100644 --- a/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/service/impl/HistoryResultServiceImpl.java +++ b/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/service/impl/HistoryResultServiceImpl.java @@ -78,7 +78,7 @@ public class HistoryResultServiceImpl implements HistoryResultService { List eventDetailVOList = new ArrayList<>(); if (!eventDetailList.isEmpty()) { for (EventDetail eventdetail : eventDetailList) { - Instant now = eventdetail.getTimeId(); + Instant now = eventdetail.getStartTime(); Long time = now.toEpochMilli(); String timeText = format.format(time); EventDetailVO eventDetailVO = new EventDetailVO(); diff --git a/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/service/impl/PollutionSubstationServiceImpl.java b/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/service/impl/PollutionSubstationServiceImpl.java index 1a901f4da..523f6cf57 100644 --- a/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/service/impl/PollutionSubstationServiceImpl.java +++ b/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/service/impl/PollutionSubstationServiceImpl.java @@ -673,10 +673,10 @@ public class PollutionSubstationServiceImpl extends ServiceImpl getLineDate(List line, String startTime, String endTime, String type) { List result = new ArrayList<>(); String quota = ""; - if (Objects.equals(type, DicDataEnum.XBDY_ENUM.getCode())) { - quota = "harmonic_v"; - } else if (Objects.equals(type, DicDataEnum.XBDL_ENUM.getCode())) { - quota = "harmonic_i"; + if (Objects.equals(type, DicDataEnum.V_HARMONIC.getCode())) { + quota = ",harmonic_v"; + } else if (Objects.equals(type, DicDataEnum.I_ALL.getCode())) { + quota = ",harmonic_i"; } StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append(Param.TIME).append(" >= '").append(startTime).append(Param.START_TIME).append("' and ").append(Param.TIME).append(" <= '").append(endTime).append(Param.END_TIME).append("' and ("); @@ -688,7 +688,7 @@ public class PollutionSubstationServiceImpl extends ServiceImpl list = sqlResult.getResults().get(0).getSeries(); if (!CollectionUtils.isEmpty(list)) { diff --git a/pqs-prepare/prepare-api/src/main/java/com/njcn/prepare/harmonic/pojo/po/RStatIntegrityDPO.java b/pqs-prepare/prepare-api/src/main/java/com/njcn/prepare/harmonic/pojo/po/RStatIntegrityDPO.java deleted file mode 100644 index 7496fb0a4..000000000 --- a/pqs-prepare/prepare-api/src/main/java/com/njcn/prepare/harmonic/pojo/po/RStatIntegrityDPO.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.njcn.prepare.harmonic.pojo.po; - -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import com.github.jeffreyning.mybatisplus.anno.MppMultiId; -import lombok.Data; - -import java.io.Serializable; -import java.util.Date; - -/** - * 类的介绍: - * - * @author xuyang - * @version 1.0.0 - * @createTime 2023/3/26 22:04 - */ -@Data -@TableName(value = "r_stat_integrity_d") -public class RStatIntegrityDPO implements Serializable { - - @MppMultiId - @TableField(value = "time_id") - private Date time; - - @MppMultiId - @TableField(value = "line_index") - private String lineId; - - @TableField(value = "due_time") - private Integer dueTime; - - @TableField(value = "real_time") - private Integer realTime; -} diff --git a/pqs-prepare/prepare-api/src/main/java/com/njcn/prepare/harmonic/pojo/po/RStatOnlineRateDPO.java b/pqs-prepare/prepare-api/src/main/java/com/njcn/prepare/harmonic/pojo/po/RStatOnlineRateDPO.java deleted file mode 100644 index bb89582e1..000000000 --- a/pqs-prepare/prepare-api/src/main/java/com/njcn/prepare/harmonic/pojo/po/RStatOnlineRateDPO.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.njcn.prepare.harmonic.pojo.po; - -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableName; -import com.github.jeffreyning.mybatisplus.anno.MppMultiId; -import lombok.Data; - -import java.io.Serializable; -import java.util.Date; - -/** - * 类的介绍: - * - * @author xuyang - * @version 1.0.0 - * @createTime 2023/3/26 22:04 - */ -@Data -@TableName(value = "r_stat_onlinerate_d") -public class RStatOnlineRateDPO implements Serializable { - - @MppMultiId - @TableField(value = "time_id") - private Date time; - - @MppMultiId - @TableField(value = "dev_index") - private String devId; - - @TableField(value = "online_min") - private Integer onlineMin; - - @TableField(value = "offline_min") - private Integer offlineMin; -} diff --git a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatAssesDMapper.java b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatAssesDMapper.java index ec1a0bfd3..56d367f35 100644 --- a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatAssesDMapper.java +++ b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatAssesDMapper.java @@ -1,9 +1,7 @@ package com.njcn.prepare.harmonic.mapper.mysql.day; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.github.jeffreyning.mybatisplus.base.MppBaseMapper; -import com.njcn.prepare.harmonic.pojo.po.RStatAssesDPO; -import com.njcn.prepare.harmonic.pojo.po.RStatOnlineRateDPO; +import com.njcn.harmonic.pojo.po.day.RStatAssesDPO; public interface RStatAssesDMapper extends MppBaseMapper { } diff --git a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatComassesDMapper.java b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatComassesDMapper.java index 1398f7528..562867130 100644 --- a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatComassesDMapper.java +++ b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatComassesDMapper.java @@ -1,9 +1,7 @@ package com.njcn.prepare.harmonic.mapper.mysql.day; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.github.jeffreyning.mybatisplus.base.MppBaseMapper; -import com.njcn.prepare.harmonic.pojo.po.RStatAssesDPO; -import com.njcn.prepare.harmonic.pojo.po.RStatComassesDPO; +import com.njcn.harmonic.pojo.po.day.RStatComassesDPO; public interface RStatComassesDMapper extends MppBaseMapper { } diff --git a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatDataFlickerDMapper.java b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatDataFlickerDMapper.java index f63c4c414..d0a3d8618 100644 --- a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatDataFlickerDMapper.java +++ b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatDataFlickerDMapper.java @@ -1,8 +1,7 @@ package com.njcn.prepare.harmonic.mapper.mysql.day; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.github.jeffreyning.mybatisplus.base.MppBaseMapper; -import com.njcn.prepare.harmonic.pojo.po.RStatDataFlickerDPO; +import com.njcn.harmonic.pojo.po.day.RStatDataFlickerDPO; public interface RStatDataFlickerDMapper extends MppBaseMapper { } diff --git a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatDataFlucDMapper.java b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatDataFlucDMapper.java index e821700c2..6be6a232f 100644 --- a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatDataFlucDMapper.java +++ b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatDataFlucDMapper.java @@ -1,7 +1,7 @@ package com.njcn.prepare.harmonic.mapper.mysql.day; import com.github.jeffreyning.mybatisplus.base.MppBaseMapper; -import com.njcn.prepare.harmonic.pojo.po.RStatDataFlucDPO; +import com.njcn.harmonic.pojo.po.day.RStatDataFlucDPO; public interface RStatDataFlucDMapper extends MppBaseMapper { } diff --git a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatDataHarmRateIDMapper.java b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatDataHarmRateIDMapper.java index e41637a89..be57f5422 100644 --- a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatDataHarmRateIDMapper.java +++ b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatDataHarmRateIDMapper.java @@ -1,8 +1,7 @@ package com.njcn.prepare.harmonic.mapper.mysql.day; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.github.jeffreyning.mybatisplus.base.MppBaseMapper; -import com.njcn.prepare.harmonic.pojo.po.RStatDataHarmrateIDPO; +import com.njcn.harmonic.pojo.po.day.RStatDataHarmrateIDPO; public interface RStatDataHarmRateIDMapper extends MppBaseMapper { } diff --git a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatDataHarmRateVDMapper.java b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatDataHarmRateVDMapper.java index 4182e08d2..20761655a 100644 --- a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatDataHarmRateVDMapper.java +++ b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatDataHarmRateVDMapper.java @@ -1,8 +1,7 @@ package com.njcn.prepare.harmonic.mapper.mysql.day; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.github.jeffreyning.mybatisplus.base.MppBaseMapper; -import com.njcn.prepare.harmonic.pojo.po.RStatDataHarmrateVDPO; +import com.njcn.harmonic.pojo.po.day.RStatDataHarmrateVDPO; public interface RStatDataHarmRateVDMapper extends MppBaseMapper { } diff --git a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatDataHarmphasicIDMapper.java b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatDataHarmphasicIDMapper.java index 7cbef0a01..756f433b1 100644 --- a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatDataHarmphasicIDMapper.java +++ b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatDataHarmphasicIDMapper.java @@ -1,9 +1,7 @@ package com.njcn.prepare.harmonic.mapper.mysql.day; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.github.jeffreyning.mybatisplus.base.MppBaseMapper; -import com.njcn.prepare.harmonic.pojo.po.RStatDataHarmphasicIDPO; -import com.njcn.prepare.harmonic.pojo.po.RStatDataVDPO; +import com.njcn.harmonic.pojo.po.day.RStatDataHarmphasicIDPO; public interface RStatDataHarmphasicIDMapper extends MppBaseMapper { } diff --git a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatDataHarmphasicVDMapper.java b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatDataHarmphasicVDMapper.java index 4d32a03a6..3675df653 100644 --- a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatDataHarmphasicVDMapper.java +++ b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatDataHarmphasicVDMapper.java @@ -1,8 +1,7 @@ package com.njcn.prepare.harmonic.mapper.mysql.day; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.github.jeffreyning.mybatisplus.base.MppBaseMapper; -import com.njcn.prepare.harmonic.pojo.po.RStatDataHarmphasicVDPO; +import com.njcn.harmonic.pojo.po.day.RStatDataHarmphasicVDPO; public interface RStatDataHarmphasicVDMapper extends MppBaseMapper { } diff --git a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatDataHarmpowerPDMapper.java b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatDataHarmpowerPDMapper.java index 9130b0590..d7042c858 100644 --- a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatDataHarmpowerPDMapper.java +++ b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatDataHarmpowerPDMapper.java @@ -1,9 +1,7 @@ package com.njcn.prepare.harmonic.mapper.mysql.day; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.github.jeffreyning.mybatisplus.base.MppBaseMapper; -import com.njcn.prepare.harmonic.pojo.po.RStatDataHarmpowerPDPO; -import com.njcn.prepare.harmonic.pojo.po.RStatDataVDPO; +import com.njcn.harmonic.pojo.po.day.RStatDataHarmpowerPDPO; public interface RStatDataHarmpowerPDMapper extends MppBaseMapper { } diff --git a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatDataHarmpowerQDMapper.java b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatDataHarmpowerQDMapper.java index 071c3fd1e..f76d3138d 100644 --- a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatDataHarmpowerQDMapper.java +++ b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatDataHarmpowerQDMapper.java @@ -1,8 +1,7 @@ package com.njcn.prepare.harmonic.mapper.mysql.day; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.github.jeffreyning.mybatisplus.base.MppBaseMapper; -import com.njcn.prepare.harmonic.pojo.po.RStatDataHarmpowerQDPO; +import com.njcn.harmonic.pojo.po.day.RStatDataHarmpowerQDPO; public interface RStatDataHarmpowerQDMapper extends MppBaseMapper { } diff --git a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatDataHarmpowerSDMapper.java b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatDataHarmpowerSDMapper.java index 7c2bd74a6..24cd89706 100644 --- a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatDataHarmpowerSDMapper.java +++ b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatDataHarmpowerSDMapper.java @@ -1,8 +1,7 @@ package com.njcn.prepare.harmonic.mapper.mysql.day; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.github.jeffreyning.mybatisplus.base.MppBaseMapper; -import com.njcn.prepare.harmonic.pojo.po.RStatDataHarmpowerSDPO; +import com.njcn.harmonic.pojo.po.day.RStatDataHarmpowerSDPO; public interface RStatDataHarmpowerSDMapper extends MppBaseMapper { } diff --git a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatDataIDMapper.java b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatDataIDMapper.java index 22c52e606..7072dcb93 100644 --- a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatDataIDMapper.java +++ b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatDataIDMapper.java @@ -1,8 +1,7 @@ package com.njcn.prepare.harmonic.mapper.mysql.day; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.github.jeffreyning.mybatisplus.base.MppBaseMapper; -import com.njcn.prepare.harmonic.pojo.po.RStatDataIDPO; +import com.njcn.harmonic.pojo.po.day.RStatDataIDPO; public interface RStatDataIDMapper extends MppBaseMapper { } diff --git a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatDataInHarmIDMapper.java b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatDataInHarmIDMapper.java index 36e8bfe1f..f6166a61f 100644 --- a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatDataInHarmIDMapper.java +++ b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatDataInHarmIDMapper.java @@ -1,8 +1,7 @@ package com.njcn.prepare.harmonic.mapper.mysql.day; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.github.jeffreyning.mybatisplus.base.MppBaseMapper; -import com.njcn.prepare.harmonic.pojo.po.RStatDataInharmIDPO; +import com.njcn.harmonic.pojo.po.day.RStatDataInharmIDPO; public interface RStatDataInHarmIDMapper extends MppBaseMapper { } diff --git a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatDataInHarmVDMapper.java b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatDataInHarmVDMapper.java index 0c85c0f3a..c1097f6ed 100644 --- a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatDataInHarmVDMapper.java +++ b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatDataInHarmVDMapper.java @@ -1,8 +1,7 @@ package com.njcn.prepare.harmonic.mapper.mysql.day; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.github.jeffreyning.mybatisplus.base.MppBaseMapper; -import com.njcn.prepare.harmonic.pojo.po.RStatDataInharmVDPO; +import com.njcn.harmonic.pojo.po.day.RStatDataInharmVDPO; public interface RStatDataInHarmVDMapper extends MppBaseMapper { } diff --git a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatDataPltDMapper.java b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatDataPltDMapper.java index 7b9fe3d07..abf101455 100644 --- a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatDataPltDMapper.java +++ b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatDataPltDMapper.java @@ -1,8 +1,7 @@ package com.njcn.prepare.harmonic.mapper.mysql.day; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.github.jeffreyning.mybatisplus.base.MppBaseMapper; -import com.njcn.prepare.harmonic.pojo.po.RStatDataPltDPO; +import com.njcn.harmonic.pojo.po.day.RStatDataPltDPO; public interface RStatDataPltDMapper extends MppBaseMapper { } diff --git a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatDataVDMapper.java b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatDataVDMapper.java index c22e63f40..380587d8e 100644 --- a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatDataVDMapper.java +++ b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatDataVDMapper.java @@ -1,9 +1,7 @@ package com.njcn.prepare.harmonic.mapper.mysql.day; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.github.jeffreyning.mybatisplus.base.MppBaseMapper; -import com.njcn.prepare.harmonic.pojo.po.RStatDataFlickerDPO; -import com.njcn.prepare.harmonic.pojo.po.RStatDataVDPO; +import com.njcn.harmonic.pojo.po.day.RStatDataVDPO; public interface RStatDataVDMapper extends MppBaseMapper { } diff --git a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatIntegrityDMapper.java b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatIntegrityDMapper.java index 7a2cf4925..72d274462 100644 --- a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatIntegrityDMapper.java +++ b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatIntegrityDMapper.java @@ -1,7 +1,7 @@ package com.njcn.prepare.harmonic.mapper.mysql.day; import com.github.jeffreyning.mybatisplus.base.MppBaseMapper; -import com.njcn.prepare.harmonic.pojo.po.RStatIntegrityDPO; +import com.njcn.device.pq.pojo.po.RStatIntegrityD; -public interface RStatIntegrityDMapper extends MppBaseMapper { +public interface RStatIntegrityDMapper extends MppBaseMapper { } diff --git a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatLimitRateDMapper.java b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatLimitRateDMapper.java index b792d3368..5ab09c1b3 100644 --- a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatLimitRateDMapper.java +++ b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatLimitRateDMapper.java @@ -1,9 +1,7 @@ package com.njcn.prepare.harmonic.mapper.mysql.day; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.github.jeffreyning.mybatisplus.base.MppBaseMapper; -import com.njcn.prepare.harmonic.pojo.po.RStatLimitRateDPO; -import com.njcn.prepare.harmonic.pojo.po.RStatLimitTargetDPO; +import com.njcn.harmonic.pojo.po.day.RStatLimitRateDPO; public interface RStatLimitRateDMapper extends MppBaseMapper { } diff --git a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatLimitTargetDMapper.java b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatLimitTargetDMapper.java index f3b2dc632..c47717c02 100644 --- a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatLimitTargetDMapper.java +++ b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatLimitTargetDMapper.java @@ -1,8 +1,7 @@ package com.njcn.prepare.harmonic.mapper.mysql.day; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.github.jeffreyning.mybatisplus.base.MppBaseMapper; -import com.njcn.prepare.harmonic.pojo.po.RStatLimitTargetDPO; +import com.njcn.harmonic.pojo.po.day.RStatLimitTargetDPO; public interface RStatLimitTargetDMapper extends MppBaseMapper { } diff --git a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatOnlineRateDMapper.java b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatOnlineRateDMapper.java index 332327679..c4ed44af3 100644 --- a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatOnlineRateDMapper.java +++ b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/mapper/mysql/day/RStatOnlineRateDMapper.java @@ -1,9 +1,7 @@ package com.njcn.prepare.harmonic.mapper.mysql.day; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.github.jeffreyning.mybatisplus.base.MppBaseMapper; -import com.njcn.prepare.harmonic.pojo.po.RStatIntegrityDPO; -import com.njcn.prepare.harmonic.pojo.po.RStatOnlineRateDPO; +import com.njcn.device.pq.pojo.po.RStatOnlinerateD; -public interface RStatOnlineRateDMapper extends MppBaseMapper { +public interface RStatOnlineRateDMapper extends MppBaseMapper { } diff --git a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/day/RStatDataFlickerDServiceImpl.java b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/day/RStatDataFlickerDServiceImpl.java index f12b256d0..83c4f1f17 100644 --- a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/day/RStatDataFlickerDServiceImpl.java +++ b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/day/RStatDataFlickerDServiceImpl.java @@ -1,9 +1,8 @@ package com.njcn.prepare.harmonic.service.mysql.Impl.day; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.github.jeffreyning.mybatisplus.service.MppServiceImpl; +import com.njcn.harmonic.pojo.po.day.RStatDataFlickerDPO; import com.njcn.prepare.harmonic.mapper.mysql.day.RStatDataFlickerDMapper; -import com.njcn.prepare.harmonic.pojo.po.RStatDataFlickerDPO; import com.njcn.prepare.harmonic.service.mysql.day.IRStatDataFlickerDService; import org.springframework.stereotype.Service; diff --git a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/day/RStatDataFlucDServiceImpl.java b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/day/RStatDataFlucDServiceImpl.java index 4d087f88c..1f2870680 100644 --- a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/day/RStatDataFlucDServiceImpl.java +++ b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/day/RStatDataFlucDServiceImpl.java @@ -1,8 +1,8 @@ package com.njcn.prepare.harmonic.service.mysql.Impl.day; import com.github.jeffreyning.mybatisplus.service.MppServiceImpl; +import com.njcn.harmonic.pojo.po.day.RStatDataFlucDPO; import com.njcn.prepare.harmonic.mapper.mysql.day.RStatDataFlucDMapper; -import com.njcn.prepare.harmonic.pojo.po.RStatDataFlucDPO; import com.njcn.prepare.harmonic.service.mysql.day.IRStatDataFlucDService; import org.springframework.stereotype.Service; diff --git a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/day/RStatDataHarmRateIDServiceImpl.java b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/day/RStatDataHarmRateIDServiceImpl.java index 273565cff..a145c85f5 100644 --- a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/day/RStatDataHarmRateIDServiceImpl.java +++ b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/day/RStatDataHarmRateIDServiceImpl.java @@ -1,13 +1,9 @@ package com.njcn.prepare.harmonic.service.mysql.Impl.day; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.github.jeffreyning.mybatisplus.service.MppServiceImpl; +import com.njcn.harmonic.pojo.po.day.RStatDataHarmrateIDPO; import com.njcn.prepare.harmonic.mapper.mysql.day.RStatDataHarmRateIDMapper; -import com.njcn.prepare.harmonic.mapper.mysql.day.RStatDataHarmpowerSDMapper; -import com.njcn.prepare.harmonic.pojo.po.RStatDataHarmpowerSDPO; -import com.njcn.prepare.harmonic.pojo.po.RStatDataHarmrateIDPO; import com.njcn.prepare.harmonic.service.mysql.day.IRStatDataHarmRateIDService; -import com.njcn.prepare.harmonic.service.mysql.day.IRStatDataHarmpowerSDService; import org.springframework.stereotype.Service; import java.util.List; diff --git a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/day/RStatDataHarmRateVDServiceImpl.java b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/day/RStatDataHarmRateVDServiceImpl.java index 95d013f8c..6a6831d1f 100644 --- a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/day/RStatDataHarmRateVDServiceImpl.java +++ b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/day/RStatDataHarmRateVDServiceImpl.java @@ -1,10 +1,8 @@ package com.njcn.prepare.harmonic.service.mysql.Impl.day; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.github.jeffreyning.mybatisplus.service.MppServiceImpl; +import com.njcn.harmonic.pojo.po.day.RStatDataHarmrateVDPO; import com.njcn.prepare.harmonic.mapper.mysql.day.RStatDataHarmRateVDMapper; -import com.njcn.prepare.harmonic.pojo.po.RStatDataHarmrateIDPO; -import com.njcn.prepare.harmonic.pojo.po.RStatDataHarmrateVDPO; import com.njcn.prepare.harmonic.service.mysql.day.IRStatDataHarmRateVDService; import org.springframework.stereotype.Service; diff --git a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/day/RStatDataHarmphasicIDServiceImpl.java b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/day/RStatDataHarmphasicIDServiceImpl.java index d9c4f27d5..04d59a43c 100644 --- a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/day/RStatDataHarmphasicIDServiceImpl.java +++ b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/day/RStatDataHarmphasicIDServiceImpl.java @@ -1,9 +1,8 @@ package com.njcn.prepare.harmonic.service.mysql.Impl.day; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.github.jeffreyning.mybatisplus.service.MppServiceImpl; +import com.njcn.harmonic.pojo.po.day.RStatDataHarmphasicIDPO; import com.njcn.prepare.harmonic.mapper.mysql.day.RStatDataHarmphasicIDMapper; -import com.njcn.prepare.harmonic.pojo.po.RStatDataHarmphasicIDPO; import com.njcn.prepare.harmonic.service.mysql.day.IRStatDataHarmphasicIDService; import org.springframework.stereotype.Service; diff --git a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/day/RStatDataHarmphasicVDServiceImpl.java b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/day/RStatDataHarmphasicVDServiceImpl.java index 2ff329113..f462e8594 100644 --- a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/day/RStatDataHarmphasicVDServiceImpl.java +++ b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/day/RStatDataHarmphasicVDServiceImpl.java @@ -1,9 +1,8 @@ package com.njcn.prepare.harmonic.service.mysql.Impl.day; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.github.jeffreyning.mybatisplus.service.MppServiceImpl; +import com.njcn.harmonic.pojo.po.day.RStatDataHarmphasicVDPO; import com.njcn.prepare.harmonic.mapper.mysql.day.RStatDataHarmphasicVDMapper; -import com.njcn.prepare.harmonic.pojo.po.RStatDataHarmphasicVDPO; import com.njcn.prepare.harmonic.service.mysql.day.IRStatDataHarmphasicVDService; import org.springframework.stereotype.Service; diff --git a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/day/RStatDataHarmpowerPDServiceImpl.java b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/day/RStatDataHarmpowerPDServiceImpl.java index 95b586cb2..ced7d05e8 100644 --- a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/day/RStatDataHarmpowerPDServiceImpl.java +++ b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/day/RStatDataHarmpowerPDServiceImpl.java @@ -1,9 +1,8 @@ package com.njcn.prepare.harmonic.service.mysql.Impl.day; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.github.jeffreyning.mybatisplus.service.MppServiceImpl; +import com.njcn.harmonic.pojo.po.day.RStatDataHarmpowerPDPO; import com.njcn.prepare.harmonic.mapper.mysql.day.RStatDataHarmpowerPDMapper; -import com.njcn.prepare.harmonic.pojo.po.RStatDataHarmpowerPDPO; import com.njcn.prepare.harmonic.service.mysql.day.IRStatDataHarmpowerPDService; import org.springframework.stereotype.Service; diff --git a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/day/RStatDataHarmpowerQDServiceImpl.java b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/day/RStatDataHarmpowerQDServiceImpl.java index 9642c5dd3..3b1c7bac7 100644 --- a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/day/RStatDataHarmpowerQDServiceImpl.java +++ b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/day/RStatDataHarmpowerQDServiceImpl.java @@ -1,9 +1,8 @@ package com.njcn.prepare.harmonic.service.mysql.Impl.day; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.github.jeffreyning.mybatisplus.service.MppServiceImpl; +import com.njcn.harmonic.pojo.po.day.RStatDataHarmpowerQDPO; import com.njcn.prepare.harmonic.mapper.mysql.day.RStatDataHarmpowerQDMapper; -import com.njcn.prepare.harmonic.pojo.po.RStatDataHarmpowerQDPO; import com.njcn.prepare.harmonic.service.mysql.day.IRStatDataHarmpowerQDService; import org.springframework.stereotype.Service; diff --git a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/day/RStatDataHarmpowerSDServiceImpl.java b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/day/RStatDataHarmpowerSDServiceImpl.java index 62e05f3c6..445cd599c 100644 --- a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/day/RStatDataHarmpowerSDServiceImpl.java +++ b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/day/RStatDataHarmpowerSDServiceImpl.java @@ -1,9 +1,8 @@ package com.njcn.prepare.harmonic.service.mysql.Impl.day; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.github.jeffreyning.mybatisplus.service.MppServiceImpl; +import com.njcn.harmonic.pojo.po.day.RStatDataHarmpowerSDPO; import com.njcn.prepare.harmonic.mapper.mysql.day.RStatDataHarmpowerSDMapper; -import com.njcn.prepare.harmonic.pojo.po.RStatDataHarmpowerSDPO; import com.njcn.prepare.harmonic.service.mysql.day.IRStatDataHarmpowerSDService; import org.springframework.stereotype.Service; diff --git a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/day/RStatDataIDServiceImpl.java b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/day/RStatDataIDServiceImpl.java index 94ab9f212..9300f9766 100644 --- a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/day/RStatDataIDServiceImpl.java +++ b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/day/RStatDataIDServiceImpl.java @@ -1,9 +1,8 @@ package com.njcn.prepare.harmonic.service.mysql.Impl.day; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.github.jeffreyning.mybatisplus.service.MppServiceImpl; +import com.njcn.harmonic.pojo.po.day.RStatDataIDPO; import com.njcn.prepare.harmonic.mapper.mysql.day.RStatDataIDMapper; -import com.njcn.prepare.harmonic.pojo.po.RStatDataIDPO; import com.njcn.prepare.harmonic.service.mysql.day.IRStatDataIDService; import org.springframework.stereotype.Service; diff --git a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/day/RStatDataInharmIDServiceImpl.java b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/day/RStatDataInharmIDServiceImpl.java index 048337954..5a0319721 100644 --- a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/day/RStatDataInharmIDServiceImpl.java +++ b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/day/RStatDataInharmIDServiceImpl.java @@ -1,13 +1,8 @@ package com.njcn.prepare.harmonic.service.mysql.Impl.day; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.github.jeffreyning.mybatisplus.service.MppServiceImpl; -import com.njcn.prepare.harmonic.mapper.mysql.day.RStatDataIDMapper; +import com.njcn.harmonic.pojo.po.day.RStatDataInharmIDPO; import com.njcn.prepare.harmonic.mapper.mysql.day.RStatDataInHarmIDMapper; -import com.njcn.prepare.harmonic.pojo.po.RStatDataHarmrateIDPO; -import com.njcn.prepare.harmonic.pojo.po.RStatDataIDPO; -import com.njcn.prepare.harmonic.pojo.po.RStatDataInharmIDPO; -import com.njcn.prepare.harmonic.service.mysql.day.IRStatDataIDService; import com.njcn.prepare.harmonic.service.mysql.day.IRStatDataInharmIDService; import org.springframework.stereotype.Service; diff --git a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/day/RStatDataInharmVDServiceImpl.java b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/day/RStatDataInharmVDServiceImpl.java index 06caaafe5..b5395d7ce 100644 --- a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/day/RStatDataInharmVDServiceImpl.java +++ b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/day/RStatDataInharmVDServiceImpl.java @@ -1,12 +1,8 @@ package com.njcn.prepare.harmonic.service.mysql.Impl.day; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.github.jeffreyning.mybatisplus.service.MppServiceImpl; -import com.njcn.prepare.harmonic.mapper.mysql.day.RStatDataInHarmIDMapper; +import com.njcn.harmonic.pojo.po.day.RStatDataInharmVDPO; import com.njcn.prepare.harmonic.mapper.mysql.day.RStatDataInHarmVDMapper; -import com.njcn.prepare.harmonic.pojo.po.RStatDataInharmIDPO; -import com.njcn.prepare.harmonic.pojo.po.RStatDataInharmVDPO; -import com.njcn.prepare.harmonic.service.mysql.day.IRStatDataInharmIDService; import com.njcn.prepare.harmonic.service.mysql.day.IRStatDataInharmVDService; import org.springframework.stereotype.Service; diff --git a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/day/RStatDataPltDServiceImpl.java b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/day/RStatDataPltDServiceImpl.java index b0ecfb498..b897f117d 100644 --- a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/day/RStatDataPltDServiceImpl.java +++ b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/day/RStatDataPltDServiceImpl.java @@ -1,12 +1,8 @@ package com.njcn.prepare.harmonic.service.mysql.Impl.day; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.github.jeffreyning.mybatisplus.service.MppServiceImpl; -import com.njcn.prepare.harmonic.mapper.mysql.day.RStatDataFlickerDMapper; +import com.njcn.harmonic.pojo.po.day.RStatDataPltDPO; import com.njcn.prepare.harmonic.mapper.mysql.day.RStatDataPltDMapper; -import com.njcn.prepare.harmonic.pojo.po.RStatDataFlickerDPO; -import com.njcn.prepare.harmonic.pojo.po.RStatDataPltDPO; -import com.njcn.prepare.harmonic.service.mysql.day.IRStatDataFlickerDService; import com.njcn.prepare.harmonic.service.mysql.day.IRStatDataPltDService; import org.springframework.stereotype.Service; diff --git a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/day/RStatDataVDServiceImpl.java b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/day/RStatDataVDServiceImpl.java index fcb8cef79..b2b621828 100644 --- a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/day/RStatDataVDServiceImpl.java +++ b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/day/RStatDataVDServiceImpl.java @@ -1,9 +1,8 @@ package com.njcn.prepare.harmonic.service.mysql.Impl.day; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.github.jeffreyning.mybatisplus.service.MppServiceImpl; +import com.njcn.harmonic.pojo.po.day.RStatDataVDPO; import com.njcn.prepare.harmonic.mapper.mysql.day.RStatDataVDMapper; -import com.njcn.prepare.harmonic.pojo.po.RStatDataVDPO; import com.njcn.prepare.harmonic.service.mysql.day.IRStatDataVDService; import org.springframework.stereotype.Service; diff --git a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/day/RStatLimitRateDServiceImpl.java b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/day/RStatLimitRateDServiceImpl.java index 75fe2866d..9e5ae502e 100644 --- a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/day/RStatLimitRateDServiceImpl.java +++ b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/day/RStatLimitRateDServiceImpl.java @@ -2,13 +2,9 @@ package com.njcn.prepare.harmonic.service.mysql.Impl.day; import cn.hutool.core.collection.CollUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.github.jeffreyning.mybatisplus.service.MppServiceImpl; -import com.njcn.device.pq.pojo.po.AlarmStrategy; -import com.njcn.energy.pojo.po.EleEvtParm; +import com.njcn.harmonic.pojo.po.day.RStatLimitRateDPO; import com.njcn.prepare.harmonic.mapper.mysql.day.RStatLimitRateDMapper; -import com.njcn.prepare.harmonic.pojo.po.RStatLimitRateDPO; import com.njcn.prepare.harmonic.service.mysql.day.IRStatLimitRateDService; import org.springframework.stereotype.Service; diff --git a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/line/DayDataServiceImpl.java b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/line/DayDataServiceImpl.java index 600323826..d5638910a 100644 --- a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/line/DayDataServiceImpl.java +++ b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/line/DayDataServiceImpl.java @@ -1,6 +1,7 @@ package com.njcn.prepare.harmonic.service.mysql.Impl.line; import com.njcn.harmonic.pojo.po.*; +import com.njcn.harmonic.pojo.po.day.*; import com.njcn.influxdb.param.InfluxDBPublicParam; import com.njcn.influxdb.utils.InfluxDbUtils; import com.njcn.prepare.harmonic.constant.InfluxdbPOConverter; @@ -9,7 +10,6 @@ import com.njcn.prepare.harmonic.pojo.mysql.po.line.RMpFlickerReportDPO; import com.njcn.prepare.harmonic.pojo.mysql.po.line.RMpHarmonicPReportDPO; import com.njcn.prepare.harmonic.pojo.mysql.po.line.RMpInharmonicIMagReportDPO; import com.njcn.prepare.harmonic.pojo.mysql.po.line.RMpPltReportDPO; -import com.njcn.prepare.harmonic.pojo.po.*; import com.njcn.prepare.harmonic.service.mysql.day.*; import com.njcn.prepare.harmonic.service.mysql.line.*; import lombok.RequiredArgsConstructor; diff --git a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/line/HarmonicGeneralServiceImpl.java b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/line/HarmonicGeneralServiceImpl.java index 4bd29fa33..99af562bc 100644 --- a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/line/HarmonicGeneralServiceImpl.java +++ b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/line/HarmonicGeneralServiceImpl.java @@ -5,12 +5,12 @@ import cn.hutool.core.date.DateUtil; import com.github.jeffreyning.mybatisplus.service.MppServiceImpl; import com.njcn.device.pq.api.LineFeignClient; import com.njcn.device.pq.pojo.po.Overlimit; +import com.njcn.harmonic.pojo.po.day.RStatComassesDPO; import com.njcn.influxdb.utils.InfluxDbUtils; import com.njcn.prepare.harmonic.mapper.mysql.day.RStatComassesDMapper; import com.njcn.prepare.harmonic.pojo.influxdb.po.DataFlickerPO; import com.njcn.prepare.harmonic.pojo.influxdb.po.DataVPO; import com.njcn.prepare.harmonic.pojo.param.LineParam; -import com.njcn.prepare.harmonic.pojo.po.RStatComassesDPO; import com.njcn.prepare.harmonic.service.mysql.line.HarmonicGeneralService; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; diff --git a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/line/HarmonicMetricServiceImpl.java b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/line/HarmonicMetricServiceImpl.java index 0fada68c8..e3cec45c1 100644 --- a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/line/HarmonicMetricServiceImpl.java +++ b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/line/HarmonicMetricServiceImpl.java @@ -5,12 +5,12 @@ import cn.hutool.core.date.DateUtil; import com.github.jeffreyning.mybatisplus.service.MppServiceImpl; import com.njcn.device.pq.api.LineFeignClient; import com.njcn.device.pq.pojo.po.Overlimit; +import com.njcn.harmonic.pojo.po.day.RStatAssesDPO; import com.njcn.influxdb.utils.InfluxDbUtils; import com.njcn.prepare.harmonic.mapper.mysql.day.RStatAssesDMapper; import com.njcn.prepare.harmonic.pojo.param.LineParam; import com.njcn.prepare.harmonic.pojo.influxdb.po.DataPltPO; import com.njcn.prepare.harmonic.pojo.influxdb.po.DataVPO; -import com.njcn.prepare.harmonic.pojo.po.RStatAssesDPO; import com.njcn.prepare.harmonic.service.mysql.line.HarmonicMetricService; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; diff --git a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/line/IntegrityServiceImpl.java b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/line/IntegrityServiceImpl.java index ea24eb277..d30892348 100644 --- a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/line/IntegrityServiceImpl.java +++ b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/line/IntegrityServiceImpl.java @@ -6,11 +6,11 @@ import com.github.jeffreyning.mybatisplus.service.MppServiceImpl; import com.njcn.device.pq.api.LineFeignClient; import com.njcn.device.pq.pojo.po.LineDetail; import com.njcn.device.pq.pojo.po.Overlimit; +import com.njcn.device.pq.pojo.po.RStatIntegrityD; import com.njcn.influxdb.utils.InfluxDbUtils; import com.njcn.prepare.harmonic.mapper.mysql.day.RStatIntegrityDMapper; import com.njcn.prepare.harmonic.pojo.influxdb.po.DataVPO; import com.njcn.prepare.harmonic.pojo.param.LineParam; -import com.njcn.prepare.harmonic.pojo.po.RStatIntegrityDPO; import com.njcn.prepare.harmonic.service.mysql.line.IntegrityService; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -23,6 +23,8 @@ import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; import java.util.*; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; @@ -40,7 +42,7 @@ import static com.njcn.influxdb.param.InfluxDBPublicParam.DAY_MINUTE; @Slf4j @Service @AllArgsConstructor -public class IntegrityServiceImpl extends MppServiceImpl implements IntegrityService{ +public class IntegrityServiceImpl extends MppServiceImpl implements IntegrityService{ private final InfluxDbUtils influxDbUtils; @@ -82,6 +84,8 @@ public class IntegrityServiceImpl extends MppServiceImpl lineDetailList = new ArrayList<>(); if (CollUtil.isEmpty(lineParam.getLineIds())){ List overLimitList = getAllLinesLimitData(); @@ -90,13 +94,12 @@ public class IntegrityServiceImpl extends MppServiceImpl list = new ArrayList<>(); + List list = new ArrayList<>(); for (LineDetail lineDetail :lineDetailList){ int dataCount = getDataCount(lineDetail.getId(),time); - RStatIntegrityDPO integrityDpo = new RStatIntegrityDPO(); - integrityDpo.setTime(dateOut); - integrityDpo.setLineId(lineDetail.getId()); + RStatIntegrityD integrityDpo = new RStatIntegrityD(); + integrityDpo.setTimeId(dateTime); + integrityDpo.setLineIndex(lineDetail.getId()); integrityDpo.setDueTime(DAY_MINUTE/lineDetail.getTimeInterval()); integrityDpo.setRealTime(dataCount); list.add(integrityDpo); diff --git a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/line/LimitRateService.java b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/line/LimitRateService.java index 5e43cba8b..ea8402a97 100644 --- a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/line/LimitRateService.java +++ b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/line/LimitRateService.java @@ -6,11 +6,11 @@ import com.njcn.device.pq.api.LineFeignClient; import com.njcn.device.pq.pojo.po.Overlimit; import com.njcn.harmonic.pojo.po.LimitRate; import com.njcn.harmonic.pojo.po.LimitRatePO; +import com.njcn.harmonic.pojo.po.day.RStatLimitRateDPO; import com.njcn.influxdb.param.InfluxDBPublicParam; import com.njcn.influxdb.utils.InfluxDbUtils; import com.njcn.prepare.harmonic.mapper.mysql.line.LimitRatePOMapper; import com.njcn.prepare.harmonic.pojo.influxdb.po.*; -import com.njcn.prepare.harmonic.pojo.po.RStatLimitRateDPO; import com.njcn.prepare.harmonic.service.mysql.day.IRStatLimitRateDService; import lombok.AllArgsConstructor; import lombok.SneakyThrows; diff --git a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/line/LimitTargetServiceImpl.java b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/line/LimitTargetServiceImpl.java index d149bcdc3..98dca09e6 100644 --- a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/line/LimitTargetServiceImpl.java +++ b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/line/LimitTargetServiceImpl.java @@ -3,14 +3,13 @@ package com.njcn.prepare.harmonic.service.mysql.Impl.line; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.StrUtil; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.github.jeffreyning.mybatisplus.service.MppServiceImpl; import com.njcn.harmonic.pojo.po.LimitRate; +import com.njcn.harmonic.pojo.po.day.RStatLimitRateDPO; +import com.njcn.harmonic.pojo.po.day.RStatLimitTargetDPO; import com.njcn.influxdb.utils.InfluxDbUtils; import com.njcn.prepare.harmonic.mapper.mysql.day.RStatLimitTargetDMapper; import com.njcn.prepare.harmonic.pojo.param.LineParam; -import com.njcn.prepare.harmonic.pojo.po.RStatLimitRateDPO; -import com.njcn.prepare.harmonic.pojo.po.RStatLimitTargetDPO; import com.njcn.prepare.harmonic.service.mysql.day.IRStatLimitRateDService; import com.njcn.prepare.harmonic.service.mysql.line.LimitTargetService; import lombok.AllArgsConstructor; diff --git a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/line/OnlineRateServiceImpl.java b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/line/OnlineRateServiceImpl.java index 44ac1edcd..8b6b8271d 100644 --- a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/line/OnlineRateServiceImpl.java +++ b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/line/OnlineRateServiceImpl.java @@ -3,9 +3,9 @@ package com.njcn.prepare.harmonic.service.mysql.Impl.line; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.date.DateUnit; import cn.hutool.core.date.DateUtil; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.github.jeffreyning.mybatisplus.service.MppServiceImpl; import com.njcn.device.pq.api.LineFeignClient; +import com.njcn.device.pq.pojo.po.RStatOnlinerateD; import com.njcn.energy.pojo.constant.ModelState; import com.njcn.influxdb.utils.InfluxDbUtils; import com.njcn.prepare.harmonic.mapper.mysql.day.RStatOnlineRateDMapper; @@ -13,7 +13,6 @@ import com.njcn.prepare.harmonic.pojo.dto.OnLineRateDTO; import com.njcn.prepare.harmonic.pojo.param.LineParam; import com.njcn.prepare.harmonic.pojo.influxdb.po.PqsCommunicatePO; -import com.njcn.prepare.harmonic.pojo.po.RStatOnlineRateDPO; import com.njcn.prepare.harmonic.service.mysql.line.OnlineRateService; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -27,6 +26,8 @@ import org.springframework.stereotype.Service; import java.math.BigDecimal; import java.math.RoundingMode; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; import java.util.*; import java.util.concurrent.TimeUnit; @@ -42,7 +43,7 @@ import static com.njcn.influxdb.param.InfluxDBPublicParam.DAY_MINUTE; @Slf4j @Service @AllArgsConstructor -public class OnlineRateServiceImpl extends MppServiceImpl implements OnlineRateService { +public class OnlineRateServiceImpl extends MppServiceImpl implements OnlineRateService { private final InfluxDbUtils influxDbUtils; @@ -82,6 +83,8 @@ public class OnlineRateServiceImpl extends MppServiceImpl lineIdList = lineParam.getLineIds(); if (CollUtil.isEmpty(lineParam.getLineIds())){ lineIdList = lineFeignClient.getDeviceList().getData(); @@ -91,14 +94,14 @@ public class OnlineRateServiceImpl extends MppServiceImpl communicateData = getCommunicateData(lineId); outCommunicateData.addAll(communicateData); } - List list = new ArrayList<>(); + List list = new ArrayList<>(); Date dateOut = DateUtil.parse(time); for (PqsCommunicatePO pqsCommunicate : outCommunicateData){ - RStatOnlineRateDPO onlineRateDpo = new RStatOnlineRateDPO(); + RStatOnlinerateD onlineRateDpo = new RStatOnlinerateD(); Date newDate = Date.from(pqsCommunicate.getTime()); OnLineRateDTO onLineRate = onLineMinute(newDate,dateOut,pqsCommunicate.getType(),pqsCommunicate.getDevId(),time); - onlineRateDpo.setTime(dateOut); - onlineRateDpo.setDevId(pqsCommunicate.getDevId()); + onlineRateDpo.setTimeId(dateTime); + onlineRateDpo.setDevIndex(pqsCommunicate.getDevId()); onlineRateDpo.setOnlineMin(onLineRate.getOnLineMinute()); onlineRateDpo.setOfflineMin(onLineRate.getOffLineMinute()); list.add(onlineRateDpo); diff --git a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/day/IRStatDataFlickerDService.java b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/day/IRStatDataFlickerDService.java index 6234e654f..b29d33fa0 100644 --- a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/day/IRStatDataFlickerDService.java +++ b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/day/IRStatDataFlickerDService.java @@ -1,6 +1,6 @@ package com.njcn.prepare.harmonic.service.mysql.day; -import com.njcn.prepare.harmonic.pojo.po.RStatDataFlickerDPO; +import com.njcn.harmonic.pojo.po.day.RStatDataFlickerDPO; import java.util.List; diff --git a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/day/IRStatDataFlucDService.java b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/day/IRStatDataFlucDService.java index da5493e45..5fae92b6a 100644 --- a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/day/IRStatDataFlucDService.java +++ b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/day/IRStatDataFlucDService.java @@ -1,6 +1,6 @@ package com.njcn.prepare.harmonic.service.mysql.day; -import com.njcn.prepare.harmonic.pojo.po.RStatDataFlucDPO; +import com.njcn.harmonic.pojo.po.day.RStatDataFlucDPO; import java.util.List; diff --git a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/day/IRStatDataHarmRateIDService.java b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/day/IRStatDataHarmRateIDService.java index 3fca043fa..4290d2cce 100644 --- a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/day/IRStatDataHarmRateIDService.java +++ b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/day/IRStatDataHarmRateIDService.java @@ -1,6 +1,6 @@ package com.njcn.prepare.harmonic.service.mysql.day; -import com.njcn.prepare.harmonic.pojo.po.RStatDataHarmrateIDPO; +import com.njcn.harmonic.pojo.po.day.RStatDataHarmrateIDPO; import java.util.List; diff --git a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/day/IRStatDataHarmRateVDService.java b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/day/IRStatDataHarmRateVDService.java index fdb523759..238e0e4d2 100644 --- a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/day/IRStatDataHarmRateVDService.java +++ b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/day/IRStatDataHarmRateVDService.java @@ -1,6 +1,6 @@ package com.njcn.prepare.harmonic.service.mysql.day; -import com.njcn.prepare.harmonic.pojo.po.RStatDataHarmrateVDPO; +import com.njcn.harmonic.pojo.po.day.RStatDataHarmrateVDPO; import java.util.List; diff --git a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/day/IRStatDataHarmphasicIDService.java b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/day/IRStatDataHarmphasicIDService.java index 3a615737e..f6db8acd9 100644 --- a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/day/IRStatDataHarmphasicIDService.java +++ b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/day/IRStatDataHarmphasicIDService.java @@ -1,6 +1,6 @@ package com.njcn.prepare.harmonic.service.mysql.day; -import com.njcn.prepare.harmonic.pojo.po.RStatDataHarmphasicIDPO; +import com.njcn.harmonic.pojo.po.day.RStatDataHarmphasicIDPO; import java.util.List; diff --git a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/day/IRStatDataHarmphasicVDService.java b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/day/IRStatDataHarmphasicVDService.java index f55e7845f..b236f20f0 100644 --- a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/day/IRStatDataHarmphasicVDService.java +++ b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/day/IRStatDataHarmphasicVDService.java @@ -1,6 +1,6 @@ package com.njcn.prepare.harmonic.service.mysql.day; -import com.njcn.prepare.harmonic.pojo.po.RStatDataHarmphasicVDPO; +import com.njcn.harmonic.pojo.po.day.RStatDataHarmphasicVDPO; import java.util.List; diff --git a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/day/IRStatDataHarmpowerPDService.java b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/day/IRStatDataHarmpowerPDService.java index 08c0657e6..5c6173e37 100644 --- a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/day/IRStatDataHarmpowerPDService.java +++ b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/day/IRStatDataHarmpowerPDService.java @@ -1,6 +1,6 @@ package com.njcn.prepare.harmonic.service.mysql.day; -import com.njcn.prepare.harmonic.pojo.po.RStatDataHarmpowerPDPO; +import com.njcn.harmonic.pojo.po.day.RStatDataHarmpowerPDPO; import java.util.List; diff --git a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/day/IRStatDataHarmpowerQDService.java b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/day/IRStatDataHarmpowerQDService.java index 06f072349..9ab837bb4 100644 --- a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/day/IRStatDataHarmpowerQDService.java +++ b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/day/IRStatDataHarmpowerQDService.java @@ -1,6 +1,6 @@ package com.njcn.prepare.harmonic.service.mysql.day; -import com.njcn.prepare.harmonic.pojo.po.RStatDataHarmpowerQDPO; +import com.njcn.harmonic.pojo.po.day.RStatDataHarmpowerQDPO; import java.util.List; diff --git a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/day/IRStatDataHarmpowerSDService.java b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/day/IRStatDataHarmpowerSDService.java index c7d831a66..1c71d5652 100644 --- a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/day/IRStatDataHarmpowerSDService.java +++ b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/day/IRStatDataHarmpowerSDService.java @@ -1,6 +1,6 @@ package com.njcn.prepare.harmonic.service.mysql.day; -import com.njcn.prepare.harmonic.pojo.po.RStatDataHarmpowerSDPO; +import com.njcn.harmonic.pojo.po.day.RStatDataHarmpowerSDPO; import java.util.List; diff --git a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/day/IRStatDataIDService.java b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/day/IRStatDataIDService.java index 7fd867990..296304560 100644 --- a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/day/IRStatDataIDService.java +++ b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/day/IRStatDataIDService.java @@ -1,6 +1,6 @@ package com.njcn.prepare.harmonic.service.mysql.day; -import com.njcn.prepare.harmonic.pojo.po.RStatDataIDPO; +import com.njcn.harmonic.pojo.po.day.RStatDataIDPO; import java.util.List; diff --git a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/day/IRStatDataInharmIDService.java b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/day/IRStatDataInharmIDService.java index faafb2064..a7e48e568 100644 --- a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/day/IRStatDataInharmIDService.java +++ b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/day/IRStatDataInharmIDService.java @@ -1,6 +1,6 @@ package com.njcn.prepare.harmonic.service.mysql.day; -import com.njcn.prepare.harmonic.pojo.po.RStatDataInharmIDPO; +import com.njcn.harmonic.pojo.po.day.RStatDataInharmIDPO; import java.util.List; diff --git a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/day/IRStatDataInharmVDService.java b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/day/IRStatDataInharmVDService.java index 9a78c5ccf..4ae42d0f6 100644 --- a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/day/IRStatDataInharmVDService.java +++ b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/day/IRStatDataInharmVDService.java @@ -1,6 +1,6 @@ package com.njcn.prepare.harmonic.service.mysql.day; -import com.njcn.prepare.harmonic.pojo.po.RStatDataInharmVDPO; +import com.njcn.harmonic.pojo.po.day.RStatDataInharmVDPO; import java.util.List; diff --git a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/day/IRStatDataPltDService.java b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/day/IRStatDataPltDService.java index ee429db36..f85c8ba06 100644 --- a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/day/IRStatDataPltDService.java +++ b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/day/IRStatDataPltDService.java @@ -1,6 +1,6 @@ package com.njcn.prepare.harmonic.service.mysql.day; -import com.njcn.prepare.harmonic.pojo.po.RStatDataPltDPO; +import com.njcn.harmonic.pojo.po.day.RStatDataPltDPO; import java.util.List; diff --git a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/day/IRStatDataVDService.java b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/day/IRStatDataVDService.java index 8a4bd543b..cd8b95100 100644 --- a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/day/IRStatDataVDService.java +++ b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/day/IRStatDataVDService.java @@ -1,7 +1,6 @@ package com.njcn.prepare.harmonic.service.mysql.day; -import com.njcn.prepare.harmonic.pojo.po.RStatDataFlickerDPO; -import com.njcn.prepare.harmonic.pojo.po.RStatDataVDPO; +import com.njcn.harmonic.pojo.po.day.RStatDataVDPO; import java.util.List; diff --git a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/day/IRStatLimitRateDService.java b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/day/IRStatLimitRateDService.java index 99bfefd82..744dc2ea3 100644 --- a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/day/IRStatLimitRateDService.java +++ b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/day/IRStatLimitRateDService.java @@ -1,7 +1,6 @@ package com.njcn.prepare.harmonic.service.mysql.day; -import com.njcn.prepare.harmonic.pojo.po.RStatDataVDPO; -import com.njcn.prepare.harmonic.pojo.po.RStatLimitRateDPO; +import com.njcn.harmonic.pojo.po.day.RStatLimitRateDPO; import java.util.List; diff --git a/pqs-system/system-api/src/main/java/com/njcn/system/enums/DicDataEnum.java b/pqs-system/system-api/src/main/java/com/njcn/system/enums/DicDataEnum.java index 28b74e067..211aa00a4 100644 --- a/pqs-system/system-api/src/main/java/com/njcn/system/enums/DicDataEnum.java +++ b/pqs-system/system-api/src/main/java/com/njcn/system/enums/DicDataEnum.java @@ -24,6 +24,12 @@ public enum DicDataEnum { FXDL_ENUM("负序电流", "FXDL"), JXBDY_ENUM("间谐波电压", "JXBDY"), + /** + * 污区图统计类型 + */ + I_ALL("谐波电流", "I_All"), + V_HARMONIC("谐波电压", "V_Harmonic"), + /** * 监测点类型 @@ -49,6 +55,9 @@ public enum DicDataEnum { VOLTAGE_DIP("电压暂降", "Voltage_Dip"), VOLTAGE_RISE("电压暂升", "Voltage_Rise"), SHORT_INTERRUPTIONS("短时中断", "Short_Interruptions"), + DISTURBANCE("扰动", "Disturbance"), + OTHER("其他", "Other"), + RECORDING_WAVE("录波", "Recording_Wave"), /** * 数据类型