设备接口修改1
This commit is contained in:
parent
a93f20772b
commit
e31f612f09
|
@ -14,6 +14,7 @@ import com.isu.gaswellwatch.dto.DeviceEditDTO;
|
||||||
import com.isu.gaswellwatch.entity.BlockDepartment;
|
import com.isu.gaswellwatch.entity.BlockDepartment;
|
||||||
import com.isu.gaswellwatch.entity.Department;
|
import com.isu.gaswellwatch.entity.Department;
|
||||||
import com.isu.gaswellwatch.entity.Device;
|
import com.isu.gaswellwatch.entity.Device;
|
||||||
|
import com.isu.gaswellwatch.entity.GasWell;
|
||||||
import com.isu.gaswellwatch.exception.BusinessException;
|
import com.isu.gaswellwatch.exception.BusinessException;
|
||||||
import com.isu.gaswellwatch.service.BlockDepartmentService;
|
import com.isu.gaswellwatch.service.BlockDepartmentService;
|
||||||
import com.isu.gaswellwatch.service.DepartmentService;
|
import com.isu.gaswellwatch.service.DepartmentService;
|
||||||
|
@ -56,6 +57,15 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceDao, Device> implements
|
||||||
if(CollectionUtil.isNotEmpty(list)) {
|
if(CollectionUtil.isNotEmpty(list)) {
|
||||||
throw new BusinessException("已有相同设备编码,请重新输入");
|
throw new BusinessException("已有相同设备编码,请重新输入");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GasWell gasWell = gasWellService.getOne(new LambdaQueryWrapper<GasWell>().eq(GasWell::getId, deviceCreateDTO.getGasWell()));
|
||||||
|
if(gasWell==null) {
|
||||||
|
throw new BusinessException("该气井不存在");
|
||||||
|
}
|
||||||
|
if(gasWell.getDeviceId()!=null) {
|
||||||
|
throw new BusinessException("该气井已存在绑定设备,无法添加新设备");
|
||||||
|
}
|
||||||
|
|
||||||
Device device = ConverterUtil.convert(deviceCreateDTO, Device.class);
|
Device device = ConverterUtil.convert(deviceCreateDTO, Device.class);
|
||||||
//code必须为整形,用于在缓存中查询设备的上报数据
|
//code必须为整形,用于在缓存中查询设备的上报数据
|
||||||
device.setId(Long.valueOf(deviceCreateDTO.getCode()));
|
device.setId(Long.valueOf(deviceCreateDTO.getCode()));
|
||||||
|
|
Loading…
Reference in New Issue