|
|
@ -88,6 +88,17 @@ public class HwDeviceModeServiceImpl implements IHwDeviceModeService {
|
|
|
|
@Transactional
|
|
|
|
@Transactional
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public int insertHwDeviceMode(HwDeviceMode hwDeviceMode) {
|
|
|
|
public int insertHwDeviceMode(HwDeviceMode hwDeviceMode) {
|
|
|
|
|
|
|
|
//判断同一场景下模型名称是否重复
|
|
|
|
|
|
|
|
String deviceModeName = hwDeviceMode.getDeviceModeName();
|
|
|
|
|
|
|
|
Long sceneId = hwDeviceMode.getSceneId();
|
|
|
|
|
|
|
|
HwDeviceMode queryDeviceMode = new HwDeviceMode();
|
|
|
|
|
|
|
|
queryDeviceMode.setDeviceModeName(deviceModeName);
|
|
|
|
|
|
|
|
queryDeviceMode.setSceneId(sceneId);
|
|
|
|
|
|
|
|
List<HwDeviceMode> deviceModes = hwDeviceModeMapper.selectHwDeviceModeList(queryDeviceMode);
|
|
|
|
|
|
|
|
if (deviceModes != null && !deviceModes.isEmpty()) {
|
|
|
|
|
|
|
|
throw new ServiceException("此场景下设备模型名称重复");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//先判断是否有重复的标识符
|
|
|
|
//先判断是否有重复的标识符
|
|
|
|
List<HwDeviceModeFunction> hwDeviceModeFunctionList = hwDeviceMode.getHwDeviceModeFunctionList();
|
|
|
|
List<HwDeviceModeFunction> hwDeviceModeFunctionList = hwDeviceMode.getHwDeviceModeFunctionList();
|
|
|
|
|
|
|
|
|
|
|
@ -135,6 +146,22 @@ public class HwDeviceModeServiceImpl implements IHwDeviceModeService {
|
|
|
|
@Transactional
|
|
|
|
@Transactional
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public int updateHwDeviceMode(HwDeviceMode hwDeviceMode) {
|
|
|
|
public int updateHwDeviceMode(HwDeviceMode hwDeviceMode) {
|
|
|
|
|
|
|
|
String deviceModeName = hwDeviceMode.getDeviceModeName();
|
|
|
|
|
|
|
|
Long sceneId = hwDeviceMode.getSceneId();
|
|
|
|
|
|
|
|
HwDeviceMode queryDeviceMode = new HwDeviceMode();
|
|
|
|
|
|
|
|
queryDeviceMode.setDeviceModeName(deviceModeName);
|
|
|
|
|
|
|
|
queryDeviceMode.setSceneId(sceneId);
|
|
|
|
|
|
|
|
List<HwDeviceMode> deviceModes = hwDeviceModeMapper.selectHwDeviceModeList(queryDeviceMode);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (deviceModes != null && !deviceModes.isEmpty()) {
|
|
|
|
|
|
|
|
List<HwDeviceMode> filterDeviceModes = deviceModes.stream().filter(hwDm -> !hwDm.getDeviceModeId().equals(hwDeviceMode.getDeviceModeId())
|
|
|
|
|
|
|
|
&& hwDm.getDeviceModeName().equals(hwDeviceMode.getDeviceModeName())).collect(Collectors.toList());
|
|
|
|
|
|
|
|
if (filterDeviceModes != null && !filterDeviceModes.isEmpty()) {
|
|
|
|
|
|
|
|
throw new ServiceException("此场景下设备模型名称重复");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
hwDeviceMode.setUpdateBy(SecurityUtils.getUsername());
|
|
|
|
hwDeviceMode.setUpdateBy(SecurityUtils.getUsername());
|
|
|
|
hwDeviceMode.setUpdateTime(DateUtils.getNowDate());
|
|
|
|
hwDeviceMode.setUpdateTime(DateUtils.getNowDate());
|
|
|
|
// hwDeviceModeMapper.deleteHwDeviceModeFunctionByDeviceModeId(hwDeviceMode.getDeviceModeId());
|
|
|
|
// hwDeviceModeMapper.deleteHwDeviceModeFunctionByDeviceModeId(hwDeviceMode.getDeviceModeId());
|
|
|
@ -364,7 +391,7 @@ public class HwDeviceModeServiceImpl implements IHwDeviceModeService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 重建所有设备模型的超级表
|
|
|
|
* 重建所有设备模型的超级表(创建超级表,将所有设备模型中没有创建超级表的创建一下,已经创建过的不需要再创建)
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @description
|
|
|
|
* @description
|
|
|
|
* @author xins
|
|
|
|
* @author xins
|
|
|
@ -397,7 +424,7 @@ public class HwDeviceModeServiceImpl implements IHwDeviceModeService {
|
|
|
|
//过滤只有数值的属性才可以定义报警规则.或过滤出服务可以添加关联设备
|
|
|
|
//过滤只有数值的属性才可以定义报警规则.或过滤出服务可以添加关联设备
|
|
|
|
List<HwDeviceModeFunction> filterDeviceModeFunctions = deviceModeFunctions.stream()
|
|
|
|
List<HwDeviceModeFunction> filterDeviceModeFunctions = deviceModeFunctions.stream()
|
|
|
|
.filter(deviceModeFunction -> (deviceModeFunction.getFunctionMode().equals(HwDictConstants.FUNCTION_MODE_ATTRIBUTE) &&
|
|
|
|
.filter(deviceModeFunction -> (deviceModeFunction.getFunctionMode().equals(HwDictConstants.FUNCTION_MODE_ATTRIBUTE) &&
|
|
|
|
deviceModeFunction.getDataType()!=null && (String.valueOf(deviceModeFunction.getDataType()).equals(String.valueOf(DataTypeEnums.INT.getDataCode()))
|
|
|
|
deviceModeFunction.getDataType() != null && (String.valueOf(deviceModeFunction.getDataType()).equals(String.valueOf(DataTypeEnums.INT.getDataCode()))
|
|
|
|
|| String.valueOf(deviceModeFunction.getDataType()).equals(String.valueOf(DataTypeEnums.FLOAT.getDataCode()))
|
|
|
|
|| String.valueOf(deviceModeFunction.getDataType()).equals(String.valueOf(DataTypeEnums.FLOAT.getDataCode()))
|
|
|
|
|| String.valueOf(deviceModeFunction.getDataType()).equals(String.valueOf(DataTypeEnums.DOUBLE.getDataCode()))))
|
|
|
|
|| String.valueOf(deviceModeFunction.getDataType()).equals(String.valueOf(DataTypeEnums.DOUBLE.getDataCode()))))
|
|
|
|
|| (deviceModeFunction.getFunctionMode().equals(HwDictConstants.FUNCTION_MODE_SERVICE)))
|
|
|
|
|| (deviceModeFunction.getFunctionMode().equals(HwDictConstants.FUNCTION_MODE_SERVICE)))
|
|
|
|