优化了上传文件的临时存储路径
This commit is contained in:
parent
251908b8b0
commit
cbbcdad382
|
|
@ -42,6 +42,9 @@ public class LoginInterceptor implements HandlerInterceptor {
|
|||
@Resource
|
||||
private UserAccessLogMapper userAccessLogMapper;
|
||||
|
||||
@Resource
|
||||
private ElePropertyConfig elePropertyConfig;
|
||||
|
||||
private static String getRealIp(HttpServletRequest request) {
|
||||
String ipAddress = request.getHeader("X-Forwarded-For");
|
||||
if (ipAddress == null || ipAddress.isEmpty() || "unknown".equalsIgnoreCase(ipAddress)) {
|
||||
|
|
@ -119,6 +122,7 @@ public class LoginInterceptor implements HandlerInterceptor {
|
|||
userLoginInfo.setUsername(claims.get(UserConstants.LOGIN_USER_NAME, String.class));
|
||||
userLoginInfo.setWorkNumber(claims.get(UserConstants.LOGIN_WORK_NUMBER, String.class));
|
||||
userLoginInfo.setAdminType(claims.get(UserConstants.LOGIN_ADMIN_TYPE, String.class));
|
||||
userLoginInfo.setPrjTmpDir(elePropertyConfig.getEleTmpPath());
|
||||
UserThreadLocal.set(userLoginInfo);
|
||||
}
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -1,20 +1,16 @@
|
|||
package com.electromagnetic.industry.software.common.parse;
|
||||
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.electromagnetic.industry.software.common.util.UserThreadLocal;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
import java.util.Objects;
|
||||
|
||||
public abstract class FileParse {
|
||||
|
||||
private static String tmpPath = Objects.requireNonNull(Thread.currentThread().getContextClassLoader().getResource("")).getPath();
|
||||
|
||||
public abstract String parseAllText(InputStream stream, String fileType);
|
||||
|
||||
protected String createFileTmpPath(String fileType) {
|
||||
tmpPath = FileUtil.getParent(tmpPath, 3) + File.separator + "tmp" + File.separator + IdUtil.simpleUUID() + "." + fileType;
|
||||
return tmpPath;
|
||||
return UserThreadLocal.getUser().getPrjTmpDir() + File.separator + "tmp" + File.separator + IdUtil.simpleUUID() + "." + fileType;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,6 +46,8 @@ public class UserLoginInfo {
|
|||
|
||||
private String parentId;
|
||||
|
||||
private String prjTmpDir;
|
||||
|
||||
/**
|
||||
* 访问请求的参数
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in New Issue