diff --git a/src/main/java/com/codesdream/ase/component/error/ErrorResponse.java b/src/main/java/com/codesdream/ase/component/error/ErrorResponse.java index 42d5bbf..0aee4ca 100644 --- a/src/main/java/com/codesdream/ase/component/error/ErrorResponse.java +++ b/src/main/java/com/codesdream/ase/component/error/ErrorResponse.java @@ -1,5 +1,7 @@ package com.codesdream.ase.component.error; +import lombok.Data; + import javax.xml.bind.annotation.XmlRootElement; import java.util.List; diff --git a/src/main/java/com/codesdream/ase/configure/CustomWebSecurityConfig.java b/src/main/java/com/codesdream/ase/configure/CustomWebSecurityConfig.java index 32dd966..597d44f 100644 --- a/src/main/java/com/codesdream/ase/configure/CustomWebSecurityConfig.java +++ b/src/main/java/com/codesdream/ase/configure/CustomWebSecurityConfig.java @@ -54,6 +54,6 @@ public class CustomWebSecurityConfig extends WebSecurityConfigurerAdapter { public void configure(WebSecurity web) throws Exception { web .ignoring() - .antMatchers("/assets/**", "/register/**", "/forget/**", "/not_found/**"); + .antMatchers("/assets/**", "/register/**", "/forget/**", "/not_found/**", "/error/**"); } } diff --git a/src/main/java/com/codesdream/ase/controller/ASEErrorController.java b/src/main/java/com/codesdream/ase/controller/ASEErrorController.java index 0fa6b72..6e2b7ba 100644 --- a/src/main/java/com/codesdream/ase/controller/ASEErrorController.java +++ b/src/main/java/com/codesdream/ase/controller/ASEErrorController.java @@ -22,21 +22,33 @@ public class ASEErrorController implements ErrorController { public String handleError(HttpServletRequest request, Model model){ Integer statusCode = (Integer) request.getAttribute("javax.servlet.error.status_code"); Exception exception = (Exception) request.getAttribute("javax.servlet.error.exception"); - - // 页面未找到 - if(statusCode == HttpStatus.NOT_FOUND.value()){ - return "not_found"; + // 无效异常检查 + if(statusCode == null || exception == null){ + model.addAttribute("if_active", false); } - model.addAttribute("http_status", statusCode); - model.addAttribute("exception_name", exception.getClass().getName()); - model.addAttribute("exception_message", exception.getMessage()); - List stack_infos = new ArrayList<>(); - for(StackTraceElement element : exception.getStackTrace()){ - String s = element.toString(); - stack_infos.add(s); + else { + model.addAttribute("if_active", true); + // 页面未找到 + if (statusCode == HttpStatus.NOT_FOUND.value()) { + return "not_found"; + } + model.addAttribute("http_status", statusCode); + // 引发异常检查 + if (exception.getCause() == null) { + model.addAttribute("exception_name", exception.getClass().getName()); + model.addAttribute("exception_message", exception.getMessage()); + } else { + model.addAttribute("exception_name", exception.getCause().getClass().getName()); + model.addAttribute("exception_message", exception.getCause().getMessage()); + } + List stack_infos = new ArrayList<>(); + for (StackTraceElement element : exception.getStackTrace()) { + String s = element.toString(); + stack_infos.add(s); + } + model.addAttribute("error_stack", stack_infos); + model.addAttribute("exception_date", new Date()); } - model.addAttribute("error_stack", stack_infos); - model.addAttribute("exception_date",new Date()); return "error"; } diff --git a/src/main/java/com/codesdream/ase/controller/HomeController.java b/src/main/java/com/codesdream/ase/controller/HomeController.java index 858007b..0d73a79 100644 --- a/src/main/java/com/codesdream/ase/controller/HomeController.java +++ b/src/main/java/com/codesdream/ase/controller/HomeController.java @@ -20,8 +20,16 @@ public class HomeController { User user = userService.findUserByUsername(principal.getName()); // 为视图模板指定参数 model.addAttribute("username", user.getUsername().substring(0, 18)); + model.addAttribute("real_name", user.getUserDetail().getRealName()); + model.addAttribute("sex", user.getUserDetail().getSex()); model.addAttribute("student_id", user.getUserAuth().getStudentID()); + model.addAttribute("class_id", user.getUserDetail().getClassId()); + model.addAttribute("college", user.getUserDetail().getBaseCollege().getName()); + model.addAttribute("ethnic", user.getUserDetail().getBaseEthnic().getName()); + model.addAttribute("major", user.getUserDetail().getBaseMajor().getName()); model.addAttribute("is_at_school", user.getUserDetail().isAtSchool()); + model.addAttribute("ethnic", user.getUserDetail().getBaseEthnic().getName()); + model.addAttribute("mail", user.getUserAuth().getMail()); return "home"; } } diff --git a/src/main/java/com/codesdream/ase/controller/RegisterController.java b/src/main/java/com/codesdream/ase/controller/RegisterController.java index 248abd0..3144d2b 100644 --- a/src/main/java/com/codesdream/ase/controller/RegisterController.java +++ b/src/main/java/com/codesdream/ase/controller/RegisterController.java @@ -1,6 +1,8 @@ package com.codesdream.ase.controller; +import com.codesdream.ase.model.information.BaseStudentInfo; import com.codesdream.ase.model.permission.User; +import com.codesdream.ase.service.BaseInformationService; import com.codesdream.ase.service.UserService; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; @@ -16,6 +18,9 @@ public class RegisterController { @Resource UserService userService; + @Resource + BaseInformationService baseInformationService; + @RequestMapping(value = "/register") String registerView(Model model){ return "register"; @@ -33,10 +38,27 @@ public class RegisterController { && parameterMap.containsKey("user-question") && parameterMap.containsKey("user-answer") ) { - User user = userService.getDefaultUser(); + // 获得提交学号 String student_id = parameterMap.get("student-id")[0].toString(); - // 生成随机用户名 - userService.generateRandomUsernameByStudentID(user, student_id); + // 获得密保问题 + String user_question = parameterMap.get("user-question")[0].toString(); + // 获得密保答案 + String user_answer = parameterMap.get("user-answer")[0].toString(); + + // 检查用户的基本信息是否录入系统 + if(!baseInformationService.checkStudentInfo(student_id)) + throw new RuntimeException("Student ID Not Found In Base Information Service"); + + // 查找对应的基本信息 + BaseStudentInfo studentInfo = baseInformationService.findStudentInfoByStudentId(student_id); + + // 根据基本信息生成对应用户 + User user = userService.getUserByStudentInfo(studentInfo); + + // 填充密保问题 + user.getUserAuth().setUserQuestion(user_question); + user.getUserAuth().setUserAnswer(user_answer); + user.getUserAuth().setMail(""); String password = parameterMap.get("password")[0].toString(); String retry_password = parameterMap.get("retry-password")[0].toString(); diff --git a/src/main/java/com/codesdream/ase/model/permission/UserDetail.java b/src/main/java/com/codesdream/ase/model/permission/UserDetail.java index 7f2e448..42cf013 100644 --- a/src/main/java/com/codesdream/ase/model/permission/UserDetail.java +++ b/src/main/java/com/codesdream/ase/model/permission/UserDetail.java @@ -42,6 +42,9 @@ public class UserDetail { // 真实姓名 private String realName = null; + // 性别 + private String sex = null; + // 在校认证状态 private boolean atSchool = false; } diff --git a/src/main/java/com/codesdream/ase/service/UserService.java b/src/main/java/com/codesdream/ase/service/UserService.java index 394094d..e621b51 100644 --- a/src/main/java/com/codesdream/ase/service/UserService.java +++ b/src/main/java/com/codesdream/ase/service/UserService.java @@ -92,6 +92,17 @@ public class UserService implements IUserService { if(userRepository.findByUsername(user.getUsername()).isPresent()) throw new UsernameAlreadyExistException(user.getUsername()); + // 用户信息一般性规范检查 + if(user.getUserAuth().getUserAnswer() == null + || user.getUserAuth().getUserQuestion() == null + || user.getUserAuth().getStudentID() == null + || user.getUserDetail().getRealName() == null + || user.getUserAuth().getMail() == null){ + + throw new RuntimeException("Key Information IS NULL"); + } + + // 用户信息一般性规范检查 if(user.getUserAuth().getUserAnswer().length() > 255 || user.getUserAuth().getUserQuestion().length() > 255 @@ -144,6 +155,7 @@ public class UserService implements IUserService { user.getUserDetail().setBaseMajor(studentInfo.getMajor()); user.getUserDetail().setBaseEthnic(studentInfo.getEthnic()); user.getUserDetail().setBasePoliticalStatus(studentInfo.getPoliticalStatus()); + user.getUserDetail().setSex(studentInfo.getSex()); // 添加在校学生认证 user.getUserDetail().setAtSchool(true); diff --git a/src/main/resources/templates/error.html b/src/main/resources/templates/error.html index 55690a0..5739e24 100644 --- a/src/main/resources/templates/error.html +++ b/src/main/resources/templates/error.html @@ -14,78 +14,85 @@
- -
-
-
-
- -

  概要信息

-
-
-
- 此次异常的简要信息已被异常管理子系统收集并概括如下表 -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#信息项
0 HTTP状态
1异常类型
2附带消息
2附带消息
-
- -
-
-
-

  运行栈相关信息

-
-
-
    -
  1. - -
  2. -
- -
-
+
+ +
+
+
+
+ +

  概要信息

+
+
+
+ 此次异常的简要信息已被异常管理子系统收集并概括如下表 +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#信息项
0 HTTP状态
1异常类型
2附带消息
2时间
+
+ +
+
+
+

  运行栈相关信息

+
+
+
    +
  1. + +
  2. +
+ +
+
+
+
diff --git a/src/main/resources/templates/home.html b/src/main/resources/templates/home.html index dc3ea8f..b6cf3df 100644 --- a/src/main/resources/templates/home.html +++ b/src/main/resources/templates/home.html @@ -11,6 +11,7 @@ +
@@ -147,16 +148,19 @@
...
@@ -182,10 +186,10 @@ @@ -195,8 +199,8 @@ @@ -206,8 +210,8 @@ @@ -261,15 +265,17 @@ 姓名 - 二狗子 - 在校状态 - -
- 在校 - 未在校 - 未知 -
-
+ + 身份认证状态 + + + + 已认证 + 未认证 + + + + @@ -280,15 +286,20 @@ - 手机 - 180892131811 + 民族 + 性别 - + - + + + + + + 班号 - 14011809 + 班级 软件九班 @@ -296,14 +307,14 @@ 专业 - 软件工程 + 学院 - 软件学院 + 邮箱 - 857331073@qq.com - 职务 + + 职务 @@ -370,7 +381,138 @@
+ + -
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/templates/huodong1.html b/src/main/resources/templates/huodong1.html new file mode 100644 index 0000000..a66d952 --- /dev/null +++ b/src/main/resources/templates/huodong1.html @@ -0,0 +1,265 @@ + + + + + + + + + + +
+我的活动 + + + +
+
+
+ + +
+ +
+
+
+

远处,在“山”一词的后面,远离Vokalia和Consonantia国家,那里有盲目的文字。他们分开居住在语义大国语义海的Bookmarksgrove。

+ +

一条名为Duden的小河在其所在地流淌,并向其提供必要的游憩设施。这是一个天堂般的国家,在这里,烤过的句子飞入您的嘴里。

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
创建人二狗子报名人数1223
进行状态未开始活动编号E123442
我的角色参加者参加情况待参加
报名时间3.13-3.14开展时间3.15 14:00-3.17 14:00
活动类型团建活动地点在线
是否考勤随机考勤
+ +
+
+ + +
+ +

+ + + 3月10日 + + +

+ + + + + + + + + + + +
+

已签到名单

+ +
+ + +

二分法

+

大法官

+

王大王

+
+

未签到名单

+ +
+

二分法

+

大法官

+

王大王

+ +
+
+
+

二分法

+

大法官

+

王大王

+
+
+
+ + + +

+ + + + 3/20 + + + +

+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/templates/huodong2.html b/src/main/resources/templates/huodong2.html new file mode 100644 index 0000000..ecf91e8 --- /dev/null +++ b/src/main/resources/templates/huodong2.html @@ -0,0 +1,626 @@ + + + + + + + + + + +
+创建活动 + + + +
+
+
+ + + + +
+ + + + + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ +
+ +

+ + +

+ + +
+ + +
+ + + + + + + + +
+
+ +
+ + +
+
+ + + +
+ +
+ +
+ + + +
+
+ 筛选添加(不选默认为全选) +

+
+
+ + 职务: + + + + + +
+
+ + 学院和专业: + + 学院
+ 专业
+ +
+
+ + 班级: + + + +
+ +
+
+ + 性别: + + +
+ +
+

+ + + + + +

+
+
+
+ +
+ + + +
+
+ 筛选添加(不选默认为全选) +

+
+
职务: + + + + + +
+
学院和专业: + + 学院 +
+ + 专业 +
+
+
班级: + +
+
+
性别: + + +
+ +
+

+ + +

+
+
+ + + +
+
+ + +
+
+ + +
+ 报名开始时间: + + + + +
+ +
+ 报名持续时长: + + + +
+ + + +
+
+
+ +
+ +
+ 开始时间: + + + + +
+
+ 持续时长: + + + +
+ + + +
+
+ + +
+
+ 周期: + + 周 +
+ 哪一天开展活动: +
+ + + + + + + + +
+ + +
+
+
+ + + +
+
+ +
+ + + +
+
+ 筛选添加(不选默认为全选) +

+
+
职务: + + + + + +
+
学院和专业: + + 学院 +
+ + 专业 +
+
+
班级: + +
+
+
性别: + + +
+ +
+

+ + +

+
+
+ + + + +
+ + +
+ +
+ + + + + +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/templates/huodong3.html b/src/main/resources/templates/huodong3.html new file mode 100644 index 0000000..e69de29 diff --git a/src/main/resources/templates/huodong4.html b/src/main/resources/templates/huodong4.html new file mode 100644 index 0000000..04d0b02 --- /dev/null +++ b/src/main/resources/templates/huodong4.html @@ -0,0 +1,387 @@ + + + + + + + + + +
+ +home + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/templates/information.html b/src/main/resources/templates/information.html new file mode 100644 index 0000000..27d7389 --- /dev/null +++ b/src/main/resources/templates/information.html @@ -0,0 +1,220 @@ + + + + + + + + + + +
+information + + + +
+
+
+ +
基本信息
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
姓名二狗子在校状态在校
学号2018303208身份学生
手机180892131811性别
班号14011809班级软件九班
专业软件工程学院软件学院
邮箱857331073@qq.com职务
+
统计信息
+ + + + + + + + + + + + + + + + + + + + + + + +
学分积学分积排名综合测评综测排名考勤次数考勤率活动参加数
1个表格单元格表格单元格表格单元格表格单元格表格单元格表格单元格
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/templates/main.html b/src/main/resources/templates/main.html new file mode 100644 index 0000000..5a5df66 --- /dev/null +++ b/src/main/resources/templates/main.html @@ -0,0 +1,394 @@ + + + + + + + + + +
+ +main + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +