Skip to content
This repository was archived by the owner on Mar 6, 2024. It is now read-only.

Commit df7412d

Browse files
committed
优化部分代码
1 parent 985d39d commit df7412d

File tree

19 files changed

+156
-75
lines changed

19 files changed

+156
-75
lines changed

.gitignore

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ buildNumber.properties
3737
### IntelliJ IDEA ###
3838
.idea
3939
*.iws
40-
*.iml
4140
*.ipr
4241

4342
.DS_Store
@@ -57,4 +56,7 @@ build/
5756
nbbuild/
5857
dist/
5958
nbdist/
60-
.nb-gradle/
59+
.nb-gradle/
60+
/META-INF/
61+
src/main/resources/templates/
62+
/out/

META-INF/MANIFEST.MF

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Manifest-Version: 1.0
2+
Main-Class: com.zhazhapan.efo.EfoApplication
3+

README.md

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,37 @@
1-
# efo
2-
线上文件管理系统
1+
#### 项目名称 `efo``Easy File Online` 的缩写,字面意思就是让您轻松实现线上文件管理
2+
3+
##### 且本系统具有文件分享的功能,权限控制和自定义配置都很强大(可能还不完善,望大神指教)
4+
5+
##### 系统后端框架有Spring Boot,Spring, SpringMVC,MyBatis; 前段框架有Bootstrap,Jquery, Layer, Vue。项目完全纯注解,零XML配置。
6+
7+
> 第一次运行系统,请先运行 [SQL代码](/mysql/efo.sql) , 并登陆系统修改系统用户(默认密码 `123456``system` 的密码
8+
9+
###### 项目部分截图(背景图片可通过配置设置)
10+
11+
- 登录页面(包含登录、注册、密码重置),路径 `/signin`
12+
13+
![登录页面](http://oq4pzgtcb.bkt.clouddn.com/git/efo/signin.png)
14+
15+
- 资源首页,路径 `/index`
16+
17+
![登录页面](http://oq4pzgtcb.bkt.clouddn.com/git/efo/index.png)
18+
19+
- 上传页面,路径 `/upload`
20+
21+
![登录页面](http://oq4pzgtcb.bkt.clouddn.com/git/efo/upload.png)
22+
23+
- 管理员管理页面,路径 `/admin`
24+
25+
![登录页面](http://oq4pzgtcb.bkt.clouddn.com/git/efo/admin.png)
26+
27+
- 远程文件管理(管理服务器端所有文件,只有系统用户才能进入此页面),路径 `/filemanager`
28+
29+
![登录页面](http://oq4pzgtcb.bkt.clouddn.com/git/efo/filemanager.png)
30+
31+
> 此功能基于 `angular-filamanager` 实现,其中上传部分我搞的还不是很明白,用的很笨的方法实现了上传(但是最多只能上传11个文件,可修改代码,自行设置)
32+
33+
> 有知道怎么弄的大神,望告知啊。
34+
35+
> [angular-filamanager项目地址](https://github.com/joni2back/angular-filemanager)
36+
37+
#### 大家有什么好的建议欢迎提出哦,觉得好用的话,给个star呗

pom.xml

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
<groupId>com.zhazhapan</groupId>
77
<artifactId>efo</artifactId>
8-
<version>0.0.1-SNAPSHOT</version>
8+
<version>1.0</version>
99
<packaging>jar</packaging>
1010

1111
<name>efo</name>
@@ -33,7 +33,7 @@
3333
<dependency>
3434
<groupId>com.zhazhapan</groupId>
3535
<artifactId>util</artifactId>
36-
<version>1.0.4</version>
36+
<version>1.0.5</version>
3737
<exclusions>
3838
<exclusion>
3939
<artifactId>commons-io</artifactId>
@@ -102,7 +102,33 @@
102102
<groupId>org.springframework.boot</groupId>
103103
<artifactId>spring-boot-maven-plugin</artifactId>
104104
</plugin>
105+
<plugin>
106+
<groupId>org.apache.maven.plugins</groupId>
107+
<artifactId>maven-shade-plugin</artifactId>
108+
<version>2.2</version>
109+
<executions>
110+
<execution>
111+
<phase>package</phase>
112+
<goals>
113+
<goal>shade</goal>
114+
</goals>
115+
<configuration>
116+
<transformers>
117+
<transformer
118+
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
119+
<mainClass>com.zhazhapan.efo.EfoApplication</mainClass>
120+
</transformer>
121+
</transformers>
122+
</configuration>
123+
</execution>
124+
</executions>
125+
</plugin>
105126
</plugins>
127+
<resources>
128+
<resource>
129+
<directory>src/main</directory>
130+
</resource>
131+
</resources>
106132
</build>
107133

108134
<repositories>

src/main/java/com/zhazhapan/efo/EfoApplication.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import com.zhazhapan.efo.config.TokenConfig;
55
import com.zhazhapan.efo.modules.constant.ConfigConsts;
66
import com.zhazhapan.efo.modules.constant.DefaultValues;
7+
import com.zhazhapan.util.FileExecutor;
78
import com.zhazhapan.util.MailSender;
89
import com.zhazhapan.util.ReflectUtils;
910
import org.mybatis.spring.annotation.MapperScan;
@@ -32,7 +33,7 @@ public class EfoApplication {
3233
public static Hashtable<String, Integer> tokens;
3334

3435
public static void main(String[] args) throws IOException, ClassNotFoundException {
35-
settings.setJsonPath(EfoApplication.class.getResource(DefaultValues.SETTING_PATH));
36+
settings.setJsonObject(FileExecutor.read(EfoApplication.class.getResourceAsStream(DefaultValues.SETTING_PATH)));
3637
MailSender.config(settings.getObjectUseEval(ConfigConsts.EMAIL_CONFIG_OF_SETTINGS));
3738
controllers = ReflectUtils.getClasses(DefaultValues.CONTROLLER_PACKAGE);
3839
tokens = TokenConfig.loadToken();

src/main/java/com/zhazhapan/efo/config/SettingConfig.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,12 @@ public static int[] getAuth(String jsonPath) {
5252
public static String getUploadStoragePath() {
5353
String parent = getStoragePath(ConfigConsts.UPLOAD_PATH_OF_SETTING);
5454
String formatWay = EfoApplication.settings.getStringUseEval(ConfigConsts.UPLOAD_FORM_OF_SETTING);
55-
String path = parent + ValueConsts.SEPARATOR + Formatter.datetimeToCustomString(new Date(), formatWay);
56-
FileExecutor.createFolder(path);
55+
String childPath = ValueConsts.SEPARATOR + Formatter.datetimeToCustomString(new Date(), formatWay);
56+
String path = parent + childPath;
57+
if (!FileExecutor.createFolder(path)) {
58+
path = ConfigConsts.DEFAULT_UPLOAD_PATH + childPath;
59+
FileExecutor.createFolder(path);
60+
}
5761
logger.info("upload path: " + path);
5862
return path;
5963
}

src/main/java/com/zhazhapan/efo/config/TokenConfig.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,20 @@ public static Hashtable<String, Integer> loadToken() {
6161
}
6262
return tokens;
6363
}
64+
65+
public static void removeTokenByValue(int userId) {
66+
if (userId > 0) {
67+
String removeKey = "";
68+
for (String key : EfoApplication.tokens.keySet()) {
69+
if (EfoApplication.tokens.get(key) == userId) {
70+
removeKey = key;
71+
break;
72+
}
73+
}
74+
if (Checker.isNotEmpty(removeKey)) {
75+
EfoApplication.tokens.remove(removeKey);
76+
TokenConfig.saveToken();
77+
}
78+
}
79+
}
6480
}

src/main/java/com/zhazhapan/efo/modules/constant/ConfigConsts.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package com.zhazhapan.efo.modules.constant;
22

3-
import com.zhazhapan.modules.constant.ValueConsts;
4-
53
/**
64
* @author pantao
75
* @since 2018/1/12
@@ -192,8 +190,7 @@ public class ConfigConsts {
192190
/**
193191
* 默认上传路径,如果配置文件中的上传路径无法创建,将使用默认的上传路径
194192
*/
195-
public static final String DEFAULT_UPLOAD_PATH = ValueConsts.USER_HOME + ValueConsts.SEPARATOR + "Desktop" +
196-
ValueConsts.SEPARATOR + "upload";
193+
public static final String DEFAULT_UPLOAD_PATH = DefaultValues.STORAGE_PATH + "upload";
197194

198195
private ConfigConsts() {}
199196
}

src/main/java/com/zhazhapan/efo/service/IUserService.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -110,13 +110,6 @@ public interface IUserService {
110110
*/
111111
void updateUserLoginTime(User user);
112112

113-
/**
114-
* 通知值删除Token
115-
*
116-
* @param userId {@link Integer}
117-
*/
118-
void removeTokenByValue(int userId);
119-
120113
/**
121114
* 更新密码
122115
*

src/main/java/com/zhazhapan/efo/service/impl/DownloadedServiceImpl.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import com.zhazhapan.efo.dao.DownloadedDAO;
44
import com.zhazhapan.efo.model.DownloadRecord;
5-
import com.zhazhapan.efo.model.UploadedRecord;
65
import com.zhazhapan.efo.service.IDownloadedService;
76
import com.zhazhapan.efo.util.ServiceUtils;
87
import org.springframework.beans.factory.annotation.Autowired;

0 commit comments

Comments
 (0)