diff options
3 files changed, 12 insertions, 8 deletions
diff --git a/nz-admin/src/main/java/com/nis/modules/panel/service/impl/VisualChartServiceImpl.java b/nz-admin/src/main/java/com/nis/modules/panel/service/impl/VisualChartServiceImpl.java index 7562adb4..424e2b43 100644 --- a/nz-admin/src/main/java/com/nis/modules/panel/service/impl/VisualChartServiceImpl.java +++ b/nz-admin/src/main/java/com/nis/modules/panel/service/impl/VisualChartServiceImpl.java @@ -246,7 +246,7 @@ public class VisualChartServiceImpl extends ServiceImpl<VisualChartDao, VisualCh // group 类型不需要校验 elements case Constant.CHART_GROUP_TYPE:{ // 当chart为group时 不允许name重复 会影响chart批量导入 - List<VisualChart> charts = this.list(new QueryWrapper<VisualChart>().lambda().eq(VisualChart::getName, chart.getName()).eq(VisualChart::getType, Constant.CHART_GROUP_TYPE.toString()).eq(VisualChart::getPanelId, chart.getPanelId()).ne(ToolUtil.isNotEmpty(chart.getId()), VisualChart::getId,chart.getId())); + List<VisualChart> charts = this.list(new QueryWrapper<VisualChart>().lambda().eq(VisualChart::getName, chart.getName()).eq(VisualChart::getType, Constant.CHART_GROUP_TYPE.toString()).eq(VisualChart::getPanelId, chart.getPanelId()).ne(ToolUtil.isNotEmpty(chart.getId()), VisualChart::getId,chart.getId()).ne(ToolUtil.isNotEmpty(chart.getVarType()), VisualChart::getVarType,chart.getVarType())); if(ToolUtil.isNotEmpty(charts)) { throw new NZException(RCode.CHART_GROUP_NAME_DUPLICATE); } diff --git a/nz-admin/src/main/java/com/nis/modules/panel/service/impl/VisualPanelServiceImpl.java b/nz-admin/src/main/java/com/nis/modules/panel/service/impl/VisualPanelServiceImpl.java index 09fd56bb..7cd3d310 100644 --- a/nz-admin/src/main/java/com/nis/modules/panel/service/impl/VisualPanelServiceImpl.java +++ b/nz-admin/src/main/java/com/nis/modules/panel/service/impl/VisualPanelServiceImpl.java @@ -718,7 +718,7 @@ public class VisualPanelServiceImpl extends ServiceImpl<VisualPanelDao, VisualPa groupChart.setName(groupName); groupChart.setGroupId(0); groupChart.setSpan(12); - groupChart.setHeight(100); + groupChart.setHeight(12); groupChart.setUpdateBy((ShiroUtils.getUserId()).intValue()); groupChart.setUpdateAt(new Date()); groupChart.setType(Constant.CHART_GROUP_TYPE.toString()); @@ -1073,11 +1073,12 @@ public class VisualPanelServiceImpl extends ServiceImpl<VisualPanelDao, VisualPa Integer groupId=0; String groupName = ExcelUtils.getCellValue(row.getCell(0)); + String varType = ExcelUtils.getCellValue(row.getCell(3)); if(StrUtil.isNotBlank(groupName)) { VisualChart groupChart; if (templateFlag) { // template 类型,panel = 0 为 template - groupChart = visualChartService.getOne(new LambdaQueryWrapper<VisualChart>().eq(VisualChart::getName, groupName).eq(VisualChart::getPanelId, 0).eq(VisualChart::getType, Constant.CHART_GROUP_TYPE)); + groupChart = visualChartService.getOne(new LambdaQueryWrapper<VisualChart>().eq(VisualChart::getName, groupName).eq(VisualChart::getPanelId, 0).eq(VisualChart::getType, Constant.CHART_GROUP_TYPE).eq(VisualChart::getVarType, varTypeAndValMap.get(varType.trim()))); } else { // asset endpoint 类型,通过指定 panel group name 查找 group groupChart = visualChartService.getOne(new QueryWrapper<VisualChart>().lambda().eq(VisualChart::getName, groupName).eq(VisualChart::getPanelId, panel.getId()).eq(VisualChart::getType, Constant.CHART_GROUP_TYPE.toString())); @@ -1089,13 +1090,16 @@ public class VisualPanelServiceImpl extends ServiceImpl<VisualPanelDao, VisualPa groupChart.setName(groupName); groupChart.setGroupId(0); groupChart.setSpan(12); - groupChart.setHeight(100); + groupChart.setHeight(12); groupChart.setUpdateBy((ShiroUtils.getUserId()).intValue()); groupChart.setUpdateAt(new Date()); groupChart.setType(Constant.CHART_GROUP_TYPE.toString()); groupChart.setUnit(2); groupChart.setBuildIn(0); groupChart.setRemark(""); + if(templateFlag) { + groupChart.setVarType(varTypeAndValMap.get(varType.trim())); + } groupChart.setSeq(seqUUID); visualChartService.save(groupChart); } @@ -1122,7 +1126,7 @@ public class VisualPanelServiceImpl extends ServiceImpl<VisualPanelDao, VisualPa VisualChart groupChart = null; if (templateFlag) { - groupChart = visualChartService.getOne(new LambdaQueryWrapper<VisualChart>().eq(VisualChart::getName, title).eq(VisualChart::getPanelId, 0).eq(VisualChart::getType, Constant.CHART_GROUP_TYPE)); + groupChart = visualChartService.getOne(new LambdaQueryWrapper<VisualChart>().eq(VisualChart::getName, title).eq(VisualChart::getPanelId, 0).eq(VisualChart::getType, Constant.CHART_GROUP_TYPE).eq(VisualChart::getVarType, varTypeAndValMap.get(varType.trim()))); } else { groupChart = visualChartService.getOne(new QueryWrapper<VisualChart>().lambda().eq(VisualChart::getName, title).eq(VisualChart::getPanelId, panel.getId()).eq(VisualChart::getType, Constant.CHART_GROUP_TYPE)); } @@ -1133,7 +1137,7 @@ public class VisualPanelServiceImpl extends ServiceImpl<VisualPanelDao, VisualPa } // varType, type = template required - String varType = ExcelUtils.getCellValue(row.getCell(3)); + if(templateFlag){ if (StringUtils.isEmpty(varType)) { saveFlag = typeFlag = false; diff --git a/nz-admin/src/main/java/com/nis/modules/sys/service/impl/SnmpCredentialServiceImpl.java b/nz-admin/src/main/java/com/nis/modules/sys/service/impl/SnmpCredentialServiceImpl.java index 9592fa7e..79e4e2b0 100644 --- a/nz-admin/src/main/java/com/nis/modules/sys/service/impl/SnmpCredentialServiceImpl.java +++ b/nz-admin/src/main/java/com/nis/modules/sys/service/impl/SnmpCredentialServiceImpl.java @@ -68,9 +68,9 @@ public class SnmpCredentialServiceImpl extends ServiceImpl<SnmpCredentialDao,Snm public void validateSnmpCredential(SnmpCredential snmpCredential) { ValidateUtils.is(snmpCredential.getName()).notNull(RCode.SNMP_CREDENTIAL_NAME_ISNULL).maxLength(64) .and(snmpCredential.getType()).notNull(RCode.SNMP_CREDENTIAL_TYPE_ISNULL) - .and(snmpCredential.getConfig()).notNull(RCode.SNMP_CREDENTIAL_CONFIG_ISNULL).maxLength(64) + .and(snmpCredential.getConfig()).notNull(RCode.SNMP_CREDENTIAL_CONFIG_ISNULL).maxLength(1024) .and(snmpCredential.getPort()).notNull(RCode.SNMP_CREDENTIAL_PORT_ISNULL) - .and(snmpCredential.getRemark()).maxLength(1024); + .and(snmpCredential.getRemark()).maxLength(256); // 当snmp为v3版本时进行参数校验 if(ToolUtil.equals(snmpCredential.getType(), 3)) { SnmpUtil.ValidateAuthForSnmpV3((Map)JSON.parseObject(snmpCredential.getConfig())); |
