Browse Source

Merge remote-tracking branch 'origin/master'

zhongwei
yang_shj 1 year ago
parent
commit
e1008623e5
  1. 4
      hzims-biz-common/pom.xml
  2. 47
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/vo/FdpFaultRealDataVO.java
  3. 30
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/entity/OperDefectEntity.java
  4. 8
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/entity/OperDefectStatisticsEntity.java
  5. 8
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/entity/OperPhenomenonEntity.java
  6. 4
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/entity/StationEntity.java
  7. 20
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/Constants.java
  8. 49
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/ObjectConstants.java
  9. 17
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/dto/ContentDTO.java
  10. 26
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/dto/ContentDefinitionDTO.java
  11. 27
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/dto/ProjectDTO.java
  12. 92
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/entity/ContentDefinitionEntity.java
  13. 14
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/entity/ContentEntity.java
  14. 3
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/entity/ProjectEntity.java
  15. 25
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/feign/IContentClient.java
  16. 63
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/feign/IContentDefinitionClient.java
  17. 29
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/feign/IProjectClient.java
  18. 29
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/vo/ContentDefinitionVO.java
  19. 23
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/vo/ContentVO.java
  20. 29
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/wrapper/ContentDefinitionWrapper.java
  21. 26
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/wrapper/ContentWrapper.java
  22. 3
      hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/controller/FdpMonitorController.java
  23. 2
      hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/IFdpMonitorService.java
  24. 57
      hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpMonitorServiceImpl.java
  25. 2
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/MiddleApplication.java
  26. 4
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/controller/SysLogController.java
  27. 3
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/entity/Statistics.java
  28. 4
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/entity/SysLog.java
  29. 2
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/mapper/StatisticsMapper.java
  30. 8
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/mapper/StatisticsMapper.xml
  31. 10
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/mapper/SysLogMapper.java
  32. 34
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/mapper/SysLogMapper.xml
  33. 3
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/service/SysLogService.java
  34. 10
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/service/impl/StatisticsServiceImpl.java
  35. 2
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/service/impl/SysLogServiceImpl.java
  36. 10
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/dao/ContentDefinitionMapper.java
  37. 4
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/entity/ObjectEntity.java
  38. 36
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/feign/ContentClient.java
  39. 61
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/feign/ContentDefinitionClient.java
  40. 35
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/feign/ProjectClient.java
  41. 10
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/mapper/ContentDefinitionMapper.java
  42. 19
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/IContentDefinitionService.java
  43. 7
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/ObjectService.java
  44. 15
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/ProjectService.java
  45. 46
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/impl/ContentDefinitionServiceImpl.java
  46. 78
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/impl/ObjectServiceImpl.java
  47. 63
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/impl/ProjectServiceImpl.java
  48. 51
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/web/ContentDefinitionController.java
  49. 17
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/web/ObjectController.java
  50. 58
      hzims-service/inspect/src/main/resources/db/1.0.1.sql
  51. 15
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/controller/ImsDutyMainController.java
  52. 9
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/StationAttributeController.java
  53. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/IStationAttributeService.java
  54. 78
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationAttributeServiceImpl.java
  55. 2
      hzims-service/operational/src/main/resources/db/1.0.1.sql

4
hzims-biz-common/pom.xml

@ -22,6 +22,10 @@
<artifactId>blade-core-auto</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springblade</groupId>
<artifactId>blade-common</artifactId>
</dependency>
<!--Json 工具 Start-->
<dependency>
<groupId>com.alibaba</groupId>

47
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<String> real;
@ApiModelProperty("实时数据时间,如果MULTI是“单”则为数值,MULTI是“多”则为数组")
private List<Date> realTime;
}

30
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;
}

8
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;
/**

8
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;
/**
* 实际开始时间

4
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;
}

20
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;
}
}
}

49
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;
}
}

17
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 {
}

26
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;
}

27
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<ContentDTO> contentDTOList;
}

92
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;
}

14
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/entity/ContentEntity.java → 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;
}

3
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/entity/ProjectEntity.java → 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;
}

25
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<ContentVO> detail(Long id);
}

63
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<ContentDefinitionVO> detail(@RequestParam Long id);
/**
* 批量保存巡检内容定义
* @param request ContentDefinitionDTO列表
* @return
*/
@PostMapping(SAVE_BATCH)
R<Boolean> saveBatch(@RequestBody List<ContentDefinitionDTO> request);
/**
* 查询列表
* @param request 筛选条件
* @return
*/
@GetMapping(LIST)
R<List<ContentDefinitionVO>> list(ContentDefinitionDTO request);
/**
* 批量更新
* @param request
* @return
*/
@GetMapping(SAVE_OR_UPDATE_BATCH)
R<Boolean> saveOrUpdateBatch(List<ContentDefinitionDTO> request);
}

29
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<Boolean> addProjectAndContent(@RequestBody @Valid List<ProjectDTO> request);
}

29
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;
}

23
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 {
}

29
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<ContentDefinitionEntity, ContentDefinitionVO> {
public static ContentDefinitionWrapper build() {
return new ContentDefinitionWrapper();
}
@Override
public ContentDefinitionVO entityVO(ContentDefinitionEntity entity) {
ContentDefinitionVO definitionVO = BeanUtil.copy(entity, ContentDefinitionVO.class);
return definitionVO;
}
}

26
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<ContentEntity, ContentVO> {
public static ContentWrapper build() {
return new ContentWrapper();
}
@Override
public ContentVO entityVO(ContentEntity entity) {
ContentVO contentVO = BeanUtil.copy(entity, ContentVO.class);
return contentVO;
}
}

3
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")

2
hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/IFdpMonitorService.java

@ -97,7 +97,7 @@ public interface IFdpMonitorService extends BaseService<FdpMonitorEntity> {
Map<String,Object> dataBack(String faultId);
R dataBackV2(String faultId);
Map<String,Object> monthlyDataBack(DataBackVo vo);
/**

57
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<FdpMonitorMapper, Fdp
@Value("${url.updateFaultState_All}")
public String updateFaultStateAll;
@Value("${url.getRealByFault}")
public String getRealByFault;
@Value("${hzims.equipment.fdp.fdpReturnValuePath}")
public String fdpReturnValuePath;
@ -805,8 +808,56 @@ public class FdpMonitorServiceImpl extends BaseServiceImpl<FdpMonitorMapper, Fdp
}
return vo;
}
@Override
public R dataBackV2(String faultId) {
Map<String, Object> resultMap = new HashMap<>();
resultMap.put("faultId", faultId);
String post = HttpRequestUtil.postCallObjectParam(resultMap, getRealByFault, "POST");
FdpHttpResponseVo fdpHttpResponseVo = JSONObject.parseObject(post, new TypeReference<FdpHttpResponseVo>() {});
if (1==fdpHttpResponseVo.getSuccess()) {
if (Func.isNotEmpty(fdpHttpResponseVo.getData())) {
List<FdpFaultRealDataVO> list = JSONObject.parseObject(fdpHttpResponseVo.getData(), new TypeReference<List<FdpFaultRealDataVO>>() {});
if (CollectionUtil.isEmpty(list)){
return R.success("暂无数据,请稍后重试");
}
List<FdpFaultRealDataVO> 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<String, Object> dataBack(String faultId) {
//根据故障ID查询监测点列表

2
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 {

4
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);

3
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;

4
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;

2
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;
/**
* <p>

8
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/mapper/StatisticsMapper.xml

@ -5,6 +5,14 @@
<select id="selectPages" resultType="com.hnac.hzims.middle.systemlog.vo.StatisticsResponseVo">
select module_name moduleName, sum(module_name_num) moduleNameNum
from hzims_statistics
<where>
<if test="statistics.createTime != null">
date_format(date_calculated,'%Y-%m-%d') &gt;= #{statistics.createTime}
</if>
<if test="statistics.endTime != null">
and date_format(date_calculated,'%Y-%m-%d') &lt;= #{statistics.endTime}
</if>
</where>
group by module_name;
</select>
</mapper>

10
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<SysLog> {
* @return
*/
IPage<StatisticsTitleResponseVo> statisticsTitleByModuleName(Page<StatisticsTitleResponseVo> moduleName, @Param("statisticsVo") StatisticsVo statisticsVo);
/**
* 根据Id获取日志数据
* @param id
* @return
*/
SysLog getSysLogById(@Param("id") Long id);
}

34
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/mapper/SysLogMapper.xml

@ -35,4 +35,38 @@
group by title;
</select>
<select id="getSysLogById" resultType="com.hnac.hzims.middle.systemlog.entity.SysLog">
select id,
tenant_id,
server_ip,
server_host,
server_name,
env,
operation_user_id,
operation_user_name,
path,
user_agent,
method,
method_class,
method_name,
cost_time,
parameter,
module_name,
title,
action,
operator_type,
business_type,
json_result,
local_ip,
error_msg,
operation_time,
status,
create_time,
update_time,
is_deleted
from hzims_sys_log
where id = #{id}
</select>
</mapper>

3
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/service/SysLogService.java

@ -46,4 +46,7 @@ public interface SysLogService extends IService<SysLog> {
*/
IPage<StatisticsTitleResponseVo> statisticsTitleByModuleName(Page<StatisticsTitleResponseVo> statisticsTitleResponseVoPage,
StatisticsVo statisticsVo);
}

10
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<StatisticsMapper, Statist
@Autowired
private SysLogService sysLogService;
@Autowired
private StatisticsService statisticsService;
/**
* 保存统计的数据
*/
@ -55,18 +51,18 @@ public class StatisticsServiceImpl extends ServiceImpl<StatisticsMapper, Statist
continue;
}
//查询数据
Statistics statistics = statisticsService.getStatisticsBydateCalculated(sysLogStatisticsVo);
Statistics statistics = this.getStatisticsBydateCalculated(sysLogStatisticsVo);
//如果为空保存数据,如果不为空更新数据
if (statistics == null) {
statistics = new Statistics();
statistics.setDateCalculated(sysLogStatisticsVo.getOperationTime());
statistics.setModuleNameNum(sysLogStatisticsVo.getModuleNameCount());
statistics.setModuleName(sysLogStatisticsVo.getModuleName());
statisticsService.save(statistics);
this.save(statistics);
} else {
statistics.setModuleName(sysLogStatisticsVo.getModuleName());
statistics.setModuleNameNum(sysLogStatisticsVo.getModuleNameCount());
statisticsService.updateById(statistics);
this.updateById(statistics);
}
}
}

2
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/service/impl/SysLogServiceImpl.java

@ -67,6 +67,8 @@ public class SysLogServiceImpl extends ServiceImpl<SysLogMapper, SysLog> impleme
}
/**
* 日志查询接口
* @param sysLog

10
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<ContentDefinitionEntity> {
}

4
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<DangerSourceEntity> dangerSources;
@ApiModelProperty(value = "设备编号,按逗号分隔")
@QueryField(condition = SqlCondition.LIKE)
private String emCodes;
}

36
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<ContentVO> detail(Long id) {
ContentEntity entity = contentService.getById(id);
return R.data(Optional.ofNullable(entity).map(content -> ContentWrapper.build().entityVO(content)).orElse(null));
}
}

61
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<ContentDefinitionVO> 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<Boolean> saveBatch(@RequestBody List<ContentDefinitionDTO> request) {
List<ContentDefinitionEntity> list = JSONArray.parseArray(JSON.toJSONString(request), ContentDefinitionEntity.class);
return R.data(contentDefinitionService.saveBatch(list));
}
@Override
@GetMapping(LIST)
public R<List<ContentDefinitionVO>> list(ContentDefinitionDTO request) {
return R.data(contentDefinitionService.list(request));
}
@Override
@PostMapping(SAVE_OR_UPDATE_BATCH)
public R<Boolean> saveOrUpdateBatch(List<ContentDefinitionDTO> request) {
List<ContentDefinitionEntity> list = JSONArray.parseArray(JSON.toJSONString(request), ContentDefinitionEntity.class);
return R.data(contentDefinitionService.saveOrUpdateBatch(list));
}
}

35
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<Boolean> addProjectAndContent(@RequestBody @Valid List<ProjectDTO> request) {
return R.data(projectService.addProjectAndContent(request));
}
}

10
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<ContentDefinitionEntity> {
}

19
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<ContentDefinitionEntity> {
/**
* 根据筛选条件获取列表
* @param request 筛选条件
* @return
*/
List<ContentDefinitionVO> list(ContentDefinitionDTO request);
}

7
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/ObjectService.java

@ -49,4 +49,11 @@ public interface ObjectService extends BaseService<ObjectEntity> {
void previewQrCode(Long objectId);
List<ObjectOfflineVO> getReDbjectData(String tenantId);
/**
* 新增或修改巡检对象
* @param object
* @return
*/
Boolean submit(ObjectEntity object);
}

15
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<ProjectEntity>{
List<ProjectOfflineVO> getProjectData(String tenantId);
/**
* 获取巡检项目目前筛选条件只支持emCode查询想添加条件需自行在Entity内添加QueryField注解
* @param req 筛选条件
* @return
*/
ProjectEntity getOne(ProjectEntity req);
/**
* 新增设备巡检项目以及设备巡检内容以及两者之间的绑定关系
* @param request 设备巡检项目DTO
* @return
*/
Boolean addProjectAndContent(List<ProjectDTO> request);
}

46
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<ContentDefinitionMapper, ContentDefinitionEntity>
implements IContentDefinitionService {
@Override
public List<ContentDefinitionVO> list(ContentDefinitionDTO request) {
QueryWrapper<ContentDefinitionEntity> queryWrapper = Condition.getQueryWrapper(BeanUtil.copy(request, ContentDefinitionEntity.class));
LambdaQueryWrapper<ContentDefinitionEntity> lambda = queryWrapper.lambda();
lambda.in(StringUtil.isNotBlank(request.getIds()),ContentDefinitionEntity::getId,Func.toLongList(",",request.getIds()));
return ContentDefinitionWrapper.build().listVO(this.list(lambda));
}
}

78
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<InspectObjectMapper, Obje
private ProjectContentService projectContentService;
@Autowired
private TemplateProjectService templateProjectService;
@Autowired
private IObjectDangerService objectDangerService;
@Autowired
private ProjectService projectService;
/** pdf文件存储路径 */
@Value("${hzinfo.task.pdf.file-path}")
@ -201,6 +212,65 @@ public class ObjectServiceImpl extends BaseServiceImpl<InspectObjectMapper, Obje
return this.baseMapper.getReDbjectData(tenantId);
}
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean submit(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为空");
}
Assert.isTrue(this.saveOrUpdate(object),() -> {
throw new ServiceException("保存巡检对象失败!");
});
objectDangerService.remove(Wrappers.<ObjectDangerEntity>lambdaQuery().eq(ObjectDangerEntity::getObjectId, object.getId()));
List<ObjectDangerEntity> 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<String> emCodeList = Func.toStrList(",", object.getEmCodes());
Function<Integer,TemplateProjectEntity> 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<TemplateProjectEntity> templateProjectList = Stream.iterate(0,n -> n + 1).limit(emCodeList.size())
.map(getTemplateProjectByEmCode).collect(Collectors.toList());
templateProjectService.saveBatch(templateProjectList);
}
}
/**
* 导出巡检对象为 PDF
* @return pdf 文件路径

63
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<ProjectMapper, ProjectEntity> 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<ProjectMapper, ProjectEn
public List<ProjectOfflineVO> getProjectData(String tenantId) {
return this.baseMapper.getProjectData(tenantId);
}
@Override
public ProjectEntity getOne(ProjectEntity req) {
LambdaQueryWrapper<ProjectEntity> queryWrapper = Condition.getQueryWrapper(req).lambda();
queryWrapper.eq(Func.isNotEmpty(req.getStatus()),ProjectEntity::getStatus,req.getStatus());
List<ProjectEntity> 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<ProjectDTO> 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<ContentDTO> contentDTOList = projectDTO.getContentDTOList();
contentDTOList.forEach(contentDTO -> contentDTO.setCode(CodeUtils.randomCode()));
List<ContentEntity> contentEntityList = JSONArray.parseArray(JSON.toJSONString(contentDTOList),ContentEntity.class);
if(contentService.saveBatch(contentEntityList)) {
// 保存巡检内容以及巡检项目的绑定关系
List<ProjectContentEntity> 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;
}
}

51
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<IPage<ContentDefinitionVO>> page(ContentDefinitionDTO content, Query query) {
QueryWrapper<ContentDefinitionEntity> 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);
}
}

17
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<Boolean> 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.<ObjectDangerEntity>lambdaQuery().eq(ObjectDangerEntity::getObjectId, object.getId()));
List<ObjectDangerEntity> 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")

58
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 '设备编号,按逗号分隔';

15
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<ImsDutyMainReportExcel> list = imsDutyMainService.getExcelDutyData(year, month, deptId);
String deptName = sysClient.getDeptName(deptId).getData();

9
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<List<StationAttributeVo>> bandingMonitor(@ApiParam(value = "设备编码",required = true) String emCode,
public R<List<StationAttributeVo>> 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));
}
}

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/IStationAttributeService.java

@ -45,5 +45,5 @@ public interface IStationAttributeService extends BaseService<StationAttributeEn
*/
void removeByStationCode(String stationCode);
List<StationAttributeVo> bandingMonitor(String emCode,String stationType,String emType);
List<StationAttributeVo> bandingMonitor(String stationCode,String emCode,String stationType,String setType);
}

78
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<StationAttribut
* @return
*/
@Override
public List<StationAttributeVo> bandingMonitor(String emCode,String stationType,String emType) {
public List<StationAttributeVo> bandingMonitor(String stationCode,String emCode,String stationType,String setType) {
List<StationAttributeVo> result;
// 获取集中监控属性配置
List<FocusAttributeEntity> attributes = attributeService.list(Wrappers.<FocusAttributeEntity>lambdaQuery()
.eq(FocusAttributeEntity::getDomainId, stationType)
.eq(FocusAttributeEntity::getGroupId, emType)
.eq(FocusAttributeEntity::getGroupId, setType)
.eq(FocusAttributeEntity::getStatus, 0)
.orderByAsc(FocusAttributeEntity::getSort)
);
// 标识
List<String> signages = attributes.stream().map(FocusAttributeEntity::getSignage).filter(Func::isNotEmpty).collect(Collectors.toList());
@ -225,19 +227,65 @@ public class StationAttributeServiceImpl extends BaseServiceImpl<StationAttribut
deviceChildrenDTO.setDeviceCode(emCode);
deviceChildrenDTO.setType("attr");
Result<List<DeviceChildrenVO>> deviceChildrenListResult = deviceClient.getRealId(deviceChildrenDTO);
boolean facAttrFlag = deviceChildrenListResult.isSuccess() && CollectionUtil.isNotEmpty(deviceChildrenListResult.getData());
// 根据集中监控属性配置获取站点集中监控属性配置
Function<FocusAttributeEntity,StationAttributeVo> convert = focusAttr -> {
StationAttributeVo vo = BeanUtil.copy(focusAttr,StationAttributeVo.class);
if(facAttrFlag) {
List<DeviceChildrenVO> data = deviceChildrenListResult.getData();
Optional<DeviceChildrenVO> 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<DeviceChildrenVO> modelAttr = deviceChildrenListResult.isSuccess() && CollectionUtil.isNotEmpty(deviceChildrenListResult.getData())
? deviceChildrenListResult.getData() : new ArrayList<>();
// 获取
LambdaQueryWrapper<StationAttributeEntity> queryWrapper = Wrappers.<StationAttributeEntity>lambdaQuery()
.eq(StationAttributeEntity::getStationId, stationCode)
.eq(StationAttributeEntity::getEmCode, emCode);
List<StationAttributeEntity> 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<DeviceChildrenVO> modelAttr,FocusAttributeEntity focusAttr,String stationCode,String emCode) {
StationAttributeVo vo = BeanUtil.copy(focusAttr,StationAttributeVo.class);
Optional<DeviceChildrenVO> 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<StationAttributeEntity> stationAttrList,StationAttributeVo stationAttr) {
if(CollectionUtil.isNotEmpty(stationAttrList)) {
Optional<StationAttributeEntity> 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;
}
}

2
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:否';
Loading…
Cancel
Save