From c5ed47808d1f25fd855110826f934be6cf6792d5 Mon Sep 17 00:00:00 2001 From: haungxing <1203316822@qq.com> Date: Tue, 7 Nov 2023 14:55:41 +0800 Subject: [PATCH 1/7] =?UTF-8?q?#=20=E4=B8=A4=E7=A5=A8=E7=BC=96=E5=8F=B7?= =?UTF-8?q?=E7=94=9F=E6=88=90=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hzims/ticket/workTicket/service/impl/OfflineTicketServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/OfflineTicketServiceImpl.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/OfflineTicketServiceImpl.java index 774fc57..ec5c331 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/OfflineTicketServiceImpl.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/OfflineTicketServiceImpl.java @@ -61,6 +61,7 @@ public class OfflineTicketServiceImpl extends BaseServiceImpl Date: Tue, 14 Nov 2023 16:44:29 +0800 Subject: [PATCH 2/7] =?UTF-8?q?#=20HZ100C=E5=8F=82=E6=95=B0=E4=B8=8B?= =?UTF-8?q?=E5=8F=91=E4=B8=8E=E5=A4=87=E4=BB=BD=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hnac/hzims/emParam/dto/ParamBackupsDTO.java | 36 +++++ .../hzims/emParam/dto/ParamBackupsDetailDTO.java | 15 ++ .../java/com/hnac/hzims/emParam/dto/ParamDTO.java | 42 ++++++ .../hnac/hzims/emParam/dto/ParamDistributeDTO.java | 37 +++++ .../emParam/entity/ParamBackupsDetailEntity.java | 54 +++++++ .../hzims/emParam/entity/ParamBackupsEntity.java | 41 +++++ .../hzims/emParam/entity/ParamModelEntity.java | 63 ++++++++ .../src/main/java/com/hnac/hzims/emParam/note.md | 1 + .../hzims/emParam/vo/ParamBackupsDetailVO.java | 15 ++ .../com/hnac/hzims/emParam/vo/ParamBackupsVO.java | 20 +++ .../com/hnac/hzims/emParam/vo/ParamGroupVO.java | 21 +++ .../com/hnac/hzims/emParam/vo/ParamTreeVO.java | 22 +++ .../java/com/hnac/hzims/emParam/vo/ParamVO.java | 64 ++++++++ .../java/com/hnac/hzims/emParam/vo/RealDataVO.java | 27 ++++ .../emParam/wrapper/ParamBackupsDetailWrapper.java | 26 ++++ .../hzims/emParam/wrapper/ParamBackupsWrapper.java | 21 +++ .../hnac/hzims/equipment/entity/EmInfoEntity.java | 11 +- .../emParam/controller/ParamBackupsController.java | 67 +++++++++ .../hzims/emParam/controller/ParamController.java | 39 +++++ .../emParam/mapper/ParamBackupsDetailMapper.java | 8 + .../hzims/emParam/mapper/ParamBackupsMapper.java | 9 ++ .../hzims/emParam/mapper/ParamModelMapper.java | 10 ++ .../src/main/java/com/hnac/hzims/emParam/note.md | 1 + .../service/IParamBackupsDetailService.java | 8 + .../emParam/service/IParamBackupsService.java | 30 ++++ .../hzims/emParam/service/IParamModelService.java | 7 + .../hnac/hzims/emParam/service/IParamService.java | 13 ++ .../impl/ParamBackupsDetailServiceImpl.java | 18 +++ .../service/impl/ParamBackupsServiceImpl.java | 90 +++++++++++ .../service/impl/ParamModelServiceImpl.java | 17 +++ .../emParam/service/impl/ParamServiceImpl.java | 166 +++++++++++++++++++++ .../equipment/src/main/resources/db/1.0.1.sql | 48 +++++- .../controller/MessagePushRecordController.java | 6 +- pom.xml | 2 +- 34 files changed, 1049 insertions(+), 6 deletions(-) create mode 100644 hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/emParam/dto/ParamBackupsDTO.java create mode 100644 hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/emParam/dto/ParamBackupsDetailDTO.java create mode 100644 hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/emParam/dto/ParamDTO.java create mode 100644 hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/emParam/dto/ParamDistributeDTO.java create mode 100644 hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/emParam/entity/ParamBackupsDetailEntity.java create mode 100644 hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/emParam/entity/ParamBackupsEntity.java create mode 100644 hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/emParam/entity/ParamModelEntity.java create mode 100644 hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/emParam/note.md create mode 100644 hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/emParam/vo/ParamBackupsDetailVO.java create mode 100644 hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/emParam/vo/ParamBackupsVO.java create mode 100644 hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/emParam/vo/ParamGroupVO.java create mode 100644 hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/emParam/vo/ParamTreeVO.java create mode 100644 hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/emParam/vo/ParamVO.java create mode 100644 hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/emParam/vo/RealDataVO.java create mode 100644 hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/emParam/wrapper/ParamBackupsDetailWrapper.java create mode 100644 hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/emParam/wrapper/ParamBackupsWrapper.java create mode 100644 hzims-service/equipment/src/main/java/com/hnac/hzims/emParam/controller/ParamBackupsController.java create mode 100644 hzims-service/equipment/src/main/java/com/hnac/hzims/emParam/controller/ParamController.java create mode 100644 hzims-service/equipment/src/main/java/com/hnac/hzims/emParam/mapper/ParamBackupsDetailMapper.java create mode 100644 hzims-service/equipment/src/main/java/com/hnac/hzims/emParam/mapper/ParamBackupsMapper.java create mode 100644 hzims-service/equipment/src/main/java/com/hnac/hzims/emParam/mapper/ParamModelMapper.java create mode 100644 hzims-service/equipment/src/main/java/com/hnac/hzims/emParam/note.md create mode 100644 hzims-service/equipment/src/main/java/com/hnac/hzims/emParam/service/IParamBackupsDetailService.java create mode 100644 hzims-service/equipment/src/main/java/com/hnac/hzims/emParam/service/IParamBackupsService.java create mode 100644 hzims-service/equipment/src/main/java/com/hnac/hzims/emParam/service/IParamModelService.java create mode 100644 hzims-service/equipment/src/main/java/com/hnac/hzims/emParam/service/IParamService.java create mode 100644 hzims-service/equipment/src/main/java/com/hnac/hzims/emParam/service/impl/ParamBackupsDetailServiceImpl.java create mode 100644 hzims-service/equipment/src/main/java/com/hnac/hzims/emParam/service/impl/ParamBackupsServiceImpl.java create mode 100644 hzims-service/equipment/src/main/java/com/hnac/hzims/emParam/service/impl/ParamModelServiceImpl.java create mode 100644 hzims-service/equipment/src/main/java/com/hnac/hzims/emParam/service/impl/ParamServiceImpl.java diff --git a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/emParam/dto/ParamBackupsDTO.java b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/emParam/dto/ParamBackupsDTO.java new file mode 100644 index 0000000..273365b --- /dev/null +++ b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/emParam/dto/ParamBackupsDTO.java @@ -0,0 +1,36 @@ +package com.hnac.hzims.emParam.dto; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.hnac.hzims.emParam.entity.ParamBackupsEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.springblade.core.tool.utils.DateUtil; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.List; + +@Data +@ApiModel("下发参数备份DTO对象") +@EqualsAndHashCode +public class ParamBackupsDTO extends ParamBackupsEntity implements Serializable { + + + @ApiModelProperty("开始时间") + @JsonFormat(pattern = DateUtil.PATTERN_DATETIME) + @DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME) + private LocalDateTime startTime; + + @ApiModelProperty("结束时间") + @JsonFormat(pattern = DateUtil.PATTERN_DATETIME) + @DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME) + private LocalDateTime endTime; + + @ApiModelProperty("参数备份详情列表") + private List details; + +} diff --git a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/emParam/dto/ParamBackupsDetailDTO.java b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/emParam/dto/ParamBackupsDetailDTO.java new file mode 100644 index 0000000..80eb450 --- /dev/null +++ b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/emParam/dto/ParamBackupsDetailDTO.java @@ -0,0 +1,15 @@ +package com.hnac.hzims.emParam.dto; + +import com.hnac.hzims.emParam.entity.ParamBackupsDetailEntity; +import io.swagger.annotations.ApiModel; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; + +@Data +@ApiModel("下发参数备份详情DTO对象") +@EqualsAndHashCode +public class ParamBackupsDetailDTO extends ParamBackupsDetailEntity implements Serializable { + +} diff --git a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/emParam/dto/ParamDTO.java b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/emParam/dto/ParamDTO.java new file mode 100644 index 0000000..72605ce --- /dev/null +++ b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/emParam/dto/ParamDTO.java @@ -0,0 +1,42 @@ +package com.hnac.hzims.emParam.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; + +@ApiModel("下发参数") +@Data +@EqualsAndHashCode +public class ParamDTO implements Serializable { + + @ApiModelProperty("参数名称") + private String name; + + @ApiModelProperty("标识") + private String signage; + + @ApiModelProperty("关联设备") + private String facDeviceId; + + @ApiModelProperty("hz3000关联id") + private String facDeviceFuncId; + + @ApiModelProperty("参数标识") + private String parameterTag; + + @ApiModelProperty("参数名称") + private String parameterName; + + @ApiModelProperty("值") + private String value; + + @ApiModelProperty("最大值") + private String maxValue; + + @ApiModelProperty("最小值") + private String minValue; + +} diff --git a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/emParam/dto/ParamDistributeDTO.java b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/emParam/dto/ParamDistributeDTO.java new file mode 100644 index 0000000..da7e972 --- /dev/null +++ b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/emParam/dto/ParamDistributeDTO.java @@ -0,0 +1,37 @@ +package com.hnac.hzims.emParam.dto; + +import com.hnac.hzims.emParam.vo.ParamVO; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; +import java.util.List; + +@ApiModel("参数下发请求体") +@Data +@EqualsAndHashCode +public class ParamDistributeDTO implements Serializable { + + @ApiModelProperty("站点编号") + @NotBlank + private String stationCode; + + @ApiModelProperty("设备编码") + @NotBlank + private String emCode; + + @ApiModelProperty("是否延迟发布") + private Boolean delay; + + @ApiModelProperty("机器码") + @NotBlank + private String machineCode; + + @ApiModelProperty("参数列表") + @NotBlank + private List paramList; + +} diff --git a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/emParam/entity/ParamBackupsDetailEntity.java b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/emParam/entity/ParamBackupsDetailEntity.java new file mode 100644 index 0000000..ff7b15d --- /dev/null +++ b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/emParam/entity/ParamBackupsDetailEntity.java @@ -0,0 +1,54 @@ +package com.hnac.hzims.emParam.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.springblade.core.mp.support.QueryField; +import org.springblade.core.mp.support.SqlCondition; +import org.springblade.core.tenant.mp.TenantEntity; + +import java.io.Serializable; + +@Data +@ApiModel("下发参数备份详情表") +@TableName("HZIMS_PARAM_BACKUPS_DETAIL") +@EqualsAndHashCode +public class ParamBackupsDetailEntity extends TenantEntity implements Serializable { + + @ApiModelProperty("备份主表ID") + private Long backupsId; + + @ApiModelProperty("参数名称") + @QueryField(condition = SqlCondition.LIKE) + private String name; + + @ApiModelProperty("标识") + @QueryField(condition = SqlCondition.LIKE) + private String signage; + + @ApiModelProperty("关联设备") + private String facDeviceId; + + @ApiModelProperty("hz3000关联id") + private String facDeviceFuncId; + + @ApiModelProperty("参数标识") + @QueryField(condition = SqlCondition.LIKE) + private String parameterTag; + + @ApiModelProperty("参数名称") + @QueryField(condition = SqlCondition.LIKE) + private String parameterName; + + @ApiModelProperty("值") + private String value; + + @ApiModelProperty("最大值") + private String maxValue; + + @ApiModelProperty("最小值") + private String minValue; + +} diff --git a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/emParam/entity/ParamBackupsEntity.java b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/emParam/entity/ParamBackupsEntity.java new file mode 100644 index 0000000..e9de13e --- /dev/null +++ b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/emParam/entity/ParamBackupsEntity.java @@ -0,0 +1,41 @@ +package com.hnac.hzims.emParam.entity; + +import com.baomidou.mybatisplus.annotation.SqlCondition; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.springblade.core.mp.support.QueryField; +import org.springblade.core.tenant.mp.TenantEntity; + +import java.io.Serializable; + +@Data +@ApiModel("下发参数备份表") +@TableName("hzims_param_backups") +@EqualsAndHashCode +public class ParamBackupsEntity extends TenantEntity implements Serializable { + + @ApiModelProperty("备份名称") + @QueryField(condition = SqlCondition.LIKE) + private String name; + + @ApiModelProperty("站点编号") + @QueryField(condition = SqlCondition.EQUAL) + private String stationCode; + + @ApiModelProperty("设备编号") + @QueryField(condition = SqlCondition.EQUAL) + private String emCode; + + @ApiModelProperty("是否延迟发布") + @QueryField(condition = SqlCondition.EQUAL) + private Boolean delay; + + @ApiModelProperty("机器码") + @QueryField(condition = SqlCondition.EQUAL) + private String machineCode; + +} diff --git a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/emParam/entity/ParamModelEntity.java b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/emParam/entity/ParamModelEntity.java new file mode 100644 index 0000000..3b27b02 --- /dev/null +++ b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/emParam/entity/ParamModelEntity.java @@ -0,0 +1,63 @@ +package com.hnac.hzims.emParam.entity; + +import com.baomidou.mybatisplus.annotation.SqlCondition; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.springblade.core.mp.support.QueryField; +import org.springblade.core.tenant.mp.TenantEntity; + +import java.io.Serializable; + +@ApiModel("HZ100C参数模板实体类") +@EqualsAndHashCode +@Data +@TableName("HZIMS_EM_PARAM_MODEL") +public class ParamModelEntity extends TenantEntity implements Serializable { + + @ApiModelProperty("编号") + @QueryField(condition = SqlCondition.LIKE) + private String code; + + @ApiModelProperty("名称") + @QueryField(condition = SqlCondition.LIKE) + private String name; + + @ApiModelProperty("单位") + private String unit; + + @ApiModelProperty("小数位") + private Integer decimalDigit; + + @ApiModelProperty("最大值") + private Double maxValue; + + @ApiModelProperty("最小值") + private Double minValue; + + @ApiModelProperty("宽度") + private Double width; + + @ApiModelProperty("类型") + @QueryField(condition = SqlCondition.EQUAL) + private Integer type; + + @ApiModelProperty("数据类型") + @QueryField(condition = SqlCondition.EQUAL) + private Integer dataType; + + @ApiModelProperty("地址") + private Integer address; + + @ApiModelProperty("起始位") + private Integer initDigital; + + @ApiModelProperty("所在显示组") + private Integer group; + + @ApiModelProperty("注释") + private String remark; + +} diff --git a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/emParam/note.md b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/emParam/note.md new file mode 100644 index 0000000..8bccf8a --- /dev/null +++ b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/emParam/note.md @@ -0,0 +1 @@ +### HZ100C 参数下发功能 \ No newline at end of file diff --git a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/emParam/vo/ParamBackupsDetailVO.java b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/emParam/vo/ParamBackupsDetailVO.java new file mode 100644 index 0000000..6768608 --- /dev/null +++ b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/emParam/vo/ParamBackupsDetailVO.java @@ -0,0 +1,15 @@ +package com.hnac.hzims.emParam.vo; + +import com.hnac.hzims.emParam.entity.ParamBackupsDetailEntity; +import io.swagger.annotations.ApiModel; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; + +@Data +@ApiModel("下发参数备份详情VO对象") +@EqualsAndHashCode +public class ParamBackupsDetailVO extends ParamBackupsDetailEntity implements Serializable { + +} diff --git a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/emParam/vo/ParamBackupsVO.java b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/emParam/vo/ParamBackupsVO.java new file mode 100644 index 0000000..3bc6f87 --- /dev/null +++ b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/emParam/vo/ParamBackupsVO.java @@ -0,0 +1,20 @@ +package com.hnac.hzims.emParam.vo; + +import com.hnac.hzims.emParam.entity.ParamBackupsEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.util.List; + +@Data +@ApiModel("下发参数备份VO对象") +@EqualsAndHashCode +public class ParamBackupsVO extends ParamBackupsEntity implements Serializable { + + @ApiModelProperty("下发参数备份参数列表") + private List detailList; + +} diff --git a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/emParam/vo/ParamGroupVO.java b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/emParam/vo/ParamGroupVO.java new file mode 100644 index 0000000..b8b24d7 --- /dev/null +++ b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/emParam/vo/ParamGroupVO.java @@ -0,0 +1,21 @@ +package com.hnac.hzims.emParam.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; + +@Data +@ApiModel("HZ100C参数分组VO") +@EqualsAndHashCode +public class ParamGroupVO implements Serializable { + + @ApiModelProperty("参数分组ID") + private String groupId; + + @ApiModelProperty("参数分组名称") + private String groupName; + +} diff --git a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/emParam/vo/ParamTreeVO.java b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/emParam/vo/ParamTreeVO.java new file mode 100644 index 0000000..6bdeee2 --- /dev/null +++ b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/emParam/vo/ParamTreeVO.java @@ -0,0 +1,22 @@ +package com.hnac.hzims.emParam.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.util.List; + +@Data +@ApiModel("HZ100C参数树VO") +@EqualsAndHashCode +public class ParamTreeVO implements Serializable { + + @ApiModelProperty("参数分组") + private ParamGroupVO paramGroup; + + @ApiModelProperty("参数列表") + private List paramList; + +} diff --git a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/emParam/vo/ParamVO.java b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/emParam/vo/ParamVO.java new file mode 100644 index 0000000..76816be --- /dev/null +++ b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/emParam/vo/ParamVO.java @@ -0,0 +1,64 @@ +package com.hnac.hzims.emParam.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; + +/** + * @ClassName ParamVO + * @description: + * @author: hx + * @create: 2023-10-17 14:13 + * @Version 4.0 + **/ +@Data +@ApiModel("HZ100C参数VO") +@EqualsAndHashCode +public class ParamVO implements Serializable { + + @ApiModelProperty("参数名称") + private String name; + + @ApiModelProperty("标识") + private String signage; + + @ApiModelProperty("关联设备") + private String facDeviceId; + + @ApiModelProperty("hz3000关联id") + private String facDeviceAttrId; + + @ApiModelProperty("参数标识") + private String parameterTag; + + @ApiModelProperty("参数名称") + private String parameterName; + + @ApiModelProperty("是否只读") + private Integer isReadOnly; + + @ApiModelProperty("数据类型") + private String dbType; + + @ApiModelProperty("参数分组") + private Long modelClassifyId; + + @ApiModelProperty("参数分组名称") + private String modelClassifyName; + + @ApiModelProperty("单位") + private String units; + + @ApiModelProperty("值") + private String value; + + @ApiModelProperty("最大值") + private String maxValue; + + @ApiModelProperty("最小值") + private String minValue; + +} diff --git a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/emParam/vo/RealDataVO.java b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/emParam/vo/RealDataVO.java new file mode 100644 index 0000000..9139299 --- /dev/null +++ b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/emParam/vo/RealDataVO.java @@ -0,0 +1,27 @@ +package com.hnac.hzims.emParam.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; + +@Data +@ApiModel("实时数据VO对象") +@EqualsAndHashCode +public class RealDataVO implements Serializable { + + @ApiModelProperty("采集点ID") + private String realId; + + @ApiModelProperty("采集点实时数据") + private String value; + + @ApiModelProperty("采集点时间") + private String time; + + @ApiModelProperty("有效值") + private String q; + +} diff --git a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/emParam/wrapper/ParamBackupsDetailWrapper.java b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/emParam/wrapper/ParamBackupsDetailWrapper.java new file mode 100644 index 0000000..4c389ca --- /dev/null +++ b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/emParam/wrapper/ParamBackupsDetailWrapper.java @@ -0,0 +1,26 @@ +package com.hnac.hzims.emParam.wrapper; + +import com.hnac.hzims.emParam.entity.ParamBackupsDetailEntity; +import com.hnac.hzims.emParam.entity.ParamBackupsEntity; +import com.hnac.hzims.emParam.vo.ParamBackupsDetailVO; +import com.hnac.hzims.emParam.vo.ParamBackupsVO; +import org.springblade.core.mp.support.BaseEntityWrapper; +import org.springblade.core.tool.utils.BeanUtil; + +/** + * @ClassName ParamBackupsDetailWrapper + * @description: + * @author: hx + * @create: 2023-10-17 17:07 + * @Version 4.0 + **/ +public class ParamBackupsDetailWrapper extends BaseEntityWrapper { + public static ParamBackupsDetailWrapper build() { + return new ParamBackupsDetailWrapper(); + } + @Override + public ParamBackupsDetailVO entityVO(ParamBackupsDetailEntity entity) { + ParamBackupsDetailVO vo = BeanUtil.copy(entity, ParamBackupsDetailVO.class); + return vo; + } +} diff --git a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/emParam/wrapper/ParamBackupsWrapper.java b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/emParam/wrapper/ParamBackupsWrapper.java new file mode 100644 index 0000000..96afad9 --- /dev/null +++ b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/emParam/wrapper/ParamBackupsWrapper.java @@ -0,0 +1,21 @@ +package com.hnac.hzims.emParam.wrapper; + +import com.hnac.hzims.emParam.entity.ParamBackupsEntity; +import com.hnac.hzims.emParam.vo.ParamBackupsVO; +import org.apache.ibatis.reflection.wrapper.BaseWrapper; +import org.springblade.core.mp.support.BaseEntityWrapper; +import org.springblade.core.tool.utils.BeanUtil; + + +public class ParamBackupsWrapper extends BaseEntityWrapper { + + public static ParamBackupsWrapper build() { + return new ParamBackupsWrapper(); + } + + @Override + public ParamBackupsVO entityVO(ParamBackupsEntity entity) { + ParamBackupsVO vo = BeanUtil.copy(entity,ParamBackupsVO.class); + return vo; + } +} diff --git a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/entity/EmInfoEntity.java b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/entity/EmInfoEntity.java index 9f0cbde..f9b0dbc 100644 --- a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/entity/EmInfoEntity.java +++ b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/entity/EmInfoEntity.java @@ -17,6 +17,7 @@ import org.springframework.format.annotation.DateTimeFormat; import javax.validation.constraints.NotNull; import java.math.BigDecimal; +import java.time.LocalDateTime; import java.util.Date; import java.util.List; @@ -191,14 +192,14 @@ public class EmInfoEntity extends TenantEntity { */ @ApiModelProperty(value = "经度(东经)") @JsonSerialize(nullsUsing = NullSerializer.class) - @NotNull + //@NotNull private BigDecimal lgtd; /** * 纬度(北纬) */ @ApiModelProperty(value = "纬度(北纬)") @JsonSerialize(nullsUsing = NullSerializer.class) - @NotNull + //@NotNull private BigDecimal lttd; /** * 主要部件及附属设备 @@ -249,4 +250,10 @@ public class EmInfoEntity extends TenantEntity { @TableField(exist = false) private List infoChildren; + @ApiModelProperty("最后下发时间") + private LocalDateTime lastDistributeTime; + + @ApiModelProperty("机组类别") + private String setCategory; + } diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/emParam/controller/ParamBackupsController.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/emParam/controller/ParamBackupsController.java new file mode 100644 index 0000000..c6ccb84 --- /dev/null +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/emParam/controller/ParamBackupsController.java @@ -0,0 +1,67 @@ +package com.hnac.hzims.emParam.controller; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; +import com.hnac.hzims.common.utils.Condition; +import com.hnac.hzims.emParam.dto.ParamBackupsDTO; +import com.hnac.hzims.emParam.entity.ParamBackupsEntity; +import com.hnac.hzims.emParam.service.IParamBackupsService; +import com.hnac.hzims.emParam.vo.ParamBackupsVO; +import com.hnac.hzims.emParam.wrapper.ParamBackupsWrapper; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import lombok.AllArgsConstructor; +import org.springblade.core.boot.ctrl.BladeController; +import org.springblade.core.mp.support.Query; +import org.springblade.core.tool.api.R; +import org.springblade.core.tool.utils.BeanUtil; +import org.springblade.core.tool.utils.Func; +import org.springframework.web.bind.annotation.*; + +@RestController +@RequestMapping("/emParam/backups") +@Api(value = "HZ100C参数下发备份管理",tags = "HZ100C参数下发备份管理") +@AllArgsConstructor +public class ParamBackupsController extends BladeController { + + private final IParamBackupsService paramBackupsService; + + @GetMapping("/listPage") + @ApiOperation("分页查询") + @ApiOperationSupport(order = 1) + public R listPage(ParamBackupsDTO request, Query query) { + IPage page = paramBackupsService.page(Condition.getPage(query),paramBackupsService.getQueryWrapper(request)); + page.setRecords(ParamBackupsWrapper.build().listVO(page.getRecords())); + return R.data(page); + } + + @DeleteMapping("/remove/{ids}") + @ApiOperation("删除备份") + @ApiOperationSupport(order = 2) + public R remove(@PathVariable @ApiParam("主键,按,分隔") String ids) { + return R.status(paramBackupsService.removeByIds(Func.toLongList(",",ids))); + } + + @PostMapping("/save") + @ApiOperation("新增") + @ApiOperationSupport(order = 3) + public R save(@RequestBody ParamBackupsDTO request) { + return R.status(paramBackupsService.save(request)); + } + + @GetMapping("/detail/{id}") + @ApiOperation("查看详情") + @ApiOperationSupport(order = 4) + public R detail(@PathVariable @ApiParam("主键") Long id) { + return R.data(paramBackupsService.detail(id)); + } + + @PutMapping("/updateById") + @ApiOperation("编辑") + @ApiOperationSupport(order = 5) + public R updateById(@RequestBody ParamBackupsDTO request) { + return R.status(paramBackupsService.updateById(request)); + } + +} diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/emParam/controller/ParamController.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/emParam/controller/ParamController.java new file mode 100644 index 0000000..f3cdd91 --- /dev/null +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/emParam/controller/ParamController.java @@ -0,0 +1,39 @@ +package com.hnac.hzims.emParam.controller; + +import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; +import com.hnac.hzims.emParam.dto.ParamDistributeDTO; +import com.hnac.hzims.emParam.service.IParamService; +import com.hnac.hzims.emParam.vo.ParamTreeVO; +import com.hnac.hzinfo.sdk.core.response.Result; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.AllArgsConstructor; +import org.springblade.core.boot.ctrl.BladeController; +import org.springblade.core.tool.api.R; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +@RequestMapping("/param") +@AllArgsConstructor +@RestController +@Api(value = "参数下发管理",tags = "参数下发管理") +public class ParamController extends BladeController { + + private final IParamService paramService; + + @GetMapping("/recall") + @ApiOperation("召回参数") + @ApiOperationSupport(order = 1) + public R> recall(String emCode, String stationCode) { + return R.data(paramService.recall(emCode,stationCode)); + } + + @PostMapping("/distribute") + @ApiOperation("下发参数") + @ApiOperationSupport(order = 2) + public Result distribute(@RequestBody ParamDistributeDTO req) { + return paramService.distribute(req); + } + +} diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/emParam/mapper/ParamBackupsDetailMapper.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/emParam/mapper/ParamBackupsDetailMapper.java new file mode 100644 index 0000000..b53f1b2 --- /dev/null +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/emParam/mapper/ParamBackupsDetailMapper.java @@ -0,0 +1,8 @@ +package com.hnac.hzims.emParam.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hnac.hzims.emParam.entity.ParamBackupsDetailEntity; +import com.hnac.hzims.emParam.entity.ParamBackupsEntity; + +public interface ParamBackupsDetailMapper extends BaseMapper { +} diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/emParam/mapper/ParamBackupsMapper.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/emParam/mapper/ParamBackupsMapper.java new file mode 100644 index 0000000..b0e28ad --- /dev/null +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/emParam/mapper/ParamBackupsMapper.java @@ -0,0 +1,9 @@ +package com.hnac.hzims.emParam.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hnac.hzims.emParam.entity.ParamBackupsEntity; +import org.apache.ibatis.reflection.wrapper.BaseWrapper; + +public interface ParamBackupsMapper extends BaseMapper { + +} diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/emParam/mapper/ParamModelMapper.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/emParam/mapper/ParamModelMapper.java new file mode 100644 index 0000000..3b59e6d --- /dev/null +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/emParam/mapper/ParamModelMapper.java @@ -0,0 +1,10 @@ +package com.hnac.hzims.emParam.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hnac.hzims.emParam.entity.ParamModelEntity; + +public interface ParamModelMapper extends BaseMapper { + + + +} diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/emParam/note.md b/hzims-service/equipment/src/main/java/com/hnac/hzims/emParam/note.md new file mode 100644 index 0000000..8bccf8a --- /dev/null +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/emParam/note.md @@ -0,0 +1 @@ +### HZ100C 参数下发功能 \ No newline at end of file diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/emParam/service/IParamBackupsDetailService.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/emParam/service/IParamBackupsDetailService.java new file mode 100644 index 0000000..20b3381 --- /dev/null +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/emParam/service/IParamBackupsDetailService.java @@ -0,0 +1,8 @@ +package com.hnac.hzims.emParam.service; + +import com.hnac.hzims.emParam.entity.ParamBackupsDetailEntity; +import org.springblade.core.mp.base.BaseService; + +public interface IParamBackupsDetailService extends BaseService { + +} diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/emParam/service/IParamBackupsService.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/emParam/service/IParamBackupsService.java new file mode 100644 index 0000000..4e73022 --- /dev/null +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/emParam/service/IParamBackupsService.java @@ -0,0 +1,30 @@ +package com.hnac.hzims.emParam.service; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.hnac.hzims.common.utils.Condition; +import com.hnac.hzims.emParam.dto.ParamBackupsDTO; +import com.hnac.hzims.emParam.entity.ParamBackupsEntity; +import com.hnac.hzims.emParam.vo.ParamBackupsVO; +import org.springblade.core.mp.base.BaseService; +import org.springblade.core.tool.utils.BeanUtil; +import org.springblade.core.tool.utils.Func; +import org.springframework.web.bind.annotation.RequestBody; + +public interface IParamBackupsService extends BaseService { + + Boolean save(ParamBackupsDTO request); + + ParamBackupsVO detail(Long id); + + Boolean updateById(ParamBackupsDTO request); + + default LambdaQueryWrapper getQueryWrapper(ParamBackupsDTO request) { + ParamBackupsEntity paramBackupsEntity = BeanUtil.copy(request, ParamBackupsEntity.class); + LambdaQueryWrapper queryWrapper = Condition.getQueryWrapper(ParamBackupsEntity.class, paramBackupsEntity); + queryWrapper.ge(Func.isNotEmpty(request.getStartTime()),ParamBackupsEntity::getCreateTime,request.getStartTime()); + queryWrapper.le(Func.isNotEmpty(request.getEndTime()),ParamBackupsEntity::getCreateTime,request.getEndTime()); + queryWrapper.orderByDesc(ParamBackupsEntity::getCreateTime); + return queryWrapper; + } + +} diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/emParam/service/IParamModelService.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/emParam/service/IParamModelService.java new file mode 100644 index 0000000..0252723 --- /dev/null +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/emParam/service/IParamModelService.java @@ -0,0 +1,7 @@ +package com.hnac.hzims.emParam.service; + +import com.hnac.hzims.emParam.entity.ParamModelEntity; +import org.springblade.core.mp.base.BaseService; + +public interface IParamModelService extends BaseService { +} diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/emParam/service/IParamService.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/emParam/service/IParamService.java new file mode 100644 index 0000000..15d8784 --- /dev/null +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/emParam/service/IParamService.java @@ -0,0 +1,13 @@ +package com.hnac.hzims.emParam.service; + +import com.hnac.hzims.emParam.dto.ParamDistributeDTO; +import com.hnac.hzims.emParam.vo.ParamTreeVO; +import com.hnac.hzinfo.sdk.core.response.Result; + +import java.util.List; + +public interface IParamService { + List recall(String emCode, String stationCode); + + Result distribute(ParamDistributeDTO req); +} diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/emParam/service/impl/ParamBackupsDetailServiceImpl.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/emParam/service/impl/ParamBackupsDetailServiceImpl.java new file mode 100644 index 0000000..8ea468c --- /dev/null +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/emParam/service/impl/ParamBackupsDetailServiceImpl.java @@ -0,0 +1,18 @@ +package com.hnac.hzims.emParam.service.impl; + +import com.hnac.hzims.emParam.entity.ParamBackupsDetailEntity; +import com.hnac.hzims.emParam.mapper.ParamBackupsDetailMapper; +import com.hnac.hzims.emParam.service.IParamBackupsDetailService; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springframework.stereotype.Service; + +@Service +@AllArgsConstructor +@Slf4j +public class ParamBackupsDetailServiceImpl extends BaseServiceImpl implements IParamBackupsDetailService { + + + +} diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/emParam/service/impl/ParamBackupsServiceImpl.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/emParam/service/impl/ParamBackupsServiceImpl.java new file mode 100644 index 0000000..b1af8de --- /dev/null +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/emParam/service/impl/ParamBackupsServiceImpl.java @@ -0,0 +1,90 @@ +package com.hnac.hzims.emParam.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.hnac.hzims.emParam.dto.ParamBackupsDTO; +import com.hnac.hzims.emParam.entity.ParamBackupsDetailEntity; +import com.hnac.hzims.emParam.entity.ParamBackupsEntity; +import com.hnac.hzims.emParam.mapper.ParamBackupsDetailMapper; +import com.hnac.hzims.emParam.mapper.ParamBackupsMapper; +import com.hnac.hzims.emParam.service.IParamBackupsDetailService; +import com.hnac.hzims.emParam.service.IParamBackupsService; +import com.hnac.hzims.emParam.vo.ParamBackupsVO; +import com.hnac.hzims.emParam.wrapper.ParamBackupsDetailWrapper; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.log.exception.ServiceException; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springblade.core.tool.utils.BeanUtil; +import org.springblade.core.tool.utils.CollectionUtil; +import org.springblade.core.tool.utils.Func; +import org.springblade.core.tool.utils.ObjectUtil; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.Assert; + +import javax.sql.rowset.serial.SerialException; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +@Service +@AllArgsConstructor +@Slf4j +public class ParamBackupsServiceImpl extends BaseServiceImpl implements IParamBackupsService { + + private final IParamBackupsDetailService detailService; + + @Override + @Transactional + public Boolean save(ParamBackupsDTO request) { + Assert.isTrue(CollectionUtil.isNotEmpty(request.getDetails()),() -> { + throw new ServiceException("备份参数不能为空!"); + }); + ParamBackupsEntity paramBackupsEntity = BeanUtil.copy(request,ParamBackupsEntity.class); + if(this.save(paramBackupsEntity)) { + List detailList = request.getDetails().stream() + .map(d -> BeanUtil.copy(d, ParamBackupsDetailEntity.class)).filter(Objects::nonNull) + .peek(d -> d.setBackupsId(paramBackupsEntity.getId())).collect(Collectors.toList()); + Assert.isTrue(detailService.saveBatch(detailList),() -> { + throw new ServiceException("保存备份参数列表失败!"); + }); + return true; + } + return false; + } + + @Override + public ParamBackupsVO detail(Long id) { + ParamBackupsEntity paramBackupsEntity = this.getById(id); + Assert.isTrue(Func.isNotEmpty(paramBackupsEntity),() -> { + throw new ServiceException("未查询到相关记录!"); + }); + ParamBackupsVO result = BeanUtil.copy(paramBackupsEntity,ParamBackupsVO.class); + LambdaQueryWrapper detailQuery = Wrappers.lambdaQuery().eq(ParamBackupsDetailEntity::getBackupsId, id); + List detailList = detailService.list(detailQuery); + result.setDetailList(ParamBackupsDetailWrapper.build().listVO(detailList)); + return result; + } + + @Override + @Transactional + public Boolean updateById(ParamBackupsDTO request) { + Assert.isTrue(CollectionUtil.isNotEmpty(request.getDetails()),() -> { + throw new ServiceException("备份参数不能为空!"); + }); + ParamBackupsEntity paramBackupsEntity = BeanUtil.copy(request,ParamBackupsEntity.class); + if(this.updateById(paramBackupsEntity)) { + List detailList = request.getDetails().stream() + .map(d -> BeanUtil.copy(d, ParamBackupsDetailEntity.class)).filter(Objects::nonNull) + .peek(d -> d.setBackupsId(paramBackupsEntity.getId())).collect(Collectors.toList()); + Assert.isTrue(detailService.saveOrUpdateBatch(detailList),() -> { + throw new ServiceException("保存备份参数列表失败!"); + }); + return true; + } + return false; + } + + +} diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/emParam/service/impl/ParamModelServiceImpl.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/emParam/service/impl/ParamModelServiceImpl.java new file mode 100644 index 0000000..0b38863 --- /dev/null +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/emParam/service/impl/ParamModelServiceImpl.java @@ -0,0 +1,17 @@ +package com.hnac.hzims.emParam.service.impl; + +import com.hnac.hzims.emParam.entity.ParamModelEntity; +import com.hnac.hzims.emParam.mapper.ParamModelMapper; +import com.hnac.hzims.emParam.service.IParamModelService; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.mp.base.BaseService; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springframework.stereotype.Service; + +@Service +@AllArgsConstructor +@Slf4j +public class ParamModelServiceImpl extends BaseServiceImpl implements IParamModelService { + +} diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/emParam/service/impl/ParamServiceImpl.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/emParam/service/impl/ParamServiceImpl.java new file mode 100644 index 0000000..10b4a7b --- /dev/null +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/emParam/service/impl/ParamServiceImpl.java @@ -0,0 +1,166 @@ +package com.hnac.hzims.emParam.service.impl; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.google.common.collect.Lists; +import com.hnac.hzims.emParam.dto.ParamDTO; +import com.hnac.hzims.emParam.dto.ParamDistributeDTO; +import com.hnac.hzims.emParam.service.IParamService; +import com.hnac.hzims.emParam.vo.ParamGroupVO; +import com.hnac.hzims.emParam.vo.ParamTreeVO; +import com.hnac.hzims.emParam.vo.ParamVO; +import com.hnac.hzims.emParam.vo.RealDataVO; +import com.hnac.hzims.equipment.entity.EmInfoEntity; +import com.hnac.hzims.equipment.service.IEmInfoService; +import com.hnac.hzinfo.datasearch.analyse.IAnalyseDataSearchClient; +import com.hnac.hzinfo.datasearch.analyse.domain.FieldsData; +import com.hnac.hzinfo.datasearch.real.po.RealDataSearchPO; +import com.hnac.hzinfo.sdk.core.response.Result; +import com.hnac.hzinfo.sdk.v5.control.ControlClient; +import com.hnac.hzinfo.sdk.v5.control.dto.ControlBatchDTO; +import com.hnac.hzinfo.sdk.v5.control.dto.Ctrl; +import com.hnac.hzinfo.sdk.v5.device.DeviceDataClient; +import com.hnac.hzinfo.sdk.v5.device.client.DeviceClient; +import com.hnac.hzinfo.sdk.v5.device.dto.DeviceDataDTO; +import com.hnac.hzinfo.sdk.v5.device.vo.DeviceInstanceAttrVO; +import com.hnac.hzinfo.sdk.v5.device.vo.DeviceInstanceFuncVO; +import com.hnac.hzinfo.sdk.v5.redis.RedisClient; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.log.exception.ServiceException; +import org.springblade.core.log.logger.BladeLogger; +import org.springblade.core.secure.utils.AuthUtil; +import org.springblade.core.tool.api.R; +import org.springblade.core.tool.utils.BeanUtil; +import org.springblade.core.tool.utils.CollectionUtil; +import org.springblade.core.tool.utils.Func; +import org.springblade.core.tool.utils.StringUtil; +import org.springframework.stereotype.Service; +import org.springframework.util.Assert; +import java.time.LocalDateTime; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.stream.Collectors; + +@Service +@AllArgsConstructor +@Slf4j +public class ParamServiceImpl implements IParamService { + + private final ControlClient controlClient; + private final DeviceClient deviceClient; + private final RedisClient redisClient; + private final BladeLogger logger; + private final IEmInfoService emInfoService; + private final DeviceDataClient deviceDataClient; + private final IAnalyseDataSearchClient analyseDataSearchClient; + + /** + * 参数召回 + * @param emCode 设备编号 + * @param stationCode 站点编号 + * @return 召回参数渲染对象 + */ + @Override + public List recall(String emCode,String stationCode) { + List result = Lists.newArrayList(); + // 获取设备物模型中是参数的属性 + Result> paramDeviceAttrR = deviceDataClient.getIsParamDeviceAttr(emCode); + Assert.isTrue(paramDeviceAttrR.isSuccess() && CollectionUtil.isNotEmpty(paramDeviceAttrR.getData()),() -> { + throw new ServiceException("获取设备实例物模型属性失败!"); + }); + // 获取实时数据 + List signageList = paramDeviceAttrR.getData().stream().map(DeviceInstanceAttrVO::getSignage).filter(StringUtil::isNotBlank).collect(Collectors.toList()); + Result realDataR = deviceDataClient.getDeviceRealDataByCode(emCode, signageList); + Assert.isTrue(realDataR.isSuccess(),() -> { + throw new ServiceException("参数召回获取实时数据失败"); + }); + Map> paramGroupVOListMap = paramDeviceAttrR.getData().stream().map(this::convert).collect(Collectors.groupingBy(p -> { + ParamGroupVO paramGroupVO = new ParamGroupVO(); + paramGroupVO.setGroupId(String.valueOf(p.getModelClassifyId())); + paramGroupVO.setGroupName(p.getModelClassifyName()); + return paramGroupVO; + })); + paramGroupVOListMap.forEach((groupVO,list) -> { + ParamTreeVO paramTreeVO = new ParamTreeVO(); + paramTreeVO.setParamGroup(groupVO); + list.stream().filter(p -> realDataR.getData().getDataMap().containsKey(p.getSignage())).forEach(p -> { + String realData = JSON.toJSONString(realDataR.getData().getDataMap().get(p.getSignage())); + if("0".equals(JSONObject.parseObject(realData).getString("q"))) { + p.setValue(JSONObject.parseObject(realData).getString("v")); + } + }); + paramTreeVO.setParamList(list); + result.add(paramTreeVO); + }); + return result; + } + + /** + * 参数下发 + * @param req 下发参数 + * @return 下发结果 + */ + @Override + public Result distribute(ParamDistributeDTO req) { + Assert.isTrue(Func.isNotEmpty(AuthUtil.getUserId()),() -> { + throw new ServiceException("未获取到当前登录人,无法下发参数!"); + }); + ControlBatchDTO controlBatchDTO = new ControlBatchDTO(); + controlBatchDTO.setProjectId(req.getStationCode()); + controlBatchDTO.setDeviceCode(req.getEmCode()); + controlBatchDTO.setDelay(req.getDelay()); + controlBatchDTO.setOperator(String.valueOf(AuthUtil.getUserId())); + controlBatchDTO.setMachineCode(req.getMachineCode()); + List ctrl = req.getParamList().stream().map(this::convert).collect(Collectors.toList()); + controlBatchDTO.setCtrls(ctrl); + log.info("{}",JSON.toJSONString(controlBatchDTO)); + Result result = controlClient.batchSendToDevice(controlBatchDTO); + if(!result.isSuccess()) { + logger.error("equipment:ParamServiceImpl:distribute","下发参数传参为:"+JSON.toJSONString(controlBatchDTO)+";下发结果为:"+JSON.toJSONString(result)); + return result; + } + LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate().set(EmInfoEntity::getLastDistributeTime, LocalDateTime.now()).eq(EmInfoEntity::getNumber, req.getEmCode()); + emInfoService.update(updateWrapper); + return result; + } + + /** + * 参数转换为下发参数传参格式 + * @param param 参数 + * @return 下发参数传参格式 + */ + private Ctrl convert(ParamDTO param) { + Ctrl result = new Ctrl(); + result.setSignage(param.getSignage()); + Map params = new HashMap(1){{ + put(param.getSignage(),param.getValue()); + }}; + result.setParams(params); + return result; + } + + private ParamVO convert(DeviceInstanceAttrVO instanceAttrVO) { + ParamVO paramVO = BeanUtil.copy(instanceAttrVO, ParamVO.class); + paramVO.setMaxValue(String.valueOf(instanceAttrVO.getUpperLimit())); + paramVO.setMinValue(String.valueOf(instanceAttrVO.getLowerLimit())); + return paramVO; + } + + /** + * 设备实例功能对象转换为参数VO对象 + * @param funcVO 设备实例功能对象 + * @return 参数VO对象 + */ + private ParamVO convert(DeviceInstanceFuncVO funcVO) { + ParamVO paramVO = BeanUtil.copy(funcVO, ParamVO.class); + return paramVO; + } + + +} diff --git a/hzims-service/equipment/src/main/resources/db/1.0.1.sql b/hzims-service/equipment/src/main/resources/db/1.0.1.sql index 5c7b661..98b3759 100644 --- a/hzims-service/equipment/src/main/resources/db/1.0.1.sql +++ b/hzims-service/equipment/src/main/resources/db/1.0.1.sql @@ -1 +1,47 @@ -alter table hzims_em_param add COLUMN NAME VARCHAR(100) comment '参数名称'; \ No newline at end of file +alter table hzims_em_param add COLUMN NAME VARCHAR(100) comment '参数名称'; + +-- HZ100C参数下发 设备表添加参数最后下发时间字段 +alter table `hzims_em_info` add column `LAST_DISTRIBUTE_TIME` DATETIME DEFAULT NULL COMMENT '最后下发时间'; +-- HZ100C参数下发 设备表添加字段机组类别 +alter table `hzims_em_info` add column `SET_CATEGORY` VARCHAR(2) DEFAULT NULL COMMENT '机组类别'; + +CREATE TABLE `hzims_param_backups` ( + `ID` bigint(20) NOT NULL, + `NAME` varchar(255) DEFAULT NULL, + `STATION_CODE` varchar(64) DEFAULT NULL, + `EM_CODE` varchar(64) DEFAULT NULL, + `DELAY` tinyint(1) DEFAULT NULL, + `MACHINE_CODE` varchar(255) DEFAULT NULL, + `TENANT_ID` varchar(12) DEFAULT NULL COMMENT '租户ID', + `CREATE_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATE_TIME` datetime DEFAULT NULL COMMENT '更新时间', + `CREATE_USER` bigint(20) NOT NULL COMMENT '创建人', + `UPDATE_USER` bigint(20) DEFAULT NULL COMMENT '更新人', + `IS_DELETED` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否删除', + `STATUS` tinyint(4) DEFAULT NULL COMMENT '状态 ', + `CREATE_DEPT` bigint(20) DEFAULT NULL COMMENT '创建部门', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +CREATE TABLE `hzims_param_backups_detail` ( + `ID` bigint(20) NOT NULL, + `BACKUPS_ID` bigint(20) DEFAULT NULL COMMENT '备份主表ID', + `NAME` varchar(255) DEFAULT NULL COMMENT '参数名称', + `SIGNAGE` varchar(128) DEFAULT NULL COMMENT '标识', + `FAC_DEVICE_ID` varchar(64) DEFAULT NULL COMMENT '关联设备', + `FAC_DEVICE_FUNC_ID` varchar(64) DEFAULT NULL COMMENT 'hz3000关联id', + `PARAMETER_TAG` varchar(128) DEFAULT NULL COMMENT '参数标识', + `PARAMETER_NAME` varchar(255) DEFAULT NULL COMMENT '参数名称', + `VALUE` varchar(16) DEFAULT NULL COMMENT '值', + `MAX_VALUE` varchar(16) DEFAULT NULL COMMENT '最大值', + `MIN_VALUE` varchar(16) DEFAULT NULL COMMENT '最小值', + `TENANT_ID` varchar(12) DEFAULT NULL COMMENT '租户ID', + `CREATE_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATE_TIME` datetime DEFAULT NULL COMMENT '更新时间', + `CREATE_USER` bigint(20) NOT NULL COMMENT '创建人', + `UPDATE_USER` bigint(20) DEFAULT NULL COMMENT '更新人', + `IS_DELETED` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否删除', + `STATUS` tinyint(4) DEFAULT NULL COMMENT '状态 ', + `CREATE_DEPT` bigint(20) DEFAULT NULL COMMENT '创建部门', + PRIMARY KEY (`ID`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; \ No newline at end of file diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/controller/MessagePushRecordController.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/controller/MessagePushRecordController.java index 056cd66..e2a9b9e 100644 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/controller/MessagePushRecordController.java +++ b/hzims-service/message/src/main/java/com/hnac/hzims/message/controller/MessagePushRecordController.java @@ -90,12 +90,14 @@ public class MessagePushRecordController extends BladeController { @GetMapping("/readMessageBatch") @ApiOperation("批量处理消息") @ApiOperationSupport(order = 7) - public R readMessageBatch() { + public R readMessageBatch(String businessClassify,String type) { LambdaUpdateWrapper eq = Wrappers.lambdaUpdate() .set(MessagePushRecordEntity::getStatus, MessageConstants.CONFIRM) .set(MessagePushRecordEntity::getRespondTime, LocalDateTime.now()) .eq(MessagePushRecordEntity::getPusher, AuthUtil.getUserId()) - .eq(MessagePushRecordEntity::getStatus, MessageConstants.PUSH_SUCCESS); + .eq(MessagePushRecordEntity::getStatus, MessageConstants.PUSH_SUCCESS) + .eq(Func.isNotEmpty(businessClassify),MessagePushRecordEntity::getBusinessClassify,businessClassify) + .eq(Func.isNotEmpty(type),MessagePushRecordEntity::getType,type); return R.status(messagePushRecordService.update(eq)); } diff --git a/pom.xml b/pom.xml index 02336a9..8593c9c 100644 --- a/pom.xml +++ b/pom.xml @@ -16,7 +16,7 @@ 5.0.1.RELEASE - 5.0.2-SNAPSHOT + 5.1.0-SNAPSHOT UTF-8 1.8 From cef87107198e3d1983c7fd082d590f223449ac36 Mon Sep 17 00:00:00 2001 From: tyty Date: Tue, 14 Nov 2023 18:16:04 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=82=A8=E8=83=BD?= =?UTF-8?q?=E3=80=81=E9=A3=8E=E7=94=B5=E4=BB=A5=E5=8F=8A=E5=8F=91=E7=94=B5?= =?UTF-8?q?=E9=87=8F=E6=89=B9=E9=87=8F=E6=96=B0=E5=A2=9E=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hnac/hzims/operational/fill/vo/QueryVo.java | 2 - .../operational/main/constant/MainConstants.java | 4 + .../scheduled/mapper/operation/StorageMapper.java | 14 +++ .../scheduled/mapper/operation/WindMapper.java | 11 ++ .../scheduled/RealTargetScheduledTask.java | 34 +++-- .../scheduled/scheduled/ReportScheduledTask.java | 35 +++++- .../service/operation/fill/StorageService.java | 20 +++ .../service/operation/fill/WindService.java | 15 +++ .../operation/fill/impl/StorageServiceImpl.java | 51 ++++++++ .../operation/fill/impl/WindServiceImpl.java | 52 ++++++++ .../service/operation/home/RealTargetService.java | 1 + .../operation/home/impl/RealTargetServiceImpl.java | 76 ++++++++++-- .../service/operation/report/ReportService.java | 1 + .../operation/report/impl/ReportServiceImpl.java | 39 ++++++ .../resources/mapper/operation/StorageMapper.xml | 4 + .../main/resources/mapper/operation/WindMapper.xml | 5 + .../fill/controller/GenerateController.java | 11 ++ .../operational/fill/service/GenerateService.java | 6 +- .../fill/service/impl/GenerateServiceImpl.java | 22 ++++ .../main/controller/AreaMonthReportController.java | 35 +++++- .../main/service/IAreaMonthReportService.java | 5 + .../service/impl/AreaMonthReportServiceImpl.java | 137 ++++++++++++++++++++- 22 files changed, 550 insertions(+), 30 deletions(-) create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/StorageMapper.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/WindMapper.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/fill/StorageService.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/fill/WindService.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/fill/impl/StorageServiceImpl.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/fill/impl/WindServiceImpl.java create mode 100644 hzims-service/hzims-scheduled/src/main/resources/mapper/operation/StorageMapper.xml create mode 100644 hzims-service/hzims-scheduled/src/main/resources/mapper/operation/WindMapper.xml diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/fill/vo/QueryVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/fill/vo/QueryVo.java index 3f7d66b..18d92ee 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/fill/vo/QueryVo.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/fill/vo/QueryVo.java @@ -3,8 +3,6 @@ package com.hnac.hzims.operational.fill.vo; import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import java.util.Date; - /** * @author ysj * @date 2023/04/10 11:16:07 diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/MainConstants.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/MainConstants.java index e8b21ab..dcc66fc 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/MainConstants.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/MainConstants.java @@ -48,6 +48,8 @@ public interface MainConstants { // 近年发电量 String ELECTRICITY_GENERATION_RECENT_YEAR = "electricityGenerationRecentYear"; + // 風電儲能近年发电量 + String WIND_POWER_GENERATION_RECENT_YEAR = "windPowerGenerationRecentYear"; // 区域值班信息 String REGIONAL_DUTY_INFO = "regionalDutyInfo"; @@ -57,6 +59,8 @@ public interface MainConstants { // 区域月报 String AREA_MONTH_REPORT = "areaMonthReport"; + String WIND_AREA_MONTH_REPORT = "windAreaMonthReport"; + String ENERGY_AREA_MONTH_REPORT = "energyAreaMonthReport"; // 站点数据统计 String STATION_DATA_COUNT = "stationDataCount"; diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/StorageMapper.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/StorageMapper.java new file mode 100644 index 0000000..57b5d21 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/StorageMapper.java @@ -0,0 +1,14 @@ +package com.hnac.hzims.scheduled.mapper.operation; + +import com.hnac.hzims.operational.fill.entity.StorageEntity; +import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; + +/** + * @author ysj + * @date 2023/03/09 16:12:22 + * @version 4.0.0 + */ +public interface StorageMapper extends UserDataScopeBaseMapper { + + +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/WindMapper.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/WindMapper.java new file mode 100644 index 0000000..87a8aac --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/WindMapper.java @@ -0,0 +1,11 @@ +package com.hnac.hzims.scheduled.mapper.operation; + +import com.hnac.hzims.operational.fill.entity.WindEntity; +import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; + +/** + * @author ysj + */ +public interface WindMapper extends UserDataScopeBaseMapper { + +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/RealTargetScheduledTask.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/RealTargetScheduledTask.java index 878486f..75b7745 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/RealTargetScheduledTask.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/RealTargetScheduledTask.java @@ -8,12 +8,12 @@ import lombok.extern.slf4j.Slf4j; import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.Func; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; import java.util.Arrays; import java.util.Date; -import static com.hnac.hzims.fdp.constants.ScheduledConstant.LOAD_EM_INFO; import static com.hnac.hzims.operational.main.constant.MainConstants.*; @@ -33,9 +33,9 @@ public class RealTargetScheduledTask { * @return * @throws Exception */ - @XxlJob(LOAD_EM_INFO) - //@Scheduled(cron = "0/40 * * * * ? ") - public ReturnT loadEmInfo(String param) { +// @XxlJob(LOAD_EM_INFO) +// @Scheduled(cron = "0/40 * * * * ? ") + public ReturnT loadEmInfo() { service.loadEmInfo(); return new ReturnT<>("SUCCESS"); } @@ -128,12 +128,26 @@ public class RealTargetScheduledTask { /** * 获取站点近3年发电量数据 */ - @XxlJob(ELECTRICITY_GENERATION_RECENT_YEAR) - public ReturnT loadPowerData(String param) { - if (Func.isBlank(param)) { - param = DateUtil.format(new Date(), "yyyy-MM"); - } - service.loadPowerData(param, Arrays.asList(HomePageConstant.HYDROPOWER,HomePageConstant.PHOTOVOLTAIC),2,3); +// @XxlJob(ELECTRICITY_GENERATION_RECENT_YEAR) + @Scheduled(cron = "0/40 * * * * ? ") + public ReturnT loadPowerData() { +// if (Func.isBlank(param)) { +// param = DateUtil.format(new Date(), "yyyy-MM"); +// } + service.loadPowerData("", Arrays.asList(HomePageConstant.HYDROPOWER,HomePageConstant.PHOTOVOLTAIC),2,3); + return new ReturnT<>("SUCCESS"); + } + /** + * 获取風電和儲能站点近3年发电量数据 + */ + private final static String wind_recent_year_power_data = "hzims:operation:wind:power:data"; +// @XxlJob(WIND_POWER_GENERATION_RECENT_YEAR) + @Scheduled(cron = "0/40 * * * * ? ") + public ReturnT loadWindPowerData() { +// if (Func.isBlank(param)) { +// param = DateUtil.format(new Date(), "yyyy-MM"); +// } + service.loadPowerDataByWindEnergy("", Arrays.asList(HomePageConstant.WIND_POWER,HomePageConstant.ENERGY_STORAGE),2,3,wind_recent_year_power_data); return new ReturnT<>("SUCCESS"); } } \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/ReportScheduledTask.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/ReportScheduledTask.java index 7010e3b..438bfc7 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/ReportScheduledTask.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/ReportScheduledTask.java @@ -1,5 +1,6 @@ package com.hnac.hzims.scheduled.scheduled; +import com.hnac.hzims.operational.main.constant.HomePageConstant; import com.hnac.hzims.scheduled.service.operation.report.ReportService; import com.xxl.job.core.biz.model.ReturnT; import com.xxl.job.core.handler.annotation.XxlJob; @@ -7,11 +8,13 @@ import lombok.extern.slf4j.Slf4j; import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.Func; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; import java.util.Date; -import static com.hnac.hzims.operational.main.constant.MainConstants.AREA_MONTH_REPORT; +import static com.hnac.hzims.operational.main.constant.MainConstants.*; +import static com.hnac.hzims.scheduled.service.operation.report.impl.ReportServiceImpl.wind_recent_year_cache; /** @@ -25,6 +28,11 @@ public class ReportScheduledTask { @Autowired private ReportService service; + + @Value("${hzims.operation.wind.report}") + private String wind_report_month_cache_final; + @Value("${hzims.operation.energy.report}") + private String energy_report_month_cache_final; /** * 首页-生产月报表 * @return ReturnT @@ -37,5 +45,30 @@ public class ReportScheduledTask { service.loadMonthReport(param,1); return new ReturnT<>("SUCCESS"); } + /** + * 首页-生产月报表 + * @return ReturnT + */ + @XxlJob(WIND_AREA_MONTH_REPORT) + public ReturnT loadWindMonthReport(String param) { + if (Func.isBlank(param)) { + param = DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss"); + } + service.loadMonthReportByType(param,1, HomePageConstant.WIND_POWER,wind_recent_year_cache,wind_report_month_cache_final); + return new ReturnT<>("SUCCESS"); + } + /** + * 首页-生产月报表 + * @return ReturnT + */ + @XxlJob(ENERGY_AREA_MONTH_REPORT) + public ReturnT loadEnergyMonthReport(String param) { + if (Func.isBlank(param)) { + param = DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss"); + } + service.loadMonthReportByType(param,1,HomePageConstant.ENERGY_STORAGE,wind_recent_year_cache,energy_report_month_cache_final); + return new ReturnT<>("SUCCESS"); + } + } \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/fill/StorageService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/fill/StorageService.java new file mode 100644 index 0000000..a9d9825 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/fill/StorageService.java @@ -0,0 +1,20 @@ +package com.hnac.hzims.scheduled.service.operation.fill; + +import com.hnac.hzims.operational.fill.entity.StorageEntity; +import com.hnac.hzims.operational.main.vo.PowerMonthVo; +import org.springblade.core.mp.base.BaseService; + +import java.util.List; + +/** + * @author ysj + * @date 2023/03/09 16:12:22 + * @version 4.0.0 + */ + +/** + * 接入电站历史发电量填报 + */ +public interface StorageService extends BaseService { + List generateThreeYear(String start, String end, Long station); +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/fill/WindService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/fill/WindService.java new file mode 100644 index 0000000..3885df8 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/fill/WindService.java @@ -0,0 +1,15 @@ +package com.hnac.hzims.scheduled.service.operation.fill; + +import com.hnac.hzims.operational.fill.entity.WindEntity; +import com.hnac.hzims.operational.main.vo.PowerMonthVo; +import org.springblade.core.mp.base.BaseService; + +import java.util.List; + +/** + * @author ysj + */ +public interface WindService extends BaseService { + List generateThreeYear(String start, String end, Long station); + +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/fill/impl/StorageServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/fill/impl/StorageServiceImpl.java new file mode 100644 index 0000000..fb5ccf9 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/fill/impl/StorageServiceImpl.java @@ -0,0 +1,51 @@ +package com.hnac.hzims.scheduled.service.operation.fill.impl; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.hnac.hzims.operational.fill.entity.StorageEntity; +import com.hnac.hzims.operational.main.vo.PowerMonthVo; +import com.hnac.hzims.scheduled.mapper.operation.StorageMapper; +import com.hnac.hzims.scheduled.service.operation.fill.StorageService; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springblade.core.tool.utils.CollectionUtil; +import org.springblade.core.tool.utils.DateUtil; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +/** + * @author ysj + * @date 2023/03/09 16:12:22 + * @version 4.0.0 + */ +@Slf4j +@Service +@AllArgsConstructor +public class StorageServiceImpl extends BaseServiceImpl implements StorageService { + + @Override + public List generateThreeYear(String start, String end, Long station) { + List fills = this.list(Wrappers.lambdaQuery() + .between(StorageEntity::getFillDate,start,end) + .eq(StorageEntity::getCreateDept,station) + ); + if(CollectionUtil.isEmpty(fills)){ + return new ArrayList<>(); + + } + return fills.stream().map(fill->{ + PowerMonthVo mon = new PowerMonthVo(); + mon.setStrMonth(DateUtil.format(fill.getFillDate(),DateUtil.PATTERN_DATE)); + if(Math.abs(fill.getPower().intValue()) <= 0){ + mon.setPower(0f); + }else{ + mon.setPower(Float.parseFloat(fill.getPower().toString())); + } + return mon; + }).collect(Collectors.toList()); + } + +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/fill/impl/WindServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/fill/impl/WindServiceImpl.java new file mode 100644 index 0000000..2a82ea5 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/fill/impl/WindServiceImpl.java @@ -0,0 +1,52 @@ +package com.hnac.hzims.scheduled.service.operation.fill.impl; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.hnac.hzims.operational.fill.entity.WindEntity; +import com.hnac.hzims.operational.main.vo.PowerMonthVo; +import com.hnac.hzims.scheduled.mapper.operation.WindMapper; +import com.hnac.hzims.scheduled.service.operation.fill.WindService; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springblade.core.tool.utils.CollectionUtil; +import org.springblade.core.tool.utils.DateUtil; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +/** + * @author ysj + * @date 2023/04/10 11:16:07 + * @version 4.0.0 + */ +@Slf4j +@Service +@AllArgsConstructor +public class WindServiceImpl extends BaseServiceImpl implements WindService { + + + @Override + public List generateThreeYear(String start, String end, Long station) { + List fills = this.list(Wrappers.lambdaQuery() + .between(WindEntity::getFillDate,start,end) + .eq(WindEntity::getCreateDept,station) + ); + if(CollectionUtil.isEmpty(fills)){ + return new ArrayList<>(); + + } + return fills.stream().map(fill->{ + PowerMonthVo mon = new PowerMonthVo(); + mon.setStrMonth(DateUtil.format(DateUtil.parse(fill.getFillDate(),DateUtil.PATTERN_DATE),DateUtil.PATTERN_DATE)); + if(Math.abs(fill.getPower()) <= 0){ + mon.setPower(0f); + }else{ + mon.setPower(Float.parseFloat(fill.getPower().toString())); + } + return mon; + }).collect(Collectors.toList()); + } + +} \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/RealTargetService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/RealTargetService.java index a675773..8d6f2d7 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/RealTargetService.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/RealTargetService.java @@ -34,4 +34,5 @@ public interface RealTargetService { // 光伏、水电站近3年发电量 void loadPowerData(String param, List types, Integer serveType, int year); + void loadPowerDataByWindEnergy(String param, List types, Integer serveType, int year,String key); } diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java index e9e9d73..d8ec750 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java @@ -14,18 +14,15 @@ import com.hnac.hzims.operational.station.entity.HzimsAnalyzeModelStationEntity; import com.hnac.hzims.operational.station.entity.StationEntity; import com.hnac.hzims.scheduled.service.equipment.DeviceParamService; import com.hnac.hzims.scheduled.service.equipment.DeviceService; +import com.hnac.hzims.scheduled.service.operation.fill.*; import com.hnac.hzims.scheduled.service.operation.home.ModelStationService; import com.hnac.hzims.scheduled.service.operation.home.RealTargetService; -import com.hnac.hzims.scheduled.service.operation.fill.GenerateService; -import com.hnac.hzims.scheduled.service.operation.fill.PowerService; -import com.hnac.hzims.scheduled.service.operation.fill.UseService; +import com.hnac.hzims.scheduled.service.operation.plate.DataService; import com.hnac.hzims.scheduled.service.operation.station.StationAttributeService; import com.hnac.hzims.scheduled.service.operation.station.StationService; -import com.hnac.hzims.scheduled.service.operation.plate.DataService; import com.hnac.hzinfo.datasearch.PointData; import com.hnac.hzinfo.datasearch.analyse.IAnalyseDataSearchClient; import com.hnac.hzinfo.datasearch.analyse.domain.FieldsData; -import com.hnac.hzinfo.datasearch.analyse.po.AnalyseCodeByAnalyseDataPO; import com.hnac.hzinfo.datasearch.analyse.vo.AnalyseDataTaosVO; import com.hnac.hzinfo.datasearch.analyse.vo.AnalyzeCodeBySignagesVO; import com.hnac.hzinfo.datasearch.history.IHistoryDataSearchClient; @@ -80,6 +77,8 @@ public class RealTargetServiceImpl implements RealTargetService { private final ModelStationService modelStationService; private final RedisTemplate redisTemplate; + private final WindService windService; + private final StorageService storageService; private final IHistoryDataSearchClient historyDataSearchClient; @@ -1111,7 +1110,50 @@ public class RealTargetServiceImpl implements RealTargetService { redisTemplate.opsForValue().set(recent_year_power_data, powerMap); } - + /** + * 近年发电量数据 + * + * @param param 时间 + * @param serveType 站点类型 + * @param year 近几年 + */ + @Override + public void loadPowerDataByWindEnergy(String param, List types, Integer serveType, int year,String key) { + // 站点查询 + List stationList = stationService.list(new LambdaQueryWrapper() {{ + if (ObjectUtil.isNotEmpty(serveType)) { + eq(StationEntity::getServeType, serveType); + } + if (CollectionUtil.isNotEmpty(types)) { + in(StationEntity::getType, types); + } + }}); + // 设备信息 +// List devices = JSONObject.parseObject(redisTemplate.opsForValue().get(device_cache_cofig_final).toString(), new TypeReference>() { +// }); + // 开始时间 + Calendar calendar = Calendar.getInstance(); + calendar.add(Calendar.MONTH, -calendar.get(Calendar.MONTH) + 12); + calendar.add(Calendar.DATE, -calendar.get(Calendar.DATE) + 1); + String end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE) + " 00:00:00"; + // 结束日期 + calendar.set(Calendar.YEAR, calendar.get(Calendar.YEAR) - year); + calendar.add(Calendar.MONTH, -calendar.get(Calendar.MONTH)); + String start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE) + " 00:00:00"; + // 存储数据map :<站点id,<月份,发电量>> + Map> powerMap = new HashMap<>(); + stationList.forEach(station -> { + // 站点设备集合 +// List stationDevices = devices.stream().filter(device -> device.getCreateDept().equals(station.getRefDept())).collect(Collectors.toList()); +// log.error("load_power_data station :" + station.getCode() + "==== device :" + stationDevices ); + Map generateMap = this.getGenerateYearByWindEnergy(station,start,end); + if(MapUtils.isEmpty(generateMap)){ + return; + } + powerMap.put(station.getId(),generateMap); + }); + redisTemplate.opsForValue().set(key, powerMap); + } /** * 当天有功功率 * @param device @@ -1165,7 +1207,21 @@ public class RealTargetServiceImpl implements RealTargetService { } return datas.stream().collect(Collectors.toMap(PowerMonthVo::getStrMonth, PowerMonthVo::getPower, Float::sum)); } - + /** + * 获取风电或者储能的年发电量 + * @param start + * @param end + * @return + */ + private Map getGenerateYearByWindEnergy(StationEntity station, String start, String end) { + List datas = new ArrayList<>(); + // 补充填报数据 + datas.addAll(this.generateFill(station,start,end)); + if(CollectionUtil.isEmpty(datas)){ + return null; + } + return datas.stream().collect(Collectors.toMap(PowerMonthVo::getStrMonth, PowerMonthVo::getPower, Float::sum)); + } /** * 获取填报用电量 @@ -1207,6 +1263,12 @@ public class RealTargetServiceImpl implements RealTargetService { if(HomePageConstant.PHOTOVOLTAIC.equals(station.getType())){ return powerService.generateThreeYear(start,end,station.getRefDept()); } + if(HomePageConstant.WIND_POWER.equals(station.getType())){ + return windService.generateThreeYear(start,end,station.getRefDept()); + } + if(HomePageConstant.ENERGY_STORAGE.equals(station.getType())){ + return storageService.generateThreeYear(start,end,station.getRefDept()); + } // 水电 return generateService.generateThreeYear(start,end,station.getCode()); } diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/report/ReportService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/report/ReportService.java index 2612f12..24b3bd0 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/report/ReportService.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/report/ReportService.java @@ -6,4 +6,5 @@ package com.hnac.hzims.scheduled.service.operation.report; public interface ReportService { void loadMonthReport(String param, int i); + void loadMonthReportByType(String param, int year,Integer type,String key,String saveKey); } \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/report/impl/ReportServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/report/impl/ReportServiceImpl.java index 59e3839..c38748b 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/report/impl/ReportServiceImpl.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/report/impl/ReportServiceImpl.java @@ -72,6 +72,7 @@ public class ReportServiceImpl implements ReportService { private final static String recent_year_cache_final = "hzims:operation:key:power:data"; + public final static String wind_recent_year_cache = "hzims:operation:wind:power:data"; @Value("${hzims.operation.area.report}") private String report_month_cache_final; @@ -115,6 +116,44 @@ public class ReportServiceImpl implements ReportService { } /** + * 区域-月报-风电/储能/水利 + * @param param + * @param year + */ + @Override + public void loadMonthReportByType(String param, int year,Integer type,String key,String saveKey) { + // 获取所有机构 + R> R = sysClient.getDeptList(); + if (!R.isSuccess() || CollectionUtil.isEmpty(R.getData())) { + return; + } + // 查询所有服务类型——"运维服务"、站点类型——"水电站" + List stations = stationService.list(Wrappers.lambdaQuery() + .eq(StationEntity::getServeType,HomePageConstant.HYDROPOWER_SERVETYPE) + .eq(StationEntity::getType,type) + ); + if (CollectionUtil.isEmpty(stations)) { + return; + } + // 站点近年发电数据 + Map> powerMap = (Map>) redisTemplate.opsForValue().get(key); + // 存储数据节点 key - 月份 value - 区域数据集合 + Map> map = new HashMap<>(); + // 月份集合 + List monthList = getMonthList(year, Calendar.getInstance().get(Calendar.MONTH)); + monthList.forEach(mon -> { + List list = this.getAreaReportByMon(R.getData(), powerMap, stations, mon); + if (CollectionUtil.isEmpty(list)) { + return; + } + map.put(mon, list); + }); + // 推送当月报表邮件 + this.sendMonthReport(map, R.getData()); + redisTemplate.opsForValue().set(report_month_cache_final, map); + } + + /** * 获取近年月份集合 * * @param year diff --git a/hzims-service/hzims-scheduled/src/main/resources/mapper/operation/StorageMapper.xml b/hzims-service/hzims-scheduled/src/main/resources/mapper/operation/StorageMapper.xml new file mode 100644 index 0000000..d3a9441 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/resources/mapper/operation/StorageMapper.xml @@ -0,0 +1,4 @@ + + + + diff --git a/hzims-service/hzims-scheduled/src/main/resources/mapper/operation/WindMapper.xml b/hzims-service/hzims-scheduled/src/main/resources/mapper/operation/WindMapper.xml new file mode 100644 index 0000000..61392dc --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/resources/mapper/operation/WindMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/controller/GenerateController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/controller/GenerateController.java index 999e9bf..4a56847 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/controller/GenerateController.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/controller/GenerateController.java @@ -20,6 +20,8 @@ import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.Func; import org.springframework.web.bind.annotation.*; +import java.util.List; + /** * @author ysj @@ -43,6 +45,15 @@ public class GenerateController extends BladeController { public R saveOrUpdate(@RequestBody GenerateEntity entity) { return R.status(service.saveUpdate(entity)); } + /** + * 新增 + */ + @PostMapping("/saveOrUpdateList") + @ApiOperationSupport(order = 1) + @ApiOperation(value = "新增", notes = "传入InsertPowerEntity对象") + public R saveOrUpdateList(@RequestBody List entity) { + return service.saveUpdateList(entity); + } /** * 删除 diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/GenerateService.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/GenerateService.java index 29bb8aa..dc7e967 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/GenerateService.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/GenerateService.java @@ -2,19 +2,15 @@ package com.hnac.hzims.operational.fill.service; import com.baomidou.mybatisplus.core.metadata.IPage; import com.hnac.hzims.operational.fill.entity.GenerateEntity; -import com.hnac.hzims.operational.fill.entity.RainfallEntity; import com.hnac.hzims.operational.fill.vo.GenerateVo; import com.hnac.hzims.operational.fill.vo.QueryVo; -import com.hnac.hzims.operational.fill.vo.RainfallVo; import com.hnac.hzims.operational.main.vo.GenerationPowerVo; import com.hnac.hzims.operational.main.vo.PowerMonthVo; -import com.hnac.hzims.operational.main.vo.UsrPowerVo; import org.springblade.core.mp.base.BaseService; import org.springblade.core.mp.support.Query; import org.springblade.core.tool.api.R; import java.util.List; -import java.util.Map; /** * @author ysj @@ -28,7 +24,7 @@ public interface GenerateService extends BaseService { // 新增/修改发电量填报数据 boolean saveUpdate(GenerateEntity entity); - + R saveUpdateList(List entity); // 查询填报用电量 Float generate(String date,String station); diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/impl/GenerateServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/impl/GenerateServiceImpl.java index 0a53e2b..5c7e1d6 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/impl/GenerateServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/impl/GenerateServiceImpl.java @@ -24,6 +24,7 @@ import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.ObjectUtil; import org.springblade.core.tool.utils.StringUtil; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; import java.util.Calendar; @@ -86,7 +87,28 @@ public class GenerateServiceImpl extends BaseServiceImpl entityList) { + //发电量不为空的,保存或者编辑 + List addList = entityList.stream().filter(s -> ObjectUtil.isNotEmpty(s.getGenerate())).collect(Collectors.toList()); + boolean saveFlag = this.saveOrUpdateBatch(addList); + //发电量为空的,且有ID的为删除 + List ids = entityList.stream(). + filter(s -> ObjectUtil.isEmpty(s.getGenerate())) + .filter(s -> ObjectUtil.isNotEmpty(s.getId())) + .map(GenerateEntity::getId).collect(Collectors.toList()); + boolean deleteFlag =true; + if (CollectionUtil.isNotEmpty(ids)){ + deleteFlag= this.deleteLogic(ids); + } + if (saveFlag&&deleteFlag){ + return R.success("保存成功"); + }else { + return R.fail("保存失败"); + } + } /** * 根据时间、机构查询用电量 * @param date 时间: 年 - yyyy/月 yyyy-mm/日 yyyy-mm-dd diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/AreaMonthReportController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/AreaMonthReportController.java index 7720bc9..707307f 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/AreaMonthReportController.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/AreaMonthReportController.java @@ -20,6 +20,7 @@ import org.springblade.core.log.annotation.ApiLog; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.Func; +import org.springblade.core.tool.utils.ObjectUtil; import org.springblade.system.feign.ISysClient; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; @@ -54,7 +55,14 @@ public class AreaMonthReportController extends BladeController { service.loadMonthReport(DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss"), 1); return R.success("success"); } - + @ApiLog + @ApiOperationSupport(order = 1) + @ApiOperation("生成区域月报") + @GetMapping("/loadMonthReportByType") + public R loadMonthReportByType(int type) { + service.loadMonthReportByType(DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss"), 1,type); + return R.success("success"); + } @ApiLog @ApiOperationSupport(order = 2) @ApiOperation("获取区域月报") @@ -66,7 +74,30 @@ public class AreaMonthReportController extends BladeController { public R> getAreaMonthReport(@ApiParam(value = "日期-年月", required = true) String date) { return service.getReport(date); } - + @ApiLog + @ApiOperationSupport(order = 2) + @ApiOperation("获取区域月报") + @GetMapping("/getAreaMonthReportByType") + @OperationAnnotation( + moduleName = "生产月报", + title = "水电生产运行月报", operatorType = OperatorType.MOBILE, businessType = BusinessType.GENCODE, + action = "获取区域月报") + public R> getAreaMonthReportByType(@ApiParam(value = "日期-年月", required = true) String date,Integer type) { + if (ObjectUtil.isEmpty(type)){ + type=0; + } + return service.getReportByType(date,type); + } + @ApiLog + @ApiOperationSupport(order = 3) + @ApiOperation("导出区域月报") + @GetMapping("/exportAreaMonthReportByType") + public R exportAreaMonthReportByType(HttpServletResponse response, @ApiParam(value = "日期-年月", required = true) String date,Integer type) { + if (ObjectUtil.isEmpty(type)){ + type=0; + } + return service.exportByType(response, date,type); + } @ApiLog @ApiOperationSupport(order = 3) @ApiOperation("导出区域月报") diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/IAreaMonthReportService.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/IAreaMonthReportService.java index 14a7882..dfb672c 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/IAreaMonthReportService.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/IAreaMonthReportService.java @@ -13,10 +13,15 @@ import java.util.List; public interface IAreaMonthReportService { void loadMonthReport(String param,int year); + void loadMonthReportByType(String param,int year,int type); R> getReport(String date); R export(HttpServletResponse response, String date); R exportHydropowerStationMonthReport(HttpServletResponse response, HashMap map, Integer year, Integer month,Long deptId,String name); + + R> getReportByType(String date, Integer type); + + R exportByType(HttpServletResponse response, String date, Integer type); } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AreaMonthReportServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AreaMonthReportServiceImpl.java index baa6714..143b7d8 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AreaMonthReportServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AreaMonthReportServiceImpl.java @@ -121,7 +121,10 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService { @Value("${hzims.operation.area.report}") private String area_month_report_key; - + @Value("${hzims.operation.wind.report}") + private String wind_report_month_cache_final; + @Value("${hzims.operation.energy.report}") + private String energy_report_month_cache_final; private final static String RECENT_YEAR_POWER_DATA = "hzims:operation:key:power:data"; private final static String load_hydropower_unit_real_key = "hzims:operation:loadhydropowerunit:real:key"; private final static String load_hydropower_unit_target_key = "hzims:operation:loadhydropowerunit:target:key"; @@ -153,7 +156,61 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService { //根据用户权限获取机构 return R.data(areaMonthReportVoList.stream().sorted(Comparator.comparing(AreaMonthReportVo::getActualPower, Comparator.reverseOrder())).collect(Collectors.toList())); } + @Override + public R> getReportByType(String date, Integer type){ + List areaMonthReportVoList = this.getAreaMonthReportByType(date, false,type); + if (CollectionUtil.isEmpty(areaMonthReportVoList)) { + return R.fail("选择月份无统计报表数据"); + } + //根据用户权限获取机构 + return R.data(areaMonthReportVoList.stream().sorted(Comparator.comparing(AreaMonthReportVo::getActualPower, Comparator.reverseOrder())).collect(Collectors.toList())); + } + /** + * 导出区域月报 + * + * @param response + * @param date + */ + @Override + public R exportByType(HttpServletResponse response, String date, Integer type) { + List monthReportVoList = this.getAreaMonthReportByType(date, true,type); + // 创建Excel文件 + HSSFWorkbook hssWB = new HSSFWorkbook(); + // 添加sheet页 + HSSFSheet sheet = hssWB.createSheet("运行月报(" + date + ")"); + // 行高 + sheet.setDefaultRowHeight((short) (20 * 25)); + // 列宽 + sheet.setDefaultColumnWidth(20); + this.setFirstHeader(hssWB, sheet); + // 第二行/三行 表头格式设置 + this.setWorkHeader(hssWB, sheet); + if (!CollectionUtil.isEmpty(monthReportVoList)) { + // 数据填充 + this.setWorkData(hssWB, sheet, monthReportVoList); + } + // 下载导出 + String filename = "(" + date + ")水电站生产运行月报"; + // 设置头信息 + response.setCharacterEncoding("UTF-8"); + response.setContentType("application/vnd.ms-excel"); + ServletOutputStream outputStream; + try { + //设置xlsx格式 + response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(filename + ".xlsx", "UTF-8")); + //创建一个输出流 + outputStream = response.getOutputStream(); + //写入数据 + hssWB.write(outputStream); + // 关闭 + outputStream.close(); + hssWB.close(); + } catch (IOException e) { + e.printStackTrace(); + } + return R.data("success"); + } /** * 导出区域月报 * @@ -1103,6 +1160,37 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService { /** + * 获取区域月报数据 + * + * @return + */ + private List getAreaMonthReportByType(String date, boolean isSendFlag,Integer type) { + R> D = sysClient.getDeptByCurrentUser(); + if (!D.isSuccess() || CollectionUtil.isEmpty(D.getData())) { + return null; + } + List authList = D.getData().stream().filter(o -> o.getDeptCategory().equals(3)).map(Dept::getId).collect(Collectors.toList()); + if (CollectionUtil.isEmpty(authList)) { + return null; + } + String key = area_month_report_key; + if (type.equals(HomePageConstant.WIND_POWER)){ + key= wind_report_month_cache_final; + } + if (type.equals(HomePageConstant.ENERGY_STORAGE)){ + key= energy_report_month_cache_final; + } + Map> map = (Map>) redisTemplate.opsForValue().get(key); + if (MapUtils.isEmpty(map)) { + return null; + } + if (isSendFlag) { + // 发送邮件 + this.sendMonthReport(map, D.getData()); + } + return map.get(date); + } + /** * 区域-加载月报数据 * * @param param @@ -1133,10 +1221,53 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService { map.put(mon, list); }); // 推送当月报表邮件 - this.sendMonthReport(map, R.getData()); +// this.sendMonthReport(map, R.getData()); redisTemplate.opsForValue().set(area_month_report_key, map); } - + /** + * 区域-加载月报数据 + * + * @param param + */ + @Override + public void loadMonthReportByType(String param, int year,int type) { + // 获取所有机构 + R> R = sysClient.getDeptList(); + if (!R.isSuccess() || CollectionUtil.isEmpty(R.getData())) { + return; + } + if (ObjectUtil.isEmpty(type)){ + type=HomePageConstant.HYDROPOWER; + } + String saveKey=area_month_report_key; + if (type==HomePageConstant.WIND_POWER){ + saveKey=wind_report_month_cache_final; + } + if (type==HomePageConstant.ENERGY_STORAGE){ + saveKey=energy_report_month_cache_final; + } + // 查询所有服务类型——"运维服务"、站点类型——"水电站" + List stationList = stationService.getStationType(HomePageConstant.HYDROPOWER_SERVETYPE, Collections.singletonList(type), null,true); + if (CollectionUtil.isEmpty(stationList)) { + return; + } + // 站点近年发电数据 + Map> powerMap = (Map>) redisTemplate.opsForValue().get(RECENT_YEAR_POWER_DATA); + // 存储数据节点 key - 月份 value - 区域数据集合 + Map> map = new HashMap<>(); + // 月份集合 + List monthList = getMonthList(year, Calendar.getInstance().get(Calendar.MONTH)); + monthList.forEach(mon -> { + List list = this.getAreaReportByMon(R.getData(), powerMap, stationList, mon); + if (CollectionUtil.isEmpty(list)) { + return; + } + map.put(mon, list); + }); + // 推送当月报表邮件 +// this.sendMonthReport(map, R.getData()); + redisTemplate.opsForValue().set(saveKey, map); + } /** * 获取近年月份集合 * From ee8bb5a4de974c53aef8a37d49b6ee32b3c8e3a1 Mon Sep 17 00:00:00 2001 From: tyty Date: Tue, 14 Nov 2023 19:03:54 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E5=8F=91=E7=94=B5=E9=87=8F=E5=A1=AB?= =?UTF-8?q?=E6=8A=A5=E5=88=A0=E9=99=A4=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hzims/operational/fill/service/impl/GenerateServiceImpl.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/impl/GenerateServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/impl/GenerateServiceImpl.java index 5c7e1d6..80db3af 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/impl/GenerateServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/impl/GenerateServiceImpl.java @@ -78,6 +78,11 @@ public class GenerateServiceImpl extends BaseServiceImpl(){{ eq(GenerateEntity::getStationCode, entity.getStationCode()); eq(GenerateEntity::getFillDate,entity.getFillDate()); + eq(GenerateEntity::getIsDeleted,0); + if (ObjectUtil.isNotEmpty(entity.getId())){ + eq(GenerateEntity::getFillDate,entity.getFillDate()); + } + last("limit 1"); }}); if(ObjectUtil.isNotEmpty(history) && (ObjectUtil.isEmpty(entity.getId()) || !entity.getId().equals(history.getId()))){ throw new ServiceException("日期已经存在填报数据!"); From 3aade6f344a839bddab7fe805bd7e57ccbb0eade Mon Sep 17 00:00:00 2001 From: tyty Date: Wed, 15 Nov 2023 09:30:45 +0800 Subject: [PATCH 5/7] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=97=A5=E5=B8=B8?= =?UTF-8?q?=E7=BB=B4=E6=8A=A4=E8=AE=A1=E5=88=92=E6=89=80=E5=B1=9E=E7=AB=99?= =?UTF-8?q?=E7=82=B9=E7=AD=9B=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/OperMaintenanceTaskServiceImpl.java | 4 +- .../resources/files/消缺处理流程.bpmn20.xml | 85 +++++++++++++++ .../files/隐患排查治理流程.bpmn20.xml | 118 +++++++++++++++++++++ 3 files changed, 206 insertions(+), 1 deletion(-) create mode 100644 hzims-service/operational/src/main/resources/files/消缺处理流程.bpmn20.xml create mode 100644 hzims-service/operational/src/main/resources/files/隐患排查治理流程.bpmn20.xml diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/OperMaintenanceTaskServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/OperMaintenanceTaskServiceImpl.java index 3f8609a..a4bd954 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/OperMaintenanceTaskServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/OperMaintenanceTaskServiceImpl.java @@ -145,7 +145,9 @@ public class OperMaintenanceTaskServiceImpl extends BaseServiceImpl + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/hzims-service/operational/src/main/resources/files/隐患排查治理流程.bpmn20.xml b/hzims-service/operational/src/main/resources/files/隐患排查治理流程.bpmn20.xml new file mode 100644 index 0000000..1c94a40 --- /dev/null +++ b/hzims-service/operational/src/main/resources/files/隐患排查治理流程.bpmn20.xml @@ -0,0 +1,118 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From c7df48365b41c1feee4cd8051df33ad3a686a344 Mon Sep 17 00:00:00 2001 From: tyty Date: Wed, 15 Nov 2023 10:30:38 +0800 Subject: [PATCH 6/7] =?UTF-8?q?=E7=BC=BA=E9=99=B7=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E7=BC=96=E7=A0=81=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hzims/operational/defect/service/impl/DefectCheckServiceImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/DefectCheckServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/DefectCheckServiceImpl.java index 5114ee1..a5552e5 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/DefectCheckServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/DefectCheckServiceImpl.java @@ -135,12 +135,12 @@ public class DefectCheckServiceImpl extends BaseServiceImpl stationR = stationClient.getOne(station); + R stationR = stationClient.getStationByCodeOrRedDept(station); Assert.isTrue(stationR.isSuccess() && ObjectUtil.isNotEmpty(stationR.getData()) && Func.isNotEmpty(stationR.getData().getSignage()), () -> { throw new ServiceException("该工作票站点下未获取到两票抬头!"); }); From 6fdfe4b64957044b0916c8ad09ba88ff0c5d8241 Mon Sep 17 00:00:00 2001 From: tyty Date: Wed, 15 Nov 2023 11:24:33 +0800 Subject: [PATCH 7/7] =?UTF-8?q?=E7=BC=BA=E9=99=B7=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E7=BC=96=E7=A0=81=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../operational/defect/service/impl/DefectCheckServiceImpl.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/DefectCheckServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/DefectCheckServiceImpl.java index a5552e5..70fc27f 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/DefectCheckServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/DefectCheckServiceImpl.java @@ -79,7 +79,7 @@ public class DefectCheckServiceImpl extends BaseServiceImpl ticketList = this.list( - Wrappers.lambdaQuery().eq(OperPhenomenonEntity::getCreateDept, entity.getCreateDept()) + Wrappers.lambdaQuery().eq(OperPhenomenonEntity::getCreateDept, deptId) .ge(OperPhenomenonEntity::getCreateTime, firstDay).le(OperPhenomenonEntity::getCreateTime, lastDay) ); String suffix = String.format(String.format("%03d", ticketList.size() + 1)); String result = stationR.getData().getSignage() + yearMonth + suffix; // 缺陷编码 : 按项目+年+月+序号 - if (Func.isEmpty(result)) { + if (Func.isNotEmpty(result)) { entity.setDefectCode(result); } // 现象发起人 : 当前用户Id