├── src └── main │ ├── resources │ ├── application.properties │ ├── application-dev.yml │ ├── application-pre.yml │ ├── application-prod.yml │ ├── application-test.yml │ ├── application.yml │ ├── mapper │ │ └── TextContentMapper.xml │ └── logback-spring.xml │ └── java │ └── com │ └── mindskip │ └── xzs │ ├── service │ ├── FileUpload.java │ ├── UserEventLogService.java │ ├── SubjectService.java │ ├── enums │ │ └── ActionEnum.java │ ├── TaskExamCustomerAnswerService.java │ ├── TaskExamService.java │ ├── QuestionService.java │ ├── MessageService.java │ ├── TextContentService.java │ ├── AuthenticationService.java │ ├── UserTokenService.java │ ├── BaseService.java │ ├── ExamPaperService.java │ ├── impl │ │ ├── BaseServiceImpl.java │ │ ├── SubjectServiceImpl.java │ │ ├── FileUploadImpl.java │ │ ├── AuthenticationServiceImpl.java │ │ ├── UserEventLogServiceImpl.java │ │ └── TextContentServiceImpl.java │ ├── ExamPaperQuestionCustomerAnswerService.java │ └── ExamPaperAnswerService.java │ ├── base │ ├── BaseEntity.java │ ├── BasePage.java │ ├── BaseApiController.java │ └── SystemCode.java │ ├── repository │ ├── TextContentMapper.java │ ├── UserTokenMapper.java │ ├── BaseMapper.java │ ├── TaskExamMapper.java │ ├── MessageMapper.java │ ├── SubjectMapper.java │ ├── MessageUserMapper.java │ ├── TaskExamCustomerAnswerMapper.java │ ├── UserEventLogMapper.java │ ├── QuestionMapper.java │ ├── ExamPaperAnswerMapper.java │ ├── ExamPaperQuestionCustomerAnswerMapper.java │ └── ExamPaperMapper.java │ ├── viewmodel │ ├── admin │ │ ├── task │ │ │ ├── TaskPageRequestVM.java │ │ │ ├── TaskRequestVM.java │ │ │ └── TaskPageResponseVM.java │ │ ├── paper │ │ │ ├── ExamPaperAnswerPageRequestVM.java │ │ │ └── ExamAnswerResponseVM.java │ │ ├── message │ │ │ ├── MessagePageRequestVM.java │ │ │ ├── MessageSendVM.java │ │ │ └── MessageResponseVM.java │ │ ├── education │ │ │ ├── SubjectPageRequestVM.java │ │ │ ├── SubjectResponseVM.java │ │ │ └── SubjectEditRequestVM.java │ │ ├── user │ │ │ ├── UserPageRequestVM.java │ │ │ ├── UserUpdateVM.java │ │ │ ├── UserEventPageRequestVM.java │ │ │ ├── UserEventLogVM.java │ │ │ └── UserCreateVM.java │ │ ├── exam │ │ │ ├── ExamPaperTitleItemVM.java │ │ │ ├── ExamPaperPageRequestVM.java │ │ │ ├── ExamResponseVM.java │ │ │ └── ExamPaperEditRequestVM.java │ │ ├── question │ │ │ ├── QuestionEditItemVM.java │ │ │ └── QuestionPageRequestVM.java │ │ ├── file │ │ │ ├── UploadResultVM.java │ │ │ └── UeditorConfigVM.java │ │ └── dashboard │ │ │ └── IndexVM.java │ ├── student │ │ ├── user │ │ │ ├── MessageRequestVM.java │ │ │ ├── UserRegisterVM.java │ │ │ ├── UserEventLogVM.java │ │ │ ├── UserUpdateVM.java │ │ │ └── MessageResponseVM.java │ │ ├── question │ │ │ └── answer │ │ │ │ ├── QuestionPageStudentRequestVM.java │ │ │ │ ├── QuestionAnswerVM.java │ │ │ │ └── QuestionPageStudentResponseVM.java │ │ ├── education │ │ │ ├── SubjectVM.java │ │ │ └── SubjectEditRequestVM.java │ │ ├── dashboard │ │ │ ├── PaperInfoVM.java │ │ │ ├── TaskItemVm.java │ │ │ ├── IndexVM.java │ │ │ ├── PaperInfo.java │ │ │ ├── PaperFilter.java │ │ │ └── TaskItemPaperVm.java │ │ ├── exam │ │ │ ├── ExamPaperReadVM.java │ │ │ ├── ExamPaperPageVM.java │ │ │ ├── ExamPaperSubmitVM.java │ │ │ ├── ExamPaperSubmitItemVM.java │ │ │ └── ExamPaperPageResponseVM.java │ │ └── exampaper │ │ │ └── ExamPaperAnswerPageVM.java │ ├── wx │ │ └── student │ │ │ └── user │ │ │ └── BindInfo.java │ └── BaseVM.java │ ├── domain │ ├── other │ │ ├── KeyValue.java │ │ └── ExamPaperAnswerUpdate.java │ ├── exam │ │ ├── ExamPaperQuestionItemObject.java │ │ └── ExamPaperTitleItemObject.java │ ├── enums │ │ ├── QuestionStatusEnum.java │ │ ├── UserStatusEnum.java │ │ ├── RoleEnum.java │ │ ├── ExamPaperTypeEnum.java │ │ ├── ExamPaperAnswerStatusEnum.java │ │ └── QuestionTypeEnum.java │ ├── task │ │ ├── TaskItemObject.java │ │ └── TaskItemAnswerObject.java │ ├── question │ │ ├── QuestionItemObject.java │ │ └── QuestionObject.java │ ├── ExamPaperAnswerInfo.java │ ├── TextContent.java │ ├── TaskExamCustomerAnswer.java │ ├── Subject.java │ ├── UserToken.java │ ├── UserEventLog.java │ ├── TaskExam.java │ └── MessageUser.java │ ├── utility │ ├── ErrorUtil.java │ ├── ModelMapperSingle.java │ ├── HtmlUtil.java │ ├── WxResponse.java │ ├── PageInfoHelper.java │ └── WxUtil.java │ ├── configuration │ ├── property │ │ ├── CookieConfig.java │ │ ├── PasswordKeyConfig.java │ │ ├── QnConfig.java │ │ ├── WxConfig.java │ │ └── SystemConfig.java │ ├── spring │ │ ├── security │ │ │ ├── RestAccessDeniedHandler.java │ │ │ ├── RestAuthenticationFailureHandler.java │ │ │ ├── RestTokenBasedRememberMeServices.java │ │ │ ├── LoginAuthenticationEntryPoint.java │ │ │ ├── AuthenticationBean.java │ │ │ ├── RestDetailsServiceImpl.java │ │ │ ├── RestUtil.java │ │ │ └── RestLogoutSuccessHandler.java │ │ ├── mvc │ │ │ └── WebMvcConfiguration.java │ │ ├── wx │ │ │ └── TokenHandlerInterceptor.java │ │ └── exception │ │ │ └── ExceptionHandle.java │ └── application │ │ └── ApplicationContextProvider.java │ ├── controller │ ├── student │ │ ├── QuestionController.java │ │ ├── EducationController.java │ │ ├── UploadController.java │ │ └── ExamPaperController.java │ ├── wx │ │ ├── BaseWXApiController.java │ │ └── student │ │ │ └── ExamPaperController.java │ ├── ErrorController.java │ └── admin │ │ ├── TaskController.java │ │ ├── ExamPaperAnswerController.java │ │ └── DashboardController.java │ ├── listener │ ├── EmailSendListener.java │ └── UserLogListener.java │ ├── event │ ├── OnRegistrationCompleteEvent.java │ ├── UserEvent.java │ └── CalculateExamPaperAnswerCompleteEvent.java │ ├── XzsApplication.java │ └── context │ ├── WxContext.java │ └── WebContext.java └── README.assets ├── image-20240105143202372.png └── image-20240105143231994.png /src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /README.assets/image-20240105143202372.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hctestedu/api-test-project/HEAD/README.assets/image-20240105143202372.png -------------------------------------------------------------------------------- /README.assets/image-20240105143231994.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hctestedu/api-test-project/HEAD/README.assets/image-20240105143231994.png -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/service/FileUpload.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.service; 2 | 3 | 4 | import java.io.InputStream; 5 | import java.util.Set; 6 | 7 | public interface FileUpload { 8 | 9 | String uploadFile(InputStream inputStream, long size, String extName); 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/base/BaseEntity.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.base; 2 | 3 | 4 | /** 5 | * @version 3.3.0 6 | * @description: The type Base entity. 7 | * Copyright (C), 2019-2024, 武汉思维跳跃科技有限公司 8 | * @date 2021 /5/26 10:45 9 | */ 10 | public abstract class BaseEntity { 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/repository/TextContentMapper.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.repository; 2 | 3 | import com.mindskip.xzs.domain.TextContent; 4 | import org.apache.ibatis.annotations.Mapper; 5 | 6 | @Mapper 7 | public interface TextContentMapper extends BaseMapper { 8 | 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/repository/UserTokenMapper.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.repository; 2 | 3 | import com.mindskip.xzs.domain.UserToken; 4 | import org.apache.ibatis.annotations.Mapper; 5 | 6 | @Mapper 7 | public interface UserTokenMapper extends BaseMapper { 8 | 9 | UserToken getToken(String token); 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/main/resources/application-dev.yml: -------------------------------------------------------------------------------- 1 | logging: 2 | path: ./log/ 3 | 4 | spring: 5 | datasource: 6 | url: jdbc:mysql://localhost:3306/xzs?useSSL=false&useUnicode=true&serverTimezone=Asia/Shanghai&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&allowPublicKeyRetrieval=true&allowMultiQueries=true 7 | username: root 8 | password: root 9 | driver-class-name: com.mysql.cj.jdbc.Driver 10 | -------------------------------------------------------------------------------- /src/main/resources/application-pre.yml: -------------------------------------------------------------------------------- 1 | logging: 2 | path: /usr/log/xzs/ 3 | 4 | spring: 5 | datasource: 6 | url: jdbc:mysql://localhost:3306/xzs?useSSL=false&useUnicode=true&serverTimezone=Asia/Shanghai&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&allowPublicKeyRetrieval=true&allowMultiQueries=true 7 | username: root 8 | password: 123456 9 | driver-class-name: com.mysql.cj.jdbc.Driver 10 | -------------------------------------------------------------------------------- /src/main/resources/application-prod.yml: -------------------------------------------------------------------------------- 1 | logging: 2 | path: /usr/log/xzs/ 3 | 4 | spring: 5 | datasource: 6 | url: jdbc:mysql://localhost:3306/xzs?useSSL=false&useUnicode=true&serverTimezone=Asia/Shanghai&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&allowPublicKeyRetrieval=true&allowMultiQueries=true 7 | username: root 8 | password: root 9 | driver-class-name: com.mysql.cj.jdbc.Driver 10 | -------------------------------------------------------------------------------- /src/main/resources/application-test.yml: -------------------------------------------------------------------------------- 1 | logging: 2 | path: /usr/log/xzs/ 3 | 4 | spring: 5 | datasource: 6 | url: jdbc:mysql://localhost:3306/xzs?useSSL=false&useUnicode=true&serverTimezone=Asia/Shanghai&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&allowPublicKeyRetrieval=true&allowMultiQueries=true 7 | username: root 8 | password: 123456 9 | driver-class-name: com.mysql.cj.jdbc.Driver 10 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/repository/BaseMapper.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.repository; 2 | 3 | public interface BaseMapper { 4 | 5 | int deleteByPrimaryKey(Integer id); 6 | 7 | int insert(T record); 8 | 9 | int insertSelective(T record); 10 | 11 | T selectByPrimaryKey(Integer id); 12 | 13 | int updateByPrimaryKeySelective(T record); 14 | 15 | int updateByPrimaryKey(T record); 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/viewmodel/admin/task/TaskPageRequestVM.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.viewmodel.admin.task; 2 | 3 | import com.mindskip.xzs.base.BasePage; 4 | 5 | 6 | 7 | public class TaskPageRequestVM extends BasePage { 8 | private Integer gradeLevel; 9 | 10 | public Integer getGradeLevel() { 11 | return gradeLevel; 12 | } 13 | 14 | public void setGradeLevel(Integer gradeLevel) { 15 | this.gradeLevel = gradeLevel; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/viewmodel/admin/paper/ExamPaperAnswerPageRequestVM.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.viewmodel.admin.paper; 2 | 3 | import com.mindskip.xzs.base.BasePage; 4 | 5 | public class ExamPaperAnswerPageRequestVM extends BasePage { 6 | private Integer subjectId; 7 | 8 | public Integer getSubjectId() { 9 | return subjectId; 10 | } 11 | 12 | public void setSubjectId(Integer subjectId) { 13 | this.subjectId = subjectId; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/viewmodel/student/user/MessageRequestVM.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.viewmodel.student.user; 2 | 3 | import com.mindskip.xzs.base.BasePage; 4 | 5 | public class MessageRequestVM extends BasePage { 6 | 7 | private Integer receiveUserId; 8 | 9 | public Integer getReceiveUserId() { 10 | return receiveUserId; 11 | } 12 | 13 | public void setReceiveUserId(Integer receiveUserId) { 14 | this.receiveUserId = receiveUserId; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/viewmodel/admin/message/MessagePageRequestVM.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.viewmodel.admin.message; 2 | 3 | import com.mindskip.xzs.base.BasePage; 4 | 5 | 6 | 7 | public class MessagePageRequestVM extends BasePage { 8 | private String sendUserName; 9 | 10 | public String getSendUserName() { 11 | return sendUserName; 12 | } 13 | 14 | public void setSendUserName(String sendUserName) { 15 | this.sendUserName = sendUserName; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/repository/TaskExamMapper.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.repository; 2 | 3 | import com.mindskip.xzs.domain.TaskExam; 4 | import com.mindskip.xzs.viewmodel.admin.task.TaskPageRequestVM; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | import java.util.List; 8 | 9 | @Mapper 10 | public interface TaskExamMapper extends BaseMapper { 11 | 12 | List page(TaskPageRequestVM requestVM); 13 | 14 | List getByGradeLevel(Integer gradeLevel); 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/viewmodel/student/question/answer/QuestionPageStudentRequestVM.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.viewmodel.student.question.answer; 2 | 3 | import com.mindskip.xzs.base.BasePage; 4 | 5 | public class QuestionPageStudentRequestVM extends BasePage { 6 | private Integer createUser; 7 | 8 | public Integer getCreateUser() { 9 | return createUser; 10 | } 11 | 12 | public void setCreateUser(Integer createUser) { 13 | this.createUser = createUser; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/domain/other/KeyValue.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.domain.other; 2 | 3 | 4 | public class KeyValue { 5 | 6 | private String name; 7 | private Integer value; 8 | 9 | public String getName() { 10 | return name; 11 | } 12 | 13 | public void setName(String name) { 14 | this.name = name; 15 | } 16 | 17 | public Integer getValue() { 18 | return value; 19 | } 20 | 21 | public void setValue(Integer value) { 22 | this.value = value; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/repository/MessageMapper.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.repository; 2 | 3 | import com.mindskip.xzs.domain.Message; 4 | import com.mindskip.xzs.viewmodel.admin.message.MessagePageRequestVM; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | import java.util.List; 8 | 9 | @Mapper 10 | public interface MessageMapper extends BaseMapper { 11 | 12 | List page(MessagePageRequestVM requestVM); 13 | 14 | List selectByIds(List ids); 15 | 16 | int readAdd(Integer id); 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/viewmodel/student/education/SubjectVM.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.viewmodel.student.education; 2 | 3 | 4 | public class SubjectVM { 5 | private String id; 6 | 7 | private String name; 8 | 9 | public String getId() { 10 | return id; 11 | } 12 | 13 | public void setId(String id) { 14 | this.id = id; 15 | } 16 | 17 | public String getName() { 18 | return name; 19 | } 20 | 21 | public void setName(String name) { 22 | this.name = name; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/repository/SubjectMapper.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.repository; 2 | 3 | import com.mindskip.xzs.domain.Subject; 4 | import com.mindskip.xzs.viewmodel.admin.education.SubjectPageRequestVM; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | import java.util.List; 8 | 9 | @Mapper 10 | public interface SubjectMapper extends BaseMapper { 11 | 12 | List getSubjectByLevel(Integer level); 13 | 14 | List allSubject(); 15 | 16 | List page(SubjectPageRequestVM requestVM); 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/service/UserEventLogService.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.service; 2 | 3 | import com.mindskip.xzs.domain.UserEventLog; 4 | import com.mindskip.xzs.viewmodel.admin.user.UserEventPageRequestVM; 5 | import com.github.pagehelper.PageInfo; 6 | 7 | import java.util.List; 8 | 9 | public interface UserEventLogService extends BaseService { 10 | 11 | List getUserEventLogByUserId(Integer id); 12 | 13 | PageInfo page(UserEventPageRequestVM requestVM); 14 | 15 | List selectMothCount(); 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/domain/exam/ExamPaperQuestionItemObject.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.domain.exam; 2 | 3 | public class ExamPaperQuestionItemObject { 4 | private Integer id; 5 | private Integer itemOrder; 6 | 7 | public Integer getId() { 8 | return id; 9 | } 10 | 11 | public void setId(Integer id) { 12 | this.id = id; 13 | } 14 | 15 | public Integer getItemOrder() { 16 | return itemOrder; 17 | } 18 | 19 | public void setItemOrder(Integer itemOrder) { 20 | this.itemOrder = itemOrder; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/service/SubjectService.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.service; 2 | 3 | import com.mindskip.xzs.domain.Subject; 4 | import com.mindskip.xzs.viewmodel.admin.education.SubjectPageRequestVM; 5 | import com.github.pagehelper.PageInfo; 6 | 7 | import java.util.List; 8 | 9 | public interface SubjectService extends BaseService { 10 | 11 | List getSubjectByLevel(Integer level); 12 | 13 | List allSubject(); 14 | 15 | Integer levelBySubjectId(Integer id); 16 | 17 | PageInfo page(SubjectPageRequestVM requestVM); 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/utility/ErrorUtil.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.utility; 2 | 3 | 4 | /** 5 | * @version 3.5.0 6 | * @description: The type Error util. 7 | * Copyright (C), 2020-2024, 武汉思维跳跃科技有限公司 8 | * @date 2021/12/25 9:45 9 | */ 10 | public class ErrorUtil { 11 | /** 12 | * Parameter error format string. 13 | * 14 | * @param field the field 15 | * @param msg the msg 16 | * @return the string 17 | */ 18 | public static String parameterErrorFormat(String field, String msg) { 19 | return "【" + field + " : " + msg + "】"; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/viewmodel/student/dashboard/PaperInfoVM.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.viewmodel.student.dashboard; 2 | 3 | 4 | public class PaperInfoVM extends PaperInfo { 5 | private String startTime; 6 | private String endTime; 7 | 8 | public String getStartTime() { 9 | return startTime; 10 | } 11 | 12 | public void setStartTime(String startTime) { 13 | this.startTime = startTime; 14 | } 15 | 16 | public String getEndTime() { 17 | return endTime; 18 | } 19 | 20 | public void setEndTime(String endTime) { 21 | this.endTime = endTime; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/repository/MessageUserMapper.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.repository; 2 | 3 | import com.mindskip.xzs.domain.MessageUser; 4 | import com.mindskip.xzs.viewmodel.student.user.MessageRequestVM; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | import java.util.List; 8 | 9 | @Mapper 10 | public interface MessageUserMapper extends BaseMapper { 11 | 12 | List selectByMessageIds(List ids); 13 | 14 | int inserts(List list); 15 | 16 | List studentPage(MessageRequestVM requestVM); 17 | 18 | Integer unReadCount(Integer userId); 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/repository/TaskExamCustomerAnswerMapper.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.repository; 2 | 3 | import com.mindskip.xzs.domain.TaskExamCustomerAnswer; 4 | import org.apache.ibatis.annotations.Mapper; 5 | import org.apache.ibatis.annotations.Param; 6 | 7 | import java.util.List; 8 | 9 | @Mapper 10 | public interface TaskExamCustomerAnswerMapper extends BaseMapper { 11 | 12 | TaskExamCustomerAnswer getByTUid(@Param("tid") Integer tid, @Param("uid") Integer uid); 13 | 14 | List selectByTUid(@Param("taskIds") List taskIds, @Param("uid") Integer uid); 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/viewmodel/admin/education/SubjectPageRequestVM.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.viewmodel.admin.education; 2 | 3 | import com.mindskip.xzs.base.BasePage; 4 | 5 | 6 | 7 | public class SubjectPageRequestVM extends BasePage { 8 | private Integer id; 9 | private Integer level; 10 | 11 | public Integer getId() { 12 | return id; 13 | } 14 | 15 | public void setId(Integer id) { 16 | this.id = id; 17 | } 18 | 19 | public Integer getLevel() { 20 | return level; 21 | } 22 | 23 | public void setLevel(Integer level) { 24 | this.level = level; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/viewmodel/admin/user/UserPageRequestVM.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.viewmodel.admin.user; 2 | 3 | import com.mindskip.xzs.base.BasePage; 4 | 5 | 6 | public class UserPageRequestVM extends BasePage { 7 | 8 | private String userName; 9 | private Integer role; 10 | 11 | public String getUserName() { 12 | return userName; 13 | } 14 | 15 | public void setUserName(String userName) { 16 | this.userName = userName; 17 | } 18 | 19 | public Integer getRole() { 20 | return role; 21 | } 22 | 23 | public void setRole(Integer role) { 24 | this.role = role; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/configuration/property/CookieConfig.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.configuration.property; 2 | 3 | /** 4 | * @version 3.5.0 5 | * @description: The type Cookie config. 6 | * Copyright (C), 2020-2024, 武汉思维跳跃科技有限公司 7 | * @date 2021/12/25 9:45 8 | */ 9 | public class CookieConfig { 10 | 11 | /** 12 | * Gets name. 13 | * 14 | * @return the name 15 | */ 16 | public static String getName() { 17 | return "xzs"; 18 | } 19 | 20 | /** 21 | * Gets interval. 22 | * 23 | * @return the interval 24 | */ 25 | public static Integer getInterval() { 26 | return 30 * 24 * 60 * 60; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/service/enums/ActionEnum.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.service.enums; 2 | 3 | public enum ActionEnum { 4 | 5 | ADD(1, "新增"), 6 | UPDATE(2, "修改"); 7 | 8 | int code; 9 | String Name; 10 | 11 | ActionEnum(int code, String name) { 12 | this.code = code; 13 | Name = name; 14 | } 15 | 16 | 17 | public int getCode() { 18 | return code; 19 | } 20 | 21 | public void setCode(int code) { 22 | this.code = code; 23 | } 24 | 25 | public String getName() { 26 | return Name; 27 | } 28 | 29 | public void setName(String name) { 30 | Name = name; 31 | } 32 | 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/service/TaskExamCustomerAnswerService.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.service; 2 | 3 | import com.mindskip.xzs.domain.ExamPaper; 4 | import com.mindskip.xzs.domain.ExamPaperAnswer; 5 | import com.mindskip.xzs.domain.TaskExamCustomerAnswer; 6 | 7 | import java.util.Date; 8 | import java.util.List; 9 | 10 | public interface TaskExamCustomerAnswerService extends BaseService { 11 | 12 | void insertOrUpdate(ExamPaper examPaper, ExamPaperAnswer examPaperAnswer, Date now); 13 | 14 | TaskExamCustomerAnswer selectByTUid(Integer tid, Integer uid); 15 | 16 | List selectByTUid(List taskIds, Integer uid); 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/viewmodel/admin/user/UserUpdateVM.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.viewmodel.admin.user; 2 | 3 | 4 | 5 | import javax.validation.constraints.NotBlank; 6 | 7 | 8 | public class UserUpdateVM { 9 | 10 | @NotBlank 11 | private String realName; 12 | 13 | @NotBlank 14 | private String phone; 15 | 16 | public String getRealName() { 17 | return realName; 18 | } 19 | 20 | public void setRealName(String realName) { 21 | this.realName = realName; 22 | } 23 | 24 | public String getPhone() { 25 | return phone; 26 | } 27 | 28 | public void setPhone(String phone) { 29 | this.phone = phone; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/viewmodel/admin/user/UserEventPageRequestVM.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.viewmodel.admin.user; 2 | 3 | import com.mindskip.xzs.base.BasePage; 4 | 5 | 6 | 7 | 8 | public class UserEventPageRequestVM extends BasePage { 9 | 10 | private Integer userId; 11 | 12 | private String userName; 13 | 14 | public Integer getUserId() { 15 | return userId; 16 | } 17 | 18 | public void setUserId(Integer userId) { 19 | this.userId = userId; 20 | } 21 | 22 | public String getUserName() { 23 | return userName; 24 | } 25 | 26 | public void setUserName(String userName) { 27 | this.userName = userName; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/service/TaskExamService.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.service; 2 | 3 | import com.mindskip.xzs.domain.TaskExam; 4 | import com.mindskip.xzs.domain.User; 5 | import com.mindskip.xzs.viewmodel.admin.task.TaskPageRequestVM; 6 | import com.mindskip.xzs.viewmodel.admin.task.TaskRequestVM; 7 | import com.github.pagehelper.PageInfo; 8 | 9 | import java.util.List; 10 | 11 | public interface TaskExamService extends BaseService { 12 | 13 | PageInfo page(TaskPageRequestVM requestVM); 14 | 15 | void edit(TaskRequestVM model, User user); 16 | 17 | TaskRequestVM taskExamToVM(Integer id); 18 | 19 | List getByGradeLevel(Integer gradeLevel); 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/domain/enums/QuestionStatusEnum.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.domain.enums; 2 | 3 | public enum QuestionStatusEnum { 4 | 5 | OK(1, "正常"), 6 | Publish(2, "发布"); 7 | 8 | int code; 9 | String name; 10 | 11 | QuestionStatusEnum(int code, String name) { 12 | this.code = code; 13 | this.name = name; 14 | } 15 | 16 | 17 | public int getCode() { 18 | return code; 19 | } 20 | 21 | public void setCode(int code) { 22 | this.code = code; 23 | } 24 | 25 | public String getName() { 26 | return name; 27 | } 28 | 29 | public void setName(String name) { 30 | this.name = name; 31 | } 32 | 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/viewmodel/student/exam/ExamPaperReadVM.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.viewmodel.student.exam; 2 | 3 | import com.mindskip.xzs.viewmodel.admin.exam.ExamPaperEditRequestVM; 4 | 5 | public class ExamPaperReadVM { 6 | private ExamPaperEditRequestVM paper; 7 | private ExamPaperSubmitVM answer; 8 | 9 | public ExamPaperEditRequestVM getPaper() { 10 | return paper; 11 | } 12 | 13 | public void setPaper(ExamPaperEditRequestVM paper) { 14 | this.paper = paper; 15 | } 16 | 17 | public ExamPaperSubmitVM getAnswer() { 18 | return answer; 19 | } 20 | 21 | public void setAnswer(ExamPaperSubmitVM answer) { 22 | this.answer = answer; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/viewmodel/student/exampaper/ExamPaperAnswerPageVM.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.viewmodel.student.exampaper; 2 | 3 | import com.mindskip.xzs.base.BasePage; 4 | 5 | public class ExamPaperAnswerPageVM extends BasePage { 6 | 7 | private Integer subjectId; 8 | 9 | private Integer createUser; 10 | 11 | public Integer getSubjectId() { 12 | return subjectId; 13 | } 14 | 15 | public void setSubjectId(Integer subjectId) { 16 | this.subjectId = subjectId; 17 | } 18 | 19 | public Integer getCreateUser() { 20 | return createUser; 21 | } 22 | 23 | public void setCreateUser(Integer createUser) { 24 | this.createUser = createUser; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/controller/student/QuestionController.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.controller.student; 2 | 3 | import com.mindskip.xzs.base.BaseApiController; 4 | import com.mindskip.xzs.service.QuestionService; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.web.bind.annotation.*; 7 | 8 | @RestController("StudentQuestionController") 9 | @RequestMapping(value = "/api/student/question") 10 | public class QuestionController extends BaseApiController { 11 | 12 | private final QuestionService questionService; 13 | 14 | @Autowired 15 | public QuestionController(QuestionService questionService) { 16 | this.questionService = questionService; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/domain/exam/ExamPaperTitleItemObject.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.domain.exam; 2 | 3 | 4 | import java.util.List; 5 | 6 | public class ExamPaperTitleItemObject { 7 | 8 | private String name; 9 | 10 | private List questionItems; 11 | 12 | public String getName() { 13 | return name; 14 | } 15 | 16 | public void setName(String name) { 17 | this.name = name; 18 | } 19 | 20 | public List getQuestionItems() { 21 | return questionItems; 22 | } 23 | 24 | public void setQuestionItems(List questionItems) { 25 | this.questionItems = questionItems; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/repository/UserEventLogMapper.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.repository; 2 | 3 | import com.mindskip.xzs.domain.UserEventLog; 4 | import com.mindskip.xzs.domain.other.KeyValue; 5 | import com.mindskip.xzs.viewmodel.admin.user.UserEventPageRequestVM; 6 | import org.apache.ibatis.annotations.Mapper; 7 | import org.apache.ibatis.annotations.Param; 8 | 9 | import java.util.Date; 10 | import java.util.List; 11 | 12 | @Mapper 13 | public interface UserEventLogMapper extends BaseMapper { 14 | 15 | List getUserEventLogByUserId(Integer id); 16 | 17 | List page(UserEventPageRequestVM requestVM); 18 | 19 | List selectCountByDate(@Param("startTime") Date startTime, @Param("endTime") Date endTime); 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/repository/QuestionMapper.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.repository; 2 | 3 | import com.mindskip.xzs.domain.other.KeyValue; 4 | import com.mindskip.xzs.domain.Question; 5 | import com.mindskip.xzs.viewmodel.admin.question.QuestionPageRequestVM; 6 | import org.apache.ibatis.annotations.Mapper; 7 | import org.apache.ibatis.annotations.Param; 8 | 9 | import java.util.Date; 10 | import java.util.List; 11 | 12 | @Mapper 13 | public interface QuestionMapper extends BaseMapper { 14 | 15 | List page(QuestionPageRequestVM requestVM); 16 | 17 | List selectByIds(@Param("ids") List ids); 18 | 19 | Integer selectAllCount(); 20 | 21 | List selectCountByDate(@Param("startTime") Date startTime,@Param("endTime") Date endTime); 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/controller/wx/BaseWXApiController.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.controller.wx; 2 | 3 | import com.mindskip.xzs.context.WxContext; 4 | import com.mindskip.xzs.domain.User; 5 | import com.mindskip.xzs.domain.UserToken; 6 | import com.mindskip.xzs.utility.ModelMapperSingle; 7 | import org.modelmapper.ModelMapper; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | 10 | public class BaseWXApiController { 11 | protected final static ModelMapper modelMapper = ModelMapperSingle.Instance(); 12 | @Autowired 13 | private WxContext wxContext; 14 | 15 | protected User getCurrentUser() { 16 | return wxContext.getCurrentUser(); 17 | } 18 | 19 | protected UserToken getUserToken() { 20 | return wxContext.getCurrentUserToken(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/domain/other/ExamPaperAnswerUpdate.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.domain.other; 2 | 3 | 4 | public class ExamPaperAnswerUpdate { 5 | private Integer id; 6 | private Integer customerScore; 7 | private Boolean doRight; 8 | 9 | public Integer getId() { 10 | return id; 11 | } 12 | 13 | public void setId(Integer id) { 14 | this.id = id; 15 | } 16 | 17 | public Integer getCustomerScore() { 18 | return customerScore; 19 | } 20 | 21 | public void setCustomerScore(Integer customerScore) { 22 | this.customerScore = customerScore; 23 | } 24 | 25 | public Boolean getDoRight() { 26 | return doRight; 27 | } 28 | 29 | public void setDoRight(Boolean doRight) { 30 | this.doRight = doRight; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/viewmodel/student/dashboard/TaskItemVm.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.viewmodel.student.dashboard; 2 | 3 | 4 | import java.util.List; 5 | 6 | public class TaskItemVm { 7 | private Integer id; 8 | private String title; 9 | private List paperItems; 10 | 11 | public Integer getId() { 12 | return id; 13 | } 14 | 15 | public void setId(Integer id) { 16 | this.id = id; 17 | } 18 | 19 | public String getTitle() { 20 | return title; 21 | } 22 | 23 | public void setTitle(String title) { 24 | this.title = title; 25 | } 26 | 27 | public List getPaperItems() { 28 | return paperItems; 29 | } 30 | 31 | public void setPaperItems(List paperItems) { 32 | this.paperItems = paperItems; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/domain/task/TaskItemObject.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.domain.task; 2 | 3 | 4 | public class TaskItemObject { 5 | private Integer examPaperId; 6 | private String examPaperName; 7 | private Integer itemOrder; 8 | 9 | public Integer getExamPaperId() { 10 | return examPaperId; 11 | } 12 | 13 | public void setExamPaperId(Integer examPaperId) { 14 | this.examPaperId = examPaperId; 15 | } 16 | 17 | public String getExamPaperName() { 18 | return examPaperName; 19 | } 20 | 21 | public void setExamPaperName(String examPaperName) { 22 | this.examPaperName = examPaperName; 23 | } 24 | 25 | public Integer getItemOrder() { 26 | return itemOrder; 27 | } 28 | 29 | public void setItemOrder(Integer itemOrder) { 30 | this.itemOrder = itemOrder; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/listener/EmailSendListener.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.listener; 2 | 3 | import com.mindskip.xzs.domain.User; 4 | import com.mindskip.xzs.event.OnRegistrationCompleteEvent; 5 | import org.springframework.context.ApplicationListener; 6 | import org.springframework.lang.NonNull; 7 | import org.springframework.stereotype.Component; 8 | 9 | 10 | /** 11 | * @version 3.5.0 12 | * @description: The type Email send listener. 13 | * Copyright (C), 2020-2024, 武汉思维跳跃科技有限公司 14 | * @date 2021/12/25 9:45 15 | */ 16 | @Component 17 | public class EmailSendListener implements ApplicationListener { 18 | 19 | @Override 20 | @NonNull 21 | public void onApplicationEvent(OnRegistrationCompleteEvent event) { 22 | User user = event.getUser(); 23 | System.out.println("User register Email sender :" + user.getUserName()); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/service/QuestionService.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.service; 2 | 3 | import com.mindskip.xzs.domain.Question; 4 | import com.mindskip.xzs.viewmodel.admin.question.QuestionEditRequestVM; 5 | import com.mindskip.xzs.viewmodel.admin.question.QuestionPageRequestVM; 6 | import com.github.pagehelper.PageInfo; 7 | 8 | import java.util.List; 9 | 10 | public interface QuestionService extends BaseService { 11 | 12 | PageInfo page(QuestionPageRequestVM requestVM); 13 | 14 | Question insertFullQuestion(QuestionEditRequestVM model, Integer userId); 15 | 16 | Question updateFullQuestion(QuestionEditRequestVM model); 17 | 18 | QuestionEditRequestVM getQuestionEditRequestVM(Integer questionId); 19 | 20 | QuestionEditRequestVM getQuestionEditRequestVM(Question question); 21 | 22 | Integer selectAllCount(); 23 | 24 | List selectMothCount(); 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/viewmodel/wx/student/user/BindInfo.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.viewmodel.wx.student.user; 2 | 3 | 4 | import javax.validation.constraints.NotBlank; 5 | 6 | public class BindInfo { 7 | 8 | @NotBlank 9 | private String userName; 10 | 11 | @NotBlank 12 | private String password; 13 | 14 | @NotBlank 15 | private String code; 16 | 17 | public String getUserName() { 18 | return userName; 19 | } 20 | 21 | public void setUserName(String userName) { 22 | this.userName = userName; 23 | } 24 | 25 | public String getPassword() { 26 | return password; 27 | } 28 | 29 | public void setPassword(String password) { 30 | this.password = password; 31 | } 32 | 33 | public String getCode() { 34 | return code; 35 | } 36 | 37 | public void setCode(String code) { 38 | this.code = code; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/event/OnRegistrationCompleteEvent.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.event; 2 | 3 | import com.mindskip.xzs.domain.User; 4 | import org.springframework.context.ApplicationEvent; 5 | 6 | /** 7 | * @version 3.5.0 8 | * @description: The type On registration complete event. 9 | * Copyright (C), 2020-2024, 武汉思维跳跃科技有限公司 10 | * @date 2021/12/25 9:45 11 | */ 12 | public class OnRegistrationCompleteEvent extends ApplicationEvent { 13 | 14 | 15 | private final User user; 16 | 17 | 18 | /** 19 | * Instantiates a new On registration complete event. 20 | * 21 | * @param user the user 22 | */ 23 | public OnRegistrationCompleteEvent(final User user) { 24 | super(user); 25 | this.user = user; 26 | } 27 | 28 | /** 29 | * Gets user. 30 | * 31 | * @return the user 32 | */ 33 | public User getUser() { 34 | return user; 35 | } 36 | 37 | } -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/viewmodel/student/question/answer/QuestionAnswerVM.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.viewmodel.student.question.answer; 2 | 3 | import com.mindskip.xzs.viewmodel.admin.question.QuestionEditRequestVM; 4 | import com.mindskip.xzs.viewmodel.student.exam.ExamPaperSubmitItemVM; 5 | 6 | public class QuestionAnswerVM { 7 | private QuestionEditRequestVM questionVM; 8 | private ExamPaperSubmitItemVM questionAnswerVM; 9 | 10 | public QuestionEditRequestVM getQuestionVM() { 11 | return questionVM; 12 | } 13 | 14 | public void setQuestionVM(QuestionEditRequestVM questionVM) { 15 | this.questionVM = questionVM; 16 | } 17 | 18 | public ExamPaperSubmitItemVM getQuestionAnswerVM() { 19 | return questionAnswerVM; 20 | } 21 | 22 | public void setQuestionAnswerVM(ExamPaperSubmitItemVM questionAnswerVM) { 23 | this.questionAnswerVM = questionAnswerVM; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/service/MessageService.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.service; 2 | 3 | import com.mindskip.xzs.domain.Message; 4 | import com.mindskip.xzs.domain.MessageUser; 5 | import com.mindskip.xzs.viewmodel.admin.message.MessagePageRequestVM; 6 | import com.mindskip.xzs.viewmodel.student.user.MessageRequestVM; 7 | import com.github.pagehelper.PageInfo; 8 | 9 | import java.util.List; 10 | 11 | public interface MessageService { 12 | 13 | List selectMessageByIds(List ids); 14 | 15 | PageInfo studentPage(MessageRequestVM requestVM); 16 | 17 | PageInfo page(MessagePageRequestVM requestVM); 18 | 19 | List selectByMessageIds(List ids); 20 | 21 | void sendMessage(Message message, List messageUsers); 22 | 23 | void read(Integer id); 24 | 25 | Integer unReadCount(Integer userId); 26 | 27 | Message messageDetail(Integer id); 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/event/UserEvent.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.event; 2 | 3 | import com.mindskip.xzs.domain.UserEventLog; 4 | import org.springframework.context.ApplicationEvent; 5 | 6 | /** 7 | * @version 3.5.0 8 | * @description: The type User event. 9 | * Copyright (C), 2020-2024, 武汉思维跳跃科技有限公司 10 | * @date 2021/12/25 9:45 11 | */ 12 | public class UserEvent extends ApplicationEvent { 13 | 14 | private final UserEventLog userEventLog; 15 | 16 | /** 17 | * Instantiates a new User event. 18 | * 19 | * @param userEventLog the user event log 20 | */ 21 | public UserEvent(final UserEventLog userEventLog) { 22 | super(userEventLog); 23 | this.userEventLog = userEventLog; 24 | } 25 | 26 | /** 27 | * Gets user event log. 28 | * 29 | * @return the user event log 30 | */ 31 | public UserEventLog getUserEventLog() { 32 | return userEventLog; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/viewmodel/BaseVM.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.viewmodel; 2 | 3 | import com.mindskip.xzs.utility.ModelMapperSingle; 4 | import org.modelmapper.ModelMapper; 5 | 6 | /** 7 | * @version 3.5.0 8 | * @description: The type Base vm. 9 | * Copyright (C), 2020-2024, 武汉思维跳跃科技有限公司 10 | * @date 2021/12/25 9:45 11 | */ 12 | public class BaseVM { 13 | /** 14 | * The constant modelMapper. 15 | */ 16 | protected static ModelMapper modelMapper = ModelMapperSingle.Instance(); 17 | 18 | 19 | /** 20 | * Gets model mapper. 21 | * 22 | * @return the model mapper 23 | */ 24 | public static ModelMapper getModelMapper() { 25 | return modelMapper; 26 | } 27 | 28 | /** 29 | * Sets model mapper. 30 | * 31 | * @param modelMapper the model mapper 32 | */ 33 | public static void setModelMapper(ModelMapper modelMapper) { 34 | BaseVM.modelMapper = modelMapper; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/viewmodel/student/exam/ExamPaperPageVM.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.viewmodel.student.exam; 2 | 3 | import com.mindskip.xzs.base.BasePage; 4 | 5 | import javax.validation.constraints.NotNull; 6 | 7 | public class ExamPaperPageVM extends BasePage { 8 | @NotNull 9 | private Integer paperType; 10 | private Integer subjectId; 11 | private Integer levelId; 12 | 13 | public Integer getPaperType() { 14 | return paperType; 15 | } 16 | 17 | public void setPaperType(Integer paperType) { 18 | this.paperType = paperType; 19 | } 20 | 21 | public Integer getSubjectId() { 22 | return subjectId; 23 | } 24 | 25 | public void setSubjectId(Integer subjectId) { 26 | this.subjectId = subjectId; 27 | } 28 | 29 | public Integer getLevelId() { 30 | return levelId; 31 | } 32 | 33 | public void setLevelId(Integer levelId) { 34 | this.levelId = levelId; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/repository/ExamPaperAnswerMapper.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.repository; 2 | 3 | import com.mindskip.xzs.domain.ExamPaperAnswer; 4 | import com.mindskip.xzs.domain.other.KeyValue; 5 | import com.mindskip.xzs.viewmodel.student.exampaper.ExamPaperAnswerPageVM; 6 | import org.apache.ibatis.annotations.Mapper; 7 | import org.apache.ibatis.annotations.Param; 8 | 9 | import java.util.Date; 10 | import java.util.List; 11 | 12 | @Mapper 13 | public interface ExamPaperAnswerMapper extends BaseMapper { 14 | 15 | List studentPage(ExamPaperAnswerPageVM requestVM); 16 | 17 | Integer selectAllCount(); 18 | 19 | List selectCountByDate(@Param("startTime") Date startTime, @Param("endTime") Date endTime); 20 | 21 | ExamPaperAnswer getByPidUid(@Param("pid") Integer paperId, @Param("uid") Integer uid); 22 | 23 | List adminPage(com.mindskip.xzs.viewmodel.admin.paper.ExamPaperAnswerPageRequestVM requestVM); 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/viewmodel/student/dashboard/IndexVM.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.viewmodel.student.dashboard; 2 | 3 | 4 | import java.util.List; 5 | 6 | public class IndexVM { 7 | private List fixedPaper; 8 | private List timeLimitPaper; 9 | private List pushPaper; 10 | 11 | public List getFixedPaper() { 12 | return fixedPaper; 13 | } 14 | 15 | public void setFixedPaper(List fixedPaper) { 16 | this.fixedPaper = fixedPaper; 17 | } 18 | 19 | public List getTimeLimitPaper() { 20 | return timeLimitPaper; 21 | } 22 | 23 | public void setTimeLimitPaper(List timeLimitPaper) { 24 | this.timeLimitPaper = timeLimitPaper; 25 | } 26 | 27 | public List getPushPaper() { 28 | return pushPaper; 29 | } 30 | 31 | public void setPushPaper(List pushPaper) { 32 | this.pushPaper = pushPaper; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/XzsApplication.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs; 2 | 3 | import com.mindskip.xzs.configuration.property.SystemConfig; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import org.springframework.boot.context.properties.EnableConfigurationProperties; 7 | import org.springframework.transaction.annotation.EnableTransactionManagement; 8 | 9 | /** 10 | * @version 3.5.0 11 | * @description: The type Xzs application. 12 | * Copyright (C), 2020-2024, 武汉思维跳跃科技有限公司 13 | * @date 2021/12/25 9:45 14 | */ 15 | @SpringBootApplication 16 | @EnableTransactionManagement 17 | @EnableConfigurationProperties(value = { SystemConfig.class}) 18 | public class XzsApplication { 19 | 20 | /** 21 | * The entry point of application. 22 | * 23 | * @param args the input arguments 24 | */ 25 | public static void main(String[] args) { 26 | SpringApplication.run(XzsApplication.class, args); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/viewmodel/student/user/UserRegisterVM.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.viewmodel.student.user; 2 | 3 | 4 | import javax.validation.constraints.NotBlank; 5 | import javax.validation.constraints.NotNull; 6 | 7 | public class UserRegisterVM { 8 | 9 | @NotBlank 10 | private String userName; 11 | 12 | @NotBlank 13 | private String password; 14 | 15 | @NotNull 16 | private Integer userLevel; 17 | 18 | public String getUserName() { 19 | return userName; 20 | } 21 | 22 | public void setUserName(String userName) { 23 | this.userName = userName; 24 | } 25 | 26 | public String getPassword() { 27 | return password; 28 | } 29 | 30 | public void setPassword(String password) { 31 | this.password = password; 32 | } 33 | 34 | public Integer getUserLevel() { 35 | return userLevel; 36 | } 37 | 38 | public void setUserLevel(Integer userLevel) { 39 | this.userLevel = userLevel; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/domain/question/QuestionItemObject.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.domain.question; 2 | 3 | 4 | public class QuestionItemObject { 5 | 6 | private String prefix; 7 | 8 | private String content; 9 | 10 | private Integer score; 11 | 12 | private String itemUuid; 13 | 14 | public String getPrefix() { 15 | return prefix; 16 | } 17 | 18 | public void setPrefix(String prefix) { 19 | this.prefix = prefix; 20 | } 21 | 22 | public String getContent() { 23 | return content; 24 | } 25 | 26 | public void setContent(String content) { 27 | this.content = content; 28 | } 29 | 30 | public Integer getScore() { 31 | return score; 32 | } 33 | 34 | public void setScore(Integer score) { 35 | this.score = score; 36 | } 37 | 38 | public String getItemUuid() { 39 | return itemUuid; 40 | } 41 | 42 | public void setItemUuid(String itemUuid) { 43 | this.itemUuid = itemUuid; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/service/TextContentService.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.service; 2 | 3 | import com.mindskip.xzs.domain.TextContent; 4 | 5 | import java.util.Date; 6 | import java.util.List; 7 | import java.util.function.Function; 8 | 9 | public interface TextContentService extends BaseService { 10 | 11 | /** 12 | * 创建一个TextContent,将内容转化为json,回写到content中,不入库 13 | * 14 | * @param list 15 | * @param now 16 | * @param mapper 17 | * @param 18 | * @param 19 | * @return 20 | */ 21 | TextContent jsonConvertInsert(List list, Date now, Function mapper); 22 | 23 | /** 24 | * 修改一个TextContent,将内容转化为json,回写到content中,不入库 25 | * 26 | * @param textContent 27 | * @param list 28 | * @param mapper 29 | * @param 30 | * @param 31 | * @return 32 | */ 33 | TextContent jsonConvertUpdate(TextContent textContent, List list, Function mapper); 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/service/AuthenticationService.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.service; 2 | 3 | import com.mindskip.xzs.domain.User; 4 | 5 | 6 | public interface AuthenticationService { 7 | 8 | /** 9 | * authUser 10 | * 11 | * @param username username 12 | * @param password password 13 | * @return boolean 14 | */ 15 | boolean authUser(String username, String password); 16 | 17 | 18 | 19 | /** 20 | * authUser 21 | * 22 | * @param user user 23 | * @param username username 24 | * @param password password 25 | * @return boolean 26 | */ 27 | boolean authUser(User user, String username, String password); 28 | 29 | /** 30 | * pwdEncode 31 | * 32 | * @param password password 33 | * @return String 34 | */ 35 | String pwdEncode(String password); 36 | 37 | /** 38 | * pwdDecode 39 | * 40 | * @param endodePwd endodePwd 41 | * @return String 42 | */ 43 | String pwdDecode(String endodePwd); 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/viewmodel/admin/exam/ExamPaperTitleItemVM.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.viewmodel.admin.exam; 2 | 3 | import com.mindskip.xzs.viewmodel.admin.question.QuestionEditRequestVM; 4 | 5 | 6 | import javax.validation.Valid; 7 | import javax.validation.constraints.NotBlank; 8 | import javax.validation.constraints.Size; 9 | import java.util.List; 10 | 11 | 12 | public class ExamPaperTitleItemVM { 13 | 14 | @NotBlank(message = "标题内容不能为空") 15 | private String name; 16 | 17 | @Size(min = 1,message = "请添加题目") 18 | @Valid 19 | private List questionItems; 20 | 21 | public String getName() { 22 | return name; 23 | } 24 | 25 | public void setName(String name) { 26 | this.name = name; 27 | } 28 | 29 | public List getQuestionItems() { 30 | return questionItems; 31 | } 32 | 33 | public void setQuestionItems(List questionItems) { 34 | this.questionItems = questionItems; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/utility/ModelMapperSingle.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.utility; 2 | 3 | import org.modelmapper.ModelMapper; 4 | import org.modelmapper.convention.MatchingStrategies; 5 | 6 | /** 7 | * @version 3.5.0 8 | * @description: The type Model mapper single. 9 | * Copyright (C), 2020-2024, 武汉思维跳跃科技有限公司 10 | * @date 2021/12/25 9:45 11 | */ 12 | public class ModelMapperSingle { 13 | /** 14 | * The constant modelMapper. 15 | */ 16 | protected final static ModelMapper modelMapper = new ModelMapper(); 17 | private final static ModelMapperSingle modelMapperSingle = new ModelMapperSingle(); 18 | 19 | static { 20 | modelMapper.getConfiguration().setFullTypeMatchingRequired(true); 21 | modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT); 22 | } 23 | 24 | /** 25 | * Instance model mapper. 26 | * 27 | * @return the model mapper 28 | */ 29 | public static ModelMapper Instance() { 30 | return modelMapperSingle.modelMapper; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/configuration/spring/security/RestAccessDeniedHandler.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.configuration.spring.security; 2 | 3 | import com.mindskip.xzs.base.SystemCode; 4 | import org.springframework.security.access.AccessDeniedException; 5 | import org.springframework.security.web.access.AccessDeniedHandler; 6 | import org.springframework.stereotype.Component; 7 | 8 | import javax.servlet.ServletException; 9 | import javax.servlet.http.HttpServletRequest; 10 | import javax.servlet.http.HttpServletResponse; 11 | import java.io.IOException; 12 | 13 | 14 | /** 15 | * @version 3.5.0 16 | * @description: 没权限 17 | * Copyright (C), 2020-2024, 武汉思维跳跃科技有限公司 18 | * @date 2021/12/25 9:45 19 | */ 20 | @Component 21 | public class RestAccessDeniedHandler implements AccessDeniedHandler { 22 | @Override 23 | public void handle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, AccessDeniedException e) throws IOException, ServletException { 24 | RestUtil.response(httpServletResponse, SystemCode.AccessDenied); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/viewmodel/admin/education/SubjectResponseVM.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.viewmodel.admin.education; 2 | 3 | import com.mindskip.xzs.viewmodel.BaseVM; 4 | 5 | 6 | 7 | public class SubjectResponseVM extends BaseVM { 8 | private Integer id; 9 | 10 | private String name; 11 | 12 | private Integer level; 13 | 14 | private String levelName; 15 | 16 | public Integer getId() { 17 | return id; 18 | } 19 | 20 | public void setId(Integer id) { 21 | this.id = id; 22 | } 23 | 24 | public String getName() { 25 | return name; 26 | } 27 | 28 | public void setName(String name) { 29 | this.name = name; 30 | } 31 | 32 | public Integer getLevel() { 33 | return level; 34 | } 35 | 36 | public void setLevel(Integer level) { 37 | this.level = level; 38 | } 39 | 40 | public String getLevelName() { 41 | return levelName; 42 | } 43 | 44 | public void setLevelName(String levelName) { 45 | this.levelName = levelName; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/viewmodel/student/dashboard/PaperInfo.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.viewmodel.student.dashboard; 2 | 3 | 4 | import java.util.Date; 5 | 6 | public class PaperInfo { 7 | private Integer id; 8 | private String name; 9 | private Date limitStartTime; 10 | private Date limitEndTime; 11 | 12 | public Integer getId() { 13 | return id; 14 | } 15 | 16 | public void setId(Integer id) { 17 | this.id = id; 18 | } 19 | 20 | public String getName() { 21 | return name; 22 | } 23 | 24 | public void setName(String name) { 25 | this.name = name; 26 | } 27 | 28 | public Date getLimitStartTime() { 29 | return limitStartTime; 30 | } 31 | 32 | public void setLimitStartTime(Date limitStartTime) { 33 | this.limitStartTime = limitStartTime; 34 | } 35 | 36 | public Date getLimitEndTime() { 37 | return limitEndTime; 38 | } 39 | 40 | public void setLimitEndTime(Date limitEndTime) { 41 | this.limitEndTime = limitEndTime; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/service/UserTokenService.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.service; 2 | 3 | import com.mindskip.xzs.domain.User; 4 | import com.mindskip.xzs.domain.UserToken; 5 | 6 | public interface UserTokenService extends BaseService { 7 | 8 | /** 9 | * 微信token绑定 10 | * 11 | * @param user user 12 | * @return UserToken 13 | */ 14 | UserToken bind(User user); 15 | 16 | /** 17 | * 检查微信openId是否绑定过 18 | * 19 | * @param openId openId 20 | * @return UserToken 21 | */ 22 | UserToken checkBind(String openId); 23 | 24 | /** 25 | * 根据token获取UserToken,带缓存的 26 | * 27 | * @param token token 28 | * @return UserToken 29 | */ 30 | UserToken getToken(String token); 31 | 32 | /** 33 | * 插入用户Token 34 | * 35 | * @param user user 36 | * @return UserToken 37 | */ 38 | UserToken insertUserToken(User user); 39 | 40 | /** 41 | * 微信小程序退出,清除缓存 42 | * 43 | * @param userToken userToken 44 | */ 45 | void unBind(UserToken userToken); 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/viewmodel/admin/message/MessageSendVM.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.viewmodel.admin.message; 2 | 3 | 4 | 5 | import javax.validation.constraints.NotBlank; 6 | import javax.validation.constraints.Size; 7 | import java.util.List; 8 | 9 | 10 | public class MessageSendVM { 11 | 12 | @NotBlank 13 | private String title; 14 | @NotBlank 15 | private String content; 16 | 17 | @Size(min = 1, message = "接收人不能为空") 18 | private List receiveUserIds; 19 | 20 | public String getTitle() { 21 | return title; 22 | } 23 | 24 | public void setTitle(String title) { 25 | this.title = title; 26 | } 27 | 28 | public String getContent() { 29 | return content; 30 | } 31 | 32 | public void setContent(String content) { 33 | this.content = content; 34 | } 35 | 36 | public List getReceiveUserIds() { 37 | return receiveUserIds; 38 | } 39 | 40 | public void setReceiveUserIds(List receiveUserIds) { 41 | this.receiveUserIds = receiveUserIds; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/service/BaseService.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.service; 2 | 3 | /** 4 | * service接口,和mybatis generator 配套使用 5 | * 6 | * @param 7 | */ 8 | public interface BaseService { 9 | /** 10 | * 根据id删除数据,硬删除 11 | * 12 | * @param id id 13 | * @return int 14 | */ 15 | int deleteById(Integer id); 16 | 17 | /** 18 | * 插入数据,完整数据插入 19 | * 20 | * @param record record 21 | * @return int 22 | */ 23 | int insert(T record); 24 | 25 | /** 26 | * 插入不为null的数据 27 | * 28 | * @param record 29 | * @return int 30 | */ 31 | int insertByFilter(T record); 32 | 33 | /** 34 | * 根据id查询数据 35 | * 36 | * @param id 37 | * @return 38 | */ 39 | T selectById(Integer id); 40 | 41 | /** 42 | * 更新不为null的数据 43 | * 44 | * @param record 45 | * @return int 46 | */ 47 | int updateByIdFilter(T record); 48 | 49 | /** 50 | * 更新完整的数据 51 | * 52 | * @param record 53 | * @return int 54 | */ 55 | int updateById(T record); 56 | } 57 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/viewmodel/student/dashboard/PaperFilter.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.viewmodel.student.dashboard; 2 | 3 | 4 | import java.util.Date; 5 | 6 | public class PaperFilter { 7 | private Integer userId; 8 | private Date dateTime; 9 | private Integer examPaperType; 10 | private Integer gradeLevel; 11 | 12 | public Integer getUserId() { 13 | return userId; 14 | } 15 | 16 | public void setUserId(Integer userId) { 17 | this.userId = userId; 18 | } 19 | 20 | public Date getDateTime() { 21 | return dateTime; 22 | } 23 | 24 | public void setDateTime(Date dateTime) { 25 | this.dateTime = dateTime; 26 | } 27 | 28 | public Integer getExamPaperType() { 29 | return examPaperType; 30 | } 31 | 32 | public void setExamPaperType(Integer examPaperType) { 33 | this.examPaperType = examPaperType; 34 | } 35 | 36 | public Integer getGradeLevel() { 37 | return gradeLevel; 38 | } 39 | 40 | public void setGradeLevel(Integer gradeLevel) { 41 | this.gradeLevel = gradeLevel; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/domain/enums/UserStatusEnum.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.domain.enums; 2 | 3 | 4 | import java.util.HashMap; 5 | import java.util.Map; 6 | 7 | public enum UserStatusEnum { 8 | 9 | Enable(1, "启用"), 10 | Disable(2, "禁用"); 11 | 12 | int code; 13 | String name; 14 | 15 | UserStatusEnum(int code, String name) { 16 | this.code = code; 17 | this.name = name; 18 | } 19 | 20 | private static final Map keyMap = new HashMap<>(); 21 | 22 | static { 23 | for (UserStatusEnum item : UserStatusEnum.values()) { 24 | keyMap.put(item.getCode(), item); 25 | } 26 | } 27 | 28 | public static UserStatusEnum fromCode(Integer code) { 29 | return keyMap.get(code); 30 | } 31 | 32 | public int getCode() { 33 | return code; 34 | } 35 | 36 | public void setCode(int code) { 37 | this.code = code; 38 | } 39 | 40 | public String getName() { 41 | return name; 42 | } 43 | 44 | public void setName(String name) { 45 | this.name = name; 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/viewmodel/admin/question/QuestionEditItemVM.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.viewmodel.admin.question; 2 | 3 | 4 | import javax.validation.constraints.NotBlank; 5 | 6 | 7 | public class QuestionEditItemVM { 8 | @NotBlank 9 | private String prefix; 10 | @NotBlank 11 | private String content; 12 | 13 | private String score; 14 | 15 | private String itemUuid; 16 | 17 | public String getPrefix() { 18 | return prefix; 19 | } 20 | 21 | public void setPrefix(String prefix) { 22 | this.prefix = prefix; 23 | } 24 | 25 | public String getContent() { 26 | return content; 27 | } 28 | 29 | public void setContent(String content) { 30 | this.content = content; 31 | } 32 | 33 | public String getScore() { 34 | return score; 35 | } 36 | 37 | public void setScore(String score) { 38 | this.score = score; 39 | } 40 | 41 | public String getItemUuid() { 42 | return itemUuid; 43 | } 44 | 45 | public void setItemUuid(String itemUuid) { 46 | this.itemUuid = itemUuid; 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/base/BasePage.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.base; 2 | 3 | /** 4 | * @version 3.3.0 5 | * @description: The type Base page. 6 | * Copyright (C), 2020-2024, 武汉思维跳跃科技有限公司 7 | * @date 2021/5/25 10:45 8 | */ 9 | public class BasePage { 10 | 11 | private Integer pageIndex; 12 | 13 | private Integer pageSize; 14 | 15 | /** 16 | * Gets page index. 17 | * 18 | * @return the page index 19 | */ 20 | public Integer getPageIndex() { 21 | return pageIndex; 22 | } 23 | 24 | /** 25 | * Sets page index. 26 | * 27 | * @param pageIndex the page index 28 | */ 29 | public void setPageIndex(Integer pageIndex) { 30 | this.pageIndex = pageIndex; 31 | } 32 | 33 | /** 34 | * Gets page size. 35 | * 36 | * @return the page size 37 | */ 38 | public Integer getPageSize() { 39 | return pageSize; 40 | } 41 | 42 | /** 43 | * Sets page size. 44 | * 45 | * @param pageSize the page size 46 | */ 47 | public void setPageSize(Integer pageSize) { 48 | this.pageSize = pageSize; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/base/BaseApiController.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.base; 2 | 3 | 4 | import com.mindskip.xzs.context.WebContext; 5 | import com.mindskip.xzs.domain.User; 6 | import com.mindskip.xzs.utility.ModelMapperSingle; 7 | import org.modelmapper.ModelMapper; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | 10 | /** 11 | * @version 3.3.0 12 | * @description: The type Base api controller. 13 | * Copyright (C), 2019-2024, 武汉思维跳跃科技有限公司 14 | * @date 2021 /5/26 10:45 15 | */ 16 | public class BaseApiController { 17 | /** 18 | * The constant DEFAULT_PAGE_SIZE. 19 | */ 20 | protected final static String DEFAULT_PAGE_SIZE = "10"; 21 | /** 22 | * The constant modelMapper. 23 | */ 24 | protected final static ModelMapper modelMapper = ModelMapperSingle.Instance(); 25 | /** 26 | * The Web context. 27 | */ 28 | @Autowired 29 | protected WebContext webContext; 30 | 31 | /** 32 | * Gets current user. 33 | * 34 | * @return the current user 35 | */ 36 | protected User getCurrentUser() { 37 | return webContext.getCurrentUser(); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/configuration/spring/security/RestAuthenticationFailureHandler.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.configuration.spring.security; 2 | 3 | import com.mindskip.xzs.base.SystemCode; 4 | import org.springframework.security.core.AuthenticationException; 5 | import org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler; 6 | import org.springframework.stereotype.Component; 7 | 8 | import javax.servlet.ServletException; 9 | import javax.servlet.http.HttpServletRequest; 10 | import javax.servlet.http.HttpServletResponse; 11 | import java.io.IOException; 12 | 13 | 14 | /** 15 | * @version 3.5.0 16 | * @description: 账号验证异常 17 | * Copyright (C), 2020-2024, 武汉思维跳跃科技有限公司 18 | * @date 2021/12/25 9:45 19 | */ 20 | @Component 21 | public class RestAuthenticationFailureHandler extends SimpleUrlAuthenticationFailureHandler { 22 | 23 | @Override 24 | public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response, AuthenticationException exception) throws IOException, ServletException { 25 | RestUtil.response(response, SystemCode.AuthError.getCode(), exception.getMessage()); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/viewmodel/student/dashboard/TaskItemPaperVm.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.viewmodel.student.dashboard; 2 | 3 | 4 | public class TaskItemPaperVm { 5 | private Integer examPaperId; 6 | private String examPaperName; 7 | private Integer examPaperAnswerId; 8 | private Integer status; 9 | 10 | public Integer getExamPaperId() { 11 | return examPaperId; 12 | } 13 | 14 | public void setExamPaperId(Integer examPaperId) { 15 | this.examPaperId = examPaperId; 16 | } 17 | 18 | public String getExamPaperName() { 19 | return examPaperName; 20 | } 21 | 22 | public void setExamPaperName(String examPaperName) { 23 | this.examPaperName = examPaperName; 24 | } 25 | 26 | public Integer getExamPaperAnswerId() { 27 | return examPaperAnswerId; 28 | } 29 | 30 | public void setExamPaperAnswerId(Integer examPaperAnswerId) { 31 | this.examPaperAnswerId = examPaperAnswerId; 32 | } 33 | 34 | public Integer getStatus() { 35 | return status; 36 | } 37 | 38 | public void setStatus(Integer status) { 39 | this.status = status; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/domain/ExamPaperAnswerInfo.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.domain; 2 | 3 | 4 | import java.util.List; 5 | 6 | public class ExamPaperAnswerInfo { 7 | public ExamPaper examPaper; 8 | public ExamPaperAnswer examPaperAnswer; 9 | public List examPaperQuestionCustomerAnswers; 10 | 11 | public ExamPaper getExamPaper() { 12 | return examPaper; 13 | } 14 | 15 | public void setExamPaper(ExamPaper examPaper) { 16 | this.examPaper = examPaper; 17 | } 18 | 19 | public ExamPaperAnswer getExamPaperAnswer() { 20 | return examPaperAnswer; 21 | } 22 | 23 | public void setExamPaperAnswer(ExamPaperAnswer examPaperAnswer) { 24 | this.examPaperAnswer = examPaperAnswer; 25 | } 26 | 27 | public List getExamPaperQuestionCustomerAnswers() { 28 | return examPaperQuestionCustomerAnswers; 29 | } 30 | 31 | public void setExamPaperQuestionCustomerAnswers(List examPaperQuestionCustomerAnswers) { 32 | this.examPaperQuestionCustomerAnswers = examPaperQuestionCustomerAnswers; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/repository/ExamPaperQuestionCustomerAnswerMapper.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.repository; 2 | 3 | import com.mindskip.xzs.domain.ExamPaperQuestionCustomerAnswer; 4 | import com.mindskip.xzs.domain.other.ExamPaperAnswerUpdate; 5 | import com.mindskip.xzs.domain.other.KeyValue; 6 | import com.mindskip.xzs.viewmodel.student.question.answer.QuestionPageStudentRequestVM; 7 | import org.apache.ibatis.annotations.Mapper; 8 | import org.apache.ibatis.annotations.Param; 9 | 10 | import java.util.Date; 11 | import java.util.List; 12 | 13 | @Mapper 14 | public interface ExamPaperQuestionCustomerAnswerMapper extends BaseMapper { 15 | 16 | List selectListByPaperAnswerId(Integer id); 17 | 18 | List studentPage(QuestionPageStudentRequestVM requestVM); 19 | 20 | int insertList(List list); 21 | 22 | Integer selectAllCount(); 23 | 24 | List selectCountByDate(@Param("startTime") Date startTime, @Param("endTime") Date endTime); 25 | 26 | int updateScore(List examPaperAnswerUpdates); 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/domain/enums/RoleEnum.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.domain.enums; 2 | 3 | 4 | import java.util.HashMap; 5 | import java.util.Map; 6 | 7 | public enum RoleEnum { 8 | 9 | STUDENT(1, "STUDENT"), 10 | ADMIN(3, "ADMIN"); 11 | 12 | int code; 13 | String name; 14 | 15 | RoleEnum(int code, String name) { 16 | this.code = code; 17 | this.name = name; 18 | } 19 | 20 | private static final Map keyMap = new HashMap<>(); 21 | 22 | static { 23 | for (RoleEnum item : RoleEnum.values()) { 24 | keyMap.put(item.getCode(), item); 25 | } 26 | } 27 | 28 | public static RoleEnum fromCode(Integer code) { 29 | return keyMap.get(code); 30 | } 31 | 32 | public int getCode() { 33 | return code; 34 | } 35 | 36 | public void setCode(int code) { 37 | this.code = code; 38 | } 39 | 40 | public String getName() { 41 | return name; 42 | } 43 | 44 | public void setName(String name) { 45 | this.name = name; 46 | } 47 | 48 | public String getRoleName() { 49 | return "ROLE_" + name; 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/domain/enums/ExamPaperTypeEnum.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.domain.enums; 2 | 3 | import java.util.HashMap; 4 | import java.util.Map; 5 | 6 | public enum ExamPaperTypeEnum { 7 | 8 | Fixed(1, "固定试卷"), 9 | TimeLimit(4, "时段试卷"), 10 | Task(6, "任务试卷"); 11 | 12 | int code; 13 | String name; 14 | 15 | ExamPaperTypeEnum(int code, String name) { 16 | this.code = code; 17 | this.name = name; 18 | } 19 | 20 | 21 | private static final Map keyMap = new HashMap<>(); 22 | 23 | static { 24 | for (ExamPaperTypeEnum item : ExamPaperTypeEnum.values()) { 25 | keyMap.put(item.getCode(), item); 26 | } 27 | } 28 | 29 | public static ExamPaperTypeEnum fromCode(Integer code) { 30 | return keyMap.get(code); 31 | } 32 | 33 | 34 | public int getCode() { 35 | return code; 36 | } 37 | 38 | public void setCode(int code) { 39 | this.code = code; 40 | } 41 | 42 | public String getName() { 43 | return name; 44 | } 45 | 46 | public void setName(String name) { 47 | this.name = name; 48 | } 49 | 50 | 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/configuration/spring/security/RestTokenBasedRememberMeServices.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.configuration.spring.security; 2 | 3 | import org.springframework.security.core.userdetails.UserDetailsService; 4 | import org.springframework.security.web.authentication.rememberme.TokenBasedRememberMeServices; 5 | 6 | import javax.servlet.http.HttpServletRequest; 7 | 8 | 9 | /** 10 | * @version 3.5.0 11 | * @description: 记住我,Cookie 12 | * Copyright (C), 2020-2024, 武汉思维跳跃科技有限公司 13 | * @date 2021/12/25 9:45 14 | */ 15 | public class RestTokenBasedRememberMeServices extends TokenBasedRememberMeServices { 16 | /** 17 | * Instantiates a new Rest token based remember me services. 18 | * 19 | * @param key the key 20 | * @param userDetailsService the user details service 21 | */ 22 | public RestTokenBasedRememberMeServices(String key, UserDetailsService userDetailsService) { 23 | super(key, userDetailsService); 24 | } 25 | 26 | @Override 27 | protected boolean rememberMeRequested(HttpServletRequest request, String parameter) { 28 | return (boolean) request.getAttribute(DEFAULT_PARAMETER); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/listener/UserLogListener.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.listener; 2 | 3 | import com.mindskip.xzs.event.UserEvent; 4 | import com.mindskip.xzs.service.UserEventLogService; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.context.ApplicationListener; 7 | import org.springframework.stereotype.Component; 8 | 9 | /** 10 | * @version 3.5.0 11 | * @description: The type User log listener. 12 | * Copyright (C), 2020-2024, 武汉思维跳跃科技有限公司 13 | * @date 2021/12/25 9:45 14 | */ 15 | @Component 16 | public class UserLogListener implements ApplicationListener { 17 | 18 | private final UserEventLogService userEventLogService; 19 | 20 | /** 21 | * Instantiates a new User log listener. 22 | * 23 | * @param userEventLogService the user event log service 24 | */ 25 | @Autowired 26 | public UserLogListener(UserEventLogService userEventLogService) { 27 | this.userEventLogService = userEventLogService; 28 | } 29 | 30 | @Override 31 | public void onApplicationEvent(UserEvent userEvent) { 32 | userEventLogService.insertByFilter(userEvent.getUserEventLog()); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/domain/task/TaskItemAnswerObject.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.domain.task; 2 | 3 | 4 | public class TaskItemAnswerObject { 5 | private Integer examPaperId; 6 | private Integer examPaperAnswerId; 7 | private Integer status; 8 | 9 | public TaskItemAnswerObject(){ 10 | 11 | } 12 | 13 | public TaskItemAnswerObject(Integer examPaperId, Integer examPaperAnswerId, Integer status) { 14 | this.examPaperId = examPaperId; 15 | this.examPaperAnswerId = examPaperAnswerId; 16 | this.status = status; 17 | } 18 | 19 | public Integer getExamPaperId() { 20 | return examPaperId; 21 | } 22 | 23 | public void setExamPaperId(Integer examPaperId) { 24 | this.examPaperId = examPaperId; 25 | } 26 | 27 | public Integer getExamPaperAnswerId() { 28 | return examPaperAnswerId; 29 | } 30 | 31 | public void setExamPaperAnswerId(Integer examPaperAnswerId) { 32 | this.examPaperAnswerId = examPaperAnswerId; 33 | } 34 | 35 | public Integer getStatus() { 36 | return status; 37 | } 38 | 39 | public void setStatus(Integer status) { 40 | this.status = status; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/event/CalculateExamPaperAnswerCompleteEvent.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.event; 2 | 3 | import com.mindskip.xzs.domain.ExamPaperAnswerInfo; 4 | import org.springframework.context.ApplicationEvent; 5 | 6 | /** 7 | * @version 3.3.0 8 | * @description: The type Calculate exam paper answer complete event. 9 | * Copyright (C), 2020-2024, 武汉思维跳跃科技有限公司 10 | * @date 2021/5/25 10:45 11 | */ 12 | public class CalculateExamPaperAnswerCompleteEvent extends ApplicationEvent { 13 | 14 | 15 | private final ExamPaperAnswerInfo examPaperAnswerInfo; 16 | 17 | 18 | /** 19 | * Instantiates a new Calculate exam paper answer complete event. 20 | * 21 | * @param examPaperAnswerInfo the exam paper answer info 22 | */ 23 | public CalculateExamPaperAnswerCompleteEvent(final ExamPaperAnswerInfo examPaperAnswerInfo) { 24 | super(examPaperAnswerInfo); 25 | this.examPaperAnswerInfo = examPaperAnswerInfo; 26 | } 27 | 28 | /** 29 | * Gets exam paper answer info. 30 | * 31 | * @return the exam paper answer info 32 | */ 33 | public ExamPaperAnswerInfo getExamPaperAnswerInfo() { 34 | return examPaperAnswerInfo; 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/domain/enums/ExamPaperAnswerStatusEnum.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.domain.enums; 2 | 3 | import java.util.HashMap; 4 | import java.util.Map; 5 | 6 | public enum ExamPaperAnswerStatusEnum { 7 | 8 | WaitJudge(1, "待批改"), 9 | Complete(2, "完成"); 10 | 11 | int code; 12 | String name; 13 | 14 | ExamPaperAnswerStatusEnum(int code, String name) { 15 | this.code = code; 16 | this.name = name; 17 | } 18 | 19 | 20 | public int getCode() { 21 | return code; 22 | } 23 | 24 | public void setCode(int code) { 25 | this.code = code; 26 | } 27 | 28 | public String getName() { 29 | return name; 30 | } 31 | 32 | public void setName(String name) { 33 | this.name = name; 34 | } 35 | 36 | 37 | private static final Map keyMap = new HashMap<>(); 38 | 39 | static { 40 | for (ExamPaperAnswerStatusEnum item : ExamPaperAnswerStatusEnum.values()) { 41 | keyMap.put(item.getCode(), item); 42 | } 43 | } 44 | 45 | public static ExamPaperAnswerStatusEnum fromCode(Integer code) { 46 | return keyMap.get(code); 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/service/ExamPaperService.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.service; 2 | 3 | import com.mindskip.xzs.domain.ExamPaper; 4 | import com.mindskip.xzs.domain.User; 5 | import com.mindskip.xzs.viewmodel.admin.exam.ExamPaperEditRequestVM; 6 | import com.mindskip.xzs.viewmodel.admin.exam.ExamPaperPageRequestVM; 7 | import com.mindskip.xzs.viewmodel.student.dashboard.PaperFilter; 8 | import com.mindskip.xzs.viewmodel.student.dashboard.PaperInfo; 9 | import com.mindskip.xzs.viewmodel.student.exam.ExamPaperPageVM; 10 | import com.github.pagehelper.PageInfo; 11 | 12 | import java.util.List; 13 | 14 | public interface ExamPaperService extends BaseService { 15 | 16 | PageInfo page(ExamPaperPageRequestVM requestVM); 17 | 18 | PageInfo taskExamPage(ExamPaperPageRequestVM requestVM); 19 | 20 | PageInfo studentPage(ExamPaperPageVM requestVM); 21 | 22 | ExamPaper savePaperFromVM(ExamPaperEditRequestVM examPaperEditRequestVM, User user); 23 | 24 | ExamPaperEditRequestVM examPaperToVM(Integer id); 25 | 26 | List indexPaper(PaperFilter paperFilter); 27 | 28 | Integer selectAllCount(); 29 | 30 | List selectMothCount(); 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/configuration/property/PasswordKeyConfig.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.configuration.property; 2 | 3 | /** 4 | * @version 3.5.0 5 | * @description: The type Password key config. 6 | * Copyright (C), 2020-2024, 武汉思维跳跃科技有限公司 7 | * @date 2021/12/25 9:45 8 | */ 9 | public class PasswordKeyConfig { 10 | private String publicKey; 11 | 12 | private String privateKey; 13 | 14 | /** 15 | * Gets public key. 16 | * 17 | * @return the public key 18 | */ 19 | public String getPublicKey() { 20 | return publicKey; 21 | } 22 | 23 | /** 24 | * Sets public key. 25 | * 26 | * @param publicKey the public key 27 | */ 28 | public void setPublicKey(String publicKey) { 29 | this.publicKey = publicKey; 30 | } 31 | 32 | /** 33 | * Gets private key. 34 | * 35 | * @return the private key 36 | */ 37 | public String getPrivateKey() { 38 | return privateKey; 39 | } 40 | 41 | /** 42 | * Sets private key. 43 | * 44 | * @param privateKey the private key 45 | */ 46 | public void setPrivateKey(String privateKey) { 47 | this.privateKey = privateKey; 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/viewmodel/student/education/SubjectEditRequestVM.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.viewmodel.student.education; 2 | 3 | import com.mindskip.xzs.viewmodel.BaseVM; 4 | 5 | import javax.validation.constraints.NotBlank; 6 | import javax.validation.constraints.NotNull; 7 | 8 | public class SubjectEditRequestVM extends BaseVM { 9 | 10 | private Integer id; 11 | 12 | @NotBlank 13 | private String name; 14 | 15 | @NotNull 16 | private Integer level; 17 | 18 | @NotBlank 19 | private String levelName; 20 | 21 | public Integer getId() { 22 | return id; 23 | } 24 | 25 | public void setId(Integer id) { 26 | this.id = id; 27 | } 28 | 29 | public String getName() { 30 | return name; 31 | } 32 | 33 | public void setName(String name) { 34 | this.name = name; 35 | } 36 | 37 | public Integer getLevel() { 38 | return level; 39 | } 40 | 41 | public void setLevel(Integer level) { 42 | this.level = level; 43 | } 44 | 45 | public String getLevelName() { 46 | return levelName; 47 | } 48 | 49 | public void setLevelName(String levelName) { 50 | this.levelName = levelName; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/domain/question/QuestionObject.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.domain.question; 2 | 3 | 4 | 5 | import java.util.List; 6 | 7 | public class QuestionObject { 8 | 9 | private String titleContent; 10 | 11 | private String analyze; 12 | 13 | private List questionItemObjects; 14 | 15 | private String correct; 16 | 17 | public String getTitleContent() { 18 | return titleContent; 19 | } 20 | 21 | public void setTitleContent(String titleContent) { 22 | this.titleContent = titleContent; 23 | } 24 | 25 | public String getAnalyze() { 26 | return analyze; 27 | } 28 | 29 | public void setAnalyze(String analyze) { 30 | this.analyze = analyze; 31 | } 32 | 33 | public List getQuestionItemObjects() { 34 | return questionItemObjects; 35 | } 36 | 37 | public void setQuestionItemObjects(List questionItemObjects) { 38 | this.questionItemObjects = questionItemObjects; 39 | } 40 | 41 | public String getCorrect() { 42 | return correct; 43 | } 44 | 45 | public void setCorrect(String correct) { 46 | this.correct = correct; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/viewmodel/admin/education/SubjectEditRequestVM.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.viewmodel.admin.education; 2 | 3 | import com.mindskip.xzs.viewmodel.BaseVM; 4 | 5 | 6 | import javax.validation.constraints.NotBlank; 7 | import javax.validation.constraints.NotNull; 8 | 9 | 10 | public class SubjectEditRequestVM extends BaseVM { 11 | 12 | private Integer id; 13 | 14 | @NotBlank 15 | private String name; 16 | 17 | @NotNull 18 | private Integer level; 19 | 20 | @NotBlank 21 | private String levelName; 22 | 23 | public Integer getId() { 24 | return id; 25 | } 26 | 27 | public void setId(Integer id) { 28 | this.id = id; 29 | } 30 | 31 | public String getName() { 32 | return name; 33 | } 34 | 35 | public void setName(String name) { 36 | this.name = name; 37 | } 38 | 39 | public Integer getLevel() { 40 | return level; 41 | } 42 | 43 | public void setLevel(Integer level) { 44 | this.level = level; 45 | } 46 | 47 | public String getLevelName() { 48 | return levelName; 49 | } 50 | 51 | public void setLevelName(String levelName) { 52 | this.levelName = levelName; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/service/impl/BaseServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.service.impl; 2 | 3 | import com.mindskip.xzs.repository.BaseMapper; 4 | import com.mindskip.xzs.service.BaseService; 5 | 6 | public abstract class BaseServiceImpl implements BaseService { 7 | 8 | private final BaseMapper baseMapper; 9 | 10 | public BaseServiceImpl(BaseMapper baseMapper) { 11 | this.baseMapper = baseMapper; 12 | } 13 | 14 | @Override 15 | public int deleteById(Integer id) { 16 | return baseMapper.deleteByPrimaryKey(id); 17 | } 18 | 19 | @Override 20 | public int insert(T record) { 21 | return baseMapper.insert(record); 22 | } 23 | 24 | @Override 25 | public int insertByFilter(T record) { 26 | return baseMapper.insertSelective(record); 27 | } 28 | 29 | @Override 30 | public T selectById(Integer id) { 31 | return baseMapper.selectByPrimaryKey(id); 32 | } 33 | 34 | @Override 35 | public int updateByIdFilter(T record) { 36 | return baseMapper.updateByPrimaryKeySelective(record); 37 | } 38 | 39 | @Override 40 | public int updateById(T record) { 41 | return baseMapper.updateByPrimaryKey(record); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/domain/TextContent.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.domain; 2 | 3 | import java.io.Serializable; 4 | import java.util.Date; 5 | 6 | public class TextContent implements Serializable { 7 | 8 | private static final long serialVersionUID = -1279530310964668131L; 9 | 10 | public TextContent(){ 11 | 12 | } 13 | 14 | public TextContent(String content, Date createTime) { 15 | this.content = content; 16 | this.createTime = createTime; 17 | } 18 | 19 | private Integer id; 20 | 21 | /** 22 | * 内容(Json) 23 | */ 24 | private String content; 25 | 26 | /** 27 | * 创建时间 28 | */ 29 | private Date createTime; 30 | 31 | public Integer getId() { 32 | return id; 33 | } 34 | 35 | public void setId(Integer id) { 36 | this.id = id; 37 | } 38 | 39 | public String getContent() { 40 | return content; 41 | } 42 | 43 | public void setContent(String content) { 44 | this.content = content == null ? null : content.trim(); 45 | } 46 | 47 | public Date getCreateTime() { 48 | return createTime; 49 | } 50 | 51 | public void setCreateTime(Date createTime) { 52 | this.createTime = createTime; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/viewmodel/student/exam/ExamPaperSubmitVM.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.viewmodel.student.exam; 2 | 3 | 4 | import javax.validation.Valid; 5 | import javax.validation.constraints.NotNull; 6 | import java.util.List; 7 | 8 | 9 | public class ExamPaperSubmitVM { 10 | 11 | @NotNull 12 | private Integer id; 13 | 14 | @NotNull 15 | private Integer doTime; 16 | 17 | private String score; 18 | 19 | @NotNull 20 | @Valid 21 | private List answerItems; 22 | 23 | public Integer getId() { 24 | return id; 25 | } 26 | 27 | public void setId(Integer id) { 28 | this.id = id; 29 | } 30 | 31 | public Integer getDoTime() { 32 | return doTime; 33 | } 34 | 35 | public void setDoTime(Integer doTime) { 36 | this.doTime = doTime; 37 | } 38 | 39 | public String getScore() { 40 | return score; 41 | } 42 | 43 | public void setScore(String score) { 44 | this.score = score; 45 | } 46 | 47 | public List getAnswerItems() { 48 | return answerItems; 49 | } 50 | 51 | public void setAnswerItems(List answerItems) { 52 | this.answerItems = answerItems; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/utility/HtmlUtil.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.utility; 2 | 3 | import java.util.regex.Matcher; 4 | import java.util.regex.Pattern; 5 | 6 | 7 | /** 8 | * @version 3.5.0 9 | * @description: The type Html util. 10 | * Copyright (C), 2020-2024, 武汉思维跳跃科技有限公司 11 | * @date 2021/12/25 9:45 12 | */ 13 | public class HtmlUtil { 14 | /** 15 | * Clear string. 16 | * 17 | * @param htmlStr the html str 18 | * @return the string 19 | */ 20 | public static String clear(String htmlStr) { 21 | String regEx_script = "]*?>[\\s\\S]*?<\\/script>"; 22 | String regEx_style = "]*?>[\\s\\S]*?<\\/style>"; 23 | String regEx_html = "<[^>]+>"; 24 | Pattern p_script = Pattern.compile(regEx_script, Pattern.CASE_INSENSITIVE); 25 | Matcher m_script = p_script.matcher(htmlStr); 26 | htmlStr = m_script.replaceAll(""); 27 | Pattern p_style = Pattern.compile(regEx_style, Pattern.CASE_INSENSITIVE); 28 | Matcher m_style = p_style.matcher(htmlStr); 29 | htmlStr = m_style.replaceAll(""); 30 | Pattern p_html = Pattern.compile(regEx_html, Pattern.CASE_INSENSITIVE); 31 | Matcher m_html = p_html.matcher(htmlStr); 32 | htmlStr = m_html.replaceAll(""); 33 | return htmlStr.trim(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/configuration/spring/security/LoginAuthenticationEntryPoint.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.configuration.spring.security; 2 | 3 | import com.mindskip.xzs.base.SystemCode; 4 | import org.springframework.security.core.AuthenticationException; 5 | import org.springframework.security.web.authentication.LoginUrlAuthenticationEntryPoint; 6 | import org.springframework.stereotype.Component; 7 | 8 | import javax.servlet.ServletException; 9 | import javax.servlet.http.HttpServletRequest; 10 | import javax.servlet.http.HttpServletResponse; 11 | import java.io.IOException; 12 | 13 | /** 14 | * @version 3.5.0 15 | * @description: 未登录 16 | * Copyright (C), 2020-2024, 武汉思维跳跃科技有限公司 17 | * @date 2021/12/25 9:45 18 | */ 19 | @Component 20 | public final class LoginAuthenticationEntryPoint extends LoginUrlAuthenticationEntryPoint { 21 | 22 | /** 23 | * Instantiates a new Login authentication entry point. 24 | */ 25 | public LoginAuthenticationEntryPoint() { 26 | super("/api/user/login"); 27 | } 28 | 29 | @Override 30 | public void commence(HttpServletRequest request, HttpServletResponse response, 31 | AuthenticationException authException) throws IOException, ServletException { 32 | RestUtil.response(response, SystemCode.UNAUTHORIZED); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/repository/ExamPaperMapper.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.repository; 2 | 3 | import com.mindskip.xzs.domain.ExamPaper; 4 | import com.mindskip.xzs.domain.other.KeyValue; 5 | import com.mindskip.xzs.viewmodel.admin.exam.ExamPaperPageRequestVM; 6 | import com.mindskip.xzs.viewmodel.student.dashboard.PaperFilter; 7 | import com.mindskip.xzs.viewmodel.student.dashboard.PaperInfo; 8 | import com.mindskip.xzs.viewmodel.student.exam.ExamPaperPageVM; 9 | import org.apache.ibatis.annotations.Mapper; 10 | import org.apache.ibatis.annotations.Param; 11 | 12 | import java.util.Date; 13 | import java.util.List; 14 | 15 | @Mapper 16 | public interface ExamPaperMapper extends BaseMapper { 17 | 18 | List page(ExamPaperPageRequestVM requestVM); 19 | 20 | List taskExamPage(ExamPaperPageRequestVM requestVM); 21 | 22 | List studentPage(ExamPaperPageVM requestVM); 23 | 24 | List indexPaper(PaperFilter paperFilter); 25 | 26 | Integer selectAllCount(); 27 | 28 | List selectCountByDate(@Param("startTime") Date startTime, @Param("endTime") Date endTime); 29 | 30 | int updateTaskPaper(@Param("taskId") Integer taskId,@Param("paperIds") List paperIds); 31 | 32 | int clearTaskPaper(@Param("paperIds") List paperIds); 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/viewmodel/admin/exam/ExamPaperPageRequestVM.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.viewmodel.admin.exam; 2 | 3 | import com.mindskip.xzs.base.BasePage; 4 | 5 | 6 | 7 | public class ExamPaperPageRequestVM extends BasePage { 8 | 9 | private Integer id; 10 | private Integer subjectId; 11 | private Integer level; 12 | private Integer paperType; 13 | private Integer taskExamId; 14 | 15 | public Integer getId() { 16 | return id; 17 | } 18 | 19 | public void setId(Integer id) { 20 | this.id = id; 21 | } 22 | 23 | public Integer getSubjectId() { 24 | return subjectId; 25 | } 26 | 27 | public void setSubjectId(Integer subjectId) { 28 | this.subjectId = subjectId; 29 | } 30 | 31 | public Integer getLevel() { 32 | return level; 33 | } 34 | 35 | public void setLevel(Integer level) { 36 | this.level = level; 37 | } 38 | 39 | public Integer getPaperType() { 40 | return paperType; 41 | } 42 | 43 | public void setPaperType(Integer paperType) { 44 | this.paperType = paperType; 45 | } 46 | 47 | public Integer getTaskExamId() { 48 | return taskExamId; 49 | } 50 | 51 | public void setTaskExamId(Integer taskExamId) { 52 | this.taskExamId = taskExamId; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/viewmodel/admin/question/QuestionPageRequestVM.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.viewmodel.admin.question; 2 | 3 | import com.mindskip.xzs.base.BasePage; 4 | 5 | 6 | 7 | public class QuestionPageRequestVM extends BasePage { 8 | 9 | private Integer id; 10 | private Integer level; 11 | private Integer subjectId; 12 | private Integer questionType; 13 | private String content; 14 | 15 | 16 | public Integer getId() { 17 | return id; 18 | } 19 | 20 | public void setId(Integer id) { 21 | this.id = id; 22 | } 23 | 24 | public Integer getLevel() { 25 | return level; 26 | } 27 | 28 | public void setLevel(Integer level) { 29 | this.level = level; 30 | } 31 | 32 | public Integer getSubjectId() { 33 | return subjectId; 34 | } 35 | 36 | public void setSubjectId(Integer subjectId) { 37 | this.subjectId = subjectId; 38 | } 39 | 40 | public Integer getQuestionType() { 41 | return questionType; 42 | } 43 | 44 | public void setQuestionType(Integer questionType) { 45 | this.questionType = questionType; 46 | } 47 | 48 | public String getContent() { 49 | return content; 50 | } 51 | 52 | public void setContent(String content) { 53 | this.content = content; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/viewmodel/admin/file/UploadResultVM.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.viewmodel.admin.file; 2 | 3 | 4 | 5 | 6 | public class UploadResultVM { 7 | private String original; 8 | private String name; 9 | private String url; 10 | private Long size; 11 | private String type; 12 | private String state; 13 | 14 | public String getOriginal() { 15 | return original; 16 | } 17 | 18 | public void setOriginal(String original) { 19 | this.original = original; 20 | } 21 | 22 | public String getName() { 23 | return name; 24 | } 25 | 26 | public void setName(String name) { 27 | this.name = name; 28 | } 29 | 30 | public String getUrl() { 31 | return url; 32 | } 33 | 34 | public void setUrl(String url) { 35 | this.url = url; 36 | } 37 | 38 | public Long getSize() { 39 | return size; 40 | } 41 | 42 | public void setSize(Long size) { 43 | this.size = size; 44 | } 45 | 46 | public String getType() { 47 | return type; 48 | } 49 | 50 | public void setType(String type) { 51 | this.type = type; 52 | } 53 | 54 | public String getState() { 55 | return state; 56 | } 57 | 58 | public void setState(String state) { 59 | this.state = state; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/viewmodel/student/question/answer/QuestionPageStudentResponseVM.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.viewmodel.student.question.answer; 2 | 3 | 4 | public class QuestionPageStudentResponseVM { 5 | private Integer id; 6 | 7 | private Integer questionType; 8 | 9 | private String createTime; 10 | 11 | private String subjectName; 12 | 13 | private String shortTitle; 14 | 15 | public Integer getId() { 16 | return id; 17 | } 18 | 19 | public void setId(Integer id) { 20 | this.id = id; 21 | } 22 | 23 | public Integer getQuestionType() { 24 | return questionType; 25 | } 26 | 27 | public void setQuestionType(Integer questionType) { 28 | this.questionType = questionType; 29 | } 30 | 31 | public String getCreateTime() { 32 | return createTime; 33 | } 34 | 35 | public void setCreateTime(String createTime) { 36 | this.createTime = createTime; 37 | } 38 | 39 | public String getSubjectName() { 40 | return subjectName; 41 | } 42 | 43 | public void setSubjectName(String subjectName) { 44 | this.subjectName = subjectName; 45 | } 46 | 47 | public String getShortTitle() { 48 | return shortTitle; 49 | } 50 | 51 | public void setShortTitle(String shortTitle) { 52 | this.shortTitle = shortTitle; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/viewmodel/admin/task/TaskRequestVM.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.viewmodel.admin.task; 2 | 3 | import com.mindskip.xzs.viewmodel.admin.exam.ExamResponseVM; 4 | 5 | 6 | import javax.validation.Valid; 7 | import javax.validation.constraints.NotNull; 8 | import javax.validation.constraints.Size; 9 | import java.util.List; 10 | 11 | 12 | public class TaskRequestVM { 13 | 14 | private Integer id; 15 | 16 | @NotNull 17 | private Integer gradeLevel; 18 | 19 | @NotNull 20 | private String title; 21 | 22 | @Size(min = 1, message = "请添加试卷") 23 | @Valid 24 | private List paperItems; 25 | 26 | public Integer getId() { 27 | return id; 28 | } 29 | 30 | public void setId(Integer id) { 31 | this.id = id; 32 | } 33 | 34 | public Integer getGradeLevel() { 35 | return gradeLevel; 36 | } 37 | 38 | public void setGradeLevel(Integer gradeLevel) { 39 | this.gradeLevel = gradeLevel; 40 | } 41 | 42 | public String getTitle() { 43 | return title; 44 | } 45 | 46 | public void setTitle(String title) { 47 | this.title = title; 48 | } 49 | 50 | public List getPaperItems() { 51 | return paperItems; 52 | } 53 | 54 | public void setPaperItems(List paperItems) { 55 | this.paperItems = paperItems; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/base/SystemCode.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.base; 2 | 3 | /** 4 | * @version 3.3.0 5 | * @description: The enum System code. 6 | * Copyright (C), 2020-2024, 武汉思维跳跃科技有限公司 7 | * @date 2021/5/25 10:45 8 | */ 9 | public enum SystemCode { 10 | /** 11 | * OK 12 | */ 13 | OK(1, "成功"), 14 | /** 15 | * AccessTokenError 16 | */ 17 | AccessTokenError(400, "用户登录令牌失效"), 18 | /** 19 | * UNAUTHORIZED 20 | */ 21 | UNAUTHORIZED(401, "用户未登录"), 22 | /** 23 | * UNAUTHORIZED 24 | */ 25 | AuthError(402, "用户名或密码错误"), 26 | /** 27 | * InnerError 28 | */ 29 | InnerError(500, "系统内部错误"), 30 | /** 31 | * ParameterValidError 32 | */ 33 | ParameterValidError(501, "参数验证错误"), 34 | 35 | /** 36 | * AccessDenied 37 | */ 38 | AccessDenied(502, "用户没有权限访问"); 39 | 40 | /** 41 | * The Code. 42 | */ 43 | int code; 44 | /** 45 | * The Message. 46 | */ 47 | String message; 48 | 49 | SystemCode(int code, String message) { 50 | this.code = code; 51 | this.message = message; 52 | } 53 | 54 | /** 55 | * Gets code. 56 | * 57 | * @return the code 58 | */ 59 | public int getCode() { 60 | return code; 61 | } 62 | 63 | /** 64 | * Gets message. 65 | * 66 | * @return the message 67 | */ 68 | public String getMessage() { 69 | return message; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/service/ExamPaperQuestionCustomerAnswerService.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.service; 2 | 3 | import com.mindskip.xzs.domain.ExamPaperQuestionCustomerAnswer; 4 | import com.mindskip.xzs.domain.other.ExamPaperAnswerUpdate; 5 | import com.mindskip.xzs.viewmodel.student.exam.ExamPaperSubmitItemVM; 6 | import com.mindskip.xzs.viewmodel.student.question.answer.QuestionPageStudentRequestVM; 7 | import com.github.pagehelper.PageInfo; 8 | 9 | import java.util.List; 10 | 11 | public interface ExamPaperQuestionCustomerAnswerService extends BaseService { 12 | 13 | PageInfo studentPage(QuestionPageStudentRequestVM requestVM); 14 | 15 | List selectListByPaperAnswerId(Integer id); 16 | 17 | /** 18 | * 试卷提交答案入库 19 | * 20 | * @param examPaperQuestionCustomerAnswers List 21 | */ 22 | void insertList(List examPaperQuestionCustomerAnswers); 23 | 24 | /** 25 | * 试卷问题答题信息转成ViewModel 传给前台 26 | * 27 | * @param qa ExamPaperQuestionCustomerAnswer 28 | * @return ExamPaperSubmitItemVM 29 | */ 30 | ExamPaperSubmitItemVM examPaperQuestionCustomerAnswerToVM(ExamPaperQuestionCustomerAnswer qa); 31 | 32 | 33 | Integer selectAllCount(); 34 | 35 | List selectMothCount(); 36 | 37 | int updateScore(List examPaperAnswerUpdates); 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/viewmodel/admin/user/UserEventLogVM.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.viewmodel.admin.user; 2 | 3 | 4 | 5 | 6 | public class UserEventLogVM { 7 | 8 | private Integer id; 9 | 10 | private Integer userId; 11 | 12 | private String userName; 13 | 14 | private String realName; 15 | 16 | private String content; 17 | 18 | private String createTime; 19 | 20 | public Integer getId() { 21 | return id; 22 | } 23 | 24 | public void setId(Integer id) { 25 | this.id = id; 26 | } 27 | 28 | public Integer getUserId() { 29 | return userId; 30 | } 31 | 32 | public void setUserId(Integer userId) { 33 | this.userId = userId; 34 | } 35 | 36 | public String getUserName() { 37 | return userName; 38 | } 39 | 40 | public void setUserName(String userName) { 41 | this.userName = userName; 42 | } 43 | 44 | public String getRealName() { 45 | return realName; 46 | } 47 | 48 | public void setRealName(String realName) { 49 | this.realName = realName; 50 | } 51 | 52 | public String getContent() { 53 | return content; 54 | } 55 | 56 | public void setContent(String content) { 57 | this.content = content; 58 | } 59 | 60 | public String getCreateTime() { 61 | return createTime; 62 | } 63 | 64 | public void setCreateTime(String createTime) { 65 | this.createTime = createTime; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/utility/WxResponse.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.utility; 2 | 3 | 4 | import java.io.Serializable; 5 | 6 | 7 | /** 8 | * @version 3.5.0 9 | * @description: The type Wx response. 10 | * Copyright (C), 2020-2024, 武汉思维跳跃科技有限公司 11 | * @date 2021/12/25 9:45 12 | */ 13 | public class WxResponse implements Serializable { 14 | private static final long serialVersionUID = -8496869159673561976L; 15 | private String session_key; 16 | private String openid; 17 | 18 | /** 19 | * Gets serial version uid. 20 | * 21 | * @return the serial version uid 22 | */ 23 | public static long getSerialVersionUID() { 24 | return serialVersionUID; 25 | } 26 | 27 | /** 28 | * Gets session key. 29 | * 30 | * @return the session key 31 | */ 32 | public String getSession_key() { 33 | return session_key; 34 | } 35 | 36 | /** 37 | * Sets session key. 38 | * 39 | * @param session_key the session key 40 | */ 41 | public void setSession_key(String session_key) { 42 | this.session_key = session_key; 43 | } 44 | 45 | /** 46 | * Gets openid. 47 | * 48 | * @return the openid 49 | */ 50 | public String getOpenid() { 51 | return openid; 52 | } 53 | 54 | /** 55 | * Sets openid. 56 | * 57 | * @param openid the openid 58 | */ 59 | public void setOpenid(String openid) { 60 | this.openid = openid; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/viewmodel/student/user/UserEventLogVM.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.viewmodel.student.user; 2 | 3 | 4 | import java.util.Date; 5 | 6 | public class UserEventLogVM { 7 | 8 | private Integer id; 9 | 10 | private Integer userId; 11 | 12 | private String userName; 13 | 14 | private String realName; 15 | 16 | private String content; 17 | 18 | private String createTime; 19 | 20 | public Integer getId() { 21 | return id; 22 | } 23 | 24 | public void setId(Integer id) { 25 | this.id = id; 26 | } 27 | 28 | public Integer getUserId() { 29 | return userId; 30 | } 31 | 32 | public void setUserId(Integer userId) { 33 | this.userId = userId; 34 | } 35 | 36 | public String getUserName() { 37 | return userName; 38 | } 39 | 40 | public void setUserName(String userName) { 41 | this.userName = userName; 42 | } 43 | 44 | public String getRealName() { 45 | return realName; 46 | } 47 | 48 | public void setRealName(String realName) { 49 | this.realName = realName; 50 | } 51 | 52 | public String getContent() { 53 | return content; 54 | } 55 | 56 | public void setContent(String content) { 57 | this.content = content; 58 | } 59 | 60 | public String getCreateTime() { 61 | return createTime; 62 | } 63 | 64 | public void setCreateTime(String createTime) { 65 | this.createTime = createTime; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/configuration/application/ApplicationContextProvider.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.configuration.application; 2 | 3 | import org.springframework.beans.BeansException; 4 | import org.springframework.context.ApplicationContext; 5 | import org.springframework.context.ApplicationContextAware; 6 | import org.springframework.stereotype.Component; 7 | 8 | /** 9 | * @version 3.5.0 10 | * @description: The type Application context provider. 11 | * Copyright (C), 2020-2024, 武汉思维跳跃科技有限公司 12 | * @date 2021/12/25 9:45 13 | */ 14 | @Component 15 | public class ApplicationContextProvider implements ApplicationContextAware { 16 | private static ApplicationContext context; 17 | 18 | private ApplicationContextProvider() { 19 | } 20 | 21 | @Override 22 | public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { 23 | context = applicationContext; 24 | } 25 | 26 | /** 27 | * Gets bean. 28 | * 29 | * @param the type parameter 30 | * @param aClass the a class 31 | * @return the bean 32 | */ 33 | public static T getBean(Class aClass) { 34 | return context.getBean(aClass); 35 | } 36 | 37 | /** 38 | * Gets bean. 39 | * 40 | * @param the type parameter 41 | * @param name the name 42 | * @return the bean 43 | */ 44 | @SuppressWarnings("unchecked") 45 | public static T getBean(String name) { 46 | return (T) context.getBean(name); 47 | } 48 | } 49 | 50 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/viewmodel/admin/task/TaskPageResponseVM.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.viewmodel.admin.task; 2 | 3 | 4 | 5 | import java.util.Date; 6 | 7 | 8 | public class TaskPageResponseVM { 9 | 10 | private Integer id; 11 | 12 | private String title; 13 | 14 | private Integer gradeLevel; 15 | 16 | private String createUserName; 17 | 18 | private String createTime; 19 | 20 | private Boolean deleted; 21 | 22 | public Integer getId() { 23 | return id; 24 | } 25 | 26 | public void setId(Integer id) { 27 | this.id = id; 28 | } 29 | 30 | public String getTitle() { 31 | return title; 32 | } 33 | 34 | public void setTitle(String title) { 35 | this.title = title; 36 | } 37 | 38 | public Integer getGradeLevel() { 39 | return gradeLevel; 40 | } 41 | 42 | public void setGradeLevel(Integer gradeLevel) { 43 | this.gradeLevel = gradeLevel; 44 | } 45 | 46 | public String getCreateUserName() { 47 | return createUserName; 48 | } 49 | 50 | public void setCreateUserName(String createUserName) { 51 | this.createUserName = createUserName; 52 | } 53 | 54 | public String getCreateTime() { 55 | return createTime; 56 | } 57 | 58 | public void setCreateTime(String createTime) { 59 | this.createTime = createTime; 60 | } 61 | 62 | public Boolean getDeleted() { 63 | return deleted; 64 | } 65 | 66 | public void setDeleted(Boolean deleted) { 67 | this.deleted = deleted; 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/viewmodel/student/user/UserUpdateVM.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.viewmodel.student.user; 2 | 3 | 4 | import javax.validation.constraints.NotBlank; 5 | import javax.validation.constraints.NotNull; 6 | 7 | public class UserUpdateVM { 8 | 9 | @NotBlank 10 | private String realName; 11 | 12 | private String age; 13 | 14 | private Integer sex; 15 | 16 | private String birthDay; 17 | 18 | private String phone; 19 | 20 | @NotNull 21 | private Integer userLevel; 22 | 23 | public String getRealName() { 24 | return realName; 25 | } 26 | 27 | public void setRealName(String realName) { 28 | this.realName = realName; 29 | } 30 | 31 | public String getAge() { 32 | return age; 33 | } 34 | 35 | public void setAge(String age) { 36 | this.age = age; 37 | } 38 | 39 | public Integer getSex() { 40 | return sex; 41 | } 42 | 43 | public void setSex(Integer sex) { 44 | this.sex = sex; 45 | } 46 | 47 | public String getBirthDay() { 48 | return birthDay; 49 | } 50 | 51 | public void setBirthDay(String birthDay) { 52 | this.birthDay = birthDay; 53 | } 54 | 55 | public String getPhone() { 56 | return phone; 57 | } 58 | 59 | public void setPhone(String phone) { 60 | this.phone = phone; 61 | } 62 | 63 | public Integer getUserLevel() { 64 | return userLevel; 65 | } 66 | 67 | public void setUserLevel(Integer userLevel) { 68 | this.userLevel = userLevel; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/configuration/spring/security/AuthenticationBean.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.configuration.spring.security; 2 | 3 | /** 4 | * @version 3.5.0 5 | * @description: The type Authentication bean. 6 | * Copyright (C), 2020-2024, 武汉思维跳跃科技有限公司 7 | * @date 2021/12/25 9:45 8 | */ 9 | public class AuthenticationBean { 10 | private String userName; 11 | private String password; 12 | private boolean remember; 13 | 14 | /** 15 | * Gets user name. 16 | * 17 | * @return the user name 18 | */ 19 | public String getUserName() { 20 | return userName; 21 | } 22 | 23 | /** 24 | * Sets user name. 25 | * 26 | * @param userName the user name 27 | */ 28 | public void setUserName(String userName) { 29 | this.userName = userName; 30 | } 31 | 32 | /** 33 | * Gets password. 34 | * 35 | * @return the password 36 | */ 37 | public String getPassword() { 38 | return password; 39 | } 40 | 41 | /** 42 | * Sets password. 43 | * 44 | * @param password the password 45 | */ 46 | public void setPassword(String password) { 47 | this.password = password; 48 | } 49 | 50 | /** 51 | * Is remember boolean. 52 | * 53 | * @return the boolean 54 | */ 55 | public boolean isRemember() { 56 | return remember; 57 | } 58 | 59 | /** 60 | * Sets remember. 61 | * 62 | * @param remember the remember 63 | */ 64 | public void setRemember(boolean remember) { 65 | this.remember = remember; 66 | } 67 | 68 | } 69 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/domain/enums/QuestionTypeEnum.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.domain.enums; 2 | 3 | import java.util.HashMap; 4 | import java.util.Map; 5 | 6 | public enum QuestionTypeEnum { 7 | 8 | SingleChoice(1, "单选题"), 9 | MultipleChoice(2, "多选题"), 10 | TrueFalse(3, "判断题"), 11 | GapFilling(4, "填空题"), 12 | ShortAnswer(5, "简答题"); 13 | 14 | int code; 15 | String name; 16 | 17 | QuestionTypeEnum(int code, String name) { 18 | this.code = code; 19 | this.name = name; 20 | } 21 | 22 | 23 | private static final Map keyMap = new HashMap<>(); 24 | 25 | static { 26 | for (QuestionTypeEnum item : QuestionTypeEnum.values()) { 27 | keyMap.put(item.getCode(), item); 28 | } 29 | } 30 | 31 | public static QuestionTypeEnum fromCode(Integer code) { 32 | return keyMap.get(code); 33 | } 34 | 35 | public static boolean needSaveTextContent(Integer code) { 36 | QuestionTypeEnum questionTypeEnum = QuestionTypeEnum.fromCode(code); 37 | switch (questionTypeEnum) { 38 | case GapFilling: 39 | case ShortAnswer: 40 | return true; 41 | default: 42 | return false; 43 | } 44 | } 45 | 46 | public int getCode() { 47 | return code; 48 | } 49 | 50 | public void setCode(int code) { 51 | this.code = code; 52 | } 53 | 54 | public String getName() { 55 | return name; 56 | } 57 | 58 | public void setName(String name) { 59 | this.name = name; 60 | } 61 | 62 | 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/service/ExamPaperAnswerService.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.service; 2 | 3 | import com.mindskip.xzs.domain.ExamPaperAnswer; 4 | import com.mindskip.xzs.domain.ExamPaperAnswerInfo; 5 | import com.mindskip.xzs.domain.User; 6 | import com.mindskip.xzs.viewmodel.student.exam.ExamPaperSubmitVM; 7 | import com.mindskip.xzs.viewmodel.student.exampaper.ExamPaperAnswerPageVM; 8 | import com.github.pagehelper.PageInfo; 9 | 10 | import java.util.List; 11 | 12 | public interface ExamPaperAnswerService extends BaseService { 13 | 14 | /** 15 | * 学生考试记录分页 16 | * 17 | * @param requestVM 过滤条件 18 | * @return PageInfo 19 | */ 20 | PageInfo studentPage(ExamPaperAnswerPageVM requestVM); 21 | 22 | /** 23 | * 计算试卷提交结果(不入库) 24 | * 25 | * @param examPaperSubmitVM 26 | * @param user 27 | * @return 28 | */ 29 | ExamPaperAnswerInfo calculateExamPaperAnswer(ExamPaperSubmitVM examPaperSubmitVM, User user); 30 | 31 | 32 | /** 33 | * 试卷批改 34 | * @param examPaperSubmitVM examPaperSubmitVM 35 | * @return String 36 | */ 37 | String judge(ExamPaperSubmitVM examPaperSubmitVM); 38 | 39 | /** 40 | * 试卷答题信息转成ViewModel 传给前台 41 | * 42 | * @param id 试卷id 43 | * @return ExamPaperSubmitVM 44 | */ 45 | ExamPaperSubmitVM examPaperAnswerToVM(Integer id); 46 | 47 | 48 | Integer selectAllCount(); 49 | 50 | List selectMothCount(); 51 | 52 | PageInfo adminPage(com.mindskip.xzs.viewmodel.admin.paper.ExamPaperAnswerPageRequestVM requestVM); 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/controller/ErrorController.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.controller; 2 | 3 | import com.mindskip.xzs.base.SystemCode; 4 | import org.springframework.boot.autoconfigure.web.ErrorProperties; 5 | import org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController; 6 | import org.springframework.boot.web.servlet.error.DefaultErrorAttributes; 7 | import org.springframework.http.HttpStatus; 8 | import org.springframework.http.MediaType; 9 | import org.springframework.http.ResponseEntity; 10 | import org.springframework.web.bind.annotation.RequestMapping; 11 | import org.springframework.web.bind.annotation.ResponseBody; 12 | import org.springframework.web.bind.annotation.RestController; 13 | 14 | import javax.servlet.http.HttpServletRequest; 15 | import java.util.HashMap; 16 | import java.util.Map; 17 | 18 | @RestController 19 | public class ErrorController extends BasicErrorController { 20 | 21 | private static final String PATH = "/error"; 22 | 23 | public ErrorController() { 24 | super(new DefaultErrorAttributes(), new ErrorProperties()); 25 | } 26 | 27 | @RequestMapping(produces = {MediaType.APPLICATION_JSON_VALUE}) 28 | @ResponseBody 29 | public ResponseEntity> error(HttpServletRequest request) { 30 | Map error = new HashMap<>(2); 31 | error.put("code", SystemCode.InnerError.getCode()); 32 | error.put("message", SystemCode.InnerError.getMessage()); 33 | return new ResponseEntity<>(error, HttpStatus.OK); 34 | } 35 | 36 | @Override 37 | public String getErrorPath() { 38 | return PATH; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/domain/TaskExamCustomerAnswer.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.domain; 2 | 3 | import java.io.Serializable; 4 | import java.util.Date; 5 | 6 | public class TaskExamCustomerAnswer implements Serializable { 7 | 8 | private static final long serialVersionUID = -556842372977600137L; 9 | 10 | private Integer id; 11 | 12 | /** 13 | * 任务Id 14 | */ 15 | private Integer taskExamId; 16 | 17 | /** 18 | * 创建者 19 | */ 20 | private Integer createUser; 21 | 22 | /** 23 | * 创建时间 24 | */ 25 | private Date createTime; 26 | 27 | /** 28 | * 任务完成情况(Json) 29 | */ 30 | private Integer textContentId; 31 | 32 | public Integer getId() { 33 | return id; 34 | } 35 | 36 | public void setId(Integer id) { 37 | this.id = id; 38 | } 39 | 40 | public Integer getTaskExamId() { 41 | return taskExamId; 42 | } 43 | 44 | public void setTaskExamId(Integer taskExamId) { 45 | this.taskExamId = taskExamId; 46 | } 47 | 48 | public Integer getCreateUser() { 49 | return createUser; 50 | } 51 | 52 | public void setCreateUser(Integer createUser) { 53 | this.createUser = createUser; 54 | } 55 | 56 | public Date getCreateTime() { 57 | return createTime; 58 | } 59 | 60 | public void setCreateTime(Date createTime) { 61 | this.createTime = createTime; 62 | } 63 | 64 | public Integer getTextContentId() { 65 | return textContentId; 66 | } 67 | 68 | public void setTextContentId(Integer textContentId) { 69 | this.textContentId = textContentId; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/viewmodel/student/user/MessageResponseVM.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.viewmodel.student.user; 2 | 3 | 4 | public class MessageResponseVM { 5 | private Integer id; 6 | 7 | private String title; 8 | 9 | private Integer messageId; 10 | 11 | private String content; 12 | 13 | private Boolean readed; 14 | 15 | private String createTime; 16 | 17 | private String sendUserName; 18 | 19 | public Integer getId() { 20 | return id; 21 | } 22 | 23 | public void setId(Integer id) { 24 | this.id = id; 25 | } 26 | 27 | public String getTitle() { 28 | return title; 29 | } 30 | 31 | public void setTitle(String title) { 32 | this.title = title; 33 | } 34 | 35 | public Integer getMessageId() { 36 | return messageId; 37 | } 38 | 39 | public void setMessageId(Integer messageId) { 40 | this.messageId = messageId; 41 | } 42 | 43 | public String getContent() { 44 | return content; 45 | } 46 | 47 | public void setContent(String content) { 48 | this.content = content; 49 | } 50 | 51 | public Boolean getReaded() { 52 | return readed; 53 | } 54 | 55 | public void setReaded(Boolean readed) { 56 | this.readed = readed; 57 | } 58 | 59 | public String getCreateTime() { 60 | return createTime; 61 | } 62 | 63 | public void setCreateTime(String createTime) { 64 | this.createTime = createTime; 65 | } 66 | 67 | public String getSendUserName() { 68 | return sendUserName; 69 | } 70 | 71 | public void setSendUserName(String sendUserName) { 72 | this.sendUserName = sendUserName; 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/domain/Subject.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.domain; 2 | 3 | import java.io.Serializable; 4 | 5 | public class Subject implements Serializable { 6 | 7 | private static final long serialVersionUID = 8058095034457106501L; 8 | 9 | private Integer id; 10 | 11 | /** 12 | * 语文 数学 英语 等 13 | */ 14 | private String name; 15 | 16 | /** 17 | * 年级 (1-12) 小学 初中 18 | */ 19 | private Integer level; 20 | 21 | /** 22 | * 一年级、二年级等 23 | */ 24 | private String levelName; 25 | 26 | /** 27 | * 排序 28 | */ 29 | private Integer itemOrder; 30 | 31 | private Boolean deleted; 32 | 33 | public Integer getId() { 34 | return id; 35 | } 36 | 37 | public void setId(Integer id) { 38 | this.id = id; 39 | } 40 | 41 | public String getName() { 42 | return name; 43 | } 44 | 45 | public void setName(String name) { 46 | this.name = name == null ? null : name.trim(); 47 | } 48 | 49 | public Integer getLevel() { 50 | return level; 51 | } 52 | 53 | public void setLevel(Integer level) { 54 | this.level = level; 55 | } 56 | 57 | public String getLevelName() { 58 | return levelName; 59 | } 60 | 61 | public void setLevelName(String levelName) { 62 | this.levelName = levelName == null ? null : levelName.trim(); 63 | } 64 | 65 | public Integer getItemOrder() { 66 | return itemOrder; 67 | } 68 | 69 | public void setItemOrder(Integer itemOrder) { 70 | this.itemOrder = itemOrder; 71 | } 72 | 73 | public Boolean getDeleted() { 74 | return deleted; 75 | } 76 | 77 | public void setDeleted(Boolean deleted) { 78 | this.deleted = deleted; 79 | } 80 | } -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/context/WxContext.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.context; 2 | 3 | import com.mindskip.xzs.domain.User; 4 | import com.mindskip.xzs.domain.UserToken; 5 | import org.springframework.stereotype.Component; 6 | import org.springframework.web.context.request.RequestAttributes; 7 | import org.springframework.web.context.request.RequestContextHolder; 8 | 9 | /** 10 | * @version 3.3.0 11 | * @description: The enum System code. 12 | * Copyright (C), 2020-2024, 武汉思维跳跃科技有限公司 13 | * @date 2021/5/25 10:45 14 | */ 15 | @Component 16 | public class WxContext { 17 | 18 | private static final String USER_ATTRIBUTES = "USER_ATTRIBUTES"; 19 | private static final String USER_TOKEN_ATTRIBUTES = "USER_TOKEN_ATTRIBUTES"; 20 | 21 | 22 | /** 23 | * Sets context. 24 | * 25 | * @param user the user 26 | * @param userToken the user token 27 | */ 28 | public void setContext(User user, UserToken userToken) { 29 | RequestContextHolder.currentRequestAttributes().setAttribute(USER_ATTRIBUTES, user, RequestAttributes.SCOPE_REQUEST); 30 | RequestContextHolder.currentRequestAttributes().setAttribute(USER_TOKEN_ATTRIBUTES, userToken, RequestAttributes.SCOPE_REQUEST); 31 | } 32 | 33 | /** 34 | * Gets current user. 35 | * 36 | * @return the current user 37 | */ 38 | public User getCurrentUser() { 39 | return (User) RequestContextHolder.currentRequestAttributes().getAttribute(USER_ATTRIBUTES, RequestAttributes.SCOPE_REQUEST); 40 | } 41 | 42 | /** 43 | * Gets current user token. 44 | * 45 | * @return the current user token 46 | */ 47 | public UserToken getCurrentUserToken() { 48 | return (UserToken) RequestContextHolder.currentRequestAttributes().getAttribute(USER_TOKEN_ATTRIBUTES, RequestAttributes.SCOPE_REQUEST); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/service/impl/SubjectServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.service.impl; 2 | 3 | import com.mindskip.xzs.domain.Subject; 4 | import com.mindskip.xzs.repository.SubjectMapper; 5 | import com.mindskip.xzs.service.SubjectService; 6 | import com.mindskip.xzs.viewmodel.admin.education.SubjectPageRequestVM; 7 | import com.github.pagehelper.PageHelper; 8 | import com.github.pagehelper.PageInfo; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.stereotype.Service; 11 | 12 | import java.util.List; 13 | 14 | @Service 15 | public class SubjectServiceImpl extends BaseServiceImpl implements SubjectService { 16 | 17 | private final SubjectMapper subjectMapper; 18 | 19 | @Autowired 20 | public SubjectServiceImpl(SubjectMapper subjectMapper) { 21 | super(subjectMapper); 22 | this.subjectMapper = subjectMapper; 23 | } 24 | 25 | @Override 26 | public Subject selectById(Integer id) { 27 | return super.selectById(id); 28 | } 29 | 30 | @Override 31 | public int updateByIdFilter(Subject record) { 32 | return super.updateByIdFilter(record); 33 | } 34 | 35 | @Override 36 | public List getSubjectByLevel(Integer level) { 37 | return subjectMapper.getSubjectByLevel(level); 38 | } 39 | 40 | @Override 41 | public List allSubject() { 42 | return subjectMapper.allSubject(); 43 | } 44 | 45 | @Override 46 | public Integer levelBySubjectId(Integer id) { 47 | return this.selectById(id).getLevel(); 48 | } 49 | 50 | @Override 51 | public PageInfo page(SubjectPageRequestVM requestVM) { 52 | return PageHelper.startPage(requestVM.getPageIndex(), requestVM.getPageSize(), "id desc").doSelectPageInfo(() -> 53 | subjectMapper.page(requestVM) 54 | ); 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/utility/PageInfoHelper.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.utility; 2 | 3 | import com.github.pagehelper.PageInfo; 4 | 5 | import java.util.function.Function; 6 | import java.util.stream.Collectors; 7 | 8 | /** 9 | * @version 3.5.0 10 | * @description: The type Page info helper. 11 | * Copyright (C), 2020-2024, 武汉思维跳跃科技有限公司 12 | * @date 2021/12/25 9:45 13 | */ 14 | public class PageInfoHelper { 15 | 16 | /** 17 | * Copy map page info. 18 | * 19 | * @param the type parameter 20 | * @param the type parameter 21 | * @param source the source 22 | * @param mapper the mapper 23 | * @return the page info 24 | */ 25 | public static PageInfo copyMap(PageInfo source, Function mapper) { 26 | PageInfo newPage = new PageInfo<>(); 27 | newPage.setPageNum(source.getPageNum()); 28 | newPage.setPageSize(source.getPageSize()); 29 | newPage.setSize(source.getSize()); 30 | newPage.setStartRow(source.getStartRow()); 31 | newPage.setEndRow(source.getEndRow()); 32 | newPage.setTotal(source.getTotal()); 33 | newPage.setPages(source.getPages()); 34 | newPage.setList(source.getList().stream().map(mapper).collect(Collectors.toList())); 35 | newPage.setPrePage(source.getPrePage()); 36 | newPage.setNextPage(source.getNextPage()); 37 | newPage.setIsFirstPage(source.isIsFirstPage()); 38 | newPage.setIsLastPage(source.isIsLastPage()); 39 | newPage.setHasPreviousPage(source.isHasPreviousPage()); 40 | newPage.setHasNextPage(source.isHasNextPage()); 41 | newPage.setNavigatePages(source.getNavigatePages()); 42 | newPage.setNavigatepageNums(source.getNavigatepageNums()); 43 | newPage.setNavigateFirstPage(source.getNavigateFirstPage()); 44 | newPage.setNavigateLastPage(source.getNavigateLastPage()); 45 | return newPage; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/utility/WxUtil.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.utility; 2 | 3 | 4 | import org.apache.http.HttpEntity; 5 | import org.apache.http.client.methods.HttpGet; 6 | import org.apache.http.impl.client.CloseableHttpClient; 7 | import org.apache.http.impl.client.HttpClientBuilder; 8 | import org.apache.http.util.EntityUtils; 9 | import org.slf4j.Logger; 10 | import org.slf4j.LoggerFactory; 11 | 12 | import java.io.IOException; 13 | 14 | /** 15 | * @version 3.5.0 16 | * @description: The type Wx util. 17 | * Copyright (C), 2020-2024, 武汉思维跳跃科技有限公司 18 | * @date 2021/12/25 9:45 19 | */ 20 | public class WxUtil { 21 | private static final Logger logger = LoggerFactory.getLogger(WxUtil.class); 22 | private static final String openIdUrl = "https://api.weixin.qq.com/sns/jscode2session?appid=%s&secret=%s&js_code=%s&grant_type=authorization_code"; 23 | 24 | /** 25 | * Gets open id. 26 | * 27 | * @param appId the app id 28 | * @param secret the secret 29 | * @param code the code 30 | * @return the open id 31 | */ 32 | public static String getOpenId(String appId, String secret, String code) { 33 | try (CloseableHttpClient httpClient = HttpClientBuilder.create().build()) { 34 | String requestUrl = String.format(openIdUrl, appId, secret, code); 35 | HttpGet httpGet = new HttpGet(requestUrl); 36 | HttpEntity responseEntity = httpClient.execute(httpGet).getEntity(); 37 | if (responseEntity != null) { 38 | String responseStr = EntityUtils.toString(responseEntity); 39 | if (responseStr.contains("openid")) { 40 | WxResponse wxResponse = JsonUtil.toJsonObject(responseStr, WxResponse.class); 41 | return wxResponse.getOpenid(); 42 | } 43 | } 44 | } catch (IOException e) { 45 | logger.error(e.getMessage(), e); 46 | } 47 | return null; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/configuration/property/QnConfig.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.configuration.property; 2 | 3 | 4 | import java.time.Duration; 5 | import java.util.List; 6 | 7 | /** 8 | * @version 3.5.0 9 | * @description: The type Qn config. 10 | * Copyright (C), 2020-2024, 武汉思维跳跃科技有限公司 11 | * @date 2021/12/25 9:45 12 | */ 13 | public class QnConfig { 14 | 15 | private String url; 16 | private String bucket; 17 | private String accessKey; 18 | private String secretKey; 19 | 20 | /** 21 | * Gets url. 22 | * 23 | * @return the url 24 | */ 25 | public String getUrl() { 26 | return url; 27 | } 28 | 29 | /** 30 | * Sets url. 31 | * 32 | * @param url the url 33 | */ 34 | public void setUrl(String url) { 35 | this.url = url; 36 | } 37 | 38 | /** 39 | * Gets bucket. 40 | * 41 | * @return the bucket 42 | */ 43 | public String getBucket() { 44 | return bucket; 45 | } 46 | 47 | /** 48 | * Sets bucket. 49 | * 50 | * @param bucket the bucket 51 | */ 52 | public void setBucket(String bucket) { 53 | this.bucket = bucket; 54 | } 55 | 56 | /** 57 | * Gets access key. 58 | * 59 | * @return the access key 60 | */ 61 | public String getAccessKey() { 62 | return accessKey; 63 | } 64 | 65 | /** 66 | * Sets access key. 67 | * 68 | * @param accessKey the access key 69 | */ 70 | public void setAccessKey(String accessKey) { 71 | this.accessKey = accessKey; 72 | } 73 | 74 | /** 75 | * Gets secret key. 76 | * 77 | * @return the secret key 78 | */ 79 | public String getSecretKey() { 80 | return secretKey; 81 | } 82 | 83 | /** 84 | * Sets secret key. 85 | * 86 | * @param secretKey the secret key 87 | */ 88 | public void setSecretKey(String secretKey) { 89 | this.secretKey = secretKey; 90 | } 91 | 92 | } 93 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/service/impl/FileUploadImpl.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.service.impl; 2 | 3 | import com.mindskip.xzs.configuration.property.QnConfig; 4 | import com.mindskip.xzs.configuration.property.SystemConfig; 5 | import com.mindskip.xzs.service.FileUpload; 6 | import com.google.gson.Gson; 7 | import com.qiniu.common.QiniuException; 8 | import com.qiniu.http.Response; 9 | import com.qiniu.storage.Configuration; 10 | import com.qiniu.storage.Region; 11 | import com.qiniu.storage.UploadManager; 12 | import com.qiniu.storage.model.DefaultPutRet; 13 | import com.qiniu.util.Auth; 14 | import org.slf4j.Logger; 15 | import org.slf4j.LoggerFactory; 16 | import org.springframework.beans.factory.annotation.Autowired; 17 | import org.springframework.stereotype.Service; 18 | 19 | import java.io.InputStream; 20 | 21 | @Service 22 | public class FileUploadImpl implements FileUpload { 23 | private final Logger logger = LoggerFactory.getLogger(FileUpload.class); 24 | private final SystemConfig systemConfig; 25 | 26 | 27 | @Autowired 28 | public FileUploadImpl(SystemConfig systemConfig) { 29 | this.systemConfig = systemConfig; 30 | } 31 | 32 | @Override 33 | public String uploadFile(InputStream inputStream, long size, String extName) { 34 | QnConfig qnConfig = systemConfig.getQn(); 35 | Configuration cfg = new Configuration(Region.region2()); 36 | UploadManager uploadManager = new UploadManager(cfg); 37 | Auth auth = Auth.create(qnConfig.getAccessKey(), qnConfig.getSecretKey()); 38 | String upToken = auth.uploadToken(qnConfig.getBucket()); 39 | try { 40 | Response response = uploadManager.put(inputStream, null, upToken, null, null); 41 | DefaultPutRet putRet = new Gson().fromJson(response.bodyString(), DefaultPutRet.class); 42 | return qnConfig.getUrl() + "/" + putRet.key; 43 | } catch (QiniuException ex) { 44 | logger.error(ex.getMessage(), ex); 45 | } 46 | return null; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/configuration/spring/security/RestDetailsServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.configuration.spring.security; 2 | 3 | import com.mindskip.xzs.domain.enums.RoleEnum; 4 | import com.mindskip.xzs.service.UserService; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.security.core.GrantedAuthority; 7 | import org.springframework.security.core.authority.SimpleGrantedAuthority; 8 | import org.springframework.security.core.userdetails.User; 9 | import org.springframework.security.core.userdetails.UserDetails; 10 | import org.springframework.security.core.userdetails.UserDetailsService; 11 | import org.springframework.security.core.userdetails.UsernameNotFoundException; 12 | import org.springframework.stereotype.Component; 13 | 14 | import java.util.ArrayList; 15 | 16 | 17 | /** 18 | * @version 3.5.0 19 | * @description: 验证通过之后,第二、三...请求,会调用此类 20 | * Copyright (C), 2020-2024, 武汉思维跳跃科技有限公司 21 | * @date 2021/12/25 9:45 22 | */ 23 | @Component 24 | public class RestDetailsServiceImpl implements UserDetailsService { 25 | 26 | private final UserService userService; 27 | 28 | /** 29 | * Instantiates a new Rest details service. 30 | * 31 | * @param userService the user service 32 | */ 33 | @Autowired 34 | public RestDetailsServiceImpl(UserService userService) { 35 | this.userService = userService; 36 | } 37 | 38 | @Override 39 | public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { 40 | 41 | com.mindskip.xzs.domain.User user = userService.getUserByUserName(username); 42 | 43 | if (user == null) { 44 | throw new UsernameNotFoundException("Username not found."); 45 | } 46 | 47 | ArrayList grantedAuthorities = new ArrayList<>(); 48 | grantedAuthorities.add(new SimpleGrantedAuthority(RoleEnum.fromCode(user.getRole()).getRoleName())); 49 | 50 | return new User(user.getUserName(), user.getPassword(), grantedAuthorities); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/controller/student/EducationController.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.controller.student; 2 | 3 | 4 | import com.mindskip.xzs.base.BaseApiController; 5 | import com.mindskip.xzs.base.RestResponse; 6 | import com.mindskip.xzs.domain.Subject; 7 | import com.mindskip.xzs.domain.User; 8 | import com.mindskip.xzs.service.SubjectService; 9 | import com.mindskip.xzs.viewmodel.student.education.SubjectEditRequestVM; 10 | import com.mindskip.xzs.viewmodel.student.education.SubjectVM; 11 | import org.springframework.beans.factory.annotation.Autowired; 12 | import org.springframework.web.bind.annotation.*; 13 | 14 | import java.util.List; 15 | import java.util.stream.Collectors; 16 | 17 | @RestController("StudentEducationController") 18 | @RequestMapping(value = "/api/student/education") 19 | public class EducationController extends BaseApiController { 20 | 21 | private final SubjectService subjectService; 22 | 23 | @Autowired 24 | public EducationController(SubjectService subjectService) { 25 | this.subjectService = subjectService; 26 | } 27 | 28 | @RequestMapping(value = "/subject/list", method = RequestMethod.POST) 29 | public RestResponse> list() { 30 | User user = getCurrentUser(); 31 | List subjects = subjectService.getSubjectByLevel(user.getUserLevel()); 32 | List subjectVMS = subjects.stream().map(d -> { 33 | SubjectVM subjectVM = modelMapper.map(d, SubjectVM.class); 34 | subjectVM.setId(String.valueOf(d.getId())); 35 | return subjectVM; 36 | }).collect(Collectors.toList()); 37 | return RestResponse.ok(subjectVMS); 38 | } 39 | 40 | @RequestMapping(value = "/subject/select/{id}", method = RequestMethod.POST) 41 | public RestResponse select(@PathVariable Integer id) { 42 | Subject subject = subjectService.selectById(id); 43 | SubjectEditRequestVM vm = modelMapper.map(subject, SubjectEditRequestVM.class); 44 | return RestResponse.ok(vm); 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/service/impl/AuthenticationServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.service.impl; 2 | 3 | import com.mindskip.xzs.configuration.property.SystemConfig; 4 | import com.mindskip.xzs.domain.User; 5 | import com.mindskip.xzs.service.AuthenticationService; 6 | import com.mindskip.xzs.service.UserService; 7 | import com.mindskip.xzs.utility.RsaUtil; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.stereotype.Service; 10 | 11 | 12 | @Service 13 | public class AuthenticationServiceImpl implements AuthenticationService { 14 | 15 | 16 | private final UserService userService; 17 | private final SystemConfig systemConfig; 18 | 19 | @Autowired 20 | public AuthenticationServiceImpl(UserService userService, SystemConfig systemConfig) { 21 | this.userService = userService; 22 | this.systemConfig = systemConfig; 23 | } 24 | 25 | 26 | /** 27 | * @param username username 28 | * @param password password 29 | * @return boolean 30 | */ 31 | @Override 32 | public boolean authUser(String username, String password) { 33 | User user = userService.getUserByUserName(username); 34 | return authUser(user, username, password); 35 | } 36 | 37 | 38 | @Override 39 | public boolean authUser(User user, String username, String password) { 40 | if (user == null) { 41 | return false; 42 | } 43 | String encodePwd = user.getPassword(); 44 | if (null == encodePwd || encodePwd.length() == 0) { 45 | return false; 46 | } 47 | String pwd = pwdDecode(encodePwd); 48 | return pwd.equals(password); 49 | } 50 | 51 | @Override 52 | public String pwdEncode(String password) { 53 | return RsaUtil.rsaEncode(systemConfig.getPwdKey().getPublicKey(), password); 54 | } 55 | 56 | @Override 57 | public String pwdDecode(String encodePwd) { 58 | return RsaUtil.rsaDecode(systemConfig.getPwdKey().getPrivateKey(), encodePwd); 59 | } 60 | 61 | 62 | } 63 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/viewmodel/admin/message/MessageResponseVM.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.viewmodel.admin.message; 2 | 3 | 4 | 5 | import java.util.Date; 6 | 7 | 8 | public class MessageResponseVM { 9 | private Integer id; 10 | 11 | private String title; 12 | 13 | private String content; 14 | 15 | private String sendUserName; 16 | 17 | private String receives; 18 | 19 | private Integer receiveUserCount; 20 | 21 | private Integer readCount; 22 | 23 | private String createTime; 24 | 25 | public Integer getId() { 26 | return id; 27 | } 28 | 29 | public void setId(Integer id) { 30 | this.id = id; 31 | } 32 | 33 | public String getTitle() { 34 | return title; 35 | } 36 | 37 | public void setTitle(String title) { 38 | this.title = title; 39 | } 40 | 41 | public String getContent() { 42 | return content; 43 | } 44 | 45 | public void setContent(String content) { 46 | this.content = content; 47 | } 48 | 49 | public String getSendUserName() { 50 | return sendUserName; 51 | } 52 | 53 | public void setSendUserName(String sendUserName) { 54 | this.sendUserName = sendUserName; 55 | } 56 | 57 | public String getReceives() { 58 | return receives; 59 | } 60 | 61 | public void setReceives(String receives) { 62 | this.receives = receives; 63 | } 64 | 65 | public Integer getReceiveUserCount() { 66 | return receiveUserCount; 67 | } 68 | 69 | public void setReceiveUserCount(Integer receiveUserCount) { 70 | this.receiveUserCount = receiveUserCount; 71 | } 72 | 73 | public Integer getReadCount() { 74 | return readCount; 75 | } 76 | 77 | public void setReadCount(Integer readCount) { 78 | this.readCount = readCount; 79 | } 80 | 81 | public String getCreateTime() { 82 | return createTime; 83 | } 84 | 85 | public void setCreateTime(String createTime) { 86 | this.createTime = createTime; 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/configuration/spring/security/RestUtil.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.configuration.spring.security; 2 | 3 | import com.mindskip.xzs.base.RestResponse; 4 | import com.mindskip.xzs.base.SystemCode; 5 | import com.mindskip.xzs.utility.JsonUtil; 6 | import org.slf4j.Logger; 7 | import org.slf4j.LoggerFactory; 8 | 9 | import javax.servlet.http.HttpServletResponse; 10 | import java.io.IOException; 11 | 12 | 13 | /** 14 | * @version 3.5.0 15 | * @description: The type Rest util. 16 | * Copyright (C), 2020-2024, 武汉思维跳跃科技有限公司 17 | * @date 2021/12/25 9:45 18 | */ 19 | public class RestUtil { 20 | private static final Logger logger = LoggerFactory.getLogger(RestUtil.class); 21 | 22 | 23 | /** 24 | * Response. 25 | * 26 | * @param response the response 27 | * @param systemCode the system code 28 | */ 29 | public static void response(HttpServletResponse response, SystemCode systemCode) { 30 | response(response, systemCode.getCode(), systemCode.getMessage()); 31 | } 32 | 33 | /** 34 | * Response. 35 | * 36 | * @param response the response 37 | * @param systemCode the system code 38 | * @param msg the msg 39 | */ 40 | public static void response(HttpServletResponse response, int systemCode, String msg) { 41 | response(response, systemCode, msg, null); 42 | } 43 | 44 | 45 | /** 46 | * Response. 47 | * 48 | * @param response the response 49 | * @param systemCode the system code 50 | * @param msg the msg 51 | * @param content the content 52 | */ 53 | public static void response(HttpServletResponse response, int systemCode, String msg, Object content) { 54 | try { 55 | RestResponse res = new RestResponse<>(systemCode, msg, content); 56 | String resStr = JsonUtil.toJsonStr(res); 57 | response.setContentType("application/json;charset=utf-8"); 58 | response.getWriter().write(resStr); 59 | } catch (IOException e) { 60 | logger.error(e.getMessage(), e); 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/viewmodel/student/exam/ExamPaperSubmitItemVM.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.viewmodel.student.exam; 2 | 3 | 4 | import javax.validation.constraints.NotNull; 5 | import java.util.List; 6 | 7 | public class ExamPaperSubmitItemVM { 8 | private Integer id; 9 | @NotNull 10 | private Integer questionId; 11 | 12 | private Boolean doRight; 13 | 14 | private String content; 15 | 16 | private Integer itemOrder; 17 | 18 | private List contentArray; 19 | 20 | private String score; 21 | 22 | private String questionScore; 23 | 24 | public Integer getId() { 25 | return id; 26 | } 27 | 28 | public void setId(Integer id) { 29 | this.id = id; 30 | } 31 | 32 | public Integer getQuestionId() { 33 | return questionId; 34 | } 35 | 36 | public void setQuestionId(Integer questionId) { 37 | this.questionId = questionId; 38 | } 39 | 40 | public Boolean getDoRight() { 41 | return doRight; 42 | } 43 | 44 | public void setDoRight(Boolean doRight) { 45 | this.doRight = doRight; 46 | } 47 | 48 | public String getContent() { 49 | return content; 50 | } 51 | 52 | public void setContent(String content) { 53 | this.content = content; 54 | } 55 | 56 | public Integer getItemOrder() { 57 | return itemOrder; 58 | } 59 | 60 | public void setItemOrder(Integer itemOrder) { 61 | this.itemOrder = itemOrder; 62 | } 63 | 64 | public List getContentArray() { 65 | return contentArray; 66 | } 67 | 68 | public void setContentArray(List contentArray) { 69 | this.contentArray = contentArray; 70 | } 71 | 72 | public String getScore() { 73 | return score; 74 | } 75 | 76 | public void setScore(String score) { 77 | this.score = score; 78 | } 79 | 80 | public String getQuestionScore() { 81 | return questionScore; 82 | } 83 | 84 | public void setQuestionScore(String questionScore) { 85 | this.questionScore = questionScore; 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/domain/UserToken.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.domain; 2 | 3 | import java.io.Serializable; 4 | import java.util.Date; 5 | 6 | public class UserToken implements Serializable { 7 | 8 | private static final long serialVersionUID = -2414443061696200360L; 9 | 10 | private Integer id; 11 | 12 | /** 13 | * 用户token 14 | */ 15 | private String token; 16 | 17 | /** 18 | * 用户Id 19 | */ 20 | private Integer userId; 21 | 22 | /** 23 | * 微信小程序openId 24 | */ 25 | private String wxOpenId; 26 | 27 | /** 28 | * 创建时间 29 | */ 30 | private Date createTime; 31 | 32 | /** 33 | * 结束时间 34 | */ 35 | private Date endTime; 36 | 37 | /** 38 | * 用户名 39 | */ 40 | private String userName; 41 | 42 | public Integer getId() { 43 | return id; 44 | } 45 | 46 | public void setId(Integer id) { 47 | this.id = id; 48 | } 49 | 50 | public String getToken() { 51 | return token; 52 | } 53 | 54 | public void setToken(String token) { 55 | this.token = token == null ? null : token.trim(); 56 | } 57 | 58 | public Integer getUserId() { 59 | return userId; 60 | } 61 | 62 | public void setUserId(Integer userId) { 63 | this.userId = userId; 64 | } 65 | 66 | public String getWxOpenId() { 67 | return wxOpenId; 68 | } 69 | 70 | public void setWxOpenId(String wxOpenId) { 71 | this.wxOpenId = wxOpenId == null ? null : wxOpenId.trim(); 72 | } 73 | 74 | public Date getCreateTime() { 75 | return createTime; 76 | } 77 | 78 | public void setCreateTime(Date createTime) { 79 | this.createTime = createTime; 80 | } 81 | 82 | public Date getEndTime() { 83 | return endTime; 84 | } 85 | 86 | public void setEndTime(Date endTime) { 87 | this.endTime = endTime; 88 | } 89 | 90 | public String getUserName() { 91 | return userName; 92 | } 93 | 94 | public void setUserName(String userName) { 95 | this.userName = userName == null ? null : userName.trim(); 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/controller/student/UploadController.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.controller.student; 2 | 3 | 4 | import com.mindskip.xzs.base.BaseApiController; 5 | import com.mindskip.xzs.base.RestResponse; 6 | import com.mindskip.xzs.service.FileUpload; 7 | import com.mindskip.xzs.service.UserService; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.web.bind.annotation.RequestMapping; 10 | import org.springframework.web.bind.annotation.ResponseBody; 11 | import org.springframework.web.bind.annotation.RestController; 12 | import org.springframework.web.multipart.MultipartFile; 13 | import org.springframework.web.multipart.MultipartHttpServletRequest; 14 | 15 | import javax.servlet.http.HttpServletRequest; 16 | import java.io.IOException; 17 | import java.io.InputStream; 18 | 19 | 20 | @RequestMapping("/api/student/upload") 21 | @RestController("StudentUploadController") 22 | public class UploadController extends BaseApiController { 23 | 24 | private final FileUpload fileUpload; 25 | private final UserService userService; 26 | 27 | @Autowired 28 | public UploadController(FileUpload fileUpload, UserService userService) { 29 | this.fileUpload = fileUpload; 30 | this.userService = userService; 31 | } 32 | 33 | 34 | @RequestMapping("/image") 35 | @ResponseBody 36 | public RestResponse questionUploadAndReadExcel(HttpServletRequest request) { 37 | MultipartHttpServletRequest multipartHttpServletRequest = (MultipartHttpServletRequest) request; 38 | MultipartFile multipartFile = multipartHttpServletRequest.getFile("file"); 39 | long attachSize = multipartFile.getSize(); 40 | String imgName = multipartFile.getOriginalFilename(); 41 | try (InputStream inputStream = multipartFile.getInputStream()) { 42 | String filePath = fileUpload.uploadFile(inputStream, attachSize, imgName); 43 | userService.changePicture(getCurrentUser(), filePath); 44 | return RestResponse.ok(filePath); 45 | } catch (IOException e) { 46 | return RestResponse.fail(2, e.getMessage()); 47 | } 48 | } 49 | 50 | 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/configuration/property/WxConfig.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.configuration.property; 2 | 3 | 4 | import java.time.Duration; 5 | import java.util.List; 6 | 7 | /** 8 | * @version 3.5.0 9 | * @description: The type Wx config. 10 | * Copyright (C), 2020-2024, 武汉思维跳跃科技有限公司 11 | * @date 2021/12/25 9:45 12 | */ 13 | public class WxConfig { 14 | 15 | 16 | private String appid; 17 | private String secret; 18 | private Duration tokenToLive; 19 | private List securityIgnoreUrls; 20 | 21 | /** 22 | * Gets appid. 23 | * 24 | * @return the appid 25 | */ 26 | public String getAppid() { 27 | return appid; 28 | } 29 | 30 | /** 31 | * Sets appid. 32 | * 33 | * @param appid the appid 34 | */ 35 | public void setAppid(String appid) { 36 | this.appid = appid; 37 | } 38 | 39 | /** 40 | * Gets secret. 41 | * 42 | * @return the secret 43 | */ 44 | public String getSecret() { 45 | return secret; 46 | } 47 | 48 | /** 49 | * Sets secret. 50 | * 51 | * @param secret the secret 52 | */ 53 | public void setSecret(String secret) { 54 | this.secret = secret; 55 | } 56 | 57 | /** 58 | * Gets token to live. 59 | * 60 | * @return the token to live 61 | */ 62 | public Duration getTokenToLive() { 63 | return tokenToLive; 64 | } 65 | 66 | /** 67 | * Sets token to live. 68 | * 69 | * @param tokenToLive the token to live 70 | */ 71 | public void setTokenToLive(Duration tokenToLive) { 72 | this.tokenToLive = tokenToLive; 73 | } 74 | 75 | /** 76 | * Gets security ignore urls. 77 | * 78 | * @return the security ignore urls 79 | */ 80 | public List getSecurityIgnoreUrls() { 81 | return securityIgnoreUrls; 82 | } 83 | 84 | /** 85 | * Sets security ignore urls. 86 | * 87 | * @param securityIgnoreUrls the security ignore urls 88 | */ 89 | public void setSecurityIgnoreUrls(List securityIgnoreUrls) { 90 | this.securityIgnoreUrls = securityIgnoreUrls; 91 | } 92 | 93 | } 94 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/configuration/property/SystemConfig.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.configuration.property; 2 | 3 | import org.springframework.boot.context.properties.ConfigurationProperties; 4 | 5 | import java.util.List; 6 | 7 | 8 | /** 9 | * @version 3.5.0 10 | * @description: The type System config. 11 | * Copyright (C), 2020-2024, 武汉思维跳跃科技有限公司 12 | * @date 2021/12/25 9:45 13 | */ 14 | @ConfigurationProperties(prefix = "system") 15 | public class SystemConfig { 16 | 17 | private PasswordKeyConfig pwdKey; 18 | private List securityIgnoreUrls; 19 | private WxConfig wx; 20 | private QnConfig qn; 21 | 22 | /** 23 | * Gets pwd key. 24 | * 25 | * @return the pwd key 26 | */ 27 | public PasswordKeyConfig getPwdKey() { 28 | return pwdKey; 29 | } 30 | 31 | /** 32 | * Sets pwd key. 33 | * 34 | * @param pwdKey the pwd key 35 | */ 36 | public void setPwdKey(PasswordKeyConfig pwdKey) { 37 | this.pwdKey = pwdKey; 38 | } 39 | 40 | /** 41 | * Gets security ignore urls. 42 | * 43 | * @return the security ignore urls 44 | */ 45 | public List getSecurityIgnoreUrls() { 46 | return securityIgnoreUrls; 47 | } 48 | 49 | /** 50 | * Sets security ignore urls. 51 | * 52 | * @param securityIgnoreUrls the security ignore urls 53 | */ 54 | public void setSecurityIgnoreUrls(List securityIgnoreUrls) { 55 | this.securityIgnoreUrls = securityIgnoreUrls; 56 | } 57 | 58 | /** 59 | * Gets wx. 60 | * 61 | * @return the wx 62 | */ 63 | public WxConfig getWx() { 64 | return wx; 65 | } 66 | 67 | /** 68 | * Sets wx. 69 | * 70 | * @param wx the wx 71 | */ 72 | public void setWx(WxConfig wx) { 73 | this.wx = wx; 74 | } 75 | 76 | /** 77 | * Gets qn. 78 | * 79 | * @return the qn 80 | */ 81 | public QnConfig getQn() { 82 | return qn; 83 | } 84 | 85 | /** 86 | * Sets qn. 87 | * 88 | * @param qn the qn 89 | */ 90 | public void setQn(QnConfig qn) { 91 | this.qn = qn; 92 | } 93 | 94 | } 95 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/domain/UserEventLog.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.domain; 2 | 3 | import java.io.Serializable; 4 | import java.util.Date; 5 | 6 | public class UserEventLog implements Serializable { 7 | 8 | private static final long serialVersionUID = -3951198127152024633L; 9 | 10 | 11 | public UserEventLog() { 12 | 13 | } 14 | 15 | public UserEventLog(Integer userId, String userName, String realName, Date createTime) { 16 | this.userId = userId; 17 | this.userName = userName; 18 | this.realName = realName; 19 | this.createTime = createTime; 20 | } 21 | 22 | private Integer id; 23 | 24 | /** 25 | * 用户id 26 | */ 27 | private Integer userId; 28 | 29 | /** 30 | * 用户名 31 | */ 32 | private String userName; 33 | 34 | /** 35 | * 真实姓名 36 | */ 37 | private String realName; 38 | 39 | /** 40 | * 内容 41 | */ 42 | private String content; 43 | 44 | /** 45 | * 时间 46 | */ 47 | private Date createTime; 48 | 49 | public Integer getId() { 50 | return id; 51 | } 52 | 53 | public void setId(Integer id) { 54 | this.id = id; 55 | } 56 | 57 | public Integer getUserId() { 58 | return userId; 59 | } 60 | 61 | public void setUserId(Integer userId) { 62 | this.userId = userId; 63 | } 64 | 65 | public String getUserName() { 66 | return userName; 67 | } 68 | 69 | public void setUserName(String userName) { 70 | this.userName = userName == null ? null : userName.trim(); 71 | } 72 | 73 | public String getRealName() { 74 | return realName; 75 | } 76 | 77 | public void setRealName(String realName) { 78 | this.realName = realName == null ? null : realName.trim(); 79 | } 80 | 81 | public String getContent() { 82 | return content; 83 | } 84 | 85 | public void setContent(String content) { 86 | this.content = content == null ? null : content.trim(); 87 | } 88 | 89 | public Date getCreateTime() { 90 | return createTime; 91 | } 92 | 93 | public void setCreateTime(Date createTime) { 94 | this.createTime = createTime; 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/viewmodel/admin/dashboard/IndexVM.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.viewmodel.admin.dashboard; 2 | 3 | 4 | 5 | import java.util.List; 6 | 7 | 8 | public class IndexVM { 9 | private Integer examPaperCount; 10 | private Integer questionCount; 11 | private Integer doExamPaperCount; 12 | private Integer doQuestionCount; 13 | private List mothDayUserActionValue; 14 | private List mothDayDoExamQuestionValue; 15 | private List mothDayText; 16 | 17 | public Integer getExamPaperCount() { 18 | return examPaperCount; 19 | } 20 | 21 | public void setExamPaperCount(Integer examPaperCount) { 22 | this.examPaperCount = examPaperCount; 23 | } 24 | 25 | public Integer getQuestionCount() { 26 | return questionCount; 27 | } 28 | 29 | public void setQuestionCount(Integer questionCount) { 30 | this.questionCount = questionCount; 31 | } 32 | 33 | public Integer getDoExamPaperCount() { 34 | return doExamPaperCount; 35 | } 36 | 37 | public void setDoExamPaperCount(Integer doExamPaperCount) { 38 | this.doExamPaperCount = doExamPaperCount; 39 | } 40 | 41 | public Integer getDoQuestionCount() { 42 | return doQuestionCount; 43 | } 44 | 45 | public void setDoQuestionCount(Integer doQuestionCount) { 46 | this.doQuestionCount = doQuestionCount; 47 | } 48 | 49 | public List getMothDayUserActionValue() { 50 | return mothDayUserActionValue; 51 | } 52 | 53 | public void setMothDayUserActionValue(List mothDayUserActionValue) { 54 | this.mothDayUserActionValue = mothDayUserActionValue; 55 | } 56 | 57 | public List getMothDayDoExamQuestionValue() { 58 | return mothDayDoExamQuestionValue; 59 | } 60 | 61 | public void setMothDayDoExamQuestionValue(List mothDayDoExamQuestionValue) { 62 | this.mothDayDoExamQuestionValue = mothDayDoExamQuestionValue; 63 | } 64 | 65 | public List getMothDayText() { 66 | return mothDayText; 67 | } 68 | 69 | public void setMothDayText(List mothDayText) { 70 | this.mothDayText = mothDayText; 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/viewmodel/admin/exam/ExamResponseVM.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.viewmodel.admin.exam; 2 | 3 | 4 | 5 | 6 | public class ExamResponseVM { 7 | private Integer id; 8 | 9 | private String name; 10 | 11 | private Integer questionCount; 12 | 13 | private Integer score; 14 | 15 | private String createTime; 16 | 17 | private Integer createUser; 18 | 19 | private Integer subjectId; 20 | 21 | private Integer paperType; 22 | 23 | private Integer frameTextContentId; 24 | 25 | public Integer getId() { 26 | return id; 27 | } 28 | 29 | public void setId(Integer id) { 30 | this.id = id; 31 | } 32 | 33 | public String getName() { 34 | return name; 35 | } 36 | 37 | public void setName(String name) { 38 | this.name = name; 39 | } 40 | 41 | public Integer getQuestionCount() { 42 | return questionCount; 43 | } 44 | 45 | public void setQuestionCount(Integer questionCount) { 46 | this.questionCount = questionCount; 47 | } 48 | 49 | public Integer getScore() { 50 | return score; 51 | } 52 | 53 | public void setScore(Integer score) { 54 | this.score = score; 55 | } 56 | 57 | public String getCreateTime() { 58 | return createTime; 59 | } 60 | 61 | public void setCreateTime(String createTime) { 62 | this.createTime = createTime; 63 | } 64 | 65 | public Integer getCreateUser() { 66 | return createUser; 67 | } 68 | 69 | public void setCreateUser(Integer createUser) { 70 | this.createUser = createUser; 71 | } 72 | 73 | public Integer getSubjectId() { 74 | return subjectId; 75 | } 76 | 77 | public void setSubjectId(Integer subjectId) { 78 | this.subjectId = subjectId; 79 | } 80 | 81 | public Integer getPaperType() { 82 | return paperType; 83 | } 84 | 85 | public void setPaperType(Integer paperType) { 86 | this.paperType = paperType; 87 | } 88 | 89 | public Integer getFrameTextContentId() { 90 | return frameTextContentId; 91 | } 92 | 93 | public void setFrameTextContentId(Integer frameTextContentId) { 94 | this.frameTextContentId = frameTextContentId; 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/context/WebContext.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.context; 2 | 3 | import com.mindskip.xzs.domain.User; 4 | import com.mindskip.xzs.service.UserService; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.security.core.context.SecurityContextHolder; 7 | import org.springframework.stereotype.Component; 8 | import org.springframework.web.context.request.RequestAttributes; 9 | import org.springframework.web.context.request.RequestContextHolder; 10 | 11 | /** 12 | * @version 3.3.0 13 | * @description: The enum System code. 14 | * Copyright (C), 2020-2024, 武汉思维跳跃科技有限公司 15 | * @date 2021/5/25 10:45 16 | */ 17 | @Component 18 | public class WebContext { 19 | private static final String USER_ATTRIBUTES = "USER_ATTRIBUTES"; 20 | private final UserService userService; 21 | 22 | /** 23 | * Instantiates a new Web context. 24 | * 25 | * @param userService the user service 26 | */ 27 | @Autowired 28 | public WebContext(UserService userService) { 29 | this.userService = userService; 30 | } 31 | 32 | 33 | /** 34 | * Sets current user. 35 | * 36 | * @param user the user 37 | */ 38 | public void setCurrentUser(User user) { 39 | RequestContextHolder.currentRequestAttributes().setAttribute(USER_ATTRIBUTES, user, RequestAttributes.SCOPE_REQUEST); 40 | } 41 | 42 | /** 43 | * Gets current user. 44 | * 45 | * @return the current user 46 | */ 47 | public User getCurrentUser() { 48 | User user = (User) RequestContextHolder.currentRequestAttributes().getAttribute(USER_ATTRIBUTES, RequestAttributes.SCOPE_REQUEST); 49 | if (null != user) { 50 | return user; 51 | } else { 52 | org.springframework.security.core.userdetails.User springUser = (org.springframework.security.core.userdetails.User) SecurityContextHolder.getContext().getAuthentication().getPrincipal(); 53 | if (null == springUser) { 54 | return null; 55 | } 56 | user = userService.getUserByUserName(springUser.getUsername()); 57 | if (null != user) { 58 | setCurrentUser(user); 59 | } 60 | return user; 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/viewmodel/admin/paper/ExamAnswerResponseVM.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.viewmodel.admin.paper; 2 | 3 | 4 | public class ExamAnswerResponseVM { 5 | private Integer id; 6 | 7 | private String name; 8 | 9 | private Integer questionCount; 10 | 11 | private Integer score; 12 | 13 | private String createTime; 14 | 15 | private Integer createUser; 16 | 17 | private Integer subjectId; 18 | 19 | private Integer paperType; 20 | 21 | private Integer frameTextContentId; 22 | 23 | public Integer getId() { 24 | return id; 25 | } 26 | 27 | public void setId(Integer id) { 28 | this.id = id; 29 | } 30 | 31 | public String getName() { 32 | return name; 33 | } 34 | 35 | public void setName(String name) { 36 | this.name = name; 37 | } 38 | 39 | public Integer getQuestionCount() { 40 | return questionCount; 41 | } 42 | 43 | public void setQuestionCount(Integer questionCount) { 44 | this.questionCount = questionCount; 45 | } 46 | 47 | public Integer getScore() { 48 | return score; 49 | } 50 | 51 | public void setScore(Integer score) { 52 | this.score = score; 53 | } 54 | 55 | public String getCreateTime() { 56 | return createTime; 57 | } 58 | 59 | public void setCreateTime(String createTime) { 60 | this.createTime = createTime; 61 | } 62 | 63 | public Integer getCreateUser() { 64 | return createUser; 65 | } 66 | 67 | public void setCreateUser(Integer createUser) { 68 | this.createUser = createUser; 69 | } 70 | 71 | public Integer getSubjectId() { 72 | return subjectId; 73 | } 74 | 75 | public void setSubjectId(Integer subjectId) { 76 | this.subjectId = subjectId; 77 | } 78 | 79 | public Integer getPaperType() { 80 | return paperType; 81 | } 82 | 83 | public void setPaperType(Integer paperType) { 84 | this.paperType = paperType; 85 | } 86 | 87 | public Integer getFrameTextContentId() { 88 | return frameTextContentId; 89 | } 90 | 91 | public void setFrameTextContentId(Integer frameTextContentId) { 92 | this.frameTextContentId = frameTextContentId; 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/service/impl/UserEventLogServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.service.impl; 2 | 3 | import com.mindskip.xzs.domain.UserEventLog; 4 | import com.mindskip.xzs.domain.other.KeyValue; 5 | import com.mindskip.xzs.repository.UserEventLogMapper; 6 | import com.mindskip.xzs.service.UserEventLogService; 7 | import com.mindskip.xzs.utility.DateTimeUtil; 8 | import com.mindskip.xzs.viewmodel.admin.user.UserEventPageRequestVM; 9 | import com.github.pagehelper.PageHelper; 10 | import com.github.pagehelper.PageInfo; 11 | import org.springframework.beans.factory.annotation.Autowired; 12 | import org.springframework.stereotype.Service; 13 | 14 | import java.util.Date; 15 | import java.util.List; 16 | import java.util.stream.Collectors; 17 | 18 | @Service 19 | public class UserEventLogServiceImpl extends BaseServiceImpl implements UserEventLogService { 20 | 21 | private final UserEventLogMapper userEventLogMapper; 22 | 23 | @Autowired 24 | public UserEventLogServiceImpl(UserEventLogMapper userEventLogMapper) { 25 | super(userEventLogMapper); 26 | this.userEventLogMapper = userEventLogMapper; 27 | } 28 | 29 | @Override 30 | public List getUserEventLogByUserId(Integer id) { 31 | return userEventLogMapper.getUserEventLogByUserId(id); 32 | } 33 | 34 | @Override 35 | public PageInfo page(UserEventPageRequestVM requestVM) { 36 | return PageHelper.startPage(requestVM.getPageIndex(), requestVM.getPageSize(), "id desc").doSelectPageInfo(() -> 37 | userEventLogMapper.page(requestVM) 38 | ); 39 | } 40 | 41 | 42 | @Override 43 | public List selectMothCount() { 44 | Date startTime = DateTimeUtil.getMonthStartDay(); 45 | Date endTime = DateTimeUtil.getMonthEndDay(); 46 | List mouthCount = userEventLogMapper.selectCountByDate(startTime, endTime); 47 | List mothStartToNowFormat = DateTimeUtil.MothStartToNowFormat(); 48 | return mothStartToNowFormat.stream().map(md -> { 49 | KeyValue keyValue = mouthCount.stream().filter(kv -> kv.getName().equals(md)).findAny().orElse(null); 50 | return null == keyValue ? 0 : keyValue.getValue(); 51 | }).collect(Collectors.toList()); 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/configuration/spring/security/RestLogoutSuccessHandler.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.configuration.spring.security; 2 | 3 | import com.mindskip.xzs.base.SystemCode; 4 | import com.mindskip.xzs.domain.User; 5 | import com.mindskip.xzs.domain.UserEventLog; 6 | import com.mindskip.xzs.event.UserEvent; 7 | import com.mindskip.xzs.service.UserService; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.context.ApplicationEventPublisher; 10 | import org.springframework.security.core.Authentication; 11 | import org.springframework.security.web.authentication.logout.SimpleUrlLogoutSuccessHandler; 12 | import org.springframework.stereotype.Component; 13 | 14 | import javax.servlet.http.HttpServletRequest; 15 | import javax.servlet.http.HttpServletResponse; 16 | import java.util.Date; 17 | 18 | 19 | /** 20 | * @version 3.5.0 21 | * @description: 用户登出 22 | * Copyright (C), 2020-2024, 武汉思维跳跃科技有限公司 23 | * @date 2021/12/25 9:45 24 | */ 25 | @Component 26 | public class RestLogoutSuccessHandler extends SimpleUrlLogoutSuccessHandler { 27 | 28 | private final ApplicationEventPublisher eventPublisher; 29 | private final UserService userService; 30 | 31 | /** 32 | * Instantiates a new Rest logout success handler. 33 | * 34 | * @param eventPublisher the event publisher 35 | * @param userService the user service 36 | */ 37 | @Autowired 38 | public RestLogoutSuccessHandler(ApplicationEventPublisher eventPublisher, UserService userService) { 39 | this.eventPublisher = eventPublisher; 40 | this.userService = userService; 41 | } 42 | 43 | @Override 44 | public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) { 45 | org.springframework.security.core.userdetails.User springUser = (org.springframework.security.core.userdetails.User) authentication.getPrincipal(); 46 | if (null != springUser) { 47 | User user = userService.getUserByUserName(springUser.getUsername()); 48 | UserEventLog userEventLog = new UserEventLog(user.getId(), user.getUserName(), user.getRealName(), new Date()); 49 | userEventLog.setContent(user.getUserName() + " 登出了学之思开源考试系统"); 50 | eventPublisher.publishEvent(new UserEvent(userEventLog)); 51 | } 52 | RestUtil.response(response, SystemCode.OK); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/service/impl/TextContentServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.service.impl; 2 | 3 | import com.mindskip.xzs.domain.TextContent; 4 | import com.mindskip.xzs.repository.TextContentMapper; 5 | import com.mindskip.xzs.service.TextContentService; 6 | import com.mindskip.xzs.utility.JsonUtil; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.stereotype.Service; 9 | 10 | import java.util.Date; 11 | import java.util.List; 12 | import java.util.function.Function; 13 | import java.util.stream.Collectors; 14 | 15 | @Service 16 | public class TextContentServiceImpl extends BaseServiceImpl implements TextContentService { 17 | 18 | private final TextContentMapper textContentMapper; 19 | 20 | @Autowired 21 | public TextContentServiceImpl(TextContentMapper textContentMapper) { 22 | super(textContentMapper); 23 | this.textContentMapper = textContentMapper; 24 | } 25 | 26 | @Override 27 | public TextContent selectById(Integer id) { 28 | return super.selectById(id); 29 | } 30 | 31 | @Override 32 | public int insertByFilter(TextContent record) { 33 | return super.insertByFilter(record); 34 | } 35 | 36 | @Override 37 | public int updateByIdFilter(TextContent record) { 38 | return super.updateByIdFilter(record); 39 | } 40 | 41 | @Override 42 | public TextContent jsonConvertInsert(List list, Date now, Function mapper) { 43 | String frameTextContent = null; 44 | if (null == mapper) { 45 | frameTextContent = JsonUtil.toJsonStr(list); 46 | } else { 47 | List mapList = list.stream().map(mapper).collect(Collectors.toList()); 48 | frameTextContent = JsonUtil.toJsonStr(mapList); 49 | } 50 | TextContent textContent = new TextContent(frameTextContent, now); 51 | return textContent; 52 | } 53 | 54 | @Override 55 | public TextContent jsonConvertUpdate(TextContent textContent, List list, Function mapper) { 56 | String frameTextContent = null; 57 | if (null == mapper) { 58 | frameTextContent = JsonUtil.toJsonStr(list); 59 | } else { 60 | List mapList = list.stream().map(mapper).collect(Collectors.toList()); 61 | frameTextContent = JsonUtil.toJsonStr(mapList); 62 | } 63 | textContent.setContent(frameTextContent); 64 | return textContent; 65 | } 66 | 67 | 68 | 69 | } 70 | -------------------------------------------------------------------------------- /src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8000 3 | undertow: 4 | io-threads: 16 5 | worker-threads: 4000 6 | buffer-size: 1024 7 | direct-buffers: true 8 | compression: 9 | enabled: true 10 | min-response-size: 1 11 | 12 | #logging logback 13 | logging: 14 | config: classpath:logback-spring.xml 15 | file: xzs 16 | 17 | #mybatis 18 | mybatis: 19 | mapper-locations: classpath:/mapper/*.xml 20 | configuration: 21 | log-prefix: repository. 22 | 23 | 24 | system: 25 | security-ignore-urls: 26 | - /api/wx/** 27 | - /api/admin/upload/configAndUpload 28 | - /api/admin/upload/auth 29 | - /api/student/user/register 30 | pwdKey: 31 | publicKey: MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQClwwxhJKwStDnu7c0yCRkwTW2VKuLWwyVtFC6Zx9bYdF1qwqSP26CkDwaF6GHayIvv9b8BHlAaQH4SLIPzir062yzNukqspmthUw4gPJhbx1AQrWRoQJSv3/1Sk+tWyJRHXSiCZJZ3216LDhtx42LQ0HItDP8U9BLtsxA+5LEZzQIDAQAB 32 | privateKey: MIICeAIBADANBgkqhkiG9w0BAQEFAASCAmIwggJeAgEAAoGBAKXDDGEkrBK0Oe7tzTIJGTBNbZUq4tbDJW0ULpnH1th0XWrCpI/boKQPBoXoYdrIi+/1vwEeUBpAfhIsg/OKvTrbLM26Sqyma2FTDiA8mFvHUBCtZGhAlK/f/VKT61bIlEddKIJklnfbXosOG3HjYtDQci0M/xT0Eu2zED7ksRnNAgMBAAECgYEAlCuz5yn2volnt9HNuEo1v92WdN5vAnZSAB0oQsJFpBrwXjw7CXTTNZNQy2YcAot9uzO6Vu+Xvr+jce9ky9BasM7ehz0gnwJWAO79IqUnmu3RRq7HllDwp72qysXIypJZCF4HX5jAzUGlNzlTSUb1H4LtavKc6a//YqPfQ0jTLsECQQDZuGKGAYq6rBCX0+T8qlQpCPc41wsl4Gi9lLD21ks9PMx44JdhsUrqLWItZiGynDzq1LJ3M1hr3gbSsPQcI9HJAkEAwugDFCiRLOqOBRRGlYbzgGdmXbR4SrMNIpcFTFhU+MsEqaMueVPiNtRSIK6W8pS28ZN0aiZDTBAT84fOIENp5QJBAJaVgQ9OYbVa7N8WH3riE/ONz+/wTDWWUNtOzFbtQHzKYGH6dLmM9lOhsBXWXdg7V6bUFdt8F9wDZJS07yHHZIECQG4rHrJiS80Lt8L/NvaGFVVbHO2SePwgQShwHLqOo1kNyFDqv/YsiA1d7h4zEXeEv/PE2WS2xAtWezCIbualtFECQQDPUkYhs3vZoZgsltdeFnv/WoXaXNRIzunMTmksIlh8JP7C1xQHrwdCpUkffgSVphxGJGHkxooMpki7oTC1Mdjx 33 | wx: 34 | appid: wxa0d64cf3de0cc0ce 35 | secret: 36 | token-to-live: 12h #token 过期时间 37 | security-ignore-urls: 38 | - /api/wx/student/auth/bind 39 | - /api/wx/student/auth/checkBind 40 | - /api/wx/student/user/register 41 | qn: 42 | url: http://xzs.file.mindskip.net 43 | bucket: mindskip 44 | access-key: KabOBTPGVll2sSV8d1OIlW8G4_n_cReE7RSsLafA 45 | secret-key: mSltk9_9KtCdFetCmxvvCAgsBg8JZHiXMuQeqSJA 46 | 47 | 48 | #mybatis page helper 49 | pagehelper: 50 | autoDialect: true 51 | closeConn: true 52 | reasonable: true 53 | 54 | 55 | #mybatis datasource default HikariPool 56 | spring: 57 | datasource: 58 | hikari: 59 | idle-timeout: 600000 #10 min 60 | max-lifetime: 1800000 #30 min 61 | 62 | 63 | #runningtime environment 64 | profiles: 65 | active: dev 66 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/controller/student/ExamPaperController.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.controller.student; 2 | 3 | import com.mindskip.xzs.base.BaseApiController; 4 | import com.mindskip.xzs.base.RestResponse; 5 | import com.mindskip.xzs.domain.ExamPaper; 6 | import com.mindskip.xzs.service.ExamPaperAnswerService; 7 | import com.mindskip.xzs.service.ExamPaperService; 8 | import com.mindskip.xzs.utility.DateTimeUtil; 9 | import com.mindskip.xzs.utility.PageInfoHelper; 10 | import com.mindskip.xzs.viewmodel.admin.exam.ExamPaperEditRequestVM; 11 | import com.mindskip.xzs.viewmodel.student.exam.ExamPaperPageResponseVM; 12 | import com.mindskip.xzs.viewmodel.student.exam.ExamPaperPageVM; 13 | import com.github.pagehelper.PageInfo; 14 | import org.springframework.beans.factory.annotation.Autowired; 15 | import org.springframework.context.ApplicationEventPublisher; 16 | import org.springframework.web.bind.annotation.*; 17 | 18 | import javax.validation.Valid; 19 | 20 | @RestController("StudentExamPaperController") 21 | @RequestMapping(value = "/api/student/exam/paper") 22 | public class ExamPaperController extends BaseApiController { 23 | 24 | private final ExamPaperService examPaperService; 25 | private final ExamPaperAnswerService examPaperAnswerService; 26 | private final ApplicationEventPublisher eventPublisher; 27 | 28 | @Autowired 29 | public ExamPaperController(ExamPaperService examPaperService, ExamPaperAnswerService examPaperAnswerService, ApplicationEventPublisher eventPublisher) { 30 | this.examPaperService = examPaperService; 31 | this.examPaperAnswerService = examPaperAnswerService; 32 | this.eventPublisher = eventPublisher; 33 | } 34 | 35 | 36 | @RequestMapping(value = "/select/{id}", method = RequestMethod.POST) 37 | public RestResponse select(@PathVariable Integer id) { 38 | ExamPaperEditRequestVM vm = examPaperService.examPaperToVM(id); 39 | return RestResponse.ok(vm); 40 | } 41 | 42 | 43 | @RequestMapping(value = "/pageList", method = RequestMethod.POST) 44 | public RestResponse> pageList(@RequestBody @Valid ExamPaperPageVM model) { 45 | PageInfo pageInfo = examPaperService.studentPage(model); 46 | PageInfo page = PageInfoHelper.copyMap(pageInfo, e -> { 47 | ExamPaperPageResponseVM vm = modelMapper.map(e, ExamPaperPageResponseVM.class); 48 | vm.setCreateTime(DateTimeUtil.dateFormat(e.getCreateTime())); 49 | return vm; 50 | }); 51 | return RestResponse.ok(page); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/domain/TaskExam.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.domain; 2 | 3 | import java.io.Serializable; 4 | import java.util.Date; 5 | 6 | public class TaskExam implements Serializable { 7 | 8 | private static final long serialVersionUID = -7014704644631536195L; 9 | 10 | private Integer id; 11 | 12 | /** 13 | * 任务标题 14 | */ 15 | private String title; 16 | 17 | /** 18 | * 年级 19 | */ 20 | private Integer gradeLevel; 21 | 22 | /** 23 | * 任务框架 内容为JSON 24 | */ 25 | private Integer frameTextContentId; 26 | 27 | /** 28 | * 创建者 29 | */ 30 | private Integer createUser; 31 | 32 | /** 33 | * 创建时间 34 | */ 35 | private Date createTime; 36 | 37 | private Boolean deleted; 38 | 39 | /** 40 | * 创建人用户名 41 | */ 42 | private String createUserName; 43 | 44 | public Integer getId() { 45 | return id; 46 | } 47 | 48 | public void setId(Integer id) { 49 | this.id = id; 50 | } 51 | 52 | public String getTitle() { 53 | return title; 54 | } 55 | 56 | public void setTitle(String title) { 57 | this.title = title == null ? null : title.trim(); 58 | } 59 | 60 | public Integer getGradeLevel() { 61 | return gradeLevel; 62 | } 63 | 64 | public void setGradeLevel(Integer gradeLevel) { 65 | this.gradeLevel = gradeLevel; 66 | } 67 | 68 | public Integer getFrameTextContentId() { 69 | return frameTextContentId; 70 | } 71 | 72 | public void setFrameTextContentId(Integer frameTextContentId) { 73 | this.frameTextContentId = frameTextContentId; 74 | } 75 | 76 | public Integer getCreateUser() { 77 | return createUser; 78 | } 79 | 80 | public void setCreateUser(Integer createUser) { 81 | this.createUser = createUser; 82 | } 83 | 84 | public Date getCreateTime() { 85 | return createTime; 86 | } 87 | 88 | public void setCreateTime(Date createTime) { 89 | this.createTime = createTime; 90 | } 91 | 92 | public Boolean getDeleted() { 93 | return deleted; 94 | } 95 | 96 | public void setDeleted(Boolean deleted) { 97 | this.deleted = deleted; 98 | } 99 | 100 | public String getCreateUserName() { 101 | return createUserName; 102 | } 103 | 104 | public void setCreateUserName(String createUserName) { 105 | this.createUserName = createUserName == null ? null : createUserName.trim(); 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/domain/MessageUser.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.domain; 2 | 3 | import java.io.Serializable; 4 | import java.util.Date; 5 | 6 | public class MessageUser implements Serializable { 7 | 8 | private static final long serialVersionUID = -4042932811802896498L; 9 | 10 | private Integer id; 11 | 12 | /** 13 | * 消息内容ID 14 | */ 15 | private Integer messageId; 16 | 17 | /** 18 | * 接收人ID 19 | */ 20 | private Integer receiveUserId; 21 | 22 | /** 23 | * 接收人用户名 24 | */ 25 | private String receiveUserName; 26 | 27 | /** 28 | * 接收人真实姓名 29 | */ 30 | private String receiveRealName; 31 | 32 | /** 33 | * 是否已读 34 | */ 35 | private Boolean readed; 36 | 37 | private Date createTime; 38 | 39 | /** 40 | * 阅读时间 41 | */ 42 | private Date readTime; 43 | 44 | public Integer getId() { 45 | return id; 46 | } 47 | 48 | public void setId(Integer id) { 49 | this.id = id; 50 | } 51 | 52 | public Integer getMessageId() { 53 | return messageId; 54 | } 55 | 56 | public void setMessageId(Integer messageId) { 57 | this.messageId = messageId; 58 | } 59 | 60 | public Integer getReceiveUserId() { 61 | return receiveUserId; 62 | } 63 | 64 | public void setReceiveUserId(Integer receiveUserId) { 65 | this.receiveUserId = receiveUserId; 66 | } 67 | 68 | public String getReceiveUserName() { 69 | return receiveUserName; 70 | } 71 | 72 | public void setReceiveUserName(String receiveUserName) { 73 | this.receiveUserName = receiveUserName == null ? null : receiveUserName.trim(); 74 | } 75 | 76 | public String getReceiveRealName() { 77 | return receiveRealName; 78 | } 79 | 80 | public void setReceiveRealName(String receiveRealName) { 81 | this.receiveRealName = receiveRealName == null ? null : receiveRealName.trim(); 82 | } 83 | 84 | public Boolean getReaded() { 85 | return readed; 86 | } 87 | 88 | public void setReaded(Boolean readed) { 89 | this.readed = readed; 90 | } 91 | 92 | public Date getCreateTime() { 93 | return createTime; 94 | } 95 | 96 | public void setCreateTime(Date createTime) { 97 | this.createTime = createTime; 98 | } 99 | 100 | public Date getReadTime() { 101 | return readTime; 102 | } 103 | 104 | public void setReadTime(Date readTime) { 105 | this.readTime = readTime; 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/viewmodel/student/exam/ExamPaperPageResponseVM.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.viewmodel.student.exam; 2 | 3 | 4 | public class ExamPaperPageResponseVM { 5 | private Integer id; 6 | 7 | private String name; 8 | 9 | private Integer questionCount; 10 | 11 | private Integer score; 12 | 13 | private String createTime; 14 | 15 | private Integer createUser; 16 | 17 | private Integer subjectId; 18 | 19 | private String subjectName; 20 | 21 | private Integer paperType; 22 | 23 | private Integer frameTextContentId; 24 | 25 | public Integer getId() { 26 | return id; 27 | } 28 | 29 | public void setId(Integer id) { 30 | this.id = id; 31 | } 32 | 33 | public String getName() { 34 | return name; 35 | } 36 | 37 | public void setName(String name) { 38 | this.name = name; 39 | } 40 | 41 | public Integer getQuestionCount() { 42 | return questionCount; 43 | } 44 | 45 | public void setQuestionCount(Integer questionCount) { 46 | this.questionCount = questionCount; 47 | } 48 | 49 | public Integer getScore() { 50 | return score; 51 | } 52 | 53 | public void setScore(Integer score) { 54 | this.score = score; 55 | } 56 | 57 | public String getCreateTime() { 58 | return createTime; 59 | } 60 | 61 | public void setCreateTime(String createTime) { 62 | this.createTime = createTime; 63 | } 64 | 65 | public Integer getCreateUser() { 66 | return createUser; 67 | } 68 | 69 | public void setCreateUser(Integer createUser) { 70 | this.createUser = createUser; 71 | } 72 | 73 | public Integer getSubjectId() { 74 | return subjectId; 75 | } 76 | 77 | public void setSubjectId(Integer subjectId) { 78 | this.subjectId = subjectId; 79 | } 80 | 81 | public String getSubjectName() { 82 | return subjectName; 83 | } 84 | 85 | public void setSubjectName(String subjectName) { 86 | this.subjectName = subjectName; 87 | } 88 | 89 | public Integer getPaperType() { 90 | return paperType; 91 | } 92 | 93 | public void setPaperType(Integer paperType) { 94 | this.paperType = paperType; 95 | } 96 | 97 | public Integer getFrameTextContentId() { 98 | return frameTextContentId; 99 | } 100 | 101 | public void setFrameTextContentId(Integer frameTextContentId) { 102 | this.frameTextContentId = frameTextContentId; 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/controller/wx/student/ExamPaperController.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.controller.wx.student; 2 | 3 | import com.mindskip.xzs.base.RestResponse; 4 | import com.mindskip.xzs.controller.wx.BaseWXApiController; 5 | import com.mindskip.xzs.domain.ExamPaper; 6 | import com.mindskip.xzs.domain.Subject; 7 | import com.mindskip.xzs.service.ExamPaperService; 8 | import com.mindskip.xzs.service.SubjectService; 9 | import com.mindskip.xzs.utility.DateTimeUtil; 10 | import com.mindskip.xzs.utility.PageInfoHelper; 11 | import com.mindskip.xzs.viewmodel.admin.exam.ExamPaperEditRequestVM; 12 | import com.mindskip.xzs.viewmodel.student.exam.ExamPaperPageResponseVM; 13 | import com.mindskip.xzs.viewmodel.student.exam.ExamPaperPageVM; 14 | import com.github.pagehelper.PageInfo; 15 | import org.springframework.beans.factory.annotation.Autowired; 16 | import org.springframework.stereotype.Controller; 17 | import org.springframework.web.bind.annotation.*; 18 | 19 | import javax.validation.Valid; 20 | 21 | 22 | @Controller("WXStudentExamController") 23 | @RequestMapping(value = "/api/wx/student/exampaper") 24 | @ResponseBody 25 | public class ExamPaperController extends BaseWXApiController { 26 | 27 | private final ExamPaperService examPaperService; 28 | private final SubjectService subjectService; 29 | 30 | @Autowired 31 | public ExamPaperController(ExamPaperService examPaperService, SubjectService subjectService) { 32 | this.examPaperService = examPaperService; 33 | this.subjectService = subjectService; 34 | } 35 | 36 | 37 | @RequestMapping(value = "/select/{id}", method = RequestMethod.POST) 38 | public RestResponse select(@PathVariable Integer id) { 39 | ExamPaperEditRequestVM vm = examPaperService.examPaperToVM(id); 40 | return RestResponse.ok(vm); 41 | } 42 | 43 | 44 | @RequestMapping(value = "/pageList", method = RequestMethod.POST) 45 | public RestResponse> pageList(@Valid ExamPaperPageVM model) { 46 | model.setLevelId(getCurrentUser().getUserLevel()); 47 | PageInfo pageInfo = examPaperService.studentPage(model); 48 | PageInfo page = PageInfoHelper.copyMap(pageInfo, e -> { 49 | ExamPaperPageResponseVM vm = modelMapper.map(e, ExamPaperPageResponseVM.class); 50 | Subject subject = subjectService.selectById(vm.getSubjectId()); 51 | vm.setSubjectName(subject.getName()); 52 | vm.setCreateTime(DateTimeUtil.dateFormat(e.getCreateTime())); 53 | return vm; 54 | }); 55 | return RestResponse.ok(page); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/viewmodel/admin/file/UeditorConfigVM.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.viewmodel.admin.file; 2 | 3 | 4 | 5 | import java.util.List; 6 | 7 | 8 | public class UeditorConfigVM { 9 | private String imageActionName; 10 | private String imageFieldName; 11 | private Long imageMaxSize; 12 | private List imageAllowFiles; 13 | private boolean imageCompressEnable; 14 | private Integer imageCompressBorder; 15 | private String imageInsertAlign; 16 | private String imageUrlPrefix; 17 | private String imagePathFormat; 18 | 19 | public String getImageActionName() { 20 | return imageActionName; 21 | } 22 | 23 | public void setImageActionName(String imageActionName) { 24 | this.imageActionName = imageActionName; 25 | } 26 | 27 | public String getImageFieldName() { 28 | return imageFieldName; 29 | } 30 | 31 | public void setImageFieldName(String imageFieldName) { 32 | this.imageFieldName = imageFieldName; 33 | } 34 | 35 | public Long getImageMaxSize() { 36 | return imageMaxSize; 37 | } 38 | 39 | public void setImageMaxSize(Long imageMaxSize) { 40 | this.imageMaxSize = imageMaxSize; 41 | } 42 | 43 | public List getImageAllowFiles() { 44 | return imageAllowFiles; 45 | } 46 | 47 | public void setImageAllowFiles(List imageAllowFiles) { 48 | this.imageAllowFiles = imageAllowFiles; 49 | } 50 | 51 | public boolean isImageCompressEnable() { 52 | return imageCompressEnable; 53 | } 54 | 55 | public void setImageCompressEnable(boolean imageCompressEnable) { 56 | this.imageCompressEnable = imageCompressEnable; 57 | } 58 | 59 | public Integer getImageCompressBorder() { 60 | return imageCompressBorder; 61 | } 62 | 63 | public void setImageCompressBorder(Integer imageCompressBorder) { 64 | this.imageCompressBorder = imageCompressBorder; 65 | } 66 | 67 | public String getImageInsertAlign() { 68 | return imageInsertAlign; 69 | } 70 | 71 | public void setImageInsertAlign(String imageInsertAlign) { 72 | this.imageInsertAlign = imageInsertAlign; 73 | } 74 | 75 | public String getImageUrlPrefix() { 76 | return imageUrlPrefix; 77 | } 78 | 79 | public void setImageUrlPrefix(String imageUrlPrefix) { 80 | this.imageUrlPrefix = imageUrlPrefix; 81 | } 82 | 83 | public String getImagePathFormat() { 84 | return imagePathFormat; 85 | } 86 | 87 | public void setImagePathFormat(String imagePathFormat) { 88 | this.imagePathFormat = imagePathFormat; 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/viewmodel/admin/exam/ExamPaperEditRequestVM.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.viewmodel.admin.exam; 2 | 3 | 4 | 5 | import javax.validation.Valid; 6 | import javax.validation.constraints.NotBlank; 7 | import javax.validation.constraints.NotNull; 8 | import javax.validation.constraints.Size; 9 | import java.util.List; 10 | 11 | 12 | public class ExamPaperEditRequestVM { 13 | private Integer id; 14 | @NotNull 15 | private Integer level; 16 | @NotNull 17 | private Integer subjectId; 18 | @NotNull 19 | private Integer paperType; 20 | @NotBlank 21 | private String name; 22 | @NotNull 23 | private Integer suggestTime; 24 | 25 | private List limitDateTime; 26 | 27 | @Size(min = 1,message = "请添加试卷标题") 28 | @Valid 29 | private List titleItems; 30 | 31 | private String score; 32 | 33 | public Integer getId() { 34 | return id; 35 | } 36 | 37 | public void setId(Integer id) { 38 | this.id = id; 39 | } 40 | 41 | public Integer getLevel() { 42 | return level; 43 | } 44 | 45 | public void setLevel(Integer level) { 46 | this.level = level; 47 | } 48 | 49 | public Integer getSubjectId() { 50 | return subjectId; 51 | } 52 | 53 | public void setSubjectId(Integer subjectId) { 54 | this.subjectId = subjectId; 55 | } 56 | 57 | public Integer getPaperType() { 58 | return paperType; 59 | } 60 | 61 | public void setPaperType(Integer paperType) { 62 | this.paperType = paperType; 63 | } 64 | 65 | public String getName() { 66 | return name; 67 | } 68 | 69 | public void setName(String name) { 70 | this.name = name; 71 | } 72 | 73 | public Integer getSuggestTime() { 74 | return suggestTime; 75 | } 76 | 77 | public void setSuggestTime(Integer suggestTime) { 78 | this.suggestTime = suggestTime; 79 | } 80 | 81 | public List getLimitDateTime() { 82 | return limitDateTime; 83 | } 84 | 85 | public void setLimitDateTime(List limitDateTime) { 86 | this.limitDateTime = limitDateTime; 87 | } 88 | 89 | public List getTitleItems() { 90 | return titleItems; 91 | } 92 | 93 | public void setTitleItems(List titleItems) { 94 | this.titleItems = titleItems; 95 | } 96 | 97 | public String getScore() { 98 | return score; 99 | } 100 | 101 | public void setScore(String score) { 102 | this.score = score; 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/viewmodel/admin/user/UserCreateVM.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.viewmodel.admin.user; 2 | 3 | 4 | 5 | import javax.validation.constraints.NotBlank; 6 | 7 | 8 | public class UserCreateVM { 9 | 10 | private Integer id; 11 | 12 | @NotBlank 13 | private String userName; 14 | 15 | private String password; 16 | 17 | @NotBlank 18 | private String realName; 19 | 20 | private String age; 21 | 22 | private Integer status; 23 | 24 | private Integer sex; 25 | 26 | private String birthDay; 27 | 28 | private String phone; 29 | 30 | private Integer role; 31 | 32 | private Integer userLevel; 33 | 34 | public Integer getId() { 35 | return id; 36 | } 37 | 38 | public void setId(Integer id) { 39 | this.id = id; 40 | } 41 | 42 | public String getUserName() { 43 | return userName; 44 | } 45 | 46 | public void setUserName(String userName) { 47 | this.userName = userName; 48 | } 49 | 50 | public String getPassword() { 51 | return password; 52 | } 53 | 54 | public void setPassword(String password) { 55 | this.password = password; 56 | } 57 | 58 | public String getRealName() { 59 | return realName; 60 | } 61 | 62 | public void setRealName(String realName) { 63 | this.realName = realName; 64 | } 65 | 66 | public String getAge() { 67 | return age; 68 | } 69 | 70 | public void setAge(String age) { 71 | this.age = age; 72 | } 73 | 74 | public Integer getStatus() { 75 | return status; 76 | } 77 | 78 | public void setStatus(Integer status) { 79 | this.status = status; 80 | } 81 | 82 | public Integer getSex() { 83 | return sex; 84 | } 85 | 86 | public void setSex(Integer sex) { 87 | this.sex = sex; 88 | } 89 | 90 | public String getBirthDay() { 91 | return birthDay; 92 | } 93 | 94 | public void setBirthDay(String birthDay) { 95 | this.birthDay = birthDay; 96 | } 97 | 98 | public String getPhone() { 99 | return phone; 100 | } 101 | 102 | public void setPhone(String phone) { 103 | this.phone = phone; 104 | } 105 | 106 | public Integer getRole() { 107 | return role; 108 | } 109 | 110 | public void setRole(Integer role) { 111 | this.role = role; 112 | } 113 | 114 | public Integer getUserLevel() { 115 | return userLevel; 116 | } 117 | 118 | public void setUserLevel(Integer userLevel) { 119 | this.userLevel = userLevel; 120 | } 121 | } 122 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/controller/admin/TaskController.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.controller.admin; 2 | 3 | 4 | import com.mindskip.xzs.base.BaseApiController; 5 | import com.mindskip.xzs.base.RestResponse; 6 | import com.mindskip.xzs.domain.TaskExam; 7 | import com.mindskip.xzs.service.TaskExamService; 8 | import com.mindskip.xzs.utility.DateTimeUtil; 9 | import com.mindskip.xzs.utility.PageInfoHelper; 10 | import com.mindskip.xzs.viewmodel.admin.task.TaskPageRequestVM; 11 | import com.mindskip.xzs.viewmodel.admin.task.TaskPageResponseVM; 12 | import com.mindskip.xzs.viewmodel.admin.task.TaskRequestVM; 13 | import com.github.pagehelper.PageInfo; 14 | import org.springframework.beans.factory.annotation.Autowired; 15 | import org.springframework.web.bind.annotation.*; 16 | 17 | import javax.validation.Valid; 18 | 19 | @RestController("AdminTaskController") 20 | @RequestMapping(value = "/api/admin/task") 21 | public class TaskController extends BaseApiController { 22 | 23 | private final TaskExamService taskExamService; 24 | 25 | @Autowired 26 | public TaskController(TaskExamService taskExamService) { 27 | this.taskExamService = taskExamService; 28 | } 29 | 30 | @RequestMapping(value = "/page", method = RequestMethod.POST) 31 | public RestResponse> pageList(@RequestBody TaskPageRequestVM model) { 32 | PageInfo pageInfo = taskExamService.page(model); 33 | PageInfo page = PageInfoHelper.copyMap(pageInfo, m -> { 34 | TaskPageResponseVM vm = modelMapper.map(m, TaskPageResponseVM.class); 35 | vm.setCreateTime(DateTimeUtil.dateFormat(m.getCreateTime())); 36 | return vm; 37 | }); 38 | return RestResponse.ok(page); 39 | } 40 | 41 | 42 | @RequestMapping(value = "/edit", method = RequestMethod.POST) 43 | public RestResponse edit(@RequestBody @Valid TaskRequestVM model) { 44 | taskExamService.edit(model, getCurrentUser()); 45 | TaskRequestVM vm = taskExamService.taskExamToVM(model.getId()); 46 | return RestResponse.ok(vm); 47 | } 48 | 49 | 50 | @RequestMapping(value = "/select/{id}", method = RequestMethod.POST) 51 | public RestResponse select(@PathVariable Integer id) { 52 | TaskRequestVM vm = taskExamService.taskExamToVM(id); 53 | return RestResponse.ok(vm); 54 | } 55 | 56 | @RequestMapping(value = "/delete/{id}", method = RequestMethod.POST) 57 | public RestResponse delete(@PathVariable Integer id) { 58 | TaskExam taskExam = taskExamService.selectById(id); 59 | taskExam.setDeleted(true); 60 | taskExamService.updateByIdFilter(taskExam); 61 | return RestResponse.ok(); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/controller/admin/ExamPaperAnswerController.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.controller.admin; 2 | 3 | import com.mindskip.xzs.base.BaseApiController; 4 | import com.mindskip.xzs.base.RestResponse; 5 | import com.mindskip.xzs.domain.ExamPaperAnswer; 6 | import com.mindskip.xzs.domain.Subject; 7 | import com.mindskip.xzs.domain.User; 8 | import com.mindskip.xzs.service.*; 9 | import com.mindskip.xzs.utility.DateTimeUtil; 10 | import com.mindskip.xzs.utility.ExamUtil; 11 | import com.mindskip.xzs.utility.PageInfoHelper; 12 | import com.mindskip.xzs.viewmodel.student.exampaper.ExamPaperAnswerPageResponseVM; 13 | import com.mindskip.xzs.viewmodel.admin.paper.ExamPaperAnswerPageRequestVM; 14 | import com.github.pagehelper.PageInfo; 15 | import org.springframework.beans.factory.annotation.Autowired; 16 | import org.springframework.web.bind.annotation.*; 17 | 18 | @RestController("AdminExamPaperAnswerController") 19 | @RequestMapping(value = "/api/admin/examPaperAnswer") 20 | public class ExamPaperAnswerController extends BaseApiController { 21 | 22 | private final ExamPaperAnswerService examPaperAnswerService; 23 | private final SubjectService subjectService; 24 | private final UserService userService; 25 | 26 | @Autowired 27 | public ExamPaperAnswerController(ExamPaperAnswerService examPaperAnswerService, SubjectService subjectService, UserService userService) { 28 | this.examPaperAnswerService = examPaperAnswerService; 29 | this.subjectService = subjectService; 30 | this.userService = userService; 31 | } 32 | 33 | 34 | @RequestMapping(value = "/page", method = RequestMethod.POST) 35 | public RestResponse> pageJudgeList(@RequestBody ExamPaperAnswerPageRequestVM model) { 36 | PageInfo pageInfo = examPaperAnswerService.adminPage(model); 37 | PageInfo page = PageInfoHelper.copyMap(pageInfo, e -> { 38 | ExamPaperAnswerPageResponseVM vm = modelMapper.map(e, ExamPaperAnswerPageResponseVM.class); 39 | Subject subject = subjectService.selectById(vm.getSubjectId()); 40 | vm.setDoTime(ExamUtil.secondToVM(e.getDoTime())); 41 | vm.setSystemScore(ExamUtil.scoreToVM(e.getSystemScore())); 42 | vm.setUserScore(ExamUtil.scoreToVM(e.getUserScore())); 43 | vm.setPaperScore(ExamUtil.scoreToVM(e.getPaperScore())); 44 | vm.setSubjectName(subject.getName()); 45 | vm.setCreateTime(DateTimeUtil.dateFormat(e.getCreateTime())); 46 | User user = userService.selectById(e.getCreateUser()); 47 | vm.setUserName(user.getUserName()); 48 | return vm; 49 | }); 50 | return RestResponse.ok(page); 51 | } 52 | 53 | 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/configuration/spring/mvc/WebMvcConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.configuration.spring.mvc; 2 | 3 | import com.mindskip.xzs.configuration.property.SystemConfig; 4 | import com.mindskip.xzs.configuration.spring.wx.TokenHandlerInterceptor; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.context.annotation.Configuration; 7 | import org.springframework.web.servlet.config.annotation.*; 8 | 9 | import java.util.List; 10 | 11 | 12 | /** 13 | * @version 3.5.0 14 | * @description: The type Web mvc configuration. 15 | * Copyright (C), 2020-2024, 武汉思维跳跃科技有限公司 16 | * @date 2021/12/25 9:45 17 | */ 18 | @Configuration 19 | public class WebMvcConfiguration extends WebMvcConfigurationSupport { 20 | 21 | private final TokenHandlerInterceptor tokenHandlerInterceptor; 22 | private final SystemConfig systemConfig; 23 | 24 | /** 25 | * Instantiates a new Web mvc configuration. 26 | * 27 | * @param tokenHandlerInterceptor the token handler interceptor 28 | * @param systemConfig the system config 29 | */ 30 | @Autowired 31 | public WebMvcConfiguration(TokenHandlerInterceptor tokenHandlerInterceptor, SystemConfig systemConfig) { 32 | this.tokenHandlerInterceptor = tokenHandlerInterceptor; 33 | this.systemConfig = systemConfig; 34 | } 35 | 36 | @Override 37 | public void addViewControllers(ViewControllerRegistry registry) { 38 | registry.addRedirectViewController("/", "/student/index.html"); 39 | registry.addRedirectViewController("/student", "/student/index.html"); 40 | registry.addRedirectViewController("/admin", "/admin/index.html"); 41 | } 42 | 43 | @Override 44 | public void addResourceHandlers(ResourceHandlerRegistry registry) { 45 | registry.addResourceHandler("/**") 46 | .addResourceLocations("classpath:/static/") 47 | .setCachePeriod(31556926); 48 | } 49 | 50 | @Override 51 | public void addInterceptors(InterceptorRegistry registry) { 52 | List securityIgnoreUrls = systemConfig.getWx().getSecurityIgnoreUrls(); 53 | String[] ignores = new String[securityIgnoreUrls.size()]; 54 | registry.addInterceptor(tokenHandlerInterceptor) 55 | .addPathPatterns("/api/wx/**") 56 | .excludePathPatterns(securityIgnoreUrls.toArray(ignores)); 57 | super.addInterceptors(registry); 58 | } 59 | 60 | @Override 61 | public void addCorsMappings(CorsRegistry registry) { 62 | registry.addMapping("/**") 63 | .allowCredentials(true) 64 | .allowedMethods("*") 65 | .allowedOrigins("*") 66 | .allowedHeaders("*"); 67 | super.addCorsMappings(registry); 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/configuration/spring/wx/TokenHandlerInterceptor.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.configuration.spring.wx; 2 | 3 | import com.mindskip.xzs.base.SystemCode; 4 | import com.mindskip.xzs.configuration.spring.security.RestUtil; 5 | import com.mindskip.xzs.context.WxContext; 6 | import com.mindskip.xzs.domain.User; 7 | import com.mindskip.xzs.domain.UserToken; 8 | import com.mindskip.xzs.service.UserService; 9 | import com.mindskip.xzs.service.UserTokenService; 10 | import org.apache.commons.lang3.StringUtils; 11 | import org.springframework.beans.factory.annotation.Autowired; 12 | import org.springframework.stereotype.Component; 13 | import org.springframework.web.servlet.HandlerInterceptor; 14 | 15 | import javax.servlet.http.HttpServletRequest; 16 | import javax.servlet.http.HttpServletResponse; 17 | import java.util.Date; 18 | 19 | @Component 20 | public class TokenHandlerInterceptor implements HandlerInterceptor { 21 | 22 | private final UserTokenService userTokenService; 23 | private final UserService userService; 24 | private final WxContext wxContext; 25 | 26 | @Autowired 27 | public TokenHandlerInterceptor(UserTokenService userTokenService, UserService userService, WxContext wxContext) { 28 | this.userTokenService = userTokenService; 29 | this.userService = userService; 30 | this.wxContext = wxContext; 31 | } 32 | 33 | @Override 34 | public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { 35 | String token = request.getHeader("token"); 36 | if (StringUtils.isEmpty(token)) { 37 | RestUtil.response(response, SystemCode.UNAUTHORIZED); 38 | return false; 39 | } 40 | 41 | if (StringUtils.isBlank(token)) { 42 | RestUtil.response(response, SystemCode.UNAUTHORIZED); 43 | return false; 44 | } 45 | 46 | if (token.length() != 36) { 47 | RestUtil.response(response, SystemCode.UNAUTHORIZED); 48 | return false; 49 | } 50 | 51 | UserToken userToken = userTokenService.getToken(token); 52 | if (null == userToken) { 53 | RestUtil.response(response, SystemCode.UNAUTHORIZED); 54 | return false; 55 | } 56 | 57 | Date now = new Date(); 58 | User user = userService.getUserByUserName(userToken.getUserName()); 59 | if (now.before(userToken.getEndTime())) { 60 | wxContext.setContext(user,userToken); 61 | return true; 62 | } else { //refresh token 63 | UserToken refreshToken = userTokenService.insertUserToken(user); 64 | RestUtil.response(response, SystemCode.AccessTokenError.getCode(), SystemCode.AccessTokenError.getMessage(), refreshToken.getToken()); 65 | return false; 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/configuration/spring/exception/ExceptionHandle.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.configuration.spring.exception; 2 | 3 | import com.mindskip.xzs.base.RestResponse; 4 | import com.mindskip.xzs.base.SystemCode; 5 | import com.mindskip.xzs.utility.ErrorUtil; 6 | import org.slf4j.Logger; 7 | import org.slf4j.LoggerFactory; 8 | import org.springframework.validation.BindException; 9 | import org.springframework.validation.FieldError; 10 | import org.springframework.web.bind.MethodArgumentNotValidException; 11 | import org.springframework.web.bind.annotation.ControllerAdvice; 12 | import org.springframework.web.bind.annotation.ExceptionHandler; 13 | import org.springframework.web.bind.annotation.ResponseBody; 14 | 15 | import java.util.stream.Collectors; 16 | 17 | /** 18 | * @version 3.5.0 19 | * @description: The type Exception handle. 20 | * Copyright (C), 2020-2024, 武汉思维跳跃科技有限公司 21 | * @date 2021/12/25 9:45 22 | */ 23 | @ControllerAdvice 24 | public class ExceptionHandle { 25 | private final static Logger logger = LoggerFactory.getLogger(ExceptionHandle.class); 26 | 27 | /** 28 | * Handler rest response. 29 | * 30 | * @param e the e 31 | * @return the rest response 32 | */ 33 | @ExceptionHandler(Exception.class) 34 | @ResponseBody 35 | public RestResponse handler(Exception e) { 36 | logger.error(e.getMessage(), e); 37 | return new RestResponse<>(SystemCode.InnerError.getCode(), SystemCode.InnerError.getMessage()); 38 | } 39 | 40 | /** 41 | * Handler rest response. 42 | * 43 | * @param e the e 44 | * @return the rest response 45 | */ 46 | @ExceptionHandler(MethodArgumentNotValidException.class) 47 | @ResponseBody 48 | public RestResponse handler(MethodArgumentNotValidException e) { 49 | String errorMsg = e.getBindingResult().getAllErrors().stream().map(file -> { 50 | FieldError fieldError = (FieldError) file; 51 | return ErrorUtil.parameterErrorFormat(fieldError.getField(), fieldError.getDefaultMessage()); 52 | }).collect(Collectors.joining()); 53 | return new RestResponse<>(SystemCode.ParameterValidError.getCode(), errorMsg); 54 | } 55 | 56 | /** 57 | * Handler rest response. 58 | * 59 | * @param e the e 60 | * @return the rest response 61 | */ 62 | @ExceptionHandler(BindException.class) 63 | @ResponseBody 64 | public RestResponse handler(BindException e) { 65 | String errorMsg = e.getBindingResult().getAllErrors().stream().map(file -> { 66 | FieldError fieldError = (FieldError) file; 67 | return ErrorUtil.parameterErrorFormat(fieldError.getField(), fieldError.getDefaultMessage()); 68 | }).collect(Collectors.joining()); 69 | return new RestResponse<>(SystemCode.ParameterValidError.getCode(), errorMsg); 70 | } 71 | 72 | 73 | } 74 | -------------------------------------------------------------------------------- /src/main/java/com/mindskip/xzs/controller/admin/DashboardController.java: -------------------------------------------------------------------------------- 1 | package com.mindskip.xzs.controller.admin; 2 | 3 | import com.mindskip.xzs.base.BaseApiController; 4 | import com.mindskip.xzs.base.RestResponse; 5 | import com.mindskip.xzs.service.*; 6 | import com.mindskip.xzs.utility.DateTimeUtil; 7 | import com.mindskip.xzs.viewmodel.admin.dashboard.IndexVM; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.web.bind.annotation.RequestMapping; 10 | import org.springframework.web.bind.annotation.RequestMethod; 11 | import org.springframework.web.bind.annotation.RestController; 12 | 13 | import java.util.List; 14 | 15 | @RestController("AdminDashboardController") 16 | @RequestMapping(value = "/api/admin/dashboard") 17 | public class DashboardController extends BaseApiController { 18 | 19 | private final ExamPaperService examPaperService; 20 | private final QuestionService questionService; 21 | private final ExamPaperAnswerService examPaperAnswerService; 22 | private final ExamPaperQuestionCustomerAnswerService examPaperQuestionCustomerAnswerService; 23 | private final UserEventLogService userEventLogService; 24 | 25 | @Autowired 26 | public DashboardController(ExamPaperService examPaperService, QuestionService questionService, ExamPaperAnswerService examPaperAnswerService, ExamPaperQuestionCustomerAnswerService examPaperQuestionCustomerAnswerService, UserEventLogService userEventLogService) { 27 | this.examPaperService = examPaperService; 28 | this.questionService = questionService; 29 | this.examPaperAnswerService = examPaperAnswerService; 30 | this.examPaperQuestionCustomerAnswerService = examPaperQuestionCustomerAnswerService; 31 | this.userEventLogService = userEventLogService; 32 | } 33 | 34 | @RequestMapping(value = "/index", method = RequestMethod.POST) 35 | public RestResponse Index() { 36 | IndexVM vm = new IndexVM(); 37 | 38 | Integer examPaperCount = examPaperService.selectAllCount(); 39 | Integer questionCount = questionService.selectAllCount(); 40 | Integer doExamPaperCount = examPaperAnswerService.selectAllCount(); 41 | Integer doQuestionCount = examPaperQuestionCustomerAnswerService.selectAllCount(); 42 | 43 | vm.setExamPaperCount(examPaperCount); 44 | vm.setQuestionCount(questionCount); 45 | vm.setDoExamPaperCount(doExamPaperCount); 46 | vm.setDoQuestionCount(doQuestionCount); 47 | 48 | List mothDayUserActionValue = userEventLogService.selectMothCount(); 49 | List mothDayDoExamQuestionValue = examPaperQuestionCustomerAnswerService.selectMothCount(); 50 | vm.setMothDayUserActionValue(mothDayUserActionValue); 51 | vm.setMothDayDoExamQuestionValue(mothDayDoExamQuestionValue); 52 | 53 | vm.setMothDayText(DateTimeUtil.MothDay()); 54 | return RestResponse.ok(vm); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/main/resources/mapper/TextContentMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | id, content, create_time 11 | 12 | 18 | 19 | delete from t_text_content 20 | where id = #{id,jdbcType=INTEGER} 21 | 22 | 23 | insert into t_text_content (id, content, create_time 24 | ) 25 | values (#{id,jdbcType=INTEGER}, #{content,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP} 26 | ) 27 | 28 | 29 | insert into t_text_content 30 | 31 | 32 | id, 33 | 34 | 35 | content, 36 | 37 | 38 | create_time, 39 | 40 | 41 | 42 | 43 | #{id,jdbcType=INTEGER}, 44 | 45 | 46 | #{content,jdbcType=VARCHAR}, 47 | 48 | 49 | #{createTime,jdbcType=TIMESTAMP}, 50 | 51 | 52 | 53 | 54 | update t_text_content 55 | 56 | 57 | content = #{content,jdbcType=VARCHAR}, 58 | 59 | 60 | create_time = #{createTime,jdbcType=TIMESTAMP}, 61 | 62 | 63 | where id = #{id,jdbcType=INTEGER} 64 | 65 | 66 | update t_text_content 67 | set content = #{content,jdbcType=VARCHAR}, 68 | create_time = #{createTime,jdbcType=TIMESTAMP} 69 | where id = #{id,jdbcType=INTEGER} 70 | 71 | 72 | -------------------------------------------------------------------------------- /src/main/resources/logback-spring.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 8 | 10 | 12 | 13 | 14 | ${CONSOLE_LOG_PATTERN} 15 | utf8 16 | 17 | 18 | 20 | 21 | ${FILE_LOG_PATTERN} 22 | 23 | 24 | ${LOG_PATH}/${LOG_FILE}.%d{yyyyMMdd}.log 25 | 30 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | --------------------------------------------------------------------------------