导出注解行数根据内容动态设置
This commit is contained in:
@@ -47,6 +47,7 @@ import com.nis.domain.FunctionServiceDict;
|
||||
import com.nis.domain.SysDataDictionaryItem;
|
||||
import com.nis.domain.basics.ServiceDictInfo;
|
||||
import com.nis.domain.configuration.DnsResStrategy;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.Encodes;
|
||||
import com.nis.util.Reflections;
|
||||
@@ -139,7 +140,8 @@ public class ExportExcel {
|
||||
}
|
||||
}
|
||||
public String[] validRegionFieldAndSetComment(String headerStr,String commentStr,FunctionRegionDict region,FunctionServiceDict service,Properties msgProp){
|
||||
String[] titleInfo=new String[2];
|
||||
int index=0;
|
||||
String[] titleInfo=new String[3];
|
||||
//ratelimit
|
||||
if("ratelimit".equals(headerStr)){
|
||||
commentStr="";
|
||||
@@ -147,15 +149,20 @@ public class ExportExcel {
|
||||
if(ratelimit !=null && ratelimit.size()>0){
|
||||
for (SysDataDictionaryItem sysDataDictionaryItem : ratelimit) {
|
||||
if(StringUtil.isEmpty(msgProp.getProperty(sysDataDictionaryItem.getItemValue()))){
|
||||
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+":"+sysDataDictionaryItem.getItemValue()+"\n";
|
||||
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+"\n";
|
||||
index++;
|
||||
}else{
|
||||
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+":"+msgProp.getProperty(sysDataDictionaryItem.getItemValue())+"\n";
|
||||
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+"\n";
|
||||
index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(StringUtil.isEmpty(commentStr)){
|
||||
headerStr="";
|
||||
commentStr="";
|
||||
}else{
|
||||
commentStr=msgProp.getProperty("select")+":\n"+commentStr;
|
||||
index++;
|
||||
}
|
||||
}
|
||||
//replace_zone
|
||||
@@ -166,14 +173,19 @@ public class ExportExcel {
|
||||
for (SysDataDictionaryItem sysDataDictionaryItem : interceptReplaceZone) {
|
||||
if(StringUtil.isEmpty(msgProp.getProperty(sysDataDictionaryItem.getItemValue()))){
|
||||
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+":"+sysDataDictionaryItem.getItemValue()+"\n";
|
||||
index++;
|
||||
}else{
|
||||
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+":"+msgProp.getProperty(sysDataDictionaryItem.getItemValue())+"\n";
|
||||
index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(StringUtil.isEmpty(commentStr)){
|
||||
headerStr="";
|
||||
commentStr="";
|
||||
}else{
|
||||
commentStr=msgProp.getProperty("select")+":\n"+commentStr;
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -190,12 +202,16 @@ public class ExportExcel {
|
||||
}else{
|
||||
for (DnsResStrategy dnsResStrategy : resStrategys) {
|
||||
commentStr=commentStr+dnsResStrategy.getCfgId()+":"+dnsResStrategy.getCfgDesc()+"\n";
|
||||
index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(StringUtil.isEmpty(commentStr)){
|
||||
headerStr="";
|
||||
commentStr="";
|
||||
}else{
|
||||
commentStr=msgProp.getProperty("select")+":\n"+commentStr;
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -217,88 +233,178 @@ public class ExportExcel {
|
||||
commentStr="";
|
||||
if((","+region.getConfigIpType()+",").indexOf(",4,") > -1){
|
||||
if((","+region.getConfigIpPattern()+",").indexOf(",3,") > -1){
|
||||
commentStr=commentStr+"0.0.0.0"+"\n";
|
||||
commentStr=commentStr+Constants.IPV4_DEFAULT_IP_VALUE+"(IPv4)"+"\n";
|
||||
index++;
|
||||
}
|
||||
if((","+region.getConfigIpPattern()+",").indexOf(",2,") > -1){
|
||||
commentStr=commentStr+"0.0.0.0-1"+"\n";
|
||||
commentStr=commentStr+Constants.IPV4_DEFAULT_IP_RANGE_VALUE+"("+msgProp.getProperty("ipv4_range")+")"+"\n";
|
||||
index++;
|
||||
}
|
||||
if((","+region.getConfigIpPattern()+",").indexOf(",1,") > -1){
|
||||
commentStr=commentStr+"0.0.0.0/16"+"\n";
|
||||
commentStr=commentStr+Constants.IPV4_DEFAULT_IP_SUBNET_VALUE+"("+msgProp.getProperty("ipv4_mask")+")"+"\n";
|
||||
index++;
|
||||
}
|
||||
}
|
||||
if((","+region.getConfigIpType()+",").indexOf(",6,") > -1){
|
||||
if((","+region.getConfigIpPattern()+",").indexOf(",3,") > -1){
|
||||
commentStr=commentStr+"::"+"\n";
|
||||
commentStr=commentStr+Constants.IPV6_DEFAULT_IP_VALUE+"(IPv6)"+"\n";
|
||||
index++;
|
||||
}
|
||||
if((","+region.getConfigIpPattern()+",").indexOf(",2,") > -1){
|
||||
commentStr=commentStr+"::-::"+"\n";
|
||||
commentStr=commentStr+Constants.IPV6_DEFAULT_IP_RANGE_VALUE+"("+msgProp.getProperty("ipv6_range")+")"+"\n";
|
||||
index++;
|
||||
}
|
||||
if((","+region.getConfigIpPattern()+",").indexOf(",1,") > -1){
|
||||
commentStr=commentStr+"::/128"+"\n";
|
||||
commentStr=commentStr+Constants.IPV6_DEFAULT_IP_SUBNET_VALUE+"("+msgProp.getProperty("ipv6_mask")+")"+"\n";
|
||||
index++;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
headerStr="";
|
||||
commentStr="";
|
||||
}
|
||||
if(StringUtil.isEmpty(commentStr)){
|
||||
headerStr="";
|
||||
commentStr="";
|
||||
}else{
|
||||
commentStr=msgProp.getProperty("example")+":\n"+commentStr;
|
||||
index++;
|
||||
/**TODO
|
||||
规则:
|
||||
index++;
|
||||
1、源ip和目的ip不能相等
|
||||
index++;
|
||||
2、源ip和目的ip格式必须一致
|
||||
index++;
|
||||
3、IPv4 Range 必须是C段IP
|
||||
index++;
|
||||
4、IPv4 Mask 掩码范围16-32
|
||||
index++;
|
||||
5、IPv6 Mask 掩码范围2-128
|
||||
index++;
|
||||
*/
|
||||
}
|
||||
|
||||
}
|
||||
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";
|
||||
commentStr=commentStr+Constants.IPV4_DEFAULT_IP_VALUE+"(IPv4)"+"\n";
|
||||
index++;
|
||||
}
|
||||
if((","+region.getConfigIpPattern()+",").indexOf(",2,") > -1){
|
||||
commentStr=commentStr+"0.0.0.0-1"+"\n";
|
||||
commentStr=commentStr+Constants.IPV4_DEFAULT_IP_RANGE_VALUE+"("+msgProp.getProperty("ipv4_range")+")"+"\n";
|
||||
index++;
|
||||
}
|
||||
if((","+region.getConfigIpPattern()+",").indexOf(",1,") > -1){
|
||||
commentStr=commentStr+"0.0.0.0/16"+"\n";
|
||||
commentStr=commentStr+Constants.IPV4_DEFAULT_IP_SUBNET_VALUE+"("+msgProp.getProperty("ipv4_mask")+")"+"\n";
|
||||
index++;
|
||||
}
|
||||
}
|
||||
if((","+region.getConfigIpType()+",").indexOf(",6,") > -1){
|
||||
if((","+region.getConfigIpPattern()+",").indexOf(",3,") > -1){
|
||||
commentStr=commentStr+"::"+"\n";
|
||||
commentStr=commentStr+Constants.IPV6_DEFAULT_IP_VALUE+"(IPv6)"+"\n";
|
||||
index++;
|
||||
}
|
||||
if((","+region.getConfigIpPattern()+",").indexOf(",2,") > -1){
|
||||
commentStr=commentStr+"::-::"+"\n";
|
||||
commentStr=commentStr+Constants.IPV6_DEFAULT_IP_RANGE_VALUE+"("+msgProp.getProperty("ipv6_range")+")"+"\n";
|
||||
index++;
|
||||
}
|
||||
if((","+region.getConfigIpPattern()+",").indexOf(",1,") > -1){
|
||||
commentStr=commentStr+"::/128"+"\n";
|
||||
commentStr=commentStr+Constants.IPV6_DEFAULT_IP_SUBNET_VALUE+"("+msgProp.getProperty("ipv6_mask")+")"+"\n";
|
||||
index++;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
headerStr="";
|
||||
commentStr="";
|
||||
}
|
||||
if(StringUtil.isEmpty(commentStr)){
|
||||
headerStr="";
|
||||
commentStr="";
|
||||
}else{
|
||||
commentStr=msgProp.getProperty("example")+":\n"+commentStr;
|
||||
index++;
|
||||
/**TODO
|
||||
规则:
|
||||
index++;
|
||||
1、源ip和目的ip不能相等
|
||||
index++;
|
||||
2、源ip和目的ip格式必须一致
|
||||
index++;
|
||||
3、IPv4 Range 必须是C段IP
|
||||
index++;
|
||||
4、IPv4 Mask 掩码范围16-32
|
||||
index++;
|
||||
5、IPv6 Mask 掩码范围2-128
|
||||
index++;
|
||||
*/
|
||||
}
|
||||
}
|
||||
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";
|
||||
commentStr=commentStr+Constants.PORT_DEFAULT+"(Port)"+"\n";
|
||||
index++;
|
||||
}
|
||||
if((","+region.getConfigPortPattern()+",").indexOf(",2,") > -1){
|
||||
commentStr=commentStr+"0/65535["+msgProp.getProperty("val_src_port_mask")+"]"+"\n";
|
||||
commentStr=commentStr+Constants.PORT_MASK_DEFAULT+"(Port/"+msgProp.getProperty("port_mask")+")"+"\n";
|
||||
index++;
|
||||
}
|
||||
}else{
|
||||
headerStr="";
|
||||
commentStr="";
|
||||
}
|
||||
if(StringUtil.isEmpty(commentStr)){
|
||||
headerStr="";
|
||||
commentStr="";
|
||||
}else{
|
||||
commentStr=msgProp.getProperty("example")+":\n"+commentStr;
|
||||
index++;
|
||||
/**TODO
|
||||
规则:
|
||||
index++;
|
||||
1、源端口和目的端口格式必须一致
|
||||
index++;
|
||||
2、端口范围0-65535
|
||||
index++;
|
||||
3、端口掩码范围0-65535
|
||||
index++;
|
||||
4、非TCP、UDP、ALL协议,端口必须为0
|
||||
index++;
|
||||
*/
|
||||
}
|
||||
}
|
||||
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";
|
||||
commentStr=commentStr+Constants.PORT_DEFAULT+"(Port)"+"\n";
|
||||
index++;
|
||||
}
|
||||
if((","+region.getConfigPortPattern()+",").indexOf(",2,") > -1){
|
||||
commentStr=commentStr+"0/65535["+msgProp.getProperty("val_src_port_mask")+"]"+"\n";
|
||||
commentStr=commentStr+Constants.PORT_MASK_DEFAULT+"(Port/"+msgProp.getProperty("port_mask")+")"+"\n";
|
||||
index++;
|
||||
}
|
||||
}else{
|
||||
headerStr="";
|
||||
commentStr="";
|
||||
}
|
||||
/**TODO
|
||||
规则:
|
||||
index++;
|
||||
1、源端口和目的端口格式必须一致
|
||||
index++;
|
||||
2、端口范围0-65535
|
||||
index++;
|
||||
3、端口掩码范围0-65535
|
||||
index++;
|
||||
4、非TCP、UDP、ALL协议,端口必须为0
|
||||
index++;
|
||||
*/
|
||||
}
|
||||
}
|
||||
//导入的Protocol
|
||||
@@ -311,7 +417,8 @@ public class ExportExcel {
|
||||
if(protocol !=null && protocol.size()>0){
|
||||
for (SysDataDictionaryItem sysDataDictionaryItem : protocol) {
|
||||
if(sysDataDictionaryItem.getItemCode().equals(6)){
|
||||
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+":"+sysDataDictionaryItem.getItemValue()+"\n";
|
||||
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+"("+sysDataDictionaryItem.getItemValue()+")"+"\n";
|
||||
index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -322,9 +429,11 @@ public class ExportExcel {
|
||||
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";
|
||||
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+"("+sysDataDictionaryItem.getItemValue()+")"+"\n";
|
||||
index++;
|
||||
}else{
|
||||
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+":"+msgProp.getProperty(sysDataDictionaryItem.getItemValue())+"\n";
|
||||
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+"("+msgProp.getProperty(sysDataDictionaryItem.getItemValue())+")"+"\n";
|
||||
index++;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -342,20 +451,25 @@ public class ExportExcel {
|
||||
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";
|
||||
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+"("+sysDataDictionaryItem.getItemValue()+")"+"\n";
|
||||
index++;
|
||||
}else{
|
||||
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+":"+msgProp.getProperty(sysDataDictionaryItem.getItemValue())+"\n";
|
||||
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+"("+msgProp.getProperty(sysDataDictionaryItem.getItemValue())+")"+"\n";
|
||||
index++;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if(StringUtil.isEmpty(commentStr)){
|
||||
headerStr="";
|
||||
commentStr="";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(StringUtil.isEmpty(commentStr)){
|
||||
headerStr="";
|
||||
commentStr="";
|
||||
}else{
|
||||
commentStr=msgProp.getProperty("select")+":\n"+commentStr;
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
//Direction
|
||||
@@ -370,9 +484,11 @@ public class ExportExcel {
|
||||
for (SysDataDictionaryItem sysDataDictionaryItem : direction) {
|
||||
if(((","+region.getConfigDirection()+",").indexOf(sysDataDictionaryItem.getItemCode()) >-1)
|
||||
&& StringUtil.isEmpty(msgProp.getProperty(sysDataDictionaryItem.getItemValue()))){
|
||||
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+":"+sysDataDictionaryItem.getItemValue()+"\n";
|
||||
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+"("+sysDataDictionaryItem.getItemValue()+")"+"\n";
|
||||
index++;
|
||||
}else if((","+region.getConfigDirection()+",").indexOf(sysDataDictionaryItem.getItemCode()) >-1){
|
||||
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+":"+msgProp.getProperty(sysDataDictionaryItem.getItemValue())+"\n";
|
||||
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+"("+msgProp.getProperty(sysDataDictionaryItem.getItemValue())+")"+"\n";
|
||||
index++;
|
||||
}
|
||||
}
|
||||
if(StringUtil.isEmpty(commentStr)){
|
||||
@@ -381,6 +497,13 @@ public class ExportExcel {
|
||||
}
|
||||
}
|
||||
}
|
||||
if(StringUtil.isEmpty(commentStr)){
|
||||
headerStr="";
|
||||
commentStr="";
|
||||
}else{
|
||||
commentStr=msgProp.getProperty("select")+":\n"+commentStr;
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
//字符串或摘要字符串
|
||||
@@ -392,9 +515,16 @@ public class ExportExcel {
|
||||
commentStr="";
|
||||
}else{
|
||||
commentStr=region.getConfigDistrict();
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
if(StringUtil.isEmpty(commentStr)){
|
||||
headerStr="";
|
||||
commentStr="";
|
||||
}else{
|
||||
commentStr=msgProp.getProperty("select")+":\n"+commentStr;
|
||||
index++;
|
||||
}
|
||||
}
|
||||
//expr type
|
||||
if("expression_type".equals(headerStr)){
|
||||
@@ -408,17 +538,22 @@ public class ExportExcel {
|
||||
for (SysDataDictionaryItem sysDataDictionaryItem : exprType) {
|
||||
if(((","+region.getConfigExprType()+",").indexOf(sysDataDictionaryItem.getItemCode()) >-1)
|
||||
&& StringUtil.isEmpty(msgProp.getProperty(sysDataDictionaryItem.getItemValue()))){
|
||||
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+":"+sysDataDictionaryItem.getItemValue()+"\n";
|
||||
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+"("+sysDataDictionaryItem.getItemValue()+")"+"\n";
|
||||
index++;
|
||||
}else if((","+region.getConfigExprType()+",").indexOf(sysDataDictionaryItem.getItemCode()) >-1){
|
||||
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+":"+msgProp.getProperty(sysDataDictionaryItem.getItemValue())+"\n";
|
||||
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+"("+msgProp.getProperty(sysDataDictionaryItem.getItemValue())+")"+"\n";
|
||||
index++;
|
||||
}
|
||||
}
|
||||
if(StringUtil.isEmpty(commentStr)){
|
||||
headerStr="";
|
||||
commentStr="";
|
||||
}
|
||||
}
|
||||
}
|
||||
if(StringUtil.isEmpty(commentStr)){
|
||||
headerStr="";
|
||||
commentStr="";
|
||||
}else{
|
||||
commentStr=msgProp.getProperty("select")+":\n"+commentStr;
|
||||
index++;
|
||||
}
|
||||
}
|
||||
//match method
|
||||
if("match_method".equals(headerStr)){
|
||||
@@ -432,15 +567,20 @@ public class ExportExcel {
|
||||
for (SysDataDictionaryItem sysDataDictionaryItem : matchMethod) {
|
||||
if(((","+region.getConfigMatchMethod()+",").indexOf(sysDataDictionaryItem.getItemCode()) >-1)
|
||||
&& StringUtil.isEmpty(msgProp.getProperty(sysDataDictionaryItem.getItemValue()))){
|
||||
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+":"+sysDataDictionaryItem.getItemValue()+"\n";
|
||||
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+"("+sysDataDictionaryItem.getItemValue()+")"+"\n";
|
||||
index++;
|
||||
}else if((","+region.getConfigMatchMethod()+",").indexOf(sysDataDictionaryItem.getItemCode()) >-1){
|
||||
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+":"+msgProp.getProperty(sysDataDictionaryItem.getItemValue())+"\n";
|
||||
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+"("+msgProp.getProperty(sysDataDictionaryItem.getItemValue())+")"+"\n";
|
||||
index++;
|
||||
}
|
||||
}
|
||||
if(StringUtil.isEmpty(commentStr)){
|
||||
headerStr="";
|
||||
commentStr="";
|
||||
}
|
||||
}
|
||||
if(StringUtil.isEmpty(commentStr)){
|
||||
headerStr="";
|
||||
commentStr="";
|
||||
}else{
|
||||
commentStr=msgProp.getProperty("select")+":\n"+commentStr;
|
||||
index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -456,24 +596,29 @@ public class ExportExcel {
|
||||
if(((","+region.getConfigHex()+",").indexOf(",1,") >-1)){
|
||||
for (SysDataDictionaryItem sysDataDictionaryItem : isHex) {
|
||||
if(sysDataDictionaryItem.getItemCode().equals("1")){
|
||||
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+":"+sysDataDictionaryItem.getItemValue()+"\n";
|
||||
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+"("+sysDataDictionaryItem.getItemValue()+")"+"\n";
|
||||
index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!((","+region.getConfigHex()+",").indexOf(",1,") >-1)){
|
||||
for (SysDataDictionaryItem sysDataDictionaryItem : isHex) {
|
||||
if(sysDataDictionaryItem.getItemCode().equals("0")){
|
||||
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+":"+sysDataDictionaryItem.getItemValue()+"\n";
|
||||
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+"("+sysDataDictionaryItem.getItemValue()+")"+"\n";
|
||||
index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(StringUtil.isEmpty(commentStr)){
|
||||
headerStr="";
|
||||
commentStr="";
|
||||
}
|
||||
}
|
||||
}
|
||||
if(StringUtil.isEmpty(commentStr)){
|
||||
headerStr="";
|
||||
commentStr="";
|
||||
}else{
|
||||
commentStr=msgProp.getProperty("select")+":\n"+commentStr;
|
||||
index++;
|
||||
}
|
||||
}
|
||||
if("is_case_insenstive".equals(headerStr)){
|
||||
if(StringUtil.isEmpty(region.getConfigHex())){
|
||||
@@ -486,28 +631,34 @@ public class ExportExcel {
|
||||
if(((","+region.getConfigHex()+",").indexOf(",2,") >-1)){
|
||||
for (SysDataDictionaryItem sysDataDictionaryItem : isCaseSenstive) {
|
||||
if(sysDataDictionaryItem.getItemCode().equals("1")){
|
||||
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+":"+sysDataDictionaryItem.getItemValue()+"\n";
|
||||
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+"("+sysDataDictionaryItem.getItemValue()+")"+"\n";
|
||||
index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!((","+region.getConfigHex()+",").indexOf(",2,") >-1)){
|
||||
for (SysDataDictionaryItem sysDataDictionaryItem : isCaseSenstive) {
|
||||
if(sysDataDictionaryItem.getItemCode().equals("0")){
|
||||
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+":"+sysDataDictionaryItem.getItemValue()+"\n";
|
||||
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+"("+sysDataDictionaryItem.getItemValue()+")"+"\n";
|
||||
index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(StringUtil.isEmpty(commentStr)){
|
||||
headerStr="";
|
||||
commentStr="";
|
||||
}
|
||||
}
|
||||
}
|
||||
if(StringUtil.isEmpty(commentStr)){
|
||||
headerStr="";
|
||||
commentStr="";
|
||||
}else{
|
||||
commentStr=msgProp.getProperty("select")+":\n"+commentStr;
|
||||
index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
titleInfo[0]=headerStr;
|
||||
titleInfo[1]=commentStr;
|
||||
titleInfo[2]=index+"";
|
||||
return titleInfo;
|
||||
}
|
||||
/**
|
||||
@@ -635,7 +786,7 @@ public class ExportExcel {
|
||||
headerList.add(titleStr);
|
||||
commentList.add(commentStr);
|
||||
}
|
||||
initialize(title, headerList,commentList);
|
||||
initialize(title, headerList,commentList,null);
|
||||
}
|
||||
/**
|
||||
* 构造函数
|
||||
@@ -714,9 +865,11 @@ public class ExportExcel {
|
||||
// Initialize
|
||||
List<String> headerList = Lists.newArrayList();
|
||||
List<String> commentList = Lists.newArrayList();
|
||||
List<Integer> commentRowList = Lists.newArrayList();
|
||||
for (Object[] os : annotationList){
|
||||
String titleStr = ((ExcelField)os[0]).title();
|
||||
String commentStr = ((ExcelField)os[0]).comment();
|
||||
Integer commentRow = 0;
|
||||
|
||||
// 如果是导出,则去掉注释
|
||||
if (type==1){
|
||||
@@ -726,14 +879,16 @@ public class ExportExcel {
|
||||
String[] titleInfo=validRegionFieldAndSetComment(titleStr,commentStr,region,service,msgProp);
|
||||
titleStr=titleInfo[0];
|
||||
commentStr=titleInfo[1];
|
||||
commentRow=StringUtil.isEmpty(titleInfo[2]) ? 0:Integer.parseInt(titleInfo[2]);
|
||||
}
|
||||
if(!StringUtil.isEmpty(titleStr)){
|
||||
headerList.add(msgProp.getProperty(titleStr)==null?titleStr:msgProp.getProperty(titleStr));
|
||||
commentList.add(commentStr);
|
||||
commentRowList.add(commentRow);
|
||||
}
|
||||
|
||||
}
|
||||
initialize(title, headerList,commentList);
|
||||
initialize(title, headerList,commentList,commentRowList);
|
||||
}
|
||||
/**
|
||||
* 构造函数
|
||||
@@ -825,7 +980,7 @@ public class ExportExcel {
|
||||
}
|
||||
|
||||
}
|
||||
initialize(title, headerList,commentList);
|
||||
initialize(title, headerList,commentList,null);
|
||||
}
|
||||
/**
|
||||
* 构造函数
|
||||
@@ -937,7 +1092,7 @@ public class ExportExcel {
|
||||
headerList.add(msgProp.getProperty(titleStr)==null?titleStr:msgProp.getProperty(titleStr));
|
||||
commentList.add(commentStr);
|
||||
}
|
||||
initialize(title, headerList,commentList);
|
||||
initialize(title, headerList,commentList,null);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -946,7 +1101,7 @@ public class ExportExcel {
|
||||
* @param headers 表头数组
|
||||
*/
|
||||
public ExportExcel(String title, String[] headers, String[] comments) {
|
||||
initialize(title, Lists.newArrayList(headers), Lists.newArrayList(comments));
|
||||
initialize(title, Lists.newArrayList(headers), Lists.newArrayList(comments),null);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -955,8 +1110,8 @@ public class ExportExcel {
|
||||
* @param headerList 表头列表
|
||||
* @param commentList 注释列表
|
||||
*/
|
||||
public ExportExcel(String title, List<String> headerList, List<String> commentList) {
|
||||
initialize(title, headerList,commentList);
|
||||
public ExportExcel(String title, List<String> headerList, List<String> commentList,List<Integer> commentRowList) {
|
||||
initialize(title, headerList,commentList,commentRowList);
|
||||
}
|
||||
|
||||
|
||||
@@ -965,7 +1120,7 @@ public class ExportExcel {
|
||||
* @param title 表格标题,传“空值”,表示无标题
|
||||
* @param headerList 表头列表
|
||||
*/
|
||||
private void initialize(String title, List<String> headerList, List<String> commentList) {
|
||||
private void initialize(String title, List<String> headerList, List<String> commentList,List<Integer> commentRowList) {
|
||||
this.wb = new SXSSFWorkbook(500);
|
||||
this.sheet = wb.createSheet("Export");
|
||||
this.styles = createStyles(wb);
|
||||
@@ -989,10 +1144,16 @@ public class ExportExcel {
|
||||
Cell cell = headerRow.createCell(i);
|
||||
cell.setCellStyle(styles.get("header"));
|
||||
String commentStr = commentList.get(i);
|
||||
Integer commentRow =3;
|
||||
if(!StringUtil.isEmpty(commentRowList)
|
||||
&& !StringUtil.isEmpty(commentRowList.get(i))
|
||||
&& commentRowList.get(i) > 0){
|
||||
commentRow=commentRowList.get(i);
|
||||
}
|
||||
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, i+5));
|
||||
new XSSFClientAnchor(0, 0, 0, 0, (short) i, 0, (short) i+3, commentRow));
|
||||
comment.setString(new XSSFRichTextString(commentStr));
|
||||
cell.setCellComment(comment);
|
||||
}else{
|
||||
|
||||
Reference in New Issue
Block a user