fix:针对传感器删除和导入功能进行修复
parent
4dbecd11d9
commit
bfd41b30fd
|
|
@ -426,6 +426,7 @@ public class IotSensorInfoController extends BaseController {
|
|||
obj.setMtime(new Date());
|
||||
resultMap = service.update("IotSensorInfo.update", obj) ;
|
||||
if(isOk(resultMap)){
|
||||
obj = ProCacheUtil.getCache(CacheName.SENSORINFO, obj.getId().toString(), obj);
|
||||
IotNodeInfoBO nodeDt = ProCacheUtil.getCache(CacheName.NODEINFO, obj.getNode_id().toString());
|
||||
String port_id = (ObjectUtil.isNotEmpty(nodeDt) && nodeDt.getIot_protocal_category().equalsIgnoreCase("ProtocalXRxasn"))
|
||||
? "" : "-"+obj.getPort_id();
|
||||
|
|
|
|||
|
|
@ -193,6 +193,10 @@ public class IotSensorInfoServiceImpl extends BaseServiceImpl implements IotSens
|
|||
String[] fields = {"name","measure_unit_type","iot_sensor_type","devide_code","sensor_device_id","port_id","seq","sdata_degree","formula_up","formula_down","data_type","param_names","sdata","param_config","infos","store_strage"};
|
||||
List<IotImportSensorInfoBO> list = ExcelUtil.getExcelInfo(file, IotImportSensorInfoBO.class, 0, 16, fields, 2) ;
|
||||
// 不能重复,并且不能已存在,先判断,然后在开始添加,文件内设备不重复,文件外不能跟已有重复
|
||||
List<ProDictionaryInfo> measure_unit_types = ProCacheUtil.getCache(CacheName.DICTIONARY_RELATION, "20", new ProDictionaryInfoBO()).getSub();
|
||||
List<ProDictionaryInfo> iot_sensor_types = ProCacheUtil.getCache(CacheName.DICTIONARY_RELATION, "24", new ProDictionaryInfoBO()).getSub();
|
||||
List<ProDictionaryInfo> store_strages = ProCacheUtil.getCache(CacheName.DICTIONARY_RELATION, "270", new ProDictionaryInfoBO()).getSub();
|
||||
|
||||
for(IotImportSensorInfoBO obj : list){
|
||||
if(!obj.validate()){
|
||||
putStatusCode(resultMap, 10000);
|
||||
|
|
@ -214,12 +218,28 @@ public class IotSensorInfoServiceImpl extends BaseServiceImpl implements IotSens
|
|||
putStatusMsg(resultMap, "传感器:["+obj.getSensor_device_id()+port_id+"]已经存在") ;
|
||||
return resultMap ;
|
||||
}
|
||||
|
||||
if(obj.getData_type().equals("数据属性")){
|
||||
if(measure_unit_types.stream().noneMatch(v -> v.getName().equals(obj.getMeasure_unit_type()))){
|
||||
putStatusCode(resultMap, 10000);
|
||||
putStatusMsg(resultMap, "传感器:["+obj.getSensor_device_id()+port_id+"]是数据属性,但是其单位未在数据字典中配置,请联系管理员") ;
|
||||
return resultMap ;
|
||||
}
|
||||
if(iot_sensor_types.stream().noneMatch(v -> v.getName().equals(obj.getIot_sensor_type()))){
|
||||
putStatusCode(resultMap, 10000);
|
||||
putStatusMsg(resultMap, "传感器:["+obj.getSensor_device_id()+port_id+"]是数据属性,但是其传感点类型未在数据字典中配置,请联系管理员") ;
|
||||
return resultMap ;
|
||||
}
|
||||
|
||||
}
|
||||
if(store_strages.stream().noneMatch(v -> v.getName().equals(obj.getStore_strage()))){
|
||||
putStatusCode(resultMap, 10000);
|
||||
putStatusMsg(resultMap, "传感器:["+obj.getSensor_device_id()+port_id+"]是数据属性,但是其储存策略未在数据字典中配置,请联系管理员") ;
|
||||
return resultMap ;
|
||||
}
|
||||
}
|
||||
|
||||
Set<String> sensorSet = new HashSet<>();
|
||||
List<ProDictionaryInfo> measure_unit_types = ProCacheUtil.getCache(CacheName.DICTIONARY_RELATION, "20", new ProDictionaryInfoBO()).getSub();
|
||||
List<ProDictionaryInfo> iot_sensor_types = ProCacheUtil.getCache(CacheName.DICTIONARY_RELATION, "24", new ProDictionaryInfoBO()).getSub();
|
||||
List<ProDictionaryInfo> store_strages = ProCacheUtil.getCache(CacheName.DICTIONARY_RELATION, "270", new ProDictionaryInfoBO()).getSub();
|
||||
for(IotImportSensorInfoBO obj : list){
|
||||
String port_id = isXRxasn ? "" : "-" + obj.getPort_id();
|
||||
if(!sensorSet.contains(obj.getSensor_device_id() + port_id)){
|
||||
|
|
|
|||
Binary file not shown.
Loading…
Reference in New Issue