Explorar o código

添加版本信息,便于后续发行维护管理

keyuan %!s(int64=4) %!d(string=hai) anos
pai
achega
8268c16266

+ 2 - 2
pom.xml

@@ -548,8 +548,8 @@
         <artifactId>maven-compiler-plugin</artifactId>
         <version>3.1</version>
         <configuration>
-          <source>1.6</source>
-          <target>1.6</target>
+          <source>7</source>
+          <target>7</target>
         </configuration>
       </plugin>
       <plugin>

+ 78 - 0
src/main/java/com/key/common/plugs/version/VersionInfo.java

@@ -0,0 +1,78 @@
+package com.key.common.plugs.version;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
+
+public class VersionInfo {
+
+
+    private static final String versionInfo;
+
+    private static final String versionBuilt;
+
+    private static final String versionNumber;
+
+    static {
+
+        String info = null;
+        String built = null;
+        String number = null;
+
+        Properties props = new Properties();
+
+        try {
+            InputStream is = VersionInfo.class.getResourceAsStream("/com/key/common/plugs/version/VersionInfo.properties");
+
+            if(is!=null){
+                props.load(is);
+                info = props.getProperty("version.info");
+                built = props.getProperty("version.built");
+                number = props.getProperty("version.number");
+            }
+
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+
+        if (info == null || info.equals("DWSurvey OSS @VERSION@"))
+            info = "DWSurvey OSS V3.1.0-dev";
+        if (built == null || built.equals("@VERSION_BUILT@"))
+            built = "unknown";
+        if (number == null || number.equals("@VERSION_NUMBER@"))
+            number = "3.1.x";
+
+        versionInfo = info;
+        versionBuilt = built;
+        versionNumber = number;
+    }
+
+    public static String getVersionInfo() {
+        return versionInfo;
+    }
+
+    public static String getVersionBuilt() {
+        return versionBuilt;
+    }
+
+    public static String getVersionNumber() {
+        return versionNumber;
+    }
+
+    public static void main(String args[]) {
+        System.out.println("Server version: " + getVersionInfo());
+        System.out.println("Server built:   " + getVersionBuilt());
+        System.out.println("Server number:  " + getVersionNumber());
+        System.out.println("OS Name:        " +
+                           System.getProperty("os.name"));
+        System.out.println("OS Version:     " +
+                           System.getProperty("os.version"));
+        System.out.println("Architecture:   " +
+                           System.getProperty("os.arch"));
+        System.out.println("JVM Version:    " +
+                           System.getProperty("java.runtime.version"));
+        System.out.println("JVM Vendor:     " +
+                           System.getProperty("java.vm.vendor"));
+    }
+
+}

+ 3 - 0
src/main/java/com/key/common/plugs/version/VersionInfo.properties

@@ -0,0 +1,3 @@
+version.info=DWSurvey OSS @VERSION@
+version.number=@VERSION_NUMBER@
+version.built=@VERSION_BUILT@

+ 4 - 1
src/main/resources/conf/site/site.properties

@@ -9,4 +9,7 @@ dw.site.admin_email=keyuan258@gmail.net
 dw.site.admin_qq=
 dw.site.admin_telephone=010-00000000000
 dw.site.icp_code=\u4EACICP\u590713050030\u53F7-3
-dw_loginBgImg=/images/style-model/login_bg/2.jpg
+dw_loginBgImg=/images/style-model/login_bg/2.jpg
+###记录版本号
+dw.version = DWSurvey-OSS-v3.1.0
+

+ 3 - 2
src/main/webapp/WEB-INF/page/content/diaowen-design/design-survey.jsp

@@ -1,5 +1,6 @@
+<%@ page import="com.key.common.plugs.version.VersionInfo" %>
 <%@ page language="java" contentType="text/html; charset=UTF-8"
-    pageEncoding="UTF-8"%>
+		 pageEncoding="UTF-8"%>
  <%@include file="/common/taglibs.jsp" %>
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
 <html>
@@ -2303,7 +2304,7 @@
 <div style="text-align: center;">
 <div class="dw_foot" style="padding-bottom: 30px;">
 	<div class="footer-copyright" style="color: gray;padding-top: 0px;font-size: 16px;">
-		Powered by <a href="http://www.dwsurvey.net" target="_blank" style="text-decoration: none;color: gray;">DWSurvey</a>&nbsp;&nbsp;&nbsp;
+		Powered by <a href="http://www.diaowen.net" target="_blank" style="text-decoration: none;color: gray;"> <%=VersionInfo.getVersionInfo()%> </a>&nbsp;&nbsp;&nbsp;
 		Copyright © 2012-2021
 		<a href="http://www.diaowen.net" target="_blank" style="text-decoration: none;color: rgb(53, 117, 136);">调问网</a>
 	</div>

+ 3 - 2
src/main/webapp/WEB-INF/page/layouts/default.jsp

@@ -1,5 +1,6 @@
+<%@ page import="com.key.common.plugs.version.VersionInfo" %>
 <%@ page language="java" contentType="text/html; charset=UTF-8"
-    pageEncoding="UTF-8"%>
+		 pageEncoding="UTF-8"%>
  <%@include file="/common/taglibs.jsp" %>
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
 <html>
@@ -30,7 +31,7 @@
 
 		<!-- 必须保留声明 start -->
 		<div class="footer-copyright" style="color: gray;padding-top: 0px;font-size: 16px;padding-bottom: 16px;">
-			Powered by <a href="http://www.dwsurvey.net" style="text-decoration: none;color: gray;">DWSurvey</a>
+			Powered by <a href="http://www.diaowen.net" style="text-decoration: none;color: gray;"> <%=VersionInfo.getVersionInfo()%> </a>
 			&nbsp;&nbsp;&nbsp;Copyright © 2012-2017
 			<a href="http://www.diaowen.net" style="text-decoration: none;color: rgb(53, 117, 136);">调问网</a>
 		</div>