...
 
Commits (4)
......@@ -23,14 +23,15 @@ public class FileCleanTask {
@Autowired
private SystemFile systemFile;
private final long month = 31 * 24 * 60 * 60 * 1000;
private final long halfYear = 6L * 31 * 24 * 60 * 60 * 1000;
@Scheduled(cron = "0 0 0 1 * ? ")
public void cleanFile() {
File[] files = systemFile.getWwwDir().listFiles();
for (File file : files) {
if ((System.currentTimeMillis() - file.lastModified()) > month) {
logger.warn("开始清理过期文件[{}] 创建时间[{}]",file,DateFormatUtils.format(new Date(file.lastModified()),"yyyy-MM-dd HH:mm:ss"));
if ((System.currentTimeMillis() - file.lastModified()) > halfYear) {
logger.warn("开始清理过期文件[{}] 创建时间[{}]", file, DateFormatUtils.format(file.lastModified(), "yyyy-MM-dd HH:mm:ss"));
systemFile.cleanFile(file.getName());
}
}
......
......@@ -6,4 +6,4 @@ RUN /bin/cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shang
RUN mkdir /home/logs/
VOLUME ["/home/java/logs"]
ADD $APP_NAME $APP_NAME
CMD java -Xmx320m -Xms80m -jar $APP_NAME
\ No newline at end of file
CMD java -Xmx120m -Xms80m -jar $APP_NAME
\ No newline at end of file
spring.application.name=site-server
server.port=51420
server.port=8080
spring.servlet.multipart.max-file-size=256MB
workspace=${user.home}/.site-server
server.servlet.session.timeout=24h
\ No newline at end of file
......@@ -35,7 +35,7 @@
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>1.3.9-SNAPSHOT</version>
<version>1.3.9.1-RELEASE</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
......
......@@ -3,6 +3,7 @@ package cn.yunmaozj.upload;
import org.apache.maven.plugins.annotations.Parameter;
import java.io.File;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
......@@ -25,5 +26,11 @@ public class Directories {
this.directories.add(file);
}
@Override
public String toString() {
final StringBuilder sb = new StringBuilder("Directories{");
sb.append("directories=").append(Arrays.toString(directories.toArray()));
sb.append('}');
return sb.toString();
}
}
......@@ -31,4 +31,13 @@ public class Directory {
public void setPath(File path) {
this.path = path;
}
@Override
public String toString() {
final StringBuilder sb = new StringBuilder("Directory{");
sb.append("name='").append(name).append('\'');
sb.append(", path=").append(path);
sb.append('}');
return sb.toString();
}
}
......@@ -75,6 +75,7 @@ public class DocumentUploadMojo extends AbstractMojo {
getLog().info("skip document-upload");
return;
}
getLog().info(directories.toString());
for (Directory directory : directories.getFileList()) {
File inputDirectory = directory.getPath();
if (!inputDirectory.exists()) {
......@@ -129,6 +130,7 @@ public class DocumentUploadMojo extends AbstractMojo {
.post(body).build();
Response response = getClient().newCall(request).execute();
getLog().info("Uploading file:[" + outFile + "] to [" + request.url() + "]");
getLog().info(response.toString());
if (!response.isSuccessful())
getLog().info("Response Body[" + response.body().string() + "]");
}
......
......@@ -6,7 +6,7 @@
<parent>
<groupId>cn.yunmaozj</groupId>
<artifactId>yunmaozj-parent</artifactId>
<version>1.0.0.13</version>
<version>1.0.0.14</version>
</parent>
<groupId>cn.yunmaozj.tools</groupId>
......