dangsn
2024-06-11 b6dee87c91bfdcb68fcc456c9a2ec46b2ed7cbe3
Source/plt-web/plt-web-parent/plt-web-base/src/main/java/com/vci/starter/web/util/ControllerUtil.java
@@ -1,19 +1,17 @@
package com.vci.starter.web.util;
import com.vci.starter.web.pagemodel.PageHelper;
import com.vci.starter.web.constant.VConstant;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.MediaType;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@@ -292,7 +290,7 @@
     * @param isQueryTotal 是否查询总数
     */
    public static void setQueryTotal(HttpServletRequest request, boolean isQueryTotal){
        WebThreadLocalUtil.getNeedQueryTotalInThread().set(isQueryTotal?"true":"false");
        WebThreadLocalUtil.setNeedQueryTotalInThread(isQueryTotal?"true":"false");
        //request.setAttribute(webProperties.getQueryTotalSessionName(), isQueryTotal);
    }
@@ -323,4 +321,32 @@
            tempFileForDownloadMap.remove(uuid);
        }
    }
    /**
     * 内容编码
     *
     * @param str 内容
     * @return 编码后的内容
     */
    public static String urlEncode(String str) {
        try {
            return URLEncoder.encode(str, VConstant.UTF8);
        } catch (UnsupportedEncodingException e) {
            return StringUtils.EMPTY;
        }
    }
    /**
     * 内容解码
     *
     * @param str 内容
     * @return 解码后的内容
     */
    public static String urlDecode(String str) {
        try {
            return URLDecoder.decode(str, VConstant.UTF8);
        } catch (UnsupportedEncodingException e) {
            return StringUtils.EMPTY;
        }
    }
}