|
@@ -39,6 +39,7 @@ import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
|
+import static cn.iocoder.yudao.module.pms.enums.ErrorCodeConstant.IOT_DEVICE_EXISTED;
|
|
|
import static cn.iocoder.yudao.module.pms.enums.ErrorCodeConstant.IOT_DEVICE_NOT_EXISTS;
|
|
|
|
|
|
/**
|
|
@@ -99,6 +100,11 @@ public class IotDeviceServiceImpl implements IotDeviceService {
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public Long createIotDevice(IotDeviceSaveReqVO createReqVO) {
|
|
|
+ //校验资产编号
|
|
|
+ List<IotDeviceDO> iotDeviceDOS = iotDeviceMapper.selectList("device_code", createReqVO.getDeviceCode());
|
|
|
+ if (CollUtil.isNotEmpty(iotDeviceDOS)) {
|
|
|
+ throw new ServiceException(IOT_DEVICE_EXISTED);
|
|
|
+ }
|
|
|
// 插入
|
|
|
IotDeviceDO iotDevice = BeanUtils.toBean(createReqVO, IotDeviceDO.class);
|
|
|
iotDevice.setDeleted(false);
|