物模型属性新增是否敏感字段:confidential
This commit is contained in:
parent
0c7992dec2
commit
3df4c84dd4
@ -216,7 +216,7 @@ public class SysIotModelController {
|
||||
return R.success();
|
||||
}
|
||||
|
||||
/** 物模型导出 */
|
||||
/** 物模型属性导出 */
|
||||
@PostMapping("/export")
|
||||
public void exportSysIotModel(@RequestBody SysIotModelDto sysIotModelDto, HttpServletRequest request, HttpServletResponse response) {
|
||||
|
||||
@ -227,7 +227,7 @@ public class SysIotModelController {
|
||||
|
||||
}
|
||||
|
||||
/** 物模型导入 */
|
||||
/** 物模型属性导入 */
|
||||
@PostMapping("/import")
|
||||
public R<Void> importSysIotModel(String id, @RequestParam("file") MultipartFile file) throws IOException {
|
||||
|
||||
|
@ -77,5 +77,5 @@ public class SysIotModelFieldDto implements Serializable {
|
||||
|
||||
private String stateDesc;
|
||||
|
||||
|
||||
private Integer confidential;
|
||||
}
|
||||
|
@ -70,4 +70,6 @@ public class SysIotModelFieldVo {
|
||||
|
||||
private String stateDesc;
|
||||
|
||||
private Integer confidential;
|
||||
|
||||
}
|
||||
|
@ -111,4 +111,11 @@ public class SysIotModelField extends BaseEntity {
|
||||
*/
|
||||
@TableField("statedesc")
|
||||
private String stateDesc;
|
||||
|
||||
|
||||
/**
|
||||
* 是否为敏感数据
|
||||
*/
|
||||
@TableField("confidential")
|
||||
private Integer confidential;
|
||||
}
|
||||
|
@ -311,8 +311,9 @@ public class SysIotModelServiceImpl implements SysIotModelService {
|
||||
map.put("dataType", "*数据类型");
|
||||
map.put("visible", "是否可见(0:不可见,1:可见)");
|
||||
map.put("highSpeed", "*属性频度(0低频属性,1高频属性)");
|
||||
map.put("level","离散量级别:0提示;1告警;2故障");
|
||||
map.put("stateDesc","告警级别描述");
|
||||
map.put("level", "离散量级别:0提示;1告警;2故障");
|
||||
map.put("stateDesc", "告警级别描述");
|
||||
map.put("confidential","是否为敏感数据(0:非敏感数据,1:敏感数据)");
|
||||
sheetDTO.setSheetName("物模型属性");
|
||||
sheetDTO.setFieldAndAlias(map);
|
||||
sheetDTO.setCollection(sysIotModelFieldVoList);
|
||||
@ -460,7 +461,7 @@ public class SysIotModelServiceImpl implements SysIotModelService {
|
||||
map.put(sysIotModelField.getAttributeCode(), sysIotModelField.getDataType());
|
||||
//创建低频超级表
|
||||
tdEngineService.addStableColumn(sysIotModel.getIotModelCode(), "l_", map);
|
||||
sysRecordLogService.createRecordLog("/系统管理/物模型配置","新增低频TD超级表字段,"+"表名:l_" +sysIotModel.getIotModelCode()+",字段:"+map);
|
||||
sysRecordLogService.createRecordLog("/系统管理/物模型配置", "新增低频TD超级表字段," + "表名:l_" + sysIotModel.getIotModelCode() + ",字段:" + map);
|
||||
addModelFieldCache(lowCreateList.get(i));
|
||||
}
|
||||
}
|
||||
@ -476,7 +477,7 @@ public class SysIotModelServiceImpl implements SysIotModelService {
|
||||
map.put(sysIotModelField.getAttributeCode(), sysIotModelField.getDataType());
|
||||
//创建高频超级表
|
||||
tdEngineService.addStableColumn(sysIotModel.getIotModelCode(), "h_", map);
|
||||
sysRecordLogService.createRecordLog("/系统管理/物模型配置","新增低频TD超级表字段,"+"表名:h_" +sysIotModel.getIotModelCode()+",字段:"+map);
|
||||
sysRecordLogService.createRecordLog("/系统管理/物模型配置", "新增低频TD超级表字段," + "表名:h_" + sysIotModel.getIotModelCode() + ",字段:" + map);
|
||||
addModelFieldCache(highCreateList.get(i));
|
||||
}
|
||||
}
|
||||
@ -514,10 +515,13 @@ public class SysIotModelServiceImpl implements SysIotModelService {
|
||||
|
||||
private static void buildFieldInfo(String iotModelId, List<Object> row, SysIotModelField field) {
|
||||
//参数校验
|
||||
boolean allNotEmpty = ObjectUtil.isAllNotEmpty(row.get(3), row.get(4), row.get(5), row.get(7), row.get(9), row.get(11));
|
||||
boolean allNotEmpty = ObjectUtil.isAllNotEmpty(row.get(3), row.get(4), row.get(5), row.get(7), row.get(9), row.get(11), row.get(14));
|
||||
if (!allNotEmpty) {
|
||||
throw new ServiceException("字段不可为空,请检查excel文件{}" + row);
|
||||
}
|
||||
if (!(row.get(14).toString().equals("0") || row.get(14).toString().equals("1"))){
|
||||
throw new ServiceException("参数是否为敏感字段不符合规范,请输入0或者1");
|
||||
}
|
||||
field.setAttributeCode(row.get(3).toString());
|
||||
field.setAttributeName(row.get(4).toString());
|
||||
field.setAttributeType(Integer.valueOf(row.get(5).toString()));
|
||||
@ -530,6 +534,7 @@ public class SysIotModelServiceImpl implements SysIotModelService {
|
||||
field.setHighSpeed(Integer.valueOf(row.get(11).toString()));
|
||||
field.setLevel(ObjectUtil.isEmpty(row.get(12)) ? null : Integer.valueOf(row.get(12).toString()));
|
||||
field.setStateDesc(ObjectUtil.isEmpty(row.get(13)) ? null : row.get(13).toString());
|
||||
field.setConfidential(Integer.valueOf(row.get(14).toString()));
|
||||
field.setIotModelId(Long.valueOf(iotModelId));
|
||||
}
|
||||
|
||||
@ -544,7 +549,7 @@ public class SysIotModelServiceImpl implements SysIotModelService {
|
||||
if (sysIotModelField.getAttributeType() == 199) {
|
||||
String modelCode = dataService.iotModelMap.get(sysIotModelField.getIotModelId().toString());
|
||||
tdEngineService.createCalStable(modelCode, sysIotModelField.getAttributeCode(), sysIotModelField.getDataType());
|
||||
sysRecordLogService.createRecordLog("/系统管理/物模型配置","创建计算超级表"+"c_" + modelCode + "_" + sysIotModelField.getAttributeCode());
|
||||
sysRecordLogService.createRecordLog("/系统管理/物模型配置", "创建计算超级表" + "c_" + modelCode + "_" + sysIotModelField.getAttributeCode());
|
||||
} else {
|
||||
//创建type为138 139 140的超级表
|
||||
//如果新增的是第一条记录 创建tdengine超级表 分为高频和低频
|
||||
@ -559,7 +564,7 @@ public class SysIotModelServiceImpl implements SysIotModelService {
|
||||
map.put(sysIotModelField.getAttributeCode(), sysIotModelField.getDataType());
|
||||
//创建低频超级表
|
||||
tdEngineService.createStable(sysIotModel.getIotModelCode(), "l_", map);
|
||||
sysRecordLogService.createRecordLog("/系统管理/物模型配置","创建低频TD超级表"+"l_" +sysIotModel.getIotModelCode());
|
||||
sysRecordLogService.createRecordLog("/系统管理/物模型配置", "创建低频TD超级表" + "l_" + sysIotModel.getIotModelCode());
|
||||
}
|
||||
if (sysIotModelField.getHighSpeed() == 1) {
|
||||
SysIotModel sysIotModel = sysIotModelMapper.selectById(sysIotModelField.getIotModelId());
|
||||
@ -567,7 +572,7 @@ public class SysIotModelServiceImpl implements SysIotModelService {
|
||||
map.put(sysIotModelField.getAttributeCode(), sysIotModelField.getDataType());
|
||||
//创建高频超级表
|
||||
tdEngineService.createStable(sysIotModel.getIotModelCode(), "h_", map);
|
||||
sysRecordLogService.createRecordLog("/系统管理/物模型配置","创建高频TD超级表"+"h_" +sysIotModel.getIotModelCode());
|
||||
sysRecordLogService.createRecordLog("/系统管理/物模型配置", "创建高频TD超级表" + "h_" + sysIotModel.getIotModelCode());
|
||||
}
|
||||
} else {
|
||||
//stable已经存在,新增stable列
|
||||
@ -577,7 +582,7 @@ public class SysIotModelServiceImpl implements SysIotModelService {
|
||||
map.put(sysIotModelField.getAttributeCode(), sysIotModelField.getDataType());
|
||||
//创建低频超级表
|
||||
tdEngineService.addStableColumn(sysIotModel.getIotModelCode(), "l_", map);
|
||||
sysRecordLogService.createRecordLog("/系统管理/物模型配置","新增低频TD超级表字段,"+"表名:l_" +sysIotModel.getIotModelCode()+",字段:"+map);
|
||||
sysRecordLogService.createRecordLog("/系统管理/物模型配置", "新增低频TD超级表字段," + "表名:l_" + sysIotModel.getIotModelCode() + ",字段:" + map);
|
||||
}
|
||||
if (sysIotModelField.getHighSpeed() == 1) {
|
||||
SysIotModel sysIotModel = sysIotModelMapper.selectById(sysIotModelField.getIotModelId());
|
||||
@ -585,7 +590,7 @@ public class SysIotModelServiceImpl implements SysIotModelService {
|
||||
map.put(sysIotModelField.getAttributeCode(), sysIotModelField.getDataType());
|
||||
//创建高频超级表
|
||||
tdEngineService.addStableColumn(sysIotModel.getIotModelCode(), "h_", map);
|
||||
sysRecordLogService.createRecordLog("/系统管理/物模型配置","新增高频TD超级表字段,"+"表名:h_" +sysIotModel.getIotModelCode()+",字段:"+map);
|
||||
sysRecordLogService.createRecordLog("/系统管理/物模型配置", "新增高频TD超级表字段," + "表名:h_" + sysIotModel.getIotModelCode() + ",字段:" + map);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -601,7 +606,7 @@ public class SysIotModelServiceImpl implements SysIotModelService {
|
||||
Long iotModelId = sysIotModelField.getIotModelId();
|
||||
String modelCode = dataService.iotModelMap.get(iotModelId.toString());
|
||||
tdEngineService.deleteStable("c_" + modelCode + "_" + sysIotModelField.getAttributeCode());
|
||||
sysRecordLogService.createRecordLog("/系统管理/物模型配置","删除TD超级表"+"c_" + modelCode + "_" + sysIotModelField.getAttributeCode());
|
||||
sysRecordLogService.createRecordLog("/系统管理/物模型配置", "删除TD超级表" + "c_" + modelCode + "_" + sysIotModelField.getAttributeCode());
|
||||
} else {
|
||||
String stableName = null;
|
||||
SysIotModel sysIotModel = sysIotModelMapper.selectById(sysIotModelField.getIotModelId());
|
||||
@ -617,12 +622,12 @@ public class SysIotModelServiceImpl implements SysIotModelService {
|
||||
List<SysIotModelField> sysIotModelFields = sysIotModelFieldMapper.selectList(queryWrapper);
|
||||
if (CollectionUtils.isNotEmpty(sysIotModelFields) && sysIotModelFields.size() > 1) {
|
||||
tdEngineService.deleteColumn(stableName, sysIotModelField.getAttributeCode());
|
||||
sysRecordLogService.createRecordLog("/系统管理/物模型配置","删除TD超级表"+ stableName +"中字段:"+ sysIotModelField.getAttributeCode());
|
||||
sysRecordLogService.createRecordLog("/系统管理/物模型配置", "删除TD超级表" + stableName + "中字段:" + sysIotModelField.getAttributeCode());
|
||||
}
|
||||
//物模型属性只剩下最后一个删除表
|
||||
if (CollectionUtils.isNotEmpty(sysIotModelFields) && sysIotModelFields.size() == 1) {
|
||||
tdEngineService.deleteStable(stableName);
|
||||
sysRecordLogService.createRecordLog("/系统管理/物模型配置","删除TD超级表"+ stableName);
|
||||
sysRecordLogService.createRecordLog("/系统管理/物模型配置", "删除TD超级表" + stableName);
|
||||
}
|
||||
}
|
||||
|
||||
@ -635,13 +640,12 @@ public class SysIotModelServiceImpl implements SysIotModelService {
|
||||
Map<String, String> fieldCodeNameMap = dataService.fieldCodeNameMap.get(modelCode);
|
||||
if (fieldCodeNameMap == null) {
|
||||
Map<String, String> fieldCodeName = new HashMap<>();
|
||||
fieldCodeName.put(sysIotModelField.getAttributeCode(),sysIotModelField.getAttributeName());
|
||||
dataService.fieldCodeNameMap.put(modelCode,fieldCodeName);
|
||||
}
|
||||
else {
|
||||
fieldCodeName.put(sysIotModelField.getAttributeCode(), sysIotModelField.getAttributeName());
|
||||
dataService.fieldCodeNameMap.put(modelCode, fieldCodeName);
|
||||
} else {
|
||||
fieldCodeNameMap.put(sysIotModelField.getAttributeCode(), sysIotModelField.getAttributeName());
|
||||
}
|
||||
if (sysIotModelField.getLevel() != null){
|
||||
if (sysIotModelField.getLevel() != null) {
|
||||
Map<String, Integer> levelMap = dataService.eventLevelMap.get(modelCode);
|
||||
if (levelMap == null) {
|
||||
Map<String, Integer> calMap = new HashMap<>();
|
||||
@ -652,7 +656,7 @@ public class SysIotModelServiceImpl implements SysIotModelService {
|
||||
}
|
||||
|
||||
}
|
||||
if (sysIotModelField.getStateDesc() != null){
|
||||
if (sysIotModelField.getStateDesc() != null) {
|
||||
Map<String, String> stateDescMap = dataService.stateDescMap.get(modelCode);
|
||||
if (stateDescMap == null) {
|
||||
Map<String, String> calMap = new HashMap<>();
|
||||
@ -710,10 +714,10 @@ public class SysIotModelServiceImpl implements SysIotModelService {
|
||||
String modelCode = dataService.iotModelMap.get(sysIotModelField.getIotModelId().toString());
|
||||
Map<String, String> fieldCodeName = dataService.fieldCodeNameMap.get(modelCode);
|
||||
fieldCodeName.remove(sysIotModelField.getAttributeCode());
|
||||
if (sysIotModelField.getLevel() != null){
|
||||
if (sysIotModelField.getLevel() != null) {
|
||||
dataService.eventLevelMap.remove(sysIotModelField.getAttributeCode());
|
||||
}
|
||||
if (sysIotModelField.getStateDesc() != null){
|
||||
if (sysIotModelField.getStateDesc() != null) {
|
||||
dataService.stateDescMap.remove(sysIotModelField.getAttributeCode());
|
||||
}
|
||||
if (sysIotModelField.getAttributeType() == 199) {
|
||||
|
@ -26,7 +26,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 故障录波controller
|
||||
* 运行日志controller
|
||||
*/
|
||||
@Slf4j
|
||||
@RequestMapping("/api/plc")
|
||||
|
Loading…
Reference in New Issue
Block a user