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..269580c --- /dev/null +++ b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/emParam/entity/ParamBackupsDetailEntity.java @@ -0,0 +1,60 @@ +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; + + @ApiModelProperty("保留小数位") + private Integer keepFigures; + + @ApiModelProperty("描述") + private String descs; + +} 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..8f76c9c --- /dev/null +++ b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/emParam/vo/ParamVO.java @@ -0,0 +1,70 @@ +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; + + @ApiModelProperty("保留小数位") + private Integer keepFigures; + + @ApiModelProperty("描述") + private String descs; + +} 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..6263434 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 @@ -13,10 +13,12 @@ import lombok.Data; import lombok.EqualsAndHashCode; import org.hibernate.validator.constraints.Range; import org.springblade.core.tenant.mp.TenantEntity; +import org.springblade.core.tool.utils.DateUtil; 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 +193,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 +251,12 @@ public class EmInfoEntity extends TenantEntity { @TableField(exist = false) private List infoChildren; + @ApiModelProperty("最后下发时间") + @DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME) + @JsonFormat(pattern = DateUtil.PATTERN_DATETIME) + private LocalDateTime lastDistributeTime; + + @ApiModelProperty("机组类别") + private String setCategory; + } diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/AppHydropowerStationVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/AppHydropowerStationVo.java index 234b0c4..b382278 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/AppHydropowerStationVo.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/AppHydropowerStationVo.java @@ -2,7 +2,6 @@ package com.hnac.hzims.operational.main.vo; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.ser.std.NullSerializer; -import com.hnac.hzims.hzimsweather.response.weather.Daily; import com.hnac.hzinfo.datasearch.soe.domian.SoeData; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; 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..bf8dc05 --- /dev/null +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/emParam/service/impl/ParamServiceImpl.java @@ -0,0 +1,175 @@ +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.*; +import org.springframework.stereotype.Service; +import org.springframework.util.Assert; + +import java.math.BigDecimal; +import java.math.RoundingMode; +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(); + // 获取设备物模型中是参数的属性 + R> paramDeviceAttrR = deviceClient.getOnlineAttr(emCode); + Assert.isTrue(paramDeviceAttrR.isSuccess() && CollectionUtil.isNotEmpty(paramDeviceAttrR.getData()),() -> { + throw new ServiceException("获取设备实例物模型属性失败!"); + }); + // 获取实时数据 + List signageList = paramDeviceAttrR.getData().stream() + .filter(o->StringUtil.isNotBlank(o.getSignage()) && StringUtil.isNotBlank(o.getFacDeviceAttrId())) + .map(DeviceInstanceAttrVO::getSignage).collect(Collectors.toList()); + Result realDataR = deviceDataClient.getDeviceRealDataByCode(emCode, signageList); + Assert.isTrue(realDataR.isSuccess(),() -> { + throw new ServiceException("参数召回获取实时数据失败"); + }); + Map> paramGroupVOListMap = paramDeviceAttrR.getData().stream() + .filter(o->StringUtil.isNotBlank(o.getFacDeviceAttrId()) && o.getIsParam() == 1) + .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"))) { + String value = JSONObject.parseObject(realData).getString("v"); + if(StringUtil.isNotBlank(p.getDbType()) && "double".equals(p.getDbType()) + && StringUtil.isNotBlank(value) && ObjectUtil.isNotEmpty(p.getKeepFigures())) { + value = String.valueOf(new BigDecimal(value).setScale(p.getKeepFigures(), RoundingMode.HALF_UP).doubleValue()); + } + p.setValue(value); + } + }); + 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..1f41725 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,50 @@ -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; + +alter table `HZIMS_PARAM_BACKUPS_DETAIL` add COLUMN `KEEP_FIGURES` INT(11) COMMENT '小数点位数'; +alter table `HZIMS_PARAM_BACKUPS_DETAIL` add COLUMN `DESCS` VARCHAR(255) COMMENT '描述'; 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/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyRecServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyRecServiceImpl.java index dff57e9..f0e3942 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyRecServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyRecServiceImpl.java @@ -253,7 +253,7 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl() {{ eq(ImsDutyGroupPEntity::getGroupId, groupEntity.getId()); @@ -425,10 +425,10 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl execute(String param) throws Exception { + Date startDate = StringUtil.isNotBlank(param) ? DateUtil.parse(param, DateUtil.PATTERN_DATE) : DateUtil.parse(DateUtil.formatDate(DateUtil.now()), DateUtil.PATTERN_DATE); + Date endDate = DateUtil.parse(DateUtil.formatDate(DateUtil.plusDays(startDate, 1)), DateUtil.PATTERN_DATE); + LambdaQueryWrapper planQW = Wrappers.lambdaQuery().isNull(OperMaintenancePlanEntity::getCreateTaskTime) + .gt(OperMaintenancePlanEntity::getDisposeTime, startDate).le(OperMaintenancePlanEntity::getDisposeTime, endDate); + List planList = planService.list(planQW); + XxlJobLogger.log("日常维护任务生成开始!计划ID为:"+planList.stream().map(OperMaintenancePlanEntity::getId).map(String::valueOf).collect(Collectors.joining(","))); + //分页插入日常维护计划 + planList.forEach(this::generateTaskByPlan); + XxlJobLogger.log("日常维护任务生成完成!"); + return new ReturnT<>("SUCCESS"); + } + + /** + * 根据日常维护计划生成日常维护任务 + * @param plan 日常维护计划 + */ + private void generateTaskByPlan(OperMaintenancePlanEntity plan) { + try { + OperMaintenanceTaskEntity taskEntity = BeanUtil.copy(plan,OperMaintenanceTaskEntity.class); + taskEntity.setPlanId(plan.getId()); + taskEntity.setDisposer(Optional.ofNullable(plan.getDisposer()).map(String::valueOf).orElse(null)); + LocalDateTime disposeTime = taskEntity.getDisposeTime().toInstant() + .atZone(ZoneId.systemDefault()).toLocalDateTime(); + taskEntity.setPlanEndTime(disposeTime.plusHours(taskEntity.getHours())); + + + + if(StringUtil.isNotBlank(plan.getEmCode())){ + List emCodeList = Arrays.asList(plan.getEmCode().split(",")); + for(String emCode : emCodeList){ + taskEntity.setEmCode(emCode); + this.createTask(taskEntity); + } + } + else { + this.createTask(taskEntity); + } + } + catch(Exception e) { + logger.error("MaintenanceTaskSchedule:generateTaskByPlan",e.getLocalizedMessage()); + XxlJobLogger.log(plan.getId()+"计划创建任务失败"); + // 查询到日常维护计划所创建的任务 + List maintenanceTasks = taskService.list(Wrappers.lambdaQuery().eq(OperMaintenanceTaskEntity::getPlanId, plan.getId())); + for (OperMaintenanceTaskEntity maintenanceTask : maintenanceTasks) { + if(Func.isNotEmpty(maintenanceTask.getProcessInstanceId())) { + flowClient.delProcessInstanceById(maintenanceTask.getProcessInstanceId(),"错误流程"); + taskService.removeById(maintenanceTask.getId()); + } + } + } + } + + /** + * 创建日常维护任务以及生成工作流 + * @param task 日常维护任务 + */ + private void createTask(OperMaintenanceTaskEntity task) { + task.setId(null); + task.setCreateTime(new Date()); + task.setUpdateTime(new Date()); + task.setTaskCode(UUID.randomUUID().toString()); +// if (ObjectUtil.isNotEmpty(task.getMaintenanceModel()) && finalPlanEntity.getMaintenanceModel() == 2) { +// //查询值班信息 +// LambdaQueryWrapper entityLambdaQueryWrapper = new LambdaQueryWrapper<>(); +// entityLambdaQueryWrapper.eq(ImsDutyMainEntity::getDutyDate, DateTimeFormatter.ofPattern(PATTERN_DATE).format(disposeTime)); +// entityLambdaQueryWrapper.eq(ImsDutyMainEntity::getClassId, finalPlanEntity.getImsDutyClassId()); +// ImsDutyMainEntity entity = mainService.getOne(entityLambdaQueryWrapper); +// if (ObjectUtil.isNotEmpty(entity) && StringUtils.isNotEmpty(entity.getDutyPersonIds())) { +// String userId = entity.getDutyPersonIds(); +// taskEntity.setDisposer(userId.replaceAll("\\^", ",")); +// } else { +// log.info("计划ID为:{}未查询到排班记录", finalPlanEntity.getId()); +// LambdaUpdateWrapper planQueryWrapper = Wrappers.lambdaUpdate() +// .set(OperMaintenancePlanEntity::getCreateTaskTime, new Date()) +// .eq(OperMaintenancePlanEntity::getId, finalPlanEntity.getId()); +// maintenancePlanService.update(planQueryWrapper); +// return; +// } +// } + } + +} diff --git a/hzims-service/ticket/lib/aspose-words-15.8.0-jdk16.jar b/hzims-service/ticket/lib/aspose-words-15.8.0-jdk16.jar new file mode 100644 index 0000000..c0e699f Binary files /dev/null and b/hzims-service/ticket/lib/aspose-words-15.8.0-jdk16.jar differ diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/WorkTicketInfoServiceImpl.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/WorkTicketInfoServiceImpl.java index cbf588a..31117dd 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/WorkTicketInfoServiceImpl.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/WorkTicketInfoServiceImpl.java @@ -251,6 +251,12 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl pages = this.page(Condition.getPage(query), lqw); //数据转换 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