From c178f4c6485b950eb4a42161acafcc4279d34721 Mon Sep 17 00:00:00 2001 From: haungxing <1203316822@qq.com> Date: Tue, 4 Jul 2023 10:31:33 +0800 Subject: [PATCH 1/4] =?UTF-8?q?#=20=E6=B7=BB=E5=8A=A0=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E5=B7=A1=E6=A3=80=E5=86=85=E5=AE=B9=E6=89=B9=E9=87=8F=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E7=9A=84feign=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hnac/hzinfo/inspect/obj/feign/IContentClient.java | 16 +++++++++++++++- .../com/hnac/hzinfo/inspect/obj/feign/ContentClient.java | 10 ++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) 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 index 711100b..e0557d0 100644 --- 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 @@ -1,16 +1,22 @@ package com.hnac.hzinfo.inspect.obj.feign; import com.hnac.hzinfo.inspect.Constants; +import com.hnac.hzinfo.inspect.obj.dto.ContentDTO; 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; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; + +import java.util.List; @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 UPDATE_BATCH = API_PREFIX + "/detail"; + String SAVE_BATCH = API_PREFIX + "/updateBatch"; String LIST = API_PREFIX + "/list"; String SAVE_OR_UPDATE_BATCH = API_PREFIX + "/saveOrUpdateBatch"; @@ -22,4 +28,12 @@ public interface IContentClient { @GetMapping(DETAIL) R detail(Long id); + /** + * 批量更新巡检内容 + * @param request 巡检内容列表 + * @return + */ + @PutMapping(UPDATE_BATCH) + R updateBatch(@RequestBody List request); + } 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 index 31e287e..2bb040a 100644 --- 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 @@ -1,5 +1,8 @@ package com.hnac.hzinfo.inspect.obj.feign; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.hnac.hzinfo.inspect.obj.dto.ContentDTO; import com.hnac.hzinfo.inspect.obj.entity.ContentEntity; import com.hnac.hzinfo.inspect.obj.services.ContentService; import com.hnac.hzinfo.inspect.obj.vo.ContentVO; @@ -10,6 +13,7 @@ import org.springblade.core.boot.ctrl.BladeController; import org.springblade.core.tool.api.R; import org.springframework.web.bind.annotation.RestController; +import java.util.List; import java.util.Optional; /** @@ -32,5 +36,11 @@ public class ContentClient extends BladeController implements IContentClient { return R.data(Optional.ofNullable(entity).map(content -> ContentWrapper.build().entityVO(content)).orElse(null)); } + @Override + public R updateBatch(List request) { + List contentList = JSONArray.parseArray(JSON.toJSONString(request), ContentEntity.class); + return R.data(contentService.updateBatchById(contentList)); + } + } From 32ad7b8ff65622b54d1fb30bafc2d2758959566b Mon Sep 17 00:00:00 2001 From: tyty Date: Tue, 4 Jul 2023 13:59:57 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E6=99=BA=E8=83=BD=E8=AF=8A=E6=96=AD-?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=BA=AF=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hnac/hzims/fdp/dto/FdpFaultRealDataDTO.java | 51 ++++++++++++++++++++++ .../com/hnac/hzims/fdp/vo/FdpFaultRealDataVO.java | 9 ++-- .../fdp/service/impl/FdpMonitorServiceImpl.java | 35 ++++++--------- 3 files changed, 70 insertions(+), 25 deletions(-) create mode 100644 hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/dto/FdpFaultRealDataDTO.java diff --git a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/dto/FdpFaultRealDataDTO.java b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/dto/FdpFaultRealDataDTO.java new file mode 100644 index 0000000..ad6d7cd --- /dev/null +++ b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/dto/FdpFaultRealDataDTO.java @@ -0,0 +1,51 @@ +package com.hnac.hzims.fdp.dto; + +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 FdpFaultRealDataDTO { + + private static final long serialVersionUID = 1L; + + /** + * 监测点ID + */ + @ApiModelProperty("监测点ID") + private String monitorId; + + @ApiModelProperty("监测点名称") + private String name; + @ApiModelProperty("位置") + private String ord; + @ApiModelProperty("单代表对应一个实时数据,多代表对应一组实时数据") + private String multi; + @ApiModelProperty("数据的物模型id") + private String instance; + @ApiModelProperty("数据的物模型属性:如果multi是“多”,则包含该字符串起始的所有属性") + private String identifier; + @ApiModelProperty("物模型是否开机:无法获取当作开机处理") + private Boolean powerOn; + + @ApiModelProperty("获取的实时数据如果MULTI是“单”则为数值,MULTI是“多”则为数组") + private List real; + @ApiModelProperty("获取的实时数据如果MULTI是“单”则为数值,MULTI是“多”则为数组") + private List realIdentifier; + @ApiModelProperty("获取的实时数据如果MULTI是“单”则为数值,MULTI是“多”则为数组") + private List realName; + @ApiModelProperty("实时数据时间,如果MULTI是“单”则为数值,MULTI是“多”则为数组") + private List realTime; +} diff --git a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/vo/FdpFaultRealDataVO.java b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/vo/FdpFaultRealDataVO.java index af45be3..a5094a7 100644 --- a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/vo/FdpFaultRealDataVO.java +++ b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/vo/FdpFaultRealDataVO.java @@ -6,7 +6,6 @@ import lombok.Data; import lombok.NoArgsConstructor; import java.util.Date; -import java.util.List; /** * 模型VO @@ -41,7 +40,11 @@ public class FdpFaultRealDataVO { private Boolean powerOn; @ApiModelProperty("获取的实时数据如果MULTI是“单”则为数值,MULTI是“多”则为数组") - private List real; + private String real; + @ApiModelProperty("获取的实时数据如果MULTI是“单”则为数值,MULTI是“多”则为数组") + private String realIdentifier; + @ApiModelProperty("获取的实时数据如果MULTI是“单”则为数值,MULTI是“多”则为数组") + private String realName; @ApiModelProperty("实时数据时间,如果MULTI是“单”则为数值,MULTI是“多”则为数组") - private List realTime; + private Date realTime; } diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpMonitorServiceImpl.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpMonitorServiceImpl.java index c1bb70a..718e538 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpMonitorServiceImpl.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpMonitorServiceImpl.java @@ -13,6 +13,7 @@ import com.hnac.hzims.EquipmentConstants; import com.hnac.hzims.equipment.entity.EmInfoEntity; import com.hnac.hzims.equipment.service.IEmInfoService; import com.hnac.hzims.fdp.constants.DeviceInstanceTypeConstant; +import com.hnac.hzims.fdp.dto.FdpFaultRealDataDTO; import com.hnac.hzims.fdp.dto.FdpMonitorDTO; import com.hnac.hzims.fdp.dto.FdpMonitorExtendDTO; import com.hnac.hzims.fdp.dto.FdpTaskDTO; @@ -816,38 +817,28 @@ public class FdpMonitorServiceImpl extends BaseServiceImpl() {}); if (1==fdpHttpResponseVo.getSuccess()) { if (Func.isNotEmpty(fdpHttpResponseVo.getData())) { - List list = JSONObject.parseObject(fdpHttpResponseVo.getData(), new TypeReference>() {}); + List list = JSONObject.parseObject(fdpHttpResponseVo.getData(), new TypeReference>() {}); if (CollectionUtil.isEmpty(list)){ return R.success("暂无数据,请稍后重试"); } List res =new ArrayList<>(); - for (FdpFaultRealDataVO fdpFaultRealDataVO : list) { - if (null!=fdpFaultRealDataVO.getReal()){ - for (int i = 0; i < fdpFaultRealDataVO.getReal().size(); i++ ) { + for (FdpFaultRealDataDTO fdpFaultRealDataDTO : list) { + if (null!=fdpFaultRealDataDTO.getReal()){ + for (int i = 0; i < fdpFaultRealDataDTO.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)); + BeanUtils.copyProperties(fdpFaultRealDataDTO,dataVO); + dataVO.setReal(fdpFaultRealDataDTO.getReal().get(i)); + dataVO.setRealTime(fdpFaultRealDataDTO.getRealTime().get(i)); + dataVO.setRealName(fdpFaultRealDataDTO.getRealName().get(i)); + dataVO.setRealIdentifier(fdpFaultRealDataDTO.getRealIdentifier().get(i)); res.add(dataVO); } }else { - res.add(fdpFaultRealDataVO); + FdpFaultRealDataVO dataVO=new FdpFaultRealDataVO(); + BeanUtils.copyProperties(fdpFaultRealDataDTO,dataVO); + res.add(dataVO); } } -// 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("暂无数据,请稍后重试"); From 8865a8ecd69040137c28a4ad158e61e38ebb61ef Mon Sep 17 00:00:00 2001 From: haungxing <1203316822@qq.com> Date: Tue, 4 Jul 2023 14:00:46 +0800 Subject: [PATCH 3/4] =?UTF-8?q?#=20=E5=B7=A1=E6=A3=80=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E5=B7=A1=E6=A3=80=E5=86=85=E5=AE=B9list=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E6=9D=A1=E4=BB=B6=E5=B0=86IDS=E7=94=B1String=E5=8F=98=E6=9B=B4?= =?UTF-8?q?=E4=B8=BAList=20#=20pom=E6=96=87=E4=BB=B6=E4=BE=9D?= =?UTF-8?q?=E8=B5=96=E9=97=AE=E9=A2=98=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hzims-service-api/hzims-operational-api/pom.xml | 2 -- .../java/com/hnac/hzinfo/inspect/obj/dto/ContentDefinitionDTO.java | 3 ++- .../com/hnac/hzinfo/inspect/obj/feign/IContentDefinitionClient.java | 4 ++-- .../com/hnac/hzinfo/inspect/obj/feign/ContentDefinitionClient.java | 2 +- .../inspect/obj/services/impl/ContentDefinitionServiceImpl.java | 3 ++- pom.xml | 5 +++++ 6 files changed, 12 insertions(+), 7 deletions(-) diff --git a/hzims-service-api/hzims-operational-api/pom.xml b/hzims-service-api/hzims-operational-api/pom.xml index 10b24a0..7b370f2 100644 --- a/hzims-service-api/hzims-operational-api/pom.xml +++ b/hzims-service-api/hzims-operational-api/pom.xml @@ -67,8 +67,6 @@ com.hnac.hzims middle-api - 4.0.0-SNAPSHOT - provided 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 index 16402fe..50f0607 100644 --- 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 @@ -7,6 +7,7 @@ import lombok.Data; import lombok.EqualsAndHashCode; import java.io.Serializable; +import java.util.List; /** * @ClassName ContentDefinitionDTO @@ -21,6 +22,6 @@ import java.io.Serializable; public class ContentDefinitionDTO extends ContentDefinitionEntity implements Serializable { @ApiModelProperty("id,按逗号分隔") - private String ids; + private List ids; } 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 index ebaa95c..1d1e630 100644 --- 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 @@ -57,7 +57,7 @@ public interface IContentDefinitionClient { * @param request * @return */ - @GetMapping(SAVE_OR_UPDATE_BATCH) - R saveOrUpdateBatch(List request); + @PostMapping(SAVE_OR_UPDATE_BATCH) + R saveOrUpdateBatch(@RequestBody List request); } 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 index add8955..5cf8228 100644 --- 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 @@ -53,7 +53,7 @@ public class ContentDefinitionClient implements IContentDefinitionClient { @Override @PostMapping(SAVE_OR_UPDATE_BATCH) - public R saveOrUpdateBatch(List request) { + public R saveOrUpdateBatch(@RequestBody 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/services/impl/ContentDefinitionServiceImpl.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/impl/ContentDefinitionServiceImpl.java index 1b5bdbd..58bc5f4 100644 --- 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 @@ -16,6 +16,7 @@ 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.CollectionUtil; import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.StringUtil; import org.springframework.stereotype.Service; @@ -40,7 +41,7 @@ public class ContentDefinitionServiceImpl extends BaseServiceImpl 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())); + lambda.in(CollectionUtil.isNotEmpty(request.getIds()),ContentDefinitionEntity::getId,request.getIds()); return ContentDefinitionWrapper.build().listVO(this.list(lambda)); } } diff --git a/pom.xml b/pom.xml index 255422d..93bc8d2 100644 --- a/pom.xml +++ b/pom.xml @@ -195,6 +195,11 @@ com.hnac.hzims + middle-api + ${hzims.project.version} + + + com.hnac.hzims assets-api ${hzims.project.version} From 50b33400882f63c724b8ae3f57430ce3a0fdbe13 Mon Sep 17 00:00:00 2001 From: haungxing <1203316822@qq.com> Date: Tue, 4 Jul 2023 14:37:39 +0800 Subject: [PATCH 4/4] =?UTF-8?q?#=20=E5=B7=A1=E6=A3=80=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E8=84=9A=E6=9C=AC=E4=BF=AE=E6=94=B9=E3=80=81=E5=B7=A1=E6=A3=80?= =?UTF-8?q?=E5=86=85=E5=AE=B9=E5=AE=9E=E4=BD=93=E7=B1=BB=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/hnac/hzinfo/inspect/obj/entity/ContentDefinitionEntity.java | 2 ++ hzims-service/inspect/src/main/resources/db/1.0.1.sql | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) 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 index eb2e9d9..aada419 100644 --- 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 @@ -1,5 +1,6 @@ package com.hnac.hzinfo.inspect.obj.entity; +import com.baomidou.mybatisplus.annotation.TableName; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.ser.std.NullSerializer; import io.swagger.annotations.ApiModelProperty; @@ -21,6 +22,7 @@ import java.io.Serializable; **/ @Data @EqualsAndHashCode +@TableName("hz_st_re_content_definition") public class ContentDefinitionEntity extends TenantEntity implements Serializable { @ApiModelProperty(value = "内容编码") 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 index 729823c..d534287 100644 --- a/hzims-service/inspect/src/main/resources/db/1.0.1.sql +++ b/hzims-service/inspect/src/main/resources/db/1.0.1.sql @@ -33,11 +33,11 @@ CREATE TABLE IF NOT EXISTS `hz_st_re_content_definition` ( SET FOREIGN_KEY_CHECKS = 1; -- 巡检内容定义添加物模型标识字段 -alter table hz_st_re_content add COLUMN `model_signage` VARCHAR(64) comment '模型标识'; +alter table hz_st_re_content_definition 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_definition 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_definition add COLUMN `attr_name` VARCHAR(64) comment '属性名称'; -- 设备巡检内容添加物模型标识字段 alter table hz_st_re_content add COLUMN `model_signage` VARCHAR(64) comment '模型标识';