develop

Conflicts:
	src/main/java/com/nis/web/controller/configuration/ntc/IpController.java
	限速模板增加ratelimit字段,修改导出protocol注释信息
This commit is contained in:
duandongmei
2018-10-17 11:10:50 +08:00
20 changed files with 719 additions and 225 deletions

View File

@@ -133,52 +133,21 @@ public class ExportExcel {
}
public String[] validRegionFieldAndSetComment(String headerStr,String commentStr,FunctionRegionDict region,FunctionServiceDict service,Properties msgProp){
String[] titleInfo=new String[2];
if(region.getIsMaat().equals(1)){//maat
if(region.getRegionType().equals(1)){//IP配置
//ip配置需要导入的信息:srcIp srcPort destIp destPort Protocol Direction
//确定需要导入的srcIp srcPort destIp destPort信息
if(StringUtil.isEmpty(region.getConfigIpPortShow())){//无源目的ip和端口
if("client_ip".equals(headerStr)
|| "server_ip".equals(headerStr)
|| "client_port".equals(headerStr)
|| "server_port".equals(headerStr)
){
headerStr="";
commentStr="";
}
}else{
if("client_ip".equals(headerStr)){
if(((","+region.getConfigIpPortShow()+",").indexOf(",1,") > -1) ){
commentStr="";
if((","+region.getConfigIpType()+",").indexOf(",4,") > -1){
if((","+region.getConfigIpPattern()+",").indexOf(",3,") > -1){
commentStr=commentStr+"0.0.0.0"+"\n";
}
if((","+region.getConfigIpPattern()+",").indexOf(",2,") > -1){
commentStr=commentStr+"0.0.0.0-1"+"\n";
}
if((","+region.getConfigIpPattern()+",").indexOf(",1,") > -1){
commentStr=commentStr+"0.0.0.0/16"+"\n";
}
}
if((","+region.getConfigIpType()+",").indexOf(",6,") > -1){
if((","+region.getConfigIpPattern()+",").indexOf(",3,") > -1){
commentStr=commentStr+"::"+"\n";
}
if((","+region.getConfigIpPattern()+",").indexOf(",2,") > -1){
commentStr=commentStr+"::-::"+"\n";
}
if((","+region.getConfigIpPattern()+",").indexOf(",1,") > -1){
commentStr=commentStr+"::/128"+"\n";
}
}
}else{
headerStr="";
commentStr="";
}
}
if("server_ip".equals(headerStr)){
if((","+region.getConfigIpPortShow()+",").indexOf(",3,") > -1){
if(region.getRegionType().equals(1)){//IP配置
//ip配置需要导入的信息srcIp srcPort destIp destPort Protocol Direction
//确定需要导入的srcIp srcPort destIp destPort信息
if(StringUtil.isEmpty(region.getConfigIpPortShow())){//无源目的ip和端口
if("client_ip".equals(headerStr)
|| "server_ip".equals(headerStr)
|| "client_port".equals(headerStr)
|| "server_port".equals(headerStr)
){
headerStr="";
commentStr="";
}
}else{
if("client_ip".equals(headerStr)){
if(((","+region.getConfigIpPortShow()+",").indexOf(",1,") > -1) ){
commentStr="";
if((","+region.getConfigIpType()+",").indexOf(",4,") > -1){
if((","+region.getConfigIpPattern()+",").indexOf(",3,") > -1){
@@ -206,108 +175,157 @@ public class ExportExcel {
headerStr="";
commentStr="";
}
}
if("client_port".equals(headerStr)){
if(((","+region.getConfigIpPortShow()+",").indexOf(",2,") > -1)){
commentStr="";
if((","+region.getConfigPortPattern()+",").indexOf(",1,") > -1){
commentStr=commentStr+"0["+msgProp.getProperty("val_src_port")+"]"+"\n";
}
if("server_ip".equals(headerStr)){
if((","+region.getConfigIpPortShow()+",").indexOf(",3,") > -1){
commentStr="";
if((","+region.getConfigIpType()+",").indexOf(",4,") > -1){
if((","+region.getConfigIpPattern()+",").indexOf(",3,") > -1){
commentStr=commentStr+"0.0.0.0"+"\n";
}
if((","+region.getConfigPortPattern()+",").indexOf(",2,") > -1){
commentStr=commentStr+"0/65535["+msgProp.getProperty("val_src_port_mask")+"]"+"\n";
if((","+region.getConfigIpPattern()+",").indexOf(",2,") > -1){
commentStr=commentStr+"0.0.0.0-1"+"\n";
}
if((","+region.getConfigIpPattern()+",").indexOf(",1,") > -1){
commentStr=commentStr+"0.0.0.0/16"+"\n";
}
}else{
headerStr="";
commentStr="";
}
}
if("server_port".equals(headerStr)){
if((","+region.getConfigIpPortShow()+",").indexOf(",4,") > -1){
commentStr="";
if((","+region.getConfigPortPattern()+",").indexOf(",1,") > -1){
commentStr=commentStr+"0["+msgProp.getProperty("val_src_port")+"]"+"\n";
if((","+region.getConfigIpType()+",").indexOf(",6,") > -1){
if((","+region.getConfigIpPattern()+",").indexOf(",3,") > -1){
commentStr=commentStr+"::"+"\n";
}
if((","+region.getConfigPortPattern()+",").indexOf(",2,") > -1){
commentStr=commentStr+"0/65535["+msgProp.getProperty("val_src_port_mask")+"]"+"\n";
if((","+region.getConfigIpPattern()+",").indexOf(",2,") > -1){
commentStr=commentStr+"::-::"+"\n";
}
if((","+region.getConfigIpPattern()+",").indexOf(",1,") > -1){
commentStr=commentStr+"::/128"+"\n";
}
}else{
headerStr="";
commentStr="";
}
}else{
headerStr="";
commentStr="";
}
}
//导入的Protocol
if("protocol".equals(headerStr)){
if(service.getFunctionId().equals(5) ){
}
if("client_port".equals(headerStr)){
if(((","+region.getConfigIpPortShow()+",").indexOf(",2,") > -1)){
commentStr="";
if((","+region.getConfigPortPattern()+",").indexOf(",1,") > -1){
commentStr=commentStr+"0["+msgProp.getProperty("val_src_port")+"]"+"\n";
}
if((","+region.getConfigPortPattern()+",").indexOf(",2,") > -1){
commentStr=commentStr+"0/65535["+msgProp.getProperty("val_src_port_mask")+"]"+"\n";
}
}else{
headerStr="";
commentStr="";
}
}
if("server_port".equals(headerStr)){
if((","+region.getConfigIpPortShow()+",").indexOf(",4,") > -1){
commentStr="";
if((","+region.getConfigPortPattern()+",").indexOf(",1,") > -1){
commentStr=commentStr+"0["+msgProp.getProperty("val_src_port")+"]"+"\n";
}
if((","+region.getConfigPortPattern()+",").indexOf(",2,") > -1){
commentStr=commentStr+"0/65535["+msgProp.getProperty("val_src_port_mask")+"]"+"\n";
}
}else{
headerStr="";
commentStr="";
}
}
}
//导入的Protocol
if("protocol".equals(headerStr)){
if(service.getFunctionId().equals(5) ){
commentStr="";
//block tcp
if(service.getAction().equals(16) ){
List<SysDataDictionaryItem> protocol=DictUtils.getDictList("PROTOCOL");
if(protocol !=null && protocol.size()>0){
for (SysDataDictionaryItem sysDataDictionaryItem : protocol) {
if(sysDataDictionaryItem.getItemCode().equals(6)){
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+":"+sysDataDictionaryItem.getItemValue()+"\n";
}
}
}
}else{
commentStr="";
List<SysDataDictionaryItem> protocol=DictUtils.getDictList("PROTOCOL");
if(protocol !=null && protocol.size()>0){
for (SysDataDictionaryItem sysDataDictionaryItem : protocol) {
if(service.getAction().equals(16) && sysDataDictionaryItem.getItemCode().equals(6)){
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+":"+sysDataDictionaryItem.getItemValue()+"\n";
}
if(service.getAction().equals(1) &&
(sysDataDictionaryItem.getItemCode().equals(6)
|| sysDataDictionaryItem.getItemCode().equals(17)
|| sysDataDictionaryItem.getItemCode().equals(0) )){
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+":"+sysDataDictionaryItem.getItemValue()+"\n";
}
if(service.getAction().equals(32) &&
(sysDataDictionaryItem.getItemCode().equals(6)
|| sysDataDictionaryItem.getItemCode().equals(17)
|| sysDataDictionaryItem.getItemCode().equals(1)
|| sysDataDictionaryItem.getItemCode().equals(15)
|| sysDataDictionaryItem.getItemCode().equals(51)
|| sysDataDictionaryItem.getItemCode().equals(50))){
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+":"+sysDataDictionaryItem.getItemValue()+"\n";
}
if(service.getAction().equals(64) &&
(sysDataDictionaryItem.getItemCode().equals(6)
|| sysDataDictionaryItem.getItemCode().equals(17) )){
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+":"+sysDataDictionaryItem.getItemValue()+"\n";
}
}
}
}else{
if(StringUtil.isEmpty(region.getConfigProtocol())){
headerStr="";
commentStr="";
}else{
commentStr="";
List<SysDataDictionaryItem> protocol=DictUtils.getDictList("PROTOCOL");
if(protocol !=null && protocol.size()>0){
for (SysDataDictionaryItem sysDataDictionaryItem : protocol) {
if((","+region.getConfigProtocol()+",").indexOf(","+sysDataDictionaryItem.getItemCode()+",") >0){
if(StringUtil.isEmpty(msgProp.getProperty(sysDataDictionaryItem.getItemValue()))){
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+":"+sysDataDictionaryItem.getItemValue()+"\n";
}else{
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+":"+msgProp.getProperty(sysDataDictionaryItem.getItemValue())+"\n";
}
if((","+region.getConfigProtocol()+",").indexOf(","+sysDataDictionaryItem.getItemCode()+",") >-1){
if(StringUtil.isEmpty(msgProp.getProperty(sysDataDictionaryItem.getItemValue()))){
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+":"+sysDataDictionaryItem.getItemValue()+"\n";
}else{
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+":"+msgProp.getProperty(sysDataDictionaryItem.getItemValue())+"\n";
}
}
}
}
}
}
//导入的Direction
if("direction".equals(headerStr)){
}else{
if(StringUtil.isEmpty(region.getConfigProtocol())){
headerStr="";
commentStr="";
}else{
commentStr="";
List<SysDataDictionaryItem> direction=DictUtils.getDictList("DIRECTION");
if(direction !=null && direction.size()>0){
for (SysDataDictionaryItem sysDataDictionaryItem : direction) {
if(StringUtil.isEmpty(msgProp.getProperty(sysDataDictionaryItem.getItemValue()))){
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+":"+sysDataDictionaryItem.getItemValue()+"\n";
}else{
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+":"+msgProp.getProperty(sysDataDictionaryItem.getItemValue())+"\n";
List<SysDataDictionaryItem> protocol=DictUtils.getDictList("PROTOCOL");
if(protocol !=null && protocol.size()>0){
for (SysDataDictionaryItem sysDataDictionaryItem : protocol) {
if((","+region.getConfigProtocol()+",").indexOf(","+sysDataDictionaryItem.getItemCode()+",") >-1){
if(StringUtil.isEmpty(msgProp.getProperty(sysDataDictionaryItem.getItemValue()))){
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+":"+sysDataDictionaryItem.getItemValue()+"\n";
}else{
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+":"+msgProp.getProperty(sysDataDictionaryItem.getItemValue())+"\n";
}
}
}
if(StringUtil.isEmpty(commentStr)){
headerStr="";
commentStr="";
}
}
}
}
}
//导入的Direction
if("direction".equals(headerStr)){
if(StringUtil.isEmpty(region.getConfigDirection())){
headerStr="";
commentStr="";
}else{
commentStr="";
List<SysDataDictionaryItem> direction=DictUtils.getDictList("DIRECTION");
if(direction !=null && direction.size()>0){
for (SysDataDictionaryItem sysDataDictionaryItem : direction) {
if(((","+region.getConfigDirection()+",").indexOf(sysDataDictionaryItem.getItemCode()) >-1) && StringUtil.isEmpty(msgProp.getProperty(sysDataDictionaryItem.getItemValue()))){
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+":"+sysDataDictionaryItem.getItemValue()+"\n";
}else if((","+region.getConfigDirection()+",").indexOf(sysDataDictionaryItem.getItemCode()) >-1){
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+":"+msgProp.getProperty(sysDataDictionaryItem.getItemValue())+"\n";
}
}
if(StringUtil.isEmpty(commentStr)){
headerStr="";
commentStr="";
}
}
}
}
//导入的限速
if("ratelimit".equals(headerStr)){
commentStr="";
List<SysDataDictionaryItem> ratelimit=DictUtils.getDictList("RATE_LIMIT");
if(ratelimit !=null && ratelimit.size()>0){
for (SysDataDictionaryItem sysDataDictionaryItem : ratelimit) {
if(StringUtil.isEmpty(msgProp.getProperty(sysDataDictionaryItem.getItemValue()))){
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+":"+sysDataDictionaryItem.getItemValue()+"\n";
}else{
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+":"+msgProp.getProperty(sysDataDictionaryItem.getItemValue())+"\n";
}
}
}
@@ -799,7 +817,7 @@ public class ExportExcel {
if (!StringUtil.isEmpty(commentStr)){
cell.setCellValue(headerList.get(i));
Comment comment = this.sheet.createDrawingPatriarch().createCellComment(
new XSSFClientAnchor(0, 0, 0, 0, (short) i, 0, (short) i+4, 3));
new XSSFClientAnchor(0, 0, 0, 0, (short) i, 0, (short) i+4, i+5));
comment.setString(new XSSFRichTextString(commentStr));
cell.setCellComment(comment);
}else{