代码优化
This commit is contained in:
@@ -37,6 +37,7 @@ import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.influxdb.dto.QueryResult;
|
||||
import org.influxdb.impl.InfluxDBResultMapper;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
@@ -159,7 +160,13 @@ public class EventDetailServiceImpl extends ServiceImpl<RmpEventDetailMapper, Rm
|
||||
@Override
|
||||
// @Transactional(rollbackFor = Exception.class)
|
||||
public Boolean addEventDetail(EventDeatilDTO deatilDTO) {
|
||||
RmpEventDetailPO one = this.lambdaQuery().eq(RmpEventDetailPO::getLineId, deatilDTO.getMonitorId()).eq(RmpEventDetailPO::getStartTime, deatilDTO.getStartTime()).one();
|
||||
RmpEventDetailPO rmpEventDetailPO = new RmpEventDetailPO();
|
||||
|
||||
if(Objects.nonNull(one)){
|
||||
BeanUtils.copyProperties(one,rmpEventDetailPO);
|
||||
|
||||
}
|
||||
// rmpEventDetailPO.setMeasurementPointId(deatilDTO.getMonitorId());
|
||||
rmpEventDetailPO.setLineId(deatilDTO.getMonitorId());
|
||||
DictData data = dicDataFeignClient.getDicDataByCode(eventTypeReflection(deatilDTO.getEventType())).getData();
|
||||
@@ -184,7 +191,6 @@ public class EventDetailServiceImpl extends ServiceImpl<RmpEventDetailMapper, Rm
|
||||
rmpEventDetailPO.setSeverity(Double.valueOf(severity));
|
||||
rmpEventDetailPO.setCreateTime(LocalDateTime.now());
|
||||
|
||||
RmpEventDetailPO one = this.lambdaQuery().eq(RmpEventDetailPO::getLineId, rmpEventDetailPO.getLineId()).eq(RmpEventDetailPO::getStartTime, rmpEventDetailPO.getStartTime()).one();
|
||||
if(Objects.nonNull(one)){
|
||||
rmpEventDetailPO.setEventId(one.getEventId());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user