diff --git a/pom.xml b/pom.xml
index ca95f9c..2eff17b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -60,6 +60,7 @@
org.apache.ant
ant
+ 1.10.2
diff --git a/src/main/java/com/fjy/spring/controller/DataController.java b/src/main/java/com/fjy/spring/controller/DataController.java
index 6282973..a49d5c2 100644
--- a/src/main/java/com/fjy/spring/controller/DataController.java
+++ b/src/main/java/com/fjy/spring/controller/DataController.java
@@ -7,14 +7,13 @@ import com.fjy.spring.service.*;
import com.fjy.spring.untils.CodingUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
import java.util.Optional;
@@ -51,6 +50,9 @@ public class DataController {
@Autowired
private NoticeService noticeService;
+ @Autowired
+ private VersionService versionService;
+
@Resource
private HttpServletRequest httpServletRequest;
@@ -180,4 +182,20 @@ public class DataController {
public List findAllNotice(){
return noticeService.findAll();
}
+
+ @PostMapping("/home/admin/addoneversion")
+ public boolean addOneVersion(TbVersion version){
+ log.info(version.toString());
+ return versionService.addOneVersion(version)!=null;
+ }
+
+ @PostMapping("/home/admin/addversion")
+ public boolean addVersion(@RequestBody List versions){
+ return versionService.addAllVersion(versions)!=null;
+ }
+
+ @GetMapping("/home/findallversion")
+ public List findAllVersion(){
+ return versionService.findAll();
+ }
}
diff --git a/src/main/java/com/fjy/spring/controller/DeleteController.java b/src/main/java/com/fjy/spring/controller/DeleteController.java
index 5bc5930..4f68c80 100644
--- a/src/main/java/com/fjy/spring/controller/DeleteController.java
+++ b/src/main/java/com/fjy/spring/controller/DeleteController.java
@@ -33,20 +33,25 @@ public class DeleteController {
*/
@RequestMapping("/home/filedelete")
@ResponseBody
- public void delete(@RequestParam(value = "fileid") Integer fileid)throws Exception {
+ public boolean delete(@RequestParam(value = "fileid") Integer fileid)throws Exception {
TbFile tbFile = new TbFile();
tbFile.setColfileid(fileid);
TbFile resfile = fileService.findFileById(tbFile);
File filepath = new File(resfile.getColfilepath());
if (!filepath.exists()) {
log.error("删除文件失败:" + resfile.getColfilename() + "不存在!");
+ return false;
} else {
if (filepath.isFile()){
deleteFile(resfile.getColfilepath(),resfile.getColfileid());
- new UserException(ResultEnum.SUCCESS);
+ return true;
}
- else
+ else{
deleteDirectory(resfile.getColfilepath());
+ return true;
+ }
+
+
}
}
diff --git a/src/main/java/com/fjy/spring/controller/FeedBackController.java b/src/main/java/com/fjy/spring/controller/FeedBackController.java
index 7852056..1944674 100644
--- a/src/main/java/com/fjy/spring/controller/FeedBackController.java
+++ b/src/main/java/com/fjy/spring/controller/FeedBackController.java
@@ -33,7 +33,7 @@ public class FeedBackController {
HttpServletRequest request;
@PostMapping("/home/dofeedback")
- public void doFeedBack(@RequestParam(value = "content") String content){
+ public boolean doFeedBack(@RequestParam(value = "content") String content){
Date date = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String dateNowStr = sdf.format(date);
@@ -45,7 +45,9 @@ public class FeedBackController {
RedirectUtil red = new RedirectUtil();
if (feedBackService.addContent(feedBack)){
log.info("反馈信息写入数据库成功");
+ return true;
}
+ return false;
}
}
diff --git a/src/main/java/com/fjy/spring/controller/NavController.java b/src/main/java/com/fjy/spring/controller/NavController.java
index 3dec5cc..8ffd43a 100644
--- a/src/main/java/com/fjy/spring/controller/NavController.java
+++ b/src/main/java/com/fjy/spring/controller/NavController.java
@@ -29,7 +29,7 @@ public class NavController {
@GetMapping(value = {"/home"})
public String toHomePage(){
- return "/home/home";
+ return "home/home";
}
@GetMapping(value = {"/logout"})
@@ -41,41 +41,41 @@ public class NavController {
@GetMapping(value = {"/home/feedback"})
public String toFeedbackPage(){
- return "/home/feedback";
+ return "home/feedback";
}
@GetMapping(value = {"/home/about"})
public String toAboutPage(){
- return "/home/about";
+ return "home/about";
}
@GetMapping(value = {"/home/admin"})
public String toAdminPage(){
- return "/home/admin";
+ return "home/admin";
}
@GetMapping(value = {"/home/managecourse"})
public String toManageCoursePage(){
- return "/home/managecourse";
+ return "home/managecourse";
}
@GetMapping(value = {"/home/manageuser"})
public String toManageUserPage(){
- return "/home/manageuser";
+ return "home/manageuser";
}
@GetMapping(value = {"/home/homework"})
public String toHomeworkPage(){
- return "/home/homework";
+ return "home/homework";
}
@GetMapping(value = {"/home/user"})
public String toUserPage(){
- return "/home/user";
+ return "home/user";
}
@GetMapping(value = {"/error"})
public String toErrorPage(){
- return "/error";
+ return "error";
}
}
diff --git a/src/main/java/com/fjy/spring/controller/UpLoadController.java b/src/main/java/com/fjy/spring/controller/UpLoadController.java
index c05801e..9077153 100644
--- a/src/main/java/com/fjy/spring/controller/UpLoadController.java
+++ b/src/main/java/com/fjy/spring/controller/UpLoadController.java
@@ -42,16 +42,6 @@ public class UpLoadController {
@Resource
HttpServletRequest httpServletRequest;
- @GetMapping("/toOneUpload")
- public String toOneUpload() {
- return "oneUpload";
- }
-
- @GetMapping("/toMoreUpload")
- public String toMoreUpload() {
- return "moreUpload";
- }
-
/**
* 测试文件上传路径地址
*
diff --git a/src/main/java/com/fjy/spring/domain/TbVersion.java b/src/main/java/com/fjy/spring/domain/TbVersion.java
new file mode 100644
index 0000000..d90d3b3
--- /dev/null
+++ b/src/main/java/com/fjy/spring/domain/TbVersion.java
@@ -0,0 +1,27 @@
+package com.fjy.spring.domain;
+
+import lombok.Data;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+
+@Entity
+@Data
+public class TbVersion {
+ @Id
+ @GeneratedValue
+ private Integer versionid;
+
+ private String date;
+
+ private String content;
+
+ private String version;
+
+ private String user;
+
+ public TbVersion() {
+ super();
+ }
+}
diff --git a/src/main/java/com/fjy/spring/interceptor/WebAppConfig.java b/src/main/java/com/fjy/spring/interceptor/WebAppConfig.java
index 5c000e8..5d20a5e 100644
--- a/src/main/java/com/fjy/spring/interceptor/WebAppConfig.java
+++ b/src/main/java/com/fjy/spring/interceptor/WebAppConfig.java
@@ -6,7 +6,7 @@ import org.springframework.web.servlet.config.annotation.PathMatchConfigurer;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
-/*@Configuration*/
+@Configuration
public class WebAppConfig implements WebMvcConfigurer {
/**
diff --git a/src/main/java/com/fjy/spring/repository/TbVersionRepository.java b/src/main/java/com/fjy/spring/repository/TbVersionRepository.java
new file mode 100644
index 0000000..e475f25
--- /dev/null
+++ b/src/main/java/com/fjy/spring/repository/TbVersionRepository.java
@@ -0,0 +1,8 @@
+package com.fjy.spring.repository;
+
+import com.fjy.spring.domain.TbVersion;
+import org.springframework.data.jpa.repository.JpaRepository;
+
+public interface TbVersionRepository extends JpaRepository {
+
+}
diff --git a/src/main/java/com/fjy/spring/service/VersionService.java b/src/main/java/com/fjy/spring/service/VersionService.java
new file mode 100644
index 0000000..0289882
--- /dev/null
+++ b/src/main/java/com/fjy/spring/service/VersionService.java
@@ -0,0 +1,27 @@
+package com.fjy.spring.service;
+
+import com.fjy.spring.domain.TbVersion;
+import com.fjy.spring.repository.TbVersionRepository;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class VersionService {
+
+ @Autowired
+ private TbVersionRepository versionRepository;
+
+ public TbVersion addOneVersion(TbVersion tbVersion){
+ return versionRepository.save(tbVersion);
+ }
+
+ public List addAllVersion(List versions){
+ return versionRepository.saveAll(versions);
+ }
+
+ public List findAll(){
+ return versionRepository.findAll();
+ }
+}
diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml
index 5f4f096..e4cc4bb 100644
--- a/src/main/resources/application-dev.yml
+++ b/src/main/resources/application-dev.yml
@@ -22,6 +22,12 @@ spring:
hibernate:
ddl-auto: update
show-sql: true
+ servlet:
+ multipart:
+ max-file-size: 100Mb
+ max-request-size: 100Mb
+
+
#resources:
# static-locations: classpath:/templates/
debug: true
diff --git a/src/main/resources/application-prod.yml b/src/main/resources/application-prod.yml
index e69de29..49bdd44 100644
--- a/src/main/resources/application-prod.yml
+++ b/src/main/resources/application-prod.yml
@@ -0,0 +1,33 @@
+#运行环境配置文件
+server:
+ servlet:
+ context-path: /cms
+ port: 8081
+serverproperties:
+ port_num: 8081
+ filePath: /www/cmsfile/
+spring:
+ thymeleaf:
+ prefix: classpath:/templates/
+ cache: false
+ check-template: true
+
+ datasource:
+ driver-class-name: com.mysql.jdbc.Driver
+ url: jdbc:mysql://127.0.0.1:3306/db_imis2?useUnicode=true&characterEncoding=utf-8&useSSL=true
+ username: imis2
+ password: 2015imis2
+
+ servlet:
+ multipart:
+ max-file-size: 100Mb
+ max-request-size: 100Mb
+
+ jpa:
+ hibernate:
+ ddl-auto: update
+ show-sql: false
+ #resources:
+ # static-locations: classpath:/templates/
+debug: false
+
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
index 9efaa1c..7ef289a 100644
--- a/src/main/resources/application.yml
+++ b/src/main/resources/application.yml
@@ -1,4 +1,4 @@
#控制配置文件调用
spring:
profiles:
- active: dev
\ No newline at end of file
+ active: prod
\ No newline at end of file
diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml
index 81d90ce..272ad8e 100644
--- a/src/main/resources/logback-spring.xml
+++ b/src/main/resources/logback-spring.xml
@@ -25,7 +25,8 @@
- F:\JAVA Workspace\Temp\log\info.%d.log
+
+ /www/cmsfile/%d/info.%d.log
@@ -43,7 +44,8 @@
- F:\JAVA Workspace\Temp\log\error.%d.log
+
+ /www/cmsfile/%d/error.%d.log
diff --git a/src/main/resources/static/js/homePage.js b/src/main/resources/static/js/homepage.js
similarity index 59%
rename from src/main/resources/static/js/homePage.js
rename to src/main/resources/static/js/homepage.js
index a988c7f..f0672b2 100644
--- a/src/main/resources/static/js/homePage.js
+++ b/src/main/resources/static/js/homepage.js
@@ -108,210 +108,6 @@ var Main = {
}
],
VersionList:[
- {
- date:'2018-02-24',
- content:'实现对重复文件自动重命名',
- version:'V1.11',
- user:'F嘉阳'
- },
- {
- date:'2018-02-24',
- content:'实现对文件是否重命名的控制,目前设定为管理员上传的文件不会重命名,完善日志输出存储',
- version:'V1.10',
- user:'F嘉阳'
- },
- {
- date:'2018-02-24',
- content:'添加运行日志处理,频率为每天对error和info级别的日志进行文件保存,实现判断注册用户名是否已存在',
- version:'V1.9.1',
- user:'F嘉阳'
- },
- {
- date:'2018-02-24',
- content:'实现前端对学号和用户名的异步判断,核心技术为axios',
- version:'V1.9',
- user:'F嘉阳'
- },
- {
- date:'2018-02-24',
- content:'修复注册表单输入正确不会显示反馈图标的问题',
- version:'V1.8.2',
- user:'F嘉阳'
- },
- {
- date:'2018-02-24',
- content:'修复文件批量下载的错误,为压缩文件进行统一管理,批量下载不支持多线程',
- version:'V1.8.1',
- user:'F嘉阳'
- },
- {
- date:'2018-02-24',
- content:'实现文件批量下载',
- version:'V1.8',
- user:'F嘉阳'
- },
- {
- date:'2018-02-23',
- content:'实现对未交作业人员的查询和展示',
- version:'V1.7',
- user:'F嘉阳'
- },
- {
- date:'2018-02-23',
- content:'去除js对绝对地址的依赖,为日志添加排序选项',
- version:'V1.6.1',
- user:'F嘉阳'
- },
- {
- date:'2018-02-23',
- content:'实现用户仅能查看自己提交的文件',
- version:'V1.6',
- user:'F嘉阳'
- },
- {
- date:'2018-02-23',
- content:'修复用户信息修改页面数据绑定方式,改为使用axios进行数据获取和绑定',
- version:'V1.5',
- user:'F嘉阳'
- },
- {
- date:'2018-02-22',
- content:'实现后台对未交作业人员的查询',
- version:'V1.4',
- user:'F嘉阳'
- },
- {
- date:'2018-02-22',
- content:'实现用户信息修改',
- version:'V1.3.1',
- user:'F嘉阳'
- },
- {
- date:'2018-02-21',
- content:'实现用户信息修改页面session传值',
- version:'V1.3',
- user:'F嘉阳'
- },
- {
- date:'2018-02-09',
- content:'实现用户管理和作业管理数据读取',
- version:'V1.2.1',
- user:'F嘉阳'
- },
- {
- date:'2018-02-09',
- content:'实现单文件删除',
- version:'V1.2',
- user:'F嘉阳'
- },
- {
- date:'2018-02-08',
- content:'完成课程管理数据读取,修复页面加载css,js错误',
- version:'V1.1.2',
- user:'F嘉阳'
- },
- {
- date:'2018-02-08',
- content:'完成管理员主页的数据读取',
- version:'V1.1.1',
- user:'F嘉阳'
- },
- {
- date:'2018-02-08',
- content:'完成前端界面设计',
- version:'V1.0',
- user:'F嘉阳'
- },
- {
- date:'2018-02-08',
- content:'实现表单异步提交并显示消息',
- version:'V0.15',
- user:'F嘉阳'
- },
- {
- date:'2018-02-07',
- content:'实现作业上传自动创建文件夹',
- version:'V0.14',
- user:'F嘉阳'
- },
- {
- date:'2018-02-07',
- content:'实现作业获取和展示',
- version:'V0.13',
- user:'F嘉阳'
- },
- {
- date:'2018-02-06',
- content:'完成前端上传页面设计',
- version:'V0.12',
- user:'F嘉阳'
- },
- {
- date:'2018-02-06',
- content:'实现登录日志记录',
- version:'V0.11',
- user:'F嘉阳'
- },
- {
- date:'2018-02-05',
- content:'提高加密安全性',
- version:'V0.10.1',
- user:'F嘉阳'
- },
- {
- date:'2018-02-05',
- content:'实现用户密码SHA加密',
- version:'V0.10',
- user:'F嘉阳'
- },
- {
- date:'2018-02-05',
- content:'实现登录拦截器',
- version:'V0.9',
- user:'F嘉阳'
- },
- {
- date:'2018-02-05',
- content:'实现注册功能',
- version:'V0.8',
- user:'F嘉阳'
- },
- {
- date:'2018-02-05',
- content:'实现json数据绑定',
- version:'V0.7',
- user:'F嘉阳'
- },
- {
- date:'2018-02-04',
- content:'实现多文件上传,按钮vue传值(vue2.1特性)',
- version:'V0.6',
- user:'F嘉阳'
- },
- {
- date:'2018-02-04',
- content:'实现Element组件+单文件上传',
- version:'V0.5',
- user:'F嘉阳'
- },
- {
- date:'2018-02-04',
- content:'使用thymeleaf模板引擎,引入frame框架和公用css和js文件',
- version:'V0.4',
- user:'F嘉阳'
- },
- {
- date:'2018-02-03',
- content:'实现文件上传和数据库记录、Element+vue登录注册UI',
- version:'V0.3',
- user:'F嘉阳'
- },
- {
- date:'2018-01-30',
- content:'实现登录,编写错误码,实现错误码返回json',
- version:'V0.2',
- user:'F嘉阳'
- },
{
date:'2018-01-30',
content:'实现数据库查询用户,获取密码,编写了单元测试类',
@@ -394,6 +190,15 @@ var Main = {
.catch(function (error) {
console.log(error);
});
+ axios.get(getRootPath_web()+'/home/findallversion')
+ .then(function (response) {
+ console.log(response.data);
+ that.VersionList = response.data;
+ //that.limitTime = response.data;
+ })
+ .catch(function (error) {
+ console.log(error);
+ });
})
},
methods: {
@@ -404,6 +209,12 @@ var Main = {
type: 'success'
});
},
+ openNotiError(title, content) {
+ this.$notify.error({
+ title: title,
+ message: content
+ });
+ },
openSuccess(content) {
this.$message({
message: content,
@@ -418,6 +229,7 @@ var Main = {
},
submitForm(formName, url) {
this.$refs[formName].validate((valid) => {
+ let that = this;
if (valid) {
axios({
url: getRootPath_web()+'/' + url,
@@ -436,9 +248,22 @@ var Main = {
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
- })
- console.log(this.$refs.content.value)
- this.openNotiSuccess("成功", "反馈成功!")
+ }).then(function (response) {
+ console.log(response.data);
+ if (response.data===true){
+ //that.$refs[formName].submit;
+ //return true;
+ that.openNotiSuccess("成功", "反馈成功!")
+ }else if (response.data===false){
+ that.openNotiError("失败", "反馈失败!");
+ }else {
+ that.openNotiError("错误", response.data.message);
+ }
+ }).catch(function (error) {
+ console.log(error);
+ that.openNotiError("错误", "服务器错误!");
+ });
+ //console.log(this.$refs.content.value)
//this.$options.methods.openNotiSuccess.bind(this)();
//alert('submit!');
} else {
@@ -467,6 +292,7 @@ var Main = {
window.open(getRootPath_web()+"/download/dodownload?fileId=" + row.colfileid);
},
handleDelete(row) {
+ let that = this;
axios({
url: getRootPath_web()+'/home/filedelete',
method: 'post',
@@ -484,8 +310,21 @@ var Main = {
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
+ }).then(function (response) {
+ console.log(response.data);
+ if (response.data===true){
+ //that.$refs[formName].submit;
+ //return true;
+ that.openNotiSuccess("成功", "删除成功!")
+ }else if (response.data===false){
+ that.openNotiError("失败", "删除失败!");
+ }else {
+ that.openNotiError("错误", response.data.message);
+ }
+ }).catch(function (error) {
+ console.log(error);
+ that.openNotiError("错误", "服务器错误!");
});
- this.openNotiSuccess("成功", "删除成功!");
},
handlePreview(file) {
console.log(file);
diff --git a/src/main/resources/static/js/LoginStyle.js b/src/main/resources/static/js/loginstyle.js
similarity index 100%
rename from src/main/resources/static/js/LoginStyle.js
rename to src/main/resources/static/js/loginstyle.js
diff --git a/src/main/resources/templates/home/about.html b/src/main/resources/templates/home/about.html
index 2ccf26b..8f670b4 100644
--- a/src/main/resources/templates/home/about.html
+++ b/src/main/resources/templates/home/about.html
@@ -64,6 +64,6 @@
-
+