Browse Source

自动更新功能提交

chenweida 9 years ago
parent
commit
cac76a1bed

+ 4 - 1
Hos-Resource-Mini-Update/src/main/java/com/yihu/ehr/common/ApplicationStart.java

@ -90,10 +90,13 @@ public class ApplicationStart implements ServletContextListener {
            ThreadConfig.TOMCAT_SERVICENAME = prop.getProperty("tomcat.servicename");
            //ThreadConfig.SOFT_VERSIONCODE = prop.getProperty("soft.versionCode");
            ThreadConfig.SYSTEM_CODE= prop.getProperty("system.code");
            ThreadConfig.SYSTEM_CODE = prop.getProperty("system.code");
            ThreadConfig.TOKEN_INFO = prop.getProperty("token.info");
            ThreadConfig.TOKEN_USER_NAME = prop.getProperty("token.user_name");
            ThreadConfig.TOKEN_METHOD = prop.getProperty("token.getToken");
            ThreadConfig.SYSTEM_DOWNLOADPATH = prop.getProperty("system.downloadPath");
        } catch (Exception e) {
            e.printStackTrace();
        }

+ 1 - 0
Hos-Resource-Mini-Update/src/main/java/com/yihu/ehr/config/ThreadConfig.java

@ -36,6 +36,7 @@ public class ThreadConfig {
    public static String SOFT_VERSIONCODE = "1";
    public static String SYSTEM_CODE = "";
    public static String SYSTEM_DOWNLOADPATH="";
    private static Properties prop = new Properties();

+ 65 - 34
Hos-Resource-Mini-Update/src/main/java/com/yihu/ehr/thread/UpdateThread.java

@ -2,7 +2,8 @@ package com.yihu.ehr.thread;
import com.yihu.ehr.config.ThreadConfig;
import com.yihu.ehr.dbhelper.jdbc.DBHelper;
import com.yihu.ehr.util.ZipUtil;
import com.yihu.ehr.util.Zipper;
import com.yihu.ehr.util.http.HttpClientUtil;
import com.yihu.ehr.util.http.HttpsClientUtil;
import com.yihu.ehr.util.log.LogUtil;
import org.apache.http.NameValuePair;
@ -10,10 +11,7 @@ import org.apache.http.message.BasicNameValuePair;
import org.json.JSONObject;
import org.springframework.util.StringUtils;
import java.io.BufferedReader;
import java.io.File;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.*;
import java.text.SimpleDateFormat;
import java.util.*;
@ -28,6 +26,7 @@ public class UpdateThread implements Runnable {
    private String resultString = "";
    private String versionName = "";
    private String versionCode = "";
    private String downloadPath = "";
    private String token;
    @Override
@ -50,7 +49,7 @@ public class UpdateThread implements Runnable {
                            //关闭服務
                            closeService();
                            //睡眠五秒
                            Thread.sleep(5000L);
                            Thread.sleep(1000 * 60);
                            //解压
                            if (zipFile(filePath)) {
                                //启动服务
@ -82,7 +81,10 @@ public class UpdateThread implements Runnable {
    }
    private void updateVersion() {
        String sql = "update system_param set param_value='"+versionCode+"' where param_key='VERSION'";//UPDATE 表名称 SET 列名称 = 新值 WHERE 列名称 = 某值
        if (StringUtils.isEmpty(versionCode)) {
            versionCode = "1";
        }
        String sql = "update system_param set param_value='" + versionCode + "' where param_key='VERSION'";//UPDATE 表名称 SET 列名称 = 新值 WHERE 列名称 = 某值
        db.execute(sql);
    }
@ -120,19 +122,19 @@ public class UpdateThread implements Runnable {
                }
                if (listSYSTEM != null && listSYSTEM.size() > 0) {
                    systemCode = listSYSTEM.get(0).getString("param_value");
                }else{
                } else {
                    String sql = "insert into system_param (id,param_key,param_value) values " +
                            "('" + UUID.randomUUID() + "'," +
                            " 'SYSTEM_CODE' ," +
                            " '"+ThreadConfig.SYSTEM_CODE+"'" +
                            " '" + ThreadConfig.SYSTEM_CODE + "'" +
                            ")";
                    db.execute(sql);
                }
                LogUtil.info("初始化参数成功orgCode:" + orgCode + "---systemCode:" + systemCode);
            } catch (Exception e) {
                LogUtil.error("初始化参数失败:" + e.getMessage());
            }
        }
        LogUtil.info("初始化参数成功orgCode:" + orgCode + "---systemCode:" + systemCode);
    }
    private void closeService() throws Exception {
@ -144,10 +146,12 @@ public class UpdateThread implements Runnable {
                LogUtil.info("关闭windows服务");
                //windows
                String root = System.getProperty("catalina.home").replace('\\', '/');
                String[] commandStop = {root + "\\bin\\shutdown.bat"};
                String installPath = root.substring(0, root.lastIndexOf('/') + 1);
                String url = installPath + ThreadConfig.TOMCAT_SERVICENAME;
                String[] commandStop = {url + "\\bin\\shutdown.bat"};
                String[] envp = {"JAVA_HOME=" + root + "\\jdk1.8.0_45", "CATALINA_HOME=" + root};
                File workdir = new File(root + "\\bin");
                String[] envp = {"JAVA_HOME=" + installPath + "\\jdk1.8.0_45", "CATALINA_HOME=" + url};
                File workdir = new File(url + "\\bin");
                LogUtil.info("关闭服务目录:" + commandStop[0].toString());
                Process process = Runtime.getRuntime().exec(commandStop, envp, workdir);
@ -164,12 +168,14 @@ public class UpdateThread implements Runnable {
                br.close();
            } else {
                LogUtil.info("重启linux服务");
                Runtime.getRuntime().exec("service " + ThreadConfig.TOMCAT_SERVICENAME + " restart");
                Runtime.getRuntime().exec("service " + ThreadConfig.TOMCAT_SERVICENAME + " stop");
            }
            LogUtil.info("关闭成功");
        } catch (Exception e) {
            LogUtil.error("关闭失败:" + e.getMessage());
        }
    }
    private void startService() throws Exception {
@ -180,10 +186,12 @@ public class UpdateThread implements Runnable {
                LogUtil.info("启动windows服务");
                //windows
                String root = System.getProperty("catalina.home").replace('\\', '/');
                String[] commandStart = {root + "\\bin\\startup.bat"};
                String installPath = root.substring(0, root.lastIndexOf('/') + 1);
                String url = installPath + ThreadConfig.TOMCAT_SERVICENAME;
                String[] commandStart = {url + "\\bin\\startup.bat"};
                String[] envp = {"JAVA_HOME=" + root + "\\jdk1.8.0_45", "CATALINA_HOME=" + root};
                File workdir = new File(root + "\\bin");
                String[] envp = {"JAVA_HOME=" + installPath + "\\jdk1.8.0_45", "CATALINA_HOME=" + url};
                File workdir = new File(url + "\\bin");
                LogUtil.info("启动服务目录:" + commandStart[0].toString());
                Process process = Runtime.getRuntime().exec(commandStart, envp, workdir);
@ -200,7 +208,7 @@ public class UpdateThread implements Runnable {
                br.close();
            } else {
                LogUtil.info("启动linux服务");
                Runtime.getRuntime().exec("service " + ThreadConfig.TOMCAT_SERVICENAME + " restart");
                Runtime.getRuntime().exec("service " + ThreadConfig.TOMCAT_SERVICENAME + " start");
            }
            LogUtil.info("启动成功");
        } catch (Exception e) {
@ -212,8 +220,8 @@ public class UpdateThread implements Runnable {
        try {
            String home = System.getProperty("catalina.home").replace('\\', '/');
            String url = home.substring(0, home.lastIndexOf('/') + 1) + "tomcat8-esb-ds/webapps";
            boolean zipResult = ZipUtil.unZip(filePath, url);
            LogUtil.info("解压" + zipResult + ",解压路径:" + url);
            Zipper.unzipFile(new File(filePath.trim()), url);
            LogUtil.info("解压成功解压路径:" + url);
            return true;
        } catch (Exception e) {
            LogUtil.error("解压失败:" + e.getMessage());
@ -229,13 +237,14 @@ public class UpdateThread implements Runnable {
            // params.put("orgCode", orgCode);
            path = getFilePath();
            //  HttpClientUtil.downFile(path, params, ThreadConfig.getURL(ThreadConfig.UPDATE_THREAD_DOWNUPDATEWAR), "", "");
            Map<String, Object> params = new HashMap<String, Object>();
            params.put("systemCode", systemCode);
            params.put("orgCode", orgCode);
            params.put("access_token", token);
            if (!HttpsClientUtil.downLoadFileByBase64(path, params, ThreadConfig.SERVICE_URL + ThreadConfig.UPDATE_THREAD_DOWNUPDATEWAR, ThreadConfig.SERVICE_USERNAME, ThreadConfig.SERVICE_PASSWORD)) {
                throw new Exception("文件下载失败");
            }
            // Map<String, Object> params = new HashMap<String, Object>();
            // params.put("systemCode", systemCode);
            //  params.put("orgCode", orgCode);
            // params.put("access_token", token);
            LogUtil.info("开始下载文件,文件下載地址在:" + ThreadConfig.SYSTEM_DOWNLOADPATH + downloadPath);
            System.out.println(ThreadConfig.SYSTEM_DOWNLOADPATH + downloadPath);
            // HttpClientUtil.downFile(path, new HashMap<String, Object>(), , "", "");
            HttpClientUtil.getFile(ThreadConfig.SYSTEM_DOWNLOADPATH + downloadPath, path);
            LogUtil.info("下载文件成功,文件保存目录:" + path);
        } catch (Exception e) {
            e.printStackTrace();
@ -256,7 +265,7 @@ public class UpdateThread implements Runnable {
            List<JSONObject> listSYSTEM = db.query("select * from system_param where param_key='VERSION'");
            if (listSYSTEM != null && listSYSTEM.size() > 0) {
                ThreadConfig.SOFT_VERSIONCODE = listSYSTEM.get(0).getString("param_value");
            }else{
            } else {
                String sql = "insert into system_param (id,param_key,param_value) values " +
                        "('" + UUID.randomUUID() + "'," +
                        " 'VERSION' ," +
@ -264,7 +273,7 @@ public class UpdateThread implements Runnable {
                        ")";
                db.execute(sql);
                ThreadConfig.SOFT_VERSIONCODE="1";
                ThreadConfig.SOFT_VERSIONCODE = "1";
            }
            // resultString = HttpClientUtil.doPost(ThreadConfig.SERVICE_URL + ThreadConfig.UPDATE_THREAD_GETUPDATEFLAG, params, ThreadConfig.SERVICE_USERNAME, ThreadConfig.SERVICE_PASSWORD);
            Map<String, Object> params = new HashMap<String, Object>();
@ -277,8 +286,13 @@ public class UpdateThread implements Runnable {
            //不需要更新返回空 需要更新返回版本号版本名称
            if (!StringUtils.isEmpty(resultString)) {
                net.sf.json.JSONObject jo = net.sf.json.JSONObject.fromObject(resultString);
                LogUtil.info("判断是否有需要更新的任务返回結果:" + resultString);
                versionName = String.valueOf(jo.get("versionName"));
                versionCode = String.valueOf(jo.get("versionCode"));
                downloadPath = String.valueOf(jo.get("file"));
                if (StringUtils.isEmpty(versionName)) {
                    return false;
                }
                return true;
            } else {
                return false;
@ -310,12 +324,29 @@ public class UpdateThread implements Runnable {
    }
    public static void main(String[] args) {
        String cmd = "cmd /c start F:\\aaa.bat";// pass
        getProcess();
    }
    public static boolean getProcess() {
        boolean flag = false;
        try {
            //tomcat8-esb-service
            Process ps = Runtime.getRuntime().exec(cmd);
            ps.waitFor();
        } catch (Exception ioe) {
            Process p = Runtime.getRuntime().exec("cmd /c tasklist ");
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            InputStream os = p.getInputStream();
            byte b[] = new byte[256];
            while (os.read(b) > 0)
                baos.write(b);
            String s = baos.toString();
            System.out.println(s);
            if (s.indexOf("smss.exe") >= 0) {
                System.out.println("yes ");
                flag = true;
            } else {
                System.out.println("no ");
                flag = false;
            }
        } catch (java.io.IOException ioe) {
        }
        return flag;
    }
}

+ 2 - 1
Hos-Resource-Mini-Update/src/main/java/com/yihu/ehr/util/ZipUtil.java

@ -86,6 +86,7 @@ public class ZipUtil {
            }
            flag = true;
        } catch (Exception ex) {
            ex.printStackTrace();
            return false;
        }
        return flag;
@ -129,7 +130,7 @@ public class ZipUtil {
            //ZipUtil.zip("F:/简历",
            //       "F:/sss.war");
            ZipUtil.unZip("F:/sss.war",
            ZipUtil.unZip("E:/Hos-Resource-Mini-Update.war",
                    "E:/");
        } catch (Exception e) {
            // TODO Auto-generated catch block

+ 177 - 0
Hos-Resource-Mini-Update/src/main/java/com/yihu/ehr/util/Zipper.java

@ -0,0 +1,177 @@
package com.yihu.ehr.util;
import com.yihu.ehr.util.operator.StringUtil;
import net.lingala.zip4j.core.ZipFile;
import net.lingala.zip4j.exception.ZipException;
import net.lingala.zip4j.model.FileHeader;
import net.lingala.zip4j.model.ZipParameters;
import net.lingala.zip4j.util.Zip4jConstants;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
/**
 * 文件压缩辅助类
 *
 * @created Air 2015/5/26.
 */
public class Zipper {
    /**
     * 使用给定密码解压指定的ZIP压缩文件到指定目录
     * <p>
     * 如果指定目录不存在,可以自动创建,不合法的路径将导致异常被抛出
     *
     * @param zip    指定的ZIP压缩文件
     * @param dest   解压目录
     * @param passwd ZIP文件的密码
     * @return 解压后文件数组
     * @throws ZipException 压缩文件有损坏或者解压缩失败抛出
     */
    public static File[] unzip(String zip, String dest, String passwd) throws ZipException {
        File zipFile = new File(zip);
        return unzip(zipFile, dest, passwd);
    }
    /**
     * 使用给定密码解压指定的ZIP压缩文件到当前目录
     *
     * @param zip    指定的ZIP压缩文件
     * @param passwd ZIP文件的密码
     * @return 解压后文件数组
     * @throws ZipException 压缩文件有损坏或者解压缩失败抛出
     */
    public static File[] unzip(String zip, String passwd) throws ZipException {
        File zipFile = new File(zip);
        File parentDir = zipFile.getParentFile();
        return unzip(zipFile, parentDir.getAbsolutePath(), passwd);
    }
    /**
     * 使用给定密码解压指定的ZIP压缩文件到指定目录
     * <p>
     * 如果指定目录不存在,可以自动创建,不合法的路径将导致异常被抛出
     *
     * @param dest   解压目录
     * @param passwd ZIP文件的密码
     * @return 解压后文件数组
     * @throws ZipException 压缩文件有损坏或者解压缩失败抛出
     */
    public static File[] unzip(File zipFile, String dest, String passwd) throws ZipException {
        ZipFile zFile = new ZipFile(zipFile);
        zFile.setFileNameCharset("GBK");
        if (!zFile.isValidZipFile()) {
            throw new ZipException("压缩文件不合法,可能被损坏.");
        }
        File destDir = new File(dest);
        if (destDir.isDirectory() && !destDir.exists()) {
            destDir.mkdir();
        }
        if (zFile.isEncrypted()) {
            zFile.setPassword(passwd.toCharArray());
        }
        zFile.extractAll(dest);
        List<FileHeader> headerList = zFile.getFileHeaders();
        List<File> extractedFileList = new ArrayList<>();
        for (FileHeader fileHeader : headerList) {
            if (!fileHeader.isDirectory()) {
                extractedFileList.add(new File(destDir, fileHeader.getFileName()));
            }
        }
        File[] extractedFiles = new File[extractedFileList.size()];
        extractedFileList.toArray(extractedFiles);
        return extractedFiles;
    }
    /**
     * @param unzipFile   需要压缩的文件(文件夹)
     * @param zipFileName 压缩后的文件名
     * @return 成功-File 失败-null
     * @throws ZipException
     */
    public File zipFile(File unzipFile, String zipFileName) throws ZipException {
        return zipFile(unzipFile, zipFileName, null);
    }
    /**
     * @param unzipFile   需要压缩的文件(文件夹)
     * @param zipFileName 压缩后的文件名
     * @param pwd         压缩密码
     * @return 成功-File 失败-null
     * @throws ZipException 2015.09.15 airhead modify 压缩文件为文件夹时,压缩从子目录开始,忽略当前目录
     */
    public File zipFile(File unzipFile, String zipFileName, String pwd) throws ZipException {
        //文件不存在时不压缩
        if (!unzipFile.exists()) {
            return null;
        }
        ZipParameters parameters = new ZipParameters();
        parameters.setCompressionMethod(Zip4jConstants.COMP_DEFLATE);
        parameters.setCompressionLevel(Zip4jConstants.DEFLATE_LEVEL_NORMAL);
        if (!StringUtil.isEmpty(pwd)) {
            parameters.setEncryptFiles(true);
            parameters.setEncryptionMethod(Zip4jConstants.ENC_METHOD_STANDARD);
            parameters.setPassword(pwd.toCharArray());
        }
        File file = new File(zipFileName);
        if (!file.exists()) {
            file.getParentFile().mkdirs();
        }
        ZipFile zipFile = new ZipFile(zipFileName);
        if (unzipFile.isDirectory()) {
//            zipFile.addFolder(unzipFile, parameters);
            File[] files = unzipFile.listFiles();
            for (int i = 0; i < files.length; i++) {
                if (files[i].isDirectory()) {
                    zipFile.addFolder(files[i], parameters);
                } else {
                    zipFile.addFile(files[i], parameters);
                }
            }
        } else {
            zipFile.addFile(unzipFile, parameters);
        }
        return new File(zipFileName);
    }
    /**
     * @param zipFile        需要解压的文件名
     * @param unzipDirectory 解压文件路径
     * @return 成功-File 失败-null
     * @throws ZipException
     */
    public static File unzipFile(File zipFile, String unzipDirectory) throws ZipException {
        return unzipFile(zipFile, unzipDirectory, null);
    }
    /**
     * @param zipFile        需要解压的文件名
     * @param unzipDirectory 解压文件路径
     * @param pwd            解压密码
     * @return 成功-File 失败-null
     * @throws ZipException
     */
    public static File unzipFile(File zipFile, String unzipDirectory, String pwd) throws ZipException {
        ZipFile zFile = new ZipFile(zipFile);
        zFile.setFileNameCharset("GBK");
        if (!zFile.isValidZipFile()) {
            throw new ZipException("无效的压缩文件.");
        }
        if (zFile.isEncrypted()) {
            zFile.setPassword(pwd.toCharArray());
        }
        zFile.extractAll(unzipDirectory);
        return new File(unzipDirectory);
    }
    public static void main(String[] args) throws Exception {
        Zipper.unzipFile(new File("E:\\Hos-Resource-Mini-Update.war"), "E:/");
    }
}

+ 34 - 1
Hos-Resource-Mini-Update/src/main/java/com/yihu/ehr/util/http/HttpClientUtil.java

@ -3,6 +3,7 @@ package com.yihu.ehr.util.http;
import org.apache.http.Consts;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.CredentialsProvider;
import org.apache.http.client.config.RequestConfig;
@ -385,6 +386,37 @@ public class HttpClientUtil {
        return file;
    }
    public static void getFile(String url, String destFileName)
            throws Exception {
        // 生成一个httpclient对象
        CloseableHttpClient httpclient = HttpClients.createDefault();
        HttpGet httpget = new HttpGet(url);
        HttpResponse response = httpclient.execute(httpget);
        HttpEntity entity = response.getEntity();
        InputStream in = entity.getContent();
        File file = new File(destFileName);
        FileOutputStream fout = null;
        try {
            fout = new FileOutputStream(file);
            int l = -1;
            byte[] tmp = new byte[1024];
            while ((l = in.read(tmp)) != -1) {
                fout.write(tmp, 0, l);
                // 注意这里如果用OutputStream.write(buff)的话,图片会失真,大家可以试试
            }
            fout.flush();
        } finally {
            // 关闭低层流。
            if (in != null) {
                in.close();
            }
            if (fout != null) {
                fout.close();
            }
            httpclient.close();
        }
    }
    public static void main(String[] args) throws Exception {
        Map<String, Object> params = new HashMap<String, Object>();
@ -411,6 +443,7 @@ public class HttpClientUtil {
        //params.put("id", "aaaaaaaa1");
        // params.put("queryParams", "[]");
        params.put("systemCode", "test1");
        HttpClientUtil.downFile("E:/bbb.war", params, "http://localhost:10060/api/v1.0/esb/downUpdateWar", "", "");
        //  HttpClientUtil.downFile("E:/AADq8amUQ2161111.war", params, , "", "");
        HttpClientUtil.getFile("http://172.19.103.54/group1/M00/00/06/rBFuWVX6rQGADZfKAABQtFXK5o8933.war", "E:/AADq8amUQ2161231111.war");
    }
}

+ 24 - 12
Hos-Resource-Mini-Update/src/main/java/com/yihu/ehr/util/http/HttpsClientUtil.java

@ -310,7 +310,7 @@ public class HttpsClientUtil {
            HttpPost httpPost = new HttpPost(url);
            //设置请求信息
            RequestConfig requestConfig = RequestConfig.custom().
                    setAuthenticationEnabled(true).build();
                    setAuthenticationEnabled(true).setConnectTimeout(8 * 1000 * 60).build();
            //设置参数
            List<NameValuePair> formparams = new ArrayList<NameValuePair>();
            for (Map.Entry<String, Object> entry : params.entrySet()) {
@ -332,9 +332,10 @@ public class HttpsClientUtil {
                response = httpclient.execute(httpPost);
            }
            HttpEntity httpEntity = response.getEntity();
            String responString = EntityUtils.toString(httpEntity, "UTF-8");
            String responString = EntityUtils.toString(httpEntity);
            file = new File(filePath);
            file.getParentFile().mkdirs();
            System.out.println(responString.length());
            InputStream i = new ByteArrayInputStream(Base64.decode(responString));
            FileOutputStream fileout = new FileOutputStream(file);
            /**
@ -357,8 +358,7 @@ public class HttpsClientUtil {
        }
    }
    public static File downLoadFile(String filePath, Map<String, Object> params, String url, String username, String password) {
    public static boolean downLoadFile(String filePath, Map<String, Object> params, String url, String username, String password) {
        File file = null;
        CloseableHttpResponse response = null;
        List<BasicNameValuePair> jsonParams = new ArrayList<>();
@ -368,7 +368,7 @@ public class HttpsClientUtil {
            HttpPost httpPost = new HttpPost(url);
            //设置请求信息
            RequestConfig requestConfig = RequestConfig.custom().
                    setAuthenticationEnabled(true).build();
                    setAuthenticationEnabled(true).setConnectTimeout(8 * 1000 * 60).build();
            //设置参数
            List<NameValuePair> formparams = new ArrayList<NameValuePair>();
            for (Map.Entry<String, Object> entry : params.entrySet()) {
@ -390,27 +390,30 @@ public class HttpsClientUtil {
                response = httpclient.execute(httpPost);
            }
            HttpEntity httpEntity = response.getEntity();
            InputStream is = httpEntity.getContent();
            String responString = EntityUtils.toString(httpEntity);
            file = new File(filePath);
            file.getParentFile().mkdirs();
            System.out.println(responString.length());
            InputStream i = new ByteArrayInputStream(responString.getBytes("UTF-8"));
            FileOutputStream fileout = new FileOutputStream(file);
            /**
             * 根据实际运行效果 设置缓冲区大小
             */
            byte[] buffer = new byte[1024];
            int ch = 0;
            while ((ch = is.read(buffer)) != -1) {
            while ((ch = i.read(buffer)) != -1) {
                fileout.write(buffer, 0, ch);
            }
            is.close();
            i.close();
            fileout.flush();
            fileout.close();
            return true;
        } catch (Exception e) {
            return null;
            e.printStackTrace();
            return false;
        } finally {
            close(httpclient, response);
        }
        return file;
    }
    /**
@ -492,10 +495,19 @@ public class HttpsClientUtil {
        // formParams.add(new BasicNameValuePair("orgCode", "123"));
        // formParams.add(new BasicNameValuePair("access_token", "3801916fbd19d6fdc2adf2752b491a5d"));
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("info", "{\"fingerprint\": \"abc\"}");
        params.put("access_token", "4cqetfocxyorlb5ug9umgatlpkjjn18n");
        params.put("systemCode", "MINIESB");
        params.put("orgCode", "FJWYSYY");
        //params.put("info", "{\"fingerprint\": \"abc\"}");
        //params.put("user_name", "admin");
        //POST /api/v1.0/simplified-esb/fillMiningPUT /api/v1.0/authorizations/users/{user_name}
        System.out.println(getToken());
        // System.out.println(getToken());
        // System.out.println(HttpsClientUtil.post("https://192.168.5.109:4431/api/v1.0/simplified-esb/fillMining", formParams, "admin", "123456"));
        //params.put("access_token", "7txx6wx8cmak3zpnpralh3d9626z9vfu");
        //   params.put("systemCode", "MINIESB");
        //  params.put("orgCode", "test1");
        // params.put("info", "{\"fingerprint\": \"abc\"}");
        // HttpsClientUtil.downLoadFileByBase64("E:/a.war", params, "https://172.19.103.45:8443/api/v1.0/simplified-esb/downUpdateWar", "", "");
        HttpsClientUtil.downLoadFile("E:/b.zip", params, "https://192.168.131.6:4432/api/v1.0/simplified-esb/downUpdateWar", "", "");
    }
}

+ 5 - 3
Hos-Resource-Mini-Update/src/main/resources/config/threadConfig.properties

@ -1,6 +1,6 @@
soft.versionCode=1
## service address
service.url=https://ehr.yihu.com/api/v1.0/
service.url=https://172.19.103.73:443/api/v1.0/
service.clientId = kHAbVppx44
service.clientKey = Bd2h8rdYhep6NKOO
service.username=user
@ -15,7 +15,7 @@ updateThread.downUpdateWar=simplified-esb/downUpdateWar
updateThread.uploadResult=simplified-esb/uploadResult
##service name
tomcat.servicename=tomcat8-esb-service
tomcat.servicename=tomcat8-esb-ds
##token
token.info={"fingerprint": "abc"}
@ -24,4 +24,6 @@ token.getToken=authorizations/clients/
token.user_name=kHAbVppx44
system.code=MINIESB
system.code=MINIESB
system.downloadPath=http://172.19.103.54/