|
|
|
@ -48,10 +48,7 @@ public class PluginHelper {
|
|
|
|
|
* @param p 下载百分比处理 |
|
|
|
|
*/ |
|
|
|
|
public static void downloadPluginFile(String id, String username, String password, Process<Double> p) throws Exception { |
|
|
|
|
if (StringUtils.isEmpty(id)) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
if (StringUtils.isEmpty(username) || StringUtils.isEmpty(password)) { |
|
|
|
|
if (!PluginHelper.invalidUser(id, username, password)) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
HttpClient httpClient = new HttpClient(getDownloadPath(id, username, password)); |
|
|
|
@ -79,6 +76,16 @@ public class PluginHelper {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static boolean invalidUser(String id, String username, String password) { |
|
|
|
|
if (StringUtils.isEmpty(id)) { |
|
|
|
|
return false; |
|
|
|
|
} else if (StringUtils.isEmpty(username) || StringUtils.isEmpty(password)){ |
|
|
|
|
return false; |
|
|
|
|
} else { |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static String getDownloadPath(String id, String username, String password) throws Exception { |
|
|
|
|
HashMap<String, String> map = new HashMap<String, String>(); |
|
|
|
|
map.put("id", id); |
|
|
|
|