/// <summary> /// 内容格式化 /// </summary> /// <param name="key"></param> /// <param name="value"></param> /// <returns></returns> private string FormatDataByKey(string key, string value, NPOISheetModel sheet, int k) { key = key.ToLower(); if (key == "createtime" || key == "itime" || key == "begintime" || key == "endtime" || key == "connecttime" || key == "offlinetime" || key == "updatetime") { return(value == "" ? "" : Convert.ToDateTime(value).ToString("yyyy-MM-dd HH:mm:ss")); } else if (key == "valid") { return(value == "1" ? "未删除" : "已删除"); } else if (key == "isap") { return(value == "0" ? "是" : "否"); } else if (key == "isopen") { return(ChangeValue.GetLocaCheckValue(Convert.ToInt32(value))); } else if (key == "filesize") { return(ChangeValue.FormatFileSize(Convert.ToInt64(value))); } else if (key == "spassword") { return(ChangeValue.RefSendPwd(value)); } else if (key == "statis") { return(value == "1" ? "营业状态" : "停业状态"); } else if (key == "netsite_type") { return(ChangeValue.GetLocaTypeValue(Convert.ToInt32(value))); } else if (key == "pullortrade") { return(value == "0" ? "正常" : (value == "1" ? "拆机" : "换机")); } else if (key == "pottype") { if (value == "0") { return("正常"); } else { return(value == "1" ? "待审核" : (value == "2" ? "审核成功" : "审核失败")); } } else if (key == "verified") { return(ChangeValue.RefVerifiedStrExcel(Convert.ToInt32(value))); } else if (key == "caseitem") { return(ChangeValue.pwItemvalue(Convert.ToInt32(value))); } else if (key == "vtname") { return(ChangeValue.VidContentType(value)); } else if (key == "dst_ip") { return(ChangeValue.RefIPvlong(Convert.ToInt64(value))); } else if (key == "netbar_id") { if (sheet.IsNETBAR_ID) { HCZZ.ModeDB.Loc_NetBarInfo loca = WebCommon.GetLocaInfoByNetBar_ID(Convert.ToInt32(value)); if (loca != null) { return(loca.PLACE_NAME); } else { return(""); } } else { return(value); } } else if (key == "ap_mac" && sheet.IsDevAP_MAC) { HCZZ.ModeDB.Loc_DevInfo mac = WebCommon.GetMacInfoByDevAP_ID(0, value); if (mac != null) { return(mac.APName); } return(""); } else if (key == "devap_id" && sheet.IsDevAP_ID) { HCZZ.ModeDB.Loc_DevInfo mac = WebCommon.GetMacInfoByDevAP_ID(Convert.ToInt32(value), ""); if (mac != null) { if (k < 2) { return(mac.APName); } else { return(mac.AP_MAC); } } return(""); } else if (sheet.IsCost) { if (key == "dt_day") { return(value.Insert(6, "-").Insert(4, "-")); } else if (key == "auditnum") { return(value + " | " + ChangeValue.FormatFileSize(Convert.ToInt32(value) * 150)); } else if (key == "httpnum") { return(value + " | " + ChangeValue.FormatFileSize(Convert.ToInt32(value) * 400)); } else if (key == "macnum") { return(value + " | " + ChangeValue.FormatFileSize(Convert.ToInt32(value) * 200)); } else if (key == "apmacnum") { return(value + " | " + ChangeValue.FormatFileSize(Convert.ToInt32(value) * 200)); } else { return(""); } } else if (key == "ip_address" || key == "src_ip" || key == "dst_ip") { return(ChangeValue.RefIPvlong(Convert.ToInt64(value))); } else if (key == "network_app") { return(ChangeValue.GetDetailHttpLog(value)); } else if (key == "start_time" || key == "end_time" || key == "capture_time") { DateTime time = new DateTime(); if (DateTime.TryParse(value, out time)) { return(value); } else { return(value == "0" ? "N/A" : ChangeValue.RefAuditTime(Convert.ToInt64(value))); } } else if (key == "terminal_field_strength" || key == "ap_field_strength") { return(string.IsNullOrEmpty(value) ? "" : ("-" + value + "dBm")); } else if (key == "access_type") { return(string.IsNullOrEmpty(value) ? "" : ChangeValue.GetConnectTypeValue(Convert.ToInt32(value))); } else if (key == "operator_net") { return(string.IsNullOrEmpty(value) ? "" : ChangeValue.GetServiceBusinesValue(value)); } else if (key == "law_principal_certificate_type") { if (!string.IsNullOrEmpty(value)) { Dictionary <string, string> dic = ChangeValue.GetCertifiCateList(); IEnumerable <KeyValuePair <string, string> > ilist = dic.Where(m => m.Key.ToLower() == value); if (ilist != null && ilist.Count() > 0) { return(ilist.First().Value); } } return(""); } else { return(value); } }