diff --git a/hzims-biz-common/pom.xml b/hzims-biz-common/pom.xml index be7e8e8..de9115d 100644 --- a/hzims-biz-common/pom.xml +++ b/hzims-biz-common/pom.xml @@ -22,6 +22,10 @@ blade-core-auto provided + + org.springblade + blade-common + com.alibaba diff --git a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/vo/FdpFaultRealDataVO.java b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/vo/FdpFaultRealDataVO.java new file mode 100644 index 0000000..af45be3 --- /dev/null +++ b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/vo/FdpFaultRealDataVO.java @@ -0,0 +1,47 @@ +package com.hnac.hzims.fdp.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; +import java.util.List; + +/** + * 模型VO + * + * @author tangyu + * @created 2023-07-03 17:38 + **/ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class FdpFaultRealDataVO { + + private static final long serialVersionUID = 1L; + + /** + * 监测点ID + */ + @ApiModelProperty("监测点ID") + private String monitorId; + + @ApiModelProperty("监测点名称") + private String name; + @ApiModelProperty("位置") + private String ord; + @ApiModelProperty("单代表对应一个实时数据,多代表对应一组实时数据") + private String multi; + @ApiModelProperty("数据的物模型id") + private String instance; + @ApiModelProperty("数据的物模型属性:如果multi是“多”,则包含该字符串起始的所有属性") + private String identifier; + @ApiModelProperty("物模型是否开机:无法获取当作开机处理") + private Boolean powerOn; + + @ApiModelProperty("获取的实时数据如果MULTI是“单”则为数值,MULTI是“多”则为数组") + private List real; + @ApiModelProperty("实时数据时间,如果MULTI是“单”则为数值,MULTI是“多”则为数组") + private List realTime; +} diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/entity/OperDefectEntity.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/entity/OperDefectEntity.java index e681cdd..e2e40e4 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/entity/OperDefectEntity.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/entity/OperDefectEntity.java @@ -122,16 +122,16 @@ public class OperDefectEntity extends TenantEntity { @TableField(exist = false) private YearMonth yearMonth; /** - * 计划处理人 + * 消缺处理人 */ @JsonSerialize(nullsUsing = NullSerializer.class) - @ApiModelProperty(value = "计划处理人") + @ApiModelProperty(value = "消缺处理人") private String planHandler; /** - * 处理人 + * 检修任务处理人 */ @JsonSerialize(nullsUsing = NullSerializer.class) - @ApiModelProperty(value = "处理人") + @ApiModelProperty(value = "检修任务处理人") private Long handler; /** @@ -211,4 +211,26 @@ public class OperDefectEntity extends TenantEntity { @QueryField(condition = SqlCondition.LIKE) @ApiModelProperty(value = "故障名称") private String faultName; + + /** + * 操作票负责人 + */ + @ApiModelProperty("操作票负责人") + private Long principal; + /** + * 手填值班负责人 + */ + @ApiModelProperty(value = "手填操作票负责人") + private String principalManual; + /** + * 操作票 + */ + @ApiModelProperty(value = "操作票") + private String ticketId; + /** + * 处理任务Id + */ + @ApiModelProperty(value = "处理任务Id") + private Long handleTaskId; + } diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/entity/OperDefectStatisticsEntity.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/entity/OperDefectStatisticsEntity.java index 1d10af1..cc38585 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/entity/OperDefectStatisticsEntity.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/entity/OperDefectStatisticsEntity.java @@ -128,11 +128,11 @@ public class OperDefectStatisticsEntity extends TenantEntity { @ApiModelProperty(value = "甄别描述") private String discriminateDesc; /** - * 计划处理人 + * 检修任务处理人 */ @JsonSerialize(nullsUsing = NullSerializer.class) @QueryField(condition = SqlCondition.EQUAL) - @ApiModelProperty(value = "计划处理人") + @ApiModelProperty(value = "检修任务处理人") private Long handler; /** * 计划工时 @@ -233,10 +233,10 @@ public class OperDefectStatisticsEntity extends TenantEntity { @ApiModelProperty(value = "是否为缺陷,0 否,1是") private Integer isDefect; /** - * 计划处理人 + * 消缺处理人 */ @JsonSerialize(nullsUsing = NullSerializer.class) - @ApiModelProperty(value = "计划处理人") + @ApiModelProperty(value = "消缺处理人") private String planHandler; /** diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/entity/OperPhenomenonEntity.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/entity/OperPhenomenonEntity.java index 4a7f135..8fb64ee 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/entity/OperPhenomenonEntity.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/entity/OperPhenomenonEntity.java @@ -211,10 +211,10 @@ public class OperPhenomenonEntity extends TenantEntity { private Long handleTaskId; /** - * 处理人 + * 检修任务处理人 */ @JsonSerialize(nullsUsing = NullSerializer.class) - @ApiModelProperty(value = "处理人") + @ApiModelProperty(value = "检修任务处理人") private Long handler; /** * 处理状态:已处理1,未处理0,默认0 @@ -285,10 +285,10 @@ public class OperPhenomenonEntity extends TenantEntity { @ApiModelProperty(value = "核算工时") private Integer checkHours; /** - * 计划处理人 + * 消缺处理人 */ @JsonSerialize(nullsUsing = NullSerializer.class) - @ApiModelProperty(value = "计划处理人") + @ApiModelProperty(value = "消缺处理人") private String planHandler; /** * 实际开始时间 diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/entity/StationEntity.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/entity/StationEntity.java index d55aa6b..fe0fd23 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/entity/StationEntity.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/entity/StationEntity.java @@ -156,4 +156,8 @@ public class StationEntity extends TenantEntity implements Serializable { @ApiModelProperty("是否发送告警短信: 1-发送短信 0-不发送短信") private Integer sendMessageFlag; + + @ApiModelProperty("站点是否为国外 1:是;0:否") + @QueryField(condition = SqlCondition.EQUAL) + private Boolean isAbroad; } diff --git a/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/Constants.java b/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/Constants.java index 8100261..fc2195b 100644 --- a/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/Constants.java +++ b/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/Constants.java @@ -1,8 +1,28 @@ package com.hnac.hzinfo.inspect; +import lombok.Getter; + /** * @Author: py */ public class Constants { public final static String APP_NAME = "hzinfo-inspect"; + + /** + * 巡检类型, 0普通巡检,1视频自动巡检,2机器人巡检 + */ + @Getter + public enum InspectTypeEnum{ + /**0普通巡检**/ + COMMON("0"), + /**1视频自动巡检**/ + VIDEO("1"), + /**2机器人巡检**/ + ROBOT("2"); + private final String val; + InspectTypeEnum(String val){ + this.val = val; + } + } + } diff --git a/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/ObjectConstants.java b/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/ObjectConstants.java new file mode 100644 index 0000000..905b1a0 --- /dev/null +++ b/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/ObjectConstants.java @@ -0,0 +1,49 @@ +package com.hnac.hzinfo.inspect.obj; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * @author huangxing + * 巡检配置常量 + */ +public interface ObjectConstants { + + /** + * 巡检模板重复记录类型 + */ + @AllArgsConstructor + @Getter + enum TemplateRecordEnum { + /**允许**/ + ALLOW("1","允许"), + /**禁止**/ + FORBIDDEN("0","禁止") + ; + + private final String recordType; + private final String describe; + } + + @Getter + @AllArgsConstructor + enum TemplateEnableEnum { + /**启用**/ + YES(0), + /**弃用**/ + no(1) + ; + private final Integer enableType; + } + + @Getter + @AllArgsConstructor + enum ProjectEnableEnum { + /**启用**/ + YES(0), + /**弃用**/ + no(1) + ; + private final Integer enableType; + } +} diff --git a/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/dto/ContentDTO.java b/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/dto/ContentDTO.java new file mode 100644 index 0000000..00054a6 --- /dev/null +++ b/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/dto/ContentDTO.java @@ -0,0 +1,17 @@ +package com.hnac.hzinfo.inspect.obj.dto; + +import com.hnac.hzinfo.inspect.obj.entity.ContentEntity; + +import java.io.Serializable; + +/** + * @ClassName ContentDTO + * @description: + * @author: hx + * @create: 2023-06-26 19:22 + * @Version 4.0 + **/ + +public class ContentDTO extends ContentEntity implements Serializable { + +} diff --git a/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/dto/ContentDefinitionDTO.java b/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/dto/ContentDefinitionDTO.java new file mode 100644 index 0000000..16402fe --- /dev/null +++ b/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/dto/ContentDefinitionDTO.java @@ -0,0 +1,26 @@ +package com.hnac.hzinfo.inspect.obj.dto; + +import com.hnac.hzinfo.inspect.obj.entity.ContentDefinitionEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; + +/** + * @ClassName ContentDefinitionDTO + * @description: 巡检定义VO对象 + * @author: hx + * @create: 2023-06-20 19:00 + * @Version 4.0 + **/ +@Data +@ApiModel("巡检定义DTO对象") +@EqualsAndHashCode +public class ContentDefinitionDTO extends ContentDefinitionEntity implements Serializable { + + @ApiModelProperty("id,按逗号分隔") + private String ids; + +} diff --git a/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/dto/ProjectDTO.java b/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/dto/ProjectDTO.java new file mode 100644 index 0000000..fc91215 --- /dev/null +++ b/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/dto/ProjectDTO.java @@ -0,0 +1,27 @@ +package com.hnac.hzinfo.inspect.obj.dto; + +import com.hnac.hzinfo.inspect.obj.entity.ProjectEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.util.List; + +/** + * @ClassName ProjectDTO + * @description: 设备巡检项目DTO对象 + * @author: hx + * @create: 2023-06-29 16:06 + * @Version 4.0 + **/ +@ApiModel("设备巡检项目DTO对象") +@Data +@EqualsAndHashCode +public class ProjectDTO extends ProjectEntity implements Serializable { + + @ApiModelProperty("巡检内容DTO对象") + private List contentDTOList; + +} diff --git a/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/entity/ContentDefinitionEntity.java b/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/entity/ContentDefinitionEntity.java new file mode 100644 index 0000000..eb2e9d9 --- /dev/null +++ b/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/entity/ContentDefinitionEntity.java @@ -0,0 +1,92 @@ +package com.hnac.hzinfo.inspect.obj.entity; + +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.NullSerializer; +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 javax.validation.constraints.Size; +import java.io.Serializable; + +/** + * @ClassName ContentDefinitionEntity + * @description: 巡检内容定义 + * @author: hx + * @create: 2023-06-20 18:27 + * @Version 4.0 + **/ +@Data +@EqualsAndHashCode +public class ContentDefinitionEntity extends TenantEntity implements Serializable { + + @ApiModelProperty(value = "内容编码") + private String code; + + @ApiModelProperty(value = "内容名称,长度必须为1到128") + @Size(min=1,max = 128,message ="内容名称长度必须为1到128") + private String name; + + @ApiModelProperty(value = "内容描述,长度必须为0到512") + @Size(min=0,max = 512,message ="内容描述长度必须为0到512") + private String description; + + @ApiModelProperty(value = "记录类型 0不记录 1仅选择 2仅记值 3选择并记值") + private String recordType; + + @ApiModelProperty(value = "检测类型") + private String checkType; + + @ApiModelProperty(value = "检测类型子类") + private String checkTypeSon; + +// @JsonSerialize(nullsUsing = NullSerializer.class) +// @ApiModelProperty(value = "表针识别,表盘ID") +// private Long clockId; + +// @JsonSerialize(nullsUsing = NullSerializer.class) +// @ApiModelProperty(value = "视频巡检摄像机ID") +// private Long cameraId; + + @ApiModelProperty(value = "记值方式为选择时选择值") + private String dictType; + +// @ApiModelProperty(value = "上限值") +// private Double upLimit; +// +// @ApiModelProperty(value = "下限值") +// private Double downLimit; + + @ApiModelProperty(value = "问题排除建议") + private String suggestion; + + @ApiModelProperty(value = "排序") + private Integer sort; + + @ApiModelProperty(value = " inspectType 支持的巡检类型 0普通巡检,1视频自动巡检,2机器人巡检") + private String supportAutoVideo; + +// @ApiModelProperty(value = "开关/灯/表盘在摄像机可视面二维坐标位置,例如:2,1 表示第三行第二列,行列均从0开始记录,默认 0,0,如果有多张图则:0,0,1( 最后一位表示所在图片,最后一位1表示第二张图),默认0,0,0") +// private String cameraAddr; + + @ApiModelProperty(value = "其他参数,例如多联断路器内断路器的个数") + private String otherParam; + + @ApiModelProperty(value = "校验值,用来判断当前值是否正确:枚举数据通过 “ , ”隔开, 区间通过~隔开") + private String checkVal; + + @ApiModelProperty(value = "绑定物模型标识") + @QueryField(condition = SqlCondition.EQUAL) + private String modelSignage; + + @ApiModelProperty(value = "绑定物模型属性标识") + @QueryField(condition = SqlCondition.EQUAL) + private String attrSignage; + + @ApiModelProperty(value = "绑定物模型属性标识") + @QueryField(condition = SqlCondition.LIKE) + private String attrName; +} diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/entity/ContentEntity.java b/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/entity/ContentEntity.java similarity index 90% rename from hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/entity/ContentEntity.java rename to hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/entity/ContentEntity.java index a799292..495bdae 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/entity/ContentEntity.java +++ b/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/entity/ContentEntity.java @@ -127,5 +127,19 @@ public class ContentEntity extends TenantEntity { @ApiModelProperty(value = "校验值,用来判断当前值是否正确:枚举数据通过 “ , ”隔开, 区间通过~隔开") private String checkVal; + @ApiModelProperty(value = "绑定物模型标识") + private String modelSignage; + + @ApiModelProperty(value = "绑定物模型属性标识") + private String attrSignage; + + @ApiModelProperty(value = "绑定物模型属性名称") + private String attrName; + + @ApiModelProperty(value = "绑定采集点ID") + private String facDeviceId; + + @ApiModelProperty(value = "绑定采集点名称") + private String facDeviceName; } diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/entity/ProjectEntity.java b/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/entity/ProjectEntity.java similarity index 96% rename from hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/entity/ProjectEntity.java rename to hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/entity/ProjectEntity.java index c88afa5..6889ec6 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/entity/ProjectEntity.java +++ b/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/entity/ProjectEntity.java @@ -60,4 +60,7 @@ public class ProjectEntity extends TenantEntity { @ApiModelProperty(value = "inspectType 支持的巡检类型 0普通巡检,1视频自动巡检,2机器人巡检") private String supportAutoVideo; + @ApiModelProperty("设备编号") + private String emCode; + } diff --git a/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/feign/IContentClient.java b/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/feign/IContentClient.java new file mode 100644 index 0000000..711100b --- /dev/null +++ b/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/feign/IContentClient.java @@ -0,0 +1,25 @@ +package com.hnac.hzinfo.inspect.obj.feign; + +import com.hnac.hzinfo.inspect.Constants; +import com.hnac.hzinfo.inspect.obj.vo.ContentVO; +import org.springblade.core.tool.api.R; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.GetMapping; + +@FeignClient(value = Constants.APP_NAME) +public interface IContentClient { + String API_PREFIX = "/feign/content"; + String DETAIL = API_PREFIX + "/detail"; + String SAVE_BATCH = API_PREFIX + "/saveBatch"; + String LIST = API_PREFIX + "/list"; + String SAVE_OR_UPDATE_BATCH = API_PREFIX + "/saveOrUpdateBatch"; + + /** + * 根据ID查询设备巡检内容详情 + * @param id 主键ID + * @return + */ + @GetMapping(DETAIL) + R detail(Long id); + +} diff --git a/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/feign/IContentDefinitionClient.java b/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/feign/IContentDefinitionClient.java new file mode 100644 index 0000000..ebaa95c --- /dev/null +++ b/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/feign/IContentDefinitionClient.java @@ -0,0 +1,63 @@ +package com.hnac.hzinfo.inspect.obj.feign; + +import com.hnac.hzinfo.inspect.Constants; +import com.hnac.hzinfo.inspect.obj.dto.ContentDefinitionDTO; +import com.hnac.hzinfo.inspect.obj.vo.ContentDefinitionVO; +import org.springblade.core.tool.api.R; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestParam; + +import java.util.List; + +/** + * @ClassName IContentDefinitionClient + * @description: + * @author: hx + * @create: 2023-06-26 14:15 + * @Version 4.0 + **/ +@FeignClient(value = Constants.APP_NAME) +public interface IContentDefinitionClient { + + String API_PREFIX = "/feign/content/definition"; + String DETAIL = API_PREFIX + "/detail"; + String SAVE_BATCH = API_PREFIX + "/saveBatch"; + String LIST = API_PREFIX + "/list"; + String SAVE_OR_UPDATE_BATCH = API_PREFIX + "/saveOrUpdateBatch"; + + /** + * 查看巡检内容定义详情 + * @param id 主键 + * @return + */ + @GetMapping(DETAIL) + R detail(@RequestParam Long id); + + /** + * 批量保存巡检内容定义 + * @param request ContentDefinitionDTO列表 + * @return + */ + @PostMapping(SAVE_BATCH) + R saveBatch(@RequestBody List request); + + /** + * 查询列表 + * @param request 筛选条件 + * @return + */ + @GetMapping(LIST) + R> list(ContentDefinitionDTO request); + + /** + * 批量更新 + * @param request + * @return + */ + @GetMapping(SAVE_OR_UPDATE_BATCH) + R saveOrUpdateBatch(List request); + +} diff --git a/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/feign/IProjectClient.java b/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/feign/IProjectClient.java new file mode 100644 index 0000000..c93031f --- /dev/null +++ b/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/feign/IProjectClient.java @@ -0,0 +1,29 @@ +package com.hnac.hzinfo.inspect.obj.feign; + +import com.hnac.hzinfo.inspect.Constants; +import com.hnac.hzinfo.inspect.obj.dto.ProjectDTO; +import com.hnac.hzinfo.inspect.obj.entity.ProjectEntity; +import org.springblade.core.tool.api.R; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; + +import javax.validation.Valid; +import java.util.List; + +@FeignClient(value = Constants.APP_NAME) +public interface IProjectClient { + + String API_PREFIX = "/feign/project"; + String ADD_PROJECT_AND_CONTENT = API_PREFIX + "/addProjectAndContent"; + + + /** + * 批量新增/更新项目 + * @param request ProjectEntity 列表 + * @return + */ + @PostMapping(ADD_PROJECT_AND_CONTENT) + R addProjectAndContent(@RequestBody @Valid List request); + +} diff --git a/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/vo/ContentDefinitionVO.java b/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/vo/ContentDefinitionVO.java new file mode 100644 index 0000000..e415c70 --- /dev/null +++ b/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/vo/ContentDefinitionVO.java @@ -0,0 +1,29 @@ +package com.hnac.hzinfo.inspect.obj.vo; + +import com.hnac.hzinfo.inspect.obj.entity.ContentDefinitionEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; + +/** + * @ClassName ContentDefinitionVO + * @description: + * @author: hx + * @create: 2023-06-20 19:00 + * @Version 4.0 + **/ +@Data +@EqualsAndHashCode +@ApiModel("巡检内容定义VO对象") +public class ContentDefinitionVO extends ContentDefinitionEntity implements Serializable { + + @ApiModelProperty("创建人名称") + private String creatorName; + + @ApiModelProperty("更新人名称") + private String updateUserName; + +} diff --git a/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/vo/ContentVO.java b/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/vo/ContentVO.java new file mode 100644 index 0000000..07f53ad --- /dev/null +++ b/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/vo/ContentVO.java @@ -0,0 +1,23 @@ +package com.hnac.hzinfo.inspect.obj.vo; + +import com.hnac.hzinfo.inspect.obj.entity.ContentEntity; +import io.swagger.annotations.ApiModel; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; + +/** + * @ClassName ContentVO + * @description: + * @author: hx + * @create: 2023-06-26 19:20 + * @Version 4.0 + **/ +@EqualsAndHashCode +@Data +@ApiModel(value = "设备巡检内容VO对象",description = "设备巡检内容VO对象") +public class ContentVO extends ContentEntity implements Serializable { + +} diff --git a/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/wrapper/ContentDefinitionWrapper.java b/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/wrapper/ContentDefinitionWrapper.java new file mode 100644 index 0000000..e6bf0a6 --- /dev/null +++ b/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/wrapper/ContentDefinitionWrapper.java @@ -0,0 +1,29 @@ +package com.hnac.hzinfo.inspect.obj.wrapper; + +import com.hnac.hzinfo.inspect.obj.entity.ContentDefinitionEntity; +import com.hnac.hzinfo.inspect.obj.vo.ContentDefinitionVO; +import org.springblade.core.mp.support.BaseEntityWrapper; +import org.springblade.core.tool.utils.BeanUtil; + +import java.util.Optional; + +/** + * @ClassName ContentDefinitionWrapper + * @description: 巡检内容定义 entity -> VO 转换类 + * @author: hx + * @create: 2023-06-20 19:04 + * @Version 4.0 + **/ + +public class ContentDefinitionWrapper extends BaseEntityWrapper { + + public static ContentDefinitionWrapper build() { + return new ContentDefinitionWrapper(); + } + + @Override + public ContentDefinitionVO entityVO(ContentDefinitionEntity entity) { + ContentDefinitionVO definitionVO = BeanUtil.copy(entity, ContentDefinitionVO.class); + return definitionVO; + } +} diff --git a/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/wrapper/ContentWrapper.java b/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/wrapper/ContentWrapper.java new file mode 100644 index 0000000..d644755 --- /dev/null +++ b/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/wrapper/ContentWrapper.java @@ -0,0 +1,26 @@ +package com.hnac.hzinfo.inspect.obj.wrapper; + +import com.hnac.hzinfo.inspect.obj.entity.ContentEntity; +import com.hnac.hzinfo.inspect.obj.vo.ContentVO; +import org.springblade.core.mp.support.BaseEntityWrapper; +import org.springblade.core.tool.utils.BeanUtil; + +/** + * @ClassName ContentWrapper + * @description: + * @author: hx + * @create: 2023-06-26 19:28 + * @Version 4.0 + **/ +public class ContentWrapper extends BaseEntityWrapper { + + public static ContentWrapper build() { + return new ContentWrapper(); + } + + @Override + public ContentVO entityVO(ContentEntity entity) { + ContentVO contentVO = BeanUtil.copy(entity, ContentVO.class); + return contentVO; + } +} diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/controller/FdpMonitorController.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/controller/FdpMonitorController.java index 18fe5f4..c43348a 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/controller/FdpMonitorController.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/controller/FdpMonitorController.java @@ -194,7 +194,8 @@ public class FdpMonitorController extends BladeController { @ApiOperationSupport(order = 160) @ApiOperation(value = "数据追溯") public R dataBack(@RequestBody DataBackVo vo) { - return R.data(service.dataBack(vo.getFaultId())); + service.dataBackV2(vo.getFaultId()); + return service.dataBackV2(vo.getFaultId()); } @PostMapping("/monthly/report/dataBack") diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/IFdpMonitorService.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/IFdpMonitorService.java index e36e698..d8f16cf 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/IFdpMonitorService.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/IFdpMonitorService.java @@ -97,7 +97,7 @@ public interface IFdpMonitorService extends BaseService { Map dataBack(String faultId); - + R dataBackV2(String faultId); Map monthlyDataBack(DataBackVo vo); /** diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpMonitorServiceImpl.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpMonitorServiceImpl.java index 80df684..c1bb70a 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpMonitorServiceImpl.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpMonitorServiceImpl.java @@ -40,10 +40,10 @@ import com.hnac.hzims.fdp.vo.*; import com.hnac.hzims.fdp.wrapper.FdpMonitorWrapper; import com.hnac.hzims.monitor.dto.FdpMonitorBindingDTO; import com.hnac.hzims.monitor.utils.DateUtils; -import com.hnac.hzims.util.HttpClientUtils; -import com.hnac.hzims.util.pojo.HttpResponse; import com.hnac.hzims.operational.station.entity.StationEntity; import com.hnac.hzims.operational.station.feign.IStationClient; +import com.hnac.hzims.util.HttpClientUtils; +import com.hnac.hzims.util.pojo.HttpResponse; import com.hnac.hzinfo.datasearch.analyse.IAnalyseDataSearchClient; import com.hnac.hzinfo.datasearch.analyse.IAnalyseInstanceClient; import com.hnac.hzinfo.datasearch.analyse.domain.FieldsData; @@ -54,7 +54,6 @@ import com.hnac.hzinfo.datasearch.analyse.vo.AnalyzeDataConditionVO; import com.hnac.hzinfo.datasearch.analyse.vo.AnalyzeInstanceFieldVO; import com.hnac.hzinfo.datasearch.real.IRealDataSearchClient; import com.hnac.hzinfo.datasearch.real.po.RealDataSearchPO; - import com.xxl.job.core.log.XxlJobLogger; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -66,6 +65,7 @@ import org.springblade.core.mp.support.Query; import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.*; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Value; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Service; @@ -113,6 +113,9 @@ public class FdpMonitorServiceImpl extends BaseServiceImpl resultMap = new HashMap<>(); + resultMap.put("faultId", faultId); + String post = HttpRequestUtil.postCallObjectParam(resultMap, getRealByFault, "POST"); + FdpHttpResponseVo fdpHttpResponseVo = JSONObject.parseObject(post, new TypeReference() {}); + if (1==fdpHttpResponseVo.getSuccess()) { + if (Func.isNotEmpty(fdpHttpResponseVo.getData())) { + List list = JSONObject.parseObject(fdpHttpResponseVo.getData(), new TypeReference>() {}); + if (CollectionUtil.isEmpty(list)){ + return R.success("暂无数据,请稍后重试"); + } + List res =new ArrayList<>(); + for (FdpFaultRealDataVO fdpFaultRealDataVO : list) { + if (null!=fdpFaultRealDataVO.getReal()){ + for (int i = 0; i < fdpFaultRealDataVO.getReal().size(); i++ ) { + FdpFaultRealDataVO dataVO=new FdpFaultRealDataVO(); + BeanUtils.copyProperties(fdpFaultRealDataVO,dataVO); + String real = fdpFaultRealDataVO.getReal().get(i); + Date time = fdpFaultRealDataVO.getRealTime().get(i); + dataVO.setReal(Arrays.asList(real)); + dataVO.setRealTime(Arrays.asList(time)); + res.add(dataVO); + } + }else { + res.add(fdpFaultRealDataVO); + } + } +// JSONObject jsonParams = JSONObject.parseObject(fdpHttpResponseVo.getData()); +// list=list.stream().map(s -> { +// if ("单".equals(s.getMulti())) { +// if (null == s.getReal()) { +// s.setReal(new ArrayList<>().toString()); +// } else { +// String real = jsonParams.get("real").toString(); +// s.setReal(Arrays.asList(Double.valueOf(real)).toString()); +// } +// } +// return s; +// }).collect(Collectors.toList()); + return R.data(res); + } + return R.success("暂无数据,请稍后重试"); + } + return R.fail("智能诊断接口异常,请联系管理员"); + } + //此接口已经弃用20230628 + @Deprecated @Override public Map dataBack(String faultId) { //根据故障ID查询监测点列表 diff --git a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/MiddleApplication.java b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/MiddleApplication.java index f678c01..71bedcb 100644 --- a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/MiddleApplication.java +++ b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/MiddleApplication.java @@ -10,7 +10,7 @@ import org.springframework.context.annotation.ComponentScan; @EnableBladeFeign @SpringCloudApplication -@MapperScan("com.hnac.hzims.*.**.mapper.**") +@MapperScan("com.hnac.hzims.**.mapper.**") @ComponentScan(basePackages = {"com.hnac.*"}) public class MiddleApplication { static { diff --git a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/controller/SysLogController.java b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/controller/SysLogController.java index d36294b..e06411e 100644 --- a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/controller/SysLogController.java +++ b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/controller/SysLogController.java @@ -95,11 +95,11 @@ public class SysLogController { * 根据Id获取日志数据 * @return */ + @ApiOperation("根据Id获取日志数据") + @GetMapping("/get/{id}") @ApiResponses({ @ApiResponse(code = 200,message = "OK",response = SysLog.class), }) - @ApiOperation("根据Id获取日志数据") - @GetMapping("/get/{id}") public R getById(@PathVariable Long id) { SysLog sysLog = sysLogService.getById(id); return R.data(sysLog); diff --git a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/entity/Statistics.java b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/entity/Statistics.java index 7a8a7e9..6dbcae6 100644 --- a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/entity/Statistics.java +++ b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/entity/Statistics.java @@ -1,5 +1,6 @@ package com.hnac.hzims.middle.systemlog.entity; +import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import java.time.LocalDateTime; import com.baomidou.mybatisplus.annotation.TableField; @@ -33,7 +34,7 @@ public class Statistics implements Serializable { * 编号 */ @ApiModelProperty("编号") - @TableField("id") + @TableId("id") private Long id; diff --git a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/entity/SysLog.java b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/entity/SysLog.java index 5bb4897..d9e5131 100644 --- a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/entity/SysLog.java +++ b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/entity/SysLog.java @@ -1,5 +1,7 @@ package com.hnac.hzims.middle.systemlog.entity; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import java.time.LocalDateTime; @@ -36,7 +38,7 @@ public class SysLog implements Serializable { /** * 操作日志编号 */ - @TableField("id") + @TableId(value = "id",type = IdType.ASSIGN_ID) private Long id; diff --git a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/mapper/StatisticsMapper.java b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/mapper/StatisticsMapper.java index f314b73..66c3c85 100644 --- a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/mapper/StatisticsMapper.java +++ b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/mapper/StatisticsMapper.java @@ -6,7 +6,9 @@ import com.hnac.hzims.middle.systemlog.entity.Statistics; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.hnac.hzims.middle.systemlog.vo.StatisticsResponseVo; import com.hnac.hzims.middle.systemlog.vo.StatisticsVo; +import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; /** *

diff --git a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/mapper/StatisticsMapper.xml b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/mapper/StatisticsMapper.xml index a8c53e1..f8e11c7 100644 --- a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/mapper/StatisticsMapper.xml +++ b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/mapper/StatisticsMapper.xml @@ -5,6 +5,14 @@ diff --git a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/mapper/SysLogMapper.java b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/mapper/SysLogMapper.java index 98df167..9bce1df 100644 --- a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/mapper/SysLogMapper.java +++ b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/mapper/SysLogMapper.java @@ -7,7 +7,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.hnac.hzims.middle.systemlog.vo.StatisticsTitleResponseVo; import com.hnac.hzims.middle.systemlog.vo.StatisticsVo; import com.hnac.hzims.middle.systemlog.vo.SysLogStatisticsVo; +import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; import java.util.List; @@ -37,4 +39,12 @@ public interface SysLogMapper extends BaseMapper { * @return */ IPage statisticsTitleByModuleName(Page moduleName, @Param("statisticsVo") StatisticsVo statisticsVo); + + + /** + * 根据Id获取日志数据 + * @param id + * @return + */ + SysLog getSysLogById(@Param("id") Long id); } diff --git a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/mapper/SysLogMapper.xml b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/mapper/SysLogMapper.xml index af48743..2ad6ef4 100644 --- a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/mapper/SysLogMapper.xml +++ b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/mapper/SysLogMapper.xml @@ -35,4 +35,38 @@ group by title; + + + diff --git a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/service/SysLogService.java b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/service/SysLogService.java index f61b2d8..1a02aa6 100644 --- a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/service/SysLogService.java +++ b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/service/SysLogService.java @@ -46,4 +46,7 @@ public interface SysLogService extends IService { */ IPage statisticsTitleByModuleName(Page statisticsTitleResponseVoPage, StatisticsVo statisticsVo); + + + } diff --git a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/service/impl/StatisticsServiceImpl.java b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/service/impl/StatisticsServiceImpl.java index 0df0a4c..e6c9baa 100644 --- a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/service/impl/StatisticsServiceImpl.java +++ b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/service/impl/StatisticsServiceImpl.java @@ -33,10 +33,6 @@ public class StatisticsServiceImpl extends ServiceImpl impleme } + + /** * 日志查询接口 * @param sysLog diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/dao/ContentDefinitionMapper.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/dao/ContentDefinitionMapper.java new file mode 100644 index 0000000..af5b22a --- /dev/null +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/dao/ContentDefinitionMapper.java @@ -0,0 +1,10 @@ +package com.hnac.hzinfo.inspect.obj.dao; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hnac.hzinfo.inspect.obj.entity.ContentDefinitionEntity; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface ContentDefinitionMapper extends BaseMapper { + +} diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/entity/ObjectEntity.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/entity/ObjectEntity.java index d4cea63..4a7efdb 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/entity/ObjectEntity.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/entity/ObjectEntity.java @@ -101,4 +101,8 @@ public class ObjectEntity extends TenantEntity { @TableField(exist = false) @ApiModelProperty(value = "对象危险点详情list") private List dangerSources; + + @ApiModelProperty(value = "设备编号,按逗号分隔") + @QueryField(condition = SqlCondition.LIKE) + private String emCodes; } diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/feign/ContentClient.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/feign/ContentClient.java new file mode 100644 index 0000000..31e287e --- /dev/null +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/feign/ContentClient.java @@ -0,0 +1,36 @@ +package com.hnac.hzinfo.inspect.obj.feign; + +import com.hnac.hzinfo.inspect.obj.entity.ContentEntity; +import com.hnac.hzinfo.inspect.obj.services.ContentService; +import com.hnac.hzinfo.inspect.obj.vo.ContentVO; +import com.hnac.hzinfo.inspect.obj.wrapper.ContentWrapper; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.boot.ctrl.BladeController; +import org.springblade.core.tool.api.R; +import org.springframework.web.bind.annotation.RestController; + +import java.util.Optional; + +/** + * @ClassName ContentClient + * @description: 设备巡检内容 feign 接口实现类 + * @author: hx + * @create: 2023-06-26 19:49 + * @Version 4.0 + **/ +@AllArgsConstructor +@Slf4j +@RestController +public class ContentClient extends BladeController implements IContentClient { + + private final ContentService contentService; + + @Override + public R detail(Long id) { + ContentEntity entity = contentService.getById(id); + return R.data(Optional.ofNullable(entity).map(content -> ContentWrapper.build().entityVO(content)).orElse(null)); + } + + +} diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/feign/ContentDefinitionClient.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/feign/ContentDefinitionClient.java new file mode 100644 index 0000000..add8955 --- /dev/null +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/feign/ContentDefinitionClient.java @@ -0,0 +1,61 @@ +package com.hnac.hzinfo.inspect.obj.feign; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.hnac.hzinfo.inspect.obj.dto.ContentDefinitionDTO; +import com.hnac.hzinfo.inspect.obj.entity.ContentDefinitionEntity; +import com.hnac.hzinfo.inspect.obj.services.IContentDefinitionService; +import com.hnac.hzinfo.inspect.obj.vo.ContentDefinitionVO; +import com.hnac.hzinfo.inspect.obj.wrapper.ContentDefinitionWrapper; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.extern.slf4j.Slf4j; +import oracle.jdbc.proxy.annotation.Post; +import org.springblade.core.tool.api.R; +import org.springframework.web.bind.annotation.*; + +import java.util.List; +import java.util.Optional; + +/** + * @ClassName ContentDefinitionClient + * @description: 巡检内容定义feign接口 + * @author: hx + * @create: 2023-06-26 14:20 + * @Version 4.0 + **/ +@RestController +@AllArgsConstructor +@Slf4j +public class ContentDefinitionClient implements IContentDefinitionClient { + + private final IContentDefinitionService contentDefinitionService; + + @Override + @GetMapping(DETAIL) + public R detail(@RequestParam Long id) { + ContentDefinitionEntity entity = contentDefinitionService.getById(id); + return R.data(Optional.ofNullable(entity).map(content -> ContentDefinitionWrapper.build().entityVO(content)).orElse(null)); + } + + @Override + @PostMapping(SAVE_BATCH) + public R saveBatch(@RequestBody List request) { + List list = JSONArray.parseArray(JSON.toJSONString(request), ContentDefinitionEntity.class); + return R.data(contentDefinitionService.saveBatch(list)); + } + + @Override + @GetMapping(LIST) + public R> list(ContentDefinitionDTO request) { + return R.data(contentDefinitionService.list(request)); + } + + @Override + @PostMapping(SAVE_OR_UPDATE_BATCH) + public R saveOrUpdateBatch(List request) { + List list = JSONArray.parseArray(JSON.toJSONString(request), ContentDefinitionEntity.class); + return R.data(contentDefinitionService.saveOrUpdateBatch(list)); + } + +} diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/feign/ProjectClient.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/feign/ProjectClient.java new file mode 100644 index 0000000..db7c303 --- /dev/null +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/feign/ProjectClient.java @@ -0,0 +1,35 @@ +package com.hnac.hzinfo.inspect.obj.feign; + +import com.hnac.hzinfo.inspect.obj.dto.ProjectDTO; +import com.hnac.hzinfo.inspect.obj.services.ProjectService; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.boot.ctrl.BladeController; +import org.springblade.core.tool.api.R; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RestController; + +import javax.validation.Valid; +import java.util.List; + +/** + * @ClassName ProjectClient + * @description: + * @author: hx + * @create: 2023-06-29 16:10 + * @Version 4.0 + **/ +@RestController +@AllArgsConstructor +@Slf4j +public class ProjectClient extends BladeController implements IProjectClient { + + private final ProjectService projectService; + + @Override + @PostMapping(ADD_PROJECT_AND_CONTENT) + public R addProjectAndContent(@RequestBody @Valid List request) { + return R.data(projectService.addProjectAndContent(request)); + } +} diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/mapper/ContentDefinitionMapper.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/mapper/ContentDefinitionMapper.java new file mode 100644 index 0000000..42e2b63 --- /dev/null +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/mapper/ContentDefinitionMapper.java @@ -0,0 +1,10 @@ +package com.hnac.hzinfo.inspect.obj.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hnac.hzinfo.inspect.obj.entity.ContentDefinitionEntity; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface ContentDefinitionMapper extends BaseMapper { + +} diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/IContentDefinitionService.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/IContentDefinitionService.java new file mode 100644 index 0000000..710d624 --- /dev/null +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/IContentDefinitionService.java @@ -0,0 +1,19 @@ +package com.hnac.hzinfo.inspect.obj.services; + +import com.hnac.hzinfo.inspect.obj.dto.ContentDefinitionDTO; +import com.hnac.hzinfo.inspect.obj.entity.ContentDefinitionEntity; +import com.hnac.hzinfo.inspect.obj.vo.ContentDefinitionVO; +import org.springblade.core.mp.base.BaseService; + +import java.util.List; + +public interface IContentDefinitionService extends BaseService { + + /** + * 根据筛选条件获取列表 + * @param request 筛选条件 + * @return + */ + List list(ContentDefinitionDTO request); + +} diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/ObjectService.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/ObjectService.java index e7aac45..75be494 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/ObjectService.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/ObjectService.java @@ -49,4 +49,11 @@ public interface ObjectService extends BaseService { void previewQrCode(Long objectId); List getReDbjectData(String tenantId); + + /** + * 新增或修改巡检对象 + * @param object + * @return + */ + Boolean submit(ObjectEntity object); } diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/ProjectService.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/ProjectService.java index 5c5bd7f..4dd7398 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/ProjectService.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/ProjectService.java @@ -3,6 +3,7 @@ package com.hnac.hzinfo.inspect.obj.services; import java.util.List; +import com.hnac.hzinfo.inspect.obj.dto.ProjectDTO; import com.hnac.hzinfo.inspect.obj.vo.ProjectOfflineVO; import org.springblade.core.mp.base.BaseService; @@ -14,4 +15,18 @@ import com.hnac.hzinfo.inspect.obj.entity.ProjectEntity; public interface ProjectService extends BaseService{ List getProjectData(String tenantId); + + /** + * 获取巡检项目(目前筛选条件只支持emCode查询,想添加条件需自行在Entity内添加QueryField注解) + * @param req 筛选条件 + * @return + */ + ProjectEntity getOne(ProjectEntity req); + + /** + * 新增设备巡检项目以及设备巡检内容以及两者之间的绑定关系 + * @param request 设备巡检项目DTO + * @return + */ + Boolean addProjectAndContent(List request); } diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/impl/ContentDefinitionServiceImpl.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/impl/ContentDefinitionServiceImpl.java new file mode 100644 index 0000000..1b5bdbd --- /dev/null +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/impl/ContentDefinitionServiceImpl.java @@ -0,0 +1,46 @@ +package com.hnac.hzinfo.inspect.obj.services.impl; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.hnac.hzinfo.inspect.obj.dto.ContentDefinitionDTO; +import com.hnac.hzinfo.inspect.obj.entity.ContentDefinitionEntity; +import com.hnac.hzinfo.inspect.obj.mapper.ContentDefinitionMapper; +import com.hnac.hzinfo.inspect.obj.services.IContentDefinitionService; +import com.hnac.hzinfo.inspect.obj.vo.ContentDefinitionVO; +import com.hnac.hzinfo.inspect.obj.wrapper.ContentDefinitionWrapper; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.mp.base.BaseService; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springblade.core.mp.support.Condition; +import org.springblade.core.tool.utils.BeanUtil; +import org.springblade.core.tool.utils.Func; +import org.springblade.core.tool.utils.StringUtil; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * @ClassName ContentDefinitionServiceImpl + * @description: 巡检内容定义service类 + * @author: hx + * @create: 2023-06-20 18:48 + * @Version 4.0 + **/ + +@Service +@AllArgsConstructor +@Slf4j +public class ContentDefinitionServiceImpl extends BaseServiceImpl + implements IContentDefinitionService { + + @Override + public List list(ContentDefinitionDTO request) { + QueryWrapper queryWrapper = Condition.getQueryWrapper(BeanUtil.copy(request, ContentDefinitionEntity.class)); + LambdaQueryWrapper lambda = queryWrapper.lambda(); + lambda.in(StringUtil.isNotBlank(request.getIds()),ContentDefinitionEntity::getId,Func.toLongList(",",request.getIds())); + return ContentDefinitionWrapper.build().listVO(this.list(lambda)); + } +} diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/impl/ObjectServiceImpl.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/impl/ObjectServiceImpl.java index 0f619d1..8a7e53b 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/impl/ObjectServiceImpl.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/impl/ObjectServiceImpl.java @@ -4,30 +4,37 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.google.common.collect.Lists; import com.google.zxing.BarcodeFormat; +import com.hnac.hzinfo.inspect.Constants; +import com.hnac.hzinfo.inspect.obj.ObjectConstants; import com.hnac.hzinfo.inspect.obj.entity.*; import com.hnac.hzinfo.inspect.obj.services.*; import com.hnac.hzinfo.inspect.obj.utils.CodeUtils; import com.hnac.hzinfo.inspect.obj.vo.*; +import com.hnac.hzinfo.inspect.plan.PlanContants; import com.hnac.hzinfo.inspect.utils.HtmlModule; import com.hnac.hzinfo.inspect.utils.HtmltoPdf; import com.hnac.hzinfo.inspect.utils.ZxingGenCode; 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.Func; -import org.springblade.core.tool.utils.ObjectUtil; -import org.springblade.core.tool.utils.StringUtil; +import org.springblade.core.tool.api.R; +import org.springblade.core.tool.utils.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import com.hnac.hzinfo.inspect.obj.mapper.InspectObjectMapper; import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.Assert; import java.io.File; +import java.time.LocalDateTime; +import java.time.ZoneId; import java.util.ArrayList; import java.util.List; import java.util.UUID; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; /** * @author h w @@ -45,6 +52,10 @@ public class ObjectServiceImpl extends BaseServiceImpl { + throw new ServiceException("保存巡检对象失败!"); + }); + objectDangerService.remove(Wrappers.lambdaQuery().eq(ObjectDangerEntity::getObjectId, object.getId())); + List objectDangers = object.getObjectDangers(); + if(CollectionUtil.isNotEmpty(objectDangers)){ + objectDangers.stream().forEach(e -> { + e.setObjectId(object.getId()); + }); + objectDangerService.saveBatch(objectDangers); + } + this.generateTemplate(object); + return true; + } + + /** + * 根据巡检对象生成一条同名巡检模板 + * @param object 巡检对象 + */ + private void generateTemplate(ObjectEntity object) { + // 若巡检对象设备编码存在,则生成巡检模板 + if(Func.isNotEmpty(object.getEmCodes())) { + TemplateEntity template = new TemplateEntity(); + template.setCode(String.valueOf(LocalDateTime.now().atZone(ZoneId.systemDefault()).toInstant().getEpochSecond())); + template.setName(object.getName()); + template.setDuplicateRecord(ObjectConstants.TemplateRecordEnum.ALLOW.getRecordType()); + template.setSupportAutoVideo(Constants.InspectTypeEnum.COMMON.getVal()); + template.setStatus(ObjectConstants.TemplateEnableEnum.YES.getEnableType()); + Assert.isTrue(templateService.save(template),() -> { + throw new ServiceException("保存巡检模板失败!"); + }); + // 保存巡检对象与巡检模板的绑定关系 + ObjectTemplateEntity banding = ObjectTemplateEntity.builder() + .templateId(template.getId()).objectId(object.getId()).code(template.getCode()) + .name(template.getName()).supportAutoVideo(object.getSupportAutoVideo()).build(); + objectTemplateService.save(banding); + // 保存巡检模板与巡检项目的绑定关系 + List emCodeList = Func.toStrList(",", object.getEmCodes()); + Function getTemplateProjectByEmCode = index -> { + ProjectEntity project = new ProjectEntity(); + project.setEmCode(emCodeList.get(index)); + project.setStatus(ObjectConstants.ProjectEnableEnum.YES.getEnableType()); + ProjectEntity one = projectService.getOne(project); + return TemplateProjectEntity.builder().templateId(template.getId()).projectId(one.getId()).sort(index).build(); + }; + List templateProjectList = Stream.iterate(0,n -> n + 1).limit(emCodeList.size()) + .map(getTemplateProjectByEmCode).collect(Collectors.toList()); + templateProjectService.saveBatch(templateProjectList); + } + } /** * 导出巡检对象为 PDF * @return pdf 文件路径 diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/impl/ProjectServiceImpl.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/impl/ProjectServiceImpl.java index 6d35c9a..a2d541a 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/impl/ProjectServiceImpl.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/impl/ProjectServiceImpl.java @@ -1,23 +1,45 @@ package com.hnac.hzinfo.inspect.obj.services.impl; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.hnac.hzinfo.inspect.obj.ObjectConstants; +import com.hnac.hzinfo.inspect.obj.dto.ContentDTO; +import com.hnac.hzinfo.inspect.obj.dto.ProjectDTO; +import com.hnac.hzinfo.inspect.obj.entity.ContentEntity; +import com.hnac.hzinfo.inspect.obj.entity.ProjectContentEntity; import com.hnac.hzinfo.inspect.obj.entity.ProjectEntity; import com.hnac.hzinfo.inspect.obj.mapper.ProjectMapper; +import com.hnac.hzinfo.inspect.obj.services.ContentService; +import com.hnac.hzinfo.inspect.obj.services.ProjectContentService; import com.hnac.hzinfo.inspect.obj.services.ProjectService; +import com.hnac.hzinfo.inspect.obj.utils.CodeUtils; import com.hnac.hzinfo.inspect.obj.vo.ProjectOfflineVO; +import com.hnac.hzinfo.inspect.utils.Condition; +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.ObjectUtil; -import org.springblade.core.tool.utils.StringUtil; +import org.springblade.core.tool.utils.*; import org.springframework.stereotype.Service; +import org.springframework.util.Assert; +import java.util.Collection; import java.util.List; +import java.util.stream.Collectors; +import java.util.stream.Stream; /** * 巡检项目service */ @Service +@AllArgsConstructor +@Slf4j public class ProjectServiceImpl extends BaseServiceImpl implements ProjectService { + private final ContentService contentService; + @Override public boolean save(ProjectEntity entity) { if (ObjectUtil.isNotEmpty(entity)) { @@ -35,4 +57,41 @@ public class ProjectServiceImpl extends BaseServiceImpl getProjectData(String tenantId) { return this.baseMapper.getProjectData(tenantId); } + + @Override + public ProjectEntity getOne(ProjectEntity req) { + LambdaQueryWrapper queryWrapper = Condition.getQueryWrapper(req).lambda(); + queryWrapper.eq(Func.isNotEmpty(req.getStatus()),ProjectEntity::getStatus,req.getStatus()); + List list = this.list(queryWrapper); + Assert.isTrue(CollectionUtil.isNotEmpty(list) && list.size() == 1,() -> { + throw new ServiceException("getOne方法查询唯一设备巡检项目,index为:" + list.size()); + }); + return list.get(0); + } + + @Override + public Boolean addProjectAndContent(List request) { + ProjectContentServiceImpl projectContentService = SpringUtil.getBean(ProjectContentServiceImpl.class); + request.forEach(projectDTO -> { + projectDTO.setCode(CodeUtils.randomCode()); + projectDTO.setStatus(ObjectConstants.ProjectEnableEnum.YES.getEnableType()); + ProjectEntity project = BeanUtil.copy(projectDTO, ProjectEntity.class); + if(this.save(project)) { + // 保存巡检内容以及添加绑定关系 + if(CollectionUtil.isNotEmpty(projectDTO.getContentDTOList())) { + List contentDTOList = projectDTO.getContentDTOList(); + contentDTOList.forEach(contentDTO -> contentDTO.setCode(CodeUtils.randomCode())); + List contentEntityList = JSONArray.parseArray(JSON.toJSONString(contentDTOList),ContentEntity.class); + if(contentService.saveBatch(contentEntityList)) { + // 保存巡检内容以及巡检项目的绑定关系 + List projectContentList = Stream.iterate(0, n -> n + 1).limit(contentEntityList.size()).map( + index -> ProjectContentEntity.builder().projectId(project.getId()).contentId(contentEntityList.get(index).getId()).sort(index).build() + ).collect(Collectors.toList()); + projectContentService.saveBatch(projectContentList); + } + } + } + }); + return true; + } } diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/web/ContentDefinitionController.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/web/ContentDefinitionController.java new file mode 100644 index 0000000..fc28f45 --- /dev/null +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/web/ContentDefinitionController.java @@ -0,0 +1,51 @@ +package com.hnac.hzinfo.inspect.obj.web; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; +import com.hnac.hzinfo.inspect.obj.dto.ContentDefinitionDTO; +import com.hnac.hzinfo.inspect.obj.entity.ContentDefinitionEntity; +import com.hnac.hzinfo.inspect.obj.services.IContentDefinitionService; +import com.hnac.hzinfo.inspect.obj.vo.ContentDefinitionVO; +import com.hnac.hzinfo.inspect.obj.wrapper.ContentDefinitionWrapper; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.AllArgsConstructor; +import org.springblade.core.boot.ctrl.BladeController; +import org.springblade.core.mp.support.Condition; +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.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * @ClassName ContentDefinitionController + * @description: 巡检内容定义controller + * @author: hx + * @create: 2023-06-20 19:13 + * @Version 4.0 + **/ +@RestController +@RequestMapping("/content/definition") +@Api(value = "巡检内容定义管理",tags = "巡检内容定义管理") +@AllArgsConstructor +public class ContentDefinitionController extends BladeController { + + private final IContentDefinitionService contentDefinitionService; + + @GetMapping("/page") + @ApiOperation("分页查询") + @ApiOperationSupport(order = 1) + public R> page(ContentDefinitionDTO content, Query query) { + QueryWrapper queryWrapper = Condition.getQueryWrapper(BeanUtil.copy(content, ContentDefinitionEntity.class)); + queryWrapper.lambda().eq(Func.isEmpty(content.getCreateDept()),ContentDefinitionEntity::getCreateDept,content.getCreateDept()) + .eq(Func.isEmpty(content.getCreateUser()),ContentDefinitionEntity::getCreateUser,content.getCreateUser()); + IPage page = contentDefinitionService.page(Condition.getPage(query), queryWrapper); + page.setRecords(ContentDefinitionWrapper.build().listVO(page.getRecords())); + return R.data(page); + } + +} diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/web/ObjectController.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/web/ObjectController.java index 32bdf09..4a59031 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/web/ObjectController.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/web/ObjectController.java @@ -145,22 +145,7 @@ public class ObjectController extends BladeController { @ApiOperationSupport(order = 3) @ApiOperation(value = "新增或修改", notes = "传入object") public R submit(@Valid @RequestBody ObjectEntity object) { - if(object.getId()==null && Func.isBlank(object.getCode())){ - object.setCode(CodeUtils.randomCode()); - } - if(object.getSupportAutoVideo().equals(PlanContants.InspectTypeEnum.COMMON.getVal()) && (Func.isEmpty(object.getObjectDangers()) || object.getObjectDangers().size() == 0)){ - throw new ServiceException("对象告警list为空"); - } - objectService.saveOrUpdate(object); - objectDangerService.remove(Wrappers.lambdaQuery().eq(ObjectDangerEntity::getObjectId, object.getId())); - List objectDangers = object.getObjectDangers(); - if(CollectionUtil.isNotEmpty(objectDangers)){ - objectDangers.stream().forEach(e -> { - e.setObjectId(object.getId()); - }); - objectDangerService.saveBatch(objectDangers); - } - return R.success("操作成功!"); + return R.data(objectService.submit(object)); } @PostMapping("/saveBatch") diff --git a/hzims-service/inspect/src/main/resources/db/1.0.1.sql b/hzims-service/inspect/src/main/resources/db/1.0.1.sql new file mode 100644 index 0000000..729823c --- /dev/null +++ b/hzims-service/inspect/src/main/resources/db/1.0.1.sql @@ -0,0 +1,58 @@ +-- 创建巡检内容定义表结构 +CREATE TABLE IF NOT EXISTS `hz_st_re_content_definition` ( + `ID` bigint(64) NOT NULL COMMENT 'ID', + `CODE` varchar(18) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '内容编码:由系统自动生成自动生成', + `NAME` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '内容名称', + `DESCRIPTION` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '内容描述', + `RECORD_TYPE` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '记录类型 0不记录 1仅选择 2仅记值 3选择并记值', + `CHECK_TYPE` char(2) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '检测类型 原来数据字典 暂时设计只支持99个类型', + `CREATE_USER` bigint(64) NULL DEFAULT NULL COMMENT '创建人', + `CREATE_DEPT` bigint(64) NULL DEFAULT NULL COMMENT '创建部门', + `CREATE_TIME` datetime NULL DEFAULT NULL COMMENT '创建时间', + `UPDATE_USER` bigint(64) NULL DEFAULT NULL COMMENT '修改人', + `UPDATE_TIME` datetime NULL DEFAULT NULL COMMENT '修改时间', + `STATUS` int(2) NULL DEFAULT 0 COMMENT '状态', + `IS_DELETED` int(2) NOT NULL DEFAULT 0 COMMENT '是否已删除', + `TENANT_ID` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '租户', + `CLOCK_ID` bigint(20) NULL DEFAULT NULL COMMENT '表针识别,表盘ID', + `CAMERA_ID` bigint(20) NULL DEFAULT NULL COMMENT '视频巡检摄像机ID', + `DICT_TYPE` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '记值方式为选择时选择值', + `UP_LIMIT` double NULL DEFAULT NULL COMMENT '上限值', + `DOWN_LIMIT` double NULL DEFAULT NULL COMMENT '下限值', + `SUGGESTION` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '问题排除建议', + `SORT` int(11) NULL DEFAULT 0 COMMENT '排序', + `SUPPORT_AUTO_VIDEO` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '是支持的巡检类型 0普通巡检 1视频自动巡检 2机器人巡检', + `CHECK_TYPE_SON` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '存字典表key 检测类型子类 子类的子类通过-隔开例如:1-12', + `CAMERA_ADDR` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '开关/灯/表盘在摄像机可视面二维坐标位置 例如:2 1 表示第三行第二列 行列均从0开始记录 默认 0 0 如果有多张图则:0 0 1( 最后一位表示所在图片 最后一位1表示第二张图) 默认0 0 0', + `OTHER_PARAM` varchar(1024) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '其他参数 例如多联断路器内断路器的个数', + `CHECK_VAL` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '校验值 用来判断当前值是否正确:枚举数据通过 “ ”隔开 区间通过~隔开', + PRIMARY KEY (`ID`) USING BTREE, + UNIQUE INDEX `UK_OBJECT_CONTENT_CODE`(`CODE`) USING BTREE, + INDEX `idx_is_deleted_tenant_id`(`IS_DELETED`, `TENANT_ID`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '巡检对象内容' ROW_FORMAT = Dynamic; +SET FOREIGN_KEY_CHECKS = 1; + +-- 巡检内容定义添加物模型标识字段 +alter table hz_st_re_content add COLUMN `model_signage` VARCHAR(64) comment '模型标识'; +-- 巡检内容定义添加物模型属性标识字段 +alter table hz_st_re_content add COLUMN `attr_signage` VARCHAR(50) comment '属性标识'; +-- 巡检内容定义添加物模型属性名称字段 +alter table hz_st_re_content add COLUMN `attr_name` VARCHAR(64) comment '属性名称'; + +-- 设备巡检内容添加物模型标识字段 +alter table hz_st_re_content add COLUMN `model_signage` VARCHAR(64) comment '模型标识'; +-- 设备巡检内容添加物模型属性标识字段 +alter table hz_st_re_content add COLUMN `attr_signage` VARCHAR(50) comment '属性标识'; +-- 设备巡检内容添加物模型属性名称字段 +alter table hz_st_re_content add COLUMN `attr_name` VARCHAR(64) comment '属性名称'; +-- 设备巡检内容添加采集点ID字段 +alter table hz_st_re_content add COLUMN `fac_device_id` VARCHAR(64) comment '关联的hz3000设备id'; +-- 设备巡检内容添加采集点名称字段 +alter table hz_st_re_content add COLUMN `fac_device_name` VARCHAR(64) comment '关联的hz3000设备名称'; + +-- 设备巡检项目添加设备编号字段 +alter table hz_st_re_project add COLUMN `em_code` VARCHAR(50) comment '设备编号'; + +-- 设备巡检对象添加设备字段 +alter table hz_st_re_object add COLUMN `em_codes` VARCHAR(255) comment '设备编号,按逗号分隔'; + diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/controller/ImsDutyMainController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/controller/ImsDutyMainController.java index 7ec8515..5382e24 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/controller/ImsDutyMainController.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/controller/ImsDutyMainController.java @@ -1,7 +1,6 @@ package com.hnac.hzims.operational.duty.controller; import com.alibaba.excel.EasyExcel; -import com.alibaba.excel.util.DateUtils; import com.baomidou.mybatisplus.core.metadata.IPage; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.hnac.hzims.common.logs.annotation.OperationAnnotation; @@ -32,7 +31,6 @@ import javax.validation.Valid; import java.io.IOException; import java.net.URLEncoder; import java.nio.charset.StandardCharsets; -import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -220,10 +218,21 @@ public class ImsDutyMainController extends BladeController { @GetMapping("/exportDuty") @ApiOperation(value = "导出排班计划") - public void exportTemplate(HttpServletResponse response, Integer year, Integer month, Long deptId) throws IOException { + public void exportTemplate(HttpServletResponse response, String time, Long deptId) throws IOException { + Integer year; + Integer month; if (Func.isEmpty(deptId)) { deptId = Long.valueOf(AuthUtil.getDeptId()); } + if (Func.isEmpty(time)) { + Date date = new Date(); + year = date.getYear(); + month = date.getMonth()+1; + }else { + String[] split = time.split("-"); + year=Integer.valueOf(split[0]); + month=Integer.valueOf(split[1]); + } List list = imsDutyMainService.getExcelDutyData(year, month, deptId); String deptName = sysClient.getDeptName(deptId).getData(); diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/StationAttributeController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/StationAttributeController.java index eede11e..0f6a0d0 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/StationAttributeController.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/StationAttributeController.java @@ -91,12 +91,13 @@ public class StationAttributeController extends BladeController { return R.status(stationAttributeService.deleteLogic(Func.toLongList(ids))); } - @PutMapping("/bandingMonitor") + @GetMapping("/bandingMonitor") @ApiOperation("根据设备编码更新集中监控监测点绑定") @ApiOperationSupport(order = 4) - public R> bandingMonitor(@ApiParam(value = "设备编码",required = true) String emCode, + public R> bandingMonitor(@ApiParam(value = "站点编码",required = true) String stationCode, + @ApiParam(value = "设备编码",required = true) String emCode, @ApiParam(value = "站点类型",required = true) String stationType, - @ApiParam(value = "设备类型",required = true) String emType) { - return R.data(stationAttributeService.bandingMonitor(emCode,stationType,emType)); + @ApiParam(value = "机组类型",required = true) String setType) { + return R.data(stationAttributeService.bandingMonitor(stationCode,emCode,stationType,setType)); } } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/IStationAttributeService.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/IStationAttributeService.java index d3ecdb8..9f0bdff 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/IStationAttributeService.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/IStationAttributeService.java @@ -45,5 +45,5 @@ public interface IStationAttributeService extends BaseService bandingMonitor(String emCode,String stationType,String emType); + List bandingMonitor(String stationCode,String emCode,String stationType,String setType); } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationAttributeServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationAttributeServiceImpl.java index e9dd316..5b6f614 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationAttributeServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationAttributeServiceImpl.java @@ -39,6 +39,7 @@ import org.springframework.util.Assert; import java.util.*; import java.util.function.Function; import java.util.stream.Collectors; +import java.util.stream.Stream; /** * @author hx @@ -209,13 +210,14 @@ public class StationAttributeServiceImpl extends BaseServiceImpl bandingMonitor(String emCode,String stationType,String emType) { + public List bandingMonitor(String stationCode,String emCode,String stationType,String setType) { List result; // 获取集中监控属性配置 List attributes = attributeService.list(Wrappers.lambdaQuery() .eq(FocusAttributeEntity::getDomainId, stationType) - .eq(FocusAttributeEntity::getGroupId, emType) + .eq(FocusAttributeEntity::getGroupId, setType) .eq(FocusAttributeEntity::getStatus, 0) + .orderByAsc(FocusAttributeEntity::getSort) ); // 标识 List signages = attributes.stream().map(FocusAttributeEntity::getSignage).filter(Func::isNotEmpty).collect(Collectors.toList()); @@ -225,19 +227,65 @@ public class StationAttributeServiceImpl extends BaseServiceImpl> deviceChildrenListResult = deviceClient.getRealId(deviceChildrenDTO); - boolean facAttrFlag = deviceChildrenListResult.isSuccess() && CollectionUtil.isNotEmpty(deviceChildrenListResult.getData()); - // 根据集中监控属性配置获取站点集中监控属性配置 - Function convert = focusAttr -> { - StationAttributeVo vo = BeanUtil.copy(focusAttr,StationAttributeVo.class); - if(facAttrFlag) { - List data = deviceChildrenListResult.getData(); - Optional facAttrOptional = data.stream().filter(attr -> focusAttr.getSignage().equals(attr.getSignage())).findAny(); - vo.setMonitorId(facAttrOptional.map(DeviceChildrenVO::getRealId).orElse(null)); - vo.setMonitorName(facAttrOptional.map(DeviceChildrenVO::getName).orElse(null)); - } - return vo; - }; - result = attributes.stream().map(convert).collect(Collectors.toList()); + List modelAttr = deviceChildrenListResult.isSuccess() && CollectionUtil.isNotEmpty(deviceChildrenListResult.getData()) + ? deviceChildrenListResult.getData() : new ArrayList<>(); + // 获取 + LambdaQueryWrapper queryWrapper = Wrappers.lambdaQuery() + .eq(StationAttributeEntity::getStationId, stationCode) + .eq(StationAttributeEntity::getEmCode, emCode); + List stationAttrList = this.list(queryWrapper); + result = attributes.stream().map(focusAttr -> this.fillFacAttr(modelAttr,focusAttr,stationCode,emCode)) + .map(stationAttr -> this.fillAttrId(stationAttrList,stationAttr)) + .sorted(Comparator.comparing(StationAttributeVo::getSort,Comparator.nullsLast(Integer::compareTo))) + .collect(Collectors.toList()); + // 排序完成之后循环赋值 + Stream.iterate(1,n -> n+1).limit(result.size()).forEach(index -> result.get(index-1).setSort(index)); return result; } + + /** + * 根据请求设备实例物模型属性填充集中监控属性配置采集点 + * @param modelAttr 设备实例物模型属性 + * @param focusAttr 集中监控属性配置 + * @return + */ + private StationAttributeVo fillFacAttr(List modelAttr,FocusAttributeEntity focusAttr,String stationCode,String emCode) { + StationAttributeVo vo = BeanUtil.copy(focusAttr,StationAttributeVo.class); + Optional facAttrOptional = modelAttr.stream().filter(attr -> focusAttr.getSignage().equals(attr.getSignage())).findAny(); + vo.setMonitorId(facAttrOptional.map(DeviceChildrenVO::getRealId).orElse(null)); + vo.setMonitorName(facAttrOptional.map(DeviceChildrenVO::getFacName).orElse(null)); + vo.setStationId(stationCode); + vo.setEmCode(emCode); + vo.setEnableShow(true); + vo.setId(null); + vo.setCreateUser(null); + vo.setCreateDept(null); + vo.setCreateTime(null); + vo.setUpdateTime(null); + vo.setUpdateUser(null); + return vo; + } + + /** + * 填充属性ID + * @param stationAttrList 已保存进数据库的记录 + * @param stationAttr 填充采集点后的属性模板 + * @return + */ + private StationAttributeVo fillAttrId(List stationAttrList,StationAttributeVo stationAttr) { + if(CollectionUtil.isNotEmpty(stationAttrList)) { + Optional attribute = stationAttrList.stream().filter(sa -> stationAttr.getAttributes().equals(sa.getAttributes())).findAny(); + if(attribute.isPresent()) { + StationAttributeVo result = BeanUtil.copy(attribute.get(),StationAttributeVo.class); + result.setSignage(stationAttr.getSignage()); + result.setSignageName(stationAttr.getSignageName()); + result.setMonitorId(stationAttr.getMonitorId()); + result.setMonitorName(stationAttr.getMonitorName()); + result.setUpdateUser(null); + result.setUpdateTime(null); + return result; + } + } + return stationAttr; + } } diff --git a/hzims-service/operational/src/main/resources/db/1.0.1.sql b/hzims-service/operational/src/main/resources/db/1.0.1.sql new file mode 100644 index 0000000..6204f7b --- /dev/null +++ b/hzims-service/operational/src/main/resources/db/1.0.1.sql @@ -0,0 +1,2 @@ +-- 站点表添加是否为国外 +alter table `hzims_station` add column `is_abroad` TINYINT NULL comment '站点是否为国外 1:是;0:否'; \ No newline at end of file