Browse Source

# 站点删除接口修改

zhongwei
haungxing 2 years ago
parent
commit
2bd1bf189e
  1. 4
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/feign/IQuestionClient.java
  2. 5
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/feign/QuestionClientFallback.java
  3. 9
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/entity/StationEntity.java
  4. 8
      hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/feign/QuestionClient.java
  5. 6
      hzims-service/operational/pom.xml
  6. 21
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java
  7. 2
      hzims-service/operational/src/main/resources/db/station.sql

4
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 io.swagger.annotations.ApiParam;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springframework.cloud.openfeign.FeignClient; 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.GetMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
@ -17,6 +18,7 @@ public interface IQuestionClient {
String API_PREFIX = "/feign/fdp/question"; String API_PREFIX = "/feign/fdp/question";
String SUBMIT_STATION_INFO = API_PREFIX + "/submitStationInfo"; 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) @GetMapping(SUBMIT_STATION_INFO)
R<Boolean> submitStationInfo(@RequestParam("stationCode") String stationCode, @RequestParam(value = "stationDesc",required = false) String stationDesc); R<Boolean> submitStationInfo(@RequestParam("stationCode") String stationCode, @RequestParam(value = "stationDesc",required = false) String stationDesc);
@DeleteMapping(DELETE_STATION_INFO)
R<Boolean> deleteStationInfo(@RequestParam String stationId);
} }

5
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<Boolean> submitStationInfo(String stationCode, String stationDesc) { public R<Boolean> submitStationInfo(String stationCode, String stationDesc) {
return R.fail("智能诊断提交站点失败!"); return R.fail("智能诊断提交站点失败!");
} }
@Override
public R<Boolean> deleteStationInfo(String stationId) {
return R.fail("智能诊断删除站点失败!");
}
} }

9
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.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore; 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.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.NullSerializer; 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 io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
@ -83,6 +86,8 @@ public class StationEntity extends TenantEntity implements Serializable {
@JsonFormat( @JsonFormat(
pattern = "yyyy-MM-dd HH:mm:ss" pattern = "yyyy-MM-dd HH:mm:ss"
) )
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
@JsonSerialize(using = LocalDateTimeSerializer.class)
@ApiModelProperty("投运时间,用于计算安全运行天数") @ApiModelProperty("投运时间,用于计算安全运行天数")
private LocalDateTime commissionTime; private LocalDateTime commissionTime;
@ -141,6 +146,10 @@ public class StationEntity extends TenantEntity implements Serializable {
@JsonFormat(pattern = DateUtil.PATTERN_DATE) @JsonFormat(pattern = DateUtil.PATTERN_DATE)
private LocalDate endDate; private LocalDate endDate;
@QueryField(condition = SqlCondition.EQUAL)
@ApiModelProperty("站点标识-两票编码")
private String signage;
@ApiModelProperty("限制水位") @ApiModelProperty("限制水位")
@JsonSerialize(nullsUsing = NullSerializer.class) @JsonSerialize(nullsUsing = NullSerializer.class)
private Double limitWaterLevel; private Double limitWaterLevel;

8
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 com.hnac.hzims.fdp.service.IFdpQuestionService;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.springblade.core.tool.api.R; 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.GetMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
@ -24,4 +25,11 @@ public class QuestionClient implements IQuestionClient {
return R.status(fdpQuestionService.submitStationInfo(stationCode,stationDesc)); return R.status(fdpQuestionService.submitStationInfo(stationCode,stationDesc));
} }
@DeleteMapping(DELETE_STATION_INFO)
@Override
public R<Boolean> deleteStationInfo(@RequestParam String stationId) {
return R.status(fdpQuestionService.deleteStationInfo(stationId));
}
} }

6
hzims-service/operational/pom.xml

@ -180,7 +180,11 @@
<artifactId>hutool-core</artifactId> <artifactId>hutool-core</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<version>2.13.2</version>
</dependency>
<!--WebSocket核心依赖包--> <!--WebSocket核心依赖包-->
<dependency> <dependency>

21
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.core.response.Result;
import com.hnac.hzinfo.sdk.v5.project.ProjectClient; import com.hnac.hzinfo.sdk.v5.project.ProjectClient;
import com.hnac.hzinfo.sdk.v5.project.dto.ProjectDTO; import com.hnac.hzinfo.sdk.v5.project.dto.ProjectDTO;
import com.hnac.hzinfo.sdk.v5.project.vo.ProjectVO;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils; 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.springblade.system.user.feign.IUserClient;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import java.util.*; import java.util.*;
@ -123,8 +125,25 @@ public class StationServiceImpl extends BaseServiceImpl<StationMapper, StationEn
} }
@Override @Override
@Transactional(rollbackFor = Exception.class)
public boolean removeStation(String ids) { public boolean removeStation(String ids) {
return this.deleteLogic(Func.toLongList(ids,",")); if(this.deleteLogic(Func.toLongList(ids,","))) {
Func.toLongList(ids,",").forEach(id -> {
StationEntity stationEntity = this.getById(id);
// 删除数据平台项目
Result<ProjectVO> 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 @Override

2
hzims-service/operational/src/main/resources/db/station.sql

@ -0,0 +1,2 @@
-- 站点管理添加站点标识字段
alter table HZIMS_STATION ADD COLUMN SIGNAGE VARCHAR(20) COMMENT '站点标识-两票编码';
Loading…
Cancel
Save