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-biz-common/src/main/java/com/hnac/hzims/common/pojo/ProcessWorkFlowResponse.java b/hzims-biz-common/src/main/java/com/hnac/hzims/common/pojo/ProcessWorkFlowResponse.java new file mode 100644 index 0000000..5f318b5 --- /dev/null +++ b/hzims-biz-common/src/main/java/com/hnac/hzims/common/pojo/ProcessWorkFlowResponse.java @@ -0,0 +1,46 @@ +package com.hnac.hzims.common.pojo; + +import lombok.Data; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; + +/** + * @ClassName ProcessWorkFlowResponse + * @description: + * @author: hx + * @create: 2023-06-07 19:39 + * @Version 4.0 + **/ +@Data +public class ProcessWorkFlowResponse implements Serializable { + + /**当前任务ID**/ + private String taskId; + + /**当前任务名称**/ + private String taskName; + + /**当前环节流程ID**/ + @NotNull + private String processDefinitionKey; + + /** 业务Id **/ + private String businessKey; + + /** 流程实例key **/ + private String processInstanceId; + + /** 下一环节处理人 **/ + private String nextStepOperator; + + /** 票据表单 **/ + private Object variables; + + /** 根据handleType区分是用户还是候选组角色 标识 0是用户 1是角色 **/ + private String handleType; + + + /** 用户Id **/ + private String userId; +} 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..c2511f5 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"; + public final static String APP_NAME = "hzinfo-inspect-hx"; + + /** + * 巡检类型, 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..e3372eb 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/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 '设备编号,按逗号分隔'; +