重构:lombok、vo、mybatisplus、beanutils、包名
86个文件已修改
56个文件已添加
44 文件已重命名
56个文件已删除
| | |
| | | <java.version>1.8</java.version> |
| | | <mysql.version>8.0.17</mysql.version> |
| | | <spring.boot.version>2.1.6.RELEASE</spring.boot.version> |
| | | <mybatisplus.version>3.5.1</mybatisplus.version> |
| | | <lombok.version>1.18.24</lombok.version> |
| | | </properties> |
| | | |
| | | |
| | |
| | | |
| | | |
| | | <dependencies> |
| | | |
| | | <!-- lombok --> |
| | | <dependency> |
| | | <groupId>org.projectlombok</groupId> |
| | | <artifactId>lombok</artifactId> |
| | | <version>${lombok.version}</version> |
| | | <optional>true</optional> |
| | | </dependency> |
| | | |
| | | <!-- MybatisPlus --> |
| | | <dependency> |
| | | <groupId>com.baomidou</groupId> |
| | | <artifactId>mybatis-plus-boot-starter</artifactId> |
| | | <version>${mybatisplus.version}</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-security</artifactId> |
| | | <version>${spring.boot.version}</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-validation</artifactId> |
| | | <version>${spring.boot.version}</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-web</artifactId> |
| | |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-undertow</artifactId> |
| | | <version>${spring.boot.version}</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.mybatis.spring.boot</groupId> |
| | | <artifactId>mybatis-spring-boot-starter</artifactId> |
| | | <version>2.1.0</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>com.github.pagehelper</groupId> |
| | | <artifactId>pagehelper-spring-boot-starter</artifactId> |
| | | <version>1.2.12</version> |
| | | <exclusions> |
| | | <exclusion> |
| | | <artifactId>jsqlparser</artifactId> |
| | | <groupId>com.github.jsqlparser</groupId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | |
| | | |
| | |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.modelmapper</groupId> |
| | | <artifactId>modelmapper</artifactId> |
| | | <version>2.3.3</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.apache.commons</groupId> |
| | | <artifactId>commons-lang3</artifactId> |
| | | <version>3.9</version> |
| | |
| | | <version>${spring.boot.version}</version> |
| | | <scope>test</scope> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.springframework.security</groupId> |
| | | <artifactId>spring-security-test</artifactId> |
| | |
| | | package com.ycl.jxkg; |
| | | |
| | | import com.ycl.jxkg.configuration.property.SystemConfig; |
| | | import com.ycl.jxkg.config.property.SystemConfig; |
| | | import org.springframework.boot.SpringApplication; |
| | | import org.springframework.boot.autoconfigure.SpringBootApplication; |
| | | import org.springframework.boot.context.properties.EnableConfigurationProperties; |
| | |
| | | |
| | | import com.ycl.jxkg.context.WebContext; |
| | | import com.ycl.jxkg.domain.User; |
| | | import com.ycl.jxkg.utility.ModelMapperSingle; |
| | | import org.modelmapper.ModelMapper; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | |
| | | /** |
| | |
| | | * The constant DEFAULT_PAGE_SIZE. |
| | | */ |
| | | protected final static String DEFAULT_PAGE_SIZE = "10"; |
| | | /** |
| | | * The constant modelMapper. |
| | | */ |
| | | protected final static ModelMapper modelMapper = ModelMapperSingle.Instance(); |
| | | |
| | | /** |
| | | * The Web context. |
| | | */ |
File was renamed from src/main/java/com/ycl/jxkg/base/RestResponse.java |
| | |
| | | * Copyright (C), 2020-2024, 武汉思维跳跃科技有限公司 |
| | | * @date 2021/5/25 10:45 |
| | | */ |
| | | public class RestResponse<T> { |
| | | public class Result<T> { |
| | | private int code; |
| | | private String message; |
| | | private T response; |
| | |
| | | * @param code the code |
| | | * @param message the message |
| | | */ |
| | | public RestResponse(int code, String message) { |
| | | public Result(int code, String message) { |
| | | this.code = code; |
| | | this.message = message; |
| | | } |
| | |
| | | * @param message the message |
| | | * @param response the response |
| | | */ |
| | | public RestResponse(int code, String message, T response) { |
| | | public Result(int code, String message, T response) { |
| | | this.code = code; |
| | | this.message = message; |
| | | this.response = response; |
| | |
| | | * @param msg the msg |
| | | * @return the rest response |
| | | */ |
| | | public static RestResponse fail(Integer code, String msg) { |
| | | return new RestResponse<>(code, msg); |
| | | public static Result fail(Integer code, String msg) { |
| | | return new Result<>(code, msg); |
| | | } |
| | | |
| | | /** |
| | |
| | | * |
| | | * @return the rest response |
| | | */ |
| | | public static RestResponse ok() { |
| | | public static Result ok() { |
| | | SystemCode systemCode = SystemCode.OK; |
| | | return new RestResponse<>(systemCode.getCode(), systemCode.getMessage()); |
| | | return new Result<>(systemCode.getCode(), systemCode.getMessage()); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @param response the response |
| | | * @return the rest response |
| | | */ |
| | | public static <F> RestResponse<F> ok(F response) { |
| | | public static <F> Result<F> ok(F response) { |
| | | SystemCode systemCode = SystemCode.OK; |
| | | return new RestResponse<>(systemCode.getCode(), systemCode.getMessage(), response); |
| | | return new Result<>(systemCode.getCode(), systemCode.getMessage(), response); |
| | | } |
| | | |
| | | /** |
File was renamed from src/main/java/com/ycl/jxkg/configuration/application/ApplicationContextProvider.java |
| | |
| | | package com.ycl.jxkg.configuration.application; |
| | | package com.ycl.jxkg.config.application; |
| | | |
| | | import org.springframework.beans.BeansException; |
| | | import org.springframework.context.ApplicationContext; |
New file |
| | |
| | | package com.ycl.jxkg.config.mybatisplus; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.DbType; |
| | | import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; |
| | | import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; |
| | | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | /** |
| | | * @author 29443 |
| | | * @date 2022/4/9 |
| | | */ |
| | | @Configuration |
| | | public class MybatisPlusConfig { |
| | | |
| | | @Bean |
| | | public MybatisPlusInterceptor mybatisPlusInterceptor() { |
| | | MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor(); |
| | | |
| | | // 配置分页插件 |
| | | interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL)); |
| | | return interceptor; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ycl.jxkg.config.mybatisplus; |
| | | |
| | | import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler; |
| | | import org.apache.ibatis.reflection.MetaObject; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * plus自动填充 |
| | | * |
| | | * @author 29443 |
| | | * @date 2022/4/7 |
| | | */ |
| | | @Component |
| | | public class SysMetaObjectHandler implements MetaObjectHandler { |
| | | @Override |
| | | public void insertFill(MetaObject metaObject) { |
| | | this.setFieldValByName("updateTime", new Date(), metaObject); |
| | | this.setFieldValByName("createTime", new Date(), metaObject); |
| | | this.setFieldValByName("deleted", 0, metaObject); |
| | | } |
| | | |
| | | @Override |
| | | public void updateFill(MetaObject metaObject) { |
| | | this.setFieldValByName("updateTime", new Date(), metaObject); |
| | | } |
| | | } |
File was renamed from src/main/java/com/ycl/jxkg/configuration/property/CookieConfig.java |
| | |
| | | package com.ycl.jxkg.configuration.property; |
| | | package com.ycl.jxkg.config.property; |
| | | |
| | | /** |
| | | * @version 3.5.0 |
File was renamed from src/main/java/com/ycl/jxkg/configuration/property/PasswordKeyConfig.java |
| | |
| | | package com.ycl.jxkg.configuration.property; |
| | | package com.ycl.jxkg.config.property; |
| | | |
| | | /** |
| | | * @version 3.5.0 |
File was renamed from src/main/java/com/ycl/jxkg/configuration/property/QnConfig.java |
| | |
| | | package com.ycl.jxkg.configuration.property; |
| | | package com.ycl.jxkg.config.property; |
| | | |
| | | |
| | | /** |
File was renamed from src/main/java/com/ycl/jxkg/configuration/property/SystemConfig.java |
| | |
| | | package com.ycl.jxkg.configuration.property; |
| | | package com.ycl.jxkg.config.property; |
| | | |
| | | import org.springframework.boot.context.properties.ConfigurationProperties; |
| | | |
File was renamed from src/main/java/com/ycl/jxkg/configuration/property/WxConfig.java |
| | |
| | | package com.ycl.jxkg.configuration.property; |
| | | package com.ycl.jxkg.config.property; |
| | | |
| | | |
| | | import java.time.Duration; |
File was renamed from src/main/java/com/ycl/jxkg/configuration/spring/exception/ExceptionHandle.java |
| | |
| | | package com.ycl.jxkg.configuration.spring.exception; |
| | | package com.ycl.jxkg.config.spring.exception; |
| | | |
| | | import com.ycl.jxkg.base.RestResponse; |
| | | import com.ycl.jxkg.base.Result; |
| | | import com.ycl.jxkg.base.SystemCode; |
| | | import com.ycl.jxkg.utility.ErrorUtil; |
| | | import com.ycl.jxkg.utils.ErrorUtil; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.validation.BindException; |
| | |
| | | */ |
| | | @ExceptionHandler(Exception.class) |
| | | @ResponseBody |
| | | public RestResponse handler(Exception e) { |
| | | public Result handler(Exception e) { |
| | | logger.error(e.getMessage(), e); |
| | | return new RestResponse<>(SystemCode.InnerError.getCode(), SystemCode.InnerError.getMessage()); |
| | | return new Result<>(SystemCode.InnerError.getCode(), SystemCode.InnerError.getMessage()); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @ExceptionHandler(MethodArgumentNotValidException.class) |
| | | @ResponseBody |
| | | public RestResponse handler(MethodArgumentNotValidException e) { |
| | | public Result handler(MethodArgumentNotValidException e) { |
| | | String errorMsg = e.getBindingResult().getAllErrors().stream().map(file -> { |
| | | FieldError fieldError = (FieldError) file; |
| | | return ErrorUtil.parameterErrorFormat(fieldError.getField(), fieldError.getDefaultMessage()); |
| | | }).collect(Collectors.joining()); |
| | | return new RestResponse<>(SystemCode.ParameterValidError.getCode(), errorMsg); |
| | | return new Result<>(SystemCode.ParameterValidError.getCode(), errorMsg); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @ExceptionHandler(BindException.class) |
| | | @ResponseBody |
| | | public RestResponse handler(BindException e) { |
| | | public Result handler(BindException e) { |
| | | String errorMsg = e.getBindingResult().getAllErrors().stream().map(file -> { |
| | | FieldError fieldError = (FieldError) file; |
| | | return ErrorUtil.parameterErrorFormat(fieldError.getField(), fieldError.getDefaultMessage()); |
| | | }).collect(Collectors.joining()); |
| | | return new RestResponse<>(SystemCode.ParameterValidError.getCode(), errorMsg); |
| | | return new Result<>(SystemCode.ParameterValidError.getCode(), errorMsg); |
| | | } |
| | | |
| | | |
File was renamed from src/main/java/com/ycl/jxkg/configuration/spring/mvc/WebMvcConfiguration.java |
| | |
| | | package com.ycl.jxkg.configuration.spring.mvc; |
| | | package com.ycl.jxkg.config.spring.mvc; |
| | | |
| | | import com.ycl.jxkg.configuration.property.SystemConfig; |
| | | import com.ycl.jxkg.configuration.spring.wx.TokenHandlerInterceptor; |
| | | import com.ycl.jxkg.config.property.SystemConfig; |
| | | import com.ycl.jxkg.config.spring.wx.TokenHandlerInterceptor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.web.servlet.config.annotation.*; |
File was renamed from src/main/java/com/ycl/jxkg/configuration/spring/security/AuthenticationBean.java |
| | |
| | | package com.ycl.jxkg.configuration.spring.security; |
| | | package com.ycl.jxkg.config.spring.security; |
| | | |
| | | /** |
| | | * @version 3.5.0 |
File was renamed from src/main/java/com/ycl/jxkg/configuration/spring/security/LoginAuthenticationEntryPoint.java |
| | |
| | | package com.ycl.jxkg.configuration.spring.security; |
| | | package com.ycl.jxkg.config.spring.security; |
| | | |
| | | import com.ycl.jxkg.base.SystemCode; |
| | | import org.springframework.security.core.AuthenticationException; |
File was renamed from src/main/java/com/ycl/jxkg/configuration/spring/security/RestAccessDeniedHandler.java |
| | |
| | | package com.ycl.jxkg.configuration.spring.security; |
| | | package com.ycl.jxkg.config.spring.security; |
| | | |
| | | import com.ycl.jxkg.base.SystemCode; |
| | | import org.springframework.security.access.AccessDeniedException; |
File was renamed from src/main/java/com/ycl/jxkg/configuration/spring/security/RestAuthenticationFailureHandler.java |
| | |
| | | package com.ycl.jxkg.configuration.spring.security; |
| | | package com.ycl.jxkg.config.spring.security; |
| | | |
| | | import com.ycl.jxkg.base.SystemCode; |
| | | import org.springframework.security.core.AuthenticationException; |
File was renamed from src/main/java/com/ycl/jxkg/configuration/spring/security/RestAuthenticationProvider.java |
| | |
| | | package com.ycl.jxkg.configuration.spring.security; |
| | | package com.ycl.jxkg.config.spring.security; |
| | | |
| | | |
| | | import com.ycl.jxkg.context.WebContext; |
File was renamed from src/main/java/com/ycl/jxkg/configuration/spring/security/RestAuthenticationSuccessHandler.java |
| | |
| | | package com.ycl.jxkg.configuration.spring.security; |
| | | package com.ycl.jxkg.config.spring.security; |
| | | |
| | | import com.ycl.jxkg.base.SystemCode; |
| | | import com.ycl.jxkg.domain.UserEventLog; |
File was renamed from src/main/java/com/ycl/jxkg/configuration/spring/security/RestDetailsServiceImpl.java |
| | |
| | | package com.ycl.jxkg.configuration.spring.security; |
| | | package com.ycl.jxkg.config.spring.security; |
| | | |
| | | import com.ycl.jxkg.domain.enums.RoleEnum; |
| | | import com.ycl.jxkg.service.UserService; |
File was renamed from src/main/java/com/ycl/jxkg/configuration/spring/security/RestLoginAuthenticationFilter.java |
| | |
| | | package com.ycl.jxkg.configuration.spring.security; |
| | | package com.ycl.jxkg.config.spring.security; |
| | | |
| | | import com.ycl.jxkg.configuration.property.CookieConfig; |
| | | import com.ycl.jxkg.config.property.CookieConfig; |
| | | |
| | | import com.ycl.jxkg.utility.JsonUtil; |
| | | import com.ycl.jxkg.utils.JsonUtil; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; |
| | | import org.springframework.security.core.Authentication; |
File was renamed from src/main/java/com/ycl/jxkg/configuration/spring/security/RestLogoutSuccessHandler.java |
| | |
| | | package com.ycl.jxkg.configuration.spring.security; |
| | | package com.ycl.jxkg.config.spring.security; |
| | | |
| | | import com.ycl.jxkg.base.SystemCode; |
| | | import com.ycl.jxkg.domain.User; |
File was renamed from src/main/java/com/ycl/jxkg/configuration/spring/security/RestTokenBasedRememberMeServices.java |
| | |
| | | package com.ycl.jxkg.configuration.spring.security; |
| | | package com.ycl.jxkg.config.spring.security; |
| | | |
| | | import org.springframework.security.core.userdetails.UserDetailsService; |
| | | import org.springframework.security.web.authentication.rememberme.TokenBasedRememberMeServices; |
File was renamed from src/main/java/com/ycl/jxkg/configuration/spring/security/RestUtil.java |
| | |
| | | package com.ycl.jxkg.configuration.spring.security; |
| | | package com.ycl.jxkg.config.spring.security; |
| | | |
| | | import com.ycl.jxkg.base.RestResponse; |
| | | import com.ycl.jxkg.base.Result; |
| | | import com.ycl.jxkg.base.SystemCode; |
| | | import com.ycl.jxkg.utility.JsonUtil; |
| | | import com.ycl.jxkg.utils.JsonUtil; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | |
| | |
| | | */ |
| | | public static void response(HttpServletResponse response, int systemCode, String msg, Object content) { |
| | | try { |
| | | RestResponse res = new RestResponse<>(systemCode, msg, content); |
| | | Result res = new Result<>(systemCode, msg, content); |
| | | String resStr = JsonUtil.toJsonStr(res); |
| | | response.setContentType("application/json;charset=utf-8"); |
| | | response.getWriter().write(resStr); |
File was renamed from src/main/java/com/ycl/jxkg/configuration/spring/security/SecurityConfigurer.java |
| | |
| | | package com.ycl.jxkg.configuration.spring.security; |
| | | package com.ycl.jxkg.config.spring.security; |
| | | |
| | | import com.ycl.jxkg.configuration.property.CookieConfig; |
| | | import com.ycl.jxkg.configuration.property.SystemConfig; |
| | | import com.ycl.jxkg.config.property.CookieConfig; |
| | | import com.ycl.jxkg.config.property.SystemConfig; |
| | | import com.ycl.jxkg.domain.enums.RoleEnum; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Bean; |
File was renamed from src/main/java/com/ycl/jxkg/configuration/spring/wx/TokenHandlerInterceptor.java |
| | |
| | | package com.ycl.jxkg.configuration.spring.wx; |
| | | package com.ycl.jxkg.config.spring.wx; |
| | | |
| | | import com.ycl.jxkg.base.SystemCode; |
| | | import com.ycl.jxkg.configuration.spring.security.RestUtil; |
| | | import com.ycl.jxkg.config.spring.security.RestUtil; |
| | | import com.ycl.jxkg.context.WxContext; |
| | | import com.ycl.jxkg.domain.User; |
| | | import com.ycl.jxkg.domain.UserToken; |
| | |
| | | package com.ycl.jxkg.controller.admin; |
| | | |
| | | import com.ycl.jxkg.base.BaseApiController; |
| | | import com.ycl.jxkg.base.RestResponse; |
| | | import com.ycl.jxkg.base.Result; |
| | | import com.ycl.jxkg.service.*; |
| | | import com.ycl.jxkg.utility.DateTimeUtil; |
| | | import com.ycl.jxkg.viewmodel.admin.dashboard.IndexVM; |
| | | import com.ycl.jxkg.utils.DateTimeUtil; |
| | | import com.ycl.jxkg.vo.admin.dashboard.IndexVO; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | |
| | | } |
| | | |
| | | @RequestMapping(value = "/index", method = RequestMethod.POST) |
| | | public RestResponse<IndexVM> Index() { |
| | | IndexVM vm = new IndexVM(); |
| | | public Result<IndexVO> Index() { |
| | | IndexVO vm = new IndexVO(); |
| | | |
| | | Integer examPaperCount = examPaperService.selectAllCount(); |
| | | Integer questionCount = questionService.selectAllCount(); |
| | |
| | | vm.setMothDayDoExamQuestionValue(mothDayDoExamQuestionValue); |
| | | |
| | | vm.setMothDayText(DateTimeUtil.MothDay()); |
| | | return RestResponse.ok(vm); |
| | | return Result.ok(vm); |
| | | } |
| | | } |
| | |
| | | |
| | | |
| | | import com.ycl.jxkg.base.BaseApiController; |
| | | import com.ycl.jxkg.base.RestResponse; |
| | | import com.ycl.jxkg.base.Result; |
| | | import com.ycl.jxkg.domain.Subject; |
| | | import com.ycl.jxkg.service.SubjectService; |
| | | import com.ycl.jxkg.utility.PageInfoHelper; |
| | | import com.ycl.jxkg.viewmodel.admin.education.SubjectEditRequestVM; |
| | | import com.ycl.jxkg.viewmodel.admin.education.SubjectPageRequestVM; |
| | | import com.ycl.jxkg.viewmodel.admin.education.SubjectResponseVM; |
| | | import com.ycl.jxkg.utils.PageInfoHelper; |
| | | import com.ycl.jxkg.vo.admin.education.SubjectEditRequestVO; |
| | | import com.ycl.jxkg.vo.admin.education.SubjectPageRequestVO; |
| | | import com.ycl.jxkg.vo.admin.education.SubjectResponseVO; |
| | | import com.github.pagehelper.PageInfo; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | } |
| | | |
| | | @RequestMapping(value = "/subject/list", method = RequestMethod.POST) |
| | | public RestResponse<List<Subject>> list() { |
| | | public Result<List<Subject>> list() { |
| | | List<Subject> subjects = subjectService.allSubject(); |
| | | return RestResponse.ok(subjects); |
| | | return Result.ok(subjects); |
| | | } |
| | | |
| | | @RequestMapping(value = "/subject/page", method = RequestMethod.POST) |
| | | public RestResponse<PageInfo<SubjectResponseVM>> pageList(@RequestBody SubjectPageRequestVM model) { |
| | | public Result<PageInfo<SubjectResponseVO>> pageList(@RequestBody SubjectPageRequestVO model) { |
| | | PageInfo<Subject> pageInfo = subjectService.page(model); |
| | | PageInfo<SubjectResponseVM> page = PageInfoHelper.copyMap(pageInfo, e -> modelMapper.map(e, SubjectResponseVM.class)); |
| | | return RestResponse.ok(page); |
| | | PageInfo<SubjectResponseVO> page = PageInfoHelper.copyMap(pageInfo, e -> { |
| | | SubjectResponseVO vo = new SubjectResponseVO(); |
| | | BeanUtils.copyProperties(e, vo); |
| | | return vo; |
| | | }); |
| | | return Result.ok(page); |
| | | } |
| | | |
| | | @RequestMapping(value = "/subject/edit", method = RequestMethod.POST) |
| | | public RestResponse edit(@RequestBody @Valid SubjectEditRequestVM model) { |
| | | Subject subject = modelMapper.map(model, Subject.class); |
| | | public Result edit(@RequestBody @Valid SubjectEditRequestVO model) { |
| | | Subject subject = new Subject(); |
| | | BeanUtils.copyProperties(model, subject); |
| | | if (model.getId() == null) { |
| | | subject.setDeleted(false); |
| | | subjectService.insertByFilter(subject); |
| | | } else { |
| | | subjectService.updateByIdFilter(subject); |
| | | } |
| | | return RestResponse.ok(); |
| | | return Result.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/subject/select/{id}", method = RequestMethod.POST) |
| | | public RestResponse<SubjectEditRequestVM> select(@PathVariable Integer id) { |
| | | public Result<SubjectEditRequestVO> select(@PathVariable Integer id) { |
| | | Subject subject = subjectService.selectById(id); |
| | | SubjectEditRequestVM vm = modelMapper.map(subject, SubjectEditRequestVM.class); |
| | | return RestResponse.ok(vm); |
| | | SubjectEditRequestVO vo = new SubjectEditRequestVO(); |
| | | BeanUtils.copyProperties(subject, vo); |
| | | return Result.ok(vo); |
| | | } |
| | | |
| | | @RequestMapping(value = "/subject/delete/{id}", method = RequestMethod.POST) |
| | | public RestResponse delete(@PathVariable Integer id) { |
| | | public Result delete(@PathVariable Integer id) { |
| | | Subject subject = subjectService.selectById(id); |
| | | subject.setDeleted(true); |
| | | subjectService.updateByIdFilter(subject); |
| | | return RestResponse.ok(); |
| | | return Result.ok(); |
| | | } |
| | | } |
| | |
| | | package com.ycl.jxkg.controller.admin; |
| | | |
| | | import com.ycl.jxkg.base.BaseApiController; |
| | | import com.ycl.jxkg.base.RestResponse; |
| | | import com.ycl.jxkg.base.Result; |
| | | import com.ycl.jxkg.domain.ExamPaperAnswer; |
| | | import com.ycl.jxkg.domain.Subject; |
| | | import com.ycl.jxkg.domain.User; |
| | | import com.ycl.jxkg.service.*; |
| | | import com.ycl.jxkg.utility.DateTimeUtil; |
| | | import com.ycl.jxkg.utility.ExamUtil; |
| | | import com.ycl.jxkg.utility.PageInfoHelper; |
| | | import com.ycl.jxkg.viewmodel.student.exampaper.ExamPaperAnswerPageResponseVM; |
| | | import com.ycl.jxkg.viewmodel.admin.paper.ExamPaperAnswerPageRequestVM; |
| | | import com.ycl.jxkg.utils.DateTimeUtil; |
| | | import com.ycl.jxkg.utils.ExamUtil; |
| | | import com.ycl.jxkg.utils.PageInfoHelper; |
| | | import com.ycl.jxkg.vo.student.exampaper.ExamPaperAnswerPageResponseVO; |
| | | import com.ycl.jxkg.vo.admin.paper.ExamPaperAnswerPageRequestVO; |
| | | import com.github.pagehelper.PageInfo; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | |
| | | |
| | | @RequestMapping(value = "/page", method = RequestMethod.POST) |
| | | public RestResponse<PageInfo<ExamPaperAnswerPageResponseVM>> pageJudgeList(@RequestBody ExamPaperAnswerPageRequestVM model) { |
| | | public Result<PageInfo<ExamPaperAnswerPageResponseVO>> pageJudgeList(@RequestBody ExamPaperAnswerPageRequestVO model) { |
| | | PageInfo<ExamPaperAnswer> pageInfo = examPaperAnswerService.adminPage(model); |
| | | PageInfo<ExamPaperAnswerPageResponseVM> page = PageInfoHelper.copyMap(pageInfo, e -> { |
| | | ExamPaperAnswerPageResponseVM vm = modelMapper.map(e, ExamPaperAnswerPageResponseVM.class); |
| | | Subject subject = subjectService.selectById(vm.getSubjectId()); |
| | | vm.setDoTime(ExamUtil.secondToVM(e.getDoTime())); |
| | | vm.setSystemScore(ExamUtil.scoreToVM(e.getSystemScore())); |
| | | vm.setUserScore(ExamUtil.scoreToVM(e.getUserScore())); |
| | | vm.setPaperScore(ExamUtil.scoreToVM(e.getPaperScore())); |
| | | vm.setSubjectName(subject.getName()); |
| | | vm.setCreateTime(DateTimeUtil.dateFormat(e.getCreateTime())); |
| | | PageInfo<ExamPaperAnswerPageResponseVO> page = PageInfoHelper.copyMap(pageInfo, e -> { |
| | | ExamPaperAnswerPageResponseVO vo = new ExamPaperAnswerPageResponseVO(); |
| | | BeanUtils.copyProperties(e, vo); |
| | | Subject subject = subjectService.selectById(vo.getSubjectId()); |
| | | vo.setDoTime(ExamUtil.secondToVM(e.getDoTime())); |
| | | vo.setSystemScore(ExamUtil.scoreToVM(e.getSystemScore())); |
| | | vo.setUserScore(ExamUtil.scoreToVM(e.getUserScore())); |
| | | vo.setPaperScore(ExamUtil.scoreToVM(e.getPaperScore())); |
| | | vo.setSubjectName(subject.getName()); |
| | | vo.setCreateTime(DateTimeUtil.dateFormat(e.getCreateTime())); |
| | | User user = userService.selectById(e.getCreateUser()); |
| | | vm.setUserName(user.getUserName()); |
| | | return vm; |
| | | vo.setUserName(user.getUserName()); |
| | | return vo; |
| | | }); |
| | | return RestResponse.ok(page); |
| | | return Result.ok(page); |
| | | } |
| | | |
| | | |
| | |
| | | package com.ycl.jxkg.controller.admin; |
| | | |
| | | import com.ycl.jxkg.base.BaseApiController; |
| | | import com.ycl.jxkg.base.RestResponse; |
| | | import com.ycl.jxkg.base.Result; |
| | | import com.ycl.jxkg.domain.ExamPaper; |
| | | import com.ycl.jxkg.service.ExamPaperService; |
| | | import com.ycl.jxkg.utility.DateTimeUtil; |
| | | import com.ycl.jxkg.utility.PageInfoHelper; |
| | | import com.ycl.jxkg.viewmodel.admin.exam.ExamPaperPageRequestVM; |
| | | import com.ycl.jxkg.viewmodel.admin.exam.ExamPaperEditRequestVM; |
| | | import com.ycl.jxkg.viewmodel.admin.exam.ExamResponseVM; |
| | | import com.ycl.jxkg.utils.DateTimeUtil; |
| | | import com.ycl.jxkg.utils.PageInfoHelper; |
| | | import com.ycl.jxkg.vo.admin.exam.ExamPaperPageRequestVO; |
| | | import com.ycl.jxkg.vo.admin.exam.ExamPaperEditRequestVO; |
| | | import com.ycl.jxkg.vo.admin.exam.ExamResponseVO; |
| | | import com.github.pagehelper.PageInfo; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | } |
| | | |
| | | @RequestMapping(value = "/page", method = RequestMethod.POST) |
| | | public RestResponse<PageInfo<ExamResponseVM>> pageList(@RequestBody ExamPaperPageRequestVM model) { |
| | | public Result<PageInfo<ExamResponseVO>> pageList(@RequestBody ExamPaperPageRequestVO model) { |
| | | PageInfo<ExamPaper> pageInfo = examPaperService.page(model); |
| | | PageInfo<ExamResponseVM> page = PageInfoHelper.copyMap(pageInfo, e -> { |
| | | ExamResponseVM vm = modelMapper.map(e, ExamResponseVM.class); |
| | | vm.setCreateTime(DateTimeUtil.dateFormat(e.getCreateTime())); |
| | | return vm; |
| | | PageInfo<ExamResponseVO> page = PageInfoHelper.copyMap(pageInfo, e -> { |
| | | ExamResponseVO vo = new ExamResponseVO(); |
| | | BeanUtils.copyProperties(e, vo); |
| | | vo.setCreateTime(DateTimeUtil.dateFormat(e.getCreateTime())); |
| | | return vo; |
| | | }); |
| | | return RestResponse.ok(page); |
| | | return Result.ok(page); |
| | | } |
| | | |
| | | |
| | | |
| | | @RequestMapping(value = "/taskExamPage", method = RequestMethod.POST) |
| | | public RestResponse<PageInfo<ExamResponseVM>> taskExamPageList(@RequestBody ExamPaperPageRequestVM model) { |
| | | public Result<PageInfo<ExamResponseVO>> taskExamPageList(@RequestBody ExamPaperPageRequestVO model) { |
| | | PageInfo<ExamPaper> pageInfo = examPaperService.taskExamPage(model); |
| | | PageInfo<ExamResponseVM> page = PageInfoHelper.copyMap(pageInfo, e -> { |
| | | ExamResponseVM vm = modelMapper.map(e, ExamResponseVM.class); |
| | | vm.setCreateTime(DateTimeUtil.dateFormat(e.getCreateTime())); |
| | | return vm; |
| | | PageInfo<ExamResponseVO> page = PageInfoHelper.copyMap(pageInfo, e -> { |
| | | ExamResponseVO vo = new ExamResponseVO(); |
| | | BeanUtils.copyProperties(e, vo); |
| | | vo.setCreateTime(DateTimeUtil.dateFormat(e.getCreateTime())); |
| | | return vo; |
| | | }); |
| | | return RestResponse.ok(page); |
| | | return Result.ok(page); |
| | | } |
| | | |
| | | |
| | | |
| | | @RequestMapping(value = "/edit", method = RequestMethod.POST) |
| | | public RestResponse<ExamPaperEditRequestVM> edit(@RequestBody @Valid ExamPaperEditRequestVM model) { |
| | | public Result<ExamPaperEditRequestVO> edit(@RequestBody @Valid ExamPaperEditRequestVO model) { |
| | | ExamPaper examPaper = examPaperService.savePaperFromVM(model, getCurrentUser()); |
| | | ExamPaperEditRequestVM newVM = examPaperService.examPaperToVM(examPaper.getId()); |
| | | return RestResponse.ok(newVM); |
| | | ExamPaperEditRequestVO newVM = examPaperService.examPaperToVM(examPaper.getId()); |
| | | return Result.ok(newVM); |
| | | } |
| | | |
| | | @RequestMapping(value = "/select/{id}", method = RequestMethod.POST) |
| | | public RestResponse<ExamPaperEditRequestVM> select(@PathVariable Integer id) { |
| | | ExamPaperEditRequestVM vm = examPaperService.examPaperToVM(id); |
| | | return RestResponse.ok(vm); |
| | | public Result<ExamPaperEditRequestVO> select(@PathVariable Integer id) { |
| | | ExamPaperEditRequestVO vm = examPaperService.examPaperToVM(id); |
| | | return Result.ok(vm); |
| | | } |
| | | |
| | | @RequestMapping(value = "/delete/{id}", method = RequestMethod.POST) |
| | | public RestResponse delete(@PathVariable Integer id) { |
| | | public Result delete(@PathVariable Integer id) { |
| | | ExamPaper examPaper = examPaperService.selectById(id); |
| | | examPaper.setDeleted(true); |
| | | examPaperService.updateByIdFilter(examPaper); |
| | | return RestResponse.ok(); |
| | | return Result.ok(); |
| | | } |
| | | } |
| | |
| | | |
| | | |
| | | import com.ycl.jxkg.base.BaseApiController; |
| | | import com.ycl.jxkg.base.RestResponse; |
| | | import com.ycl.jxkg.base.Result; |
| | | import com.ycl.jxkg.domain.Message; |
| | | import com.ycl.jxkg.domain.MessageUser; |
| | | import com.ycl.jxkg.domain.User; |
| | | import com.ycl.jxkg.service.MessageService; |
| | | import com.ycl.jxkg.service.UserService; |
| | | import com.ycl.jxkg.utility.DateTimeUtil; |
| | | import com.ycl.jxkg.utility.PageInfoHelper; |
| | | import com.ycl.jxkg.viewmodel.admin.message.MessagePageRequestVM; |
| | | import com.ycl.jxkg.viewmodel.admin.message.MessageResponseVM; |
| | | import com.ycl.jxkg.viewmodel.admin.message.MessageSendVM; |
| | | import com.ycl.jxkg.utils.DateTimeUtil; |
| | | import com.ycl.jxkg.utils.PageInfoHelper; |
| | | import com.ycl.jxkg.vo.admin.message.MessagePageRequestVO; |
| | | import com.ycl.jxkg.vo.admin.message.MessageResponseVO; |
| | | import com.ycl.jxkg.vo.admin.message.MessageSendVO; |
| | | import com.github.pagehelper.PageInfo; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | |
| | | } |
| | | |
| | | @RequestMapping(value = "/page", method = RequestMethod.POST) |
| | | public RestResponse<PageInfo<MessageResponseVM>> pageList(@RequestBody MessagePageRequestVM model) { |
| | | public Result<PageInfo<MessageResponseVO>> pageList(@RequestBody MessagePageRequestVO model) { |
| | | PageInfo<Message> pageInfo = messageService.page(model); |
| | | List<Integer> ids = pageInfo.getList().stream().map(d -> d.getId()).collect(Collectors.toList()); |
| | | List<MessageUser> messageUsers = ids.size() == 0 ? null : messageService.selectByMessageIds(ids); |
| | | PageInfo<MessageResponseVM> page = PageInfoHelper.copyMap(pageInfo, m -> { |
| | | MessageResponseVM vm = modelMapper.map(m, MessageResponseVM.class); |
| | | PageInfo<MessageResponseVO> page = PageInfoHelper.copyMap(pageInfo, m -> { |
| | | MessageResponseVO vo = new MessageResponseVO(); |
| | | BeanUtils.copyProperties(m, vo); |
| | | String receives = messageUsers.stream().filter(d -> d.getMessageId().equals(m.getId())).map(d -> d.getReceiveUserName()) |
| | | .collect(Collectors.joining(",")); |
| | | vm.setReceives(receives); |
| | | vm.setCreateTime(DateTimeUtil.dateFormat(m.getCreateTime())); |
| | | return vm; |
| | | vo.setReceives(receives); |
| | | vo.setCreateTime(DateTimeUtil.dateFormat(m.getCreateTime())); |
| | | return vo; |
| | | }); |
| | | return RestResponse.ok(page); |
| | | return Result.ok(page); |
| | | } |
| | | |
| | | |
| | | @RequestMapping(value = "/send", method = RequestMethod.POST) |
| | | public RestResponse send(@RequestBody @Valid MessageSendVM model) { |
| | | public Result send(@RequestBody @Valid MessageSendVO model) { |
| | | User user = getCurrentUser(); |
| | | List<User> receiveUser = userService.selectByIds(model.getReceiveUserIds()); |
| | | Date now = new Date(); |
| | |
| | | return messageUser; |
| | | }).collect(Collectors.toList()); |
| | | messageService.sendMessage(message, messageUsers); |
| | | return RestResponse.ok(); |
| | | return Result.ok(); |
| | | } |
| | | |
| | | } |
| | |
| | | package com.ycl.jxkg.controller.admin; |
| | | |
| | | import com.ycl.jxkg.base.BaseApiController; |
| | | import com.ycl.jxkg.base.RestResponse; |
| | | import com.ycl.jxkg.base.Result; |
| | | import com.ycl.jxkg.base.SystemCode; |
| | | import com.ycl.jxkg.domain.Question; |
| | | import com.ycl.jxkg.domain.TextContent; |
| | |
| | | import com.ycl.jxkg.domain.question.QuestionObject; |
| | | import com.ycl.jxkg.service.QuestionService; |
| | | import com.ycl.jxkg.service.TextContentService; |
| | | import com.ycl.jxkg.utility.*; |
| | | import com.ycl.jxkg.viewmodel.admin.question.QuestionEditRequestVM; |
| | | import com.ycl.jxkg.viewmodel.admin.question.QuestionPageRequestVM; |
| | | import com.ycl.jxkg.viewmodel.admin.question.QuestionResponseVM; |
| | | import com.ycl.jxkg.utils.*; |
| | | import com.ycl.jxkg.vo.admin.question.QuestionEditRequestVO; |
| | | import com.ycl.jxkg.vo.admin.question.QuestionPageRequestVO; |
| | | import com.ycl.jxkg.vo.admin.question.QuestionResponseVO; |
| | | import com.github.pagehelper.PageInfo; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | } |
| | | |
| | | @RequestMapping(value = "/page", method = RequestMethod.POST) |
| | | public RestResponse<PageInfo<QuestionResponseVM>> pageList(@RequestBody QuestionPageRequestVM model) { |
| | | public Result<PageInfo<QuestionResponseVO>> pageList(@RequestBody QuestionPageRequestVO model) { |
| | | PageInfo<Question> pageInfo = questionService.page(model); |
| | | PageInfo<QuestionResponseVM> page = PageInfoHelper.copyMap(pageInfo, q -> { |
| | | QuestionResponseVM vm = modelMapper.map(q, QuestionResponseVM.class); |
| | | vm.setCreateTime(DateTimeUtil.dateFormat(q.getCreateTime())); |
| | | vm.setScore(ExamUtil.scoreToVM(q.getScore())); |
| | | PageInfo<QuestionResponseVO> page = PageInfoHelper.copyMap(pageInfo, q -> { |
| | | QuestionResponseVO vo = new QuestionResponseVO(); |
| | | BeanUtils.copyProperties(q, vo); |
| | | vo.setCreateTime(DateTimeUtil.dateFormat(q.getCreateTime())); |
| | | vo.setScore(ExamUtil.scoreToVM(q.getScore())); |
| | | TextContent textContent = textContentService.selectById(q.getInfoTextContentId()); |
| | | QuestionObject questionObject = JsonUtil.toJsonObject(textContent.getContent(), QuestionObject.class); |
| | | String clearHtml = HtmlUtil.clear(questionObject.getTitleContent()); |
| | | vm.setShortTitle(clearHtml); |
| | | return vm; |
| | | vo.setShortTitle(clearHtml); |
| | | return vo; |
| | | }); |
| | | return RestResponse.ok(page); |
| | | return Result.ok(page); |
| | | } |
| | | |
| | | @RequestMapping(value = "/edit", method = RequestMethod.POST) |
| | | public RestResponse edit(@RequestBody @Valid QuestionEditRequestVM model) { |
| | | RestResponse validQuestionEditRequestResult = validQuestionEditRequestVM(model); |
| | | public Result edit(@RequestBody @Valid QuestionEditRequestVO model) { |
| | | Result validQuestionEditRequestResult = validQuestionEditRequestVM(model); |
| | | if (validQuestionEditRequestResult.getCode() != SystemCode.OK.getCode()) { |
| | | return validQuestionEditRequestResult; |
| | | } |
| | |
| | | questionService.updateFullQuestion(model); |
| | | } |
| | | |
| | | return RestResponse.ok(); |
| | | return Result.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/select/{id}", method = RequestMethod.POST) |
| | | public RestResponse<QuestionEditRequestVM> select(@PathVariable Integer id) { |
| | | QuestionEditRequestVM newVM = questionService.getQuestionEditRequestVM(id); |
| | | return RestResponse.ok(newVM); |
| | | public Result<QuestionEditRequestVO> select(@PathVariable Integer id) { |
| | | QuestionEditRequestVO newVM = questionService.getQuestionEditRequestVM(id); |
| | | return Result.ok(newVM); |
| | | } |
| | | |
| | | |
| | | @RequestMapping(value = "/delete/{id}", method = RequestMethod.POST) |
| | | public RestResponse delete(@PathVariable Integer id) { |
| | | public Result delete(@PathVariable Integer id) { |
| | | Question question = questionService.selectById(id); |
| | | question.setDeleted(true); |
| | | questionService.updateByIdFilter(question); |
| | | return RestResponse.ok(); |
| | | return Result.ok(); |
| | | } |
| | | |
| | | private RestResponse validQuestionEditRequestVM(QuestionEditRequestVM model) { |
| | | private Result validQuestionEditRequestVM(QuestionEditRequestVO model) { |
| | | int qType = model.getQuestionType().intValue(); |
| | | boolean requireCorrect = qType == QuestionTypeEnum.SingleChoice.getCode() || qType == QuestionTypeEnum.TrueFalse.getCode(); |
| | | if (requireCorrect) { |
| | | if (StringUtils.isBlank(model.getCorrect())) { |
| | | String errorMsg = ErrorUtil.parameterErrorFormat("correct", "不能为空"); |
| | | return new RestResponse<>(SystemCode.ParameterValidError.getCode(), errorMsg); |
| | | return new Result<>(SystemCode.ParameterValidError.getCode(), errorMsg); |
| | | } |
| | | } |
| | | |
| | |
| | | Integer questionScore = ExamUtil.scoreFromVM(model.getScore()); |
| | | if (!fillSumScore.equals(questionScore)) { |
| | | String errorMsg = ErrorUtil.parameterErrorFormat("score", "空分数和与题目总分不相等"); |
| | | return new RestResponse<>(SystemCode.ParameterValidError.getCode(), errorMsg); |
| | | return new Result<>(SystemCode.ParameterValidError.getCode(), errorMsg); |
| | | } |
| | | } |
| | | return RestResponse.ok(); |
| | | return Result.ok(); |
| | | } |
| | | } |
| | |
| | | |
| | | |
| | | import com.ycl.jxkg.base.BaseApiController; |
| | | import com.ycl.jxkg.base.RestResponse; |
| | | import com.ycl.jxkg.base.Result; |
| | | import com.ycl.jxkg.domain.TaskExam; |
| | | import com.ycl.jxkg.service.TaskExamService; |
| | | import com.ycl.jxkg.utility.DateTimeUtil; |
| | | import com.ycl.jxkg.utility.PageInfoHelper; |
| | | import com.ycl.jxkg.viewmodel.admin.task.TaskPageRequestVM; |
| | | import com.ycl.jxkg.viewmodel.admin.task.TaskPageResponseVM; |
| | | import com.ycl.jxkg.viewmodel.admin.task.TaskRequestVM; |
| | | import com.ycl.jxkg.utils.DateTimeUtil; |
| | | import com.ycl.jxkg.utils.PageInfoHelper; |
| | | import com.ycl.jxkg.vo.admin.task.TaskPageRequestVO; |
| | | import com.ycl.jxkg.vo.admin.task.TaskPageResponseVO; |
| | | import com.ycl.jxkg.vo.admin.task.TaskRequestVO; |
| | | import com.github.pagehelper.PageInfo; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | } |
| | | |
| | | @RequestMapping(value = "/page", method = RequestMethod.POST) |
| | | public RestResponse<PageInfo<TaskPageResponseVM>> pageList(@RequestBody TaskPageRequestVM model) { |
| | | public Result<PageInfo<TaskPageResponseVO>> pageList(@RequestBody TaskPageRequestVO model) { |
| | | PageInfo<TaskExam> pageInfo = taskExamService.page(model); |
| | | PageInfo<TaskPageResponseVM> page = PageInfoHelper.copyMap(pageInfo, m -> { |
| | | TaskPageResponseVM vm = modelMapper.map(m, TaskPageResponseVM.class); |
| | | vm.setCreateTime(DateTimeUtil.dateFormat(m.getCreateTime())); |
| | | return vm; |
| | | PageInfo<TaskPageResponseVO> page = PageInfoHelper.copyMap(pageInfo, m -> { |
| | | TaskPageResponseVO vo = new TaskPageResponseVO(); |
| | | BeanUtils.copyProperties(m, vo); |
| | | vo.setCreateTime(DateTimeUtil.dateFormat(m.getCreateTime())); |
| | | return vo; |
| | | }); |
| | | return RestResponse.ok(page); |
| | | return Result.ok(page); |
| | | } |
| | | |
| | | |
| | | @RequestMapping(value = "/edit", method = RequestMethod.POST) |
| | | public RestResponse edit(@RequestBody @Valid TaskRequestVM model) { |
| | | public Result edit(@RequestBody @Valid TaskRequestVO model) { |
| | | taskExamService.edit(model, getCurrentUser()); |
| | | TaskRequestVM vm = taskExamService.taskExamToVM(model.getId()); |
| | | return RestResponse.ok(vm); |
| | | TaskRequestVO vm = taskExamService.taskExamToVM(model.getId()); |
| | | return Result.ok(vm); |
| | | } |
| | | |
| | | |
| | | @RequestMapping(value = "/select/{id}", method = RequestMethod.POST) |
| | | public RestResponse<TaskRequestVM> select(@PathVariable Integer id) { |
| | | TaskRequestVM vm = taskExamService.taskExamToVM(id); |
| | | return RestResponse.ok(vm); |
| | | public Result<TaskRequestVO> select(@PathVariable Integer id) { |
| | | TaskRequestVO vm = taskExamService.taskExamToVM(id); |
| | | return Result.ok(vm); |
| | | } |
| | | |
| | | @RequestMapping(value = "/delete/{id}", method = RequestMethod.POST) |
| | | public RestResponse delete(@PathVariable Integer id) { |
| | | public Result delete(@PathVariable Integer id) { |
| | | TaskExam taskExam = taskExamService.selectById(id); |
| | | taskExam.setDeleted(true); |
| | | taskExamService.updateByIdFilter(taskExam); |
| | | return RestResponse.ok(); |
| | | return Result.ok(); |
| | | } |
| | | } |
| | |
| | | |
| | | |
| | | import com.ycl.jxkg.base.BaseApiController; |
| | | import com.ycl.jxkg.base.RestResponse; |
| | | import com.ycl.jxkg.configuration.property.SystemConfig; |
| | | import com.ycl.jxkg.base.Result; |
| | | import com.ycl.jxkg.config.property.SystemConfig; |
| | | import com.ycl.jxkg.service.FileUpload; |
| | | import com.ycl.jxkg.service.UserService; |
| | | import com.ycl.jxkg.viewmodel.admin.file.UeditorConfigVM; |
| | | import com.ycl.jxkg.viewmodel.admin.file.UploadResultVM; |
| | | import com.ycl.jxkg.vo.admin.file.UeditorConfigVO; |
| | | import com.ycl.jxkg.vo.admin.file.UploadResultVO; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | filePath = fileUpload.uploadFile(inputStream, attachSize, imgName); |
| | | } |
| | | String imageType = imgName.substring(imgName.lastIndexOf(".")); |
| | | UploadResultVM uploadResultVM = new UploadResultVM(); |
| | | uploadResultVM.setOriginal(imgName); |
| | | uploadResultVM.setName(imgName); |
| | | uploadResultVM.setUrl(filePath); |
| | | uploadResultVM.setSize(multipartFile.getSize()); |
| | | uploadResultVM.setType(imageType); |
| | | uploadResultVM.setState("SUCCESS"); |
| | | return uploadResultVM; |
| | | UploadResultVO uploadResultVO = new UploadResultVO(); |
| | | uploadResultVO.setOriginal(imgName); |
| | | uploadResultVO.setName(imgName); |
| | | uploadResultVO.setUrl(filePath); |
| | | uploadResultVO.setSize(multipartFile.getSize()); |
| | | uploadResultVO.setType(imageType); |
| | | uploadResultVO.setState("SUCCESS"); |
| | | return uploadResultVO; |
| | | } catch (IOException e) { |
| | | logger.error(e.getMessage(), e); |
| | | } |
| | | } else { |
| | | UeditorConfigVM ueditorConfigVM = new UeditorConfigVM(); |
| | | ueditorConfigVM.setImageActionName(IMAGE_UPLOAD); |
| | | ueditorConfigVM.setImageFieldName(IMAGE_UPLOAD_FILE); |
| | | ueditorConfigVM.setImageMaxSize(2048000L); |
| | | ueditorConfigVM.setImageAllowFiles(Arrays.asList(".png", ".jpg", ".jpeg", ".gif", ".bmp")); |
| | | ueditorConfigVM.setImageCompressEnable(true); |
| | | ueditorConfigVM.setImageCompressBorder(1600); |
| | | ueditorConfigVM.setImageInsertAlign("none"); |
| | | ueditorConfigVM.setImageUrlPrefix(""); |
| | | ueditorConfigVM.setImagePathFormat(""); |
| | | return ueditorConfigVM; |
| | | UeditorConfigVO ueditorConfigVO = new UeditorConfigVO(); |
| | | ueditorConfigVO.setImageActionName(IMAGE_UPLOAD); |
| | | ueditorConfigVO.setImageFieldName(IMAGE_UPLOAD_FILE); |
| | | ueditorConfigVO.setImageMaxSize(2048000L); |
| | | ueditorConfigVO.setImageAllowFiles(Arrays.asList(".png", ".jpg", ".jpeg", ".gif", ".bmp")); |
| | | ueditorConfigVO.setImageCompressEnable(true); |
| | | ueditorConfigVO.setImageCompressBorder(1600); |
| | | ueditorConfigVO.setImageInsertAlign("none"); |
| | | ueditorConfigVO.setImageUrlPrefix(""); |
| | | ueditorConfigVO.setImagePathFormat(""); |
| | | return ueditorConfigVO; |
| | | } |
| | | return null; |
| | | } |
| | |
| | | |
| | | @RequestMapping("/image") |
| | | @ResponseBody |
| | | public RestResponse questionUploadAndReadExcel(HttpServletRequest request) { |
| | | public Result questionUploadAndReadExcel(HttpServletRequest request) { |
| | | MultipartHttpServletRequest multipartHttpServletRequest = (MultipartHttpServletRequest) request; |
| | | MultipartFile multipartFile = multipartHttpServletRequest.getFile("file"); |
| | | long attachSize = multipartFile.getSize(); |
| | |
| | | try (InputStream inputStream = multipartFile.getInputStream()) { |
| | | String filePath = fileUpload.uploadFile(inputStream, attachSize, imgName); |
| | | userService.changePicture(getCurrentUser(), filePath); |
| | | return RestResponse.ok(filePath); |
| | | return Result.ok(filePath); |
| | | } catch (IOException e) { |
| | | return RestResponse.fail(2, e.getMessage()); |
| | | return Result.fail(2, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | |
| | | package com.ycl.jxkg.controller.admin; |
| | | |
| | | import com.ycl.jxkg.base.BaseApiController; |
| | | import com.ycl.jxkg.base.RestResponse; |
| | | import com.ycl.jxkg.base.Result; |
| | | import com.ycl.jxkg.domain.other.KeyValue; |
| | | import com.ycl.jxkg.domain.User; |
| | | import com.ycl.jxkg.domain.UserEventLog; |
| | |
| | | import com.ycl.jxkg.service.AuthenticationService; |
| | | import com.ycl.jxkg.service.UserEventLogService; |
| | | import com.ycl.jxkg.service.UserService; |
| | | import com.ycl.jxkg.utility.DateTimeUtil; |
| | | import com.ycl.jxkg.viewmodel.admin.user.*; |
| | | import com.ycl.jxkg.utility.PageInfoHelper; |
| | | import com.ycl.jxkg.utils.DateTimeUtil; |
| | | import com.ycl.jxkg.vo.admin.user.*; |
| | | import com.ycl.jxkg.utils.PageInfoHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | |
| | | |
| | | @RequestMapping(value = "/page/list", method = RequestMethod.POST) |
| | | public RestResponse<PageInfo<UserResponseVM>> pageList(@RequestBody UserPageRequestVM model) { |
| | | public Result<PageInfo<UserResponseVO>> pageList(@RequestBody UserPageRequestVO model) { |
| | | PageInfo<User> pageInfo = userService.userPage(model); |
| | | PageInfo<UserResponseVM> page = PageInfoHelper.copyMap(pageInfo, d -> UserResponseVM.from(d)); |
| | | return RestResponse.ok(page); |
| | | PageInfo<UserResponseVO> page = PageInfoHelper.copyMap(pageInfo, d -> UserResponseVO.from(d)); |
| | | return Result.ok(page); |
| | | } |
| | | |
| | | |
| | | @RequestMapping(value = "/event/page/list", method = RequestMethod.POST) |
| | | public RestResponse<PageInfo<UserEventLogVM>> eventPageList(@RequestBody UserEventPageRequestVM model) { |
| | | public Result<PageInfo<UserEventLogVO>> eventPageList(@RequestBody UserEventPageRequestVO model) { |
| | | PageInfo<UserEventLog> pageInfo = userEventLogService.page(model); |
| | | PageInfo<UserEventLogVM> page = PageInfoHelper.copyMap(pageInfo, d -> { |
| | | UserEventLogVM vm = modelMapper.map(d, UserEventLogVM.class); |
| | | vm.setCreateTime(DateTimeUtil.dateFormat(d.getCreateTime())); |
| | | return vm; |
| | | PageInfo<UserEventLogVO> page = PageInfoHelper.copyMap(pageInfo, d -> { |
| | | UserEventLogVO vo = new UserEventLogVO(); |
| | | BeanUtils.copyProperties(d, vo); |
| | | vo.setCreateTime(DateTimeUtil.dateFormat(d.getCreateTime())); |
| | | return vo; |
| | | }); |
| | | return RestResponse.ok(page); |
| | | return Result.ok(page); |
| | | } |
| | | |
| | | @RequestMapping(value = "/select/{id}", method = RequestMethod.POST) |
| | | public RestResponse<UserResponseVM> select(@PathVariable Integer id) { |
| | | public Result<UserResponseVO> select(@PathVariable Integer id) { |
| | | User user = userService.getUserById(id); |
| | | UserResponseVM userVm = UserResponseVM.from(user); |
| | | return RestResponse.ok(userVm); |
| | | UserResponseVO userVm = UserResponseVO.from(user); |
| | | return Result.ok(userVm); |
| | | } |
| | | |
| | | @RequestMapping(value = "/current", method = RequestMethod.POST) |
| | | public RestResponse<UserResponseVM> current() { |
| | | public Result<UserResponseVO> current() { |
| | | User user = getCurrentUser(); |
| | | UserResponseVM userVm = UserResponseVM.from(user); |
| | | return RestResponse.ok(userVm); |
| | | UserResponseVO userVm = UserResponseVO.from(user); |
| | | return Result.ok(userVm); |
| | | } |
| | | |
| | | |
| | | @RequestMapping(value = "/edit", method = RequestMethod.POST) |
| | | public RestResponse<User> edit(@RequestBody @Valid UserCreateVM model) { |
| | | public Result<User> edit(@RequestBody @Valid UserCreateVO model) { |
| | | if (model.getId() == null) { //create |
| | | User existUser = userService.getUserByUserName(model.getUserName()); |
| | | if (null != existUser) { |
| | | return new RestResponse<>(2, "用户已存在"); |
| | | return new Result<>(2, "用户已存在"); |
| | | } |
| | | |
| | | if (StringUtils.isBlank(model.getPassword())) { |
| | | return new RestResponse<>(3, "密码不能为空"); |
| | | return new Result<>(3, "密码不能为空"); |
| | | } |
| | | } |
| | | if (StringUtils.isBlank(model.getBirthDay())) { |
| | | model.setBirthDay(null); |
| | | } |
| | | User user = modelMapper.map(model, User.class); |
| | | User user = new User(); |
| | | BeanUtils.copyProperties(model, user); |
| | | |
| | | if (model.getId() == null) { |
| | | String encodePwd = authenticationService.pwdEncode(model.getPassword()); |
| | |
| | | user.setModifyTime(new Date()); |
| | | userService.updateByIdFilter(user); |
| | | } |
| | | return RestResponse.ok(user); |
| | | return Result.ok(user); |
| | | } |
| | | |
| | | |
| | | @RequestMapping(value = "/update", method = RequestMethod.POST) |
| | | public RestResponse update(@RequestBody @Valid UserUpdateVM model) { |
| | | public Result update(@RequestBody @Valid UserUpdateVO model) { |
| | | User user = userService.selectById(getCurrentUser().getId()); |
| | | modelMapper.map(model, user); |
| | | BeanUtils.copyProperties(model, user); |
| | | user.setModifyTime(new Date()); |
| | | userService.updateByIdFilter(user); |
| | | return RestResponse.ok(); |
| | | return Result.ok(); |
| | | } |
| | | |
| | | |
| | | @RequestMapping(value = "/changeStatus/{id}", method = RequestMethod.POST) |
| | | public RestResponse<Integer> changeStatus(@PathVariable Integer id) { |
| | | public Result<Integer> changeStatus(@PathVariable Integer id) { |
| | | User user = userService.getUserById(id); |
| | | UserStatusEnum userStatusEnum = UserStatusEnum.fromCode(user.getStatus()); |
| | | Integer newStatus = userStatusEnum == UserStatusEnum.Enable ? UserStatusEnum.Disable.getCode() : UserStatusEnum.Enable.getCode(); |
| | | user.setStatus(newStatus); |
| | | user.setModifyTime(new Date()); |
| | | userService.updateByIdFilter(user); |
| | | return RestResponse.ok(newStatus); |
| | | return Result.ok(newStatus); |
| | | } |
| | | |
| | | |
| | | @RequestMapping(value = "/delete/{id}", method = RequestMethod.POST) |
| | | public RestResponse delete(@PathVariable Integer id) { |
| | | public Result delete(@PathVariable Integer id) { |
| | | User user = userService.getUserById(id); |
| | | user.setDeleted(true); |
| | | userService.updateByIdFilter(user); |
| | | return RestResponse.ok(); |
| | | return Result.ok(); |
| | | } |
| | | |
| | | |
| | | @RequestMapping(value = "/selectByUserName", method = RequestMethod.POST) |
| | | public RestResponse<List<KeyValue>> selectByUserName(@RequestBody String userName) { |
| | | public Result<List<KeyValue>> selectByUserName(@RequestBody String userName) { |
| | | List<KeyValue> keyValues = userService.selectByUserName(userName); |
| | | return RestResponse.ok(keyValues); |
| | | return Result.ok(keyValues); |
| | | } |
| | | |
| | | } |
| | |
| | | package com.ycl.jxkg.controller.student; |
| | | |
| | | import com.ycl.jxkg.base.BaseApiController; |
| | | import com.ycl.jxkg.base.RestResponse; |
| | | import com.ycl.jxkg.base.Result; |
| | | import com.ycl.jxkg.domain.TaskExam; |
| | | import com.ycl.jxkg.domain.TaskExamCustomerAnswer; |
| | | import com.ycl.jxkg.domain.TextContent; |
| | |
| | | import com.ycl.jxkg.domain.task.TaskItemAnswerObject; |
| | | import com.ycl.jxkg.domain.task.TaskItemObject; |
| | | import com.ycl.jxkg.service.*; |
| | | import com.ycl.jxkg.utility.DateTimeUtil; |
| | | import com.ycl.jxkg.utility.JsonUtil; |
| | | import com.ycl.jxkg.viewmodel.student.dashboard.*; |
| | | import com.ycl.jxkg.utils.DateTimeUtil; |
| | | import com.ycl.jxkg.utils.JsonUtil; |
| | | import com.ycl.jxkg.vo.student.dashboard.*; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | |
| | | } |
| | | |
| | | @RequestMapping(value = "/index", method = RequestMethod.POST) |
| | | public RestResponse<IndexVM> index() { |
| | | IndexVM indexVM = new IndexVM(); |
| | | public Result<IndexVO> index() { |
| | | IndexVO indexVO = new IndexVO(); |
| | | User user = getCurrentUser(); |
| | | |
| | | PaperFilter fixedPaperFilter = new PaperFilter(); |
| | | fixedPaperFilter.setGradeLevel(user.getUserLevel()); |
| | | fixedPaperFilter.setExamPaperType(ExamPaperTypeEnum.Fixed.getCode()); |
| | | indexVM.setFixedPaper(examPaperService.indexPaper(fixedPaperFilter)); |
| | | indexVO.setFixedPaper(examPaperService.indexPaper(fixedPaperFilter)); |
| | | |
| | | PaperFilter timeLimitPaperFilter = new PaperFilter(); |
| | | timeLimitPaperFilter.setDateTime(new Date()); |
| | |
| | | timeLimitPaperFilter.setExamPaperType(ExamPaperTypeEnum.TimeLimit.getCode()); |
| | | |
| | | List<PaperInfo> limitPaper = examPaperService.indexPaper(timeLimitPaperFilter); |
| | | List<PaperInfoVM> paperInfoVMS = limitPaper.stream().map(d -> { |
| | | PaperInfoVM vm = modelMapper.map(d, PaperInfoVM.class); |
| | | vm.setStartTime(DateTimeUtil.dateFormat(d.getLimitStartTime())); |
| | | vm.setEndTime(DateTimeUtil.dateFormat(d.getLimitEndTime())); |
| | | return vm; |
| | | List<PaperInfoVO> paperInfoVOS = limitPaper.stream().map(d -> { |
| | | PaperInfoVO vo = new PaperInfoVO(); |
| | | BeanUtils.copyProperties(d, vo); |
| | | vo.setStartTime(DateTimeUtil.dateFormat(d.getLimitStartTime())); |
| | | vo.setEndTime(DateTimeUtil.dateFormat(d.getLimitEndTime())); |
| | | return vo; |
| | | }).collect(Collectors.toList()); |
| | | indexVM.setTimeLimitPaper(paperInfoVMS); |
| | | return RestResponse.ok(indexVM); |
| | | indexVO.setTimeLimitPaper(paperInfoVOS); |
| | | return Result.ok(indexVO); |
| | | } |
| | | |
| | | |
| | | @RequestMapping(value = "/task", method = RequestMethod.POST) |
| | | public RestResponse<List<TaskItemVm>> task() { |
| | | public Result<List<TaskItemVO>> task() { |
| | | User user = getCurrentUser(); |
| | | List<TaskExam> taskExams = taskExamService.getByGradeLevel(user.getUserLevel()); |
| | | if (taskExams.size() == 0) { |
| | | return RestResponse.ok(new ArrayList<>()); |
| | | return Result.ok(new ArrayList<>()); |
| | | } |
| | | List<Integer> tIds = taskExams.stream().map(taskExam -> taskExam.getId()).collect(Collectors.toList()); |
| | | List<TaskExamCustomerAnswer> taskExamCustomerAnswers = taskExamCustomerAnswerService.selectByTUid(tIds, user.getId()); |
| | | List<TaskItemVm> vm = taskExams.stream().map(t -> { |
| | | TaskItemVm itemVm = new TaskItemVm(); |
| | | List<TaskItemVO> vm = taskExams.stream().map(t -> { |
| | | TaskItemVO itemVm = new TaskItemVO(); |
| | | itemVm.setId(t.getId()); |
| | | itemVm.setTitle(t.getTitle()); |
| | | TaskExamCustomerAnswer taskExamCustomerAnswer = taskExamCustomerAnswers.stream() |
| | | .filter(tc -> tc.getTaskExamId().equals(t.getId())).findFirst().orElse(null); |
| | | List<TaskItemPaperVm> paperItemVMS = getTaskItemPaperVm(t.getFrameTextContentId(), taskExamCustomerAnswer); |
| | | List<TaskItemPaperVO> paperItemVMS = getTaskItemPaperVm(t.getFrameTextContentId(), taskExamCustomerAnswer); |
| | | itemVm.setPaperItems(paperItemVMS); |
| | | return itemVm; |
| | | }).collect(Collectors.toList()); |
| | | return RestResponse.ok(vm); |
| | | return Result.ok(vm); |
| | | } |
| | | |
| | | |
| | | private List<TaskItemPaperVm> getTaskItemPaperVm(Integer tFrameId, TaskExamCustomerAnswer taskExamCustomerAnswers) { |
| | | private List<TaskItemPaperVO> getTaskItemPaperVm(Integer tFrameId, TaskExamCustomerAnswer taskExamCustomerAnswers) { |
| | | TextContent textContent = textContentService.selectById(tFrameId); |
| | | List<TaskItemObject> paperItems = JsonUtil.toJsonListObject(textContent.getContent(), TaskItemObject.class); |
| | | |
| | |
| | | |
| | | List<TaskItemAnswerObject> finalAnswerPaperItems = answerPaperItems; |
| | | return paperItems.stream().map(p -> { |
| | | TaskItemPaperVm ivm = new TaskItemPaperVm(); |
| | | TaskItemPaperVO ivm = new TaskItemPaperVO(); |
| | | ivm.setExamPaperId(p.getExamPaperId()); |
| | | ivm.setExamPaperName(p.getExamPaperName()); |
| | | if (null != finalAnswerPaperItems) { |
| | |
| | | |
| | | |
| | | import com.ycl.jxkg.base.BaseApiController; |
| | | import com.ycl.jxkg.base.RestResponse; |
| | | import com.ycl.jxkg.base.Result; |
| | | import com.ycl.jxkg.domain.Subject; |
| | | import com.ycl.jxkg.domain.User; |
| | | import com.ycl.jxkg.service.SubjectService; |
| | | import com.ycl.jxkg.viewmodel.student.education.SubjectEditRequestVM; |
| | | import com.ycl.jxkg.viewmodel.student.education.SubjectVM; |
| | | import com.ycl.jxkg.vo.student.education.SubjectEditRequestVO; |
| | | import com.ycl.jxkg.vo.student.education.SubjectVO; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | } |
| | | |
| | | @RequestMapping(value = "/subject/list", method = RequestMethod.POST) |
| | | public RestResponse<List<SubjectVM>> list() { |
| | | public Result<List<SubjectVO>> list() { |
| | | User user = getCurrentUser(); |
| | | List<Subject> subjects = subjectService.getSubjectByLevel(user.getUserLevel()); |
| | | List<SubjectVM> subjectVMS = subjects.stream().map(d -> { |
| | | SubjectVM subjectVM = modelMapper.map(d, SubjectVM.class); |
| | | subjectVM.setId(String.valueOf(d.getId())); |
| | | return subjectVM; |
| | | List<SubjectVO> subjectVOS = subjects.stream().map(d -> { |
| | | SubjectVO subjectVO = new SubjectVO(); |
| | | BeanUtils.copyProperties(d, subjectVO); |
| | | subjectVO.setId(String.valueOf(d.getId())); |
| | | return subjectVO; |
| | | }).collect(Collectors.toList()); |
| | | return RestResponse.ok(subjectVMS); |
| | | return Result.ok(subjectVOS); |
| | | } |
| | | |
| | | @RequestMapping(value = "/subject/select/{id}", method = RequestMethod.POST) |
| | | public RestResponse<SubjectEditRequestVM> select(@PathVariable Integer id) { |
| | | public Result<SubjectEditRequestVO> select(@PathVariable Integer id) { |
| | | Subject subject = subjectService.selectById(id); |
| | | SubjectEditRequestVM vm = modelMapper.map(subject, SubjectEditRequestVM.class); |
| | | return RestResponse.ok(vm); |
| | | SubjectEditRequestVO vo = new SubjectEditRequestVO(); |
| | | BeanUtils.copyProperties(subject, vo); |
| | | return Result.ok(vo); |
| | | } |
| | | |
| | | } |
| | |
| | | package com.ycl.jxkg.controller.student; |
| | | |
| | | import com.ycl.jxkg.base.BaseApiController; |
| | | import com.ycl.jxkg.base.RestResponse; |
| | | import com.ycl.jxkg.base.Result; |
| | | import com.ycl.jxkg.domain.*; |
| | | import com.ycl.jxkg.domain.enums.ExamPaperAnswerStatusEnum; |
| | | import com.ycl.jxkg.event.CalculateExamPaperAnswerCompleteEvent; |
| | |
| | | import com.ycl.jxkg.service.ExamPaperAnswerService; |
| | | import com.ycl.jxkg.service.ExamPaperService; |
| | | import com.ycl.jxkg.service.SubjectService; |
| | | import com.ycl.jxkg.utility.DateTimeUtil; |
| | | import com.ycl.jxkg.utility.ExamUtil; |
| | | import com.ycl.jxkg.utility.PageInfoHelper; |
| | | import com.ycl.jxkg.viewmodel.admin.exam.ExamPaperEditRequestVM; |
| | | import com.ycl.jxkg.viewmodel.student.exam.ExamPaperReadVM; |
| | | import com.ycl.jxkg.viewmodel.student.exam.ExamPaperSubmitVM; |
| | | import com.ycl.jxkg.viewmodel.student.exampaper.ExamPaperAnswerPageResponseVM; |
| | | import com.ycl.jxkg.viewmodel.student.exampaper.ExamPaperAnswerPageVM; |
| | | import com.ycl.jxkg.utils.DateTimeUtil; |
| | | import com.ycl.jxkg.utils.ExamUtil; |
| | | import com.ycl.jxkg.utils.PageInfoHelper; |
| | | import com.ycl.jxkg.vo.admin.exam.ExamPaperEditRequestVO; |
| | | import com.ycl.jxkg.vo.student.exam.ExamPaperReadVO; |
| | | import com.ycl.jxkg.vo.student.exam.ExamPaperSubmitVO; |
| | | import com.ycl.jxkg.vo.student.exampaper.ExamPaperAnswerPageResponseVO; |
| | | import com.ycl.jxkg.vo.student.exampaper.ExamPaperAnswerPageVO; |
| | | import com.github.pagehelper.PageInfo; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.ApplicationEventPublisher; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | |
| | | |
| | | @RequestMapping(value = "/pageList", method = RequestMethod.POST) |
| | | public RestResponse<PageInfo<ExamPaperAnswerPageResponseVM>> pageList(@RequestBody @Valid ExamPaperAnswerPageVM model) { |
| | | public Result<PageInfo<ExamPaperAnswerPageResponseVO>> pageList(@RequestBody @Valid ExamPaperAnswerPageVO model) { |
| | | model.setCreateUser(getCurrentUser().getId()); |
| | | PageInfo<ExamPaperAnswer> pageInfo = examPaperAnswerService.studentPage(model); |
| | | PageInfo<ExamPaperAnswerPageResponseVM> page = PageInfoHelper.copyMap(pageInfo, e -> { |
| | | ExamPaperAnswerPageResponseVM vm = modelMapper.map(e, ExamPaperAnswerPageResponseVM.class); |
| | | Subject subject = subjectService.selectById(vm.getSubjectId()); |
| | | vm.setDoTime(ExamUtil.secondToVM(e.getDoTime())); |
| | | vm.setSystemScore(ExamUtil.scoreToVM(e.getSystemScore())); |
| | | vm.setUserScore(ExamUtil.scoreToVM(e.getUserScore())); |
| | | vm.setPaperScore(ExamUtil.scoreToVM(e.getPaperScore())); |
| | | vm.setSubjectName(subject.getName()); |
| | | vm.setCreateTime(DateTimeUtil.dateFormat(e.getCreateTime())); |
| | | return vm; |
| | | PageInfo<ExamPaperAnswerPageResponseVO> page = PageInfoHelper.copyMap(pageInfo, e -> { |
| | | ExamPaperAnswerPageResponseVO vo = new ExamPaperAnswerPageResponseVO(); |
| | | BeanUtils.copyProperties(e, vo); |
| | | Subject subject = subjectService.selectById(vo.getSubjectId()); |
| | | vo.setDoTime(ExamUtil.secondToVM(e.getDoTime())); |
| | | vo.setSystemScore(ExamUtil.scoreToVM(e.getSystemScore())); |
| | | vo.setUserScore(ExamUtil.scoreToVM(e.getUserScore())); |
| | | vo.setPaperScore(ExamUtil.scoreToVM(e.getPaperScore())); |
| | | vo.setSubjectName(subject.getName()); |
| | | vo.setCreateTime(DateTimeUtil.dateFormat(e.getCreateTime())); |
| | | return vo; |
| | | }); |
| | | return RestResponse.ok(page); |
| | | return Result.ok(page); |
| | | } |
| | | |
| | | |
| | | @RequestMapping(value = "/answerSubmit", method = RequestMethod.POST) |
| | | public RestResponse answerSubmit(@RequestBody @Valid ExamPaperSubmitVM examPaperSubmitVM) { |
| | | public Result answerSubmit(@RequestBody @Valid ExamPaperSubmitVO examPaperSubmitVO) { |
| | | User user = getCurrentUser(); |
| | | ExamPaperAnswerInfo examPaperAnswerInfo = examPaperAnswerService.calculateExamPaperAnswer(examPaperSubmitVM, user); |
| | | ExamPaperAnswerInfo examPaperAnswerInfo = examPaperAnswerService.calculateExamPaperAnswer(examPaperSubmitVO, user); |
| | | if (null == examPaperAnswerInfo) { |
| | | return RestResponse.fail(2, "试卷不能重复做"); |
| | | return Result.fail(2, "试卷不能重复做"); |
| | | } |
| | | ExamPaperAnswer examPaperAnswer = examPaperAnswerInfo.getExamPaperAnswer(); |
| | | Integer userScore = examPaperAnswer.getUserScore(); |
| | |
| | | userEventLog.setContent(content); |
| | | eventPublisher.publishEvent(new CalculateExamPaperAnswerCompleteEvent(examPaperAnswerInfo)); |
| | | eventPublisher.publishEvent(new UserEvent(userEventLog)); |
| | | return RestResponse.ok(scoreVm); |
| | | return Result.ok(scoreVm); |
| | | } |
| | | |
| | | |
| | | @RequestMapping(value = "/edit", method = RequestMethod.POST) |
| | | public RestResponse edit(@RequestBody @Valid ExamPaperSubmitVM examPaperSubmitVM) { |
| | | boolean notJudge = examPaperSubmitVM.getAnswerItems().stream().anyMatch(i -> i.getDoRight() == null && i.getScore() == null); |
| | | public Result edit(@RequestBody @Valid ExamPaperSubmitVO examPaperSubmitVO) { |
| | | boolean notJudge = examPaperSubmitVO.getAnswerItems().stream().anyMatch(i -> i.getDoRight() == null && i.getScore() == null); |
| | | if (notJudge) { |
| | | return RestResponse.fail(2, "有未批改题目"); |
| | | return Result.fail(2, "有未批改题目"); |
| | | } |
| | | |
| | | ExamPaperAnswer examPaperAnswer = examPaperAnswerService.selectById(examPaperSubmitVM.getId()); |
| | | ExamPaperAnswer examPaperAnswer = examPaperAnswerService.selectById(examPaperSubmitVO.getId()); |
| | | ExamPaperAnswerStatusEnum examPaperAnswerStatusEnum = ExamPaperAnswerStatusEnum.fromCode(examPaperAnswer.getStatus()); |
| | | if (examPaperAnswerStatusEnum == ExamPaperAnswerStatusEnum.Complete) { |
| | | return RestResponse.fail(3, "试卷已完成"); |
| | | return Result.fail(3, "试卷已完成"); |
| | | } |
| | | String score = examPaperAnswerService.judge(examPaperSubmitVM); |
| | | String score = examPaperAnswerService.judge(examPaperSubmitVO); |
| | | User user = getCurrentUser(); |
| | | UserEventLog userEventLog = new UserEventLog(user.getId(), user.getUserName(), user.getRealName(), new Date()); |
| | | String content = user.getUserName() + " 批改试卷:" + examPaperAnswer.getPaperName() + " 得分:" + score; |
| | | userEventLog.setContent(content); |
| | | eventPublisher.publishEvent(new UserEvent(userEventLog)); |
| | | return RestResponse.ok(score); |
| | | return Result.ok(score); |
| | | } |
| | | |
| | | @RequestMapping(value = "/read/{id}", method = RequestMethod.POST) |
| | | public RestResponse<ExamPaperReadVM> read(@PathVariable Integer id) { |
| | | public Result<ExamPaperReadVO> read(@PathVariable Integer id) { |
| | | ExamPaperAnswer examPaperAnswer = examPaperAnswerService.selectById(id); |
| | | ExamPaperReadVM vm = new ExamPaperReadVM(); |
| | | ExamPaperEditRequestVM paper = examPaperService.examPaperToVM(examPaperAnswer.getExamPaperId()); |
| | | ExamPaperSubmitVM answer = examPaperAnswerService.examPaperAnswerToVM(examPaperAnswer.getId()); |
| | | ExamPaperReadVO vm = new ExamPaperReadVO(); |
| | | ExamPaperEditRequestVO paper = examPaperService.examPaperToVM(examPaperAnswer.getExamPaperId()); |
| | | ExamPaperSubmitVO answer = examPaperAnswerService.examPaperAnswerToVM(examPaperAnswer.getId()); |
| | | vm.setPaper(paper); |
| | | vm.setAnswer(answer); |
| | | return RestResponse.ok(vm); |
| | | return Result.ok(vm); |
| | | } |
| | | |
| | | |
| | |
| | | package com.ycl.jxkg.controller.student; |
| | | |
| | | import com.ycl.jxkg.base.BaseApiController; |
| | | import com.ycl.jxkg.base.RestResponse; |
| | | import com.ycl.jxkg.base.Result; |
| | | import com.ycl.jxkg.domain.ExamPaper; |
| | | import com.ycl.jxkg.service.ExamPaperAnswerService; |
| | | import com.ycl.jxkg.service.ExamPaperService; |
| | | import com.ycl.jxkg.utility.DateTimeUtil; |
| | | import com.ycl.jxkg.utility.PageInfoHelper; |
| | | import com.ycl.jxkg.viewmodel.admin.exam.ExamPaperEditRequestVM; |
| | | import com.ycl.jxkg.viewmodel.student.exam.ExamPaperPageResponseVM; |
| | | import com.ycl.jxkg.viewmodel.student.exam.ExamPaperPageVM; |
| | | import com.ycl.jxkg.utils.DateTimeUtil; |
| | | import com.ycl.jxkg.utils.PageInfoHelper; |
| | | import com.ycl.jxkg.vo.admin.exam.ExamPaperEditRequestVO; |
| | | import com.ycl.jxkg.vo.student.exam.ExamPaperPageResponseVO; |
| | | import com.ycl.jxkg.vo.student.exam.ExamPaperPageVO; |
| | | import com.github.pagehelper.PageInfo; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.ApplicationEventPublisher; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | |
| | | |
| | | @RequestMapping(value = "/select/{id}", method = RequestMethod.POST) |
| | | public RestResponse<ExamPaperEditRequestVM> select(@PathVariable Integer id) { |
| | | ExamPaperEditRequestVM vm = examPaperService.examPaperToVM(id); |
| | | return RestResponse.ok(vm); |
| | | public Result<ExamPaperEditRequestVO> select(@PathVariable Integer id) { |
| | | ExamPaperEditRequestVO vm = examPaperService.examPaperToVM(id); |
| | | return Result.ok(vm); |
| | | } |
| | | |
| | | |
| | | @RequestMapping(value = "/pageList", method = RequestMethod.POST) |
| | | public RestResponse<PageInfo<ExamPaperPageResponseVM>> pageList(@RequestBody @Valid ExamPaperPageVM model) { |
| | | public Result<PageInfo<ExamPaperPageResponseVO>> pageList(@RequestBody @Valid ExamPaperPageVO model) { |
| | | PageInfo<ExamPaper> pageInfo = examPaperService.studentPage(model); |
| | | PageInfo<ExamPaperPageResponseVM> page = PageInfoHelper.copyMap(pageInfo, e -> { |
| | | ExamPaperPageResponseVM vm = modelMapper.map(e, ExamPaperPageResponseVM.class); |
| | | vm.setCreateTime(DateTimeUtil.dateFormat(e.getCreateTime())); |
| | | return vm; |
| | | PageInfo<ExamPaperPageResponseVO> page = PageInfoHelper.copyMap(pageInfo, e -> { |
| | | ExamPaperPageResponseVO vo = new ExamPaperPageResponseVO(); |
| | | BeanUtils.copyProperties(e, vo); |
| | | vo.setCreateTime(DateTimeUtil.dateFormat(e.getCreateTime())); |
| | | return vo; |
| | | }); |
| | | return RestResponse.ok(page); |
| | | return Result.ok(page); |
| | | } |
| | | } |
| | |
| | | package com.ycl.jxkg.controller.student; |
| | | |
| | | import com.ycl.jxkg.base.BaseApiController; |
| | | import com.ycl.jxkg.base.RestResponse; |
| | | import com.ycl.jxkg.base.Result; |
| | | import com.ycl.jxkg.domain.ExamPaperQuestionCustomerAnswer; |
| | | import com.ycl.jxkg.domain.Subject; |
| | | import com.ycl.jxkg.domain.TextContent; |
| | |
| | | import com.ycl.jxkg.service.QuestionService; |
| | | import com.ycl.jxkg.service.SubjectService; |
| | | import com.ycl.jxkg.service.TextContentService; |
| | | import com.ycl.jxkg.utility.DateTimeUtil; |
| | | import com.ycl.jxkg.utility.HtmlUtil; |
| | | import com.ycl.jxkg.utility.JsonUtil; |
| | | import com.ycl.jxkg.utility.PageInfoHelper; |
| | | import com.ycl.jxkg.viewmodel.admin.question.QuestionEditRequestVM; |
| | | import com.ycl.jxkg.viewmodel.student.exam.ExamPaperSubmitItemVM; |
| | | import com.ycl.jxkg.viewmodel.student.question.answer.QuestionAnswerVM; |
| | | import com.ycl.jxkg.viewmodel.student.question.answer.QuestionPageStudentRequestVM; |
| | | import com.ycl.jxkg.viewmodel.student.question.answer.QuestionPageStudentResponseVM; |
| | | import com.ycl.jxkg.utils.DateTimeUtil; |
| | | import com.ycl.jxkg.utils.HtmlUtil; |
| | | import com.ycl.jxkg.utils.JsonUtil; |
| | | import com.ycl.jxkg.utils.PageInfoHelper; |
| | | import com.ycl.jxkg.vo.admin.question.QuestionEditRequestVO; |
| | | import com.ycl.jxkg.vo.student.exam.ExamPaperSubmitItemVO; |
| | | import com.ycl.jxkg.vo.student.question.answer.QuestionAnswerVO; |
| | | import com.ycl.jxkg.vo.student.question.answer.QuestionPageStudentRequestVO; |
| | | import com.ycl.jxkg.vo.student.question.answer.QuestionPageStudentResponseVO; |
| | | import com.github.pagehelper.PageInfo; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | } |
| | | |
| | | @RequestMapping(value = "/page", method = RequestMethod.POST) |
| | | public RestResponse<PageInfo<QuestionPageStudentResponseVM>> pageList(@RequestBody QuestionPageStudentRequestVM model) { |
| | | public Result<PageInfo<QuestionPageStudentResponseVO>> pageList(@RequestBody QuestionPageStudentRequestVO model) { |
| | | model.setCreateUser(getCurrentUser().getId()); |
| | | PageInfo<ExamPaperQuestionCustomerAnswer> pageInfo = examPaperQuestionCustomerAnswerService.studentPage(model); |
| | | PageInfo<QuestionPageStudentResponseVM> page = PageInfoHelper.copyMap(pageInfo, q -> { |
| | | PageInfo<QuestionPageStudentResponseVO> page = PageInfoHelper.copyMap(pageInfo, q -> { |
| | | Subject subject = subjectService.selectById(q.getSubjectId()); |
| | | QuestionPageStudentResponseVM vm = modelMapper.map(q, QuestionPageStudentResponseVM.class); |
| | | vm.setCreateTime(DateTimeUtil.dateFormat(q.getCreateTime())); |
| | | QuestionPageStudentResponseVO vo = new QuestionPageStudentResponseVO(); |
| | | BeanUtils.copyProperties(q, vo); |
| | | vo.setCreateTime(DateTimeUtil.dateFormat(q.getCreateTime())); |
| | | TextContent textContent = textContentService.selectById(q.getQuestionTextContentId()); |
| | | QuestionObject questionObject = JsonUtil.toJsonObject(textContent.getContent(), QuestionObject.class); |
| | | String clearHtml = HtmlUtil.clear(questionObject.getTitleContent()); |
| | | vm.setShortTitle(clearHtml); |
| | | vm.setSubjectName(subject.getName()); |
| | | return vm; |
| | | vo.setShortTitle(clearHtml); |
| | | vo.setSubjectName(subject.getName()); |
| | | return vo; |
| | | }); |
| | | return RestResponse.ok(page); |
| | | return Result.ok(page); |
| | | } |
| | | |
| | | |
| | | @RequestMapping(value = "/select/{id}", method = RequestMethod.POST) |
| | | public RestResponse<QuestionAnswerVM> select(@PathVariable Integer id) { |
| | | QuestionAnswerVM vm = new QuestionAnswerVM(); |
| | | public Result<QuestionAnswerVO> select(@PathVariable Integer id) { |
| | | QuestionAnswerVO vm = new QuestionAnswerVO(); |
| | | ExamPaperQuestionCustomerAnswer examPaperQuestionCustomerAnswer = examPaperQuestionCustomerAnswerService.selectById(id); |
| | | ExamPaperSubmitItemVM questionAnswerVM = examPaperQuestionCustomerAnswerService.examPaperQuestionCustomerAnswerToVM(examPaperQuestionCustomerAnswer); |
| | | QuestionEditRequestVM questionVM = questionService.getQuestionEditRequestVM(examPaperQuestionCustomerAnswer.getQuestionId()); |
| | | ExamPaperSubmitItemVO questionAnswerVM = examPaperQuestionCustomerAnswerService.examPaperQuestionCustomerAnswerToVM(examPaperQuestionCustomerAnswer); |
| | | QuestionEditRequestVO questionVM = questionService.getQuestionEditRequestVM(examPaperQuestionCustomerAnswer.getQuestionId()); |
| | | vm.setQuestionVM(questionVM); |
| | | vm.setQuestionAnswerVM(questionAnswerVM); |
| | | return RestResponse.ok(vm); |
| | | return Result.ok(vm); |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | |
| | | import com.ycl.jxkg.base.BaseApiController; |
| | | import com.ycl.jxkg.base.RestResponse; |
| | | import com.ycl.jxkg.base.Result; |
| | | import com.ycl.jxkg.service.FileUpload; |
| | | import com.ycl.jxkg.service.UserService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | |
| | | @RequestMapping("/image") |
| | | @ResponseBody |
| | | public RestResponse questionUploadAndReadExcel(HttpServletRequest request) { |
| | | public Result questionUploadAndReadExcel(HttpServletRequest request) { |
| | | MultipartHttpServletRequest multipartHttpServletRequest = (MultipartHttpServletRequest) request; |
| | | MultipartFile multipartFile = multipartHttpServletRequest.getFile("file"); |
| | | long attachSize = multipartFile.getSize(); |
| | |
| | | try (InputStream inputStream = multipartFile.getInputStream()) { |
| | | String filePath = fileUpload.uploadFile(inputStream, attachSize, imgName); |
| | | userService.changePicture(getCurrentUser(), filePath); |
| | | return RestResponse.ok(filePath); |
| | | return Result.ok(filePath); |
| | | } catch (IOException e) { |
| | | return RestResponse.fail(2, e.getMessage()); |
| | | return Result.fail(2, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | |
| | | package com.ycl.jxkg.controller.student; |
| | | |
| | | import com.ycl.jxkg.base.BaseApiController; |
| | | import com.ycl.jxkg.base.RestResponse; |
| | | import com.ycl.jxkg.base.Result; |
| | | import com.ycl.jxkg.domain.Message; |
| | | import com.ycl.jxkg.domain.MessageUser; |
| | | import com.ycl.jxkg.domain.User; |
| | |
| | | import com.ycl.jxkg.service.MessageService; |
| | | import com.ycl.jxkg.service.UserEventLogService; |
| | | import com.ycl.jxkg.service.UserService; |
| | | import com.ycl.jxkg.utility.DateTimeUtil; |
| | | import com.ycl.jxkg.utility.PageInfoHelper; |
| | | import com.ycl.jxkg.viewmodel.student.user.*; |
| | | import com.ycl.jxkg.utils.DateTimeUtil; |
| | | import com.ycl.jxkg.utils.PageInfoHelper; |
| | | import com.ycl.jxkg.vo.student.user.*; |
| | | import com.github.pagehelper.PageInfo; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.ApplicationEventPublisher; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | } |
| | | |
| | | @RequestMapping(value = "/current", method = RequestMethod.POST) |
| | | public RestResponse<UserResponseVM> current() { |
| | | public Result<UserResponseVO> current() { |
| | | User user = getCurrentUser(); |
| | | UserResponseVM userVm = UserResponseVM.from(user); |
| | | return RestResponse.ok(userVm); |
| | | UserResponseVO userVm = UserResponseVO.from(user); |
| | | return Result.ok(userVm); |
| | | } |
| | | |
| | | |
| | | @RequestMapping(value = "/register", method = RequestMethod.POST) |
| | | public RestResponse register(@RequestBody @Valid UserRegisterVM model) { |
| | | public Result register(@RequestBody @Valid UserRegisterVO model) { |
| | | User existUser = userService.getUserByUserName(model.getUserName()); |
| | | if (null != existUser) { |
| | | return new RestResponse<>(2, "用户已存在"); |
| | | return new Result<>(2, "用户已存在"); |
| | | } |
| | | User user = modelMapper.map(model, User.class); |
| | | User user = new User(); |
| | | BeanUtils.copyProperties(model, user); |
| | | String encodePwd = authenticationService.pwdEncode(model.getPassword()); |
| | | user.setUserUuid(UUID.randomUUID().toString()); |
| | | user.setPassword(encodePwd); |
| | |
| | | UserEventLog userEventLog = new UserEventLog(user.getId(), user.getUserName(), user.getRealName(), new Date()); |
| | | userEventLog.setContent("欢迎 " + user.getUserName() + " 注册来到学之思开源考试系统"); |
| | | eventPublisher.publishEvent(new UserEvent(userEventLog)); |
| | | return RestResponse.ok(); |
| | | return Result.ok(); |
| | | } |
| | | |
| | | |
| | | @RequestMapping(value = "/update", method = RequestMethod.POST) |
| | | public RestResponse update(@RequestBody @Valid UserUpdateVM model) { |
| | | public Result update(@RequestBody @Valid UserUpdateVO model) { |
| | | if (StringUtils.isBlank(model.getBirthDay())) { |
| | | model.setBirthDay(null); |
| | | } |
| | | User user = userService.selectById(getCurrentUser().getId()); |
| | | modelMapper.map(model, user); |
| | | BeanUtils.copyProperties(model, user); |
| | | user.setModifyTime(new Date()); |
| | | userService.updateByIdFilter(user); |
| | | UserEventLog userEventLog = new UserEventLog(user.getId(), user.getUserName(), user.getRealName(), new Date()); |
| | | userEventLog.setContent(user.getUserName() + " 更新了个人资料"); |
| | | eventPublisher.publishEvent(new UserEvent(userEventLog)); |
| | | return RestResponse.ok(); |
| | | return Result.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/log", method = RequestMethod.POST) |
| | | public RestResponse<List<UserEventLogVM>> log() { |
| | | public Result<List<UserEventLogVO>> log() { |
| | | User user = getCurrentUser(); |
| | | List<UserEventLog> userEventLogs = userEventLogService.getUserEventLogByUserId(user.getId()); |
| | | List<UserEventLogVM> userEventLogVMS = userEventLogs.stream().map(d -> { |
| | | UserEventLogVM vm = modelMapper.map(d, UserEventLogVM.class); |
| | | vm.setCreateTime(DateTimeUtil.dateFormat(d.getCreateTime())); |
| | | return vm; |
| | | List<UserEventLogVO> userEventLogVOS = userEventLogs.stream().map(d -> { |
| | | UserEventLogVO vo = new UserEventLogVO(); |
| | | BeanUtils.copyProperties(d, vo); |
| | | vo.setCreateTime(DateTimeUtil.dateFormat(d.getCreateTime())); |
| | | return vo; |
| | | }).collect(Collectors.toList()); |
| | | return RestResponse.ok(userEventLogVMS); |
| | | return Result.ok(userEventLogVOS); |
| | | } |
| | | |
| | | @RequestMapping(value = "/message/page", method = RequestMethod.POST) |
| | | public RestResponse<PageInfo<MessageResponseVM>> messagePageList(@RequestBody MessageRequestVM messageRequestVM) { |
| | | messageRequestVM.setReceiveUserId(getCurrentUser().getId()); |
| | | PageInfo<MessageUser> messageUserPageInfo = messageService.studentPage(messageRequestVM); |
| | | public Result<PageInfo<MessageResponseVO>> messagePageList(@RequestBody MessageRequestVO messageRequestVO) { |
| | | messageRequestVO.setReceiveUserId(getCurrentUser().getId()); |
| | | PageInfo<MessageUser> messageUserPageInfo = messageService.studentPage(messageRequestVO); |
| | | List<Integer> ids = messageUserPageInfo.getList().stream().map(d -> d.getMessageId()).collect(Collectors.toList()); |
| | | List<Message> messages = ids.size() != 0 ? messageService.selectMessageByIds(ids) : null; |
| | | PageInfo<MessageResponseVM> page = PageInfoHelper.copyMap(messageUserPageInfo, e -> { |
| | | MessageResponseVM vm = modelMapper.map(e, MessageResponseVM.class); |
| | | PageInfo<MessageResponseVO> page = PageInfoHelper.copyMap(messageUserPageInfo, e -> { |
| | | MessageResponseVO vo = new MessageResponseVO(); |
| | | BeanUtils.copyProperties(e, vo); |
| | | messages.stream().filter(d -> e.getMessageId().equals(d.getId())).findFirst().ifPresent(message -> { |
| | | vm.setTitle(message.getTitle()); |
| | | vm.setContent(message.getContent()); |
| | | vm.setSendUserName(message.getSendUserName()); |
| | | vo.setTitle(message.getTitle()); |
| | | vo.setContent(message.getContent()); |
| | | vo.setSendUserName(message.getSendUserName()); |
| | | }); |
| | | vm.setCreateTime(DateTimeUtil.dateFormat(e.getCreateTime())); |
| | | return vm; |
| | | vo.setCreateTime(DateTimeUtil.dateFormat(e.getCreateTime())); |
| | | return vo; |
| | | }); |
| | | return RestResponse.ok(page); |
| | | return Result.ok(page); |
| | | } |
| | | |
| | | @RequestMapping(value = "/message/unreadCount", method = RequestMethod.POST) |
| | | public RestResponse unReadCount() { |
| | | public Result unReadCount() { |
| | | Integer count = messageService.unReadCount(getCurrentUser().getId()); |
| | | return RestResponse.ok(count); |
| | | return Result.ok(count); |
| | | } |
| | | |
| | | @RequestMapping(value = "/message/read/{id}", method = RequestMethod.POST) |
| | | public RestResponse read(@PathVariable Integer id) { |
| | | public Result read(@PathVariable Integer id) { |
| | | messageService.read(id); |
| | | return RestResponse.ok(); |
| | | return Result.ok(); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.ycl.jxkg.context.WxContext; |
| | | import com.ycl.jxkg.domain.User; |
| | | import com.ycl.jxkg.domain.UserToken; |
| | | import com.ycl.jxkg.utility.ModelMapperSingle; |
| | | import org.modelmapper.ModelMapper; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | |
| | | public class BaseWXApiController { |
| | | protected final static ModelMapper modelMapper = ModelMapperSingle.Instance(); |
| | | |
| | | @Autowired |
| | | private WxContext wxContext; |
| | | |
| | |
| | | package com.ycl.jxkg.controller.wx.student; |
| | | |
| | | import com.ycl.jxkg.base.RestResponse; |
| | | import com.ycl.jxkg.configuration.property.SystemConfig; |
| | | import com.ycl.jxkg.base.Result; |
| | | import com.ycl.jxkg.config.property.SystemConfig; |
| | | import com.ycl.jxkg.controller.wx.BaseWXApiController; |
| | | import com.ycl.jxkg.domain.UserToken; |
| | | import com.ycl.jxkg.domain.enums.UserStatusEnum; |
| | | import com.ycl.jxkg.service.AuthenticationService; |
| | | import com.ycl.jxkg.service.UserService; |
| | | import com.ycl.jxkg.service.UserTokenService; |
| | | import com.ycl.jxkg.utility.WxUtil; |
| | | import com.ycl.jxkg.viewmodel.wx.student.user.BindInfo; |
| | | import com.ycl.jxkg.utils.WxUtil; |
| | | import com.ycl.jxkg.vo.wx.student.user.BindInfo; |
| | | import com.ycl.jxkg.domain.User; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | |
| | | } |
| | | |
| | | @RequestMapping(value = "/bind", method = RequestMethod.POST) |
| | | public RestResponse bind(@Valid BindInfo model) { |
| | | public Result bind(@Valid BindInfo model) { |
| | | User user = userService.getUserByUserName(model.getUserName()); |
| | | if (user == null) { |
| | | return RestResponse.fail(2, "用户名或密码错误"); |
| | | return Result.fail(2, "用户名或密码错误"); |
| | | } |
| | | boolean result = authenticationService.authUser(user, model.getUserName(), model.getPassword()); |
| | | if (!result) { |
| | | return RestResponse.fail(2, "用户名或密码错误"); |
| | | return Result.fail(2, "用户名或密码错误"); |
| | | } |
| | | UserStatusEnum userStatusEnum = UserStatusEnum.fromCode(user.getStatus()); |
| | | if (UserStatusEnum.Disable == userStatusEnum) { |
| | | return RestResponse.fail(3, "用户被禁用"); |
| | | return Result.fail(3, "用户被禁用"); |
| | | } |
| | | String code = model.getCode(); |
| | | String openid = WxUtil.getOpenId(systemConfig.getWx().getAppid(), systemConfig.getWx().getSecret(), code); |
| | | if (null == openid) { |
| | | return RestResponse.fail(4, "获取微信OpenId失败"); |
| | | return Result.fail(4, "获取微信OpenId失败"); |
| | | } |
| | | user.setWxOpenId(openid); |
| | | UserToken userToken = userTokenService.bind(user); |
| | | return RestResponse.ok(userToken.getToken()); |
| | | return Result.ok(userToken.getToken()); |
| | | } |
| | | |
| | | |
| | | @RequestMapping(value = "/checkBind", method = RequestMethod.POST) |
| | | public RestResponse checkBind(@Valid @NotBlank String code) { |
| | | public Result checkBind(@Valid @NotBlank String code) { |
| | | String openid = WxUtil.getOpenId(systemConfig.getWx().getAppid(), systemConfig.getWx().getSecret(), code); |
| | | if (null == openid) { |
| | | return RestResponse.fail(3, "获取微信OpenId失败"); |
| | | return Result.fail(3, "获取微信OpenId失败"); |
| | | } |
| | | UserToken userToken = userTokenService.checkBind(openid); |
| | | if (null != userToken) { |
| | | return RestResponse.ok(userToken.getToken()); |
| | | return Result.ok(userToken.getToken()); |
| | | } |
| | | return RestResponse.fail(2, "用户未绑定"); |
| | | return Result.fail(2, "用户未绑定"); |
| | | } |
| | | |
| | | |
| | | @RequestMapping(value = "/unBind", method = RequestMethod.POST) |
| | | public RestResponse unBind() { |
| | | public Result unBind() { |
| | | UserToken userToken = getUserToken(); |
| | | userTokenService.unBind(userToken); |
| | | return RestResponse.ok(); |
| | | return Result.ok(); |
| | | } |
| | | } |
| | |
| | | package com.ycl.jxkg.controller.wx.student; |
| | | |
| | | import com.ycl.jxkg.base.RestResponse; |
| | | import com.ycl.jxkg.base.Result; |
| | | import com.ycl.jxkg.controller.wx.BaseWXApiController; |
| | | import com.ycl.jxkg.domain.TaskExam; |
| | | import com.ycl.jxkg.domain.TaskExamCustomerAnswer; |
| | |
| | | import com.ycl.jxkg.service.TaskExamCustomerAnswerService; |
| | | import com.ycl.jxkg.service.TaskExamService; |
| | | import com.ycl.jxkg.service.TextContentService; |
| | | import com.ycl.jxkg.utility.DateTimeUtil; |
| | | import com.ycl.jxkg.utility.JsonUtil; |
| | | import com.ycl.jxkg.viewmodel.student.dashboard.*; |
| | | import com.ycl.jxkg.utils.DateTimeUtil; |
| | | import com.ycl.jxkg.utils.JsonUtil; |
| | | import com.ycl.jxkg.vo.student.dashboard.*; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | |
| | | } |
| | | |
| | | @RequestMapping(value = "/index", method = RequestMethod.POST) |
| | | public RestResponse<IndexVM> index() { |
| | | IndexVM indexVM = new IndexVM(); |
| | | public Result<IndexVO> index() { |
| | | IndexVO indexVO = new IndexVO(); |
| | | User user = getCurrentUser(); |
| | | |
| | | PaperFilter fixedPaperFilter = new PaperFilter(); |
| | | fixedPaperFilter.setGradeLevel(user.getUserLevel()); |
| | | fixedPaperFilter.setExamPaperType(ExamPaperTypeEnum.Fixed.getCode()); |
| | | indexVM.setFixedPaper(examPaperService.indexPaper(fixedPaperFilter)); |
| | | indexVO.setFixedPaper(examPaperService.indexPaper(fixedPaperFilter)); |
| | | |
| | | PaperFilter timeLimitPaperFilter = new PaperFilter(); |
| | | timeLimitPaperFilter.setDateTime(new Date()); |
| | |
| | | timeLimitPaperFilter.setExamPaperType(ExamPaperTypeEnum.TimeLimit.getCode()); |
| | | |
| | | List<PaperInfo> limitPaper = examPaperService.indexPaper(timeLimitPaperFilter); |
| | | List<PaperInfoVM> paperInfoVMS = limitPaper.stream().map(d -> { |
| | | PaperInfoVM vm = modelMapper.map(d, PaperInfoVM.class); |
| | | vm.setStartTime(DateTimeUtil.dateFormat(d.getLimitStartTime())); |
| | | vm.setEndTime(DateTimeUtil.dateFormat(d.getLimitEndTime())); |
| | | return vm; |
| | | List<PaperInfoVO> paperInfoVOS = limitPaper.stream().map(d -> { |
| | | PaperInfoVO vo = new PaperInfoVO(); |
| | | BeanUtils.copyProperties(d, vo); |
| | | vo.setStartTime(DateTimeUtil.dateFormat(d.getLimitStartTime())); |
| | | vo.setEndTime(DateTimeUtil.dateFormat(d.getLimitEndTime())); |
| | | return vo; |
| | | }).collect(Collectors.toList()); |
| | | indexVM.setTimeLimitPaper(paperInfoVMS); |
| | | return RestResponse.ok(indexVM); |
| | | indexVO.setTimeLimitPaper(paperInfoVOS); |
| | | return Result.ok(indexVO); |
| | | } |
| | | |
| | | @RequestMapping(value = "/task", method = RequestMethod.POST) |
| | | public RestResponse<List<TaskItemVm>> task() { |
| | | public Result<List<TaskItemVO>> task() { |
| | | User user = getCurrentUser(); |
| | | List<TaskExam> taskExams = taskExamService.getByGradeLevel(user.getUserLevel()); |
| | | if (taskExams.size() == 0) { |
| | | return RestResponse.ok(new ArrayList<>()); |
| | | return Result.ok(new ArrayList<>()); |
| | | } |
| | | List<Integer> tIds = taskExams.stream().map(taskExam -> taskExam.getId()).collect(Collectors.toList()); |
| | | List<TaskExamCustomerAnswer> taskExamCustomerAnswers = taskExamCustomerAnswerService.selectByTUid(tIds, user.getId()); |
| | | List<TaskItemVm> vm = taskExams.stream().map(t -> { |
| | | TaskItemVm itemVm = new TaskItemVm(); |
| | | List<TaskItemVO> vm = taskExams.stream().map(t -> { |
| | | TaskItemVO itemVm = new TaskItemVO(); |
| | | itemVm.setId(t.getId()); |
| | | itemVm.setTitle(t.getTitle()); |
| | | TaskExamCustomerAnswer taskExamCustomerAnswer = taskExamCustomerAnswers.stream() |
| | | .filter(tc -> tc.getTaskExamId().equals(t.getId())).findFirst().orElse(null); |
| | | List<TaskItemPaperVm> paperItemVMS = getTaskItemPaperVm(t.getFrameTextContentId(), taskExamCustomerAnswer); |
| | | List<TaskItemPaperVO> paperItemVMS = getTaskItemPaperVm(t.getFrameTextContentId(), taskExamCustomerAnswer); |
| | | itemVm.setPaperItems(paperItemVMS); |
| | | return itemVm; |
| | | }).collect(Collectors.toList()); |
| | | return RestResponse.ok(vm); |
| | | return Result.ok(vm); |
| | | } |
| | | |
| | | |
| | | private List<TaskItemPaperVm> getTaskItemPaperVm(Integer tFrameId, TaskExamCustomerAnswer taskExamCustomerAnswers) { |
| | | private List<TaskItemPaperVO> getTaskItemPaperVm(Integer tFrameId, TaskExamCustomerAnswer taskExamCustomerAnswers) { |
| | | TextContent textContent = textContentService.selectById(tFrameId); |
| | | List<TaskItemObject> paperItems = JsonUtil.toJsonListObject(textContent.getContent(), TaskItemObject.class); |
| | | |
| | |
| | | |
| | | List<TaskItemAnswerObject> finalAnswerPaperItems = answerPaperItems; |
| | | return paperItems.stream().map(p -> { |
| | | TaskItemPaperVm ivm = new TaskItemPaperVm(); |
| | | TaskItemPaperVO ivm = new TaskItemPaperVO(); |
| | | ivm.setExamPaperId(p.getExamPaperId()); |
| | | ivm.setExamPaperName(p.getExamPaperName()); |
| | | if (null != finalAnswerPaperItems) { |
| | |
| | | package com.ycl.jxkg.controller.wx.student; |
| | | |
| | | import com.ycl.jxkg.base.RestResponse; |
| | | import com.ycl.jxkg.base.Result; |
| | | import com.ycl.jxkg.controller.wx.BaseWXApiController; |
| | | import com.ycl.jxkg.domain.*; |
| | | import com.ycl.jxkg.domain.enums.QuestionTypeEnum; |
| | |
| | | import com.ycl.jxkg.service.ExamPaperAnswerService; |
| | | import com.ycl.jxkg.service.ExamPaperService; |
| | | import com.ycl.jxkg.service.SubjectService; |
| | | import com.ycl.jxkg.utility.DateTimeUtil; |
| | | import com.ycl.jxkg.utility.ExamUtil; |
| | | import com.ycl.jxkg.utility.PageInfoHelper; |
| | | import com.ycl.jxkg.viewmodel.admin.exam.ExamPaperEditRequestVM; |
| | | import com.ycl.jxkg.viewmodel.student.exampaper.ExamPaperAnswerPageResponseVM; |
| | | import com.ycl.jxkg.viewmodel.student.exampaper.ExamPaperAnswerPageVM; |
| | | import com.ycl.jxkg.utils.DateTimeUtil; |
| | | import com.ycl.jxkg.utils.ExamUtil; |
| | | import com.ycl.jxkg.utils.PageInfoHelper; |
| | | import com.ycl.jxkg.vo.admin.exam.ExamPaperEditRequestVO; |
| | | import com.ycl.jxkg.vo.student.exampaper.ExamPaperAnswerPageResponseVO; |
| | | import com.ycl.jxkg.vo.student.exampaper.ExamPaperAnswerPageVO; |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.ycl.jxkg.viewmodel.student.exam.ExamPaperReadVM; |
| | | import com.ycl.jxkg.viewmodel.student.exam.ExamPaperSubmitItemVM; |
| | | import com.ycl.jxkg.viewmodel.student.exam.ExamPaperSubmitVM; |
| | | import com.ycl.jxkg.vo.student.exam.ExamPaperReadVO; |
| | | import com.ycl.jxkg.vo.student.exam.ExamPaperSubmitItemVO; |
| | | import com.ycl.jxkg.vo.student.exam.ExamPaperSubmitVO; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.ApplicationEventPublisher; |
| | | import org.springframework.stereotype.Controller; |
| | |
| | | } |
| | | |
| | | @RequestMapping(value = "/pageList", method = RequestMethod.POST) |
| | | public RestResponse<PageInfo<ExamPaperAnswerPageResponseVM>> pageList(@Valid ExamPaperAnswerPageVM model) { |
| | | public Result<PageInfo<ExamPaperAnswerPageResponseVO>> pageList(@Valid ExamPaperAnswerPageVO model) { |
| | | model.setCreateUser(getCurrentUser().getId()); |
| | | PageInfo<ExamPaperAnswer> pageInfo = examPaperAnswerService.studentPage(model); |
| | | PageInfo<ExamPaperAnswerPageResponseVM> page = PageInfoHelper.copyMap(pageInfo, e -> { |
| | | ExamPaperAnswerPageResponseVM vm = modelMapper.map(e, ExamPaperAnswerPageResponseVM.class); |
| | | Subject subject = subjectService.selectById(vm.getSubjectId()); |
| | | vm.setDoTime(ExamUtil.secondToVM(e.getDoTime())); |
| | | vm.setSystemScore(ExamUtil.scoreToVM(e.getSystemScore())); |
| | | vm.setUserScore(ExamUtil.scoreToVM(e.getUserScore())); |
| | | vm.setPaperScore(ExamUtil.scoreToVM(e.getPaperScore())); |
| | | vm.setSubjectName(subject.getName()); |
| | | vm.setCreateTime(DateTimeUtil.dateFormat(e.getCreateTime())); |
| | | return vm; |
| | | PageInfo<ExamPaperAnswerPageResponseVO> page = PageInfoHelper.copyMap(pageInfo, e -> { |
| | | ExamPaperAnswerPageResponseVO vo = new ExamPaperAnswerPageResponseVO(); |
| | | BeanUtils.copyProperties(e, vo); |
| | | Subject subject = subjectService.selectById(vo.getSubjectId()); |
| | | vo.setDoTime(ExamUtil.secondToVM(e.getDoTime())); |
| | | vo.setSystemScore(ExamUtil.scoreToVM(e.getSystemScore())); |
| | | vo.setUserScore(ExamUtil.scoreToVM(e.getUserScore())); |
| | | vo.setPaperScore(ExamUtil.scoreToVM(e.getPaperScore())); |
| | | vo.setSubjectName(subject.getName()); |
| | | vo.setCreateTime(DateTimeUtil.dateFormat(e.getCreateTime())); |
| | | return vo; |
| | | }); |
| | | return RestResponse.ok(page); |
| | | return Result.ok(page); |
| | | } |
| | | |
| | | |
| | | @RequestMapping(value = "/answerSubmit", method = RequestMethod.POST) |
| | | public RestResponse answerSubmit(HttpServletRequest request) { |
| | | ExamPaperSubmitVM examPaperSubmitVM = requestToExamPaperSubmitVM(request); |
| | | public Result answerSubmit(HttpServletRequest request) { |
| | | ExamPaperSubmitVO examPaperSubmitVO = requestToExamPaperSubmitVM(request); |
| | | User user = getCurrentUser(); |
| | | ExamPaperAnswerInfo examPaperAnswerInfo = examPaperAnswerService.calculateExamPaperAnswer(examPaperSubmitVM, user); |
| | | ExamPaperAnswerInfo examPaperAnswerInfo = examPaperAnswerService.calculateExamPaperAnswer(examPaperSubmitVO, user); |
| | | if (null == examPaperAnswerInfo) { |
| | | return RestResponse.fail(2, "试卷不能重复做"); |
| | | return Result.fail(2, "试卷不能重复做"); |
| | | } |
| | | ExamPaperAnswer examPaperAnswer = examPaperAnswerInfo.getExamPaperAnswer(); |
| | | Integer userScore = examPaperAnswer.getUserScore(); |
| | |
| | | userEventLog.setContent(content); |
| | | eventPublisher.publishEvent(new CalculateExamPaperAnswerCompleteEvent(examPaperAnswerInfo)); |
| | | eventPublisher.publishEvent(new UserEvent(userEventLog)); |
| | | return RestResponse.ok(scoreVm); |
| | | return Result.ok(scoreVm); |
| | | } |
| | | |
| | | private ExamPaperSubmitVM requestToExamPaperSubmitVM(HttpServletRequest request) { |
| | | ExamPaperSubmitVM examPaperSubmitVM = new ExamPaperSubmitVM(); |
| | | examPaperSubmitVM.setId(Integer.parseInt(request.getParameter("id"))); |
| | | examPaperSubmitVM.setDoTime(Integer.parseInt(request.getParameter("doTime"))); |
| | | private ExamPaperSubmitVO requestToExamPaperSubmitVM(HttpServletRequest request) { |
| | | ExamPaperSubmitVO examPaperSubmitVO = new ExamPaperSubmitVO(); |
| | | examPaperSubmitVO.setId(Integer.parseInt(request.getParameter("id"))); |
| | | examPaperSubmitVO.setDoTime(Integer.parseInt(request.getParameter("doTime"))); |
| | | List<String> parameterNames = Collections.list(request.getParameterNames()).stream() |
| | | .filter(n -> n.contains("_")) |
| | | .collect(Collectors.toList()); |
| | | //题目答案按序号分组 |
| | | Map<String, List<String>> questionGroup = parameterNames.stream().collect(Collectors.groupingBy(p -> p.substring(0, p.indexOf("_")))); |
| | | List<ExamPaperSubmitItemVM> answerItems = new ArrayList<>(); |
| | | List<ExamPaperSubmitItemVO> answerItems = new ArrayList<>(); |
| | | questionGroup.forEach((k, v) -> { |
| | | ExamPaperSubmitItemVM examPaperSubmitItemVM = new ExamPaperSubmitItemVM(); |
| | | ExamPaperSubmitItemVO examPaperSubmitItemVO = new ExamPaperSubmitItemVO(); |
| | | String p = v.get(0); |
| | | String[] keys = p.split("_"); |
| | | examPaperSubmitItemVM.setQuestionId(Integer.parseInt(keys[1])); |
| | | examPaperSubmitItemVM.setItemOrder(Integer.parseInt(keys[0])); |
| | | examPaperSubmitItemVO.setQuestionId(Integer.parseInt(keys[1])); |
| | | examPaperSubmitItemVO.setItemOrder(Integer.parseInt(keys[0])); |
| | | QuestionTypeEnum typeEnum = QuestionTypeEnum.fromCode(Integer.parseInt(keys[2])); |
| | | if (v.size() == 1) { |
| | | String content = request.getParameter(p); |
| | | examPaperSubmitItemVM.setContent(content); |
| | | examPaperSubmitItemVO.setContent(content); |
| | | if (typeEnum == QuestionTypeEnum.MultipleChoice) { |
| | | examPaperSubmitItemVM.setContentArray(Arrays.asList(content.split(","))); |
| | | examPaperSubmitItemVO.setContentArray(Arrays.asList(content.split(","))); |
| | | } |
| | | } else { //多个空 填空题 |
| | | List<String> answers = v.stream().sorted(Comparator.comparingInt(ExamUtil::lastNum)).map(inputKey -> request.getParameter(inputKey)).collect(Collectors.toList()); |
| | | examPaperSubmitItemVM.setContentArray(answers); |
| | | examPaperSubmitItemVO.setContentArray(answers); |
| | | } |
| | | answerItems.add(examPaperSubmitItemVM); |
| | | answerItems.add(examPaperSubmitItemVO); |
| | | }); |
| | | examPaperSubmitVM.setAnswerItems(answerItems); |
| | | return examPaperSubmitVM; |
| | | examPaperSubmitVO.setAnswerItems(answerItems); |
| | | return examPaperSubmitVO; |
| | | } |
| | | |
| | | |
| | | @PostMapping(value = "/read/{id}") |
| | | public RestResponse<ExamPaperReadVM> read(@PathVariable Integer id) { |
| | | ExamPaperReadVM vm = new ExamPaperReadVM(); |
| | | public Result<ExamPaperReadVO> read(@PathVariable Integer id) { |
| | | ExamPaperReadVO vm = new ExamPaperReadVO(); |
| | | ExamPaperAnswer examPaperAnswer = examPaperAnswerService.selectById(id); |
| | | ExamPaperEditRequestVM paper = examPaperService.examPaperToVM(examPaperAnswer.getExamPaperId()); |
| | | ExamPaperSubmitVM answer = examPaperAnswerService.examPaperAnswerToVM(examPaperAnswer.getId()); |
| | | ExamPaperEditRequestVO paper = examPaperService.examPaperToVM(examPaperAnswer.getExamPaperId()); |
| | | ExamPaperSubmitVO answer = examPaperAnswerService.examPaperAnswerToVM(examPaperAnswer.getId()); |
| | | vm.setPaper(paper); |
| | | vm.setAnswer(answer); |
| | | return RestResponse.ok(vm); |
| | | return Result.ok(vm); |
| | | } |
| | | } |
| | |
| | | package com.ycl.jxkg.controller.wx.student; |
| | | |
| | | import com.ycl.jxkg.base.RestResponse; |
| | | import com.ycl.jxkg.base.Result; |
| | | import com.ycl.jxkg.controller.wx.BaseWXApiController; |
| | | import com.ycl.jxkg.domain.ExamPaper; |
| | | import com.ycl.jxkg.domain.Subject; |
| | | import com.ycl.jxkg.service.ExamPaperService; |
| | | import com.ycl.jxkg.service.SubjectService; |
| | | import com.ycl.jxkg.utility.DateTimeUtil; |
| | | import com.ycl.jxkg.utility.PageInfoHelper; |
| | | import com.ycl.jxkg.viewmodel.admin.exam.ExamPaperEditRequestVM; |
| | | import com.ycl.jxkg.viewmodel.student.exam.ExamPaperPageResponseVM; |
| | | import com.ycl.jxkg.viewmodel.student.exam.ExamPaperPageVM; |
| | | import com.ycl.jxkg.utils.DateTimeUtil; |
| | | import com.ycl.jxkg.utils.PageInfoHelper; |
| | | import com.ycl.jxkg.vo.admin.exam.ExamPaperEditRequestVO; |
| | | import com.ycl.jxkg.vo.student.exam.ExamPaperPageResponseVO; |
| | | import com.ycl.jxkg.vo.student.exam.ExamPaperPageVO; |
| | | import com.github.pagehelper.PageInfo; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | |
| | | |
| | | @RequestMapping(value = "/select/{id}", method = RequestMethod.POST) |
| | | public RestResponse<ExamPaperEditRequestVM> select(@PathVariable Integer id) { |
| | | ExamPaperEditRequestVM vm = examPaperService.examPaperToVM(id); |
| | | return RestResponse.ok(vm); |
| | | public Result<ExamPaperEditRequestVO> select(@PathVariable Integer id) { |
| | | ExamPaperEditRequestVO vm = examPaperService.examPaperToVM(id); |
| | | return Result.ok(vm); |
| | | } |
| | | |
| | | |
| | | @RequestMapping(value = "/pageList", method = RequestMethod.POST) |
| | | public RestResponse<PageInfo<ExamPaperPageResponseVM>> pageList(@Valid ExamPaperPageVM model) { |
| | | public Result<PageInfo<ExamPaperPageResponseVO>> pageList(@Valid ExamPaperPageVO model) { |
| | | model.setLevelId(getCurrentUser().getUserLevel()); |
| | | PageInfo<ExamPaper> pageInfo = examPaperService.studentPage(model); |
| | | PageInfo<ExamPaperPageResponseVM> page = PageInfoHelper.copyMap(pageInfo, e -> { |
| | | ExamPaperPageResponseVM vm = modelMapper.map(e, ExamPaperPageResponseVM.class); |
| | | Subject subject = subjectService.selectById(vm.getSubjectId()); |
| | | vm.setSubjectName(subject.getName()); |
| | | vm.setCreateTime(DateTimeUtil.dateFormat(e.getCreateTime())); |
| | | return vm; |
| | | PageInfo<ExamPaperPageResponseVO> page = PageInfoHelper.copyMap(pageInfo, e -> { |
| | | ExamPaperPageResponseVO vo = new ExamPaperPageResponseVO(); |
| | | BeanUtils.copyProperties(e, vo); |
| | | Subject subject = subjectService.selectById(vo.getSubjectId()); |
| | | vo.setSubjectName(subject.getName()); |
| | | vo.setCreateTime(DateTimeUtil.dateFormat(e.getCreateTime())); |
| | | return vo; |
| | | }); |
| | | return RestResponse.ok(page); |
| | | return Result.ok(page); |
| | | } |
| | | } |
| | |
| | | package com.ycl.jxkg.controller.wx.student; |
| | | |
| | | import com.ycl.jxkg.base.RestResponse; |
| | | import com.ycl.jxkg.base.Result; |
| | | import com.ycl.jxkg.controller.wx.BaseWXApiController; |
| | | import com.ycl.jxkg.domain.Message; |
| | | import com.ycl.jxkg.domain.MessageUser; |
| | |
| | | import com.ycl.jxkg.service.MessageService; |
| | | import com.ycl.jxkg.service.UserEventLogService; |
| | | import com.ycl.jxkg.service.UserService; |
| | | import com.ycl.jxkg.utility.DateTimeUtil; |
| | | import com.ycl.jxkg.utility.PageInfoHelper; |
| | | import com.ycl.jxkg.viewmodel.student.user.*; |
| | | import com.ycl.jxkg.utils.DateTimeUtil; |
| | | import com.ycl.jxkg.utils.PageInfoHelper; |
| | | import com.ycl.jxkg.vo.student.user.*; |
| | | import com.github.pagehelper.PageInfo; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.ApplicationEventPublisher; |
| | | import org.springframework.stereotype.Controller; |
| | |
| | | } |
| | | |
| | | @RequestMapping(value = "/current", method = RequestMethod.POST) |
| | | public RestResponse<UserResponseVM> current() { |
| | | public Result<UserResponseVO> current() { |
| | | User user = getCurrentUser(); |
| | | UserResponseVM userVm = UserResponseVM.from(user); |
| | | UserResponseVO userVm = UserResponseVO.from(user); |
| | | userVm.setBirthDay(DateTimeUtil.dateShortFormat(user.getBirthDay())); |
| | | return RestResponse.ok(userVm); |
| | | return Result.ok(userVm); |
| | | } |
| | | |
| | | @RequestMapping(value = "/register", method = RequestMethod.POST) |
| | | public RestResponse register(@Valid UserRegisterVM model) { |
| | | public Result register(@Valid UserRegisterVO model) { |
| | | User existUser = userService.getUserByUserName(model.getUserName()); |
| | | if (null != existUser) { |
| | | return new RestResponse<>(2, "用户已存在"); |
| | | return new Result<>(2, "用户已存在"); |
| | | } |
| | | User user = modelMapper.map(model, User.class); |
| | | User user = new User(); |
| | | BeanUtils.copyProperties(model, user); |
| | | String encodePwd = authenticationService.pwdEncode(model.getPassword()); |
| | | user.setUserUuid(UUID.randomUUID().toString()); |
| | | user.setPassword(encodePwd); |
| | |
| | | UserEventLog userEventLog = new UserEventLog(user.getId(), user.getUserName(), user.getRealName(), new Date()); |
| | | userEventLog.setContent("欢迎 " + user.getUserName() + " 注册来到学之思开源考试系统"); |
| | | eventPublisher.publishEvent(new UserEvent(userEventLog)); |
| | | return RestResponse.ok(); |
| | | return Result.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/update", method = RequestMethod.POST) |
| | | public RestResponse<UserResponseVM> update(@Valid UserUpdateVM model) { |
| | | public Result<UserResponseVO> update(@Valid UserUpdateVO model) { |
| | | if (StringUtils.isBlank(model.getBirthDay())) { |
| | | model.setBirthDay(null); |
| | | } |
| | | User user = userService.selectById(getCurrentUser().getId()); |
| | | modelMapper.map(model, user); |
| | | BeanUtils.copyProperties(model, user); |
| | | user.setModifyTime(new Date()); |
| | | userService.updateByIdFilter(user); |
| | | UserEventLog userEventLog = new UserEventLog(user.getId(), user.getUserName(), user.getRealName(), new Date()); |
| | | userEventLog.setContent(user.getUserName() + " 更新了个人资料"); |
| | | eventPublisher.publishEvent(new UserEvent(userEventLog)); |
| | | UserResponseVM userVm = UserResponseVM.from(user); |
| | | return RestResponse.ok(userVm); |
| | | UserResponseVO userVm = UserResponseVO.from(user); |
| | | return Result.ok(userVm); |
| | | } |
| | | |
| | | @RequestMapping(value = "/log", method = RequestMethod.POST) |
| | | public RestResponse<List<UserEventLogVM>> log() { |
| | | public Result<List<UserEventLogVO>> log() { |
| | | User user = getCurrentUser(); |
| | | List<UserEventLog> userEventLogs = userEventLogService.getUserEventLogByUserId(user.getId()); |
| | | List<UserEventLogVM> userEventLogVMS = userEventLogs.stream().map(d -> { |
| | | UserEventLogVM vm = modelMapper.map(d, UserEventLogVM.class); |
| | | vm.setCreateTime(DateTimeUtil.dateFormat(d.getCreateTime())); |
| | | return vm; |
| | | List<UserEventLogVO> userEventLogVOS = userEventLogs.stream().map(d -> { |
| | | UserEventLogVO vo = new UserEventLogVO(); |
| | | BeanUtils.copyProperties(d, vo); |
| | | vo.setCreateTime(DateTimeUtil.dateFormat(d.getCreateTime())); |
| | | return vo; |
| | | }).collect(Collectors.toList()); |
| | | return RestResponse.ok(userEventLogVMS); |
| | | return Result.ok(userEventLogVOS); |
| | | } |
| | | |
| | | @RequestMapping(value = "/message/page", method = RequestMethod.POST) |
| | | public RestResponse<PageInfo<MessageResponseVM>> messagePageList(MessageRequestVM messageRequestVM) { |
| | | messageRequestVM.setReceiveUserId(getCurrentUser().getId()); |
| | | PageInfo<MessageUser> messageUserPageInfo = messageService.studentPage(messageRequestVM); |
| | | public Result<PageInfo<MessageResponseVO>> messagePageList(MessageRequestVO messageRequestVO) { |
| | | messageRequestVO.setReceiveUserId(getCurrentUser().getId()); |
| | | PageInfo<MessageUser> messageUserPageInfo = messageService.studentPage(messageRequestVO); |
| | | List<Integer> ids = messageUserPageInfo.getList().stream().map(d -> d.getMessageId()).collect(Collectors.toList()); |
| | | List<Message> messages = ids.size() != 0 ? messageService.selectMessageByIds(ids) : null; |
| | | PageInfo<MessageResponseVM> page = PageInfoHelper.copyMap(messageUserPageInfo, e -> { |
| | | MessageResponseVM vm = modelMapper.map(e, MessageResponseVM.class); |
| | | PageInfo<MessageResponseVO> page = PageInfoHelper.copyMap(messageUserPageInfo, e -> { |
| | | MessageResponseVO vo = new MessageResponseVO(); |
| | | BeanUtils.copyProperties(e, vo); |
| | | messages.stream().filter(d -> e.getMessageId().equals(d.getId())).findFirst().ifPresent(message -> { |
| | | vm.setTitle(message.getTitle()); |
| | | vm.setContent(message.getContent()); |
| | | vm.setSendUserName(message.getSendUserName()); |
| | | vo.setTitle(message.getTitle()); |
| | | vo.setContent(message.getContent()); |
| | | vo.setSendUserName(message.getSendUserName()); |
| | | }); |
| | | vm.setCreateTime(DateTimeUtil.dateFormat(e.getCreateTime())); |
| | | return vm; |
| | | vo.setCreateTime(DateTimeUtil.dateFormat(e.getCreateTime())); |
| | | return vo; |
| | | }); |
| | | return RestResponse.ok(page); |
| | | return Result.ok(page); |
| | | } |
| | | |
| | | @RequestMapping(value = "/message/detail/{id}", method = RequestMethod.POST) |
| | | public RestResponse messageDetail(@PathVariable Integer id) { |
| | | public Result messageDetail(@PathVariable Integer id) { |
| | | Message message = messageService.messageDetail(id); |
| | | return RestResponse.ok(message); |
| | | return Result.ok(message); |
| | | } |
| | | |
| | | |
| | | @RequestMapping(value = "/message/unreadCount", method = RequestMethod.POST) |
| | | public RestResponse unReadCount() { |
| | | public Result unReadCount() { |
| | | Integer count = messageService.unReadCount(getCurrentUser().getId()); |
| | | return RestResponse.ok(count); |
| | | return Result.ok(count); |
| | | } |
| | | |
| | | @RequestMapping(value = "/message/read/{id}", method = RequestMethod.POST) |
| | | public RestResponse read(@PathVariable Integer id) { |
| | | public Result read(@PathVariable Integer id) { |
| | | messageService.read(id); |
| | | return RestResponse.ok(); |
| | | return Result.ok(); |
| | | } |
| | | |
| | | } |
| | |
| | | package com.ycl.jxkg.domain; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | public class ExamPaper implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 8509645224550501395L; |
| | |
| | | |
| | | private Integer taskExamId; |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name == null ? null : name.trim(); |
| | | } |
| | | |
| | | public Integer getSubjectId() { |
| | | return subjectId; |
| | | } |
| | | |
| | | public void setSubjectId(Integer subjectId) { |
| | | this.subjectId = subjectId; |
| | | } |
| | | |
| | | public Integer getPaperType() { |
| | | return paperType; |
| | | } |
| | | |
| | | public void setPaperType(Integer paperType) { |
| | | this.paperType = paperType; |
| | | } |
| | | |
| | | public Integer getGradeLevel() { |
| | | return gradeLevel; |
| | | } |
| | | |
| | | public void setGradeLevel(Integer gradeLevel) { |
| | | this.gradeLevel = gradeLevel; |
| | | } |
| | | |
| | | public Integer getScore() { |
| | | return score; |
| | | } |
| | | |
| | | public void setScore(Integer score) { |
| | | this.score = score; |
| | | } |
| | | |
| | | public Integer getQuestionCount() { |
| | | return questionCount; |
| | | } |
| | | |
| | | public void setQuestionCount(Integer questionCount) { |
| | | this.questionCount = questionCount; |
| | | } |
| | | |
| | | public Integer getSuggestTime() { |
| | | return suggestTime; |
| | | } |
| | | |
| | | public void setSuggestTime(Integer suggestTime) { |
| | | this.suggestTime = suggestTime; |
| | | } |
| | | |
| | | public Date getLimitStartTime() { |
| | | return limitStartTime; |
| | | } |
| | | |
| | | public void setLimitStartTime(Date limitStartTime) { |
| | | this.limitStartTime = limitStartTime; |
| | | } |
| | | |
| | | public Date getLimitEndTime() { |
| | | return limitEndTime; |
| | | } |
| | | |
| | | public void setLimitEndTime(Date limitEndTime) { |
| | | this.limitEndTime = limitEndTime; |
| | | } |
| | | |
| | | public Integer getFrameTextContentId() { |
| | | return frameTextContentId; |
| | | } |
| | | |
| | | public void setFrameTextContentId(Integer frameTextContentId) { |
| | | this.frameTextContentId = frameTextContentId; |
| | | } |
| | | |
| | | public Integer getCreateUser() { |
| | | return createUser; |
| | | } |
| | | |
| | | public void setCreateUser(Integer createUser) { |
| | | this.createUser = createUser; |
| | | } |
| | | |
| | | public Date getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(Date createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public Boolean getDeleted() { |
| | | return deleted; |
| | | } |
| | | |
| | | public void setDeleted(Boolean deleted) { |
| | | this.deleted = deleted; |
| | | } |
| | | |
| | | public Integer getTaskExamId() { |
| | | return taskExamId; |
| | | } |
| | | |
| | | public void setTaskExamId(Integer taskExamId) { |
| | | this.taskExamId = taskExamId; |
| | | } |
| | | } |
| | |
| | | package com.ycl.jxkg.domain; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | public class ExamPaperAnswer implements Serializable { |
| | | |
| | | private static final long serialVersionUID = -2143539181805283910L; |
| | |
| | | |
| | | private Integer taskExamId; |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Integer getExamPaperId() { |
| | | return examPaperId; |
| | | } |
| | | |
| | | public void setExamPaperId(Integer examPaperId) { |
| | | this.examPaperId = examPaperId; |
| | | } |
| | | |
| | | public String getPaperName() { |
| | | return paperName; |
| | | } |
| | | |
| | | public void setPaperName(String paperName) { |
| | | this.paperName = paperName == null ? null : paperName.trim(); |
| | | } |
| | | |
| | | public Integer getPaperType() { |
| | | return paperType; |
| | | } |
| | | |
| | | public void setPaperType(Integer paperType) { |
| | | this.paperType = paperType; |
| | | } |
| | | |
| | | public Integer getSubjectId() { |
| | | return subjectId; |
| | | } |
| | | |
| | | public void setSubjectId(Integer subjectId) { |
| | | this.subjectId = subjectId; |
| | | } |
| | | |
| | | public Integer getSystemScore() { |
| | | return systemScore; |
| | | } |
| | | |
| | | public void setSystemScore(Integer systemScore) { |
| | | this.systemScore = systemScore; |
| | | } |
| | | |
| | | public Integer getUserScore() { |
| | | return userScore; |
| | | } |
| | | |
| | | public void setUserScore(Integer userScore) { |
| | | this.userScore = userScore; |
| | | } |
| | | |
| | | public Integer getPaperScore() { |
| | | return paperScore; |
| | | } |
| | | |
| | | public void setPaperScore(Integer paperScore) { |
| | | this.paperScore = paperScore; |
| | | } |
| | | |
| | | public Integer getQuestionCorrect() { |
| | | return questionCorrect; |
| | | } |
| | | |
| | | public void setQuestionCorrect(Integer questionCorrect) { |
| | | this.questionCorrect = questionCorrect; |
| | | } |
| | | |
| | | public Integer getQuestionCount() { |
| | | return questionCount; |
| | | } |
| | | |
| | | public void setQuestionCount(Integer questionCount) { |
| | | this.questionCount = questionCount; |
| | | } |
| | | |
| | | public Integer getDoTime() { |
| | | return doTime; |
| | | } |
| | | |
| | | public void setDoTime(Integer doTime) { |
| | | this.doTime = doTime; |
| | | } |
| | | |
| | | public Integer getStatus() { |
| | | return status; |
| | | } |
| | | |
| | | public void setStatus(Integer status) { |
| | | this.status = status; |
| | | } |
| | | |
| | | public Integer getCreateUser() { |
| | | return createUser; |
| | | } |
| | | |
| | | public void setCreateUser(Integer createUser) { |
| | | this.createUser = createUser; |
| | | } |
| | | |
| | | public Date getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(Date createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public Integer getTaskExamId() { |
| | | return taskExamId; |
| | | } |
| | | |
| | | public void setTaskExamId(Integer taskExamId) { |
| | | this.taskExamId = taskExamId; |
| | | } |
| | | } |
| | |
| | | package com.ycl.jxkg.domain; |
| | | |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class ExamPaperAnswerInfo { |
| | | |
| | | public ExamPaper examPaper; |
| | | |
| | | public ExamPaperAnswer examPaperAnswer; |
| | | |
| | | public List<ExamPaperQuestionCustomerAnswer> examPaperQuestionCustomerAnswers; |
| | | |
| | | public ExamPaper getExamPaper() { |
| | | return examPaper; |
| | | } |
| | | |
| | | public void setExamPaper(ExamPaper examPaper) { |
| | | this.examPaper = examPaper; |
| | | } |
| | | |
| | | public ExamPaperAnswer getExamPaperAnswer() { |
| | | return examPaperAnswer; |
| | | } |
| | | |
| | | public void setExamPaperAnswer(ExamPaperAnswer examPaperAnswer) { |
| | | this.examPaperAnswer = examPaperAnswer; |
| | | } |
| | | |
| | | public List<ExamPaperQuestionCustomerAnswer> getExamPaperQuestionCustomerAnswers() { |
| | | return examPaperQuestionCustomerAnswers; |
| | | } |
| | | |
| | | public void setExamPaperQuestionCustomerAnswers(List<ExamPaperQuestionCustomerAnswer> examPaperQuestionCustomerAnswers) { |
| | | this.examPaperQuestionCustomerAnswers = examPaperQuestionCustomerAnswers; |
| | | } |
| | | } |
| | |
| | | package com.ycl.jxkg.domain; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | public class ExamPaperQuestionCustomerAnswer implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 3389482731220342366L; |
| | |
| | | |
| | | private Integer itemOrder; |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Integer getQuestionId() { |
| | | return questionId; |
| | | } |
| | | |
| | | public void setQuestionId(Integer questionId) { |
| | | this.questionId = questionId; |
| | | } |
| | | |
| | | public Integer getExamPaperId() { |
| | | return examPaperId; |
| | | } |
| | | |
| | | public void setExamPaperId(Integer examPaperId) { |
| | | this.examPaperId = examPaperId; |
| | | } |
| | | |
| | | public Integer getExamPaperAnswerId() { |
| | | return examPaperAnswerId; |
| | | } |
| | | |
| | | public void setExamPaperAnswerId(Integer examPaperAnswerId) { |
| | | this.examPaperAnswerId = examPaperAnswerId; |
| | | } |
| | | |
| | | public Integer getQuestionType() { |
| | | return questionType; |
| | | } |
| | | |
| | | public void setQuestionType(Integer questionType) { |
| | | this.questionType = questionType; |
| | | } |
| | | |
| | | public Integer getSubjectId() { |
| | | return subjectId; |
| | | } |
| | | |
| | | public void setSubjectId(Integer subjectId) { |
| | | this.subjectId = subjectId; |
| | | } |
| | | |
| | | public Integer getCustomerScore() { |
| | | return customerScore; |
| | | } |
| | | |
| | | public void setCustomerScore(Integer customerScore) { |
| | | this.customerScore = customerScore; |
| | | } |
| | | |
| | | public Integer getQuestionScore() { |
| | | return questionScore; |
| | | } |
| | | |
| | | public void setQuestionScore(Integer questionScore) { |
| | | this.questionScore = questionScore; |
| | | } |
| | | |
| | | public Integer getQuestionTextContentId() { |
| | | return questionTextContentId; |
| | | } |
| | | |
| | | public void setQuestionTextContentId(Integer questionTextContentId) { |
| | | this.questionTextContentId = questionTextContentId; |
| | | } |
| | | |
| | | public String getAnswer() { |
| | | return answer; |
| | | } |
| | | |
| | | public void setAnswer(String answer) { |
| | | this.answer = answer == null ? null : answer.trim(); |
| | | } |
| | | |
| | | public Integer getTextContentId() { |
| | | return textContentId; |
| | | } |
| | | |
| | | public void setTextContentId(Integer textContentId) { |
| | | this.textContentId = textContentId; |
| | | } |
| | | |
| | | public Boolean getDoRight() { |
| | | return doRight; |
| | | } |
| | | |
| | | public void setDoRight(Boolean doRight) { |
| | | this.doRight = doRight; |
| | | } |
| | | |
| | | public Integer getCreateUser() { |
| | | return createUser; |
| | | } |
| | | |
| | | public void setCreateUser(Integer createUser) { |
| | | this.createUser = createUser; |
| | | } |
| | | |
| | | public Date getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(Date createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public Integer getItemOrder() { |
| | | return itemOrder; |
| | | } |
| | | |
| | | public void setItemOrder(Integer itemOrder) { |
| | | this.itemOrder = itemOrder; |
| | | } |
| | | } |
| | |
| | | package com.ycl.jxkg.domain; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | public class Message implements Serializable { |
| | | |
| | | private static final long serialVersionUID = -3510265139403747341L; |
| | |
| | | */ |
| | | private Integer readCount; |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getTitle() { |
| | | return title; |
| | | } |
| | | |
| | | public void setTitle(String title) { |
| | | this.title = title == null ? null : title.trim(); |
| | | } |
| | | |
| | | public String getContent() { |
| | | return content; |
| | | } |
| | | |
| | | public void setContent(String content) { |
| | | this.content = content == null ? null : content.trim(); |
| | | } |
| | | |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") |
| | | public Date getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(Date createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public Integer getSendUserId() { |
| | | return sendUserId; |
| | | } |
| | | |
| | | public void setSendUserId(Integer sendUserId) { |
| | | this.sendUserId = sendUserId; |
| | | } |
| | | |
| | | public String getSendUserName() { |
| | | return sendUserName; |
| | | } |
| | | |
| | | public void setSendUserName(String sendUserName) { |
| | | this.sendUserName = sendUserName == null ? null : sendUserName.trim(); |
| | | } |
| | | |
| | | public String getSendRealName() { |
| | | return sendRealName; |
| | | } |
| | | |
| | | public void setSendRealName(String sendRealName) { |
| | | this.sendRealName = sendRealName == null ? null : sendRealName.trim(); |
| | | } |
| | | |
| | | public Integer getReceiveUserCount() { |
| | | return receiveUserCount; |
| | | } |
| | | |
| | | public void setReceiveUserCount(Integer receiveUserCount) { |
| | | this.receiveUserCount = receiveUserCount; |
| | | } |
| | | |
| | | public Integer getReadCount() { |
| | | return readCount; |
| | | } |
| | | |
| | | public void setReadCount(Integer readCount) { |
| | | this.readCount = readCount; |
| | | } |
| | | } |
| | |
| | | package com.ycl.jxkg.domain; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | public class MessageUser implements Serializable { |
| | | |
| | | private static final long serialVersionUID = -4042932811802896498L; |
| | |
| | | */ |
| | | private Date readTime; |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Integer getMessageId() { |
| | | return messageId; |
| | | } |
| | | |
| | | public void setMessageId(Integer messageId) { |
| | | this.messageId = messageId; |
| | | } |
| | | |
| | | public Integer getReceiveUserId() { |
| | | return receiveUserId; |
| | | } |
| | | |
| | | public void setReceiveUserId(Integer receiveUserId) { |
| | | this.receiveUserId = receiveUserId; |
| | | } |
| | | |
| | | public String getReceiveUserName() { |
| | | return receiveUserName; |
| | | } |
| | | |
| | | public void setReceiveUserName(String receiveUserName) { |
| | | this.receiveUserName = receiveUserName == null ? null : receiveUserName.trim(); |
| | | } |
| | | |
| | | public String getReceiveRealName() { |
| | | return receiveRealName; |
| | | } |
| | | |
| | | public void setReceiveRealName(String receiveRealName) { |
| | | this.receiveRealName = receiveRealName == null ? null : receiveRealName.trim(); |
| | | } |
| | | |
| | | public Boolean getReaded() { |
| | | return readed; |
| | | } |
| | | |
| | | public void setReaded(Boolean readed) { |
| | | this.readed = readed; |
| | | } |
| | | |
| | | public Date getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(Date createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public Date getReadTime() { |
| | | return readTime; |
| | | } |
| | | |
| | | public void setReadTime(Date readTime) { |
| | | this.readTime = readTime; |
| | | } |
| | | } |
| | |
| | | package com.ycl.jxkg.domain; |
| | | |
| | | import com.ycl.jxkg.domain.enums.QuestionTypeEnum; |
| | | import com.ycl.jxkg.utility.ExamUtil; |
| | | import com.ycl.jxkg.utils.ExamUtil; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class Question implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 8826266720383164363L; |
| | |
| | | private Date createTime; |
| | | |
| | | private Boolean deleted; |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Integer getQuestionType() { |
| | | return questionType; |
| | | } |
| | | |
| | | public void setQuestionType(Integer questionType) { |
| | | this.questionType = questionType; |
| | | } |
| | | |
| | | public Integer getSubjectId() { |
| | | return subjectId; |
| | | } |
| | | |
| | | public void setSubjectId(Integer subjectId) { |
| | | this.subjectId = subjectId; |
| | | } |
| | | |
| | | public Integer getScore() { |
| | | return score; |
| | | } |
| | | |
| | | public void setScore(Integer score) { |
| | | this.score = score; |
| | | } |
| | | |
| | | public Integer getGradeLevel() { |
| | | return gradeLevel; |
| | | } |
| | | |
| | | public void setGradeLevel(Integer gradeLevel) { |
| | | this.gradeLevel = gradeLevel; |
| | | } |
| | | |
| | | public Integer getDifficult() { |
| | | return difficult; |
| | | } |
| | | |
| | | public void setDifficult(Integer difficult) { |
| | | this.difficult = difficult; |
| | | } |
| | | |
| | | public String getCorrect() { |
| | | return correct; |
| | | } |
| | | |
| | | public void setCorrect(String correct) { |
| | | this.correct = correct == null ? null : correct.trim(); |
| | | } |
| | | |
| | | public Integer getInfoTextContentId() { |
| | | return infoTextContentId; |
| | | } |
| | | |
| | | public void setInfoTextContentId(Integer infoTextContentId) { |
| | | this.infoTextContentId = infoTextContentId; |
| | | } |
| | | |
| | | public Integer getCreateUser() { |
| | | return createUser; |
| | | } |
| | | |
| | | public void setCreateUser(Integer createUser) { |
| | | this.createUser = createUser; |
| | | } |
| | | |
| | | public Integer getStatus() { |
| | | return status; |
| | | } |
| | | |
| | | public void setStatus(Integer status) { |
| | | this.status = status; |
| | | } |
| | | |
| | | public Date getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(Date createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public Boolean getDeleted() { |
| | | return deleted; |
| | | } |
| | | |
| | | public void setDeleted(Boolean deleted) { |
| | | this.deleted = deleted; |
| | | } |
| | | |
| | | |
| | | public void setCorrectFromVM(String correct, List<String> correctArray) { |
| | |
| | | package com.ycl.jxkg.domain; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | @Data |
| | | public class Subject implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 8058095034457106501L; |
| | |
| | | |
| | | private Boolean deleted; |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name == null ? null : name.trim(); |
| | | } |
| | | |
| | | public Integer getLevel() { |
| | | return level; |
| | | } |
| | | |
| | | public void setLevel(Integer level) { |
| | | this.level = level; |
| | | } |
| | | |
| | | public String getLevelName() { |
| | | return levelName; |
| | | } |
| | | |
| | | public void setLevelName(String levelName) { |
| | | this.levelName = levelName == null ? null : levelName.trim(); |
| | | } |
| | | |
| | | public Integer getItemOrder() { |
| | | return itemOrder; |
| | | } |
| | | |
| | | public void setItemOrder(Integer itemOrder) { |
| | | this.itemOrder = itemOrder; |
| | | } |
| | | |
| | | public Boolean getDeleted() { |
| | | return deleted; |
| | | } |
| | | |
| | | public void setDeleted(Boolean deleted) { |
| | | this.deleted = deleted; |
| | | } |
| | | } |
| | |
| | | package com.ycl.jxkg.domain; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | public class TaskExam implements Serializable { |
| | | |
| | | private static final long serialVersionUID = -7014704644631536195L; |
| | |
| | | */ |
| | | private String createUserName; |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getTitle() { |
| | | return title; |
| | | } |
| | | |
| | | public void setTitle(String title) { |
| | | this.title = title == null ? null : title.trim(); |
| | | } |
| | | |
| | | public Integer getGradeLevel() { |
| | | return gradeLevel; |
| | | } |
| | | |
| | | public void setGradeLevel(Integer gradeLevel) { |
| | | this.gradeLevel = gradeLevel; |
| | | } |
| | | |
| | | public Integer getFrameTextContentId() { |
| | | return frameTextContentId; |
| | | } |
| | | |
| | | public void setFrameTextContentId(Integer frameTextContentId) { |
| | | this.frameTextContentId = frameTextContentId; |
| | | } |
| | | |
| | | public Integer getCreateUser() { |
| | | return createUser; |
| | | } |
| | | |
| | | public void setCreateUser(Integer createUser) { |
| | | this.createUser = createUser; |
| | | } |
| | | |
| | | public Date getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(Date createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public Boolean getDeleted() { |
| | | return deleted; |
| | | } |
| | | |
| | | public void setDeleted(Boolean deleted) { |
| | | this.deleted = deleted; |
| | | } |
| | | |
| | | public String getCreateUserName() { |
| | | return createUserName; |
| | | } |
| | | |
| | | public void setCreateUserName(String createUserName) { |
| | | this.createUserName = createUserName == null ? null : createUserName.trim(); |
| | | } |
| | | } |
| | |
| | | package com.ycl.jxkg.domain; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | public class TaskExamCustomerAnswer implements Serializable { |
| | | |
| | | private static final long serialVersionUID = -556842372977600137L; |
| | |
| | | */ |
| | | private Integer textContentId; |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Integer getTaskExamId() { |
| | | return taskExamId; |
| | | } |
| | | |
| | | public void setTaskExamId(Integer taskExamId) { |
| | | this.taskExamId = taskExamId; |
| | | } |
| | | |
| | | public Integer getCreateUser() { |
| | | return createUser; |
| | | } |
| | | |
| | | public void setCreateUser(Integer createUser) { |
| | | this.createUser = createUser; |
| | | } |
| | | |
| | | public Date getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(Date createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public Integer getTextContentId() { |
| | | return textContentId; |
| | | } |
| | | |
| | | public void setTextContentId(Integer textContentId) { |
| | | this.textContentId = textContentId; |
| | | } |
| | | } |
| | |
| | | package com.ycl.jxkg.domain; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | public class TextContent implements Serializable { |
| | | |
| | | private static final long serialVersionUID = -1279530310964668131L; |
| | | |
| | | public TextContent(){ |
| | | |
| | | } |
| | | |
| | | public TextContent(String content, Date createTime) { |
| | | this.content = content; |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | private Integer id; |
| | | |
| | |
| | | */ |
| | | private Date createTime; |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getContent() { |
| | | return content; |
| | | } |
| | | |
| | | public void setContent(String content) { |
| | | this.content = content == null ? null : content.trim(); |
| | | } |
| | | |
| | | public Date getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(Date createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | } |
| | |
| | | package com.ycl.jxkg.domain; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | public class User implements Serializable { |
| | | |
| | | private static final long serialVersionUID = -7797183521247423117L; |
| | |
| | | */ |
| | | private String wxOpenId; |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getUserUuid() { |
| | | return userUuid; |
| | | } |
| | | |
| | | public void setUserUuid(String userUuid) { |
| | | this.userUuid = userUuid == null ? null : userUuid.trim(); |
| | | } |
| | | |
| | | public String getUserName() { |
| | | return userName; |
| | | } |
| | | |
| | | public void setUserName(String userName) { |
| | | this.userName = userName == null ? null : userName.trim(); |
| | | } |
| | | |
| | | public String getPassword() { |
| | | return password; |
| | | } |
| | | |
| | | public void setPassword(String password) { |
| | | this.password = password == null ? null : password.trim(); |
| | | } |
| | | |
| | | public String getRealName() { |
| | | return realName; |
| | | } |
| | | |
| | | public void setRealName(String realName) { |
| | | this.realName = realName == null ? null : realName.trim(); |
| | | } |
| | | |
| | | public Integer getAge() { |
| | | return age; |
| | | } |
| | | |
| | | public void setAge(Integer age) { |
| | | this.age = age; |
| | | } |
| | | |
| | | public Integer getSex() { |
| | | return sex; |
| | | } |
| | | |
| | | public void setSex(Integer sex) { |
| | | this.sex = sex; |
| | | } |
| | | |
| | | public Date getBirthDay() { |
| | | return birthDay; |
| | | } |
| | | |
| | | public void setBirthDay(Date birthDay) { |
| | | this.birthDay = birthDay; |
| | | } |
| | | |
| | | public Integer getUserLevel() { |
| | | return userLevel; |
| | | } |
| | | |
| | | public void setUserLevel(Integer userLevel) { |
| | | this.userLevel = userLevel; |
| | | } |
| | | |
| | | public String getPhone() { |
| | | return phone; |
| | | } |
| | | |
| | | public void setPhone(String phone) { |
| | | this.phone = phone == null ? null : phone.trim(); |
| | | } |
| | | |
| | | public Integer getRole() { |
| | | return role; |
| | | } |
| | | |
| | | public void setRole(Integer role) { |
| | | this.role = role; |
| | | } |
| | | |
| | | public Integer getStatus() { |
| | | return status; |
| | | } |
| | | |
| | | public void setStatus(Integer status) { |
| | | this.status = status; |
| | | } |
| | | |
| | | public String getImagePath() { |
| | | return imagePath; |
| | | } |
| | | |
| | | public void setImagePath(String imagePath) { |
| | | this.imagePath = imagePath == null ? null : imagePath.trim(); |
| | | } |
| | | |
| | | public Date getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(Date createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public Date getModifyTime() { |
| | | return modifyTime; |
| | | } |
| | | |
| | | public void setModifyTime(Date modifyTime) { |
| | | this.modifyTime = modifyTime; |
| | | } |
| | | |
| | | public Date getLastActiveTime() { |
| | | return lastActiveTime; |
| | | } |
| | | |
| | | public void setLastActiveTime(Date lastActiveTime) { |
| | | this.lastActiveTime = lastActiveTime; |
| | | } |
| | | |
| | | public Boolean getDeleted() { |
| | | return deleted; |
| | | } |
| | | |
| | | public void setDeleted(Boolean deleted) { |
| | | this.deleted = deleted; |
| | | } |
| | | |
| | | public String getWxOpenId() { |
| | | return wxOpenId; |
| | | } |
| | | |
| | | public void setWxOpenId(String wxOpenId) { |
| | | this.wxOpenId = wxOpenId == null ? null : wxOpenId.trim(); |
| | | } |
| | | } |
| | |
| | | package com.ycl.jxkg.domain; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | public class UserEventLog implements Serializable { |
| | | |
| | | private static final long serialVersionUID = -3951198127152024633L; |
| | |
| | | */ |
| | | private Date createTime; |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Integer getUserId() { |
| | | return userId; |
| | | } |
| | | |
| | | public void setUserId(Integer userId) { |
| | | this.userId = userId; |
| | | } |
| | | |
| | | public String getUserName() { |
| | | return userName; |
| | | } |
| | | |
| | | public void setUserName(String userName) { |
| | | this.userName = userName == null ? null : userName.trim(); |
| | | } |
| | | |
| | | public String getRealName() { |
| | | return realName; |
| | | } |
| | | |
| | | public void setRealName(String realName) { |
| | | this.realName = realName == null ? null : realName.trim(); |
| | | } |
| | | |
| | | public String getContent() { |
| | | return content; |
| | | } |
| | | |
| | | public void setContent(String content) { |
| | | this.content = content == null ? null : content.trim(); |
| | | } |
| | | |
| | | public Date getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(Date createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | } |
| | |
| | | package com.ycl.jxkg.domain; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | public class UserToken implements Serializable { |
| | | |
| | | private static final long serialVersionUID = -2414443061696200360L; |
| | |
| | | */ |
| | | private String userName; |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getToken() { |
| | | return token; |
| | | } |
| | | |
| | | public void setToken(String token) { |
| | | this.token = token == null ? null : token.trim(); |
| | | } |
| | | |
| | | public Integer getUserId() { |
| | | return userId; |
| | | } |
| | | |
| | | public void setUserId(Integer userId) { |
| | | this.userId = userId; |
| | | } |
| | | |
| | | public String getWxOpenId() { |
| | | return wxOpenId; |
| | | } |
| | | |
| | | public void setWxOpenId(String wxOpenId) { |
| | | this.wxOpenId = wxOpenId == null ? null : wxOpenId.trim(); |
| | | } |
| | | |
| | | public Date getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(Date createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public Date getEndTime() { |
| | | return endTime; |
| | | } |
| | | |
| | | public void setEndTime(Date endTime) { |
| | | this.endTime = endTime; |
| | | } |
| | | |
| | | public String getUserName() { |
| | | return userName; |
| | | } |
| | | |
| | | public void setUserName(String userName) { |
| | | this.userName = userName == null ? null : userName.trim(); |
| | | } |
| | | } |
| | |
| | | package com.ycl.jxkg.domain.exam; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class ExamPaperQuestionItemObject { |
| | | |
| | | private Integer id; |
| | | |
| | | private Integer itemOrder; |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Integer getItemOrder() { |
| | | return itemOrder; |
| | | } |
| | | |
| | | public void setItemOrder(Integer itemOrder) { |
| | | this.itemOrder = itemOrder; |
| | | } |
| | | } |
| | |
| | | package com.ycl.jxkg.domain.exam; |
| | | |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class ExamPaperTitleItemObject { |
| | | |
| | | private String name; |
| | | |
| | | private List<ExamPaperQuestionItemObject> questionItems; |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public List<ExamPaperQuestionItemObject> getQuestionItems() { |
| | | return questionItems; |
| | | } |
| | | |
| | | public void setQuestionItems(List<ExamPaperQuestionItemObject> questionItems) { |
| | | this.questionItems = questionItems; |
| | | } |
| | | } |
| | |
| | | package com.ycl.jxkg.domain.other; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class ExamPaperAnswerUpdate { |
| | | |
| | | private Integer id; |
| | | |
| | | private Integer customerScore; |
| | | |
| | | private Boolean doRight; |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Integer getCustomerScore() { |
| | | return customerScore; |
| | | } |
| | | |
| | | public void setCustomerScore(Integer customerScore) { |
| | | this.customerScore = customerScore; |
| | | } |
| | | |
| | | public Boolean getDoRight() { |
| | | return doRight; |
| | | } |
| | | |
| | | public void setDoRight(Boolean doRight) { |
| | | this.doRight = doRight; |
| | | } |
| | | } |
| | |
| | | package com.ycl.jxkg.domain.other; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class KeyValue { |
| | | |
| | | private String name; |
| | | |
| | | private Integer value; |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public Integer getValue() { |
| | | return value; |
| | | } |
| | | |
| | | public void setValue(Integer value) { |
| | | this.value = value; |
| | | } |
| | | } |
| | |
| | | package com.ycl.jxkg.domain.question; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class QuestionItemObject { |
| | | |
| | | private String prefix; |
| | |
| | | |
| | | private String itemUuid; |
| | | |
| | | public String getPrefix() { |
| | | return prefix; |
| | | } |
| | | |
| | | public void setPrefix(String prefix) { |
| | | this.prefix = prefix; |
| | | } |
| | | |
| | | public String getContent() { |
| | | return content; |
| | | } |
| | | |
| | | public void setContent(String content) { |
| | | this.content = content; |
| | | } |
| | | |
| | | public Integer getScore() { |
| | | return score; |
| | | } |
| | | |
| | | public void setScore(Integer score) { |
| | | this.score = score; |
| | | } |
| | | |
| | | public String getItemUuid() { |
| | | return itemUuid; |
| | | } |
| | | |
| | | public void setItemUuid(String itemUuid) { |
| | | this.itemUuid = itemUuid; |
| | | } |
| | | } |
| | |
| | | package com.ycl.jxkg.domain.question; |
| | | |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class QuestionObject { |
| | | |
| | | private String titleContent; |
| | |
| | | |
| | | private String correct; |
| | | |
| | | public String getTitleContent() { |
| | | return titleContent; |
| | | } |
| | | |
| | | public void setTitleContent(String titleContent) { |
| | | this.titleContent = titleContent; |
| | | } |
| | | |
| | | public String getAnalyze() { |
| | | return analyze; |
| | | } |
| | | |
| | | public void setAnalyze(String analyze) { |
| | | this.analyze = analyze; |
| | | } |
| | | |
| | | public List<QuestionItemObject> getQuestionItemObjects() { |
| | | return questionItemObjects; |
| | | } |
| | | |
| | | public void setQuestionItemObjects(List<QuestionItemObject> questionItemObjects) { |
| | | this.questionItemObjects = questionItemObjects; |
| | | } |
| | | |
| | | public String getCorrect() { |
| | | return correct; |
| | | } |
| | | |
| | | public void setCorrect(String correct) { |
| | | this.correct = correct; |
| | | } |
| | | } |
| | |
| | | package com.ycl.jxkg.domain.task; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class TaskItemAnswerObject { |
| | | |
| | | private Integer examPaperId; |
| | | |
| | | private Integer examPaperAnswerId; |
| | | |
| | | private Integer status; |
| | | |
| | | public TaskItemAnswerObject(){ |
| | | |
| | | } |
| | | |
| | | public TaskItemAnswerObject(Integer examPaperId, Integer examPaperAnswerId, Integer status) { |
| | | this.examPaperId = examPaperId; |
| | | this.examPaperAnswerId = examPaperAnswerId; |
| | | this.status = status; |
| | | } |
| | | |
| | | public Integer getExamPaperId() { |
| | | return examPaperId; |
| | | } |
| | | |
| | | public void setExamPaperId(Integer examPaperId) { |
| | | this.examPaperId = examPaperId; |
| | | } |
| | | |
| | | public Integer getExamPaperAnswerId() { |
| | | return examPaperAnswerId; |
| | | } |
| | | |
| | | public void setExamPaperAnswerId(Integer examPaperAnswerId) { |
| | | this.examPaperAnswerId = examPaperAnswerId; |
| | | } |
| | | |
| | | public Integer getStatus() { |
| | | return status; |
| | | } |
| | | |
| | | public void setStatus(Integer status) { |
| | | this.status = status; |
| | | } |
| | | } |
| | |
| | | package com.ycl.jxkg.domain.task; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class TaskItemObject { |
| | | |
| | | private Integer examPaperId; |
| | | |
| | | private String examPaperName; |
| | | |
| | | private Integer itemOrder; |
| | | |
| | | public Integer getExamPaperId() { |
| | | return examPaperId; |
| | | } |
| | | |
| | | public void setExamPaperId(Integer examPaperId) { |
| | | this.examPaperId = examPaperId; |
| | | } |
| | | |
| | | public String getExamPaperName() { |
| | | return examPaperName; |
| | | } |
| | | |
| | | public void setExamPaperName(String examPaperName) { |
| | | this.examPaperName = examPaperName; |
| | | } |
| | | |
| | | public Integer getItemOrder() { |
| | | return itemOrder; |
| | | } |
| | | |
| | | public void setItemOrder(Integer itemOrder) { |
| | | this.itemOrder = itemOrder; |
| | | } |
| | | } |
| | |
| | | |
| | | examPaperAnswerService.insertByFilter(examPaperAnswer); |
| | | examPaperQuestionCustomerAnswers.stream().filter(a -> QuestionTypeEnum.needSaveTextContent(a.getQuestionType())).forEach(d -> { |
| | | TextContent textContent = new TextContent(d.getAnswer(), now); |
| | | TextContent textContent = new TextContent(); |
| | | textContent.setContent(d.getAnswer()); |
| | | textContent.setCreateTime(now); |
| | | textContentService.insertByFilter(textContent); |
| | | d.setTextContentId(textContent.getId()); |
| | | d.setAnswer(null); |
File was renamed from src/main/java/com/ycl/jxkg/repository/BaseMapper.java |
| | |
| | | package com.ycl.jxkg.repository; |
| | | package com.ycl.jxkg.mapper; |
| | | |
| | | public interface BaseMapper<T> { |
| | | |
File was renamed from src/main/java/com/ycl/jxkg/repository/ExamPaperAnswerMapper.java |
| | |
| | | package com.ycl.jxkg.repository; |
| | | package com.ycl.jxkg.mapper; |
| | | |
| | | import com.ycl.jxkg.domain.ExamPaperAnswer; |
| | | import com.ycl.jxkg.domain.other.KeyValue; |
| | | import com.ycl.jxkg.viewmodel.student.exampaper.ExamPaperAnswerPageVM; |
| | | import com.ycl.jxkg.vo.admin.paper.ExamPaperAnswerPageRequestVO; |
| | | import com.ycl.jxkg.vo.student.exampaper.ExamPaperAnswerPageVO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | |
| | | @Mapper |
| | | public interface ExamPaperAnswerMapper extends BaseMapper<ExamPaperAnswer> { |
| | | |
| | | List<ExamPaperAnswer> studentPage(ExamPaperAnswerPageVM requestVM); |
| | | List<ExamPaperAnswer> studentPage(ExamPaperAnswerPageVO requestVM); |
| | | |
| | | Integer selectAllCount(); |
| | | |
| | |
| | | |
| | | ExamPaperAnswer getByPidUid(@Param("pid") Integer paperId, @Param("uid") Integer uid); |
| | | |
| | | List<ExamPaperAnswer> adminPage(com.ycl.jxkg.viewmodel.admin.paper.ExamPaperAnswerPageRequestVM requestVM); |
| | | List<ExamPaperAnswer> adminPage(ExamPaperAnswerPageRequestVO requestVM); |
| | | } |
New file |
| | |
| | | package com.ycl.jxkg.mapper; |
| | | |
| | | import com.ycl.jxkg.domain.ExamPaper; |
| | | import com.ycl.jxkg.domain.other.KeyValue; |
| | | import com.ycl.jxkg.vo.admin.exam.ExamPaperPageRequestVO; |
| | | import com.ycl.jxkg.vo.student.dashboard.PaperFilter; |
| | | import com.ycl.jxkg.vo.student.dashboard.PaperInfo; |
| | | import com.ycl.jxkg.vo.student.exam.ExamPaperPageVO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Mapper |
| | | public interface ExamPaperMapper extends BaseMapper<ExamPaper> { |
| | | |
| | | List<ExamPaper> page(ExamPaperPageRequestVO requestVM); |
| | | |
| | | List<ExamPaper> taskExamPage(ExamPaperPageRequestVO requestVM); |
| | | |
| | | List<ExamPaper> studentPage(ExamPaperPageVO requestVM); |
| | | |
| | | List<PaperInfo> indexPaper(PaperFilter paperFilter); |
| | | |
| | | Integer selectAllCount(); |
| | | |
| | | List<KeyValue> selectCountByDate(@Param("startTime") Date startTime, @Param("endTime") Date endTime); |
| | | |
| | | int updateTaskPaper(@Param("taskId") Integer taskId,@Param("paperIds") List<Integer> paperIds); |
| | | |
| | | int clearTaskPaper(@Param("paperIds") List<Integer> paperIds); |
| | | } |
File was renamed from src/main/java/com/ycl/jxkg/repository/ExamPaperQuestionCustomerAnswerMapper.java |
| | |
| | | package com.ycl.jxkg.repository; |
| | | package com.ycl.jxkg.mapper; |
| | | |
| | | import com.ycl.jxkg.domain.ExamPaperQuestionCustomerAnswer; |
| | | import com.ycl.jxkg.domain.other.ExamPaperAnswerUpdate; |
| | | import com.ycl.jxkg.domain.other.KeyValue; |
| | | import com.ycl.jxkg.viewmodel.student.question.answer.QuestionPageStudentRequestVM; |
| | | import com.ycl.jxkg.vo.student.question.answer.QuestionPageStudentRequestVO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | |
| | | |
| | | List<ExamPaperQuestionCustomerAnswer> selectListByPaperAnswerId(Integer id); |
| | | |
| | | List<ExamPaperQuestionCustomerAnswer> studentPage(QuestionPageStudentRequestVM requestVM); |
| | | List<ExamPaperQuestionCustomerAnswer> studentPage(QuestionPageStudentRequestVO requestVM); |
| | | |
| | | int insertList(List<ExamPaperQuestionCustomerAnswer> list); |
| | | |
File was renamed from src/main/java/com/ycl/jxkg/repository/MessageMapper.java |
| | |
| | | package com.ycl.jxkg.repository; |
| | | package com.ycl.jxkg.mapper; |
| | | |
| | | import com.ycl.jxkg.domain.Message; |
| | | import com.ycl.jxkg.viewmodel.admin.message.MessagePageRequestVM; |
| | | import com.ycl.jxkg.vo.admin.message.MessagePageRequestVO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.util.List; |
| | |
| | | @Mapper |
| | | public interface MessageMapper extends BaseMapper<Message> { |
| | | |
| | | List<Message> page(MessagePageRequestVM requestVM); |
| | | List<Message> page(MessagePageRequestVO requestVM); |
| | | |
| | | List<Message> selectByIds(List<Integer> ids); |
| | | |
File was renamed from src/main/java/com/ycl/jxkg/repository/MessageUserMapper.java |
| | |
| | | package com.ycl.jxkg.repository; |
| | | package com.ycl.jxkg.mapper; |
| | | |
| | | import com.ycl.jxkg.domain.MessageUser; |
| | | import com.ycl.jxkg.viewmodel.student.user.MessageRequestVM; |
| | | import com.ycl.jxkg.vo.student.user.MessageRequestVO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.util.List; |
| | |
| | | |
| | | int inserts(List<MessageUser> list); |
| | | |
| | | List<MessageUser> studentPage(MessageRequestVM requestVM); |
| | | List<MessageUser> studentPage(MessageRequestVO requestVM); |
| | | |
| | | Integer unReadCount(Integer userId); |
| | | } |
File was renamed from src/main/java/com/ycl/jxkg/repository/QuestionMapper.java |
| | |
| | | package com.ycl.jxkg.repository; |
| | | package com.ycl.jxkg.mapper; |
| | | |
| | | import com.ycl.jxkg.domain.other.KeyValue; |
| | | import com.ycl.jxkg.domain.Question; |
| | | import com.ycl.jxkg.viewmodel.admin.question.QuestionPageRequestVM; |
| | | import com.ycl.jxkg.vo.admin.question.QuestionPageRequestVO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | |
| | | @Mapper |
| | | public interface QuestionMapper extends BaseMapper<Question> { |
| | | |
| | | List<Question> page(QuestionPageRequestVM requestVM); |
| | | List<Question> page(QuestionPageRequestVO requestVM); |
| | | |
| | | List<Question> selectByIds(@Param("ids") List<Integer> ids); |
| | | |
File was renamed from src/main/java/com/ycl/jxkg/repository/SubjectMapper.java |
| | |
| | | package com.ycl.jxkg.repository; |
| | | package com.ycl.jxkg.mapper; |
| | | |
| | | import com.ycl.jxkg.domain.Subject; |
| | | import com.ycl.jxkg.viewmodel.admin.education.SubjectPageRequestVM; |
| | | import com.ycl.jxkg.vo.admin.education.SubjectPageRequestVO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.util.List; |
| | |
| | | |
| | | List<Subject> allSubject(); |
| | | |
| | | List<Subject> page(SubjectPageRequestVM requestVM); |
| | | List<Subject> page(SubjectPageRequestVO requestVM); |
| | | } |
File was renamed from src/main/java/com/ycl/jxkg/repository/TaskExamCustomerAnswerMapper.java |
| | |
| | | package com.ycl.jxkg.repository; |
| | | package com.ycl.jxkg.mapper; |
| | | |
| | | import com.ycl.jxkg.domain.TaskExamCustomerAnswer; |
| | | import org.apache.ibatis.annotations.Mapper; |
File was renamed from src/main/java/com/ycl/jxkg/repository/TaskExamMapper.java |
| | |
| | | package com.ycl.jxkg.repository; |
| | | package com.ycl.jxkg.mapper; |
| | | |
| | | import com.ycl.jxkg.domain.TaskExam; |
| | | import com.ycl.jxkg.viewmodel.admin.task.TaskPageRequestVM; |
| | | import com.ycl.jxkg.vo.admin.task.TaskPageRequestVO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.util.List; |
| | |
| | | @Mapper |
| | | public interface TaskExamMapper extends BaseMapper<TaskExam> { |
| | | |
| | | List<TaskExam> page(TaskPageRequestVM requestVM); |
| | | List<TaskExam> page(TaskPageRequestVO requestVM); |
| | | |
| | | List<TaskExam> getByGradeLevel(Integer gradeLevel); |
| | | } |
File was renamed from src/main/java/com/ycl/jxkg/repository/TextContentMapper.java |
| | |
| | | package com.ycl.jxkg.repository; |
| | | package com.ycl.jxkg.mapper; |
| | | |
| | | import com.ycl.jxkg.domain.TextContent; |
| | | import org.apache.ibatis.annotations.Mapper; |
File was renamed from src/main/java/com/ycl/jxkg/repository/UserEventLogMapper.java |
| | |
| | | package com.ycl.jxkg.repository; |
| | | package com.ycl.jxkg.mapper; |
| | | |
| | | import com.ycl.jxkg.domain.UserEventLog; |
| | | import com.ycl.jxkg.domain.other.KeyValue; |
| | | import com.ycl.jxkg.viewmodel.admin.user.UserEventPageRequestVM; |
| | | import com.ycl.jxkg.vo.admin.user.UserEventPageRequestVO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | |
| | | |
| | | List<UserEventLog> getUserEventLogByUserId(Integer id); |
| | | |
| | | List<UserEventLog> page(UserEventPageRequestVM requestVM); |
| | | List<UserEventLog> page(UserEventPageRequestVO requestVM); |
| | | |
| | | List<KeyValue> selectCountByDate(@Param("startTime") Date startTime, @Param("endTime") Date endTime); |
| | | } |
File was renamed from src/main/java/com/ycl/jxkg/repository/UserMapper.java |
| | |
| | | package com.ycl.jxkg.repository; |
| | | package com.ycl.jxkg.mapper; |
| | | |
| | | import com.ycl.jxkg.domain.other.KeyValue; |
| | | import com.ycl.jxkg.domain.User; |
| | | import com.ycl.jxkg.viewmodel.admin.user.UserPageRequestVM; |
| | | import com.ycl.jxkg.vo.admin.user.UserPageRequestVO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | |
| | | * @param requestVM requestVM |
| | | * @return List<User> |
| | | */ |
| | | List<User> userPage(UserPageRequestVM requestVM); |
| | | List<User> userPage(UserPageRequestVO requestVM); |
| | | |
| | | |
| | | /** |
File was renamed from src/main/java/com/ycl/jxkg/repository/UserTokenMapper.java |
| | |
| | | package com.ycl.jxkg.repository; |
| | | package com.ycl.jxkg.mapper; |
| | | |
| | | import com.ycl.jxkg.domain.UserToken; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | |
| | | import com.ycl.jxkg.domain.ExamPaperAnswer; |
| | | import com.ycl.jxkg.domain.ExamPaperAnswerInfo; |
| | | import com.ycl.jxkg.domain.User; |
| | | import com.ycl.jxkg.viewmodel.student.exam.ExamPaperSubmitVM; |
| | | import com.ycl.jxkg.viewmodel.student.exampaper.ExamPaperAnswerPageVM; |
| | | import com.ycl.jxkg.vo.admin.paper.ExamPaperAnswerPageRequestVO; |
| | | import com.ycl.jxkg.vo.student.exam.ExamPaperSubmitVO; |
| | | import com.ycl.jxkg.vo.student.exampaper.ExamPaperAnswerPageVO; |
| | | import com.github.pagehelper.PageInfo; |
| | | |
| | | import java.util.List; |
| | |
| | | * @param requestVM 过滤条件 |
| | | * @return PageInfo<ExamPaperAnswer> |
| | | */ |
| | | PageInfo<ExamPaperAnswer> studentPage(ExamPaperAnswerPageVM requestVM); |
| | | PageInfo<ExamPaperAnswer> studentPage(ExamPaperAnswerPageVO requestVM); |
| | | |
| | | /** |
| | | * 计算试卷提交结果(不入库) |
| | | * |
| | | * @param examPaperSubmitVM |
| | | * @param examPaperSubmitVO |
| | | * @param user |
| | | * @return |
| | | */ |
| | | ExamPaperAnswerInfo calculateExamPaperAnswer(ExamPaperSubmitVM examPaperSubmitVM, User user); |
| | | ExamPaperAnswerInfo calculateExamPaperAnswer(ExamPaperSubmitVO examPaperSubmitVO, User user); |
| | | |
| | | |
| | | /** |
| | | * 试卷批改 |
| | | * @param examPaperSubmitVM examPaperSubmitVM |
| | | * @param examPaperSubmitVO examPaperSubmitVM |
| | | * @return String |
| | | */ |
| | | String judge(ExamPaperSubmitVM examPaperSubmitVM); |
| | | String judge(ExamPaperSubmitVO examPaperSubmitVO); |
| | | |
| | | /** |
| | | * 试卷答题信息转成ViewModel 传给前台 |
| | |
| | | * @param id 试卷id |
| | | * @return ExamPaperSubmitVM |
| | | */ |
| | | ExamPaperSubmitVM examPaperAnswerToVM(Integer id); |
| | | ExamPaperSubmitVO examPaperAnswerToVM(Integer id); |
| | | |
| | | |
| | | Integer selectAllCount(); |
| | | |
| | | List<Integer> selectMothCount(); |
| | | |
| | | PageInfo<ExamPaperAnswer> adminPage(com.ycl.jxkg.viewmodel.admin.paper.ExamPaperAnswerPageRequestVM requestVM); |
| | | PageInfo<ExamPaperAnswer> adminPage(ExamPaperAnswerPageRequestVO requestVM); |
| | | } |
| | |
| | | |
| | | import com.ycl.jxkg.domain.ExamPaperQuestionCustomerAnswer; |
| | | import com.ycl.jxkg.domain.other.ExamPaperAnswerUpdate; |
| | | import com.ycl.jxkg.viewmodel.student.exam.ExamPaperSubmitItemVM; |
| | | import com.ycl.jxkg.viewmodel.student.question.answer.QuestionPageStudentRequestVM; |
| | | import com.ycl.jxkg.vo.student.exam.ExamPaperSubmitItemVO; |
| | | import com.ycl.jxkg.vo.student.question.answer.QuestionPageStudentRequestVO; |
| | | import com.github.pagehelper.PageInfo; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface ExamPaperQuestionCustomerAnswerService extends BaseService<ExamPaperQuestionCustomerAnswer> { |
| | | |
| | | PageInfo<ExamPaperQuestionCustomerAnswer> studentPage(QuestionPageStudentRequestVM requestVM); |
| | | PageInfo<ExamPaperQuestionCustomerAnswer> studentPage(QuestionPageStudentRequestVO requestVM); |
| | | |
| | | List<ExamPaperQuestionCustomerAnswer> selectListByPaperAnswerId(Integer id); |
| | | |
| | |
| | | * @param qa ExamPaperQuestionCustomerAnswer |
| | | * @return ExamPaperSubmitItemVM |
| | | */ |
| | | ExamPaperSubmitItemVM examPaperQuestionCustomerAnswerToVM(ExamPaperQuestionCustomerAnswer qa); |
| | | ExamPaperSubmitItemVO examPaperQuestionCustomerAnswerToVM(ExamPaperQuestionCustomerAnswer qa); |
| | | |
| | | |
| | | Integer selectAllCount(); |
| | |
| | | |
| | | import com.ycl.jxkg.domain.ExamPaper; |
| | | import com.ycl.jxkg.domain.User; |
| | | import com.ycl.jxkg.viewmodel.admin.exam.ExamPaperEditRequestVM; |
| | | import com.ycl.jxkg.viewmodel.admin.exam.ExamPaperPageRequestVM; |
| | | import com.ycl.jxkg.viewmodel.student.dashboard.PaperFilter; |
| | | import com.ycl.jxkg.viewmodel.student.dashboard.PaperInfo; |
| | | import com.ycl.jxkg.viewmodel.student.exam.ExamPaperPageVM; |
| | | import com.ycl.jxkg.vo.admin.exam.ExamPaperEditRequestVO; |
| | | import com.ycl.jxkg.vo.admin.exam.ExamPaperPageRequestVO; |
| | | import com.ycl.jxkg.vo.student.dashboard.PaperFilter; |
| | | import com.ycl.jxkg.vo.student.dashboard.PaperInfo; |
| | | import com.ycl.jxkg.vo.student.exam.ExamPaperPageVO; |
| | | import com.github.pagehelper.PageInfo; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface ExamPaperService extends BaseService<ExamPaper> { |
| | | |
| | | PageInfo<ExamPaper> page(ExamPaperPageRequestVM requestVM); |
| | | PageInfo<ExamPaper> page(ExamPaperPageRequestVO requestVM); |
| | | |
| | | PageInfo<ExamPaper> taskExamPage(ExamPaperPageRequestVM requestVM); |
| | | PageInfo<ExamPaper> taskExamPage(ExamPaperPageRequestVO requestVM); |
| | | |
| | | PageInfo<ExamPaper> studentPage(ExamPaperPageVM requestVM); |
| | | PageInfo<ExamPaper> studentPage(ExamPaperPageVO requestVM); |
| | | |
| | | ExamPaper savePaperFromVM(ExamPaperEditRequestVM examPaperEditRequestVM, User user); |
| | | ExamPaper savePaperFromVM(ExamPaperEditRequestVO examPaperEditRequestVO, User user); |
| | | |
| | | ExamPaperEditRequestVM examPaperToVM(Integer id); |
| | | ExamPaperEditRequestVO examPaperToVM(Integer id); |
| | | |
| | | List<PaperInfo> indexPaper(PaperFilter paperFilter); |
| | | |
| | |
| | | |
| | | import com.ycl.jxkg.domain.Message; |
| | | import com.ycl.jxkg.domain.MessageUser; |
| | | import com.ycl.jxkg.viewmodel.admin.message.MessagePageRequestVM; |
| | | import com.ycl.jxkg.viewmodel.student.user.MessageRequestVM; |
| | | import com.ycl.jxkg.vo.admin.message.MessagePageRequestVO; |
| | | import com.ycl.jxkg.vo.student.user.MessageRequestVO; |
| | | import com.github.pagehelper.PageInfo; |
| | | |
| | | import java.util.List; |
| | |
| | | |
| | | List<Message> selectMessageByIds(List<Integer> ids); |
| | | |
| | | PageInfo<MessageUser> studentPage(MessageRequestVM requestVM); |
| | | PageInfo<MessageUser> studentPage(MessageRequestVO requestVM); |
| | | |
| | | PageInfo<Message> page(MessagePageRequestVM requestVM); |
| | | PageInfo<Message> page(MessagePageRequestVO requestVM); |
| | | |
| | | List<MessageUser> selectByMessageIds(List<Integer> ids); |
| | | |
| | |
| | | package com.ycl.jxkg.service; |
| | | |
| | | import com.ycl.jxkg.domain.Question; |
| | | import com.ycl.jxkg.viewmodel.admin.question.QuestionEditRequestVM; |
| | | import com.ycl.jxkg.viewmodel.admin.question.QuestionPageRequestVM; |
| | | import com.ycl.jxkg.vo.admin.question.QuestionEditRequestVO; |
| | | import com.ycl.jxkg.vo.admin.question.QuestionPageRequestVO; |
| | | import com.github.pagehelper.PageInfo; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface QuestionService extends BaseService<Question> { |
| | | |
| | | PageInfo<Question> page(QuestionPageRequestVM requestVM); |
| | | PageInfo<Question> page(QuestionPageRequestVO requestVM); |
| | | |
| | | Question insertFullQuestion(QuestionEditRequestVM model, Integer userId); |
| | | Question insertFullQuestion(QuestionEditRequestVO model, Integer userId); |
| | | |
| | | Question updateFullQuestion(QuestionEditRequestVM model); |
| | | Question updateFullQuestion(QuestionEditRequestVO model); |
| | | |
| | | QuestionEditRequestVM getQuestionEditRequestVM(Integer questionId); |
| | | QuestionEditRequestVO getQuestionEditRequestVM(Integer questionId); |
| | | |
| | | QuestionEditRequestVM getQuestionEditRequestVM(Question question); |
| | | QuestionEditRequestVO getQuestionEditRequestVM(Question question); |
| | | |
| | | Integer selectAllCount(); |
| | | |
| | |
| | | package com.ycl.jxkg.service; |
| | | |
| | | import com.ycl.jxkg.domain.Subject; |
| | | import com.ycl.jxkg.viewmodel.admin.education.SubjectPageRequestVM; |
| | | import com.ycl.jxkg.vo.admin.education.SubjectPageRequestVO; |
| | | import com.github.pagehelper.PageInfo; |
| | | |
| | | import java.util.List; |
| | |
| | | |
| | | Integer levelBySubjectId(Integer id); |
| | | |
| | | PageInfo<Subject> page(SubjectPageRequestVM requestVM); |
| | | PageInfo<Subject> page(SubjectPageRequestVO requestVM); |
| | | } |
| | |
| | | |
| | | import com.ycl.jxkg.domain.TaskExam; |
| | | import com.ycl.jxkg.domain.User; |
| | | import com.ycl.jxkg.viewmodel.admin.task.TaskPageRequestVM; |
| | | import com.ycl.jxkg.viewmodel.admin.task.TaskRequestVM; |
| | | import com.ycl.jxkg.vo.admin.task.TaskPageRequestVO; |
| | | import com.ycl.jxkg.vo.admin.task.TaskRequestVO; |
| | | import com.github.pagehelper.PageInfo; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface TaskExamService extends BaseService<TaskExam> { |
| | | |
| | | PageInfo<TaskExam> page(TaskPageRequestVM requestVM); |
| | | PageInfo<TaskExam> page(TaskPageRequestVO requestVM); |
| | | |
| | | void edit(TaskRequestVM model, User user); |
| | | void edit(TaskRequestVO model, User user); |
| | | |
| | | TaskRequestVM taskExamToVM(Integer id); |
| | | TaskRequestVO taskExamToVM(Integer id); |
| | | |
| | | List<TaskExam> getByGradeLevel(Integer gradeLevel); |
| | | } |
| | |
| | | package com.ycl.jxkg.service; |
| | | |
| | | import com.ycl.jxkg.domain.UserEventLog; |
| | | import com.ycl.jxkg.viewmodel.admin.user.UserEventPageRequestVM; |
| | | import com.ycl.jxkg.vo.admin.user.UserEventPageRequestVO; |
| | | import com.github.pagehelper.PageInfo; |
| | | |
| | | import java.util.List; |
| | |
| | | |
| | | List<UserEventLog> getUserEventLogByUserId(Integer id); |
| | | |
| | | PageInfo<UserEventLog> page(UserEventPageRequestVM requestVM); |
| | | PageInfo<UserEventLog> page(UserEventPageRequestVO requestVM); |
| | | |
| | | List<Integer> selectMothCount(); |
| | | } |
| | |
| | | |
| | | import com.ycl.jxkg.domain.other.KeyValue; |
| | | import com.ycl.jxkg.domain.User; |
| | | import com.ycl.jxkg.viewmodel.admin.user.UserPageRequestVM; |
| | | import com.ycl.jxkg.vo.admin.user.UserPageRequestVO; |
| | | import com.github.pagehelper.PageInfo; |
| | | |
| | | import java.util.List; |
| | |
| | | * @param requestVM requestVM |
| | | * @return PageInfo<User> |
| | | */ |
| | | PageInfo<User> userPage(UserPageRequestVM requestVM); |
| | | PageInfo<User> userPage(UserPageRequestVO requestVM); |
| | | |
| | | |
| | | /** |
| | |
| | | package com.ycl.jxkg.service.impl; |
| | | |
| | | import com.ycl.jxkg.configuration.property.SystemConfig; |
| | | import com.ycl.jxkg.config.property.SystemConfig; |
| | | import com.ycl.jxkg.domain.User; |
| | | import com.ycl.jxkg.service.AuthenticationService; |
| | | import com.ycl.jxkg.service.UserService; |
| | | import com.ycl.jxkg.utility.RsaUtil; |
| | | import com.ycl.jxkg.utils.RsaUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | package com.ycl.jxkg.service.impl; |
| | | |
| | | import com.ycl.jxkg.repository.BaseMapper; |
| | | import com.ycl.jxkg.mapper.BaseMapper; |
| | | import com.ycl.jxkg.service.BaseService; |
| | | |
| | | public abstract class BaseServiceImpl<T> implements BaseService<T> { |
| | |
| | | import com.ycl.jxkg.domain.other.KeyValue; |
| | | import com.ycl.jxkg.domain.other.ExamPaperAnswerUpdate; |
| | | import com.ycl.jxkg.domain.task.TaskItemAnswerObject; |
| | | import com.ycl.jxkg.repository.ExamPaperAnswerMapper; |
| | | import com.ycl.jxkg.repository.ExamPaperMapper; |
| | | import com.ycl.jxkg.repository.QuestionMapper; |
| | | import com.ycl.jxkg.repository.TaskExamCustomerAnswerMapper; |
| | | import com.ycl.jxkg.mapper.ExamPaperAnswerMapper; |
| | | import com.ycl.jxkg.mapper.ExamPaperMapper; |
| | | import com.ycl.jxkg.mapper.QuestionMapper; |
| | | import com.ycl.jxkg.mapper.TaskExamCustomerAnswerMapper; |
| | | import com.ycl.jxkg.service.ExamPaperAnswerService; |
| | | import com.ycl.jxkg.service.ExamPaperQuestionCustomerAnswerService; |
| | | import com.ycl.jxkg.service.TextContentService; |
| | | import com.ycl.jxkg.utility.DateTimeUtil; |
| | | import com.ycl.jxkg.utility.ExamUtil; |
| | | import com.ycl.jxkg.utility.JsonUtil; |
| | | import com.ycl.jxkg.viewmodel.student.exam.ExamPaperSubmitItemVM; |
| | | import com.ycl.jxkg.viewmodel.student.exam.ExamPaperSubmitVM; |
| | | import com.ycl.jxkg.viewmodel.student.exampaper.ExamPaperAnswerPageVM; |
| | | import com.ycl.jxkg.utils.DateTimeUtil; |
| | | import com.ycl.jxkg.utils.ExamUtil; |
| | | import com.ycl.jxkg.utils.JsonUtil; |
| | | import com.ycl.jxkg.vo.admin.paper.ExamPaperAnswerPageRequestVO; |
| | | import com.ycl.jxkg.vo.student.exam.ExamPaperSubmitItemVO; |
| | | import com.ycl.jxkg.vo.student.exam.ExamPaperSubmitVO; |
| | | import com.ycl.jxkg.vo.student.exampaper.ExamPaperAnswerPageVO; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public PageInfo<ExamPaperAnswer> studentPage(ExamPaperAnswerPageVM requestVM) { |
| | | public PageInfo<ExamPaperAnswer> studentPage(ExamPaperAnswerPageVO requestVM) { |
| | | return PageHelper.startPage(requestVM.getPageIndex(), requestVM.getPageSize(), "id desc").doSelectPageInfo(() -> |
| | | examPaperAnswerMapper.studentPage(requestVM)); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public ExamPaperAnswerInfo calculateExamPaperAnswer(ExamPaperSubmitVM examPaperSubmitVM, User user) { |
| | | public ExamPaperAnswerInfo calculateExamPaperAnswer(ExamPaperSubmitVO examPaperSubmitVO, User user) { |
| | | ExamPaperAnswerInfo examPaperAnswerInfo = new ExamPaperAnswerInfo(); |
| | | Date now = new Date(); |
| | | ExamPaper examPaper = examPaperMapper.selectByPrimaryKey(examPaperSubmitVM.getId()); |
| | | ExamPaper examPaper = examPaperMapper.selectByPrimaryKey(examPaperSubmitVO.getId()); |
| | | ExamPaperTypeEnum paperTypeEnum = ExamPaperTypeEnum.fromCode(examPaper.getPaperType()); |
| | | //任务试卷只能做一次 |
| | | if (paperTypeEnum == ExamPaperTypeEnum.Task) { |
| | | ExamPaperAnswer examPaperAnswer = examPaperAnswerMapper.getByPidUid(examPaperSubmitVM.getId(), user.getId()); |
| | | ExamPaperAnswer examPaperAnswer = examPaperAnswerMapper.getByPidUid(examPaperSubmitVO.getId(), user.getId()); |
| | | if (null != examPaperAnswer) |
| | | return null; |
| | | } |
| | |
| | | .flatMap(t -> t.getQuestionItems().stream() |
| | | .map(q -> { |
| | | Question question = questions.stream().filter(tq -> tq.getId().equals(q.getId())).findFirst().get(); |
| | | ExamPaperSubmitItemVM customerQuestionAnswer = examPaperSubmitVM.getAnswerItems().stream() |
| | | ExamPaperSubmitItemVO customerQuestionAnswer = examPaperSubmitVO.getAnswerItems().stream() |
| | | .filter(tq -> tq.getQuestionId().equals(q.getId())) |
| | | .findFirst() |
| | | .orElse(null); |
| | |
| | | }) |
| | | ).collect(Collectors.toList()); |
| | | |
| | | ExamPaperAnswer examPaperAnswer = ExamPaperAnswerFromVM(examPaperSubmitVM, examPaper, examPaperQuestionCustomerAnswers, user, now); |
| | | ExamPaperAnswer examPaperAnswer = ExamPaperAnswerFromVM(examPaperSubmitVO, examPaper, examPaperQuestionCustomerAnswers, user, now); |
| | | examPaperAnswerInfo.setExamPaper(examPaper); |
| | | examPaperAnswerInfo.setExamPaperAnswer(examPaperAnswer); |
| | | examPaperAnswerInfo.setExamPaperQuestionCustomerAnswers(examPaperQuestionCustomerAnswers); |
| | |
| | | |
| | | @Override |
| | | @Transactional |
| | | public String judge(ExamPaperSubmitVM examPaperSubmitVM) { |
| | | ExamPaperAnswer examPaperAnswer = examPaperAnswerMapper.selectByPrimaryKey(examPaperSubmitVM.getId()); |
| | | List<ExamPaperSubmitItemVM> judgeItems = examPaperSubmitVM.getAnswerItems().stream().filter(d -> d.getDoRight() == null).collect(Collectors.toList()); |
| | | public String judge(ExamPaperSubmitVO examPaperSubmitVO) { |
| | | ExamPaperAnswer examPaperAnswer = examPaperAnswerMapper.selectByPrimaryKey(examPaperSubmitVO.getId()); |
| | | List<ExamPaperSubmitItemVO> judgeItems = examPaperSubmitVO.getAnswerItems().stream().filter(d -> d.getDoRight() == null).collect(Collectors.toList()); |
| | | List<ExamPaperAnswerUpdate> examPaperAnswerUpdates = new ArrayList<>(judgeItems.size()); |
| | | Integer customerScore = examPaperAnswer.getUserScore(); |
| | | Integer questionCorrect = examPaperAnswer.getQuestionCorrect(); |
| | | for (ExamPaperSubmitItemVM d : judgeItems) { |
| | | for (ExamPaperSubmitItemVO d : judgeItems) { |
| | | ExamPaperAnswerUpdate examPaperAnswerUpdate = new ExamPaperAnswerUpdate(); |
| | | examPaperAnswerUpdate.setId(d.getId()); |
| | | examPaperAnswerUpdate.setCustomerScore(ExamUtil.scoreFromVM(d.getScore())); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public ExamPaperSubmitVM examPaperAnswerToVM(Integer id) { |
| | | ExamPaperSubmitVM examPaperSubmitVM = new ExamPaperSubmitVM(); |
| | | public ExamPaperSubmitVO examPaperAnswerToVM(Integer id) { |
| | | ExamPaperSubmitVO examPaperSubmitVO = new ExamPaperSubmitVO(); |
| | | ExamPaperAnswer examPaperAnswer = examPaperAnswerMapper.selectByPrimaryKey(id); |
| | | examPaperSubmitVM.setId(examPaperAnswer.getId()); |
| | | examPaperSubmitVM.setDoTime(examPaperAnswer.getDoTime()); |
| | | examPaperSubmitVM.setScore(ExamUtil.scoreToVM(examPaperAnswer.getUserScore())); |
| | | examPaperSubmitVO.setId(examPaperAnswer.getId()); |
| | | examPaperSubmitVO.setDoTime(examPaperAnswer.getDoTime()); |
| | | examPaperSubmitVO.setScore(ExamUtil.scoreToVM(examPaperAnswer.getUserScore())); |
| | | List<ExamPaperQuestionCustomerAnswer> examPaperQuestionCustomerAnswers = examPaperQuestionCustomerAnswerService.selectListByPaperAnswerId(examPaperAnswer.getId()); |
| | | List<ExamPaperSubmitItemVM> examPaperSubmitItemVMS = examPaperQuestionCustomerAnswers.stream() |
| | | List<ExamPaperSubmitItemVO> examPaperSubmitItemVOS = examPaperQuestionCustomerAnswers.stream() |
| | | .map(a -> examPaperQuestionCustomerAnswerService.examPaperQuestionCustomerAnswerToVM(a)) |
| | | .collect(Collectors.toList()); |
| | | examPaperSubmitVM.setAnswerItems(examPaperSubmitItemVMS); |
| | | return examPaperSubmitVM; |
| | | examPaperSubmitVO.setAnswerItems(examPaperSubmitItemVOS); |
| | | return examPaperSubmitVO; |
| | | } |
| | | |
| | | @Override |
| | |
| | | * @param now now |
| | | * @return ExamPaperQuestionCustomerAnswer |
| | | */ |
| | | private ExamPaperQuestionCustomerAnswer ExamPaperQuestionCustomerAnswerFromVM(Question question, ExamPaperSubmitItemVM customerQuestionAnswer, ExamPaper examPaper, Integer itemOrder, User user, Date now) { |
| | | private ExamPaperQuestionCustomerAnswer ExamPaperQuestionCustomerAnswerFromVM(Question question, ExamPaperSubmitItemVO customerQuestionAnswer, ExamPaper examPaper, Integer itemOrder, User user, Date now) { |
| | | ExamPaperQuestionCustomerAnswer examPaperQuestionCustomerAnswer = new ExamPaperQuestionCustomerAnswer(); |
| | | examPaperQuestionCustomerAnswer.setQuestionId(question.getId()); |
| | | examPaperQuestionCustomerAnswer.setExamPaperId(examPaper.getId()); |
| | |
| | | * @param question question |
| | | * @param customerQuestionAnswer customerQuestionAnswer |
| | | */ |
| | | private void setSpecialFromVM(ExamPaperQuestionCustomerAnswer examPaperQuestionCustomerAnswer, Question question, ExamPaperSubmitItemVM customerQuestionAnswer) { |
| | | private void setSpecialFromVM(ExamPaperQuestionCustomerAnswer examPaperQuestionCustomerAnswer, Question question, ExamPaperSubmitItemVO customerQuestionAnswer) { |
| | | QuestionTypeEnum questionTypeEnum = QuestionTypeEnum.fromCode(examPaperQuestionCustomerAnswer.getQuestionType()); |
| | | switch (questionTypeEnum) { |
| | | case SingleChoice: |
| | |
| | | } |
| | | } |
| | | |
| | | private ExamPaperAnswer ExamPaperAnswerFromVM(ExamPaperSubmitVM examPaperSubmitVM, ExamPaper examPaper, List<ExamPaperQuestionCustomerAnswer> examPaperQuestionCustomerAnswers, User user, Date now) { |
| | | private ExamPaperAnswer ExamPaperAnswerFromVM(ExamPaperSubmitVO examPaperSubmitVO, ExamPaper examPaper, List<ExamPaperQuestionCustomerAnswer> examPaperQuestionCustomerAnswers, User user, Date now) { |
| | | Integer systemScore = examPaperQuestionCustomerAnswers.stream().mapToInt(a -> a.getCustomerScore()).sum(); |
| | | long questionCorrect = examPaperQuestionCustomerAnswers.stream().filter(a -> a.getCustomerScore().equals(a.getQuestionScore())).count(); |
| | | ExamPaperAnswer examPaperAnswer = new ExamPaperAnswer(); |
| | | examPaperAnswer.setPaperName(examPaper.getName()); |
| | | examPaperAnswer.setDoTime(examPaperSubmitVM.getDoTime()); |
| | | examPaperAnswer.setDoTime(examPaperSubmitVO.getDoTime()); |
| | | examPaperAnswer.setExamPaperId(examPaper.getId()); |
| | | examPaperAnswer.setCreateUser(user.getId()); |
| | | examPaperAnswer.setCreateTime(now); |
| | |
| | | |
| | | |
| | | @Override |
| | | public PageInfo<ExamPaperAnswer> adminPage(com.ycl.jxkg.viewmodel.admin.paper.ExamPaperAnswerPageRequestVM requestVM) { |
| | | public PageInfo<ExamPaperAnswer> adminPage(ExamPaperAnswerPageRequestVO requestVM) { |
| | | return PageHelper.startPage(requestVM.getPageIndex(), requestVM.getPageSize(), "id desc").doSelectPageInfo(() -> |
| | | examPaperAnswerMapper.adminPage(requestVM)); |
| | | } |
| | |
| | | import com.ycl.jxkg.domain.other.KeyValue; |
| | | import com.ycl.jxkg.domain.TextContent; |
| | | import com.ycl.jxkg.domain.enums.QuestionTypeEnum; |
| | | import com.ycl.jxkg.repository.ExamPaperQuestionCustomerAnswerMapper; |
| | | import com.ycl.jxkg.mapper.ExamPaperQuestionCustomerAnswerMapper; |
| | | import com.ycl.jxkg.service.ExamPaperQuestionCustomerAnswerService; |
| | | import com.ycl.jxkg.service.TextContentService; |
| | | import com.ycl.jxkg.utility.DateTimeUtil; |
| | | import com.ycl.jxkg.utility.ExamUtil; |
| | | import com.ycl.jxkg.utility.JsonUtil; |
| | | import com.ycl.jxkg.viewmodel.student.exam.ExamPaperSubmitItemVM; |
| | | import com.ycl.jxkg.viewmodel.student.question.answer.QuestionPageStudentRequestVM; |
| | | import com.ycl.jxkg.utils.DateTimeUtil; |
| | | import com.ycl.jxkg.utils.ExamUtil; |
| | | import com.ycl.jxkg.utils.JsonUtil; |
| | | import com.ycl.jxkg.vo.student.exam.ExamPaperSubmitItemVO; |
| | | import com.ycl.jxkg.vo.student.question.answer.QuestionPageStudentRequestVO; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | |
| | | |
| | | @Override |
| | | public PageInfo<ExamPaperQuestionCustomerAnswer> studentPage(QuestionPageStudentRequestVM requestVM) { |
| | | public PageInfo<ExamPaperQuestionCustomerAnswer> studentPage(QuestionPageStudentRequestVO requestVM) { |
| | | return PageHelper.startPage(requestVM.getPageIndex(), requestVM.getPageSize(), "id desc").doSelectPageInfo(() -> |
| | | examPaperQuestionCustomerAnswerMapper.studentPage(requestVM) |
| | | ); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public ExamPaperSubmitItemVM examPaperQuestionCustomerAnswerToVM(ExamPaperQuestionCustomerAnswer qa) { |
| | | ExamPaperSubmitItemVM examPaperSubmitItemVM = new ExamPaperSubmitItemVM(); |
| | | examPaperSubmitItemVM.setId(qa.getId()); |
| | | examPaperSubmitItemVM.setQuestionId(qa.getQuestionId()); |
| | | examPaperSubmitItemVM.setDoRight(qa.getDoRight()); |
| | | examPaperSubmitItemVM.setItemOrder(qa.getItemOrder()); |
| | | examPaperSubmitItemVM.setQuestionScore(ExamUtil.scoreToVM(qa.getQuestionScore())); |
| | | examPaperSubmitItemVM.setScore(ExamUtil.scoreToVM(qa.getCustomerScore())); |
| | | setSpecialToVM(examPaperSubmitItemVM, qa); |
| | | return examPaperSubmitItemVM; |
| | | public ExamPaperSubmitItemVO examPaperQuestionCustomerAnswerToVM(ExamPaperQuestionCustomerAnswer qa) { |
| | | ExamPaperSubmitItemVO examPaperSubmitItemVO = new ExamPaperSubmitItemVO(); |
| | | examPaperSubmitItemVO.setId(qa.getId()); |
| | | examPaperSubmitItemVO.setQuestionId(qa.getQuestionId()); |
| | | examPaperSubmitItemVO.setDoRight(qa.getDoRight()); |
| | | examPaperSubmitItemVO.setItemOrder(qa.getItemOrder()); |
| | | examPaperSubmitItemVO.setQuestionScore(ExamUtil.scoreToVM(qa.getQuestionScore())); |
| | | examPaperSubmitItemVO.setScore(ExamUtil.scoreToVM(qa.getCustomerScore())); |
| | | setSpecialToVM(examPaperSubmitItemVO, qa); |
| | | return examPaperSubmitItemVO; |
| | | } |
| | | |
| | | @Override |
| | |
| | | return examPaperQuestionCustomerAnswerMapper.updateScore(examPaperAnswerUpdates); |
| | | } |
| | | |
| | | private void setSpecialToVM(ExamPaperSubmitItemVM examPaperSubmitItemVM, ExamPaperQuestionCustomerAnswer examPaperQuestionCustomerAnswer) { |
| | | private void setSpecialToVM(ExamPaperSubmitItemVO examPaperSubmitItemVO, ExamPaperQuestionCustomerAnswer examPaperQuestionCustomerAnswer) { |
| | | QuestionTypeEnum questionTypeEnum = QuestionTypeEnum.fromCode(examPaperQuestionCustomerAnswer.getQuestionType()); |
| | | switch (questionTypeEnum) { |
| | | case MultipleChoice: |
| | | examPaperSubmitItemVM.setContent(examPaperQuestionCustomerAnswer.getAnswer()); |
| | | examPaperSubmitItemVM.setContentArray(ExamUtil.contentToArray(examPaperQuestionCustomerAnswer.getAnswer())); |
| | | examPaperSubmitItemVO.setContent(examPaperQuestionCustomerAnswer.getAnswer()); |
| | | examPaperSubmitItemVO.setContentArray(ExamUtil.contentToArray(examPaperQuestionCustomerAnswer.getAnswer())); |
| | | break; |
| | | case GapFilling: |
| | | TextContent textContent = textContentService.selectById(examPaperQuestionCustomerAnswer.getTextContentId()); |
| | | List<String> correctAnswer = JsonUtil.toJsonListObject(textContent.getContent(), String.class); |
| | | examPaperSubmitItemVM.setContentArray(correctAnswer); |
| | | examPaperSubmitItemVO.setContentArray(correctAnswer); |
| | | break; |
| | | default: |
| | | if (QuestionTypeEnum.needSaveTextContent(examPaperQuestionCustomerAnswer.getQuestionType())) { |
| | | TextContent content = textContentService.selectById(examPaperQuestionCustomerAnswer.getTextContentId()); |
| | | examPaperSubmitItemVM.setContent(content.getContent()); |
| | | examPaperSubmitItemVO.setContent(content.getContent()); |
| | | } else { |
| | | examPaperSubmitItemVM.setContent(examPaperQuestionCustomerAnswer.getAnswer()); |
| | | examPaperSubmitItemVO.setContent(examPaperQuestionCustomerAnswer.getAnswer()); |
| | | } |
| | | break; |
| | | } |
| | |
| | | import com.ycl.jxkg.domain.exam.ExamPaperQuestionItemObject; |
| | | import com.ycl.jxkg.domain.exam.ExamPaperTitleItemObject; |
| | | import com.ycl.jxkg.domain.other.KeyValue; |
| | | import com.ycl.jxkg.repository.ExamPaperMapper; |
| | | import com.ycl.jxkg.repository.QuestionMapper; |
| | | import com.ycl.jxkg.mapper.ExamPaperMapper; |
| | | import com.ycl.jxkg.mapper.QuestionMapper; |
| | | import com.ycl.jxkg.service.ExamPaperService; |
| | | import com.ycl.jxkg.service.QuestionService; |
| | | import com.ycl.jxkg.service.SubjectService; |
| | | import com.ycl.jxkg.service.TextContentService; |
| | | import com.ycl.jxkg.service.enums.ActionEnum; |
| | | import com.ycl.jxkg.utility.DateTimeUtil; |
| | | import com.ycl.jxkg.utility.JsonUtil; |
| | | import com.ycl.jxkg.utility.ModelMapperSingle; |
| | | import com.ycl.jxkg.utility.ExamUtil; |
| | | import com.ycl.jxkg.viewmodel.admin.exam.ExamPaperEditRequestVM; |
| | | import com.ycl.jxkg.viewmodel.admin.exam.ExamPaperPageRequestVM; |
| | | import com.ycl.jxkg.viewmodel.admin.exam.ExamPaperTitleItemVM; |
| | | import com.ycl.jxkg.viewmodel.admin.question.QuestionEditRequestVM; |
| | | import com.ycl.jxkg.viewmodel.student.dashboard.PaperFilter; |
| | | import com.ycl.jxkg.viewmodel.student.dashboard.PaperInfo; |
| | | import com.ycl.jxkg.viewmodel.student.exam.ExamPaperPageVM; |
| | | import com.ycl.jxkg.utils.DateTimeUtil; |
| | | import com.ycl.jxkg.utils.JsonUtil; |
| | | import com.ycl.jxkg.utils.ExamUtil; |
| | | import com.ycl.jxkg.vo.admin.exam.ExamPaperEditRequestVO; |
| | | import com.ycl.jxkg.vo.admin.exam.ExamPaperPageRequestVO; |
| | | import com.ycl.jxkg.vo.admin.exam.ExamPaperTitleItemVO; |
| | | import com.ycl.jxkg.vo.admin.question.QuestionEditRequestVO; |
| | | import com.ycl.jxkg.vo.student.dashboard.PaperFilter; |
| | | import com.ycl.jxkg.vo.student.dashboard.PaperInfo; |
| | | import com.ycl.jxkg.vo.student.exam.ExamPaperPageVO; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.ycl.jxkg.domain.ExamPaper; |
| | | import com.ycl.jxkg.domain.Question; |
| | | import com.ycl.jxkg.domain.User; |
| | | import org.modelmapper.ModelMapper; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | @Service |
| | | public class ExamPaperServiceImpl extends BaseServiceImpl<ExamPaper> implements ExamPaperService { |
| | | |
| | | protected final static ModelMapper modelMapper = ModelMapperSingle.Instance(); |
| | | private final ExamPaperMapper examPaperMapper; |
| | | private final QuestionMapper questionMapper; |
| | | private final TextContentService textContentService; |
| | |
| | | |
| | | |
| | | @Override |
| | | public PageInfo<ExamPaper> page(ExamPaperPageRequestVM requestVM) { |
| | | public PageInfo<ExamPaper> page(ExamPaperPageRequestVO requestVM) { |
| | | return PageHelper.startPage(requestVM.getPageIndex(), requestVM.getPageSize(), "id desc").doSelectPageInfo(() -> |
| | | examPaperMapper.page(requestVM)); |
| | | } |
| | | |
| | | @Override |
| | | public PageInfo<ExamPaper> taskExamPage(ExamPaperPageRequestVM requestVM) { |
| | | public PageInfo<ExamPaper> taskExamPage(ExamPaperPageRequestVO requestVM) { |
| | | return PageHelper.startPage(requestVM.getPageIndex(), requestVM.getPageSize(), "id desc").doSelectPageInfo(() -> |
| | | examPaperMapper.taskExamPage(requestVM)); |
| | | } |
| | | |
| | | @Override |
| | | public PageInfo<ExamPaper> studentPage(ExamPaperPageVM requestVM) { |
| | | public PageInfo<ExamPaper> studentPage(ExamPaperPageVO requestVM) { |
| | | return PageHelper.startPage(requestVM.getPageIndex(), requestVM.getPageSize(), "id desc").doSelectPageInfo(() -> |
| | | examPaperMapper.studentPage(requestVM)); |
| | | } |
| | |
| | | |
| | | @Override |
| | | @Transactional |
| | | public ExamPaper savePaperFromVM(ExamPaperEditRequestVM examPaperEditRequestVM, User user) { |
| | | ActionEnum actionEnum = (examPaperEditRequestVM.getId() == null) ? ActionEnum.ADD : ActionEnum.UPDATE; |
| | | public ExamPaper savePaperFromVM(ExamPaperEditRequestVO examPaperEditRequestVO, User user) { |
| | | ActionEnum actionEnum = (examPaperEditRequestVO.getId() == null) ? ActionEnum.ADD : ActionEnum.UPDATE; |
| | | Date now = new Date(); |
| | | List<ExamPaperTitleItemVM> titleItemsVM = examPaperEditRequestVM.getTitleItems(); |
| | | List<ExamPaperTitleItemVO> titleItemsVM = examPaperEditRequestVO.getTitleItems(); |
| | | List<ExamPaperTitleItemObject> frameTextContentList = frameTextContentFromVM(titleItemsVM); |
| | | String frameTextContentStr = JsonUtil.toJsonStr(frameTextContentList); |
| | | |
| | | ExamPaper examPaper; |
| | | ExamPaper examPaper = new ExamPaper(); |
| | | BeanUtils.copyProperties(examPaperEditRequestVO, examPaper); |
| | | if (actionEnum == ActionEnum.ADD) { |
| | | examPaper = modelMapper.map(examPaperEditRequestVM, ExamPaper.class); |
| | | TextContent frameTextContent = new TextContent(frameTextContentStr, now); |
| | | TextContent frameTextContent = new TextContent(); |
| | | frameTextContent.setContent(frameTextContentStr); |
| | | frameTextContent.setCreateTime(now); |
| | | textContentService.insertByFilter(frameTextContent); |
| | | examPaper.setFrameTextContentId(frameTextContent.getId()); |
| | | examPaper.setCreateTime(now); |
| | | examPaper.setCreateUser(user.getId()); |
| | | examPaper.setDeleted(false); |
| | | examPaperFromVM(examPaperEditRequestVM, examPaper, titleItemsVM); |
| | | examPaperFromVM(examPaperEditRequestVO, examPaper, titleItemsVM); |
| | | examPaperMapper.insertSelective(examPaper); |
| | | } else { |
| | | examPaper = examPaperMapper.selectByPrimaryKey(examPaperEditRequestVM.getId()); |
| | | examPaper = examPaperMapper.selectByPrimaryKey(examPaperEditRequestVO.getId()); |
| | | TextContent frameTextContent = textContentService.selectById(examPaper.getFrameTextContentId()); |
| | | frameTextContent.setContent(frameTextContentStr); |
| | | textContentService.updateByIdFilter(frameTextContent); |
| | | modelMapper.map(examPaperEditRequestVM, examPaper); |
| | | examPaperFromVM(examPaperEditRequestVM, examPaper, titleItemsVM); |
| | | examPaperFromVM(examPaperEditRequestVO, examPaper, titleItemsVM); |
| | | examPaperMapper.updateByPrimaryKeySelective(examPaper); |
| | | } |
| | | return examPaper; |
| | | } |
| | | |
| | | @Override |
| | | public ExamPaperEditRequestVM examPaperToVM(Integer id) { |
| | | public ExamPaperEditRequestVO examPaperToVM(Integer id) { |
| | | ExamPaper examPaper = examPaperMapper.selectByPrimaryKey(id); |
| | | ExamPaperEditRequestVM vm = modelMapper.map(examPaper, ExamPaperEditRequestVM.class); |
| | | vm.setLevel(examPaper.getGradeLevel()); |
| | | ExamPaperEditRequestVO vo = new ExamPaperEditRequestVO(); |
| | | BeanUtils.copyProperties(examPaper, vo); |
| | | vo.setLevel(examPaper.getGradeLevel()); |
| | | TextContent frameTextContent = textContentService.selectById(examPaper.getFrameTextContentId()); |
| | | List<ExamPaperTitleItemObject> examPaperTitleItemObjects = JsonUtil.toJsonListObject(frameTextContent.getContent(), ExamPaperTitleItemObject.class); |
| | | List<Integer> questionIds = examPaperTitleItemObjects.stream() |
| | |
| | | .map(q -> q.getId())) |
| | | .collect(Collectors.toList()); |
| | | List<Question> questions = questionMapper.selectByIds(questionIds); |
| | | List<ExamPaperTitleItemVM> examPaperTitleItemVMS = examPaperTitleItemObjects.stream().map(t -> { |
| | | ExamPaperTitleItemVM tTitleVM = modelMapper.map(t, ExamPaperTitleItemVM.class); |
| | | List<QuestionEditRequestVM> questionItemsVM = t.getQuestionItems().stream().map(i -> { |
| | | List<ExamPaperTitleItemVO> examPaperTitleItemVOS = examPaperTitleItemObjects.stream().map(t -> { |
| | | ExamPaperTitleItemVO tTitleVM = new ExamPaperTitleItemVO(); |
| | | BeanUtils.copyProperties(t, tTitleVM); |
| | | List<QuestionEditRequestVO> questionItemsVM = t.getQuestionItems().stream().map(i -> { |
| | | Question question = questions.stream().filter(q -> q.getId().equals(i.getId())).findFirst().get(); |
| | | QuestionEditRequestVM questionEditRequestVM = questionService.getQuestionEditRequestVM(question); |
| | | questionEditRequestVM.setItemOrder(i.getItemOrder()); |
| | | return questionEditRequestVM; |
| | | QuestionEditRequestVO questionEditRequestVO = questionService.getQuestionEditRequestVM(question); |
| | | questionEditRequestVO.setItemOrder(i.getItemOrder()); |
| | | return questionEditRequestVO; |
| | | }).collect(Collectors.toList()); |
| | | tTitleVM.setQuestionItems(questionItemsVM); |
| | | return tTitleVM; |
| | | }).collect(Collectors.toList()); |
| | | vm.setTitleItems(examPaperTitleItemVMS); |
| | | vm.setScore(ExamUtil.scoreToVM(examPaper.getScore())); |
| | | vo.setTitleItems(examPaperTitleItemVOS); |
| | | vo.setScore(ExamUtil.scoreToVM(examPaper.getScore())); |
| | | if (ExamPaperTypeEnum.TimeLimit == ExamPaperTypeEnum.fromCode(examPaper.getPaperType())) { |
| | | List<String> limitDateTime = Arrays.asList(DateTimeUtil.dateFormat(examPaper.getLimitStartTime()), DateTimeUtil.dateFormat(examPaper.getLimitEndTime())); |
| | | vm.setLimitDateTime(limitDateTime); |
| | | vo.setLimitDateTime(limitDateTime); |
| | | } |
| | | return vm; |
| | | return vo; |
| | | } |
| | | |
| | | @Override |
| | |
| | | }).collect(Collectors.toList()); |
| | | } |
| | | |
| | | private void examPaperFromVM(ExamPaperEditRequestVM examPaperEditRequestVM, ExamPaper examPaper, List<ExamPaperTitleItemVM> titleItemsVM) { |
| | | Integer gradeLevel = subjectService.levelBySubjectId(examPaperEditRequestVM.getSubjectId()); |
| | | private void examPaperFromVM(ExamPaperEditRequestVO examPaperEditRequestVO, ExamPaper examPaper, List<ExamPaperTitleItemVO> titleItemsVM) { |
| | | Integer gradeLevel = subjectService.levelBySubjectId(examPaperEditRequestVO.getSubjectId()); |
| | | Integer questionCount = titleItemsVM.stream() |
| | | .mapToInt(t -> t.getQuestionItems().size()).sum(); |
| | | Integer score = titleItemsVM.stream(). |
| | |
| | | examPaper.setQuestionCount(questionCount); |
| | | examPaper.setScore(score); |
| | | examPaper.setGradeLevel(gradeLevel); |
| | | List<String> dateTimes = examPaperEditRequestVM.getLimitDateTime(); |
| | | List<String> dateTimes = examPaperEditRequestVO.getLimitDateTime(); |
| | | if (ExamPaperTypeEnum.TimeLimit == ExamPaperTypeEnum.fromCode(examPaper.getPaperType())) { |
| | | examPaper.setLimitStartTime(DateTimeUtil.parse(dateTimes.get(0), DateTimeUtil.STANDER_FORMAT)); |
| | | examPaper.setLimitEndTime(DateTimeUtil.parse(dateTimes.get(1), DateTimeUtil.STANDER_FORMAT)); |
| | | } |
| | | } |
| | | |
| | | private List<ExamPaperTitleItemObject> frameTextContentFromVM(List<ExamPaperTitleItemVM> titleItems) { |
| | | private List<ExamPaperTitleItemObject> frameTextContentFromVM(List<ExamPaperTitleItemVO> titleItems) { |
| | | AtomicInteger index = new AtomicInteger(1); |
| | | return titleItems.stream().map(t -> { |
| | | ExamPaperTitleItemObject titleItem = modelMapper.map(t, ExamPaperTitleItemObject.class); |
| | | ExamPaperTitleItemObject titleItem = new ExamPaperTitleItemObject(); |
| | | BeanUtils.copyProperties(t, titleItem); |
| | | List<ExamPaperQuestionItemObject> questionItems = t.getQuestionItems().stream() |
| | | .map(q -> { |
| | | ExamPaperQuestionItemObject examPaperQuestionItemObject = modelMapper.map(q, ExamPaperQuestionItemObject.class); |
| | | ExamPaperQuestionItemObject examPaperQuestionItemObject = new ExamPaperQuestionItemObject(); |
| | | BeanUtils.copyProperties(q, examPaperQuestionItemObject); |
| | | examPaperQuestionItemObject.setItemOrder(index.getAndIncrement()); |
| | | return examPaperQuestionItemObject; |
| | | }) |
| | |
| | | package com.ycl.jxkg.service.impl; |
| | | |
| | | import com.ycl.jxkg.configuration.property.QnConfig; |
| | | import com.ycl.jxkg.configuration.property.SystemConfig; |
| | | import com.ycl.jxkg.config.property.QnConfig; |
| | | import com.ycl.jxkg.config.property.SystemConfig; |
| | | import com.ycl.jxkg.service.FileUpload; |
| | | import com.google.gson.Gson; |
| | | import com.qiniu.common.QiniuException; |
| | |
| | | |
| | | import com.ycl.jxkg.domain.Message; |
| | | import com.ycl.jxkg.domain.MessageUser; |
| | | import com.ycl.jxkg.repository.MessageMapper; |
| | | import com.ycl.jxkg.repository.MessageUserMapper; |
| | | import com.ycl.jxkg.mapper.MessageMapper; |
| | | import com.ycl.jxkg.mapper.MessageUserMapper; |
| | | import com.ycl.jxkg.service.MessageService; |
| | | import com.ycl.jxkg.viewmodel.admin.message.MessagePageRequestVM; |
| | | import com.ycl.jxkg.viewmodel.student.user.MessageRequestVM; |
| | | import com.ycl.jxkg.vo.admin.message.MessagePageRequestVO; |
| | | import com.ycl.jxkg.vo.student.user.MessageRequestVO; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public PageInfo<MessageUser> studentPage(MessageRequestVM requestVM) { |
| | | public PageInfo<MessageUser> studentPage(MessageRequestVO requestVM) { |
| | | return PageHelper.startPage(requestVM.getPageIndex(), requestVM.getPageSize(), "id desc").doSelectPageInfo(() -> |
| | | messageUserMapper.studentPage(requestVM) |
| | | ); |
| | | } |
| | | |
| | | @Override |
| | | public PageInfo<Message> page(MessagePageRequestVM requestVM) { |
| | | public PageInfo<Message> page(MessagePageRequestVO requestVM) { |
| | | return PageHelper.startPage(requestVM.getPageIndex(), requestVM.getPageSize(), "id desc").doSelectPageInfo(() -> |
| | | messageMapper.page(requestVM) |
| | | ); |
| | |
| | | import com.ycl.jxkg.domain.enums.QuestionTypeEnum; |
| | | import com.ycl.jxkg.domain.question.QuestionItemObject; |
| | | import com.ycl.jxkg.domain.question.QuestionObject; |
| | | import com.ycl.jxkg.repository.QuestionMapper; |
| | | import com.ycl.jxkg.mapper.QuestionMapper; |
| | | import com.ycl.jxkg.service.QuestionService; |
| | | import com.ycl.jxkg.service.SubjectService; |
| | | import com.ycl.jxkg.service.TextContentService; |
| | | import com.ycl.jxkg.utility.DateTimeUtil; |
| | | import com.ycl.jxkg.utility.JsonUtil; |
| | | import com.ycl.jxkg.utility.ModelMapperSingle; |
| | | import com.ycl.jxkg.utility.ExamUtil; |
| | | import com.ycl.jxkg.viewmodel.admin.question.QuestionEditItemVM; |
| | | import com.ycl.jxkg.viewmodel.admin.question.QuestionEditRequestVM; |
| | | import com.ycl.jxkg.viewmodel.admin.question.QuestionPageRequestVM; |
| | | import com.ycl.jxkg.utils.DateTimeUtil; |
| | | import com.ycl.jxkg.utils.JsonUtil; |
| | | import com.ycl.jxkg.utils.ExamUtil; |
| | | import com.ycl.jxkg.vo.admin.question.QuestionEditItemVO; |
| | | import com.ycl.jxkg.vo.admin.question.QuestionEditRequestVO; |
| | | import com.ycl.jxkg.vo.admin.question.QuestionPageRequestVO; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import org.modelmapper.ModelMapper; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | @Service |
| | | public class QuestionServiceImpl extends BaseServiceImpl<Question> implements QuestionService { |
| | | |
| | | protected final static ModelMapper modelMapper = ModelMapperSingle.Instance(); |
| | | private final QuestionMapper questionMapper; |
| | | private final TextContentService textContentService; |
| | | private final SubjectService subjectService; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public PageInfo<Question> page(QuestionPageRequestVM requestVM) { |
| | | public PageInfo<Question> page(QuestionPageRequestVO requestVM) { |
| | | return PageHelper.startPage(requestVM.getPageIndex(), requestVM.getPageSize(), "id desc").doSelectPageInfo(() -> |
| | | questionMapper.page(requestVM) |
| | | ); |
| | |
| | | |
| | | @Override |
| | | @Transactional |
| | | public Question insertFullQuestion(QuestionEditRequestVM model, Integer userId) { |
| | | public Question insertFullQuestion(QuestionEditRequestVO model, Integer userId) { |
| | | Date now = new Date(); |
| | | Integer gradeLevel = subjectService.levelBySubjectId(model.getSubjectId()); |
| | | |
| | |
| | | |
| | | @Override |
| | | @Transactional |
| | | public Question updateFullQuestion(QuestionEditRequestVM model) { |
| | | public Question updateFullQuestion(QuestionEditRequestVO model) { |
| | | Integer gradeLevel = subjectService.levelBySubjectId(model.getSubjectId()); |
| | | Question question = questionMapper.selectByPrimaryKey(model.getId()); |
| | | question.setSubjectId(model.getSubjectId()); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public QuestionEditRequestVM getQuestionEditRequestVM(Integer questionId) { |
| | | public QuestionEditRequestVO getQuestionEditRequestVM(Integer questionId) { |
| | | //题目映射 |
| | | Question question = questionMapper.selectByPrimaryKey(questionId); |
| | | return getQuestionEditRequestVM(question); |
| | | } |
| | | |
| | | @Override |
| | | public QuestionEditRequestVM getQuestionEditRequestVM(Question question) { |
| | | public QuestionEditRequestVO getQuestionEditRequestVM(Question question) { |
| | | //题目映射 |
| | | TextContent questionInfoTextContent = textContentService.selectById(question.getInfoTextContentId()); |
| | | QuestionObject questionObject = JsonUtil.toJsonObject(questionInfoTextContent.getContent(), QuestionObject.class); |
| | | QuestionEditRequestVM questionEditRequestVM = modelMapper.map(question, QuestionEditRequestVM.class); |
| | | questionEditRequestVM.setTitle(questionObject.getTitleContent()); |
| | | QuestionEditRequestVO questionEditRequestVO = new QuestionEditRequestVO(); |
| | | BeanUtils.copyProperties(question, questionEditRequestVO); |
| | | questionEditRequestVO.setTitle(questionObject.getTitleContent()); |
| | | |
| | | //答案 |
| | | QuestionTypeEnum questionTypeEnum = QuestionTypeEnum.fromCode(question.getQuestionType()); |
| | | switch (questionTypeEnum) { |
| | | case SingleChoice: |
| | | case TrueFalse: |
| | | questionEditRequestVM.setCorrect(question.getCorrect()); |
| | | questionEditRequestVO.setCorrect(question.getCorrect()); |
| | | break; |
| | | case MultipleChoice: |
| | | questionEditRequestVM.setCorrectArray(ExamUtil.contentToArray(question.getCorrect())); |
| | | questionEditRequestVO.setCorrectArray(ExamUtil.contentToArray(question.getCorrect())); |
| | | break; |
| | | case GapFilling: |
| | | List<String> correctContent = questionObject.getQuestionItemObjects().stream().map(d -> d.getContent()).collect(Collectors.toList()); |
| | | questionEditRequestVM.setCorrectArray(correctContent); |
| | | questionEditRequestVO.setCorrectArray(correctContent); |
| | | break; |
| | | case ShortAnswer: |
| | | questionEditRequestVM.setCorrect(questionObject.getCorrect()); |
| | | questionEditRequestVO.setCorrect(questionObject.getCorrect()); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | questionEditRequestVM.setScore(ExamUtil.scoreToVM(question.getScore())); |
| | | questionEditRequestVM.setAnalyze(questionObject.getAnalyze()); |
| | | questionEditRequestVO.setScore(ExamUtil.scoreToVM(question.getScore())); |
| | | questionEditRequestVO.setAnalyze(questionObject.getAnalyze()); |
| | | |
| | | |
| | | //题目项映射 |
| | | List<QuestionEditItemVM> editItems = questionObject.getQuestionItemObjects().stream().map(o -> { |
| | | QuestionEditItemVM questionEditItemVM = modelMapper.map(o, QuestionEditItemVM.class); |
| | | List<QuestionEditItemVO> editItems = questionObject.getQuestionItemObjects().stream().map(o -> { |
| | | QuestionEditItemVO questionEditItemVO = new QuestionEditItemVO(); |
| | | BeanUtils.copyProperties(o, questionEditItemVO); |
| | | if (o.getScore() != null) { |
| | | questionEditItemVM.setScore(ExamUtil.scoreToVM(o.getScore())); |
| | | questionEditItemVO.setScore(ExamUtil.scoreToVM(o.getScore())); |
| | | } |
| | | return questionEditItemVM; |
| | | return questionEditItemVO; |
| | | }).collect(Collectors.toList()); |
| | | questionEditRequestVM.setItems(editItems); |
| | | return questionEditRequestVM; |
| | | questionEditRequestVO.setItems(editItems); |
| | | return questionEditRequestVO; |
| | | } |
| | | |
| | | public void setQuestionInfoFromVM(TextContent infoTextContent, QuestionEditRequestVM model) { |
| | | public void setQuestionInfoFromVM(TextContent infoTextContent, QuestionEditRequestVO model) { |
| | | List<QuestionItemObject> itemObjects = model.getItems().stream().map(i -> |
| | | { |
| | | QuestionItemObject item = new QuestionItemObject(); |
| | |
| | | package com.ycl.jxkg.service.impl; |
| | | |
| | | import com.ycl.jxkg.domain.Subject; |
| | | import com.ycl.jxkg.repository.SubjectMapper; |
| | | import com.ycl.jxkg.mapper.SubjectMapper; |
| | | import com.ycl.jxkg.service.SubjectService; |
| | | import com.ycl.jxkg.viewmodel.admin.education.SubjectPageRequestVM; |
| | | import com.ycl.jxkg.vo.admin.education.SubjectPageRequestVO; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public PageInfo<Subject> page(SubjectPageRequestVM requestVM) { |
| | | public PageInfo<Subject> page(SubjectPageRequestVO requestVM) { |
| | | return PageHelper.startPage(requestVM.getPageIndex(), requestVM.getPageSize(), "id desc").doSelectPageInfo(() -> |
| | | subjectMapper.page(requestVM) |
| | | ); |
| | |
| | | import com.ycl.jxkg.domain.TaskExamCustomerAnswer; |
| | | import com.ycl.jxkg.domain.TextContent; |
| | | import com.ycl.jxkg.domain.task.TaskItemAnswerObject; |
| | | import com.ycl.jxkg.repository.TaskExamCustomerAnswerMapper; |
| | | import com.ycl.jxkg.mapper.TaskExamCustomerAnswerMapper; |
| | | import com.ycl.jxkg.service.TaskExamCustomerAnswerService; |
| | | import com.ycl.jxkg.service.TextContentService; |
| | | import com.ycl.jxkg.utility.JsonUtil; |
| | | import com.ycl.jxkg.utils.JsonUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | taskExamCustomerAnswer.setCreateTime(now); |
| | | taskExamCustomerAnswer.setCreateUser(userId); |
| | | taskExamCustomerAnswer.setTaskExamId(taskId); |
| | | List<TaskItemAnswerObject> taskItemAnswerObjects = Arrays.asList(new TaskItemAnswerObject(examPaperAnswer.getExamPaperId(), examPaperAnswer.getId(), examPaperAnswer.getStatus())); |
| | | TaskItemAnswerObject taskItemAnswerObject = new TaskItemAnswerObject(); |
| | | taskItemAnswerObject.setExamPaperId(examPaperAnswer.getExamPaperId()); |
| | | taskItemAnswerObject.setExamPaperAnswerId(examPaperAnswer.getId()); |
| | | taskItemAnswerObject.setStatus(examPaperAnswer.getStatus()); |
| | | List<TaskItemAnswerObject> taskItemAnswerObjects = Arrays.asList(taskItemAnswerObject); |
| | | TextContent textContent = textContentService.jsonConvertInsert(taskItemAnswerObjects, now, null); |
| | | textContentService.insertByFilter(textContent); |
| | | taskExamCustomerAnswer.setTextContentId(textContent.getId()); |
| | |
| | | } else { |
| | | TextContent textContent = textContentService.selectById(taskExamCustomerAnswer.getTextContentId()); |
| | | List<TaskItemAnswerObject> taskItemAnswerObjects = JsonUtil.toJsonListObject(textContent.getContent(), TaskItemAnswerObject.class); |
| | | taskItemAnswerObjects.add(new TaskItemAnswerObject(examPaperAnswer.getExamPaperId(), examPaperAnswer.getId(), examPaperAnswer.getStatus())); |
| | | TaskItemAnswerObject taskItemAnswerObject = new TaskItemAnswerObject(); |
| | | taskItemAnswerObject.setExamPaperId(examPaperAnswer.getExamPaperId()); |
| | | taskItemAnswerObject.setExamPaperAnswerId(examPaperAnswer.getId()); |
| | | taskItemAnswerObject.setStatus(examPaperAnswer.getStatus()); |
| | | taskItemAnswerObjects.add(taskItemAnswerObject); |
| | | textContentService.jsonConvertUpdate(textContent, taskItemAnswerObjects, null); |
| | | textContentService.updateByIdFilter(textContent); |
| | | } |
| | |
| | | import com.ycl.jxkg.domain.TextContent; |
| | | import com.ycl.jxkg.domain.User; |
| | | import com.ycl.jxkg.domain.task.TaskItemObject; |
| | | import com.ycl.jxkg.repository.ExamPaperMapper; |
| | | import com.ycl.jxkg.repository.TaskExamMapper; |
| | | import com.ycl.jxkg.mapper.ExamPaperMapper; |
| | | import com.ycl.jxkg.mapper.TaskExamMapper; |
| | | import com.ycl.jxkg.service.TaskExamService; |
| | | import com.ycl.jxkg.service.TextContentService; |
| | | import com.ycl.jxkg.service.enums.ActionEnum; |
| | | import com.ycl.jxkg.utility.DateTimeUtil; |
| | | import com.ycl.jxkg.utility.JsonUtil; |
| | | import com.ycl.jxkg.utility.ModelMapperSingle; |
| | | import com.ycl.jxkg.viewmodel.admin.exam.ExamResponseVM; |
| | | import com.ycl.jxkg.viewmodel.admin.task.TaskPageRequestVM; |
| | | import com.ycl.jxkg.viewmodel.admin.task.TaskRequestVM; |
| | | import com.ycl.jxkg.utils.DateTimeUtil; |
| | | import com.ycl.jxkg.utils.JsonUtil; |
| | | import com.ycl.jxkg.vo.admin.exam.ExamResponseVO; |
| | | import com.ycl.jxkg.vo.admin.task.TaskPageRequestVO; |
| | | import com.ycl.jxkg.vo.admin.task.TaskRequestVO; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import org.modelmapper.ModelMapper; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service |
| | | public class TaskExamServiceImpl extends BaseServiceImpl<TaskExam> implements TaskExamService { |
| | | |
| | | protected final static ModelMapper modelMapper = ModelMapperSingle.Instance(); |
| | | private final TaskExamMapper taskExamMapper; |
| | | private final TextContentService textContentService; |
| | | private final ExamPaperMapper examPaperMapper; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public PageInfo<TaskExam> page(TaskPageRequestVM requestVM) { |
| | | public PageInfo<TaskExam> page(TaskPageRequestVO requestVM) { |
| | | return PageHelper.startPage(requestVM.getPageIndex(), requestVM.getPageSize(), "id desc").doSelectPageInfo(() -> |
| | | taskExamMapper.page(requestVM) |
| | | ); |
| | |
| | | |
| | | @Override |
| | | @Transactional |
| | | public void edit(TaskRequestVM model, User user) { |
| | | public void edit(TaskRequestVO model, User user) { |
| | | ActionEnum actionEnum = (model.getId() == null) ? ActionEnum.ADD : ActionEnum.UPDATE; |
| | | TaskExam taskExam = null; |
| | | TaskExam taskExam = new TaskExam(); |
| | | |
| | | if (actionEnum == ActionEnum.ADD) { |
| | | BeanUtils.copyProperties(model, taskExam); |
| | | Date now = new Date(); |
| | | taskExam = modelMapper.map(model, TaskExam.class); |
| | | taskExam.setCreateUser(user.getId()); |
| | | taskExam.setCreateUserName(user.getUserName()); |
| | | taskExam.setCreateTime(now); |
| | |
| | | taskExamMapper.insertSelective(taskExam); |
| | | |
| | | } else { |
| | | taskExam = taskExamMapper.selectByPrimaryKey(model.getId()); |
| | | modelMapper.map(model, taskExam); |
| | | |
| | | TaskExam old = taskExamMapper.selectByPrimaryKey(model.getId()); |
| | | if (Objects.isNull(old)) { |
| | | throw new RuntimeException("数据不存在"); |
| | | } |
| | | BeanUtils.copyProperties(taskExam, old); |
| | | TextContent textContent = textContentService.selectById(taskExam.getFrameTextContentId()); |
| | | //清空试卷任务的试卷Id,后面会统一设置 |
| | | List<Integer> paperIds = JsonUtil.toJsonListObject(textContent.getContent(), TaskItemObject.class) |
| | |
| | | return taskItemObject; |
| | | }); |
| | | textContentService.updateByIdFilter(textContent); |
| | | taskExamMapper.updateByPrimaryKeySelective(taskExam); |
| | | taskExamMapper.updateByPrimaryKeySelective(old); |
| | | } |
| | | |
| | | //更新试卷的taskId |
| | |
| | | } |
| | | |
| | | @Override |
| | | public TaskRequestVM taskExamToVM(Integer id) { |
| | | public TaskRequestVO taskExamToVM(Integer id) { |
| | | TaskExam taskExam = taskExamMapper.selectByPrimaryKey(id); |
| | | TaskRequestVM vm = modelMapper.map(taskExam, TaskRequestVM.class); |
| | | TaskRequestVO vo = new TaskRequestVO(); |
| | | BeanUtils.copyProperties(taskExam, vo); |
| | | TextContent textContent = textContentService.selectById(taskExam.getFrameTextContentId()); |
| | | List<ExamResponseVM> examResponseVMS = JsonUtil.toJsonListObject(textContent.getContent(), TaskItemObject.class).stream().map(tk -> { |
| | | List<ExamResponseVO> examResponseVOS = JsonUtil.toJsonListObject(textContent.getContent(), TaskItemObject.class).stream().map(tk -> { |
| | | ExamPaper examPaper = examPaperMapper.selectByPrimaryKey(tk.getExamPaperId()); |
| | | ExamResponseVM examResponseVM = modelMapper.map(examPaper, ExamResponseVM.class); |
| | | examResponseVM.setCreateTime(DateTimeUtil.dateFormat(examPaper.getCreateTime())); |
| | | return examResponseVM; |
| | | ExamResponseVO examResponseVO = new ExamResponseVO(); |
| | | BeanUtils.copyProperties(examPaper, examResponseVO); |
| | | examResponseVO.setCreateTime(DateTimeUtil.dateFormat(examPaper.getCreateTime())); |
| | | return examResponseVO; |
| | | }).collect(Collectors.toList()); |
| | | vm.setPaperItems(examResponseVMS); |
| | | return vm; |
| | | vo.setPaperItems(examResponseVOS); |
| | | return vo; |
| | | } |
| | | |
| | | @Override |
| | |
| | | package com.ycl.jxkg.service.impl; |
| | | |
| | | import com.ycl.jxkg.domain.TextContent; |
| | | import com.ycl.jxkg.repository.TextContentMapper; |
| | | import com.ycl.jxkg.mapper.TextContentMapper; |
| | | import com.ycl.jxkg.service.TextContentService; |
| | | import com.ycl.jxkg.utility.JsonUtil; |
| | | import com.ycl.jxkg.utils.JsonUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | List<R> mapList = list.stream().map(mapper).collect(Collectors.toList()); |
| | | frameTextContent = JsonUtil.toJsonStr(mapList); |
| | | } |
| | | TextContent textContent = new TextContent(frameTextContent, now); |
| | | TextContent textContent = new TextContent(); |
| | | textContent.setContent(frameTextContent); |
| | | textContent.setCreateTime(now); |
| | | return textContent; |
| | | } |
| | | |
| | |
| | | |
| | | import com.ycl.jxkg.domain.UserEventLog; |
| | | import com.ycl.jxkg.domain.other.KeyValue; |
| | | import com.ycl.jxkg.repository.UserEventLogMapper; |
| | | import com.ycl.jxkg.mapper.UserEventLogMapper; |
| | | import com.ycl.jxkg.service.UserEventLogService; |
| | | import com.ycl.jxkg.utility.DateTimeUtil; |
| | | import com.ycl.jxkg.viewmodel.admin.user.UserEventPageRequestVM; |
| | | import com.ycl.jxkg.utils.DateTimeUtil; |
| | | import com.ycl.jxkg.vo.admin.user.UserEventPageRequestVO; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public PageInfo<UserEventLog> page(UserEventPageRequestVM requestVM) { |
| | | public PageInfo<UserEventLog> page(UserEventPageRequestVO requestVM) { |
| | | return PageHelper.startPage(requestVM.getPageIndex(), requestVM.getPageSize(), "id desc").doSelectPageInfo(() -> |
| | | userEventLogMapper.page(requestVM) |
| | | ); |
| | |
| | | import com.ycl.jxkg.exception.BusinessException; |
| | | import com.ycl.jxkg.domain.User; |
| | | import com.ycl.jxkg.event.OnRegistrationCompleteEvent; |
| | | import com.ycl.jxkg.repository.UserMapper; |
| | | import com.ycl.jxkg.mapper.UserMapper; |
| | | import com.ycl.jxkg.service.UserService; |
| | | import com.ycl.jxkg.viewmodel.admin.user.UserPageRequestVM; |
| | | import com.ycl.jxkg.vo.admin.user.UserPageRequestVO; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | |
| | | |
| | | @Override |
| | | public PageInfo<User> userPage(UserPageRequestVM requestVM) { |
| | | public PageInfo<User> userPage(UserPageRequestVO requestVM) { |
| | | return PageHelper.startPage(requestVM.getPageIndex(), requestVM.getPageSize(), "id desc").doSelectPageInfo(() -> |
| | | userMapper.userPage(requestVM) |
| | | ); |
| | |
| | | package com.ycl.jxkg.service.impl; |
| | | |
| | | import com.ycl.jxkg.configuration.property.SystemConfig; |
| | | import com.ycl.jxkg.config.property.SystemConfig; |
| | | import com.ycl.jxkg.domain.User; |
| | | import com.ycl.jxkg.domain.UserToken; |
| | | import com.ycl.jxkg.repository.UserTokenMapper; |
| | | import com.ycl.jxkg.mapper.UserTokenMapper; |
| | | import com.ycl.jxkg.service.UserService; |
| | | import com.ycl.jxkg.service.UserTokenService; |
| | | import com.ycl.jxkg.utility.DateTimeUtil; |
| | | import com.ycl.jxkg.utils.DateTimeUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
File was renamed from src/main/java/com/ycl/jxkg/utility/DateTimeUtil.java |
| | |
| | | package com.ycl.jxkg.utility; |
| | | package com.ycl.jxkg.utils; |
| | | |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
File was renamed from src/main/java/com/ycl/jxkg/utility/ErrorUtil.java |
| | |
| | | package com.ycl.jxkg.utility; |
| | | package com.ycl.jxkg.utils; |
| | | |
| | | |
| | | /** |
File was renamed from src/main/java/com/ycl/jxkg/utility/ExamUtil.java |
| | |
| | | package com.ycl.jxkg.utility; |
| | | package com.ycl.jxkg.utils; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
File was renamed from src/main/java/com/ycl/jxkg/utility/HtmlUtil.java |
| | |
| | | package com.ycl.jxkg.utility; |
| | | package com.ycl.jxkg.utils; |
| | | |
| | | import java.util.regex.Matcher; |
| | | import java.util.regex.Pattern; |
File was renamed from src/main/java/com/ycl/jxkg/utility/JsonUtil.java |
| | |
| | | package com.ycl.jxkg.utility; |
| | | package com.ycl.jxkg.utils; |
| | | |
| | | import com.fasterxml.jackson.core.JsonProcessingException; |
| | | import com.fasterxml.jackson.databind.DeserializationFeature; |
File was renamed from src/main/java/com/ycl/jxkg/utility/PageInfoHelper.java |
| | |
| | | package com.ycl.jxkg.utility; |
| | | package com.ycl.jxkg.utils; |
| | | |
| | | import com.github.pagehelper.PageInfo; |
| | | |
File was renamed from src/main/java/com/ycl/jxkg/utility/RsaUtil.java |
| | |
| | | package com.ycl.jxkg.utility; |
| | | package com.ycl.jxkg.utils; |
| | | |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
File was renamed from src/main/java/com/ycl/jxkg/utility/WxResponse.java |
| | |
| | | package com.ycl.jxkg.utility; |
| | | package com.ycl.jxkg.utils; |
| | | |
| | | |
| | | import java.io.Serializable; |
File was renamed from src/main/java/com/ycl/jxkg/utility/WxUtil.java |
| | |
| | | package com.ycl.jxkg.utility; |
| | | package com.ycl.jxkg.utils; |
| | | |
| | | |
| | | import org.apache.http.HttpEntity; |
New file |
| | |
| | | package com.ycl.jxkg.vo.admin.dashboard; |
| | | |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class IndexVO { |
| | | |
| | | private Integer examPaperCount; |
| | | |
| | | private Integer questionCount; |
| | | |
| | | private Integer doExamPaperCount; |
| | | |
| | | private Integer doQuestionCount; |
| | | |
| | | private List<Integer> mothDayUserActionValue; |
| | | |
| | | private List<Integer> mothDayDoExamQuestionValue; |
| | | |
| | | private List<String> mothDayText; |
| | | |
| | | } |
New file |
| | |
| | | package com.ycl.jxkg.vo.admin.education; |
| | | |
| | | import lombok.Data; |
| | | |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotNull; |
| | | |
| | | @Data |
| | | public class SubjectEditRequestVO { |
| | | |
| | | private Integer id; |
| | | |
| | | @NotBlank |
| | | private String name; |
| | | |
| | | @NotNull |
| | | private Integer level; |
| | | |
| | | @NotBlank |
| | | private String levelName; |
| | | |
| | | } |
New file |
| | |
| | | package com.ycl.jxkg.vo.admin.education; |
| | | |
| | | import com.ycl.jxkg.base.BasePage; |
| | | import lombok.Data; |
| | | |
| | | |
| | | @Data |
| | | public class SubjectPageRequestVO extends BasePage { |
| | | |
| | | private Integer id; |
| | | |
| | | private Integer level; |
| | | |
| | | } |
New file |
| | |
| | | package com.ycl.jxkg.vo.admin.education; |
| | | |
| | | import lombok.Data; |
| | | |
| | | |
| | | @Data |
| | | public class SubjectResponseVO { |
| | | |
| | | private Integer id; |
| | | |
| | | private String name; |
| | | |
| | | private Integer level; |
| | | |
| | | private String levelName; |
| | | |
| | | } |
New file |
| | |
| | | package com.ycl.jxkg.vo.admin.exam; |
| | | |
| | | |
| | | |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.Valid; |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotNull; |
| | | import javax.validation.constraints.Size; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class ExamPaperEditRequestVO { |
| | | |
| | | private Integer id; |
| | | |
| | | @NotNull |
| | | private Integer level; |
| | | |
| | | @NotNull |
| | | private Integer subjectId; |
| | | |
| | | @NotNull |
| | | private Integer paperType; |
| | | |
| | | @NotBlank |
| | | private String name; |
| | | |
| | | @NotNull |
| | | private Integer suggestTime; |
| | | |
| | | private List<String> limitDateTime; |
| | | |
| | | @Size(min = 1,message = "请添加试卷标题") |
| | | @Valid |
| | | private List<ExamPaperTitleItemVO> titleItems; |
| | | |
| | | private String score; |
| | | |
| | | } |
New file |
| | |
| | | package com.ycl.jxkg.vo.admin.exam; |
| | | |
| | | import com.ycl.jxkg.base.BasePage; |
| | | import lombok.Data; |
| | | |
| | | |
| | | @Data |
| | | public class ExamPaperPageRequestVO extends BasePage { |
| | | |
| | | private Integer id; |
| | | |
| | | private Integer subjectId; |
| | | |
| | | private Integer level; |
| | | |
| | | private Integer paperType; |
| | | |
| | | private Integer taskExamId; |
| | | |
| | | } |
New file |
| | |
| | | package com.ycl.jxkg.vo.admin.exam; |
| | | |
| | | import com.ycl.jxkg.vo.admin.question.QuestionEditRequestVO; |
| | | import lombok.Data; |
| | | |
| | | |
| | | import javax.validation.Valid; |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.Size; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class ExamPaperTitleItemVO { |
| | | |
| | | @NotBlank(message = "标题内容不能为空") |
| | | private String name; |
| | | |
| | | @Size(min = 1,message = "请添加题目") |
| | | @Valid |
| | | private List<QuestionEditRequestVO> questionItems; |
| | | |
| | | } |
New file |
| | |
| | | package com.ycl.jxkg.vo.admin.exam; |
| | | |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class ExamResponseVO { |
| | | |
| | | private Integer id; |
| | | |
| | | private String name; |
| | | |
| | | private Integer questionCount; |
| | | |
| | | private Integer score; |
| | | |
| | | private String createTime; |
| | | |
| | | private Integer createUser; |
| | | |
| | | private Integer subjectId; |
| | | |
| | | private Integer paperType; |
| | | |
| | | private Integer frameTextContentId; |
| | | |
| | | } |
New file |
| | |
| | | package com.ycl.jxkg.vo.admin.file; |
| | | |
| | | |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class UeditorConfigVO { |
| | | |
| | | private String imageActionName; |
| | | |
| | | private String imageFieldName; |
| | | |
| | | private Long imageMaxSize; |
| | | |
| | | private List<String> imageAllowFiles; |
| | | |
| | | private boolean imageCompressEnable; |
| | | |
| | | private Integer imageCompressBorder; |
| | | |
| | | private String imageInsertAlign; |
| | | |
| | | private String imageUrlPrefix; |
| | | |
| | | private String imagePathFormat; |
| | | |
| | | } |
New file |
| | |
| | | package com.ycl.jxkg.vo.admin.file; |
| | | |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class UploadResultVO { |
| | | |
| | | private String original; |
| | | |
| | | private String name; |
| | | |
| | | private String url; |
| | | |
| | | private Long size; |
| | | |
| | | private String type; |
| | | |
| | | private String state; |
| | | |
| | | } |
New file |
| | |
| | | package com.ycl.jxkg.vo.admin.message; |
| | | |
| | | import com.ycl.jxkg.base.BasePage; |
| | | import lombok.Data; |
| | | |
| | | |
| | | @Data |
| | | public class MessagePageRequestVO extends BasePage { |
| | | |
| | | private String sendUserName; |
| | | |
| | | } |
New file |
| | |
| | | package com.ycl.jxkg.vo.admin.message; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class MessageResponseVO { |
| | | |
| | | private Integer id; |
| | | |
| | | private String title; |
| | | |
| | | private String content; |
| | | |
| | | private String sendUserName; |
| | | |
| | | private String receives; |
| | | |
| | | private Integer receiveUserCount; |
| | | |
| | | private Integer readCount; |
| | | |
| | | private String createTime; |
| | | |
| | | } |
New file |
| | |
| | | package com.ycl.jxkg.vo.admin.message; |
| | | |
| | | |
| | | |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.Size; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class MessageSendVO { |
| | | |
| | | @NotBlank |
| | | private String title; |
| | | |
| | | @NotBlank |
| | | private String content; |
| | | |
| | | @Size(min = 1, message = "接收人不能为空") |
| | | private List<Integer> receiveUserIds; |
| | | |
| | | } |
New file |
| | |
| | | package com.ycl.jxkg.vo.admin.paper; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class ExamAnswerResponseVO { |
| | | |
| | | private Integer id; |
| | | |
| | | private String name; |
| | | |
| | | private Integer questionCount; |
| | | |
| | | private Integer score; |
| | | |
| | | private String createTime; |
| | | |
| | | private Integer createUser; |
| | | |
| | | private Integer subjectId; |
| | | |
| | | private Integer paperType; |
| | | |
| | | private Integer frameTextContentId; |
| | | |
| | | } |
New file |
| | |
| | | package com.ycl.jxkg.vo.admin.paper; |
| | | |
| | | import com.ycl.jxkg.base.BasePage; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class ExamPaperAnswerPageRequestVO extends BasePage { |
| | | |
| | | private Integer subjectId; |
| | | |
| | | } |
New file |
| | |
| | | package com.ycl.jxkg.vo.admin.question; |
| | | |
| | | |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | |
| | | @Data |
| | | public class QuestionEditItemVO { |
| | | |
| | | @NotBlank |
| | | private String prefix; |
| | | |
| | | @NotBlank |
| | | private String content; |
| | | |
| | | private String score; |
| | | |
| | | private String itemUuid; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ycl.jxkg.vo.admin.question; |
| | | |
| | | |
| | | import lombok.Data; |
| | | import org.hibernate.validator.constraints.Range; |
| | | |
| | | import javax.validation.Valid; |
| | | import javax.validation.constraints.*; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class QuestionEditRequestVO { |
| | | |
| | | private Integer id; |
| | | |
| | | @NotNull |
| | | private Integer questionType; |
| | | |
| | | @NotNull |
| | | private Integer subjectId; |
| | | |
| | | @NotBlank |
| | | private String title; |
| | | |
| | | private Integer gradeLevel; |
| | | |
| | | @Valid |
| | | private List<QuestionEditItemVO> items; |
| | | |
| | | @NotBlank |
| | | private String analyze; |
| | | |
| | | private List<String> correctArray; |
| | | |
| | | private String correct; |
| | | |
| | | @NotBlank |
| | | private String score; |
| | | |
| | | @Range(min = 1, max = 5, message = "请选择题目难度") |
| | | private Integer difficult; |
| | | |
| | | private Integer itemOrder; |
| | | |
| | | } |
New file |
| | |
| | | package com.ycl.jxkg.vo.admin.question; |
| | | |
| | | import com.ycl.jxkg.base.BasePage; |
| | | import lombok.Data; |
| | | |
| | | |
| | | @Data |
| | | public class QuestionPageRequestVO extends BasePage { |
| | | |
| | | private Integer id; |
| | | |
| | | private Integer level; |
| | | |
| | | private Integer subjectId; |
| | | |
| | | private Integer questionType; |
| | | |
| | | private String content; |
| | | |
| | | } |
New file |
| | |
| | | package com.ycl.jxkg.vo.admin.question; |
| | | |
| | | import lombok.Data; |
| | | |
| | | |
| | | @Data |
| | | public class QuestionResponseVO { |
| | | |
| | | private Integer id; |
| | | |
| | | private Integer questionType; |
| | | |
| | | private Integer textContentId; |
| | | |
| | | private String createTime; |
| | | |
| | | private Integer subjectId; |
| | | |
| | | private Integer createUser; |
| | | |
| | | private String score; |
| | | |
| | | private Integer status; |
| | | |
| | | private String correct; |
| | | |
| | | private Integer analyzeTextContentId; |
| | | |
| | | private Integer difficult; |
| | | |
| | | private String shortTitle; |
| | | |
| | | } |
New file |
| | |
| | | package com.ycl.jxkg.vo.admin.task; |
| | | |
| | | import com.ycl.jxkg.base.BasePage; |
| | | import lombok.Data; |
| | | |
| | | |
| | | @Data |
| | | public class TaskPageRequestVO extends BasePage { |
| | | |
| | | private Integer gradeLevel; |
| | | |
| | | } |
New file |
| | |
| | | package com.ycl.jxkg.vo.admin.task; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class TaskPageResponseVO { |
| | | |
| | | private Integer id; |
| | | |
| | | private String title; |
| | | |
| | | private Integer gradeLevel; |
| | | |
| | | private String createUserName; |
| | | |
| | | private String createTime; |
| | | |
| | | private Boolean deleted; |
| | | |
| | | } |
New file |
| | |
| | | package com.ycl.jxkg.vo.admin.task; |
| | | |
| | | import com.ycl.jxkg.vo.admin.exam.ExamResponseVO; |
| | | import lombok.Data; |
| | | |
| | | |
| | | import javax.validation.Valid; |
| | | import javax.validation.constraints.NotNull; |
| | | import javax.validation.constraints.Size; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class TaskRequestVO { |
| | | |
| | | private Integer id; |
| | | |
| | | @NotNull |
| | | private Integer gradeLevel; |
| | | |
| | | @NotNull |
| | | private String title; |
| | | |
| | | @Size(min = 1, message = "请添加试卷") |
| | | @Valid |
| | | private List<ExamResponseVO> paperItems; |
| | | |
| | | } |
New file |
| | |
| | | package com.ycl.jxkg.vo.admin.user; |
| | | |
| | | |
| | | |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | |
| | | @Data |
| | | public class UserCreateVO { |
| | | |
| | | private Integer id; |
| | | |
| | | @NotBlank |
| | | private String userName; |
| | | |
| | | private String password; |
| | | |
| | | @NotBlank |
| | | private String realName; |
| | | |
| | | private String age; |
| | | |
| | | private Integer status; |
| | | |
| | | private Integer sex; |
| | | |
| | | private String birthDay; |
| | | |
| | | private String phone; |
| | | |
| | | private Integer role; |
| | | |
| | | private Integer userLevel; |
| | | |
| | | } |
New file |
| | |
| | | package com.ycl.jxkg.vo.admin.user; |
| | | |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class UserEventLogVO { |
| | | |
| | | private Integer id; |
| | | |
| | | private Integer userId; |
| | | |
| | | private String userName; |
| | | |
| | | private String realName; |
| | | |
| | | private String content; |
| | | |
| | | private String createTime; |
| | | |
| | | } |
New file |
| | |
| | | package com.ycl.jxkg.vo.admin.user; |
| | | |
| | | import com.ycl.jxkg.base.BasePage; |
| | | import lombok.Data; |
| | | |
| | | |
| | | @Data |
| | | public class UserEventPageRequestVO extends BasePage { |
| | | |
| | | private Integer userId; |
| | | |
| | | private String userName; |
| | | |
| | | } |
New file |
| | |
| | | package com.ycl.jxkg.vo.admin.user; |
| | | |
| | | import com.ycl.jxkg.base.BasePage; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class UserPageRequestVO extends BasePage { |
| | | |
| | | private String userName; |
| | | |
| | | private Integer role; |
| | | |
| | | } |
New file |
| | |
| | | package com.ycl.jxkg.vo.admin.user; |
| | | |
| | | import com.ycl.jxkg.domain.User; |
| | | import com.ycl.jxkg.utils.DateTimeUtil; |
| | | import lombok.Data; |
| | | import org.springframework.beans.BeanUtils; |
| | | |
| | | @Data |
| | | public class UserResponseVO { |
| | | |
| | | private Integer id; |
| | | |
| | | private String userUuid; |
| | | |
| | | private String userName; |
| | | |
| | | private String realName; |
| | | |
| | | private Integer age; |
| | | |
| | | private Integer role; |
| | | |
| | | private Integer sex; |
| | | |
| | | private String birthDay; |
| | | |
| | | private String phone; |
| | | |
| | | private String lastActiveTime; |
| | | |
| | | private String createTime; |
| | | |
| | | private String modifyTime; |
| | | |
| | | private Integer status; |
| | | |
| | | private Integer userLevel; |
| | | |
| | | private String imagePath; |
| | | |
| | | public static UserResponseVO from(User user) { |
| | | UserResponseVO vo = new UserResponseVO(); |
| | | BeanUtils.copyProperties(user, vo); |
| | | vo.setBirthDay(DateTimeUtil.dateFormat(user.getBirthDay())); |
| | | vo.setLastActiveTime(DateTimeUtil.dateFormat(user.getLastActiveTime())); |
| | | vo.setCreateTime(DateTimeUtil.dateFormat(user.getCreateTime())); |
| | | vo.setModifyTime(DateTimeUtil.dateFormat(user.getModifyTime())); |
| | | return vo; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ycl.jxkg.vo.admin.user; |
| | | |
| | | |
| | | |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | |
| | | @Data |
| | | public class UserUpdateVO { |
| | | |
| | | @NotBlank |
| | | private String realName; |
| | | |
| | | @NotBlank |
| | | private String phone; |
| | | |
| | | } |
New file |
| | |
| | | package com.ycl.jxkg.vo.student.dashboard; |
| | | |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class IndexVO { |
| | | |
| | | private List<PaperInfo> fixedPaper; |
| | | |
| | | private List<PaperInfoVO> timeLimitPaper; |
| | | |
| | | private List<PaperInfo> pushPaper; |
| | | |
| | | } |
New file |
| | |
| | | package com.ycl.jxkg.vo.student.dashboard; |
| | | |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | public class PaperFilter { |
| | | |
| | | private Integer userId; |
| | | |
| | | private Date dateTime; |
| | | |
| | | private Integer examPaperType; |
| | | |
| | | private Integer gradeLevel; |
| | | |
| | | } |
New file |
| | |
| | | package com.ycl.jxkg.vo.student.dashboard; |
| | | |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | public class PaperInfo { |
| | | |
| | | private Integer id; |
| | | |
| | | private String name; |
| | | |
| | | private Date limitStartTime; |
| | | |
| | | private Date limitEndTime; |
| | | |
| | | } |
New file |
| | |
| | | package com.ycl.jxkg.vo.student.dashboard; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class PaperInfoVO extends PaperInfo { |
| | | |
| | | private String startTime; |
| | | |
| | | private String endTime; |
| | | |
| | | } |
New file |
| | |
| | | package com.ycl.jxkg.vo.student.dashboard; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class TaskItemPaperVO { |
| | | |
| | | private Integer examPaperId; |
| | | |
| | | private String examPaperName; |
| | | |
| | | private Integer examPaperAnswerId; |
| | | |
| | | private Integer status; |
| | | |
| | | } |
New file |
| | |
| | | package com.ycl.jxkg.vo.student.dashboard; |
| | | |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class TaskItemVO { |
| | | |
| | | private Integer id; |
| | | |
| | | private String title; |
| | | |
| | | private List<TaskItemPaperVO> paperItems; |
| | | |
| | | } |
New file |
| | |
| | | package com.ycl.jxkg.vo.student.education; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotNull; |
| | | |
| | | @Data |
| | | public class SubjectEditRequestVO { |
| | | |
| | | private Integer id; |
| | | |
| | | @NotBlank |
| | | private String name; |
| | | |
| | | @NotNull |
| | | private Integer level; |
| | | |
| | | @NotBlank |
| | | private String levelName; |
| | | |
| | | } |
New file |
| | |
| | | package com.ycl.jxkg.vo.student.education; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class SubjectVO { |
| | | |
| | | private String id; |
| | | |
| | | private String name; |
| | | |
| | | } |
New file |
| | |
| | | package com.ycl.jxkg.vo.student.exam; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class ExamPaperPageResponseVO { |
| | | |
| | | private Integer id; |
| | | |
| | | private String name; |
| | | |
| | | private Integer questionCount; |
| | | |
| | | private Integer score; |
| | | |
| | | private String createTime; |
| | | |
| | | private Integer createUser; |
| | | |
| | | private Integer subjectId; |
| | | |
| | | private String subjectName; |
| | | |
| | | private Integer paperType; |
| | | |
| | | private Integer frameTextContentId; |
| | | |
| | | } |
New file |
| | |
| | | package com.ycl.jxkg.vo.student.exam; |
| | | |
| | | import com.ycl.jxkg.base.BasePage; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotNull; |
| | | |
| | | @Data |
| | | public class ExamPaperPageVO extends BasePage { |
| | | |
| | | @NotNull |
| | | private Integer paperType; |
| | | |
| | | private Integer subjectId; |
| | | |
| | | private Integer levelId; |
| | | |
| | | } |
New file |
| | |
| | | package com.ycl.jxkg.vo.student.exam; |
| | | |
| | | import com.ycl.jxkg.vo.admin.exam.ExamPaperEditRequestVO; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class ExamPaperReadVO { |
| | | |
| | | private ExamPaperEditRequestVO paper; |
| | | |
| | | private ExamPaperSubmitVO answer; |
| | | |
| | | } |
New file |
| | |
| | | package com.ycl.jxkg.vo.student.exam; |
| | | |
| | | |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotNull; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class ExamPaperSubmitItemVO { |
| | | |
| | | private Integer id; |
| | | |
| | | @NotNull |
| | | private Integer questionId; |
| | | |
| | | private Boolean doRight; |
| | | |
| | | private String content; |
| | | |
| | | private Integer itemOrder; |
| | | |
| | | private List<String> contentArray; |
| | | |
| | | private String score; |
| | | |
| | | private String questionScore; |
| | | |
| | | } |
New file |
| | |
| | | package com.ycl.jxkg.vo.student.exam; |
| | | |
| | | |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.Valid; |
| | | import javax.validation.constraints.NotNull; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class ExamPaperSubmitVO { |
| | | |
| | | @NotNull |
| | | private Integer id; |
| | | |
| | | @NotNull |
| | | private Integer doTime; |
| | | |
| | | private String score; |
| | | |
| | | @NotNull |
| | | @Valid |
| | | private List<ExamPaperSubmitItemVO> answerItems; |
| | | |
| | | } |
New file |
| | |
| | | package com.ycl.jxkg.vo.student.exampaper; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class ExamPaperAnswerPageResponseVO { |
| | | |
| | | private Integer id; |
| | | |
| | | private String createTime; |
| | | |
| | | private String userScore; |
| | | |
| | | private String subjectName; |
| | | |
| | | private Integer subjectId; |
| | | |
| | | private Integer questionCount; |
| | | |
| | | private Integer questionCorrect; |
| | | |
| | | private String paperScore; |
| | | |
| | | private String doTime; |
| | | |
| | | private Integer paperType; |
| | | |
| | | private String systemScore; |
| | | |
| | | private Integer status; |
| | | |
| | | private String paperName; |
| | | |
| | | private String userName; |
| | | |
| | | } |
New file |
| | |
| | | package com.ycl.jxkg.vo.student.exampaper; |
| | | |
| | | import com.ycl.jxkg.base.BasePage; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class ExamPaperAnswerPageVO extends BasePage { |
| | | |
| | | private Integer subjectId; |
| | | |
| | | private Integer createUser; |
| | | |
| | | } |
New file |
| | |
| | | package com.ycl.jxkg.vo.student.question.answer; |
| | | |
| | | import com.ycl.jxkg.vo.admin.question.QuestionEditRequestVO; |
| | | import com.ycl.jxkg.vo.student.exam.ExamPaperSubmitItemVO; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class QuestionAnswerVO { |
| | | |
| | | private QuestionEditRequestVO questionVM; |
| | | |
| | | private ExamPaperSubmitItemVO questionAnswerVM; |
| | | |
| | | } |
New file |
| | |
| | | package com.ycl.jxkg.vo.student.question.answer; |
| | | |
| | | import com.ycl.jxkg.base.BasePage; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class QuestionPageStudentRequestVO extends BasePage { |
| | | |
| | | private Integer createUser; |
| | | |
| | | } |
New file |
| | |
| | | package com.ycl.jxkg.vo.student.question.answer; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class QuestionPageStudentResponseVO { |
| | | |
| | | private Integer id; |
| | | |
| | | private Integer questionType; |
| | | |
| | | private String createTime; |
| | | |
| | | private String subjectName; |
| | | |
| | | private String shortTitle; |
| | | |
| | | } |
New file |
| | |
| | | package com.ycl.jxkg.vo.student.user; |
| | | |
| | | import com.ycl.jxkg.base.BasePage; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class MessageRequestVO extends BasePage { |
| | | |
| | | private Integer receiveUserId; |
| | | |
| | | } |
New file |
| | |
| | | package com.ycl.jxkg.vo.student.user; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class MessageResponseVO { |
| | | |
| | | private Integer id; |
| | | |
| | | private String title; |
| | | |
| | | private Integer messageId; |
| | | |
| | | private String content; |
| | | |
| | | private Boolean readed; |
| | | |
| | | private String createTime; |
| | | |
| | | private String sendUserName; |
| | | |
| | | } |
New file |
| | |
| | | package com.ycl.jxkg.vo.student.user; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class UserEventLogVO { |
| | | |
| | | private Integer id; |
| | | |
| | | private Integer userId; |
| | | |
| | | private String userName; |
| | | |
| | | private String realName; |
| | | |
| | | private String content; |
| | | |
| | | private String createTime; |
| | | |
| | | } |
New file |
| | |
| | | package com.ycl.jxkg.vo.student.user; |
| | | |
| | | |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotNull; |
| | | |
| | | @Data |
| | | public class UserRegisterVO { |
| | | |
| | | @NotBlank |
| | | private String userName; |
| | | |
| | | @NotBlank |
| | | private String password; |
| | | |
| | | @NotNull |
| | | private Integer userLevel; |
| | | |
| | | } |
New file |
| | |
| | | package com.ycl.jxkg.vo.student.user; |
| | | |
| | | import com.ycl.jxkg.domain.User; |
| | | import com.ycl.jxkg.utils.DateTimeUtil; |
| | | import lombok.Data; |
| | | import org.springframework.beans.BeanUtils; |
| | | |
| | | @Data |
| | | public class UserResponseVO { |
| | | |
| | | private Integer id; |
| | | |
| | | private String userUuid; |
| | | |
| | | private String userName; |
| | | |
| | | private String realName; |
| | | |
| | | private Integer age; |
| | | |
| | | private Integer role; |
| | | |
| | | private Integer sex; |
| | | |
| | | private String birthDay; |
| | | |
| | | private String phone; |
| | | |
| | | private String lastActiveTime; |
| | | |
| | | private String createTime; |
| | | |
| | | private String modifyTime; |
| | | |
| | | private Integer status; |
| | | |
| | | private Integer userLevel; |
| | | |
| | | private String imagePath; |
| | | |
| | | public static UserResponseVO from(User user) { |
| | | UserResponseVO vo = new UserResponseVO(); |
| | | BeanUtils.copyProperties(user, vo); |
| | | vo.setBirthDay(DateTimeUtil.dateFormat(user.getBirthDay())); |
| | | vo.setLastActiveTime(DateTimeUtil.dateFormat(user.getLastActiveTime())); |
| | | vo.setCreateTime(DateTimeUtil.dateFormat(user.getCreateTime())); |
| | | vo.setModifyTime(DateTimeUtil.dateFormat(user.getModifyTime())); |
| | | return vo; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ycl.jxkg.vo.student.user; |
| | | |
| | | |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotNull; |
| | | |
| | | @Data |
| | | public class UserUpdateVO { |
| | | |
| | | @NotBlank |
| | | private String realName; |
| | | |
| | | private String age; |
| | | |
| | | private Integer sex; |
| | | |
| | | private String birthDay; |
| | | |
| | | private String phone; |
| | | |
| | | @NotNull |
| | | private Integer userLevel; |
| | | |
| | | } |
New file |
| | |
| | | package com.ycl.jxkg.vo.wx.student.user; |
| | | |
| | | |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | |
| | | @Data |
| | | public class BindInfo { |
| | | |
| | | @NotBlank |
| | | private String userName; |
| | | |
| | | @NotBlank |
| | | private String password; |
| | | |
| | | @NotBlank |
| | | private String code; |
| | | |
| | | } |
| | |
| | | config: classpath:logback-spring.xml |
| | | file: xzs |
| | | |
| | | #mybatis |
| | | mybatis: |
| | | mapper-locations: classpath:/mapper/*.xml |
| | | #mybatis plus |
| | | mybatis-plus: |
| | | global-config: |
| | | db-config: |
| | | logic-delete-field: deleted # 全局指定逻辑删除字段 |
| | | logic-delete-value: 1 # 逻辑删除后的值 |
| | | logic-not-delete-value: 0 # 没有删除的值 |
| | | configuration: |
| | | log-prefix: repository. |
| | | default-enum-type-handler: org.apache.ibatis.type.EnumOrdinalTypeHandler # 通用枚举处理器 |
| | | # log-impl: org.apache.ibatis.logging.stdout.StdOutImpl # 日志打印 |
| | | type-enums-package: com.monkeylessey.enums.general # 通用枚举所在包路径 |
| | | mapper-locations: classpath*:mapper/*.xml # mapper.xml位置 |
| | | |
| | | system: |
| | | security-ignore-urls: |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ycl.jxkg.repository.ExamPaperAnswerMapper"> |
| | | <mapper namespace="com.ycl.jxkg.mapper.ExamPaperAnswerMapper"> |
| | | <resultMap id="BaseResultMap" type="com.ycl.jxkg.domain.ExamPaperAnswer"> |
| | | <id column="id" jdbcType="INTEGER" property="id" /> |
| | | <result column="exam_paper_id" jdbcType="INTEGER" property="examPaperId" /> |
| | |
| | | |
| | | |
| | | |
| | | <select id="studentPage" resultMap="BaseResultMap" parameterType="com.ycl.jxkg.viewmodel.student.exampaper.ExamPaperAnswerPageVM"> |
| | | <select id="studentPage" resultMap="BaseResultMap" parameterType="com.ycl.jxkg.vo.student.exampaper.ExamPaperAnswerPageVO"> |
| | | SELECT |
| | | <include refid="Base_Column_List"/> |
| | | FROM t_exam_paper_answer |
| | |
| | | </select> |
| | | |
| | | |
| | | <select id="adminPage" resultMap="BaseResultMap" parameterType="com.ycl.jxkg.viewmodel.admin.paper.ExamPaperAnswerPageRequestVM"> |
| | | <select id="adminPage" resultMap="BaseResultMap" parameterType="com.ycl.jxkg.vo.admin.paper.ExamPaperAnswerPageRequestVO"> |
| | | SELECT |
| | | <include refid="Base_Column_List"/> |
| | | FROM t_exam_paper_answer |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ycl.jxkg.repository.ExamPaperMapper"> |
| | | <mapper namespace="com.ycl.jxkg.mapper.ExamPaperMapper"> |
| | | <resultMap id="BaseResultMap" type="com.ycl.jxkg.domain.ExamPaper"> |
| | | <id column="id" jdbcType="INTEGER" property="id" /> |
| | | <result column="name" jdbcType="VARCHAR" property="name" /> |
| | |
| | | |
| | | |
| | | |
| | | <resultMap id="PaperInfoResultMap" type="com.ycl.jxkg.viewmodel.student.dashboard.PaperInfo"> |
| | | <resultMap id="PaperInfoResultMap" type="com.ycl.jxkg.vo.student.dashboard.PaperInfo"> |
| | | <id column="id" jdbcType="INTEGER" property="id" /> |
| | | <result column="name" jdbcType="VARCHAR" property="name" /> |
| | | <result column="limit_start_time" jdbcType="TIMESTAMP" property="limitStartTime" /> |
| | |
| | | </resultMap> |
| | | |
| | | |
| | | <select id="page" resultMap="BaseResultMap" parameterType="com.ycl.jxkg.viewmodel.admin.exam.ExamPaperPageRequestVM"> |
| | | <select id="page" resultMap="BaseResultMap" parameterType="com.ycl.jxkg.vo.admin.exam.ExamPaperPageRequestVO"> |
| | | SELECT |
| | | <include refid="Base_Column_List"/> |
| | | FROM t_exam_paper |
| | |
| | | |
| | | |
| | | |
| | | <select id="taskExamPage" resultMap="BaseResultMap" parameterType="com.ycl.jxkg.viewmodel.admin.exam.ExamPaperPageRequestVM"> |
| | | <select id="taskExamPage" resultMap="BaseResultMap" parameterType="com.ycl.jxkg.vo.admin.exam.ExamPaperPageRequestVO"> |
| | | SELECT |
| | | <include refid="Base_Column_List"/> |
| | | FROM t_exam_paper |
| | |
| | | </where> |
| | | </select> |
| | | |
| | | <select id="studentPage" resultMap="BaseResultMap" parameterType="com.ycl.jxkg.viewmodel.student.exam.ExamPaperPageVM"> |
| | | <select id="studentPage" resultMap="BaseResultMap" parameterType="com.ycl.jxkg.vo.student.exam.ExamPaperPageVO"> |
| | | SELECT |
| | | <include refid="Base_Column_List"/> |
| | | FROM t_exam_paper |
| | |
| | | </select> |
| | | |
| | | |
| | | <select id="indexPaper" resultMap="PaperInfoResultMap" parameterType="com.ycl.jxkg.viewmodel.student.dashboard.PaperFilter"> |
| | | <select id="indexPaper" resultMap="PaperInfoResultMap" parameterType="com.ycl.jxkg.vo.student.dashboard.PaperFilter"> |
| | | SELECT id,name,limit_start_time,limit_end_time |
| | | FROM t_exam_paper |
| | | <where> |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ycl.jxkg.repository.ExamPaperQuestionCustomerAnswerMapper"> |
| | | <mapper namespace="com.ycl.jxkg.mapper.ExamPaperQuestionCustomerAnswerMapper"> |
| | | <resultMap id="BaseResultMap" type="com.ycl.jxkg.domain.ExamPaperQuestionCustomerAnswer"> |
| | | <id column="id" jdbcType="INTEGER" property="id" /> |
| | | <result column="question_id" jdbcType="INTEGER" property="questionId" /> |
| | |
| | | </select> |
| | | |
| | | |
| | | <select id="studentPage" resultMap="BaseResultMap" parameterType="com.ycl.jxkg.viewmodel.student.question.answer.QuestionPageStudentRequestVM"> |
| | | <select id="studentPage" resultMap="BaseResultMap" parameterType="com.ycl.jxkg.vo.student.question.answer.QuestionPageStudentRequestVO"> |
| | | SELECT |
| | | <include refid="Base_Column_List"/> |
| | | FROM t_exam_paper_question_customer_answer |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ycl.jxkg.repository.MessageMapper"> |
| | | <mapper namespace="com.ycl.jxkg.mapper.MessageMapper"> |
| | | <resultMap id="BaseResultMap" type="com.ycl.jxkg.domain.Message"> |
| | | <id column="id" jdbcType="INTEGER" property="id" /> |
| | | <result column="title" jdbcType="VARCHAR" property="title" /> |
| | |
| | | |
| | | |
| | | |
| | | <select id="page" resultMap="BaseResultMap" parameterType="com.ycl.jxkg.viewmodel.admin.message.MessagePageRequestVM"> |
| | | <select id="page" resultMap="BaseResultMap" parameterType="com.ycl.jxkg.vo.admin.message.MessagePageRequestVO"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from t_message |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ycl.jxkg.repository.MessageUserMapper"> |
| | | <mapper namespace="com.ycl.jxkg.mapper.MessageUserMapper"> |
| | | <resultMap id="BaseResultMap" type="com.ycl.jxkg.domain.MessageUser"> |
| | | <id column="id" jdbcType="INTEGER" property="id" /> |
| | | <result column="message_id" jdbcType="INTEGER" property="messageId" /> |
| | |
| | | </insert> |
| | | |
| | | |
| | | <select id="studentPage" resultMap="BaseResultMap" parameterType="com.ycl.jxkg.viewmodel.student.user.MessageRequestVM"> |
| | | <select id="studentPage" resultMap="BaseResultMap" parameterType="com.ycl.jxkg.vo.student.user.MessageRequestVO"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from t_message_user |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ycl.jxkg.repository.QuestionMapper"> |
| | | <mapper namespace="com.ycl.jxkg.mapper.QuestionMapper"> |
| | | <resultMap id="BaseResultMap" type="com.ycl.jxkg.domain.Question"> |
| | | <id column="id" jdbcType="INTEGER" property="id" /> |
| | | <result column="question_type" jdbcType="INTEGER" property="questionType" /> |
| | |
| | | |
| | | |
| | | |
| | | <select id="page" resultMap="BaseResultMap" parameterType="com.ycl.jxkg.viewmodel.admin.question.QuestionPageRequestVM"> |
| | | <select id="page" resultMap="BaseResultMap" parameterType="com.ycl.jxkg.vo.admin.question.QuestionPageRequestVO"> |
| | | SELECT |
| | | <include refid="Base_Column_List"/> |
| | | FROM t_question |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ycl.jxkg.repository.SubjectMapper"> |
| | | <mapper namespace="com.ycl.jxkg.mapper.SubjectMapper"> |
| | | <resultMap id="BaseResultMap" type="com.ycl.jxkg.domain.Subject"> |
| | | <id column="id" jdbcType="INTEGER" property="id" /> |
| | | <result column="name" jdbcType="VARCHAR" property="name" /> |
| | |
| | | from t_subject |
| | | </select> |
| | | |
| | | <select id="page" resultMap="BaseResultMap" parameterType="com.ycl.jxkg.viewmodel.admin.education.SubjectPageRequestVM"> |
| | | <select id="page" resultMap="BaseResultMap" parameterType="com.ycl.jxkg.vo.admin.education.SubjectPageRequestVO"> |
| | | SELECT |
| | | <include refid="Base_Column_List"/> |
| | | FROM t_subject |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ycl.jxkg.repository.TaskExamCustomerAnswerMapper"> |
| | | <mapper namespace="com.ycl.jxkg.mapper.TaskExamCustomerAnswerMapper"> |
| | | <resultMap id="BaseResultMap" type="com.ycl.jxkg.domain.TaskExamCustomerAnswer"> |
| | | <id column="id" jdbcType="INTEGER" property="id" /> |
| | | <result column="task_exam_id" jdbcType="INTEGER" property="taskExamId" /> |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ycl.jxkg.repository.TaskExamMapper"> |
| | | <mapper namespace="com.ycl.jxkg.mapper.TaskExamMapper"> |
| | | <resultMap id="BaseResultMap" type="com.ycl.jxkg.domain.TaskExam"> |
| | | <id column="id" jdbcType="INTEGER" property="id" /> |
| | | <result column="title" jdbcType="VARCHAR" property="title" /> |
| | |
| | | |
| | | |
| | | |
| | | <select id="page" resultMap="BaseResultMap" parameterType="com.ycl.jxkg.viewmodel.admin.task.TaskPageRequestVM"> |
| | | <select id="page" resultMap="BaseResultMap" parameterType="com.ycl.jxkg.vo.admin.task.TaskPageRequestVO"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from t_task_exam |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ycl.jxkg.repository.TextContentMapper"> |
| | | <mapper namespace="com.ycl.jxkg.mapper.TextContentMapper"> |
| | | <resultMap id="BaseResultMap" type="com.ycl.jxkg.domain.TextContent"> |
| | | <id column="id" jdbcType="INTEGER" property="id" /> |
| | | <result column="content" jdbcType="VARCHAR" property="content" /> |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ycl.jxkg.repository.UserEventLogMapper"> |
| | | <mapper namespace="com.ycl.jxkg.mapper.UserEventLogMapper"> |
| | | <resultMap id="BaseResultMap" type="com.ycl.jxkg.domain.UserEventLog"> |
| | | <id column="id" jdbcType="INTEGER" property="id" /> |
| | | <result column="user_id" jdbcType="INTEGER" property="userId" /> |
| | |
| | | limit 10 |
| | | </select> |
| | | |
| | | <select id="page" resultMap="BaseResultMap" parameterType="com.ycl.jxkg.viewmodel.admin.user.UserEventPageRequestVM"> |
| | | <select id="page" resultMap="BaseResultMap" parameterType="com.ycl.jxkg.vo.admin.user.UserEventPageRequestVO"> |
| | | select |
| | | <include refid="Base_Column_List"/> |
| | | from t_user_event_log |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ycl.jxkg.repository.UserMapper"> |
| | | <mapper namespace="com.ycl.jxkg.mapper.UserMapper"> |
| | | <resultMap id="BaseResultMap" type="com.ycl.jxkg.domain.User"> |
| | | <id column="id" jdbcType="INTEGER" property="id" /> |
| | | <result column="user_uuid" jdbcType="VARCHAR" property="userUuid" /> |
| | |
| | | </select> |
| | | |
| | | |
| | | <select id="userPage" resultMap="BaseResultMap" parameterType="com.ycl.jxkg.viewmodel.admin.user.UserPageRequestVM"> |
| | | <select id="userPage" resultMap="BaseResultMap" parameterType="com.ycl.jxkg.vo.admin.user.UserPageRequestVO"> |
| | | SELECT |
| | | <include refid="Base_Column_List"/> |
| | | FROM t_user |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ycl.jxkg.repository.UserTokenMapper"> |
| | | <mapper namespace="com.ycl.jxkg.mapper.UserTokenMapper"> |
| | | <resultMap id="BaseResultMap" type="com.ycl.jxkg.domain.UserToken"> |
| | | <id column="id" jdbcType="INTEGER" property="id" /> |
| | | <result column="token" jdbcType="VARCHAR" property="token" /> |