fix(配置文件)增加开发环境,清除中文空格问题

This commit is contained in:
doufenghu
2018-10-11 13:38:07 +08:00
34 changed files with 930 additions and 221 deletions

View File

@@ -28,10 +28,6 @@
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/> <attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.7.0_80"> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<attributes>
<attribute name="owner.project.facets" value="java"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/> <classpathentry kind="output" path="target/classes"/>
</classpath> </classpath>

2
.settings/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
/org.eclipse.wst.common.component
/org.eclipse.core.resources.prefs

View File

@@ -1,6 +1,8 @@
eclipse.preferences.version=1 eclipse.preferences.version=1
encoding//src/main/java=UTF-8 encoding//src/main/java=UTF-8
encoding//src/main/resources/applicationConfig-rule.properties=UTF-8
encoding//src/main/resources/b.txt=UTF-8 encoding//src/main/resources/b.txt=UTF-8
encoding//src/main/resources/fastdfs-client.properties=UTF-8
encoding//src/main/resources/jdbc.properties=UTF-8 encoding//src/main/resources/jdbc.properties=UTF-8
encoding//src/main/resources/log4j.properties=UTF-8 encoding//src/main/resources/log4j.properties=UTF-8
encoding//src/main/resources/matt.properties=UTF-8 encoding//src/main/resources/matt.properties=UTF-8
@@ -13,4 +15,3 @@ encoding//src/main/webapp/WEB-INF/tlds/fns.tld=UTF-8
encoding//src/main/webapp/WEB-INF/views/letter/process/errorView.jsp=UTF-8 encoding//src/main/webapp/WEB-INF/views/letter/process/errorView.jsp=UTF-8
encoding//src/main/webapp/static/common/jeesite.css=UTF-8 encoding//src/main/webapp/static/common/jeesite.css=UTF-8
encoding//src/test/java=UTF-8 encoding//src/test/java=UTF-8
encoding/<project>=UTF-8

View File

@@ -1,12 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0"> <?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="galaxy-0.0.1-SNAPSHOT"> <wb-module deploy-name="galaxy-service-0.0.1-SNAPSHOT">
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/> <wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/> <wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/test/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/test/resources"/>
<property name="java-output-path" value="/galaxy/target/classes"/> <property name="java-output-path" value="/galaxy/target/classes"/>
<property name="context-root" value="galaxy"/> <property name="context-root" value="galaxy-service"/>
</wb-module> </wb-module>
</project-modules> </project-modules>

10
pom.xml
View File

@@ -14,9 +14,9 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<packaging>war</packaging> <packaging>war</packaging>
<name>galaxy</name> <name>galaxy-service</name>
<groupId>com.nis.springmvc</groupId> <groupId>com.nis.galaxy</groupId>
<artifactId>galaxy</artifactId> <artifactId>galaxy-service</artifactId>
<version>0.0.1-SNAPSHOT</version> <version>0.0.1-SNAPSHOT</version>
<!-- 仓库地址构建 --> <!-- 仓库地址构建 -->
<repositories> <repositories>
@@ -30,7 +30,7 @@
<repository> <repository>
<id>nexus</id> <id>nexus</id>
<name>Team Nexus Repository</name> <name>Team Nexus Repository</name>
<url>http://10.0.6.30:8044/content/groups/public</url> <url>http://192.168.10.125:8099/content/groups/public</url>
</repository> </repository>
<!-- <repository> <id>nexus</id> <name>Team Nexus Repository</name> <url>http://json-lib.sourceforge.net/</url> <!-- <repository> <id>nexus</id> <name>Team Nexus Repository</name> <url>http://json-lib.sourceforge.net/</url>
</repository> --> </repository> -->
@@ -562,7 +562,7 @@
<dependency> <dependency>
<groupId>org.csource</groupId> <groupId>org.csource</groupId>
<artifactId>fastdfs-client-java</artifactId> <artifactId>fastdfs-client-java</artifactId>
<version>1.27-SNAPSHOT</version> <version>1.27</version>
</dependency> </dependency>

View File

@@ -0,0 +1,190 @@
package com.nis.domain.restful;
import java.io.Serializable;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.wordnik.swagger.annotations.ApiModelProperty;
public class NmsDiRule implements Serializable {
private static final long serialVersionUID = 1L;
@JsonIgnore
private long id;
private long detectionInfoId;
private long serviceIndex;
private long serviceCode;
private String serviceDesc;
private long agedTime;
private String clientNum;
private String refluxPort;
private String ruleNumber;
private String usedRuleNum;
private String leftRuleNum;
private String hitTotalNum;
private String detectionedState;
private long seqId;
private long detectionSetInfoId;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "dataCheckTime", notes = "")
private Date dataCheckTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "dataArriveTime", notes = "")
private Date dataArriveTime;
private long dataCheckTimeDigital;
private long dataArriveTimeDigital;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public long getDetectionInfoId() {
return detectionInfoId;
}
public void setDetectionInfoId(long detectionInfoId) {
this.detectionInfoId = detectionInfoId;
}
public long getServiceIndex() {
return serviceIndex;
}
public void setServiceIndex(long serviceIndex) {
this.serviceIndex = serviceIndex;
}
public long getServiceCode() {
return serviceCode;
}
public void setServiceCode(long serviceCode) {
this.serviceCode = serviceCode;
}
public String getServiceDesc() {
return serviceDesc;
}
public void setServiceDesc(String serviceDesc) {
this.serviceDesc = serviceDesc;
}
public long getAgedTime() {
return agedTime;
}
public void setAgedTime(long agedTime) {
this.agedTime = agedTime;
}
public String getClientNum() {
return clientNum;
}
public void setClientNum(String clientNum) {
this.clientNum = clientNum;
}
public String getRefluxPort() {
return refluxPort;
}
public void setRefluxPort(String refluxPort) {
this.refluxPort = refluxPort;
}
public String getRuleNumber() {
return ruleNumber;
}
public void setRuleNumber(String ruleNumber) {
this.ruleNumber = ruleNumber;
}
public String getUsedRuleNum() {
return usedRuleNum;
}
public void setUsedRuleNum(String usedRuleNum) {
this.usedRuleNum = usedRuleNum;
}
public String getLeftRuleNum() {
return leftRuleNum;
}
public void setLeftRuleNum(String leftRuleNum) {
this.leftRuleNum = leftRuleNum;
}
public String getHitTotalNum() {
return hitTotalNum;
}
public void setHitTotalNum(String hitTotalNum) {
this.hitTotalNum = hitTotalNum;
}
public String getDetectionedState() {
return detectionedState;
}
public void setDetectionedState(String detectionedState) {
this.detectionedState = detectionedState;
}
public long getSeqId() {
return seqId;
}
public void setSeqId(long seqId) {
this.seqId = seqId;
}
public long getDetectionSetInfoId() {
return detectionSetInfoId;
}
public void setDetectionSetInfoId(long detectionSetInfoId) {
this.detectionSetInfoId = detectionSetInfoId;
}
public Date getDataCheckTime() {
return dataCheckTime;
}
public void setDataCheckTime(Date dataCheckTime) {
this.dataCheckTime = dataCheckTime;
}
public Date getDataArriveTime() {
return dataArriveTime;
}
public void setDataArriveTime(Date dataArriveTime) {
this.dataArriveTime = dataArriveTime;
}
public long getDataCheckTimeDigital() {
return dataCheckTimeDigital;
}
public void setDataCheckTimeDigital(long dataCheckTimeDigital) {
this.dataCheckTimeDigital = dataCheckTimeDigital;
}
public long getDataArriveTimeDigital() {
return dataArriveTimeDigital;
}
public void setDataArriveTimeDigital(long dataArriveTimeDigital) {
this.dataArriveTimeDigital = dataArriveTimeDigital;
}
}

View File

@@ -0,0 +1,19 @@
package com.nis.domain.restful;
import java.io.Serializable;
import java.util.List;
public class NmsDiRuleList implements Serializable {
private static final long serialVersionUID = 1L;
private List<NmsDiRule> nmsDiRuleList;
public List<NmsDiRule> getNmsDiRuleList() {
return nmsDiRuleList;
}
public void setNmsDiRuleList(List<NmsDiRule> nmsDiRuleList) {
this.nmsDiRuleList = nmsDiRuleList;
}
}

View File

@@ -0,0 +1,108 @@
package com.nis.domain.restful;
import java.io.Serializable;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.wordnik.swagger.annotations.ApiModelProperty;
public class TrafficNetflowPortInfo implements Serializable {
private static final long serialVersionUID = 1L;
@JsonIgnore
private long stat_id;
private long port;
private String nodeName;
private String nodeIp;
private String portDesc;
private long bandwidth;
private long inoctets;
private long outoctets;
private long inoctetsSpeed;
private long outoctetsSpeed;
private long inpktsSpeed;
private long outpktsSpeed;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "dataArriveTime", notes = "")
private Date recvTime;
public long getStat_id() {
return stat_id;
}
public void setStat_id(long stat_id) {
this.stat_id = stat_id;
}
public long getPort() {
return port;
}
public void setPort(long port) {
this.port = port;
}
public String getNodeName() {
return nodeName;
}
public void setNodeName(String nodeName) {
this.nodeName = nodeName;
}
public String getNodeIp() {
return nodeIp;
}
public void setNodeIp(String nodeIp) {
this.nodeIp = nodeIp;
}
public String getPortDesc() {
return portDesc;
}
public void setPortDesc(String portDesc) {
this.portDesc = portDesc;
}
public long getBandwidth() {
return bandwidth;
}
public void setBandwidth(long bandwidth) {
this.bandwidth = bandwidth;
}
public long getInoctets() {
return inoctets;
}
public void setInoctets(long inoctets) {
this.inoctets = inoctets;
}
public long getOutoctets() {
return outoctets;
}
public void setOutoctets(long outoctets) {
this.outoctets = outoctets;
}
public long getInoctetsSpeed() {
return inoctetsSpeed;
}
public void setInoctetsSpeed(long inoctetsSpeed) {
this.inoctetsSpeed = inoctetsSpeed;
}
public long getOutoctetsSpeed() {
return outoctetsSpeed;
}
public void setOutoctetsSpeed(long outoctetsSpeed) {
this.outoctetsSpeed = outoctetsSpeed;
}
public long getInpktsSpeed() {
return inpktsSpeed;
}
public void setInpktsSpeed(long inpktsSpeed) {
this.inpktsSpeed = inpktsSpeed;
}
public long getOutpktsSpeed() {
return outpktsSpeed;
}
public void setOutpktsSpeed(long outpktsSpeed) {
this.outpktsSpeed = outpktsSpeed;
}
public Date getRecvTime() {
return recvTime;
}
public void setRecvTime(Date recvTime) {
this.recvTime = recvTime;
}
}

View File

@@ -0,0 +1,19 @@
package com.nis.domain.restful;
import java.io.Serializable;
import java.util.List;
public class TrafficNetflowPortInfoList implements Serializable {
private static final long serialVersionUID = 1L;
private List<TrafficNetflowPortInfo> trafficNetflowPortInfoList;
public List<TrafficNetflowPortInfo> getTrafficNetflowPortInfoList() {
return trafficNetflowPortInfoList;
}
public void setTrafficNetflowPortInfoList(List<TrafficNetflowPortInfo> trafficNetflowPortInfoList) {
this.trafficNetflowPortInfoList = trafficNetflowPortInfoList;
}
}

View File

@@ -620,6 +620,15 @@ public enum RestBusinessCode {
* Redis关联关系库中未找到配置对应的redisdb信息 * Redis关联关系库中未找到配置对应的redisdb信息
*/ */
RedisDBRelationNotExistsInRedis(5003005,"Redis关联关系库中未找到配置对应的redisdb信息"), RedisDBRelationNotExistsInRedis(5003005,"Redis关联关系库中未找到配置对应的redisdb信息"),
/**
* 保存文件到redis发生了异常
*/
SaveFileToRedisError(5003006,"保存文件到redis发生了异常"),
/** /**
* Map中缺少编译配置信息 * Map中缺少编译配置信息

View File

@@ -203,5 +203,8 @@ public final class Constants {
* 样例文件存放目录 * 样例文件存放目录
*/ */
public static final String MM_SAMPLE_DST_PATH = Configurations.getStringProperty("mmSampleDstPath", "/home/mesasoft/{tableType}/full/{fileName}"); public static final String MM_SAMPLE_DST_PATH = Configurations.getStringProperty("mmSampleDstPath", "/home/mesasoft/{tableType}/full/{fileName}");
/**
*是否使用Minio
*/
public static final Boolean IS_USE_MINIO = Configurations.getBooleanProperty("isUseMinio", true);
} }

View File

@@ -0,0 +1,50 @@
package com.nis.util;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import com.nis.restful.RestBusinessCode;
import com.nis.restful.ServiceRuntimeException;
import redis.clients.jedis.Transaction;
public class File2Redis {
private static String fileProtocol = Configurations.getStringProperty("fileProtocol", "minio://");
public static String file2Redis(String url, Transaction transaction) {
try {
byte[] fileByte = downLoadFromUrl(url);
String md5 = MD5Utils.getMd5ByIS(new ByteArrayInputStream(fileByte));
String key = "__FILE_" + md5;
transaction.set(key.getBytes(), fileByte);
return fileProtocol + key;
} catch (Exception e) {
throw new ServiceRuntimeException("保存文件到redis发生了异常:" + e.getMessage(),
RestBusinessCode.SaveFileToRedisError.getValue());
}
}
public static byte[] downLoadFromUrl(String urlStr) throws IOException {
URL url = new URL(urlStr);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
// 设置超时间为30秒
conn.setConnectTimeout(3 * 10000);
// 防止屏蔽程序抓取而返回403错误
conn.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)");
// 得到输入流
InputStream inputStream = conn.getInputStream();
ByteArrayOutputStream baosOutputStream = new ByteArrayOutputStream();
byte[] buffer = new byte[1024];
int len;
while ((len = inputStream.read(buffer)) > -1) {
baosOutputStream.write(buffer, 0, len);
}
baosOutputStream.flush();
return baosOutputStream.toByteArray();
}
}

View File

@@ -3,41 +3,29 @@
*/ */
package com.nis.util; package com.nis.util;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.security.MessageDigest; import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
import java.util.List;
import java.util.Locale;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.servlet.http.HttpServletRequest; import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.lang3.StringEscapeUtils;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.springframework.web.servlet.LocaleResolver;
import com.ckfinder.connector.ServletContextFactory;
import com.google.common.collect.Lists;
import com.nis.web.service.SpringContextHolder;
/** /**
* 字符串工具类, 继承org.apache.commons.lang3.StringUtils类 * 字符串工具类, 继承org.apache.commons.lang3.StringUtils类
* @author ThinkGem * @author ThinkGem
* @version 2013-05-22 * @version 2013-05-22
*/ */
public class MD5Utils{ public class MD5Utils {
/** /**
* 字符串转为MD532位小写 * 字符串转为MD532位小写
* @param plain * @param plain
* @return * @return
*/ */
public static String md5LowerCase(String plain) throws Exception{ public static String md5LowerCase(String plain) throws Exception {
String re_md5 = new String(); String re_md5 = new String();
MessageDigest md = MessageDigest.getInstance("MD5"); MessageDigest md = MessageDigest.getInstance("MD5");
md.update(plain.getBytes()); md.update(plain.getBytes());
@@ -58,26 +46,52 @@ public class MD5Utils{
re_md5 = buf.toString(); re_md5 = buf.toString();
return re_md5; return re_md5;
} }
public static byte[] createChecksum(String filename) throws IOException, NoSuchAlgorithmException{
InputStream fis=new FileInputStream(filename); public static byte[] createChecksum(String filename) throws IOException, NoSuchAlgorithmException {
byte[] buffer=new byte[1024]; InputStream fis = new FileInputStream(filename);
MessageDigest complete=MessageDigest.getInstance("MD5"); byte[] buffer = new byte[1024];
MessageDigest complete = MessageDigest.getInstance("MD5");
int numRead; int numRead;
do{ do {
numRead=fis.read(buffer); numRead = fis.read(buffer);
if(numRead>0){ if (numRead > 0) {
complete.update(buffer,0,numRead); complete.update(buffer, 0, numRead);
} }
}while(numRead!=-1); } while (numRead != -1);
fis.close(); fis.close();
return complete.digest(); return complete.digest();
} }
public static String getMD5Checksum(String filename) throws NoSuchAlgorithmException, IOException{
byte[] b=createChecksum(filename); public static String getMD5Checksum(String filename) throws NoSuchAlgorithmException, IOException {
StringBuffer result=new StringBuffer(); byte[] b = createChecksum(filename);
for(int i=0;i<b.length;i++){ StringBuffer result = new StringBuffer();
result.append(Integer.toString((b[i] & 0xff)+ 0x100,16).substring(1)); for (int i = 0; i < b.length; i++) {
result.append(Integer.toString((b[i] & 0xff) + 0x100, 16).substring(1));
} }
return result.toString(); return result.toString();
} }
public static void main(String[] args) throws NoSuchAlgorithmException, IOException {
long start1 = System.currentTimeMillis();
String md5Checksum = getMd5ByIS(new FileInputStream("f:\\1.iso"));
System.out.println(md5Checksum);
long start2 = System.currentTimeMillis();
System.out.println("第一次用时" + (start2 - start1));
String md5Checksum1 = getMD5Checksum("f:\\1.iso");
long start3 = System.currentTimeMillis();
System.out.println(md5Checksum1);
System.out.println("第二次用时" + (start3 - start2));
}
/**
* 这种方式计算大文件时更快一些
* @param fis
* @return
* @throws IOException
* @throws NoSuchAlgorithmException
*/
public static String getMd5ByIS(InputStream is) throws IOException, NoSuchAlgorithmException {
return DigestUtils.md5Hex(is);
}
} }

View File

@@ -29,6 +29,7 @@ import com.nis.restful.RestServiceException;
import com.nis.restful.ServiceRuntimeException; import com.nis.restful.ServiceRuntimeException;
import com.nis.util.Constants; import com.nis.util.Constants;
import com.nis.util.FileUtils; import com.nis.util.FileUtils;
import com.nis.util.MinioUtil;
import com.nis.util.StringUtil; import com.nis.util.StringUtil;
import com.nis.util.StringUtils; import com.nis.util.StringUtils;
import com.nis.web.controller.BaseRestController; import com.nis.web.controller.BaseRestController;
@@ -289,6 +290,10 @@ public class ConfigSourcesController extends BaseRestController {
throw new RestServiceException("checksum与文件MD5值不一致", RestBusinessCode.CheckSumIsWrong.getValue()); throw new RestServiceException("checksum与文件MD5值不一致", RestBusinessCode.CheckSumIsWrong.getValue());
} }
String ext = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".") + 1); String ext = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".") + 1);
logger.info("-----------------调用接口上传文件---------------");
if(Constants.IS_USE_MINIO){
filePath = MinioUtil.uploadFile(file.getInputStream(), file.getOriginalFilename(), ext);
}else{
FastDFSFile fdsfile = new FastDFSFile(file.getBytes(), file.getOriginalFilename(), ext); FastDFSFile fdsfile = new FastDFSFile(file.getBytes(), file.getOriginalFilename(), ext);
// NameValuePair[] meta_list = new NameValuePair[5]; // NameValuePair[] meta_list = new NameValuePair[5];
// meta_list[0] = new NameValuePair("fileName", file.getOriginalFilename()); // meta_list[0] = new NameValuePair("fileName", file.getOriginalFilename());
@@ -297,9 +302,9 @@ public class ConfigSourcesController extends BaseRestController {
// meta_list[2] = new NameValuePair("fileExt", ext); // meta_list[2] = new NameValuePair("fileExt", ext);
// meta_list[3] = new NameValuePair("fileAuthor", "rkg"); // meta_list[3] = new NameValuePair("fileAuthor", "rkg");
// meta_list[4] = new NameValuePair("fileMd5", md5); // meta_list[4] = new NameValuePair("fileMd5", md5);
logger.info("-----------------调用接口上传文件---------------");
filePath = FileManager.upload(fdsfile, null); filePath = FileManager.upload(fdsfile, null);
} }
}
}catch (IOException e) { }catch (IOException e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
logger.error(RestBusinessCode.FileUploadFailure.getErrorReason()+":"+e.getMessage()); logger.error(RestBusinessCode.FileUploadFailure.getErrorReason()+":"+e.getMessage());
@@ -337,6 +342,7 @@ public class ConfigSourcesController extends BaseRestController {
AuditLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_POST, request, AuditLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_POST, request,
file, null); file, null);
JSONObject resultObject = new JSONObject(); JSONObject resultObject = new JSONObject();
String filePath="";
try { try {
if (file == null) { if (file == null) {
throw new RestServiceException("请上传获取摘要的文件到file参数", RestBusinessCode.FileIsNull.getValue()); throw new RestServiceException("请上传获取摘要的文件到file参数", RestBusinessCode.FileIsNull.getValue());
@@ -353,9 +359,20 @@ public class ConfigSourcesController extends BaseRestController {
RestBusinessCode.CheckSumIsWrong.getValue()); RestBusinessCode.CheckSumIsWrong.getValue());
} }
String ext = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".") + 1); String ext = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".") + 1);
FastDFSFile fdsfile = new FastDFSFile(file.getBytes(), file.getOriginalFilename(), ext);
logger.info("-----------------调用接口上传文件---------------"); logger.info("-----------------调用接口上传文件---------------");
String filePath = FileManager.upload(fdsfile, null); if(Constants.IS_USE_MINIO){
filePath = MinioUtil.uploadFile(file.getInputStream(), file.getOriginalFilename(), ext);
}else{
FastDFSFile fdsfile = new FastDFSFile(file.getBytes(), file.getOriginalFilename(), ext);
// NameValuePair[] meta_list = new NameValuePair[5];
// meta_list[0] = new NameValuePair("fileName", file.getOriginalFilename());
// meta_list[1] = new NameValuePair("fileLength",
// String.valueOf(file.getSize()));
// meta_list[2] = new NameValuePair("fileExt", ext);
// meta_list[3] = new NameValuePair("fileAuthor", "rkg");
// meta_list[4] = new NameValuePair("fileMd5", md5);
filePath = FileManager.upload(fdsfile, null);
}
resultObject.put("accessUrl", filePath); resultObject.put("accessUrl", filePath);
} }
}catch (IOException e) { }catch (IOException e) {

View File

@@ -11,7 +11,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.nis.domain.restful.TrafficNmsServerStatistic; import com.nis.domain.restful.NmsDiRuleList;
import com.nis.domain.restful.TrafficNetflowPortInfoList;
import com.nis.domain.restful.TrafficNmsServerStatisticList; import com.nis.domain.restful.TrafficNmsServerStatisticList;
import com.nis.restful.RestBusinessCode; import com.nis.restful.RestBusinessCode;
import com.nis.restful.RestServiceException; import com.nis.restful.RestServiceException;
@@ -19,6 +20,8 @@ import com.nis.util.Constants;
import com.nis.web.controller.BaseRestController; import com.nis.web.controller.BaseRestController;
import com.nis.web.service.AuditLogThread; import com.nis.web.service.AuditLogThread;
import com.nis.web.service.ServicesRequestLogService; import com.nis.web.service.ServicesRequestLogService;
import com.nis.web.service.restful.NmsDiRuleService;
import com.nis.web.service.restful.TrafficNetflowPortInfoService;
import com.nis.web.service.restful.TrafficNmsServerStatisticService; import com.nis.web.service.restful.TrafficNmsServerStatisticService;
import com.wordnik.swagger.annotations.Api; import com.wordnik.swagger.annotations.Api;
import com.wordnik.swagger.annotations.ApiOperation; import com.wordnik.swagger.annotations.ApiOperation;
@@ -32,6 +35,10 @@ public class NmsInfoController extends BaseRestController {
protected ServicesRequestLogService servicesRequestLogService; protected ServicesRequestLogService servicesRequestLogService;
@Autowired @Autowired
TrafficNmsServerStatisticService trafficNmsServerStatisticService; TrafficNmsServerStatisticService trafficNmsServerStatisticService;
@Autowired
NmsDiRuleService nmsDiRuleService;
@Autowired
TrafficNetflowPortInfoService trafficNetflowPortInfoService;
@RequestMapping(value = "/nms/v1/saveServerStatus", method = RequestMethod.POST) @RequestMapping(value = "/nms/v1/saveServerStatus", method = RequestMethod.POST)
@ApiOperation(value = "存储NMS系统上报的服务器状态接口", httpMethod = "POST", response = Map.class, notes = "接收NMS系统上报的服务器状态信息") @ApiOperation(value = "存储NMS系统上报的服务器状态接口", httpMethod = "POST", response = Map.class, notes = "接收NMS系统上报的服务器状态信息")
@@ -60,4 +67,55 @@ public class NmsInfoController extends BaseRestController {
Constants.IS_DEBUG ? trafficNmsServerStatisticList : null); Constants.IS_DEBUG ? trafficNmsServerStatisticList : null);
} }
@RequestMapping(value = "/nms/v1/saveNmsDiRule", method = RequestMethod.POST)
@ApiOperation(value = "存储NmsDiRule接口", httpMethod = "POST", response = Map.class, notes = "接收NMS系统上报的di信息")
@ApiParam(value = "存储NmsDiRule接口", name = "saveServerStatus", required = true)
public Map<String, Object> saveNmsDiRule(@RequestBody NmsDiRuleList nmsDiRuleList, HttpServletRequest request,
HttpServletResponse response) {
long start = System.currentTimeMillis();
AuditLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_POST, request,
nmsDiRuleList);
try {
if (nmsDiRuleList != null && nmsDiRuleList.getNmsDiRuleList() != null
&& nmsDiRuleList.getNmsDiRuleList().size() > 0) {
nmsDiRuleService.saveNmsDiRuleInfo(nmsDiRuleList.getNmsDiRuleList());
} else {
throw new RestServiceException(thread, System.currentTimeMillis() - start, "参数nmsDiRuleList不能为空",
RestBusinessCode.missing_args.getValue());
}
} catch (Exception e) {
throw new RestServiceException(thread, System.currentTimeMillis() - start,
"上报NmsDiRule信息异常:" + e.getMessage(), RestBusinessCode.unknow_error.getValue());
}
return compileServiceResponse(thread, System.currentTimeMillis() - start, request, response, "上报NmsDiRule信息成功",
Constants.IS_DEBUG ? nmsDiRuleList : null);
}
@RequestMapping(value = "/nms/v1/rafficNetflowPortInfo", method = RequestMethod.POST)
@ApiOperation(value = "存储trafficNetflowPortInfo接口", httpMethod = "POST", response = Map.class, notes = "接收NMS系统上报的trafficNetflowPort信息")
@ApiParam(value = "存储trafficNetflowPortInfo接口", name = "saveTrafficNetflowPortInfo", required = true)
public Map<String, Object> saveTrafficNetflowPortInfo(
@RequestBody TrafficNetflowPortInfoList trafficNetflowPortInfoList, HttpServletRequest request,
HttpServletResponse response) {
long start = System.currentTimeMillis();
AuditLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_POST, request,
trafficNetflowPortInfoList);
try {
if (trafficNetflowPortInfoList != null && trafficNetflowPortInfoList.getTrafficNetflowPortInfoList() != null
&& trafficNetflowPortInfoList.getTrafficNetflowPortInfoList().size() > 0) {
trafficNetflowPortInfoService
.saveTrafficNetflowPortInfo(trafficNetflowPortInfoList.getTrafficNetflowPortInfoList());
} else {
throw new RestServiceException(thread, System.currentTimeMillis() - start,
"参数trafficNetflowPortInfoList不能为空", RestBusinessCode.missing_args.getValue());
}
} catch (Exception e) {
throw new RestServiceException(thread, System.currentTimeMillis() - start,
"上报trafficNetflowPort信息异常:" + e.getMessage(), RestBusinessCode.unknow_error.getValue());
}
return compileServiceResponse(thread, System.currentTimeMillis() - start, request, response,
"上报trafficNetflowPort信息成功", Constants.IS_DEBUG ? trafficNetflowPortInfoList : null);
}
} }

View File

@@ -0,0 +1,7 @@
package com.nis.web.dao;
import com.nis.domain.restful.NmsDiRule;
@MyBatisDao
public interface NmsDiRuleDao extends CrudDao<NmsDiRule> {
}

View File

@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.nis.web.dao.NmsDiRuleDao">
<insert id="insert" parameterType="nmsDiRule">
INSERT INTO
nms_di_rule(detection_info_id ,
serviceindex ,
servicecode ,
servicedesc,
agedtime ,
clientnum ,
refluxport ,
rulenumber ,
usedrulenum ,
leftrulenum ,
hittotalnum ,
detectioned_state ,
seq_id ,
detection_set_info_id ,
data_check_time ,
data_arrive_time ,
data_check_time_digital ,
data_arrive_time_digital
) VALUES (
#{detectionInfoId},
#{serviceIndex},
#{serviceCode},
#{serviceDesc},
#{agedTime},
#{clientNum},
#{refluxPort},
#{ruleNumber},
#{usedRuleNum},
#{leftRuleNum},
#{hitTotalNum},
#{detectionedState},
#{seqId},
#{detectionSetInfoId},
#{dataCheckTime},
#{dataArriveTime},
#{dataCheckTimeDigital},
#{dataArriveTimeDigital})
</insert>
</mapper>

View File

@@ -0,0 +1,7 @@
package com.nis.web.dao;
import com.nis.domain.restful.TrafficNetflowPortInfo;
@MyBatisDao
public interface TrafficNetflowPortInfoDao extends CrudDao<TrafficNetflowPortInfo> {
}

View File

@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.nis.web.dao.TrafficNetflowPortInfoDao">
<insert id="insert" parameterType="trafficNetflowPortInfo">
INSERT INTO
traffic_netflow_port_info(PORT ,
NODE_NAME ,
NODE_IP ,
PORT_DESC,
BANDWIDTH ,
INOCTETS ,
OUTOCTETS ,
INOCTETS_SPEED ,
OUTOCTETS_SPEED ,
INPKTS_SPEED ,
OUTPKTS_SPEED ,
RECV_TIME
) VALUES (
#{port},
#{nodeName},
#{nodeIp},
#{portDesc},
#{bandwidth},
#{inoctets},
#{outoctets},
#{inoctetsSpeed},
#{outoctetsSpeed},
#{inpktsSpeed},
#{outpktsSpeed},
#{recvTime})
</insert>
</mapper>

View File

@@ -21,6 +21,7 @@ import com.nis.domain.restful.MaatConfig;
import com.nis.restful.RestBusinessCode; import com.nis.restful.RestBusinessCode;
import com.nis.restful.ServiceRuntimeException; import com.nis.restful.ServiceRuntimeException;
import com.nis.util.Configurations; import com.nis.util.Configurations;
import com.nis.util.File2Redis;
import com.nis.util.JedisUtils; import com.nis.util.JedisUtils;
import com.nis.util.ReadMaatXmlUtil; import com.nis.util.ReadMaatXmlUtil;
import com.nis.util.ServiceAndRDBIndexReal; import com.nis.util.ServiceAndRDBIndexReal;
@@ -89,10 +90,38 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
} }
StringBuffer valBF = new StringBuffer(); StringBuffer valBF = new StringBuffer();
String[] valSplit = maatXmlExpr.getValueExpression().split(";"); String[] valSplit = maatXmlExpr.getValueExpression().split(";");
// List<String> urlList = new ArrayList<String>();
for (String valStr : valSplit) { for (String valStr : valSplit) {
if (!StringUtils.isEmpty(valStr) && valStr.trim().startsWith("[")) { if (!StringUtils.isEmpty(valStr) && valStr.trim().startsWith("[")) {
valStr = valStr.trim().replace("[", "").replace("]", ""); valStr = valStr.trim().replace("[", "").replace("]", "");
// if (service == 520) {
// if (valStr.equals("private_key_file")
// || valStr.equals("public_key_file")) {
// String fileUrl = map.get(valStr);
// urlList.add(fileUrl);
// }
// }
// if(valStr.equals("op_time")) {
// if (urlList.size() > 0) {
// for (String fileUrl : urlList) {
// String key = File2Redis.file2Redis(fileUrl, transaction);
// logger.info("向{}号redis数据库添加了一条文件配置,key是{}",redisDBIndex,key);
// valBF.append(key);
// valBF.append("\t");
// }
// }
// }
if (valStr.contains("redisFile_")) {
String key = File2Redis.file2Redis(map.get(valStr),
transaction);
logger.info("向{}号redis数据库添加了一条文件配置,key是{}", redisDBIndex,
key);
valBF.append(key);
// valBF.append("\t");
} else {
valBF.append(map.get(valStr)); valBF.append(map.get(valStr));
}
} else if (valStr.equals("&nbsp")) { } else if (valStr.equals("&nbsp")) {
valBF.append(" "); valBF.append(" ");
} else if (valStr.equals("\\t")) {// xml中是字符串的\t这里判断的时候需要转义为\\t,但是添加的时候需要添加\t不是\\t } else if (valStr.equals("\\t")) {// xml中是字符串的\t这里判断的时候需要转义为\\t,但是添加的时候需要添加\t不是\\t
@@ -260,6 +289,7 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
* 单独找一个redis-db记录配置信息,方便实时统计程序获取所有配置的分类性质,标签等内容,(为什么实时统计不从配置库redisdb获取呢, * 单独找一个redis-db记录配置信息,方便实时统计程序获取所有配置的分类性质,标签等内容,(为什么实时统计不从配置库redisdb获取呢,
* 因为配置有多分发的情况,会发送到不同的redisdb,每个redisdb的配置条数不一定相同,有的配置所有的redisdb都有,有的只在某一个redisdb中有,实时统计程序不好获取配置这些配置内容, * 因为配置有多分发的情况,会发送到不同的redisdb,每个redisdb的配置条数不一定相同,有的配置所有的redisdb都有,有的只在某一个redisdb中有,实时统计程序不好获取配置这些配置内容,
* 最重要的是,前端机不需要这些属性,所以在配置库有可能不带分类性质,标签等属性,maat.xml如果配置了则有,没有配置则就没有这些属性.所以单独找一个reidsdb存放带分类性质,标签等属性的配置) * 最重要的是,前端机不需要这些属性,所以在配置库有可能不带分类性质,标签等属性,maat.xml如果配置了则有,没有配置则就没有这些属性.所以单独找一个reidsdb存放带分类性质,标签等属性的配置)
*
* @param configMap * @param configMap
*/ */
private void addStatisticsReal(Map<Integer, List<MaatConfig>> configMap, Transaction transaction) { private void addStatisticsReal(Map<Integer, List<MaatConfig>> configMap, Transaction transaction) {
@@ -270,7 +300,7 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
&& redisStatisticsRealDBIndex < Configurations.getIntProperty("maxRedisDBIndex", 16)) { && redisStatisticsRealDBIndex < Configurations.getIntProperty("maxRedisDBIndex", 16)) {
List<MaatConfig> list = configMap.get(redisDBIndex); List<MaatConfig> list = configMap.get(redisDBIndex);
if (list != null && list.size() > 0) { if (list != null && list.size() > 0) {
transaction.select(redisStatisticsRealDBIndex);//选择实时统计库 transaction.select(redisStatisticsRealDBIndex);// 选择实时统计库
String redisStatisticsReal = Configurations.getStringProperty("redis-statisticsReal", String redisStatisticsReal = Configurations.getStringProperty("redis-statisticsReal",
"[COMPILE_ID];\t;[SERVICE];\t;[ACTION];\t;[CONT_TYPE];\t;[ATTR_TYPE];\t;[CONT_LABEL];\t;[TASK_ID];\t;[AFFAIR_ID];\t;[DO_BLACKLIST];\t;[DO_LOG];\t;[EFFECTIVE_RANGE];\t;[START_TIME];\t;[END_TIME];\t;[USER_REGION];\t;[IS_VALID];\t;[GROUP_NUM];\t;[FATHER_CFG_ID];\t;[OP_TIME]"); "[COMPILE_ID];\t;[SERVICE];\t;[ACTION];\t;[CONT_TYPE];\t;[ATTR_TYPE];\t;[CONT_LABEL];\t;[TASK_ID];\t;[AFFAIR_ID];\t;[DO_BLACKLIST];\t;[DO_LOG];\t;[EFFECTIVE_RANGE];\t;[START_TIME];\t;[END_TIME];\t;[USER_REGION];\t;[IS_VALID];\t;[GROUP_NUM];\t;[FATHER_CFG_ID];\t;[OP_TIME]");
String[] redisStatisticsRealArr = redisStatisticsReal.split(";"); String[] redisStatisticsRealArr = redisStatisticsReal.split(";");
@@ -379,6 +409,7 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
/** /**
* 封装组id与域id对应关系并添加到对象中 * 封装组id与域id对应关系并添加到对象中
*
* @param regionMapList * @param regionMapList
* @param compileAndGroupRelations * @param compileAndGroupRelations
*/ */
@@ -461,8 +492,10 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
int service = maatConfig.getService(); int service = maatConfig.getService();
if (ServiceAndRDBIndexReal.isAddASU(service)) { if (ServiceAndRDBIndexReal.isAddASU(service)) {
if (!keySet.contains(TAPREDISDB)) { if (!keySet.contains(TAPREDISDB)) {
throw new ServiceRuntimeException("业务类型:" + service + ",需要向阀门" + TAPREDISDB + "号库分发,但是当前只往" throw new ServiceRuntimeException(
+ keySet + "库下发,请检查阀门编号或者当前业务对应的配置文件是否正确",RestBusinessCode.PropertiesIsError.getValue()); "业务类型:" + service + ",需要向阀门" + TAPREDISDB + "号库分发,但是当前只往" + keySet
+ "库下发,请检查阀门编号或者当前业务对应的配置文件是否正确",
RestBusinessCode.PropertiesIsError.getValue());
} }
} }
@@ -515,6 +548,7 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
/** /**
* 将编译,分组,域等配置拆开分别添加到redis中 * 将编译,分组,域等配置拆开分别添加到redis中
*
* @param maatConfig * @param maatConfig
* @param maatXmlConfig * @param maatXmlConfig
* @param maatVersion * @param maatVersion
@@ -558,6 +592,7 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
/** /**
* 将整理好的数据添加到redis中,如果是分组复用时,则去临时库将对应的域找到复制过来,如果当前库存在则不复制了(在复制就重复了) * 将整理好的数据添加到redis中,如果是分组复用时,则去临时库将对应的域找到复制过来,如果当前库存在则不复制了(在复制就重复了)
*
* @param maatXmlConfig * @param maatXmlConfig
* @param map * @param map
* @param type * @param type
@@ -566,7 +601,8 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
* @param redisTemplate * @param redisTemplate
* @param redisDBIndex * @param redisDBIndex
* @param compileId * @param compileId
* @param isReuse 是否是分组复用 * @param isReuse
* 是否是分组复用
*/ */
private void setCommonConfig(MaatXmlConfig maatXmlConfig, Map<String, String> map, int type, Double maatVersion, private void setCommonConfig(MaatXmlConfig maatXmlConfig, Map<String, String> map, int type, Double maatVersion,
int service, Transaction transaction, Integer redisDBIndex, String compileId, boolean isReuse) { int service, Transaction transaction, Integer redisDBIndex, String compileId, boolean isReuse) {
@@ -695,7 +731,7 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
} }
} }
} }
} else if (isReuse && (type == 12 || type == 13 || type == 14|| type == 15|| type == 18)) {// 将数据往临时库复制一份,无论临时库里有没有都可以直接写,有则覆盖,不影响 } else if (isReuse && (type == 12 || type == 13 || type == 14 || type == 15 || type == 18)) {// 将数据往临时库复制一份,无论临时库里有没有都可以直接写,有则覆盖,不影响
int tmpStorageReuseRegionDB = Configurations.getIntProperty("tmpStorageReuseRegionDB", 15); int tmpStorageReuseRegionDB = Configurations.getIntProperty("tmpStorageReuseRegionDB", 15);
transaction.select(tmpStorageReuseRegionDB); transaction.select(tmpStorageReuseRegionDB);
transaction.set(maatKey.toUpperCase(), valBF.toString()); transaction.set(maatKey.toUpperCase(), valBF.toString());
@@ -750,8 +786,8 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
for (Integer service : serviceConfigMap.keySet()) { for (Integer service : serviceConfigMap.keySet()) {
List<Long> compileIdList = serviceConfigMap.get(service); List<Long> compileIdList = serviceConfigMap.get(service);
if (compileIdList != null && compileIdList.size() > 0) { if (compileIdList != null && compileIdList.size() > 0) {
for (Long id : compileIdList) {
MaatXmlConfig maatXmlConfig = ReadMaatXmlUtil.getMaatConfigByService(service); MaatXmlConfig maatXmlConfig = ReadMaatXmlUtil.getMaatConfigByService(service);
for (Long id : compileIdList) {
if (maatXmlConfig != null) { if (maatXmlConfig != null) {
List<MaatXmlExpr> expressionList = maatXmlConfig.getExpressionList(); List<MaatXmlExpr> expressionList = maatXmlConfig.getExpressionList();
String maatKey = null; String maatKey = null;
@@ -1009,6 +1045,7 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
/** /**
* 获取关联关系中每个关系中的-前部分 * 获取关联关系中每个关系中的-前部分
*
* @param compileStrVal * @param compileStrVal
* @return * @return
*/ */
@@ -1022,12 +1059,18 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
/** /**
* 删除maat类配置 * 删除maat类配置
* @param id 配置id *
* @param maatXmlConfig maat.xml中关于当前业务类型的key和value写法的对象 * @param id
* @param maatVersion 版本号 * 配置id
* @param service 业务类型 * @param maatXmlConfig
* maat.xml中关于当前业务类型的key和value写法的对象
* @param maatVersion
* 版本号
* @param service
* 业务类型
* @param redisTemplate * @param redisTemplate
* @param maatRelation id对应关系对象 * @param maatRelation
* id对应关系对象
*/ */
private void removeConfig(Long id, MaatXmlConfig maatXmlConfig, Double maatVersion, int service, private void removeConfig(Long id, MaatXmlConfig maatXmlConfig, Double maatVersion, int service,
Transaction transaction, int redisDBIndex, int idRelaRedisDBIndex) { Transaction transaction, int redisDBIndex, int idRelaRedisDBIndex) {
@@ -1104,6 +1147,7 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
/** /**
* 删除maat配置时,对redis进行相关操作,主要是重命名key和记录相关状态 * 删除maat配置时,对redis进行相关操作,主要是重命名key和记录相关状态
*
* @param maatXmlConfig * @param maatXmlConfig
* @param idList * @param idList
* @param type * @param type
@@ -1171,6 +1215,7 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
/** /**
* 删除域配置,重名key,记录相关信息MAAT_UPDATE_STATUS,MAAT_RULE_TIMER等 * 删除域配置,重名key,记录相关信息MAAT_UPDATE_STATUS,MAAT_RULE_TIMER等
*
* @param maatXmlConfig * @param maatXmlConfig
* @param regionArr * @param regionArr
* @param maatVersion * @param maatVersion
@@ -1207,8 +1252,7 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
} }
/** /**
* 编译配置用于实时统计 * 编译配置用于实时统计 取消分类性质,标签等信息
* 取消分类性质,标签等信息
*/ */
private boolean removeStatisticsReal(Map<Integer, List<Long>> map, Transaction transaction) { private boolean removeStatisticsReal(Map<Integer, List<Long>> map, Transaction transaction) {
if (map != null && map.size() > 0) { if (map != null && map.size() > 0) {
@@ -1271,6 +1315,7 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
/** /**
* 删除配置成功后,需要更新编译,组,域等配置id的对应关系 * 删除配置成功后,需要更新编译,组,域等配置id的对应关系
*
* @param idMap * @param idMap
*/ */
private boolean removeMaatRelation(Map<Integer, List<Long>> map, Transaction transaction) { private boolean removeMaatRelation(Map<Integer, List<Long>> map, Transaction transaction) {
@@ -1564,6 +1609,7 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
/** /**
* 添加分组和域的关联关系 * 添加分组和域的关联关系
*
* @param maatConfig * @param maatConfig
* @param transaction * @param transaction
* @param redisDBIndex * @param redisDBIndex
@@ -1607,13 +1653,21 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
/** /**
* 保存域配置信息,供分组复用单独添加域和普通maat配置添加域 * 保存域配置信息,供分组复用单独添加域和普通maat配置添加域
* @param maatConfig 配置信息 *
* @param maatXmlConfig 配置的表达式 * @param maatConfig
* @param maatVersion 版本号 * 配置信息
* @param service 业务类型 * @param maatXmlConfig
* @param transaction redis连接 * 配置的表达式
* @param redisDBIndex redis编号 * @param maatVersion
* @param isReuseSaveRegion 是否是分组复用单独添加域配置 * 版本号
* @param service
* 业务类型
* @param transaction
* redis连接
* @param redisDBIndex
* redis编号
* @param isReuseSaveRegion
* 是否是分组复用单独添加域配置
*/ */
private Integer addRegion(MaatConfig maatConfig, MaatXmlConfig maatXmlConfig, Double maatVersion, int service, private Integer addRegion(MaatConfig maatConfig, MaatXmlConfig maatXmlConfig, Double maatVersion, int service,
Transaction transaction, Integer redisDBIndex, boolean isReuseSaveRegion) { Transaction transaction, Integer redisDBIndex, boolean isReuseSaveRegion) {
@@ -1687,6 +1741,7 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
/** /**
* 从临时库删除分组复用域配置,如果该域被引用了,则去对应的redisdb中删除,并将关联库中记录的信息删除 * 从临时库删除分组复用域配置,如果该域被引用了,则去对应的redisdb中删除,并将关联库中记录的信息删除
*
* @param groupId * @param groupId
* @param regionList * @param regionList
* @param transaction * @param transaction
@@ -1816,6 +1871,7 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
/** /**
* 添加和删除时更新MAAT_*状态信息 * 添加和删除时更新MAAT_*状态信息
*
* @param list * @param list
* @param maatKey * @param maatKey
* @param transaction * @param transaction

View File

@@ -482,7 +482,7 @@ public class ConfigSourcesService extends BaseService {
maatTableName.substring(maatTableName.lastIndexOf("_") + 1)); maatTableName.substring(maatTableName.lastIndexOf("_") + 1));
dstStr = dstPath.replace("{fileName}", dstStr.substring(dstStr.lastIndexOf("/") + 1)); dstStr = dstPath.replace("{fileName}", dstStr.substring(dstStr.lastIndexOf("/") + 1));
} else if ("file_id".equals(commonSourceFieldCfg.getDstName())) { } else if ("file_id".equals(commonSourceFieldCfg.getDstName())) {
dstStr = dstStr.substring(dstStr.indexOf("group")); //dstStr = dstStr.substring(dstStr.indexOf("group"));
} }
} }
switch (commonSourceFieldCfg.getFieldType()) { switch (commonSourceFieldCfg.getFieldType()) {

View File

@@ -0,0 +1,23 @@
package com.nis.web.service.restful;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.nis.domain.restful.NmsDiRule;
import com.nis.web.dao.NmsDiRuleDao;
@Service
public class NmsDiRuleService {
@Autowired
NmsDiRuleDao nmsDiRuleDao;
@Transactional
public void saveNmsDiRuleInfo(List<NmsDiRule> nmsDiRuleList) {
for (NmsDiRule nmsDiRule : nmsDiRuleList) {
nmsDiRuleDao.insert(nmsDiRule);
}
}
}

View File

@@ -0,0 +1,23 @@
package com.nis.web.service.restful;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.nis.domain.restful.TrafficNetflowPortInfo;
import com.nis.web.dao.TrafficNetflowPortInfoDao;
@Service
public class TrafficNetflowPortInfoService {
@Autowired
TrafficNetflowPortInfoDao trafficNetflowPortInfoDao;
@Transactional
public void saveTrafficNetflowPortInfo(List<TrafficNetflowPortInfo> trafficNetflowPortInfoList) {
for (TrafficNetflowPortInfo trafficNetflowPortInfo : trafficNetflowPortInfoList) {
trafficNetflowPortInfoDao.insert(trafficNetflowPortInfo);
}
}
}

View File

@@ -21,6 +21,5 @@ public class TrafficNmsServerStatisticService {
trafficNmsServerStatisticDao.insertAbnormalMachine(trafficNmsServerStatistic.getId(), trafficNmsServerStatisticDao.insertAbnormalMachine(trafficNmsServerStatistic.getId(),
trafficNmsServerStatistic.getAbnormalMachineList()); trafficNmsServerStatistic.getAbnormalMachineList());
} }
Integer.parseInt(null);
} }
} }

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" <beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns:jdbc="http://www.springframework.org/schema/jdbc" xmlns:jee="http://www.springframework.org/schema/jee" xmlns:jdbc="http://www.springframework.org/schema/jdbc" xmlns:jee="http://www.springframework.org/schema/jee"

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation=" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="
@@ -19,7 +19,7 @@
</bean> </bean>
<!-- autodetection of such annotated controllers --> <!-- autodetection of such annotated controllers -->
<!-- 使用Annotation自动注册Bean解决事物失效问题在主容器中不扫描@Controller注解在SpringMvc中只扫描@Controller注解。 --> <!-- 使用Annotation自动注册Bean解决事物失效问题在主容器中不扫描@Controller注解在SpringMvc中只扫描@Controller注解。-->
<context:component-scan base-package="com.nis.web"> <context:component-scan base-package="com.nis.web">
<context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/> <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
</context:component-scan> </context:component-scan>
@@ -91,7 +91,7 @@
<!-- 定时清理失效会话, 清理用户直接关闭浏览器造成的孤立会话 --> <!-- 定时清理失效会话, 清理用户直接关闭浏览器造成的孤立会话 -->
<property name="sessionValidationInterval" value="${session.sessionTimeoutClean}"/> <property name="sessionValidationInterval" value="${session.sessionTimeoutClean}"/>
<!-- <property name="sessionValidationSchedulerEnabled" value="false"/> --> <!-- <property name="sessionValidationSchedulerEnabled" value="false"/> -->
<property name="sessionValidationSchedulerEnabled" value="true"/> <property name="sessionValidationSchedulerEnabled" value="true"/>
<property name="sessionIdCookie" ref="sessionIdCookie"/> <property name="sessionIdCookie" ref="sessionIdCookie"/>
@@ -111,7 +111,7 @@
</bean> </bean>
<!-- 定义授权缓存管理器 --> <!-- 定义授权缓存管理器 -->
<!-- <bean id="shiroCacheManager" class="com.thinkgem.jeesite.common.security.shiro.cache.SessionCacheManager" /> --> <!-- <bean id="shiroCacheManager" class="com.thinkgem.jeesite.common.security.shiro.cache.SessionCacheManager" /> -->
<bean id="shiroCacheManager" class="org.apache.shiro.cache.ehcache.EhCacheManager"> <bean id="shiroCacheManager" class="org.apache.shiro.cache.ehcache.EhCacheManager">
<property name="cacheManager" ref="cacheManager"/> <property name="cacheManager" ref="cacheManager"/>
</bean> </bean>

View File

@@ -167,9 +167,11 @@
<t:field fieldType="String" srcName="publicKeyFile" dstName="public_key_file" isRequired="true"/> <t:field fieldType="String" srcName="publicKeyFile" dstName="public_key_file" isRequired="true"/>
<t:field fieldType="String" srcName="expireAfter" dstName="expire_after" defaultVal="30" isRequired="true"/> <t:field fieldType="String" srcName="expireAfter" dstName="expire_after" defaultVal="30" isRequired="true"/>
<t:field fieldType="String" srcName="publicKeyAlgo" dstName="public_key_algo" isRequired="true"/> <t:field fieldType="String" srcName="publicKeyAlgo" dstName="public_key_algo" isRequired="true"/>
<t:field fieldType="String" srcName="crl" dstName="crl" defaultVal=""/> <t:field fieldType="String" srcName="crl" dstName="crl" />
<t:field fieldType="Number" srcName="isValid" dstName="is_valid" isRequired="true" regexp="[1]"/> <t:field fieldType="Number" srcName="isValid" dstName="is_valid" isRequired="true" regexp="[1]"/>
<t:field fieldType="Date" srcName="opTime" dstName="op_time" isRequired="true"/> <t:field fieldType="Date" srcName="opTime" dstName="op_time" isRequired="true"/>
<t:field fieldType="String" srcName="privateKeyFile" dstName="redisFile_private_key_file" isRequired="true"/>
<t:field fieldType="String" srcName="publicKeyFile" dstName="redisFile_public_key_file" isRequired="true"/>
</t:commonSource> </t:commonSource>
<!-- # 0x260 PXY 管控文件策略 608=0:PXY_OBJ_FILE --> <!-- # 0x260 PXY 管控文件策略 608=0:PXY_OBJ_FILE -->
@@ -180,6 +182,7 @@
<t:field fieldType="String" srcName="contentType" dstName="content_type" isRequired="true"/> <t:field fieldType="String" srcName="contentType" dstName="content_type" isRequired="true"/>
<t:field fieldType="Number" srcName="contentLength" dstName="content_length" isRequired="true"/> <t:field fieldType="Number" srcName="contentLength" dstName="content_length" isRequired="true"/>
<t:field fieldType="String" srcName="filePath" dstName="file_path" isRequired="true"/> <t:field fieldType="String" srcName="filePath" dstName="file_path" isRequired="true"/>
<t:field fieldType="String" srcName="filePath" dstName="redisFile_file_path" isRequired="true"/>
<t:field fieldType="Number" srcName="isValid" dstName="is_valid" isRequired="true" regexp="[1]"/> <t:field fieldType="Number" srcName="isValid" dstName="is_valid" isRequired="true" regexp="[1]"/>
<t:field fieldType="Date" srcName="opTime" dstName="op_time" isRequired="true"/> <t:field fieldType="Date" srcName="opTime" dstName="op_time" isRequired="true"/>
</t:commonSource> </t:commonSource>

View File

@@ -10,11 +10,11 @@ fastdfs.http_secret_key = FastDFS1234567890
fastdfs.http_tracker_http_port = 80 fastdfs.http_tracker_http_port = 80
#元辰鑫内网 #元辰鑫内网
fastdfs.tracker_servers = 10.0.6.249:22122 #fastdfs.tracker_servers = 10.0.6.249:22122
fastDfsHttpAddr= 10.0.6.249 #fastDfsHttpAddr= 10.0.6.249
#元辰鑫外网 #元辰鑫外网
#fastdfs.tracker_servers=192.168.10.205:22122 fastdfs.tracker_servers=192.168.10.205:22122
#fastDfsHttpAddr=192.168.10.205 fastDfsHttpAddr=192.168.10.205
#亦庄演示环境 #亦庄演示环境
#fastdfs.tracker_servers = 10.3.34.1:22122 #fastdfs.tracker_servers = 10.3.34.1:22122
#fastDfsHttpAddr = 10.3.34.1 #fastDfsHttpAddr = 10.3.34.1

View File

@@ -7,8 +7,8 @@ http.secret_key = FastDFS1234567890
#元辰鑫内网 #元辰鑫内网
tracker_server=10.0.6.249:22122 #tracker_server=10.0.6.249:22122
#元辰鑫外网 #元辰鑫外网
#tracker_server=192.168.10.205:22122 tracker_server=192.168.10.205:22122
#亦庄演示环境 #亦庄演示环境
#tracker_server=10.3.34.1:22122 #tracker_server=10.3.34.1:22122

View File

@@ -1,9 +1,11 @@
#==========日志库 Mysql======================= #==========日志库 Mysql=======================
jdbc.log.driver=com.mysql.jdbc.Driver jdbc.log.driver=com.mysql.jdbc.Driver
#元辰鑫内网 #元辰鑫内网
jdbc.log.url=jdbc:mysql://10.0.6.249:3306/galaxy?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull #jdbc.log.url=jdbc:mysql://10.0.6.249:3306/galaxy?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull
#华严 #华严
#jdbc.log.url=jdbc:mysql://192.168.11.242:3306/galaxy?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull #jdbc.log.url=jdbc:mysql://192.168.11.242:3306/galaxy?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull
#元辰鑫外网-开发环境
jdbc.log.url=jdbc:mysql://192.168.10.204:3306/galaxy-dev?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull
#元辰鑫外网 #元辰鑫外网
#jdbc.log.url=jdbc:mysql://192.168.10.204:3306/galaxy?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull #jdbc.log.url=jdbc:mysql://192.168.10.204:3306/galaxy?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull
#亦庄演示环境 #亦庄演示环境
@@ -42,11 +44,11 @@ jdbc.hive.DBName=maat
#A版日志库 #A版日志库
jdbc.hive.driver=org.apache.hive.jdbc.HiveDriver jdbc.hive.driver=org.apache.hive.jdbc.HiveDriver
#元辰鑫内网 #元辰鑫内网
jdbc.hive.url=jdbc:hive2://10.0.6.202:10000/maat #jdbc.hive.url=jdbc:hive2://10.0.6.202:10000/maat
#华严 #华严
#jdbc.hive.url=jdbc:hive2://192.168.11.243:2181,192.168.10.76:2181,192.168.10.77:2181/maat;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2 #jdbc.hive.url=jdbc:hive2://192.168.11.243:2181,192.168.10.76:2181,192.168.10.77:2181/maat;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2
#元辰鑫外网 #元辰鑫外网
#jdbc.hive.url=jdbc:hive2://192.168.10.22:10000/maat jdbc.hive.url=jdbc:hive2://192.168.10.22:10000/maat
#亦庄演示环境高可用集群连接,注意使用此种方法需要配置hosts,主机名与ip的对应关系 #亦庄演示环境高可用集群连接,注意使用此种方法需要配置hosts,主机名与ip的对应关系
#jdbc.hive.url=jdbc:hive2://10.3.48.2:2181,10.3.48.3:2181,10.3.48.4:2181/maat;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2 #jdbc.hive.url=jdbc:hive2://10.3.48.2:2181,10.3.48.3:2181,10.3.48.4:2181/maat;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2
jdbc.hive.username=xa_z2_mesa jdbc.hive.username=xa_z2_mesa
@@ -75,7 +77,7 @@ jdbc.clickhouse.driver=ru.yandex.clickhouse.ClickHouseDriver
#域名测试环境 #域名测试环境
#jdbc.clickhouse.url=jdbc:clickhouse://clickhouse.baifendian.com:80/k18_ods #jdbc.clickhouse.url=jdbc:clickhouse://clickhouse.baifendian.com:80/k18_ods
#亦庄演示环境 #亦庄演示环境
jdbc.clickhouse.url=jdbc:clickhouse://10.3.45.5:8123/k18_ods jdbc.clickhouse.url=jdbc:clickhouse://10.3.45.5:8123/k18_ods?socket_timeout=90000
jdbc.clickhouse.username= jdbc.clickhouse.username=
jdbc.clickhouse.key= jdbc.clickhouse.key=
jdbc.clickhouse.password= jdbc.clickhouse.password=
@@ -121,14 +123,16 @@ druid.log.filters=stat
######################################################################### #########################################################################
##minio地址 ##minio地址
######################################################################### #########################################################################
##minio的地址,注意前面的http://不要忘记写 ##华严minio的地址,注意前面的http://不要忘记写
minioUrl=http://192.168.10.61:9000 #minio_url=http://192.168.10.61:9000
##元辰鑫外网minio的地址,注意前面的http://不要忘记写
minio_url=http://192.168.10.205:9000
##minio的accessKey ##minio的accessKey
minio_accessKey= minio_accessKey=minio
##minio的secretKey ##minio的secretKey
minio_secretKey= minio_secretKey=123456789
##minio的bucketName ##minio的bucketName
minio_bucketName=test minio_bucketName=maat-redis
@@ -136,9 +140,11 @@ minio_bucketName=test
##redis连接 ##redis连接
##################################################################################################################################### #####################################################################################################################################
#元辰鑫内网 #元辰鑫内网
redis.host=10.0.6.249 #redis.host=10.0.6.249
#华严 #华严
#redis.host=192.168.11.243 #redis.host=192.168.11.243
#元辰鑫外网-开发环境
redis.host=192.168.10.12
#元辰鑫外网 #元辰鑫外网
#redis.host=192.168.10.205 #redis.host=192.168.10.205
#亦庄测试环境 #亦庄测试环境

View File

@@ -11,7 +11,7 @@ log4j.appender.file=org.apache.log4j.DailyRollingFileAppender
log4j.appender.file.Threshold=error log4j.appender.file.Threshold=error
log4j.appender.file.encoding=UTF-8 log4j.appender.file.encoding=UTF-8
log4j.appender.file.Append=true log4j.appender.file.Append=true
log4j.appender.file.file=${nis.root}/WEB-INF/log/nis.log log4j.appender.file.file=/WEB-INF/log/nis.log
log4j.appender.file.DatePattern='.'yyyy-MM-dd log4j.appender.file.DatePattern='.'yyyy-MM-dd
log4j.appender.file.layout=org.apache.log4j.PatternLayout log4j.appender.file.layout=org.apache.log4j.PatternLayout
#log4j.appender.file.layout.ConversionPattern=%d{HH:mm:ss} %X{ip} [%t] %5p %c{1} %m%n #log4j.appender.file.layout.ConversionPattern=%d{HH:mm:ss} %X{ip} [%t] %5p %c{1} %m%n

View File

@@ -160,7 +160,7 @@
<p:maatType service="520"> <p:maatType service="520">
<p:expressions> <p:expressions>
<p:keyExpression>EFFECTIVE_RULE;:;{un_maat_table_name};,;[cfg_id]</p:keyExpression> <p:keyExpression>EFFECTIVE_RULE;:;{un_maat_table_name};,;[cfg_id]</p:keyExpression>
<p:valueExpression>[cfg_id];\t;[service];\t;[keyring_name];\t;[keyring_type];\t;[private_key_file];\t;[public_key_file];\t;[expire_after];\t;[public_key_algo];\t;[crl];\t;[is_valid];\t;[op_time];&amp;nbsp;0;\n</p:valueExpression> <p:valueExpression>[cfg_id];\t;[service];\t;[keyring_name];\t;[keyring_type];\t;[private_key_file];\t;[public_key_file];\t;[expire_after];\t;[public_key_algo];\t;[crl];\t;[is_valid];\t;[redisFile_private_key_file];\t;[redisFile_public_key_file];\t;[op_time];&amp;nbsp;0;\n</p:valueExpression>
</p:expressions> </p:expressions>
<p:sequences> <p:sequences>
<p:operation>1</p:operation> <p:operation>1</p:operation>
@@ -180,7 +180,7 @@
<p:maatType service="608"> <p:maatType service="608">
<p:expressions> <p:expressions>
<p:keyExpression>EFFECTIVE_RULE;:;{un_maat_table_name};,;[cfg_id]</p:keyExpression> <p:keyExpression>EFFECTIVE_RULE;:;{un_maat_table_name};,;[cfg_id]</p:keyExpression>
<p:valueExpression>[cfg_id];\t;[service];\t;[file_desc];\t;[content_type];\t;[content_length];\t;[file_path];\t;[is_valid];\t;[op_time];&amp;nbsp;0;\n</p:valueExpression> <p:valueExpression>[cfg_id];\t;[service];\t;[file_desc];\t;[content_type];\t;[content_length];\t;[file_path];\t;[is_valid];\t;[redisFile_file_path];\t;[op_time];&amp;nbsp;0;\n</p:valueExpression>
</p:expressions> </p:expressions>
<p:sequences> <p:sequences>
<p:operation>1</p:operation> <p:operation>1</p:operation>

View File

@@ -203,3 +203,9 @@ mmSampleDstPath=/home/mesasoft/{tableType}/full/{fileName}
##定时将redis主从库的实时统计数据同步到redis集群中 ##定时将redis主从库的实时统计数据同步到redis集群中
syncRedisToClusterCron=0/10 * * * * ? syncRedisToClusterCron=0/10 * * * * ?
#文件服务器是否使用Minio
isUseMinio=true
##存储到redis中的文件类型(拼接的前缀)
fileProtocol=redis://

View File

@@ -1,46 +1,58 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta http-equiv="x-ua-compatible" content="IE=edge"> <meta http-equiv="x-ua-compatible" content="IE=edge">
<title>Galaxy UI</title> <title>Galaxy UI</title>
<link rel="icon" type="image/png" href="images/favicon-32x32.png" sizes="32x32" /> <link rel="icon" type="image/png" href="images/favicon-32x32.png"
<link rel="icon" type="image/png" href="images/favicon-16x16.png" sizes="16x16" /> sizes="32x32" />
<link href='css/typography.css' media='screen' rel='stylesheet' type='text/css'/> <link rel="icon" type="image/png" href="images/favicon-16x16.png"
<link href='css/reset.css' media='screen' rel='stylesheet' type='text/css'/> sizes="16x16" />
<link href='css/screen.css' media='screen' rel='stylesheet' type='text/css'/> <link href='css/typography.css' media='screen' rel='stylesheet'
<link href='css/reset.css' media='print' rel='stylesheet' type='text/css'/> type='text/css' />
<link href='css/print.css' media='print' rel='stylesheet' type='text/css'/> <link href='css/reset.css' media='screen' rel='stylesheet'
type='text/css' />
<link href='css/screen.css' media='screen' rel='stylesheet'
type='text/css' />
<link href='css/reset.css' media='print' rel='stylesheet'
type='text/css' />
<link href='css/print.css' media='print' rel='stylesheet'
type='text/css' />
<script src='lib/object-assign-pollyfill.js' type='text/javascript'></script> <script src='lib/object-assign-pollyfill.js' type='text/javascript'></script>
<script src='lib/jquery-1.8.0.min.js' type='text/javascript'></script> <script src='lib/jquery-1.8.0.min.js' type='text/javascript'></script>
<script src='lib/jquery.slideto.min.js' type='text/javascript'></script> <script src='lib/jquery.slideto.min.js' type='text/javascript'></script>
<script src='lib/jquery.wiggle.min.js' type='text/javascript'></script> <script src='lib/jquery.wiggle.min.js' type='text/javascript'></script>
<script src='lib/jquery.ba-bbq.min.js' type='text/javascript'></script> <script src='lib/jquery.ba-bbq.min.js' type='text/javascript'></script>
<script src='lib/handlebars-4.0.5.js' type='text/javascript'></script> <script src='lib/handlebars-4.0.5.js' type='text/javascript'></script>
<script src='lib/lodash.min.js' type='text/javascript'></script> <script src='lib/lodash.min.js' type='text/javascript'></script>
<script src='lib/backbone-min.js' type='text/javascript'></script> <script src='lib/backbone-min.js' type='text/javascript'></script>
<script src='swagger-ui.js' type='text/javascript'></script> <script src='swagger-ui.js' type='text/javascript'></script>
<script src='lib/highlight.9.1.0.pack.js' type='text/javascript'></script> <script src='lib/highlight.9.1.0.pack.js' type='text/javascript'></script>
<script src='lib/highlight.9.1.0.pack_extended.js' type='text/javascript'></script> <script src='lib/highlight.9.1.0.pack_extended.js'
<script src='lib/jsoneditor.min.js' type='text/javascript'></script> type='text/javascript'></script>
<script src='lib/marked.js' type='text/javascript'></script> <script src='lib/jsoneditor.min.js' type='text/javascript'></script>
<script src='lib/swagger-oauth.js' type='text/javascript'></script> <script src='lib/marked.js' type='text/javascript'></script>
<script src='lib/swagger-oauth.js' type='text/javascript'></script>
<!-- Some basic translations --> <!-- Some basic translations -->
<!-- <script src='lang/translator.js' type='text/javascript'></script> --> <!-- <script src='lang/translator.js' type='text/javascript'></script> -->
<!-- <script src='lang/ru.js' type='text/javascript'></script> --> <!-- <script src='lang/ru.js' type='text/javascript'></script> -->
<!-- <script src='lang/en.js' type='text/javascript'></script> --> <!-- <script src='lang/en.js' type='text/javascript'></script> -->
<script type="text/javascript"> <script type="text/javascript">
$(function () { $(function () {
var url = window.location.search.match(/url=([^&]+)/);   //获取当前网址,如:
if (url && url.length > 1) { var curWwwPath=window.document.location.href;
url = decodeURIComponent(url[1]); //获取主机地址之后的目录如:/galaxy-service/api-docs
} else { var pathName=window.document.location.pathname;
url = "http://127.0.0.1:8080/galaxy/api-docs"; var pos=curWwwPath.indexOf(pathName);
} //获取主机地址,如:http://127.0.0.1:8080
var localhostPaht=curWwwPath.substring(0,pos);
//获取带"/"的项目名,如:http://127.0.0.1:8080/galaxy-service/api-docs的pathName=/galaxy-service/api-docs,项目名是galaxy-service
var projectName=pathName.substring(0,pathName.substr(1).indexOf('/')+1);
var url =window.location.protocol+"//"+window.location.host+projectName+"/api-docs";
url = decodeURIComponent(url);
hljs.configure({ hljs.configure({
highlightSizeThreshold: 5000 highlightSizeThreshold: 5000
}); });
@@ -91,18 +103,25 @@
</head> </head>
<body class="swagger-section"> <body class="swagger-section">
<div id='header'> <div id='header'>
<div class="swagger-ui-wrap"> <div class="swagger-ui-wrap">
<a id="logo" href="/galaxy/api-docs"><img class="logo__img" alt="swagger" height="30" width="30" src="images/logo_small.png" /><span class="logo__title">swagger</span></a> <a id="logo" href="/galaxy/api-docs"><img class="logo__img"
alt="swagger" height="30" width="30" src="images/logo_small.png" /><span
class="logo__title">swagger</span></a>
<form id='api_selector'> <form id='api_selector'>
<div class='input'><input placeholder="http://example.com/api" id="input_baseUrl" name="baseUrl" type="text"/></div> <div class='input'>
<input placeholder="http://example.com/api" id="input_baseUrl"
name="baseUrl" type="text" />
</div>
<div id='auth_container'></div> <div id='auth_container'></div>
<div class='input'><a id="explore" class="header__btn" href="#" data-sw-translate>Explore</a></div> <div class='input'>
<a id="explore" class="header__btn" href="#" data-sw-translate>Explore</a>
</div>
</form> </form>
</div> </div>
</div> </div>
<div id="message-bar" class="swagger-ui-wrap" data-sw-translate>&nbsp;</div> <div id="message-bar" class="swagger-ui-wrap" data-sw-translate>&nbsp;</div>
<div id="swagger-ui-container" class="swagger-ui-wrap"></div> <div id="swagger-ui-container" class="swagger-ui-wrap"></div>
</body> </body>
</html> </html>