From 2bd1bf189e2c280bc51a60e1df3d2c4244120b4f Mon Sep 17 00:00:00 2001 From: haungxing <1203316822@qq.com> Date: Tue, 11 Apr 2023 11:42:32 +0800 Subject: [PATCH] =?UTF-8?q?#=20=E7=AB=99=E7=82=B9=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/hnac/hzims/fdp/feign/IQuestionClient.java | 4 ++++ .../hzims/fdp/feign/QuestionClientFallback.java | 5 +++++ .../operational/station/entity/StationEntity.java | 9 +++++++++ .../com/hnac/hzims/fdp/feign/QuestionClient.java | 8 ++++++++ hzims-service/operational/pom.xml | 6 +++++- .../station/service/impl/StationServiceImpl.java | 21 ++++++++++++++++++++- .../operational/src/main/resources/db/station.sql | 2 ++ 7 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 hzims-service/operational/src/main/resources/db/station.sql diff --git a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/feign/IQuestionClient.java b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/feign/IQuestionClient.java index 3fc49c2..da35544 100644 --- a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/feign/IQuestionClient.java +++ b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/feign/IQuestionClient.java @@ -4,6 +4,7 @@ import com.hnac.hzims.EquipmentConstants; import io.swagger.annotations.ApiParam; import org.springblade.core.tool.api.R; import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestParam; @@ -17,6 +18,7 @@ public interface IQuestionClient { String API_PREFIX = "/feign/fdp/question"; String SUBMIT_STATION_INFO = API_PREFIX + "/submitStationInfo"; + String DELETE_STATION_INFO = API_PREFIX + "/deleteStationInfo"; /** * 提交站点信息 @@ -27,4 +29,6 @@ public interface IQuestionClient { @GetMapping(SUBMIT_STATION_INFO) R submitStationInfo(@RequestParam("stationCode") String stationCode, @RequestParam(value = "stationDesc",required = false) String stationDesc); + @DeleteMapping(DELETE_STATION_INFO) + R deleteStationInfo(@RequestParam String stationId); } diff --git a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/feign/QuestionClientFallback.java b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/feign/QuestionClientFallback.java index 2be9c95..2017105 100644 --- a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/feign/QuestionClientFallback.java +++ b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/feign/QuestionClientFallback.java @@ -17,4 +17,9 @@ public class QuestionClientFallback implements IQuestionClient { public R submitStationInfo(String stationCode, String stationDesc) { return R.fail("智能诊断提交站点失败!"); } + + @Override + public R deleteStationInfo(String stationId) { + return R.fail("智能诊断删除站点失败!"); + } } diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/entity/StationEntity.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/entity/StationEntity.java index a00021f..8bbbe87 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/entity/StationEntity.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/entity/StationEntity.java @@ -6,8 +6,11 @@ import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.ser.std.NullSerializer; +import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer; +import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer; import io.swagger.annotations.ApiModelProperty; import lombok.AllArgsConstructor; import lombok.Builder; @@ -83,6 +86,8 @@ public class StationEntity extends TenantEntity implements Serializable { @JsonFormat( pattern = "yyyy-MM-dd HH:mm:ss" ) + @JsonDeserialize(using = LocalDateTimeDeserializer.class) + @JsonSerialize(using = LocalDateTimeSerializer.class) @ApiModelProperty("投运时间,用于计算安全运行天数") private LocalDateTime commissionTime; @@ -141,6 +146,10 @@ public class StationEntity extends TenantEntity implements Serializable { @JsonFormat(pattern = DateUtil.PATTERN_DATE) private LocalDate endDate; + @QueryField(condition = SqlCondition.EQUAL) + @ApiModelProperty("站点标识-两票编码") + private String signage; + @ApiModelProperty("限制水位") @JsonSerialize(nullsUsing = NullSerializer.class) private Double limitWaterLevel; diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/feign/QuestionClient.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/feign/QuestionClient.java index 899ac9a..3c18b89 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/feign/QuestionClient.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/feign/QuestionClient.java @@ -3,6 +3,7 @@ package com.hnac.hzims.fdp.feign; import com.hnac.hzims.fdp.service.IFdpQuestionService; import lombok.AllArgsConstructor; import org.springblade.core.tool.api.R; +import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; @@ -24,4 +25,11 @@ public class QuestionClient implements IQuestionClient { return R.status(fdpQuestionService.submitStationInfo(stationCode,stationDesc)); } + + @DeleteMapping(DELETE_STATION_INFO) + @Override + public R deleteStationInfo(@RequestParam String stationId) { + return R.status(fdpQuestionService.deleteStationInfo(stationId)); + } + } diff --git a/hzims-service/operational/pom.xml b/hzims-service/operational/pom.xml index 59da1c3..6c50243 100644 --- a/hzims-service/operational/pom.xml +++ b/hzims-service/operational/pom.xml @@ -180,7 +180,11 @@ hutool-core - + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + 2.13.2 + diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java index 59aded9..179b223 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java @@ -26,6 +26,7 @@ import com.hnac.hzinfo.sdk.v5.project.vo.ProjectVO;*/ import com.hnac.hzinfo.sdk.core.response.Result; import com.hnac.hzinfo.sdk.v5.project.ProjectClient; import com.hnac.hzinfo.sdk.v5.project.dto.ProjectDTO; +import com.hnac.hzinfo.sdk.v5.project.vo.ProjectVO; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang.StringUtils; @@ -46,6 +47,7 @@ import org.springblade.system.user.entity.User; import org.springblade.system.user.feign.IUserClient; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import org.springframework.util.Assert; import java.util.*; @@ -123,8 +125,25 @@ public class StationServiceImpl extends BaseServiceImpl { + StationEntity stationEntity = this.getById(id); + // 删除数据平台项目 + Result existProject = projectClient.getProjectByPid(stationEntity.getCode()); + if(existProject.isSuccess() && ObjectUtil.isNotEmpty(existProject.getData())) { + Result dataDelete = projectClient.delete(stationEntity.getCode()); + Assert.isTrue(dataDelete.isSuccess(),() -> { + logger.error("hzims-operational:station:removeStation",stationEntity.getCode()+"删除失败,报错信息为:"+dataDelete.getMsg()); + throw new ServiceException("数据平台删除项目失败!"); + }); + } + // 删除智能诊断站点 + questionClient.deleteStationInfo(stationEntity.getCode()); + }); + } + return true; } @Override diff --git a/hzims-service/operational/src/main/resources/db/station.sql b/hzims-service/operational/src/main/resources/db/station.sql new file mode 100644 index 0000000..0d93017 --- /dev/null +++ b/hzims-service/operational/src/main/resources/db/station.sql @@ -0,0 +1,2 @@ +-- 站点管理添加站点标识字段 +alter table HZIMS_STATION ADD COLUMN SIGNAGE VARCHAR(20) COMMENT '站点标识-两票编码'; \ No newline at end of file