有功功率趋势定时任务算法完善

This commit is contained in:
guofeihu
2024-09-05 14:17:11 +08:00
parent 9fca0e5714
commit 8e6f07330e
18 changed files with 772 additions and 183 deletions

View File

@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.device.biz.enums.DeviceResponseEnum;
import com.njcn.device.pq.enums.PvDeviceResponseEnum;
import com.njcn.device.pq.mapper.LineDetailMapper;
import com.njcn.device.pq.mapper.NewStationMapper;
import com.njcn.device.pq.pojo.param.NewStationQueryParam;
@@ -45,10 +46,19 @@ public class NewStationServiceImpl extends ServiceImpl<NewStationMapper, NewStat
NewStation newStation = new NewStation();
BeanUtil.copyProperties(newStationEdit, newStation);
newStation.setState(1);
LambdaQueryWrapper<NewStation> lambdaQueryWrapper = new LambdaQueryWrapper();
lambdaQueryWrapper.eq(NewStation::getName,newStation.getName()).eq(NewStation::getState,1);
boolean result ;
if(newStation.getId() != null){
lambdaQueryWrapper.ne(NewStation::getId,newStation.getId());
if(!this.baseMapper.selectList(lambdaQueryWrapper).isEmpty()){
throw new BusinessException(PvDeviceResponseEnum.NEWSTATION_REPEAT.getMessage());
}
result = this.updateById(newStation);
}else{
if(!this.baseMapper.selectList(lambdaQueryWrapper).isEmpty()){
throw new BusinessException(PvDeviceResponseEnum.NEWSTATION_REPEAT.getMessage());
}
newStation.setId(IdUtil.simpleUUID());
result = this.save(newStation);
}