diff --git a/src/main/java/com/fjy/spring/controller/DataController.java b/src/main/java/com/fjy/spring/controller/DataController.java index 0574de6..0ad029f 100644 --- a/src/main/java/com/fjy/spring/controller/DataController.java +++ b/src/main/java/com/fjy/spring/controller/DataController.java @@ -1,12 +1,15 @@ package com.fjy.spring.controller; +import com.fjy.spring.domain.VFeedBack; +import com.fjy.spring.domain.VLog; import com.fjy.spring.domain.VWorkDetail; import com.fjy.spring.enums.ResultEnum; import com.fjy.spring.exception.UserException; +import com.fjy.spring.service.FeedBackService; +import com.fjy.spring.service.LogService; import com.fjy.spring.service.WorkDetailService; 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.RestController; import java.util.List; @@ -17,6 +20,12 @@ public class DataController { @Autowired private WorkDetailService workDetailService; + @Autowired + private LogService logService; + + @Autowired + private FeedBackService feedBackService; + @GetMapping("/home/findAllHomework") public List findAllHomework(){ List homeworks = workDetailService.findAll(); @@ -26,4 +35,24 @@ public class DataController { new UserException(ResultEnum.EMPTY_DATA); return null; } + + @GetMapping("/home/findvlog") + public List findlog(){ + List vlogs = logService.findvlog(); + if (vlogs!=null){ + return vlogs; + } + new UserException(ResultEnum.EMPTY_DATA); + return null; + } + + @GetMapping("/home/findvfeedback") + public List findAllVFeedback(){ + List feedBacks = feedBackService.findAllVFeedback(); + if (feedBacks!=null){ + return feedBacks; + } + new UserException(ResultEnum.EMPTY_DATA); + return null; + } } diff --git a/src/main/java/com/fjy/spring/controller/NavController.java b/src/main/java/com/fjy/spring/controller/NavController.java index 9234d86..b587802 100644 --- a/src/main/java/com/fjy/spring/controller/NavController.java +++ b/src/main/java/com/fjy/spring/controller/NavController.java @@ -35,6 +35,11 @@ public class NavController { return "/home/about"; } + @GetMapping(value = {"/admin"}) + public String toAdminPage(){ + return "/home/admin"; + } + @GetMapping(value = {"/home/user"}) public String toUserPage(){ return "/home/user"; diff --git a/src/main/java/com/fjy/spring/domain/VFeedBack.java b/src/main/java/com/fjy/spring/domain/VFeedBack.java new file mode 100644 index 0000000..5ad8f36 --- /dev/null +++ b/src/main/java/com/fjy/spring/domain/VFeedBack.java @@ -0,0 +1,56 @@ +package com.fjy.spring.domain; + +import org.hibernate.annotations.Immutable; +import org.hibernate.annotations.Subselect; + +import javax.persistence.*; + +@Entity +@Immutable +@Subselect("SELECT * FROM v_feedback") +public class VFeedBack { + @Id + @Column(name = "feedbackid") + private Integer id; + + @Column(name = "colname") + private String username; + + @Column(name = "feedbackcontent") + private String content; + + @Column(name = "issuetime") + private String time; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + + public String getTime() { + return time; + } + + public void setTime(String time) { + this.time = time; + } +} diff --git a/src/main/java/com/fjy/spring/domain/VLog.java b/src/main/java/com/fjy/spring/domain/VLog.java new file mode 100644 index 0000000..4c1f1d2 --- /dev/null +++ b/src/main/java/com/fjy/spring/domain/VLog.java @@ -0,0 +1,62 @@ +package com.fjy.spring.domain; + +import org.hibernate.annotations.Immutable; +import org.hibernate.annotations.Subselect; + +import javax.persistence.*; + +@Entity +@Immutable +@Subselect("SELECT *FROM v_log LIMIT 0, 20") +public class VLog { + @Id + private Integer logid; + + private String colname; + + private String coltime; + + private String colip; + + private String colheader; + + public Integer getLogid() { + return logid; + } + + public void setLogid(Integer logid) { + this.logid = logid; + } + + public String getColname() { + return colname; + } + + public void setColname(String colname) { + this.colname = colname; + } + + public String getColtime() { + return coltime; + } + + public void setColtime(String coltime) { + this.coltime = coltime; + } + + public String getColip() { + return colip; + } + + public void setColip(String colip) { + this.colip = colip; + } + + public String getColheader() { + return colheader; + } + + public void setColheader(String colheader) { + this.colheader = colheader; + } +} diff --git a/src/main/java/com/fjy/spring/interceptor/WebAppConfig.java b/src/main/java/com/fjy/spring/interceptor/WebAppConfig.java index f3f3ad8..bd31d1c 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/VFeedBackRepository.java b/src/main/java/com/fjy/spring/repository/VFeedBackRepository.java new file mode 100644 index 0000000..bc8c669 --- /dev/null +++ b/src/main/java/com/fjy/spring/repository/VFeedBackRepository.java @@ -0,0 +1,9 @@ +package com.fjy.spring.repository; + + +import com.fjy.spring.domain.VFeedBack; +import org.springframework.data.jpa.repository.JpaRepository; + + +public interface VFeedBackRepository extends JpaRepository { +} diff --git a/src/main/java/com/fjy/spring/repository/VLogRepository.java b/src/main/java/com/fjy/spring/repository/VLogRepository.java new file mode 100644 index 0000000..f63c777 --- /dev/null +++ b/src/main/java/com/fjy/spring/repository/VLogRepository.java @@ -0,0 +1,8 @@ +package com.fjy.spring.repository; + + +import com.fjy.spring.domain.VLog; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface VLogRepository extends JpaRepository { +} diff --git a/src/main/java/com/fjy/spring/service/FeedBackService.java b/src/main/java/com/fjy/spring/service/FeedBackService.java index 19891e6..5db8401 100644 --- a/src/main/java/com/fjy/spring/service/FeedBackService.java +++ b/src/main/java/com/fjy/spring/service/FeedBackService.java @@ -1,17 +1,24 @@ package com.fjy.spring.service; import com.fjy.spring.domain.TbFeedBack; +import com.fjy.spring.domain.VFeedBack; import com.fjy.spring.enums.ResultEnum; import com.fjy.spring.exception.UserException; import com.fjy.spring.repository.TbFeedBackRepository; +import com.fjy.spring.repository.VFeedBackRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.List; + @Service public class FeedBackService { @Autowired TbFeedBackRepository feedBackRepository; + @Autowired + VFeedBackRepository vFeedBackRepository; + public boolean addContent(TbFeedBack feedBack){ TbFeedBack feed=feedBackRepository.save(feedBack); if (feed!=null){ @@ -20,4 +27,8 @@ public class FeedBackService { new UserException(ResultEnum.ADD_ERROR); return false; } + + public List findAllVFeedback(){ + return vFeedBackRepository.findAll(); + } } diff --git a/src/main/java/com/fjy/spring/service/LogService.java b/src/main/java/com/fjy/spring/service/LogService.java index f838fe9..327eeec 100644 --- a/src/main/java/com/fjy/spring/service/LogService.java +++ b/src/main/java/com/fjy/spring/service/LogService.java @@ -1,16 +1,27 @@ package com.fjy.spring.service; import com.fjy.spring.domain.TbLog; +import com.fjy.spring.domain.VLog; import com.fjy.spring.repository.TbLogRepository; +import com.fjy.spring.repository.VLogRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.List; + @Service public class LogService { @Autowired private TbLogRepository tbLogRepository; + @Autowired + private VLogRepository vLogRepository; + public void addLogRec(TbLog tbLog){ tbLogRepository.save(tbLog); } + + public List findvlog(){ + return vLogRepository.findAll(); + } } diff --git a/src/main/resources/static/js/admin.js b/src/main/resources/static/js/admin.js index 8525bda..a90f715 100644 --- a/src/main/resources/static/js/admin.js +++ b/src/main/resources/static/js/admin.js @@ -7,45 +7,70 @@ var Main = { }, feedbackData:[ { - content:'bug', - time:'2018-2-3', - username:'root' + id: 68, + username: "root", + content: "Fred", + time: "2018-02-08 10:14:11" + }, + { + id: 71, + username: "root", + content: "1234214", + time: "2018-02-08 10:30:38" + }, + { + id: 72, + username: "root", + content: "afsdas", + time: "2018-02-08 10:31:22" + }, + { + id: 73, + username: "root", + content: "反馈", + time: "2018-02-08 10:35:18" } ], logData:[ { - ip:'127.0.0.1', - header:'bug', - time:'2018-2-3', - username:'root' + logid: 55, + colname: "root", + coltime: "2018-02-06 11:35:56.0", + colip: "0:0:0:0:0:0:0:1", + colheader: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36" }, { - ip:'127.0.0.1', - header:'bug', - time:'2018-2-3', - username:'root' - }, - { - ip:'127.0.0.1', - header:'bug', - time:'2018-2-3', - username:'root' - }, - { - ip:'127.0.0.1', - header:'bug', - time:'2018-2-3', - username:'root' - }, - { - ip:'127.0.0.1', - header:'bug', - time:'2018-2-3', - username:'root' + logid: 58, + colname: "root", + coltime: "2018-02-06 11:40:41.0", + colip: "0:0:0:0:0:0:0:1", + colheader: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36" } - ], + ] } }, + mounted() { + this.$nextTick(() => { + var that = this; + axios.get('http://localhost:8080/cms/home/findvlog') + .then(function (response) { + console.log(response.data); + that.logData = response.data; + }) + .catch(function (error) { + console.log(error); + }); + axios.get('http://localhost:8080/cms/home/findvfeedback') + .then(function (response) { + console.log(response.data); + that.feedbackData = response.data; + //that.limitTime = response.data; + }) + .catch(function (error) { + console.log(error); + }); + }) + }, methods: { ClickToJump(targe){ window.location.href="http://localhost:8080/cms/" + targe; diff --git a/src/main/resources/static/js/user.js b/src/main/resources/static/js/user.js new file mode 100644 index 0000000..b975e57 --- /dev/null +++ b/src/main/resources/static/js/user.js @@ -0,0 +1,125 @@ +var Main = { + data() { + var checkName = (rule, value, callback) => { + if (!value) { + return callback(new Error('用户名不能为空')); + } + }; + var checkNo = (rule, value, callback) => { + if (!value) { + return callback(new Error('学号不能为空')); + } + }; + var checkRealName = (rule, value, callback) => { + if (!value) { + return callback(new Error('真实姓名不能为空')); + } + }; + var validatePass = (rule, value, callback) => { + if (value === '') { + callback(new Error('请输入密码')); + } else { + if (this.ruleForm2.checkPass !== '') { + this.$refs.ruleForm2.validateField('checkPass'); + } + callback(); + } + }; + var validatePass2 = (rule, value, callback) => { + if (value === '') { + callback(new Error('请再次输入密码')); + } else if (value !== this.ruleForm2.colpassword) { + callback(new Error('两次输入密码不一致!')); + } else { + callback(); + } + }; + return { + activeIndex: '1', + ruleForm2: { + colname: '', + colpassword: '', + checkPass:'', + colstudentno: '', + colrealname: '', + colemail: '' + }, + rules2: { + colpassword: [ + {required: true,validator: validatePass, trigger: 'blur'} + ], + checkPass: [ + {required: true,validator: validatePass2, trigger: 'blur'} + ], + colstudentno: [ + { + required: true, + validator: checkNo, + trigger: 'blur' + } + ], + colrealname: [ + { + required: true, + validator: checkRealName, + trigger: 'blur' + } + ], + colname: [ + {required: true,validator: checkName, trigger: 'blur'} + ], + }, + tableHomeworkData: [ + { + workid: 1, + colfileid: 56, + workname: "实验报告", + worktime: "2018-02-06 20:44:08.0", + colfilename: "2018 服务器装机.xlsx", + coursename: "信息安全", + workremark: "3000字以上", + workfolder: "第一次作业" + }, + { + workid: 1, + colfileid: 56, + workname: "实验报告2", + worktime: "2018-02-08 20:44:08.0", + colfilename: "2018 服务器装机.xlsx", + coursename: "决策支持系统", + workremark: "3000字以上", + workfolder: "第一次作业" + } + ], + } + }, + methods: { + submitForm(formName) { + this.$refs[formName].validate((valid) => { + if (valid) { + alert('submit!'); + } else { + console.log('error submit!!'); + return false; + } + }); + }, + resetForm(formName) { + this.$refs[formName].resetFields(); + }, + handleClick(tab, event) { + console.log(tab, event); + }, + ClickToJump(targe){ + window.location.href="http://localhost:8080/cms/" + targe; + }, + handleSelect(key, keyPath) { + console.log(key, keyPath); + }, + onSubmit() { + console.log('submit!'); + } + } +} +var Ctor = Vue.extend(Main) +new Ctor().$mount('#app') \ No newline at end of file diff --git a/src/main/resources/templates/home/admin.html b/src/main/resources/templates/home/admin.html index 1df2fd1..513d1df 100644 --- a/src/main/resources/templates/home/admin.html +++ b/src/main/resources/templates/home/admin.html @@ -1,57 +1,19 @@ - - - - - 后台 - - - - + + + - - - - - +
- - - 首页 - - - 选项1 - 选项2 - 选项3 - - 关于 - 意见反馈 - 登出 - - + - -
- 用户名
- 学号 -
-
- 首页 -
- 个人中心 -
- 关于 -
- 意见反馈 -
-
+
@@ -87,13 +49,13 @@ 近期登陆日志
@@ -108,7 +70,7 @@ 用户反馈
- @@ -124,15 +86,11 @@ - - - +
- - + + diff --git a/src/main/resources/templates/home/home.html b/src/main/resources/templates/home/home.html index 048dab5..156a382 100644 --- a/src/main/resources/templates/home/home.html +++ b/src/main/resources/templates/home/home.html @@ -263,7 +263,6 @@ 功能未完成
- @@ -274,16 +273,8 @@ - -
- + @@ -309,10 +300,7 @@ - - + diff --git a/src/main/resources/templates/home/user.html b/src/main/resources/templates/home/user.html new file mode 100644 index 0000000..5d84e99 --- /dev/null +++ b/src/main/resources/templates/home/user.html @@ -0,0 +1,154 @@ + + + + + 个人中心 + + + + + + + + + + + + +
+ + + + + 首页 + + + 选项1 + 选项2 + 选项3 + + 关于 + 意见反馈 + 登出 + + + + + + +
+ 用户名
+ 学号 +
+
+ 首页 +
+ 个人中心 +
+ 关于 +
+ 意见反馈 +
+
+
+
+ + +

修改信息

+ + + + + + + + + + + + + + + + + + + + + 提交 + + 重置 + + +
+
+ + + +
+ +
+ 作业提交倒计时 + 功能未完成 +
+
+ + + + + + + +
+
+
+
+
+ + +
+ 公告 +
+
+ {{'公告内容 ' + o }} +
+
+
+
+
+ + + +
+
+
+ + + +