Ver código fonte

mini系统测试与修改

hzp 9 anos atrás
pai
commit
b536082209

+ 5 - 6
Hos-Resource-Mini/src/main/java/com.yihu.ehr/service/standard/StandardManager.java

@ -10,6 +10,7 @@ import com.yihu.ehr.util.encode.Base64;
import com.yihu.ehr.util.encrypt.RSA;
import com.yihu.ehr.util.file.FileUtil;
import com.yihu.ehr.util.httpclient.EsbHttp;
import com.yihu.ehr.util.httpclient.HttpClientUtil;
import com.yihu.ehr.util.httpclient.Response;
import com.yihu.ehr.util.log.LogUtil;
import com.yihu.ehr.util.operator.CollectionUtil;
@ -166,15 +167,13 @@ public class StandardManager {
                    String encryptPwd = re.getString("password");
                    String zipContent = re.getString("url");
                    String downloadFilePath = SysConfig.getInstance().getTempFile() + "/" + Constants.STANDARD_ZIP;
                    boolean writeFile = FileUtil.writeFile(downloadFilePath, zipContent, "UTF-8");
                    if (!writeFile) {
                        LogUtil.fatal("下载标准包失败,生成本地临时文件错误.");
                        return null;
                    }
                    //boolean writeFile = FileUtil.writeFile(downloadFilePath, zipContent, "UTF-8");
                    HttpClientUtil.downLoadFile(downloadFilePath,zipContent,"","");
                    return encryptPwd;
                }
                else{
                    LogUtil.fatal("下载标准包失败");
                    LogUtil.fatal("获取标准包失败");
                    return null;
                }
            }

+ 8 - 19
Hos-Resource-Mini/src/main/java/com.yihu.ehr/util/httpclient/HttpClientUtil.java

@ -199,13 +199,6 @@ public class HttpClientUtil {
    /**
     * 发送File
     *
     * @param filePath 文件路径
     * @param params   参数
     * @param url      http路径
     * @param username
     * @param password
     * @return
     */
    public static File downLoadFileByBase64(String filePath, Map<String, Object> params, String url, String username, String password) {
        File file = null;
@ -264,25 +257,21 @@ public class HttpClientUtil {
        return file;
    }
    public static File downLoadFile(String filePath, Map<String, Object> params, String url, String username, String password) {
    /**
     * 下载文件
     */
    public static File downLoadFile(String filePath, String url, String username, String password) {
        File file = null;
        CloseableHttpResponse response = null;
        List<BasicNameValuePair> jsonParams = new ArrayList<>();
        CloseableHttpClient httpclient = getCloseableHttpClient(null);
        try {
            HttpPost httpPost = new HttpPost(url);
            HttpGet httpGet = new HttpGet(url);
            //设置请求信息
            RequestConfig requestConfig = RequestConfig.custom().
                    setAuthenticationEnabled(true).build();
            //设置参数
            List<NameValuePair> formparams = new ArrayList<NameValuePair>();
            for (Map.Entry<String, Object> entry : params.entrySet()) {
                formparams.add(new BasicNameValuePair(entry.getKey(), String.valueOf(entry.getValue())));
            }
            UrlEncodedFormEntity entity = new UrlEncodedFormEntity(formparams, Consts.UTF_8);
            httpPost.setEntity(entity);
            httpPost.setConfig(requestConfig);
            if (!StringUtils.isEmpty(username) && !StringUtils.isEmpty(password)) {
                //需要验证
                HttpClientContext context = HttpClientContext.create();
@ -291,9 +280,9 @@ public class HttpClientUtil {
                credsProvider.setCredentials(new org.apache.http.auth.AuthScope(org.apache.http.auth.AuthScope.ANY_HOST, org.apache.http.auth.AuthScope.ANY_PORT),
                        new org.apache.http.auth.UsernamePasswordCredentials(username, password));
                context.setCredentialsProvider(credsProvider);
                response = httpclient.execute(httpPost, context);
                response = httpclient.execute(httpGet, context);
            } else {
                response = httpclient.execute(httpPost);
                response = httpclient.execute(httpGet);
            }
            HttpEntity httpEntity = response.getEntity();
            InputStream is = httpEntity.getContent();