radius 动态列隐藏来导出Excel

This commit is contained in:
leijun
2018-12-15 22:53:52 +08:00
parent d8cf08011e
commit 68fe4209c7
6 changed files with 59 additions and 34 deletions

View File

@@ -11,6 +11,7 @@ public class BaseLogEntity<T> extends BaseEntity<T> {
protected Integer cfgId;
@ExcelField(title="found_time",sort=5)
protected String foundTime; //发现时间timestamp
@ExcelField(title="recv_time",sort=6)
protected String recvTime; //接收时间timestamp
@ExcelField(title="transport_layer_protocol",dictType="LOG_PROTOCOL",sort=30)
protected String transProto; //协议类型从字典LOG_PROTOCOL取值
@@ -29,12 +30,15 @@ public class BaseLogEntity<T> extends BaseEntity<T> {
@ExcelField(title="client_port",sort=43)
protected String sPort; //客户端ip端口
protected Integer service; //配置表的serviceId
@ExcelField(title="entrance_id",dictType="ENTRANCE",sort=7)
protected Integer entranceId; //出入口编号
@ExcelField(title="deviceid",dictType="DEVICE",sort=45)
protected Integer deviceId; //串联设备编号
@ExcelField(title="direction",dictType="LOG_DIRECTION",sort=55)
protected Integer direction; //传输方向 0域内->域外1域外->域内从字典LOG_DIRECTION取值
@ExcelField(title="stream_type",dictType="LOG_STREAM_TYPE",sort=65)
protected Integer streamDir; //流类型 0c2s1s2c2double从字典LOG_STREAMTYPE取值
@ExcelField(title="clj_ip",sort=27)
protected String capIp; //处理机IP
@ExcelField(title="nest_addr_list",sort=66)
protected String addrList; //嵌套地址列表
@@ -42,12 +46,17 @@ public class BaseLogEntity<T> extends BaseEntity<T> {
protected String serverLocate;// 服务端地址定位信息
@ExcelField(title="client_locate",sort=68)
protected String clientLocate;// 客户端地址定位信息
@ExcelField(title="user_region",sort=76)
protected String userRegion; //用户自定义
@ExcelField(title="s_asn",sort=70)
protected String sAsn;//客户端ASN
@ExcelField(title="d_asn",sort=71)
protected String dAsn;//服务端ASN
@ExcelField(title="s_subscribe_id",sort=73)
protected String sSubscribeId;//客户端用户名
@ExcelField(title="d_subscribe_id",sort=74)
protected String dSubscribeId;//服务端用户名
@ExcelField(title="scene_file",sort=70)
@ExcelField(title="scene_file",sort=77)
protected String sceneFile;//现场日志文件地址
protected Integer functionId;
@@ -65,6 +74,7 @@ public class BaseLogEntity<T> extends BaseEntity<T> {
//新增字段
@ExcelField(title="encap_type",dictType="ENCAP_TYPE",sort=50)
protected Integer encapType;//原始二层封装格式
@ExcelField(title="link_id",dictType="LINK",sort=47)
protected Integer linkId;//串联设备链路号
@ExcelField(title="inner_smac",sort=58)
protected String innerSmac;//MAC_IN_MAC的内层源MAC

View File

@@ -49,6 +49,14 @@ public class Reflections {
getName="dPort";
}else if(getName.equals("SPort")){
getName="sPort";
}else if(getName.equals("SAsn")){
getName="sAsn";
}else if(getName.equals("DAsn")){
getName="dAsn";
}else if(getName.equals("SSubscribeId")){
getName="sSubscribeId";
}else if(getName.equals("DSubscribeId")){
getName="dSubscribeId";
}
String getterMethodName = GETTER_PREFIX + getName;
object = invokeMethod(object, getterMethodName, new Class[] {}, new Object[] {});

View File

@@ -1910,7 +1910,7 @@ public class ExportExcel {
val = getBasicInfo(ef.dictType(),map,valStr);
}else{
//字典数据已做国际化处理
String dict=DictUtils.getDictLabel(ef.dictType(), valStr, "");
String dict=DictUtils.getDictLabel(ef.dictType(), valStr, valStr);
//如果找不到字典国际化值,把字典本身作为默认值放进去,不然导出就是空了
val = msgProp.getProperty(dict,dict);
}

View File

@@ -78,7 +78,7 @@ public class NtcCollectRadiusLogController extends BaseController {
//radius配置导出
@RequestMapping(value = "exportRadius")
public void exportRadius(@ModelAttribute("log") NtcCollectRadiusLog log, Model model, HttpServletRequest request, HttpServletResponse response,RedirectAttributes redirectAttributes){
public void exportRadius(@ModelAttribute("log") NtcCollectRadiusLog log, Model model,String hColumns, HttpServletRequest request, HttpServletResponse response,RedirectAttributes redirectAttributes){
try {
//export data info
List<String> titleList=new ArrayList<String>();
@@ -114,7 +114,7 @@ public class NtcCollectRadiusLogController extends BaseController {
}
titleList.add("radius_log");
classMap.put("radius_log", NtcCollectRadiusLog.class);
String cfgIndexInfoNoExport="";
String cfgIndexInfoNoExport=","+hColumns;
noExportMap.put("radius_log",cfgIndexInfoNoExport);
dataMap.put("radius_log",list);
/*}*/
@@ -125,4 +125,5 @@ public class NtcCollectRadiusLogController extends BaseController {
}
}
}

View File

@@ -382,9 +382,12 @@ function cancelPassOpt(url){
//导出
function exportData(url,maxRow,searchUrl){
var column=[];
var hColumn=[]; //隐藏列名
$("#${id} ${value} thead tr th").each(function(){
if($(this).is(":visible")){
column.push($(this).text().trim());
}else{
hColumn.push($(this).attr("column"));
}
});
if($("#exportType").val() != null && $("#exportType").val() != ""){
@@ -395,6 +398,9 @@ function cancelPassOpt(url){
if(column){
url+="&columns="+column.toString();
}
if(hColumn){
url+="&hColumns="+hColumn.toString();
}
var checkboxes=$("#${id} ${value} tbody tr td input.i-checks:checkbox");
//导出选中数据
if($(checkboxes).filter(":checked").length>0){

View File

@@ -214,40 +214,40 @@
<th><spring:message code="log"/></th>
<%-- <th class="sort-column cfg_id " isVisible="false" ><spring:message code="cfg_id"/></th>
<th class="sort-column service" isVisible="false"><spring:message code="action"/></th> --%>
<th class="sort-column found_time"><spring:message code="found_time"/></th>
<th class="sort-column recv_time" isVisible="false"><spring:message code="recv_time"/></th>
<th class="sort-column entrance_id" isVisible="false"><spring:message code="entrance_id"/></th>
<th class="sort-column found_time" column="" ><spring:message code="found_time"/></th>
<th class="sort-column recv_time" isVisible="false" column="recv_time"><spring:message code="recv_time"/></th>
<th class="sort-column entrance_id" isVisible="false" column="entrance_id"><spring:message code="entrance_id"/></th>
<th class="sort-column code" ><spring:message code="message_type"/></th>
<th class="sort-column nas_ip"><spring:message code="nas_ip"/></th>
<th class="sort-column framed_ip"><spring:message code='framed_ip'/></th>
<th class="sort-column account"><spring:message code="log_user_name"/></th>
<th class="sort-column code" column="message_type"><spring:message code="message_type"/></th>
<th class="sort-column nas_ip" column="nas_ip"><spring:message code="nas_ip"/></th>
<th class="sort-column framed_ip" column="framed_ip"><spring:message code='framed_ip'/></th>
<th class="sort-column account" column="log_user_name"><spring:message code="log_user_name"/></th>
<th class="sort-column cap_ip" isVisible="false"><spring:message code="clj_ip"/></th>
<th class="sort-column trans_proto"><spring:message code="transport_layer_protocol"/></th>
<th class="sort-column addr_type"><spring:message code='addr_type'/></th>
<th class="sort-column d_ip"><spring:message code="server_ip"/></th>
<th class="sort-column s_ip"><spring:message code="client_ip"/></th>
<th class="sort-column d_port"><spring:message code="server_port"/></th>
<th class="sort-column s_port"><spring:message code="client_port"/></th>
<th class="sort-column device_id" isVisible="false"><spring:message code="deviceid"/></th>
<th class="sort-column link_id" isVisible="false"><spring:message code="link_id"/></th>
<th class="sort-column encap_type"><spring:message code="encap_type"/></th>
<th class="sort-column direction"><spring:message code="direction"/></th>
<th class="sort-column inner_smac"><spring:message code="inner_smac"/></th>
<th class="sort-column inner_dmac"><spring:message code="inner_dmac"/></th>
<th class="sort-column stream_dir"><spring:message code="stream_type"/></th>
<th class="sort-column cap_ip" isVisible="false" column="clj_ip"><spring:message code="clj_ip"/></th>
<th class="sort-column trans_proto" column="transport_layer_protocol"><spring:message code="transport_layer_protocol"/></th>
<th class="sort-column addr_type" column="addr_type"><spring:message code='addr_type'/></th>
<th class="sort-column d_ip" column="server_ip"><spring:message code="server_ip"/></th>
<th class="sort-column s_ip" column="client_ip"><spring:message code="client_ip"/></th>
<th class="sort-column d_port" column="server_port"><spring:message code="server_port"/></th>
<th class="sort-column s_port" column="client_port"><spring:message code="client_port"/></th>
<th class="sort-column device_id" isVisible="false" column="deviceid"><spring:message code="deviceid"/></th>
<th class="sort-column link_id" isVisible="false" column="link_id"><spring:message code="link_id"/></th>
<th class="sort-column encap_type" column="encap_type"><spring:message code="encap_type"/></th>
<th class="sort-column direction" column="direction"><spring:message code="direction"/></th>
<th class="sort-column inner_smac" column="inner_smac"><spring:message code="inner_smac"/></th>
<th class="sort-column inner_dmac" column="inner_dmac"><spring:message code="inner_dmac"/></th>
<th class="sort-column stream_dir" column="stream_type"><spring:message code="stream_type"/></th>
<th class="sort-column addr_list"><spring:message code="nest_addr_list"/></th>
<th class="sort-column server_locate"><spring:message code='server_locate'/></th>
<th class="sort-column client_locate"><spring:message code='client_locate'/></th>
<th class="sort-column s_asn" isVisible="false"><spring:message code='s_asn'/></th>
<th class="sort-column d_asn" isVisible="false"><spring:message code='d_asn'/></th>
<th class="sort-column s_subscribe_id" isVisible="false"><spring:message code='s_subscribe_id'/></th>
<th class="sort-column d_subscribe_id" isVisible="false"><spring:message code='d_subscribe_id'/></th>
<th class="sort-column user_region" isVisible="false"><spring:message code='user_region'/></th>
<c:if test="${fns:getUser().isAdmin()}"><th class="sort-column scene_file"><spring:message code='scene_file'/></th></c:if>
<th class="sort-column addr_list" column="nest_addr_list"><spring:message code="nest_addr_list"/></th>
<th class="sort-column server_locate" column="server_locate"><spring:message code='server_locate'/></th>
<th class="sort-column client_locate" column="client_locate"><spring:message code='client_locate'/></th>
<th class="sort-column s_asn" isVisible="false" column="s_asn"><spring:message code='s_asn'/></th>
<th class="sort-column d_asn" isVisible="false" column="d_asn"><spring:message code='d_asn'/></th>
<th class="sort-column s_subscribe_id" isVisible="false" column="s_subscribe_id"><spring:message code='s_subscribe_id'/></th>
<th class="sort-column d_subscribe_id" isVisible="false" column="d_subscribe_id"><spring:message code='d_subscribe_id'/></th>
<th class="sort-column user_region" isVisible="false" column="user_region"><spring:message code='user_region'/></th>
<c:if test="${fns:getUser().isAdmin()}"><th class="sort-column scene_file" column="scene_file"><spring:message code='scene_file'/></th></c:if>
</tr>
</thead>
<tbody>