TianGuangHui před 8 roky
rodič
revize
0b0c3d546a

+ 5 - 2
src/main/java/org/leanwo/management/util/AutoUpdateService.java

@@ -116,9 +116,10 @@ public class AutoUpdateService {
 	 * 确定执行更新.
 	 */
 	public void autoUpdate(ApplicationSetting setting) {
+		//需要更新的文件
 		List<String> autoUpdateFileNames = setting.getAutoUpdateFileNames();
 		String savePath = setting.getInstallPath();
-		//文件保存位置  
+		//用于保存下载文件的目录 
 		File saveDir = new File(savePath);  
 		String fileName = savePath.substring(savePath.lastIndexOf("\\")+1);
 		URL url;
@@ -126,6 +127,7 @@ public class AutoUpdateService {
 		FileOutputStream fos = null;
 		try {
 			for (String s : autoUpdateFileNames) {
+				//url请求路径
 				String requestPath =  updateSite + "/" + fileName + "/" + s;
 				if (!existHttpPath(requestPath)) {
 					throw new RuntimeException("需要更新的文件"+ requestPath + "不存在");
@@ -138,7 +140,7 @@ public class AutoUpdateService {
 				conn.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)");  
 				//得到输入流  
 				inputStream = conn.getInputStream();    
-				//获取自己数组  
+				//获取自己的输入流数组  
 				byte[] getData = readInputStream(inputStream);      
 					
 				//判断要保存的目录是否存在,不存在就创建
@@ -149,6 +151,7 @@ public class AutoUpdateService {
 				fos = new FileOutputStream(file);  
 				fos.write(getData);
 				if (s.substring(s.lastIndexOf(".")+1).equals("zip")) {
+					//解压改文件file至目录下C:\\Users\\TianGuangHui\\Service\\Report_Server_20171218
 					unZipFiles(file,"C:\\Users\\TianGuangHui\\Service\\Report_Server_20171218\\");
 				}
 				}