feat:修改文件档案接口

dev
wangxy 3 weeks ago
parent 200f61ad9a
commit 6201cd344f

@ -79,9 +79,13 @@
/* */ /* */
/* */ /* */
/* 80 */ if (reader != null) /* 80 */ if (reader != null)
/* 81 */ reader.close(); /* 81 */ {
reader.close();
}
/* 82 */ if (is != null) /* 82 */ if (is != null)
/* 83 */ is.close(); /* 83 */ {
is.close();
}
/* 84 */ } catch (IOException iOException) {} } catch (IOException e) { e.printStackTrace(); } finally { try { if (reader != null) reader.close(); if (is != null) is.close(); } catch (IOException iOException) {} } /* 84 */ } catch (IOException iOException) {} } catch (IOException e) { e.printStackTrace(); } finally { try { if (reader != null) reader.close(); if (is != null) is.close(); } catch (IOException iOException) {} }
/* */ /* */
/* */ } /* */ }
@ -91,30 +95,7 @@
/* */ /* */
/* */ /* */
/* */ private void initializeHelper() { /* */ private void initializeHelper() {
/* 93 */ Map<String, Integer> stringPossibilities = new HashMap<>(); /* 93 */
/* 94 */ Iterator<String> iter = this.charMap.keySet().iterator();
/* 95 */ while (iter.hasNext()) {
/* 96 */ String key = iter.next();
/* 97 */ if (key.length() >= 1) {
/* 98 */ for (int i = 0; i < key.length(); i++) {
/* 99 */ String keySubstring = key.substring(0, i + 1);
/* 100 */ if (stringPossibilities.containsKey(keySubstring)) {
/* 101 */ Integer integer = stringPossibilities.get(keySubstring);
/* 102 */ stringPossibilities.put(keySubstring, new Integer(integer
/* 103 */ .intValue() + 1));
/* */ } else {
/* 105 */ stringPossibilities.put(keySubstring, new Integer(1));
/* */ }
/* */ }
/* */ }
/* */ }
/* 110 */ iter = stringPossibilities.keySet().iterator();
/* 111 */ while (iter.hasNext()) {
/* 112 */ String key = iter.next();
/* 113 */ if (((Integer)stringPossibilities.get(key)).intValue() > 1) {
/* 114 */ this.conflictingSets.add(key);
/* */ }
/* */ }
/* */ } /* */ }
/* */ /* */
/* */ public String convert(String in) { /* */ public String convert(String in) {
@ -125,7 +106,8 @@
/* 124 */ String key = "" + c; /* 124 */ String key = "" + c;
/* 125 */ stackString.append(key); /* 125 */ stackString.append(key);
/* 126 */ if (!this.conflictingSets.contains(stackString.toString())) /* 126 */ if (!this.conflictingSets.contains(stackString.toString()))
/* 127 */ if (this.charMap.containsKey(stackString.toString())) { /* 127 */ {
if (this.charMap.containsKey(stackString.toString())) {
/* 128 */ outString.append(this.charMap.get(stackString.toString())); /* 128 */ outString.append(this.charMap.get(stackString.toString()));
/* 129 */ stackString.setLength(0); /* 129 */ stackString.setLength(0);
/* */ } else { /* */ } else {
@ -133,6 +115,7 @@
/* 132 */ stackString.delete(0, stackString.length() - 1); /* 132 */ stackString.delete(0, stackString.length() - 1);
/* 133 */ flushStack(outString, new StringBuilder(sequence)); /* 133 */ flushStack(outString, new StringBuilder(sequence));
/* */ } /* */ }
}
/* */ } /* */ }
/* 136 */ flushStack(outString, stackString); /* 136 */ flushStack(outString, stackString);
/* 137 */ return outString.toString(); /* 137 */ return outString.toString();

@ -1,8 +1,6 @@
package com.archive.common.utils.file; package com.archive.common.utils.file;
import com.archive.common.exception.file.FileNameLengthLimitExceededException; import com.archive.common.exception.file.*;
import com.archive.common.exception.file.FileSizeLimitExceededException;
import com.archive.common.exception.file.InvalidExtensionException;
import com.archive.common.utils.DateUtils; import com.archive.common.utils.DateUtils;
import com.archive.common.utils.StringUtils; import com.archive.common.utils.StringUtils;
import com.archive.common.utils.file.MimeTypeUtils; import com.archive.common.utils.file.MimeTypeUtils;
@ -172,22 +170,22 @@
if (allowedExtension == MimeTypeUtils.IMAGE_EXTENSION) if (allowedExtension == MimeTypeUtils.IMAGE_EXTENSION)
{ {
throw new InvalidExtensionException.InvalidImageExtensionException(allowedExtension, extension, fileName); throw new InvalidImageExtensionException(allowedExtension, extension, fileName);
} }
if (allowedExtension == MimeTypeUtils.FLASH_EXTENSION) if (allowedExtension == MimeTypeUtils.FLASH_EXTENSION)
{ {
throw new InvalidExtensionException.InvalidFlashExtensionException(allowedExtension, extension, fileName); throw new InvalidFlashExtensionException(allowedExtension, extension, fileName);
} }
if (allowedExtension == MimeTypeUtils.MEDIA_EXTENSION) if (allowedExtension == MimeTypeUtils.MEDIA_EXTENSION)
{ {
throw new InvalidExtensionException.InvalidMediaExtensionException(allowedExtension, extension, fileName); throw new InvalidMediaExtensionException(allowedExtension, extension, fileName);
} }
if (allowedExtension == MimeTypeUtils.VIDEO_EXTENSION) if (allowedExtension == MimeTypeUtils.VIDEO_EXTENSION)
{ {
throw new InvalidExtensionException.InvalidVideoExtensionException(allowedExtension, extension, fileName); throw new InvalidVideoExtensionException(allowedExtension, extension, fileName);
} }

@ -253,7 +253,7 @@
/* */ class TrustAnyHostnameVerifier /* */ class TrustAnyHostnameVerifier
/* */ implements HostnameVerifier /* */ implements HostnameVerifier
/* */ { /* */ {
/* */ private TrustAnyHostnameVerifier() {} /* */ TrustAnyHostnameVerifier() {}
/* */ /* */
/* */ public boolean verify(String hostname, SSLSession session) { /* */ public boolean verify(String hostname, SSLSession session) {
/* 259 */ return true; /* 259 */ return true;

@ -240,7 +240,7 @@
/* */ class TrustAnyTrustManager /* */ class TrustAnyTrustManager
/* */ implements X509TrustManager /* */ implements X509TrustManager
/* */ { /* */ {
/* */ private TrustAnyTrustManager() {} /* */ TrustAnyTrustManager() {}
/* */ /* */
/* */ public void checkClientTrusted(X509Certificate[] chain, String authType) {} /* */ public void checkClientTrusted(X509Certificate[] chain, String authType) {}
/* */ /* */

@ -185,7 +185,7 @@
/* */ try { /* */ try {
/* 186 */ log.info("sendSSLPost - {}", urlNameString); /* 186 */ log.info("sendSSLPost - {}", urlNameString);
/* 187 */ SSLContext sc = SSLContext.getInstance("SSL"); /* 187 */ SSLContext sc = SSLContext.getInstance("SSL");
/* 188 */ sc.init(null, new TrustManager[] { (TrustManager)new TrustAnyTrustManager(null) }, new SecureRandom()); /* 188 */ sc.init(null, new TrustManager[] { new TrustAnyTrustManager() }, new java.security.SecureRandom());
/* 189 */ URL console = new URL(urlNameString); /* 189 */ URL console = new URL(urlNameString);
/* 190 */ HttpsURLConnection conn = (HttpsURLConnection)console.openConnection(); /* 190 */ HttpsURLConnection conn = (HttpsURLConnection)console.openConnection();
/* 191 */ conn.setRequestProperty("accept", "*/*"); /* 191 */ conn.setRequestProperty("accept", "*/*");
@ -197,7 +197,7 @@
/* 197 */ conn.setDoInput(true); /* 197 */ conn.setDoInput(true);
/* */ /* */
/* 199 */ conn.setSSLSocketFactory(sc.getSocketFactory()); /* 199 */ conn.setSSLSocketFactory(sc.getSocketFactory());
/* 200 */ conn.setHostnameVerifier((HostnameVerifier)new TrustAnyHostnameVerifier(null)); /* 200 */ conn.setHostnameVerifier(new TrustAnyHostnameVerifier());
/* 201 */ conn.connect(); /* 201 */ conn.connect();
/* 202 */ InputStream is = conn.getInputStream(); /* 202 */ InputStream is = conn.getInputStream();
/* 203 */ BufferedReader br = new BufferedReader(new InputStreamReader(is)); /* 203 */ BufferedReader br = new BufferedReader(new InputStreamReader(is));

@ -25,7 +25,7 @@
/* */ /* */
/* */ public static UserRealm getUserRealm() { /* */ public static UserRealm getUserRealm() {
/* 27 */ RealmSecurityManager rsm = (RealmSecurityManager)SecurityUtils.getSecurityManager(); /* 27 */ RealmSecurityManager rsm = (RealmSecurityManager)SecurityUtils.getSecurityManager();
/* 28 */ return rsm.getRealms().iterator().next(); /* 28 */ return (UserRealm) rsm.getRealms().iterator().next();
/* */ } /* */ }
/* */ } /* */ }

@ -5,7 +5,8 @@
/* */ import com.archive.common.utils.security.ShiroUtils; /* */ import com.archive.common.utils.security.ShiroUtils;
/* */ import com.archive.framework.shiro.session.OnlineSessionDAO; /* */ import com.archive.framework.shiro.session.OnlineSessionDAO;
/* */ import com.archive.project.monitor.online.domain.OnlineSession; /* */ import com.archive.project.monitor.online.domain.OnlineSession;
/* */ import com.archive.project.system.user.domain.User; /* */ import com.archive.project.monitor.online.domain.OnlineStatus;
import com.archive.project.system.user.domain.User;
/* */ import java.io.IOException; /* */ import java.io.IOException;
/* */ import javax.servlet.ServletRequest; /* */ import javax.servlet.ServletRequest;
/* */ import javax.servlet.ServletResponse; /* */ import javax.servlet.ServletResponse;
@ -36,7 +37,7 @@
/* */ @Value("${shiro.user.loginUrl}") /* */ @Value("${shiro.user.loginUrl}")
/* */ private String loginUrl; /* */ private String loginUrl;
/* */ private OnlineSessionDAO onlineSessionDAO; /* */ private OnlineSessionDAO onlineSessionDAO;
/* */ /* */ @Override
/* */ protected boolean isAccessAllowed(ServletRequest request, ServletResponse response, Object mappedValue) throws Exception { /* */ protected boolean isAccessAllowed(ServletRequest request, ServletResponse response, Object mappedValue) throws Exception {
/* 39 */ Subject subject = getSubject(request, response); /* 39 */ Subject subject = getSubject(request, response);
/* 40 */ if (subject == null || subject.getSession() == null) /* 40 */ if (subject == null || subject.getSession() == null)
@ -63,7 +64,7 @@
/* */ } /* */ }
/* */ } /* */ }
/* */ /* */
/* 64 */ if (onlineSession.getStatus() == OnlineSession.OnlineStatus.off_line) /* 64 */ if (onlineSession.getStatus() == OnlineStatus.off_line)
/* */ { /* */ {
/* 66 */ return false; /* 66 */ return false;
/* */ } /* */ }
@ -75,7 +76,7 @@
/* */ /* */
/* */ /* */
/* */ /* */
/* */ /* */ @Override
/* */ protected boolean onAccessDenied(ServletRequest request, ServletResponse response) throws Exception { /* */ protected boolean onAccessDenied(ServletRequest request, ServletResponse response) throws Exception {
/* 78 */ Subject subject = getSubject(request, response); /* 78 */ Subject subject = getSubject(request, response);
/* 79 */ if (subject != null) /* 79 */ if (subject != null)
@ -88,7 +89,7 @@
/* */ /* */
/* */ /* */
/* */ /* */
/* */ /* */ @Override
/* */ protected void redirectToLogin(ServletRequest request, ServletResponse response) throws IOException { /* */ protected void redirectToLogin(ServletRequest request, ServletResponse response) throws IOException {
/* 91 */ WebUtils.issueRedirect(request, response, this.loginUrl); /* 91 */ WebUtils.issueRedirect(request, response, this.loginUrl);
/* */ } /* */ }

@ -6,7 +6,8 @@
/* */ import com.archive.common.ocr.ImageOcr; /* */ import com.archive.common.ocr.ImageOcr;
/* */ import com.archive.common.ocr.PdfOcr; /* */ import com.archive.common.ocr.PdfOcr;
/* */ import com.archive.common.utils.StringUtils; /* */ import com.archive.common.utils.StringUtils;
/* */ import com.archive.framework.config.ArchiveConfig; /* */ import com.archive.common.utils.http.HttpUtils;
import com.archive.framework.config.ArchiveConfig;
/* */ import com.archive.framework.web.controller.BaseController; /* */ import com.archive.framework.web.controller.BaseController;
/* */ import com.archive.framework.web.domain.AjaxResult; /* */ import com.archive.framework.web.domain.AjaxResult;
/* */ import com.archive.project.browse.service.IBrowseService; /* */ import com.archive.project.browse.service.IBrowseService;
@ -152,9 +153,13 @@
/* */ } finally { /* */ } finally {
/* */ try { /* */ try {
/* 152 */ if (fis != null) /* 152 */ if (fis != null)
/* 153 */ fis.close(); /* 153 */ {
fis.close();
}
/* 154 */ if (ops != null) /* 154 */ if (ops != null)
/* 155 */ ops.close(); /* 155 */ {
ops.close();
}
/* 156 */ } catch (Exception e) { /* 156 */ } catch (Exception e) {
/* 157 */ fis = null; /* 157 */ fis = null;
/* 158 */ ops = null; /* 158 */ ops = null;

@ -11,7 +11,8 @@
/* */ import com.archive.framework.web.domain.AjaxResult; /* */ import com.archive.framework.web.domain.AjaxResult;
/* */ import com.archive.framework.web.page.TableDataInfo; /* */ import com.archive.framework.web.page.TableDataInfo;
/* */ import com.archive.project.monitor.online.domain.OnlineSession; /* */ import com.archive.project.monitor.online.domain.OnlineSession;
/* */ import com.archive.project.monitor.online.domain.UserOnline; /* */ import com.archive.project.monitor.online.domain.OnlineStatus;
import com.archive.project.monitor.online.domain.UserOnline;
/* */ import com.archive.project.monitor.online.service.IUserOnlineService; /* */ import com.archive.project.monitor.online.service.IUserOnlineService;
/* */ import java.util.List; /* */ import java.util.List;
/* */ import org.apache.shiro.authz.annotation.Logical; /* */ import org.apache.shiro.authz.annotation.Logical;
@ -81,7 +82,7 @@
/* 79 */ return error("当前登录用户无法强退"); /* 79 */ return error("当前登录用户无法强退");
/* */ } /* */ }
/* 81 */ this.onlineSessionDAO.delete((Session)onlineSession); /* 81 */ this.onlineSessionDAO.delete((Session)onlineSession);
/* 82 */ online.setStatus(OnlineSession.OnlineStatus.off_line); /* 82 */ online.setStatus(OnlineStatus.off_line);
/* 83 */ this.userOnlineService.saveOnline(online); /* 83 */ this.userOnlineService.saveOnline(online);
/* 84 */ this.userOnlineService.removeUserCache(online.getLoginName(), sessionId); /* 84 */ this.userOnlineService.removeUserCache(online.getLoginName(), sessionId);
/* */ } /* */ }

Loading…
Cancel
Save