diff --git a/README.en.md b/README.en.md deleted file mode 100644 index b8ad88d1..00000000 --- a/README.en.md +++ /dev/null @@ -1,36 +0,0 @@ -# HOJ - -#### Description -基于前后端分离,分布式架构的在线测评平台OJ - -#### Software Architecture -Software architecture description - -#### Installation - -1. xxxx -2. xxxx -3. xxxx - -#### Instructions - -1. xxxx -2. xxxx -3. xxxx - -#### Contribution - -1. Fork the repository -2. Create Feat_xxx branch -3. Commit your code -4. Create Pull Request - - -#### Gitee Feature - -1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md -2. Gitee blog [blog.gitee.com](https://blog.gitee.com) -3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore) -4. The most valuable open source project [GVP](https://gitee.com/gvp) -5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help) -6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) diff --git a/README.md b/README.md deleted file mode 100644 index 5b511430..00000000 --- a/README.md +++ /dev/null @@ -1,37 +0,0 @@ -# HOJ - -#### 介绍 -基于前后端分离,分布式架构的在线测评平台OJ - -#### 软件架构 -软件架构说明 - - -#### 安装教程 - -1. xxxx -2. xxxx -3. xxxx - -#### 使用说明 - -1. xxxx -2. xxxx -3. xxxx - -#### 参与贡献 - -1. Fork 本仓库 -2. 新建 Feat_xxx 分支 -3. 提交代码 -4. 新建 Pull Request - - -#### 特技 - -1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md -2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com) -3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目 -4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目 -5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) -6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) diff --git a/hoj/.idea/.gitignore b/hoj/.idea/.gitignore new file mode 100644 index 00000000..73f69e09 --- /dev/null +++ b/hoj/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml +# Editor-based HTTP Client requests +/httpRequests/ diff --git a/hoj/.idea/compiler.xml b/hoj/.idea/compiler.xml new file mode 100644 index 00000000..a3e6f187 --- /dev/null +++ b/hoj/.idea/compiler.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/hoj/.idea/jarRepositories.xml b/hoj/.idea/jarRepositories.xml new file mode 100644 index 00000000..22e83c6b --- /dev/null +++ b/hoj/.idea/jarRepositories.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/hoj/.idea/misc.xml b/hoj/.idea/misc.xml new file mode 100644 index 00000000..4b661a5f --- /dev/null +++ b/hoj/.idea/misc.xml @@ -0,0 +1,14 @@ + + + + + + + + + + \ No newline at end of file diff --git a/hoj/.idea/uiDesigner.xml b/hoj/.idea/uiDesigner.xml new file mode 100644 index 00000000..e96534fb --- /dev/null +++ b/hoj/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/hoj/DataBackup/pom.xml b/hoj/DataBackup/pom.xml new file mode 100644 index 00000000..faf57202 --- /dev/null +++ b/hoj/DataBackup/pom.xml @@ -0,0 +1,124 @@ + + + + hoj + top.hcode + 1.0-SNAPSHOT + + 4.0.0 + DataBackup + + + + org.apache.maven.plugins + maven-compiler-plugin + + 8 + 8 + + + + + + src/main/resources + + + src/main/java + + **/*.xml + + + + + + + + top.hcode + api + 1.0-SNAPSHOT + + + + org.springframework.boot + spring-boot-starter-mail + + + + + + + + + + + org.projectlombok + lombok + true + + + com.alibaba + druid + + + com.baomidou + mybatis-plus-boot-starter + + + org.crazycake + shiro-redis-spring-boot-starter + + + mysql + mysql-connector-java + + + + cn.hutool + hutool-all + 5.3.3 + + + + + org.springframework.boot + spring-boot-starter-data-redis + + + + + io.jsonwebtoken + jjwt + 0.9.1 + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-actuator + + + + + org.springframework.boot + spring-boot-devtools + + + + org.springframework.boot + spring-boot-starter-test + test + + + org.junit.vintage + junit-vintage-engine + + + + + + \ No newline at end of file diff --git a/hoj/DataBackup/src/main/java/top/hcode/DataBackupApplication.java b/hoj/DataBackup/src/main/java/top/hcode/DataBackupApplication.java new file mode 100644 index 00000000..edb90cd3 --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/DataBackupApplication.java @@ -0,0 +1,22 @@ +package top.hcode; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.client.discovery.EnableDiscoveryClient; +import org.springframework.cloud.openfeign.EnableFeignClients; +import org.springframework.scheduling.annotation.EnableAsync; + +/** + * @Author: Himit_ZH + * @Date: 2020/10/22 23:25 + * @Description: + */ +//@EnableDiscoveryClient +@SpringBootApplication +//@EnableFeignClients +@EnableAsync //开启异步注解 +public class DataBackupApplication { + public static void main(String[] args) { + SpringApplication.run(DataBackupApplication.class,args); + } +} \ No newline at end of file diff --git a/hoj/DataBackup/src/main/java/top/hcode/common/dto/LoginDto.java b/hoj/DataBackup/src/main/java/top/hcode/common/dto/LoginDto.java new file mode 100644 index 00000000..2fff1da4 --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/common/dto/LoginDto.java @@ -0,0 +1,20 @@ +package top.hcode.common.dto; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Author: Himit_ZH + * @Date: 2020/7/20 00:23 + * @Description: 登录数据实体类 + */ +@Data +public class LoginDto implements Serializable { + @NotBlank(message = "用户名不能为空") + private String username; + + @NotBlank(message = "密码不能为空") + private String password; +} \ No newline at end of file diff --git a/hoj/DataBackup/src/main/java/top/hcode/common/dto/RegisterDto.java b/hoj/DataBackup/src/main/java/top/hcode/common/dto/RegisterDto.java new file mode 100644 index 00000000..0c12f200 --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/common/dto/RegisterDto.java @@ -0,0 +1,41 @@ +package top.hcode.common.dto; + +import lombok.Data; +import lombok.experimental.Accessors; +import org.springframework.lang.Nullable; + +import javax.validation.constraints.Email; +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Author: Himit_ZH + * @Date: 2020/10/24 11:15 + * @Description: 注册数据实体类 + */ +@Data +@Accessors(chain = true) +public class RegisterDto implements Serializable { + + @Nullable + private String uuid; + + @NotBlank(message = "用户名不能为空") + private String username; + + @NotBlank(message = "密码不能为空") + private String password; + + @NotBlank(message = "昵称不能为空") + private String nickname; + + @NotBlank(message = "邮箱不能为空") + @Email(message = "邮箱格式错误") + private String email; + + @NotBlank(message = "验证码不能为空") + private String code; + + @NotBlank(message = "学号不能为空") + private String number; +} \ No newline at end of file diff --git a/hoj/DataBackup/src/main/java/top/hcode/common/exception/GlobalExceptionHandler.java b/hoj/DataBackup/src/main/java/top/hcode/common/exception/GlobalExceptionHandler.java new file mode 100644 index 00000000..fa0f76fd --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/common/exception/GlobalExceptionHandler.java @@ -0,0 +1,76 @@ +package top.hcode.common.exception; + + +import lombok.extern.slf4j.Slf4j; +import org.apache.shiro.ShiroException; +import org.apache.shiro.authc.ExpiredCredentialsException; +import org.springframework.http.HttpStatus; +import org.springframework.validation.BindingResult; +import org.springframework.validation.ObjectError; +import org.springframework.web.bind.MethodArgumentNotValidException; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.bind.annotation.ResponseStatus; +import org.springframework.web.bind.annotation.RestControllerAdvice; +import top.hcode.common.result.CommonResult; + + +import javax.mail.MessagingException; +import java.io.IOException; + +/** + * 全局异常处理 + */ +@Slf4j +@RestControllerAdvice +public class GlobalExceptionHandler { + /** + * 处理shiro的异常 + */ + @ResponseStatus(HttpStatus.UNAUTHORIZED) + @ExceptionHandler(ShiroException.class) + public CommonResult handle401(ShiroException e) { + return CommonResult.errorResponse( e.getCause().toString(),CommonResult.STATUS_ACCESS_DENIED); + } + + + /** + * 处理Assert的异常 断言的异常! + */ + @ResponseStatus(HttpStatus.BAD_REQUEST) + @ExceptionHandler(value = IllegalArgumentException.class) + public CommonResult handler(IllegalArgumentException e) throws IOException { + log.error("Assert异常:-------------->{}",e.getMessage()); + return CommonResult.errorResponse(e.getMessage(),CommonResult.STATUS_FAIL); + } + + /** + * @Validated 校验错误异常处理 + */ + @ResponseStatus(HttpStatus.BAD_REQUEST) + @ExceptionHandler(value = MethodArgumentNotValidException.class) + public CommonResult handler(MethodArgumentNotValidException e) throws IOException { + log.error("实体校验异常:-------------->",e); + BindingResult bindingResult = e.getBindingResult(); + ObjectError objectError = bindingResult.getAllErrors().stream().findFirst().get(); + return CommonResult.errorResponse(objectError.getDefaultMessage(),CommonResult.STATUS_FAIL); + } + /** + * 处理运行时出现的异常 + */ + @ResponseStatus(HttpStatus.BAD_REQUEST) + @ExceptionHandler(value = RuntimeException.class) + public CommonResult handler(RuntimeException e) throws IOException { + log.error("运行时异常:-------------->",e); + return CommonResult.errorResponse(e.getMessage(),CommonResult.STATUS_ERROR); + } + + /** + * 处理邮件发送出现的异常 + */ + @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) + @ExceptionHandler(value = MessagingException.class) + public CommonResult handler(MessagingException e) throws Exception { + log.error("邮箱系统异常:-------------->",e); + return CommonResult.errorResponse(e.getMessage(),CommonResult.STATUS_ERROR); + } +} \ No newline at end of file diff --git a/hoj/DataBackup/src/main/java/top/hcode/common/result/CommonResult.java b/hoj/DataBackup/src/main/java/top/hcode/common/result/CommonResult.java new file mode 100644 index 00000000..a99b0004 --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/common/result/CommonResult.java @@ -0,0 +1,57 @@ +package top.hcode.common.result; + +import lombok.Data; + +import java.io.Serializable; + + +@Data +public class CommonResult implements Serializable { + public final static Integer STATUS_SUCCESS = 200; + public final static Integer STATUS_FAIL = 400; + public final static Integer STATUS_ERROR = 500; + public final static Integer STATUS_ACCESS_DENIED = 401; + + private Integer status; // 状态码 + private Object data; // 返回的数据 + private String msg; // 自定义信息 + + public CommonResult(Integer status, Object data, String msg){ + this.status = status; + this.data = data; + this.msg = msg; + } + + + /** + * 成功的结果 + * @param data 返回结果 + * @param msg 返回信息 + */ + public static CommonResult successResponse(Object data, String msg) { + return new CommonResult(CommonResult.STATUS_SUCCESS, data, msg); + } + + /** + * 成功的结果 + * @param data 返回结果 + */ + public CommonResult successResponse(Object data) { + return new CommonResult(CommonResult.STATUS_SUCCESS, data, null); + } + + + /** + * 失败的结果,无异常 + * @param msg 返回信息 + */ + public static CommonResult errorResponse(String msg) { + return new CommonResult(CommonResult.STATUS_FAIL, null, msg); + } + + + public static CommonResult errorResponse(String msg,Integer status) { + return new CommonResult(status, null,msg); + } + +} \ No newline at end of file diff --git a/hoj/DataBackup/src/main/java/top/hcode/config/CorsConfig.java b/hoj/DataBackup/src/main/java/top/hcode/config/CorsConfig.java new file mode 100644 index 00000000..6a4d8e6f --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/config/CorsConfig.java @@ -0,0 +1,22 @@ +package top.hcode.config; + + +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.config.annotation.CorsRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +/** + * 解决跨域问题 + */ +@Configuration +public class CorsConfig implements WebMvcConfigurer { + @Override + public void addCorsMappings(CorsRegistry registry) { + registry.addMapping("/**") + .allowedOrigins("*") + .allowedMethods("GET", "HEAD", "POST", "PUT", "DELETE", "OPTIONS") + .allowCredentials(true) + .maxAge(3600) + .allowedHeaders("*"); + } +} \ No newline at end of file diff --git a/hoj/DataBackup/src/main/java/top/hcode/config/MybatisPlusConfig.java b/hoj/DataBackup/src/main/java/top/hcode/config/MybatisPlusConfig.java new file mode 100644 index 00000000..243b612f --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/config/MybatisPlusConfig.java @@ -0,0 +1,25 @@ +package top.hcode.config; +import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor; +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.transaction.annotation.EnableTransactionManagement; + +/** + * @Author: Himit_ZH + * @Date: 2020/7/19 21:04 + * @Description: + */ +@Configuration +@EnableTransactionManagement +@MapperScan("top.hcode.dao") +public class MybatisPlusConfig { + + + // 分页插件 + @Bean + public PaginationInterceptor paginationInterceptor() { + return new PaginationInterceptor(); + } + +} \ No newline at end of file diff --git a/hoj/DataBackup/src/main/java/top/hcode/config/RedisConfig.java b/hoj/DataBackup/src/main/java/top/hcode/config/RedisConfig.java new file mode 100644 index 00000000..ed916d65 --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/config/RedisConfig.java @@ -0,0 +1,50 @@ +package top.hcode.config; + +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.PropertyAccessor; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.data.redis.connection.RedisConnectionFactory; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer; +import org.springframework.data.redis.serializer.StringRedisSerializer; + +/** + * @Author: Himit_ZH + * @Date: 2020/10/23 23:47 + * @Description: + */ +@Configuration +public class RedisConfig { + // 自己定义了一个 RedisTemplate + @Bean + @SuppressWarnings("all") + public RedisTemplate redisTemplate(RedisConnectionFactory factory) { + // 我们为了自己开发方便,一般直接使用 + RedisTemplate template = new RedisTemplate(); + template.setConnectionFactory(factory); + + // Json序列化配置 + Jackson2JsonRedisSerializer jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer(Object.class); + ObjectMapper om = new ObjectMapper(); + om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY); + om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL); + jackson2JsonRedisSerializer.setObjectMapper(om); + // String 的序列化 + StringRedisSerializer stringRedisSerializer = new StringRedisSerializer(); + + // key采用String的序列化方式 + template.setKeySerializer(stringRedisSerializer); + // hash的key也采用String的序列化方式 + template.setHashKeySerializer(stringRedisSerializer); + // value序列化方式采用jackson + template.setValueSerializer(jackson2JsonRedisSerializer); + // hash的value序列化方式采用jackson + template.setHashValueSerializer(jackson2JsonRedisSerializer); + template.afterPropertiesSet(); + + return template; + } + +} \ No newline at end of file diff --git a/hoj/DataBackup/src/main/java/top/hcode/config/ShiroConfig.java b/hoj/DataBackup/src/main/java/top/hcode/config/ShiroConfig.java new file mode 100644 index 00000000..a10fe661 --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/config/ShiroConfig.java @@ -0,0 +1,98 @@ +package top.hcode.config; + +/** + * @Author: Himit_ZH + * @Date: 2020/7/19 22:53 + * @Description: + */ + +import org.apache.shiro.mgt.DefaultSessionStorageEvaluator; +import org.apache.shiro.mgt.DefaultSubjectDAO; +import org.apache.shiro.mgt.SecurityManager; +import org.apache.shiro.session.mgt.SessionManager; +import org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor; +import org.apache.shiro.spring.web.ShiroFilterFactoryBean; +import org.apache.shiro.spring.web.config.DefaultShiroFilterChainDefinition; +import org.apache.shiro.spring.web.config.ShiroFilterChainDefinition; +import org.apache.shiro.web.mgt.DefaultWebSecurityManager; +import org.apache.shiro.web.session.mgt.DefaultWebSessionManager; +import org.crazycake.shiro.RedisCacheManager; +import org.crazycake.shiro.RedisSessionDAO; +import org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import top.hcode.shiro.AccountRealm; +import top.hcode.shiro.JwtFilter; + + +import javax.servlet.Filter; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * shiro启用注解拦截控制器 + */ +@Configuration +public class ShiroConfig { + @Autowired + JwtFilter jwtFilter; + @Bean + public SessionManager sessionManager(RedisSessionDAO redisSessionDAO) { + DefaultWebSessionManager sessionManager = new DefaultWebSessionManager(); + sessionManager.setSessionDAO(redisSessionDAO); + return sessionManager; + } + @Bean + public DefaultWebSecurityManager securityManager(AccountRealm accountRealm, + SessionManager sessionManager, + RedisCacheManager redisCacheManager) { + DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager(accountRealm); + securityManager.setSessionManager(sessionManager); + securityManager.setCacheManager(redisCacheManager); + /* + * 关闭shiro自带的session,详情见文档 + */ + DefaultSubjectDAO subjectDAO = new DefaultSubjectDAO(); + DefaultSessionStorageEvaluator defaultSessionStorageEvaluator = new DefaultSessionStorageEvaluator(); + defaultSessionStorageEvaluator.setSessionStorageEnabled(false); + subjectDAO.setSessionStorageEvaluator(defaultSessionStorageEvaluator); + securityManager.setSubjectDAO(subjectDAO); + return securityManager; + } + @Bean + public ShiroFilterChainDefinition shiroFilterChainDefinition() { + DefaultShiroFilterChainDefinition chainDefinition = new DefaultShiroFilterChainDefinition(); + Map filterMap = new LinkedHashMap<>(); + filterMap.put("/**", "jwt"); // 主要通过注解方式校验权限 + chainDefinition.addPathDefinitions(filterMap); + return chainDefinition; + } + @Bean("shiroFilterFactoryBean") + public ShiroFilterFactoryBean shiroFilterFactoryBean(SecurityManager securityManager, + ShiroFilterChainDefinition shiroFilterChainDefinition) { + ShiroFilterFactoryBean shiroFilter = new ShiroFilterFactoryBean(); + shiroFilter.setSecurityManager(securityManager); + Map filters = new HashMap<>(); + filters.put("jwt", jwtFilter); + shiroFilter.setFilters(filters); + Map filterMap = shiroFilterChainDefinition.getFilterChainMap(); + shiroFilter.setFilterChainDefinitionMap(filterMap); + return shiroFilter; + } + + // 开启注解代理(默认好像已经开启,可以不要) + @Bean + public AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor(SecurityManager securityManager){ + AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor = new AuthorizationAttributeSourceAdvisor(); + authorizationAttributeSourceAdvisor.setSecurityManager(securityManager); + return authorizationAttributeSourceAdvisor; + } + @Bean + public static DefaultAdvisorAutoProxyCreator getDefaultAdvisorAutoProxyCreator() { + DefaultAdvisorAutoProxyCreator creator = new DefaultAdvisorAutoProxyCreator(); + creator.setProxyTargetClass(true); + return creator; + } +} diff --git a/hoj/DataBackup/src/main/java/top/hcode/config/SwaggerConfig.java b/hoj/DataBackup/src/main/java/top/hcode/config/SwaggerConfig.java new file mode 100644 index 00000000..c4c3c0d1 --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/config/SwaggerConfig.java @@ -0,0 +1,56 @@ +package top.hcode.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.env.Environment; +import org.springframework.core.env.Profiles; +import springfox.documentation.builders.RequestHandlerSelectors; +import springfox.documentation.service.ApiInfo; +import springfox.documentation.service.Contact; +import springfox.documentation.spi.DocumentationType; +import springfox.documentation.spring.web.plugins.Docket; +import springfox.documentation.swagger2.annotations.EnableSwagger2; + +import java.util.ArrayList; + +/** + * @Author: Himit_ZH + * @Date: 2020/5/29 22:28 + * @Description: + */ +@Configuration +@EnableSwagger2 //开启swagger2 +public class SwaggerConfig { + @Bean //配置swagger的docket的bean势力 + public Docket docket(Environment environment){ + //设置要显示的swagger环境 + Profiles profiles = Profiles.of("dev","test"); //线下环境 + //通过环境判断是否在自己所设定的环境当中 + boolean flag = environment.acceptsProfiles(profiles); + return new Docket(DocumentationType.SWAGGER_2) + .apiInfo(apiInfo()) + .groupName("Himit_ZH") //分组 + .enable(flag) //开启 + .select() + //RequestHandlerSelectors扫描方式 + //any()全部 + //none 都不扫描 + //path 过滤什么路径 + .apis(RequestHandlerSelectors.basePackage("top.hcode")) + .build(); + } + //配置swagger信息 + private ApiInfo apiInfo(){ + //作者信息 + Contact contact = new Contact("Himit_ZH", "https://blog.csdn.net/weixin_43853097", "372347736@qq.com"); + return new ApiInfo( + "Himit_ZH的swaggerAPI文档", + "网站作者是个大帅哥!", + "v1.0", + "https://blog.csdn.net/weixin_43853097", + contact, + "Apache 2.0", + "http://www.apache.org/licenses/LICENSE-2.0", + new ArrayList()); + } +} \ No newline at end of file diff --git a/hoj/DataBackup/src/main/java/top/hcode/controller/AccountController.java b/hoj/DataBackup/src/main/java/top/hcode/controller/AccountController.java new file mode 100644 index 00000000..cbb3afe7 --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/controller/AccountController.java @@ -0,0 +1,157 @@ +package top.hcode.controller; + +import cn.hutool.core.map.MapUtil; +import cn.hutool.core.util.IdUtil; +import cn.hutool.core.util.RandomUtil; +import cn.hutool.crypto.SecureUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import org.apache.shiro.SecurityUtils; +import org.apache.shiro.authz.annotation.RequiresAuthentication; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.Assert; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import top.hcode.common.dto.LoginDto; +import top.hcode.common.dto.RegisterDto; +import top.hcode.common.result.CommonResult; +import top.hcode.dao.UserRecordMapper; +import top.hcode.dao.UserRoleMapper; +import top.hcode.entity.UserInfo; +import top.hcode.entity.UserRecord; +import top.hcode.entity.UserRole; +import top.hcode.service.UserInfoService; +import top.hcode.service.impl.EmailServiceImpl; +import top.hcode.utils.JwtUtils; +import top.hcode.utils.RedisUtils; + +import javax.mail.MessagingException; +import javax.servlet.http.HttpServletResponse; + +/** + * @Author: Himit_ZH + * @Date: 2020/10/23 12:00 + * @Description:账户处理控制类,负责处理登录请求和注册请求 + */ +@RestController +public class AccountController { + + @Autowired + private EmailServiceImpl emailService; + + @Autowired + private RedisUtils redisUtils; + + @Autowired + private UserInfoService userInfoDao; + + @Autowired + private UserRoleMapper userRoleDao; + + @Autowired + private UserRecordMapper userRecordDao; + + @Autowired + private JwtUtils jwtUtils; + + /** + * @MethodName getRegisterCode + * @Params * @param null + * @Description 调用邮件服务,发送注册流程的6位随机验证码 + * @Return + * @Since 2020/10/26 + */ + @RequestMapping("/get-register-code") + public CommonResult getRegisterCode(@RequestParam("username") String username, @RequestParam("email") String email) throws MessagingException { + String numbers = RandomUtil.randomNumbers(6); // 随机生成6位数字的组合 + redisUtils.set(username, numbers, 5 * 60);//默认验证码有效5分钟 + emailService.sendCode(email, username, numbers); + return CommonResult.successResponse(MapUtil.builder() + .put("username", username) + .put("email", email) + .put("code", numbers) + .put("expire", 5 * 60) + .map(), "验证码已发送至指定邮箱"); + } + + /** + * @MethodName register + * @Params * @param RegisterDto + * @Description 注册逻辑,具体参数请看RegisterDto类 + * @Return + * @Since 2020/10/24 + */ + @PostMapping("/register") + @Transactional + public CommonResult register(@Validated @RequestBody RegisterDto registerDto) { + + if (!redisUtils.hasKey(registerDto.getUsername())) { + return CommonResult.errorResponse("验证码不存在或已过期"); + } + if (!redisUtils.get(registerDto.getUsername()).equals(registerDto.getCode())) { //验证码判断 + return CommonResult.errorResponse("验证码不正确"); + } + String uuid = IdUtil.simpleUUID(); + //为新用户设置uuid + registerDto.setUuid(uuid); + //往user_info表插入数据 + int result1 = userInfoDao.addUser(registerDto); + //往user_role表插入数据 + int result2 = userRoleDao.insert(new UserRole().setRoleId(1002L).setUid(uuid)); + //往user_record表插入数据 + int result3 = userRecordDao.insert(new UserRecord().setUid(uuid)); + if (result1 == 1 && result2 == 1 && result3 == 1) { + return CommonResult.successResponse(null, "注册成功!"); + } else { + return CommonResult.errorResponse("注册失败!", CommonResult.STATUS_ERROR); // 插入数据库失败,返回500 + } + } + + + /** + * @MethodName login + * @Params * @param LoginDto + * @Description 处理登录逻辑 + * @Return CommonResult + * @Since 2020/10/24 + */ + @PostMapping("/login") + public CommonResult login(@Validated @RequestBody LoginDto loginDto, HttpServletResponse response) { + QueryWrapper wrapper = new QueryWrapper().eq("username", loginDto.getUsername()); + UserInfo user = userInfoDao.getOne(wrapper); + Assert.notNull(user, "用户不存在"); + if (user.getPassword().equals(SecureUtil.md5(loginDto.getPassword()))) { + return CommonResult.errorResponse("密码不正确"); + } + if (user.getStatus() != 0) { + return CommonResult.errorResponse("该账户已被封禁,请联系管理员进行处理。"); + } + String jwt = jwtUtils.generateToken(user.getUuid()); + response.setHeader("Authorization", jwt); //放到信息头部 + response.setHeader("Access-Control-Expose-Headers", "Authorization"); + + return CommonResult.successResponse(MapUtil.builder() + .put("uid", user.getUuid()) + .put("username", user.getUsername()) + .put("nickname", user.getNickname()) + .put("avatar", user.getAvatar()) + .put("email", user.getEmail()) + .map(), "登录成功" + ); + } + + + /** + * @MethodName logout + * @Params * @param null + * @Description 退出逻辑,将jwt在redis中清除,下次需要再次登录。 + * @Return CommonResult + * @Since 2020/10/24 + */ + @GetMapping("/logout") + @RequiresAuthentication + public CommonResult logout() { + SecurityUtils.getSubject().logout(); + return CommonResult.successResponse(null, "退出成功"); + } +} \ No newline at end of file diff --git a/hoj/DataBackup/src/main/java/top/hcode/dao/AuthMapper.java b/hoj/DataBackup/src/main/java/top/hcode/dao/AuthMapper.java new file mode 100644 index 00000000..c8b0f6a2 --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/dao/AuthMapper.java @@ -0,0 +1,16 @@ +package top.hcode.dao; + +import top.hcode.entity.Auth; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +public interface AuthMapper extends BaseMapper { + +} diff --git a/hoj/DataBackup/src/main/java/top/hcode/dao/CommentMapper.java b/hoj/DataBackup/src/main/java/top/hcode/dao/CommentMapper.java new file mode 100644 index 00000000..fe5583de --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/dao/CommentMapper.java @@ -0,0 +1,16 @@ +package top.hcode.dao; + +import top.hcode.entity.Comment; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +public interface CommentMapper extends BaseMapper { + +} diff --git a/hoj/DataBackup/src/main/java/top/hcode/dao/CommentTagMapper.java b/hoj/DataBackup/src/main/java/top/hcode/dao/CommentTagMapper.java new file mode 100644 index 00000000..5390e287 --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/dao/CommentTagMapper.java @@ -0,0 +1,16 @@ +package top.hcode.dao; + +import top.hcode.entity.CommentTag; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +public interface CommentTagMapper extends BaseMapper { + +} diff --git a/hoj/DataBackup/src/main/java/top/hcode/dao/ContestAnnouncementMapper.java b/hoj/DataBackup/src/main/java/top/hcode/dao/ContestAnnouncementMapper.java new file mode 100644 index 00000000..d3a86806 --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/dao/ContestAnnouncementMapper.java @@ -0,0 +1,16 @@ +package top.hcode.dao; + +import top.hcode.entity.ContestAnnouncement; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +public interface ContestAnnouncementMapper extends BaseMapper { + +} diff --git a/hoj/DataBackup/src/main/java/top/hcode/dao/ContestExplanationMapper.java b/hoj/DataBackup/src/main/java/top/hcode/dao/ContestExplanationMapper.java new file mode 100644 index 00000000..164d9e7f --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/dao/ContestExplanationMapper.java @@ -0,0 +1,16 @@ +package top.hcode.dao; + +import top.hcode.entity.ContestExplanation; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +public interface ContestExplanationMapper extends BaseMapper { + +} diff --git a/hoj/DataBackup/src/main/java/top/hcode/dao/ContestMapper.java b/hoj/DataBackup/src/main/java/top/hcode/dao/ContestMapper.java new file mode 100644 index 00000000..9084e110 --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/dao/ContestMapper.java @@ -0,0 +1,16 @@ +package top.hcode.dao; + +import top.hcode.entity.Contest; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +public interface ContestMapper extends BaseMapper { + +} diff --git a/hoj/DataBackup/src/main/java/top/hcode/dao/ContestProblemMapper.java b/hoj/DataBackup/src/main/java/top/hcode/dao/ContestProblemMapper.java new file mode 100644 index 00000000..b503c1f2 --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/dao/ContestProblemMapper.java @@ -0,0 +1,16 @@ +package top.hcode.dao; + +import top.hcode.entity.ContestProblem; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +public interface ContestProblemMapper extends BaseMapper { + +} diff --git a/hoj/DataBackup/src/main/java/top/hcode/dao/ContestRecordMapper.java b/hoj/DataBackup/src/main/java/top/hcode/dao/ContestRecordMapper.java new file mode 100644 index 00000000..f88382b5 --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/dao/ContestRecordMapper.java @@ -0,0 +1,16 @@ +package top.hcode.dao; + +import top.hcode.entity.ContestRecord; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +public interface ContestRecordMapper extends BaseMapper { + +} diff --git a/hoj/DataBackup/src/main/java/top/hcode/dao/ContestRegisterMapper.java b/hoj/DataBackup/src/main/java/top/hcode/dao/ContestRegisterMapper.java new file mode 100644 index 00000000..071eb445 --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/dao/ContestRegisterMapper.java @@ -0,0 +1,16 @@ +package top.hcode.dao; + +import top.hcode.entity.ContestRegister; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +public interface ContestRegisterMapper extends BaseMapper { + +} diff --git a/hoj/DataBackup/src/main/java/top/hcode/dao/ContestScoreMapper.java b/hoj/DataBackup/src/main/java/top/hcode/dao/ContestScoreMapper.java new file mode 100644 index 00000000..c69efb40 --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/dao/ContestScoreMapper.java @@ -0,0 +1,16 @@ +package top.hcode.dao; + +import top.hcode.entity.ContestScore; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +public interface ContestScoreMapper extends BaseMapper { + +} diff --git a/hoj/DataBackup/src/main/java/top/hcode/dao/JudgeCaseMapper.java b/hoj/DataBackup/src/main/java/top/hcode/dao/JudgeCaseMapper.java new file mode 100644 index 00000000..bb32ffca --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/dao/JudgeCaseMapper.java @@ -0,0 +1,16 @@ +package top.hcode.dao; + +import top.hcode.entity.JudgeCase; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +public interface JudgeCaseMapper extends BaseMapper { + +} diff --git a/hoj/DataBackup/src/main/java/top/hcode/dao/JudgeMapper.java b/hoj/DataBackup/src/main/java/top/hcode/dao/JudgeMapper.java new file mode 100644 index 00000000..bd30a3be --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/dao/JudgeMapper.java @@ -0,0 +1,16 @@ +package top.hcode.dao; + +import top.hcode.entity.Judge; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +public interface JudgeMapper extends BaseMapper { + +} diff --git a/hoj/DataBackup/src/main/java/top/hcode/dao/ProblemCountMapper.java b/hoj/DataBackup/src/main/java/top/hcode/dao/ProblemCountMapper.java new file mode 100644 index 00000000..fa2eac18 --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/dao/ProblemCountMapper.java @@ -0,0 +1,16 @@ +package top.hcode.dao; + +import top.hcode.entity.ProblemCount; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +public interface ProblemCountMapper extends BaseMapper { + +} diff --git a/hoj/DataBackup/src/main/java/top/hcode/dao/ProblemMapper.java b/hoj/DataBackup/src/main/java/top/hcode/dao/ProblemMapper.java new file mode 100644 index 00000000..16f77586 --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/dao/ProblemMapper.java @@ -0,0 +1,16 @@ +package top.hcode.dao; + +import top.hcode.entity.Problem; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +public interface ProblemMapper extends BaseMapper { + +} diff --git a/hoj/DataBackup/src/main/java/top/hcode/dao/RoleAuthMapper.java b/hoj/DataBackup/src/main/java/top/hcode/dao/RoleAuthMapper.java new file mode 100644 index 00000000..c2a7152a --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/dao/RoleAuthMapper.java @@ -0,0 +1,16 @@ +package top.hcode.dao; + +import top.hcode.entity.RoleAuth; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +public interface RoleAuthMapper extends BaseMapper { + +} diff --git a/hoj/DataBackup/src/main/java/top/hcode/dao/RoleMapper.java b/hoj/DataBackup/src/main/java/top/hcode/dao/RoleMapper.java new file mode 100644 index 00000000..1ccb9558 --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/dao/RoleMapper.java @@ -0,0 +1,16 @@ +package top.hcode.dao; + +import top.hcode.entity.Role; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +public interface RoleMapper extends BaseMapper { + +} diff --git a/hoj/DataBackup/src/main/java/top/hcode/dao/UserAcproblemMapper.java b/hoj/DataBackup/src/main/java/top/hcode/dao/UserAcproblemMapper.java new file mode 100644 index 00000000..f066a362 --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/dao/UserAcproblemMapper.java @@ -0,0 +1,16 @@ +package top.hcode.dao; + +import top.hcode.entity.UserAcproblem; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +public interface UserAcproblemMapper extends BaseMapper { + +} diff --git a/hoj/DataBackup/src/main/java/top/hcode/dao/UserInfoMapper.java b/hoj/DataBackup/src/main/java/top/hcode/dao/UserInfoMapper.java new file mode 100644 index 00000000..20524da3 --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/dao/UserInfoMapper.java @@ -0,0 +1,23 @@ +package top.hcode.dao; + +import org.apache.ibatis.annotations.Mapper; +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.stereotype.Repository; +import top.hcode.common.dto.RegisterDto; +import top.hcode.entity.UserInfo; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + + +/** + *

+ * Mapper 接口 + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +@Mapper +@Repository +public interface UserInfoMapper extends BaseMapper { + int addUser(RegisterDto registerDto); +} diff --git a/hoj/DataBackup/src/main/java/top/hcode/dao/UserRecordMapper.java b/hoj/DataBackup/src/main/java/top/hcode/dao/UserRecordMapper.java new file mode 100644 index 00000000..cc55abee --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/dao/UserRecordMapper.java @@ -0,0 +1,20 @@ +package top.hcode.dao; + +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; +import top.hcode.entity.UserRecord; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +@Mapper +@Repository +public interface UserRecordMapper extends BaseMapper { + +} diff --git a/hoj/DataBackup/src/main/java/top/hcode/dao/UserRoleMapper.java b/hoj/DataBackup/src/main/java/top/hcode/dao/UserRoleMapper.java new file mode 100644 index 00000000..39ac235a --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/dao/UserRoleMapper.java @@ -0,0 +1,20 @@ +package top.hcode.dao; + +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; +import top.hcode.entity.UserRole; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +@Mapper +@Repository +public interface UserRoleMapper extends BaseMapper { + +} diff --git a/hoj/DataBackup/src/main/java/top/hcode/dao/xml/AuthMapper.xml b/hoj/DataBackup/src/main/java/top/hcode/dao/xml/AuthMapper.xml new file mode 100644 index 00000000..d2316d4c --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/dao/xml/AuthMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hoj/DataBackup/src/main/java/top/hcode/dao/xml/CommentMapper.xml b/hoj/DataBackup/src/main/java/top/hcode/dao/xml/CommentMapper.xml new file mode 100644 index 00000000..22d20be8 --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/dao/xml/CommentMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hoj/DataBackup/src/main/java/top/hcode/dao/xml/CommentTagMapper.xml b/hoj/DataBackup/src/main/java/top/hcode/dao/xml/CommentTagMapper.xml new file mode 100644 index 00000000..611ed73b --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/dao/xml/CommentTagMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hoj/DataBackup/src/main/java/top/hcode/dao/xml/ContestAnnouncementMapper.xml b/hoj/DataBackup/src/main/java/top/hcode/dao/xml/ContestAnnouncementMapper.xml new file mode 100644 index 00000000..0b2c2672 --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/dao/xml/ContestAnnouncementMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hoj/DataBackup/src/main/java/top/hcode/dao/xml/ContestExplanationMapper.xml b/hoj/DataBackup/src/main/java/top/hcode/dao/xml/ContestExplanationMapper.xml new file mode 100644 index 00000000..ff9941ab --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/dao/xml/ContestExplanationMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hoj/DataBackup/src/main/java/top/hcode/dao/xml/ContestMapper.xml b/hoj/DataBackup/src/main/java/top/hcode/dao/xml/ContestMapper.xml new file mode 100644 index 00000000..af4de1d0 --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/dao/xml/ContestMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hoj/DataBackup/src/main/java/top/hcode/dao/xml/ContestProblemMapper.xml b/hoj/DataBackup/src/main/java/top/hcode/dao/xml/ContestProblemMapper.xml new file mode 100644 index 00000000..1b091917 --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/dao/xml/ContestProblemMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hoj/DataBackup/src/main/java/top/hcode/dao/xml/ContestRecordMapper.xml b/hoj/DataBackup/src/main/java/top/hcode/dao/xml/ContestRecordMapper.xml new file mode 100644 index 00000000..9315e9e4 --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/dao/xml/ContestRecordMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hoj/DataBackup/src/main/java/top/hcode/dao/xml/ContestRegisterMapper.xml b/hoj/DataBackup/src/main/java/top/hcode/dao/xml/ContestRegisterMapper.xml new file mode 100644 index 00000000..022d2cf6 --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/dao/xml/ContestRegisterMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hoj/DataBackup/src/main/java/top/hcode/dao/xml/ContestScoreMapper.xml b/hoj/DataBackup/src/main/java/top/hcode/dao/xml/ContestScoreMapper.xml new file mode 100644 index 00000000..f01f02d2 --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/dao/xml/ContestScoreMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hoj/DataBackup/src/main/java/top/hcode/dao/xml/JudgeCaseMapper.xml b/hoj/DataBackup/src/main/java/top/hcode/dao/xml/JudgeCaseMapper.xml new file mode 100644 index 00000000..b1b09574 --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/dao/xml/JudgeCaseMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hoj/DataBackup/src/main/java/top/hcode/dao/xml/JudgeMapper.xml b/hoj/DataBackup/src/main/java/top/hcode/dao/xml/JudgeMapper.xml new file mode 100644 index 00000000..0abbce7e --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/dao/xml/JudgeMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hoj/DataBackup/src/main/java/top/hcode/dao/xml/ProblemCountMapper.xml b/hoj/DataBackup/src/main/java/top/hcode/dao/xml/ProblemCountMapper.xml new file mode 100644 index 00000000..76b5051e --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/dao/xml/ProblemCountMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hoj/DataBackup/src/main/java/top/hcode/dao/xml/ProblemMapper.xml b/hoj/DataBackup/src/main/java/top/hcode/dao/xml/ProblemMapper.xml new file mode 100644 index 00000000..c436265e --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/dao/xml/ProblemMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hoj/DataBackup/src/main/java/top/hcode/dao/xml/RoleAuthMapper.xml b/hoj/DataBackup/src/main/java/top/hcode/dao/xml/RoleAuthMapper.xml new file mode 100644 index 00000000..d1660d81 --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/dao/xml/RoleAuthMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hoj/DataBackup/src/main/java/top/hcode/dao/xml/RoleMapper.xml b/hoj/DataBackup/src/main/java/top/hcode/dao/xml/RoleMapper.xml new file mode 100644 index 00000000..a71fdd36 --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/dao/xml/RoleMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hoj/DataBackup/src/main/java/top/hcode/dao/xml/UserAcproblemMapper.xml b/hoj/DataBackup/src/main/java/top/hcode/dao/xml/UserAcproblemMapper.xml new file mode 100644 index 00000000..4ba9e06e --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/dao/xml/UserAcproblemMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hoj/DataBackup/src/main/java/top/hcode/dao/xml/UserInfoMapper.xml b/hoj/DataBackup/src/main/java/top/hcode/dao/xml/UserInfoMapper.xml new file mode 100644 index 00000000..85e404a4 --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/dao/xml/UserInfoMapper.xml @@ -0,0 +1,9 @@ + + + + + insert into user_info(uuid,username,password,nickname,email,number) values ( + #{uuid}, #{username},#{password},#{nickname},#{email},#{number} + ) + + diff --git a/hoj/DataBackup/src/main/java/top/hcode/dao/xml/UserRecordMapper.xml b/hoj/DataBackup/src/main/java/top/hcode/dao/xml/UserRecordMapper.xml new file mode 100644 index 00000000..d51473df --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/dao/xml/UserRecordMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hoj/DataBackup/src/main/java/top/hcode/dao/xml/UserRoleMapper.xml b/hoj/DataBackup/src/main/java/top/hcode/dao/xml/UserRoleMapper.xml new file mode 100644 index 00000000..0f583fbb --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/dao/xml/UserRoleMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hoj/DataBackup/src/main/java/top/hcode/service/AuthService.java b/hoj/DataBackup/src/main/java/top/hcode/service/AuthService.java new file mode 100644 index 00000000..a9dc004f --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/service/AuthService.java @@ -0,0 +1,16 @@ +package top.hcode.service; + +import top.hcode.entity.Auth; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +public interface AuthService extends IService { + +} diff --git a/hoj/DataBackup/src/main/java/top/hcode/service/CommentService.java b/hoj/DataBackup/src/main/java/top/hcode/service/CommentService.java new file mode 100644 index 00000000..14cbab57 --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/service/CommentService.java @@ -0,0 +1,16 @@ +package top.hcode.service; + +import top.hcode.entity.Comment; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +public interface CommentService extends IService { + +} diff --git a/hoj/DataBackup/src/main/java/top/hcode/service/CommentTagService.java b/hoj/DataBackup/src/main/java/top/hcode/service/CommentTagService.java new file mode 100644 index 00000000..f113881f --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/service/CommentTagService.java @@ -0,0 +1,16 @@ +package top.hcode.service; + +import top.hcode.entity.CommentTag; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +public interface CommentTagService extends IService { + +} diff --git a/hoj/DataBackup/src/main/java/top/hcode/service/ContestAnnouncementService.java b/hoj/DataBackup/src/main/java/top/hcode/service/ContestAnnouncementService.java new file mode 100644 index 00000000..8bee48d0 --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/service/ContestAnnouncementService.java @@ -0,0 +1,16 @@ +package top.hcode.service; + +import top.hcode.entity.ContestAnnouncement; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +public interface ContestAnnouncementService extends IService { + +} diff --git a/hoj/DataBackup/src/main/java/top/hcode/service/ContestExplanationService.java b/hoj/DataBackup/src/main/java/top/hcode/service/ContestExplanationService.java new file mode 100644 index 00000000..da30627d --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/service/ContestExplanationService.java @@ -0,0 +1,16 @@ +package top.hcode.service; + +import top.hcode.entity.ContestExplanation; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +public interface ContestExplanationService extends IService { + +} diff --git a/hoj/DataBackup/src/main/java/top/hcode/service/ContestProblemService.java b/hoj/DataBackup/src/main/java/top/hcode/service/ContestProblemService.java new file mode 100644 index 00000000..f1426ba4 --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/service/ContestProblemService.java @@ -0,0 +1,16 @@ +package top.hcode.service; + +import top.hcode.entity.ContestProblem; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +public interface ContestProblemService extends IService { + +} diff --git a/hoj/DataBackup/src/main/java/top/hcode/service/ContestRecordService.java b/hoj/DataBackup/src/main/java/top/hcode/service/ContestRecordService.java new file mode 100644 index 00000000..fab0e203 --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/service/ContestRecordService.java @@ -0,0 +1,16 @@ +package top.hcode.service; + +import top.hcode.entity.ContestRecord; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +public interface ContestRecordService extends IService { + +} diff --git a/hoj/DataBackup/src/main/java/top/hcode/service/ContestRegisterService.java b/hoj/DataBackup/src/main/java/top/hcode/service/ContestRegisterService.java new file mode 100644 index 00000000..f6257f55 --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/service/ContestRegisterService.java @@ -0,0 +1,16 @@ +package top.hcode.service; + +import top.hcode.entity.ContestRegister; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +public interface ContestRegisterService extends IService { + +} diff --git a/hoj/DataBackup/src/main/java/top/hcode/service/ContestScoreService.java b/hoj/DataBackup/src/main/java/top/hcode/service/ContestScoreService.java new file mode 100644 index 00000000..95bf8cf3 --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/service/ContestScoreService.java @@ -0,0 +1,16 @@ +package top.hcode.service; + +import top.hcode.entity.ContestScore; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +public interface ContestScoreService extends IService { + +} diff --git a/hoj/DataBackup/src/main/java/top/hcode/service/ContestService.java b/hoj/DataBackup/src/main/java/top/hcode/service/ContestService.java new file mode 100644 index 00000000..f7e4d362 --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/service/ContestService.java @@ -0,0 +1,16 @@ +package top.hcode.service; + +import top.hcode.entity.Contest; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +public interface ContestService extends IService { + +} diff --git a/hoj/DataBackup/src/main/java/top/hcode/service/EmailService.java b/hoj/DataBackup/src/main/java/top/hcode/service/EmailService.java new file mode 100644 index 00000000..50c52ecc --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/service/EmailService.java @@ -0,0 +1,7 @@ +package top.hcode.service; + +import javax.mail.MessagingException; + +public interface EmailService { + public void sendCode(String email,String username,String code) throws MessagingException; +} diff --git a/hoj/DataBackup/src/main/java/top/hcode/service/JudgeCaseService.java b/hoj/DataBackup/src/main/java/top/hcode/service/JudgeCaseService.java new file mode 100644 index 00000000..d2b44ed6 --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/service/JudgeCaseService.java @@ -0,0 +1,16 @@ +package top.hcode.service; + +import top.hcode.entity.JudgeCase; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +public interface JudgeCaseService extends IService { + +} diff --git a/hoj/DataBackup/src/main/java/top/hcode/service/JudgeService.java b/hoj/DataBackup/src/main/java/top/hcode/service/JudgeService.java new file mode 100644 index 00000000..c9261c61 --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/service/JudgeService.java @@ -0,0 +1,16 @@ +package top.hcode.service; + +import top.hcode.entity.Judge; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +public interface JudgeService extends IService { + +} diff --git a/hoj/DataBackup/src/main/java/top/hcode/service/ProblemCountService.java b/hoj/DataBackup/src/main/java/top/hcode/service/ProblemCountService.java new file mode 100644 index 00000000..1dbd31cd --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/service/ProblemCountService.java @@ -0,0 +1,16 @@ +package top.hcode.service; + +import top.hcode.entity.ProblemCount; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +public interface ProblemCountService extends IService { + +} diff --git a/hoj/DataBackup/src/main/java/top/hcode/service/ProblemService.java b/hoj/DataBackup/src/main/java/top/hcode/service/ProblemService.java new file mode 100644 index 00000000..44b19b01 --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/service/ProblemService.java @@ -0,0 +1,16 @@ +package top.hcode.service; + +import top.hcode.entity.Problem; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +public interface ProblemService extends IService { + +} diff --git a/hoj/DataBackup/src/main/java/top/hcode/service/RoleAuthService.java b/hoj/DataBackup/src/main/java/top/hcode/service/RoleAuthService.java new file mode 100644 index 00000000..09890f05 --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/service/RoleAuthService.java @@ -0,0 +1,16 @@ +package top.hcode.service; + +import top.hcode.entity.RoleAuth; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +public interface RoleAuthService extends IService { + +} diff --git a/hoj/DataBackup/src/main/java/top/hcode/service/RoleService.java b/hoj/DataBackup/src/main/java/top/hcode/service/RoleService.java new file mode 100644 index 00000000..c192f4b9 --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/service/RoleService.java @@ -0,0 +1,16 @@ +package top.hcode.service; + +import top.hcode.entity.Role; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +public interface RoleService extends IService { + +} diff --git a/hoj/DataBackup/src/main/java/top/hcode/service/UserAcproblemService.java b/hoj/DataBackup/src/main/java/top/hcode/service/UserAcproblemService.java new file mode 100644 index 00000000..23b1c583 --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/service/UserAcproblemService.java @@ -0,0 +1,16 @@ +package top.hcode.service; + +import top.hcode.entity.UserAcproblem; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +public interface UserAcproblemService extends IService { + +} diff --git a/hoj/DataBackup/src/main/java/top/hcode/service/UserInfoService.java b/hoj/DataBackup/src/main/java/top/hcode/service/UserInfoService.java new file mode 100644 index 00000000..0633c6b6 --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/service/UserInfoService.java @@ -0,0 +1,17 @@ +package top.hcode.service; + +import top.hcode.common.dto.RegisterDto; +import top.hcode.entity.UserInfo; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +public interface UserInfoService extends IService { + public Integer addUser(RegisterDto registerDto); +} diff --git a/hoj/DataBackup/src/main/java/top/hcode/service/UserRecordService.java b/hoj/DataBackup/src/main/java/top/hcode/service/UserRecordService.java new file mode 100644 index 00000000..906c92fb --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/service/UserRecordService.java @@ -0,0 +1,16 @@ +package top.hcode.service; + +import top.hcode.entity.UserRecord; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +public interface UserRecordService extends IService { + +} diff --git a/hoj/DataBackup/src/main/java/top/hcode/service/UserRoleService.java b/hoj/DataBackup/src/main/java/top/hcode/service/UserRoleService.java new file mode 100644 index 00000000..b8131893 --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/service/UserRoleService.java @@ -0,0 +1,16 @@ +package top.hcode.service; + +import top.hcode.entity.UserRole; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +public interface UserRoleService extends IService { + +} diff --git a/hoj/DataBackup/src/main/java/top/hcode/service/impl/AuthServiceImpl.java b/hoj/DataBackup/src/main/java/top/hcode/service/impl/AuthServiceImpl.java new file mode 100644 index 00000000..44cec5a1 --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/service/impl/AuthServiceImpl.java @@ -0,0 +1,20 @@ +package top.hcode.service.impl; + +import top.hcode.entity.Auth; +import top.hcode.dao.AuthMapper; +import top.hcode.service.AuthService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +@Service +public class AuthServiceImpl extends ServiceImpl implements AuthService { + +} diff --git a/hoj/DataBackup/src/main/java/top/hcode/service/impl/CommentServiceImpl.java b/hoj/DataBackup/src/main/java/top/hcode/service/impl/CommentServiceImpl.java new file mode 100644 index 00000000..d05f5087 --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/service/impl/CommentServiceImpl.java @@ -0,0 +1,20 @@ +package top.hcode.service.impl; + +import top.hcode.entity.Comment; +import top.hcode.dao.CommentMapper; +import top.hcode.service.CommentService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +@Service +public class CommentServiceImpl extends ServiceImpl implements CommentService { + +} diff --git a/hoj/DataBackup/src/main/java/top/hcode/service/impl/CommentTagServiceImpl.java b/hoj/DataBackup/src/main/java/top/hcode/service/impl/CommentTagServiceImpl.java new file mode 100644 index 00000000..68c6a1ef --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/service/impl/CommentTagServiceImpl.java @@ -0,0 +1,20 @@ +package top.hcode.service.impl; + +import top.hcode.entity.CommentTag; +import top.hcode.dao.CommentTagMapper; +import top.hcode.service.CommentTagService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +@Service +public class CommentTagServiceImpl extends ServiceImpl implements CommentTagService { + +} diff --git a/hoj/DataBackup/src/main/java/top/hcode/service/impl/ContestAnnouncementServiceImpl.java b/hoj/DataBackup/src/main/java/top/hcode/service/impl/ContestAnnouncementServiceImpl.java new file mode 100644 index 00000000..94e977c6 --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/service/impl/ContestAnnouncementServiceImpl.java @@ -0,0 +1,20 @@ +package top.hcode.service.impl; + +import top.hcode.entity.ContestAnnouncement; +import top.hcode.dao.ContestAnnouncementMapper; +import top.hcode.service.ContestAnnouncementService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +@Service +public class ContestAnnouncementServiceImpl extends ServiceImpl implements ContestAnnouncementService { + +} diff --git a/hoj/DataBackup/src/main/java/top/hcode/service/impl/ContestExplanationServiceImpl.java b/hoj/DataBackup/src/main/java/top/hcode/service/impl/ContestExplanationServiceImpl.java new file mode 100644 index 00000000..6a89c11f --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/service/impl/ContestExplanationServiceImpl.java @@ -0,0 +1,20 @@ +package top.hcode.service.impl; + +import top.hcode.entity.ContestExplanation; +import top.hcode.dao.ContestExplanationMapper; +import top.hcode.service.ContestExplanationService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +@Service +public class ContestExplanationServiceImpl extends ServiceImpl implements ContestExplanationService { + +} diff --git a/hoj/DataBackup/src/main/java/top/hcode/service/impl/ContestProblemServiceImpl.java b/hoj/DataBackup/src/main/java/top/hcode/service/impl/ContestProblemServiceImpl.java new file mode 100644 index 00000000..91d093e7 --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/service/impl/ContestProblemServiceImpl.java @@ -0,0 +1,20 @@ +package top.hcode.service.impl; + +import top.hcode.entity.ContestProblem; +import top.hcode.dao.ContestProblemMapper; +import top.hcode.service.ContestProblemService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +@Service +public class ContestProblemServiceImpl extends ServiceImpl implements ContestProblemService { + +} diff --git a/hoj/DataBackup/src/main/java/top/hcode/service/impl/ContestRecordServiceImpl.java b/hoj/DataBackup/src/main/java/top/hcode/service/impl/ContestRecordServiceImpl.java new file mode 100644 index 00000000..fdb542c2 --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/service/impl/ContestRecordServiceImpl.java @@ -0,0 +1,20 @@ +package top.hcode.service.impl; + +import top.hcode.entity.ContestRecord; +import top.hcode.dao.ContestRecordMapper; +import top.hcode.service.ContestRecordService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +@Service +public class ContestRecordServiceImpl extends ServiceImpl implements ContestRecordService { + +} diff --git a/hoj/DataBackup/src/main/java/top/hcode/service/impl/ContestRegisterServiceImpl.java b/hoj/DataBackup/src/main/java/top/hcode/service/impl/ContestRegisterServiceImpl.java new file mode 100644 index 00000000..f7713a04 --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/service/impl/ContestRegisterServiceImpl.java @@ -0,0 +1,20 @@ +package top.hcode.service.impl; + +import top.hcode.entity.ContestRegister; +import top.hcode.dao.ContestRegisterMapper; +import top.hcode.service.ContestRegisterService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +@Service +public class ContestRegisterServiceImpl extends ServiceImpl implements ContestRegisterService { + +} diff --git a/hoj/DataBackup/src/main/java/top/hcode/service/impl/ContestScoreServiceImpl.java b/hoj/DataBackup/src/main/java/top/hcode/service/impl/ContestScoreServiceImpl.java new file mode 100644 index 00000000..4bc98f07 --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/service/impl/ContestScoreServiceImpl.java @@ -0,0 +1,20 @@ +package top.hcode.service.impl; + +import top.hcode.entity.ContestScore; +import top.hcode.dao.ContestScoreMapper; +import top.hcode.service.ContestScoreService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +@Service +public class ContestScoreServiceImpl extends ServiceImpl implements ContestScoreService { + +} diff --git a/hoj/DataBackup/src/main/java/top/hcode/service/impl/ContestServiceImpl.java b/hoj/DataBackup/src/main/java/top/hcode/service/impl/ContestServiceImpl.java new file mode 100644 index 00000000..93f621d1 --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/service/impl/ContestServiceImpl.java @@ -0,0 +1,20 @@ +package top.hcode.service.impl; + +import top.hcode.entity.Contest; +import top.hcode.dao.ContestMapper; +import top.hcode.service.ContestService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +@Service +public class ContestServiceImpl extends ServiceImpl implements ContestService { + +} diff --git a/hoj/DataBackup/src/main/java/top/hcode/service/impl/EmailServiceImpl.java b/hoj/DataBackup/src/main/java/top/hcode/service/impl/EmailServiceImpl.java new file mode 100644 index 00000000..2cef9806 --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/service/impl/EmailServiceImpl.java @@ -0,0 +1,101 @@ +package top.hcode.service.impl; + +import cn.hutool.core.date.DateTime; +import cn.hutool.core.date.DateUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.mail.javamail.JavaMailSender; +import org.springframework.mail.javamail.MimeMessageHelper; +import org.springframework.stereotype.Service; +import top.hcode.service.EmailService; + +import javax.mail.MessagingException; +import javax.mail.internet.MimeMessage; +import java.util.Date; + + +/** + * @Author: Himit_ZH + * @Date: 2020/10/24 13:21 + * @Description: + */ +@Service +public class EmailServiceImpl implements EmailService { + + @Autowired + JavaMailSender mailSender; + + @Override + public void sendCode(String email, String username, String code) throws MessagingException { + DateTime dateTime = DateUtil.offsetMinute(new Date(), 5); + MimeMessage mimeMessage = mailSender.createMimeMessage(); + MimeMessageHelper mimeMessageHelper = new MimeMessageHelper(mimeMessage, + true); + mimeMessageHelper.setSubject("HOJ的邮件提醒"); + mimeMessageHelper.setText("
\n" + + "\t\t\t\t
\n" + + "\t\t\t\t\t
\n" + + "\t\t\t\t\t\t\n" + + "\t\t\t\t\t
\n" + + "\t\t\t\t
\n" + + "\t\t\t\t
\n" + + "\t\t\t\t\t

\n" + + "\t\t\t\t\t\tDear "+username+"\n" + + "\t\t\t\t\t

\n" + + "\t\t\t\t\t
\n" + + "\t\t\t\t\t
\n" + + "\t\t\t\t\t\t

\n" + + "\t\t\t\t\t\t\t来自 HOJ 邮件提醒\n" + + "\t\t\t\t\t\t

\n" + + "\t\t\t\t\t

\n" + + "\t\t\t\t\t\t您收到这封电子邮件是因为您 (也可能是某人冒充您的名义) 在 HOJ 上进行注册。假如这不是您本人所申请, 请不用理会这封电子邮件, 但是如果您持续收到这类的信件骚扰, 请您尽快联络管理员。\n" + + "\t\t\t\t\t

\n" + + "\t\t\t\t\t
\n" + + "\t\t\t\t\t\t请使用以下验证码完成后续注册流程:
\n" + + "\t\t\t\t\t\t "+code+"
\n" + + "\t\t\t\t\t\t 注意:请您在收到邮件5分钟内("+dateTime.toString()+"前)使用,否则该验证码将会失效。\n" + + "\t\t\t\t\t\t
\n" + + "\t\t\t\t\t   \n" + + "\n" + + "\t\t\t\t\t
\n" + + "\t\t\t\t\t
\n" + + "\t\t\t\t\t\tHOJ|传送门\uD83D\uDEAA\n" + + "\t\t\t\t\t
\n" + + "\t\t\t\t\t

\n" + + "\t\t\t\t\t\t欢迎常来访问!
\n" + + "\t\t\t\t\t\t© 2020 \n" + + "\t\t\t\t\t\t\tHODE-OJ \n" + + "\t\t\t\t\t

\n" + + "\t\t\t\t\t

\n" + + "\t\t\t\t
\n" + + "\t\t\t
",true); + + + mimeMessageHelper.setTo(email); + mimeMessageHelper.setFrom("372347736@qq.com"); + mailSender.send(mimeMessage); + } +} \ No newline at end of file diff --git a/hoj/DataBackup/src/main/java/top/hcode/service/impl/JudgeCaseServiceImpl.java b/hoj/DataBackup/src/main/java/top/hcode/service/impl/JudgeCaseServiceImpl.java new file mode 100644 index 00000000..9dc19713 --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/service/impl/JudgeCaseServiceImpl.java @@ -0,0 +1,20 @@ +package top.hcode.service.impl; + +import top.hcode.entity.JudgeCase; +import top.hcode.dao.JudgeCaseMapper; +import top.hcode.service.JudgeCaseService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +@Service +public class JudgeCaseServiceImpl extends ServiceImpl implements JudgeCaseService { + +} diff --git a/hoj/DataBackup/src/main/java/top/hcode/service/impl/JudgeServiceImpl.java b/hoj/DataBackup/src/main/java/top/hcode/service/impl/JudgeServiceImpl.java new file mode 100644 index 00000000..73c2cb2c --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/service/impl/JudgeServiceImpl.java @@ -0,0 +1,20 @@ +package top.hcode.service.impl; + +import top.hcode.entity.Judge; +import top.hcode.dao.JudgeMapper; +import top.hcode.service.JudgeService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +@Service +public class JudgeServiceImpl extends ServiceImpl implements JudgeService { + +} diff --git a/hoj/DataBackup/src/main/java/top/hcode/service/impl/ProblemCountServiceImpl.java b/hoj/DataBackup/src/main/java/top/hcode/service/impl/ProblemCountServiceImpl.java new file mode 100644 index 00000000..4a4b6c0a --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/service/impl/ProblemCountServiceImpl.java @@ -0,0 +1,20 @@ +package top.hcode.service.impl; + +import top.hcode.entity.ProblemCount; +import top.hcode.dao.ProblemCountMapper; +import top.hcode.service.ProblemCountService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +@Service +public class ProblemCountServiceImpl extends ServiceImpl implements ProblemCountService { + +} diff --git a/hoj/DataBackup/src/main/java/top/hcode/service/impl/ProblemServiceImpl.java b/hoj/DataBackup/src/main/java/top/hcode/service/impl/ProblemServiceImpl.java new file mode 100644 index 00000000..ae1b5ebd --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/service/impl/ProblemServiceImpl.java @@ -0,0 +1,20 @@ +package top.hcode.service.impl; + +import top.hcode.entity.Problem; +import top.hcode.dao.ProblemMapper; +import top.hcode.service.ProblemService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +@Service +public class ProblemServiceImpl extends ServiceImpl implements ProblemService { + +} diff --git a/hoj/DataBackup/src/main/java/top/hcode/service/impl/RoleAuthServiceImpl.java b/hoj/DataBackup/src/main/java/top/hcode/service/impl/RoleAuthServiceImpl.java new file mode 100644 index 00000000..04060e56 --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/service/impl/RoleAuthServiceImpl.java @@ -0,0 +1,20 @@ +package top.hcode.service.impl; + +import top.hcode.entity.RoleAuth; +import top.hcode.dao.RoleAuthMapper; +import top.hcode.service.RoleAuthService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +@Service +public class RoleAuthServiceImpl extends ServiceImpl implements RoleAuthService { + +} diff --git a/hoj/DataBackup/src/main/java/top/hcode/service/impl/RoleServiceImpl.java b/hoj/DataBackup/src/main/java/top/hcode/service/impl/RoleServiceImpl.java new file mode 100644 index 00000000..7db1ffe0 --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/service/impl/RoleServiceImpl.java @@ -0,0 +1,20 @@ +package top.hcode.service.impl; + +import top.hcode.entity.Role; +import top.hcode.dao.RoleMapper; +import top.hcode.service.RoleService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +@Service +public class RoleServiceImpl extends ServiceImpl implements RoleService { + +} diff --git a/hoj/DataBackup/src/main/java/top/hcode/service/impl/UserAcproblemServiceImpl.java b/hoj/DataBackup/src/main/java/top/hcode/service/impl/UserAcproblemServiceImpl.java new file mode 100644 index 00000000..cd79f81f --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/service/impl/UserAcproblemServiceImpl.java @@ -0,0 +1,20 @@ +package top.hcode.service.impl; + +import top.hcode.entity.UserAcproblem; +import top.hcode.dao.UserAcproblemMapper; +import top.hcode.service.UserAcproblemService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +@Service +public class UserAcproblemServiceImpl extends ServiceImpl implements UserAcproblemService { + +} diff --git a/hoj/DataBackup/src/main/java/top/hcode/service/impl/UserInfoServiceImpl.java b/hoj/DataBackup/src/main/java/top/hcode/service/impl/UserInfoServiceImpl.java new file mode 100644 index 00000000..8feb19fe --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/service/impl/UserInfoServiceImpl.java @@ -0,0 +1,29 @@ +package top.hcode.service.impl; + +import org.springframework.beans.factory.annotation.Autowired; +import top.hcode.common.dto.RegisterDto; +import top.hcode.entity.UserInfo; +import top.hcode.dao.UserInfoMapper; +import top.hcode.service.UserInfoService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +@Service +public class UserInfoServiceImpl extends ServiceImpl implements UserInfoService { + + @Autowired + private UserInfoMapper userInfoMapper; + + @Override + public Integer addUser(RegisterDto registerDto) { + return userInfoMapper.addUser(registerDto); + } +} diff --git a/hoj/DataBackup/src/main/java/top/hcode/service/impl/UserRecordServiceImpl.java b/hoj/DataBackup/src/main/java/top/hcode/service/impl/UserRecordServiceImpl.java new file mode 100644 index 00000000..17e5f7c8 --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/service/impl/UserRecordServiceImpl.java @@ -0,0 +1,20 @@ +package top.hcode.service.impl; + +import top.hcode.entity.UserRecord; +import top.hcode.dao.UserRecordMapper; +import top.hcode.service.UserRecordService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +@Service +public class UserRecordServiceImpl extends ServiceImpl implements UserRecordService { + +} diff --git a/hoj/DataBackup/src/main/java/top/hcode/service/impl/UserRoleServiceImpl.java b/hoj/DataBackup/src/main/java/top/hcode/service/impl/UserRoleServiceImpl.java new file mode 100644 index 00000000..7cf9968d --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/service/impl/UserRoleServiceImpl.java @@ -0,0 +1,20 @@ +package top.hcode.service.impl; + +import top.hcode.entity.UserRole; +import top.hcode.dao.UserRoleMapper; +import top.hcode.service.UserRoleService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +@Service +public class UserRoleServiceImpl extends ServiceImpl implements UserRoleService { + +} diff --git a/hoj/DataBackup/src/main/java/top/hcode/shiro/AccountProfile.java b/hoj/DataBackup/src/main/java/top/hcode/shiro/AccountProfile.java new file mode 100644 index 00000000..4bde601c --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/shiro/AccountProfile.java @@ -0,0 +1,43 @@ +package top.hcode.shiro; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author: Himit_ZH + * @Date: 2020/7/19 22:59 + * @Description: + */ +@Data +public class AccountProfile implements Serializable { + private String uuid; + + private String username; + + private String password; + + private String nickname; + + private String school; + + private String course; + + private String number; + + private String realname; + + private String cfUsername; + + private String email; + + private String avatar; + + private String signature; + + private int status; + + public String getId(){ //shiro登录用户实体默认主键获取方法要为getId + return uuid; + } +} \ No newline at end of file diff --git a/hoj/DataBackup/src/main/java/top/hcode/shiro/AccountRealm.java b/hoj/DataBackup/src/main/java/top/hcode/shiro/AccountRealm.java new file mode 100644 index 00000000..33e82a25 --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/shiro/AccountRealm.java @@ -0,0 +1,53 @@ +package top.hcode.shiro; + +import cn.hutool.core.bean.BeanUtil; +import lombok.extern.slf4j.Slf4j; +import org.apache.shiro.authc.*; +import org.apache.shiro.authz.AuthorizationInfo; +import org.apache.shiro.realm.AuthorizingRealm; +import org.apache.shiro.subject.PrincipalCollection; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import top.hcode.entity.UserInfo; +import top.hcode.service.impl.UserInfoServiceImpl; +import top.hcode.utils.JwtUtils; + +/** + * @Author: Himit_ZH + * @Date: 2020/7/19 22:57 + * @Description: + */ +@Slf4j +@Component +public class AccountRealm extends AuthorizingRealm { + @Autowired + JwtUtils jwtUtils; + @Autowired + UserInfoServiceImpl userInfoService; + @Override + public boolean supports(AuthenticationToken token) { + return token instanceof JwtToken; + } + @Override + protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) { + return null; + } + @Override + protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws AuthenticationException { + JwtToken jwt = (JwtToken) token; + log.info("jwt----------------->{}", jwt); + String userId = jwtUtils.getClaimByToken((String) jwt.getPrincipal()).getSubject(); + UserInfo user = userInfoService.getById(userId); + if(user == null) { + throw new UnknownAccountException("账户不存在!"); + } + if(user.getStatus() == 1) { + throw new LockedAccountException("账户已被锁定!"); + } + AccountProfile profile = new AccountProfile(); + BeanUtil.copyProperties(user, profile); + log.info("profile----------------->{}", profile.toString()); + return new SimpleAuthenticationInfo(profile, jwt.getCredentials(), getName()); + } +} \ No newline at end of file diff --git a/hoj/DataBackup/src/main/java/top/hcode/shiro/JwtFilter.java b/hoj/DataBackup/src/main/java/top/hcode/shiro/JwtFilter.java new file mode 100644 index 00000000..1e3ecaa7 --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/shiro/JwtFilter.java @@ -0,0 +1,90 @@ +package top.hcode.shiro; + +import cn.hutool.json.JSONUtil; +import com.baomidou.mybatisplus.core.toolkit.StringUtils; +import io.jsonwebtoken.Claims; +import org.apache.shiro.authc.AuthenticationException; +import org.apache.shiro.authc.AuthenticationToken; +import org.apache.shiro.authc.ExpiredCredentialsException; +import org.apache.shiro.web.filter.authc.AuthenticatingFilter; +import org.apache.shiro.web.util.WebUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.web.bind.annotation.RequestMethod; +import top.hcode.common.result.CommonResult; +import top.hcode.utils.JwtUtils; + + +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +/** + * @Author: Himit_ZH + * @Date: 2020/7/19 23:16 + * @Description: + */ +@Component +public class JwtFilter extends AuthenticatingFilter { + + @Autowired + JwtUtils jwtUtils; + @Override + protected AuthenticationToken createToken(ServletRequest servletRequest, ServletResponse servletResponse) throws Exception { + // 获取 token + HttpServletRequest request = (HttpServletRequest) servletRequest; + String jwt = request.getHeader("Authorization"); + if(StringUtils.isEmpty(jwt)){ + return null; + } + return new JwtToken(jwt); + } + @Override + protected boolean onAccessDenied(ServletRequest servletRequest, ServletResponse servletResponse) throws Exception { + HttpServletRequest request = (HttpServletRequest) servletRequest; + String token = request.getHeader("Authorization"); + if(StringUtils.isEmpty(token)) { + return true; + } else { + // 判断是否已过期 + Claims claim = jwtUtils.getClaimByToken(token); + if(claim == null || jwtUtils.isTokenExpired(claim.getExpiration())) { + throw new ExpiredCredentialsException("token已失效,请重新登录!"); + } + } + // 执行自动登录 + return executeLogin(servletRequest, servletResponse); + } + @Override + protected boolean onLoginFailure(AuthenticationToken token, AuthenticationException e, ServletRequest request, ServletResponse response) { + HttpServletResponse httpResponse = (HttpServletResponse) response; + try { + //处理登录失败的异常 + Throwable throwable = e.getCause() == null ? e : e.getCause(); + CommonResult result = CommonResult.errorResponse(throwable.getMessage(),CommonResult.STATUS_ERROR); + String json = JSONUtil.toJsonStr(result); + httpResponse.getWriter().print(json); + } catch (IOException e1) { + } + return false; + } + /** + * 对跨域提供支持 + */ + @Override + protected boolean preHandle(ServletRequest request, ServletResponse response) throws Exception { + HttpServletRequest httpServletRequest = WebUtils.toHttp(request); + HttpServletResponse httpServletResponse = WebUtils.toHttp(response); + httpServletResponse.setHeader("Access-control-Allow-Origin", httpServletRequest.getHeader("Origin")); + httpServletResponse.setHeader("Access-Control-Allow-Methods", "GET,POST,OPTIONS,PUT,DELETE"); + httpServletResponse.setHeader("Access-Control-Allow-Headers", httpServletRequest.getHeader("Access-Control-Request-Headers")); + // 跨域时会首先发送一个OPTIONS请求,这里我们给OPTIONS请求直接返回正常状态 + if (httpServletRequest.getMethod().equals(RequestMethod.OPTIONS.name())) { + httpServletResponse.setStatus(org.springframework.http.HttpStatus.OK.value()); + return false; + } + return super.preHandle(request, response); + } +} \ No newline at end of file diff --git a/hoj/DataBackup/src/main/java/top/hcode/shiro/JwtToken.java b/hoj/DataBackup/src/main/java/top/hcode/shiro/JwtToken.java new file mode 100644 index 00000000..f9fb4bfb --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/shiro/JwtToken.java @@ -0,0 +1,23 @@ +package top.hcode.shiro; + +import org.apache.shiro.authc.AuthenticationToken; + +/** + * @Author: Himit_ZH + * @Date: 2020/7/19 22:58 + * @Description: + */ +public class JwtToken implements AuthenticationToken { + private String token; + public JwtToken(String token) { + this.token = token; + } + @Override + public Object getPrincipal() { + return token; + } + @Override + public Object getCredentials() { + return token; + } +} \ No newline at end of file diff --git a/hoj/DataBackup/src/main/java/top/hcode/utils/JwtUtils.java b/hoj/DataBackup/src/main/java/top/hcode/utils/JwtUtils.java new file mode 100644 index 00000000..0464c27f --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/utils/JwtUtils.java @@ -0,0 +1,59 @@ +package top.hcode.utils; + +import io.jsonwebtoken.Claims; +import io.jsonwebtoken.Jwts; +import io.jsonwebtoken.SignatureAlgorithm; +import lombok.Data; +import lombok.extern.slf4j.Slf4j; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +import java.util.Date; + +@Slf4j +@Data +@Component +@ConfigurationProperties(prefix = "hoj.jwt") +public class JwtUtils { + + private String secret; + private long expire; + private String header; + + /** + * 生成jwt token + */ + public String generateToken(String userId) { + Date nowDate = new Date(); + //过期时间 + Date expireDate = new Date(nowDate.getTime() + expire * 1000); + + return Jwts.builder() + .setHeaderParam("type", "JWT") + .setSubject(userId) + .setIssuedAt(nowDate) + .setExpiration(expireDate) + .signWith(SignatureAlgorithm.HS512, secret) + .compact(); + } + + public Claims getClaimByToken(String token) { + try { + return Jwts.parser() + .setSigningKey(secret) + .parseClaimsJws(token) + .getBody(); + }catch (Exception e){ + log.debug("validate is token error ", e); + return null; + } + } + + /** + * token是否过期 + * @return true:过期 + */ + public boolean isTokenExpired(Date expiration) { + return expiration.before(new Date()); + } +} diff --git a/hoj/DataBackup/src/main/java/top/hcode/utils/RedisUtils.java b/hoj/DataBackup/src/main/java/top/hcode/utils/RedisUtils.java new file mode 100644 index 00000000..95e36cb3 --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/utils/RedisUtils.java @@ -0,0 +1,576 @@ +package top.hcode.utils; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; + +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.TimeUnit; + +/** + * @Author: Himit_ZH + * @Date: 2020/10/23 23:48 + * @Description: + */ + +@Component +public final class RedisUtils { + + @Autowired + private RedisTemplate redisTemplate; + + // =============================common============================ + /** + * 指定缓存失效时间 + * @param key 键 + * @param time 时间(秒) + */ + public boolean expire(String key, long time) { + try { + if (time > 0) { + redisTemplate.expire(key, time, TimeUnit.SECONDS); + } + return true; + } catch (Exception e) { + e.printStackTrace(); + return false; + } + } + + /** + * 根据key 获取过期时间 + * @param key 键 不能为null + * @return 时间(秒) 返回0代表为永久有效 + */ + public long getExpire(String key) { + return redisTemplate.getExpire(key, TimeUnit.SECONDS); + } + + + /** + * 判断key是否存在 + * @param key 键 + * @return true 存在 false不存在 + */ + public boolean hasKey(String key) { + try { + return redisTemplate.hasKey(key); + } catch (Exception e) { + e.printStackTrace(); + return false; + } + } + + + /** + * 删除缓存 + * @param key 可以传一个值 或多个 + */ + @SuppressWarnings("unchecked") + public void del(String... key) { + if (key != null && key.length > 0) { + if (key.length == 1) { + redisTemplate.delete(key[0]); + } else { + redisTemplate.delete(CollectionUtils.arrayToList(key)); + } + } + } + + + // ============================String============================= + + /** + * 普通缓存获取 + * @param key 键 + * @return 值 + */ + public Object get(String key) { + return key == null ? null : redisTemplate.opsForValue().get(key); + } + + /** + * 普通缓存放入 + * @param key 键 + * @param value 值 + * @return true成功 false失败 + */ + + public boolean set(String key, Object value) { + try { + redisTemplate.opsForValue().set(key, value); + return true; + } catch (Exception e) { + e.printStackTrace(); + return false; + } + } + + + /** + * 普通缓存放入并设置时间 + * @param key 键 + * @param value 值 + * @param time 时间(秒) time要大于0 如果time小于等于0 将设置无限期 + * @return true成功 false 失败 + */ + + public boolean set(String key, Object value, long time) { + try { + if (time > 0) { + redisTemplate.opsForValue().set(key, value, time, TimeUnit.SECONDS); + } else { + set(key, value); + } + return true; + } catch (Exception e) { + e.printStackTrace(); + return false; + } + } + + + /** + * 递增 + * @param key 键 + * @param delta 要增加几(大于0) + */ + public long incr(String key, long delta) { + if (delta < 0) { + throw new RuntimeException("递增因子必须大于0"); + } + return redisTemplate.opsForValue().increment(key, delta); + } + + + /** + * 递减 + * @param key 键 + * @param delta 要减少几(小于0) + */ + public long decr(String key, long delta) { + if (delta < 0) { + throw new RuntimeException("递减因子必须大于0"); + } + return redisTemplate.opsForValue().increment(key, -delta); + } + + + // ================================Map================================= + + /** + * HashGet + * @param key 键 不能为null + * @param item 项 不能为null + */ + public Object hget(String key, String item) { + return redisTemplate.opsForHash().get(key, item); + } + + /** + * 获取hashKey对应的所有键值 + * @param key 键 + * @return 对应的多个键值 + */ + public Map hmget(String key) { + return redisTemplate.opsForHash().entries(key); + } + + /** + * HashSet + * @param key 键 + * @param map 对应多个键值 + */ + public boolean hmset(String key, Map map) { + try { + redisTemplate.opsForHash().putAll(key, map); + return true; + } catch (Exception e) { + e.printStackTrace(); + return false; + } + } + + + /** + * HashSet 并设置时间 + * @param key 键 + * @param map 对应多个键值 + * @param time 时间(秒) + * @return true成功 false失败 + */ + public boolean hmset(String key, Map map, long time) { + try { + redisTemplate.opsForHash().putAll(key, map); + if (time > 0) { + expire(key, time); + } + return true; + } catch (Exception e) { + e.printStackTrace(); + return false; + } + } + + + /** + * 向一张hash表中放入数据,如果不存在将创建 + * + * @param key 键 + * @param item 项 + * @param value 值 + * @return true 成功 false失败 + */ + public boolean hset(String key, String item, Object value) { + try { + redisTemplate.opsForHash().put(key, item, value); + return true; + } catch (Exception e) { + e.printStackTrace(); + return false; + } + } + + /** + * 向一张hash表中放入数据,如果不存在将创建 + * + * @param key 键 + * @param item 项 + * @param value 值 + * @param time 时间(秒) 注意:如果已存在的hash表有时间,这里将会替换原有的时间 + * @return true 成功 false失败 + */ + public boolean hset(String key, String item, Object value, long time) { + try { + redisTemplate.opsForHash().put(key, item, value); + if (time > 0) { + expire(key, time); + } + return true; + } catch (Exception e) { + e.printStackTrace(); + return false; + } + } + + + /** + * 删除hash表中的值 + * + * @param key 键 不能为null + * @param item 项 可以使多个 不能为null + */ + public void hdel(String key, Object... item) { + redisTemplate.opsForHash().delete(key, item); + } + + + /** + * 判断hash表中是否有该项的值 + * + * @param key 键 不能为null + * @param item 项 不能为null + * @return true 存在 false不存在 + */ + public boolean hHasKey(String key, String item) { + return redisTemplate.opsForHash().hasKey(key, item); + } + + + /** + * hash递增 如果不存在,就会创建一个 并把新增后的值返回 + * + * @param key 键 + * @param item 项 + * @param by 要增加几(大于0) + */ + public double hincr(String key, String item, double by) { + return redisTemplate.opsForHash().increment(key, item, by); + } + + + /** + * hash递减 + * + * @param key 键 + * @param item 项 + * @param by 要减少记(小于0) + */ + public double hdecr(String key, String item, double by) { + return redisTemplate.opsForHash().increment(key, item, -by); + } + + + // ============================set============================= + + /** + * 根据key获取Set中的所有值 + * @param key 键 + */ + public Set sGet(String key) { + try { + return redisTemplate.opsForSet().members(key); + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + + /** + * 根据value从一个set中查询,是否存在 + * + * @param key 键 + * @param value 值 + * @return true 存在 false不存在 + */ + public boolean sHasKey(String key, Object value) { + try { + return redisTemplate.opsForSet().isMember(key, value); + } catch (Exception e) { + e.printStackTrace(); + return false; + } + } + + + /** + * 将数据放入set缓存 + * + * @param key 键 + * @param values 值 可以是多个 + * @return 成功个数 + */ + public long sSet(String key, Object... values) { + try { + return redisTemplate.opsForSet().add(key, values); + } catch (Exception e) { + e.printStackTrace(); + return 0; + } + } + + + /** + * 将set数据放入缓存 + * + * @param key 键 + * @param time 时间(秒) + * @param values 值 可以是多个 + * @return 成功个数 + */ + public long sSetAndTime(String key, long time, Object... values) { + try { + Long count = redisTemplate.opsForSet().add(key, values); + if (time > 0) + expire(key, time); + return count; + } catch (Exception e) { + e.printStackTrace(); + return 0; + } + } + + + /** + * 获取set缓存的长度 + * + * @param key 键 + */ + public long sGetSetSize(String key) { + try { + return redisTemplate.opsForSet().size(key); + } catch (Exception e) { + e.printStackTrace(); + return 0; + } + } + + + /** + * 移除值为value的 + * + * @param key 键 + * @param values 值 可以是多个 + * @return 移除的个数 + */ + + public long setRemove(String key, Object... values) { + try { + Long count = redisTemplate.opsForSet().remove(key, values); + return count; + } catch (Exception e) { + e.printStackTrace(); + return 0; + } + } + + // ===============================list================================= + + /** + * 获取list缓存的内容 + * + * @param key 键 + * @param start 开始 + * @param end 结束 0 到 -1代表所有值 + */ + public List lGet(String key, long start, long end) { + try { + return redisTemplate.opsForList().range(key, start, end); + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + + /** + * 获取list缓存的长度 + * + * @param key 键 + */ + public long lGetListSize(String key) { + try { + return redisTemplate.opsForList().size(key); + } catch (Exception e) { + e.printStackTrace(); + return 0; + } + } + + + /** + * 通过索引 获取list中的值 + * + * @param key 键 + * @param index 索引 index>=0时, 0 表头,1 第二个元素,依次类推;index<0时,-1,表尾,-2倒数第二个元素,依次类推 + */ + public Object lGetIndex(String key, long index) { + try { + return redisTemplate.opsForList().index(key, index); + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + + /** + * 将list放入缓存 + * + * @param key 键 + * @param value 值 + */ + public boolean lSet(String key, Object value) { + try { + redisTemplate.opsForList().rightPush(key, value); + return true; + } catch (Exception e) { + e.printStackTrace(); + return false; + } + } + + + /** + * 将list放入缓存 + * @param key 键 + * @param value 值 + * @param time 时间(秒) + */ + public boolean lSet(String key, Object value, long time) { + try { + redisTemplate.opsForList().rightPush(key, value); + if (time > 0) + expire(key, time); + return true; + } catch (Exception e) { + e.printStackTrace(); + return false; + } + + } + + + /** + * 将list放入缓存 + * + * @param key 键 + * @param value 值 + * @return + */ + public boolean lSet(String key, List value) { + try { + redisTemplate.opsForList().rightPushAll(key, value); + return true; + } catch (Exception e) { + e.printStackTrace(); + return false; + } + + } + + + /** + * 将list放入缓存 + * + * @param key 键 + * @param value 值 + * @param time 时间(秒) + * @return + */ + public boolean lSet(String key, List value, long time) { + try { + redisTemplate.opsForList().rightPushAll(key, value); + if (time > 0) + expire(key, time); + return true; + } catch (Exception e) { + e.printStackTrace(); + return false; + } + } + + /** + * 根据索引修改list中的某条数据 + * + * @param key 键 + * @param index 索引 + * @param value 值 + * @return + */ + + public boolean lUpdateIndex(String key, long index, Object value) { + try { + redisTemplate.opsForList().set(key, index, value); + return true; + } catch (Exception e) { + e.printStackTrace(); + return false; + } + } + + /** + * 移除N个值为value + * + * @param key 键 + * @param count 移除多少个 + * @param value 值 + * @return 移除的个数 + */ + + public long lRemove(String key, long count, Object value) { + try { + Long remove = redisTemplate.opsForList().remove(key, count, value); + return remove; + } catch (Exception e) { + e.printStackTrace(); + return 0; + } + + } + +} \ No newline at end of file diff --git a/hoj/DataBackup/src/main/java/top/hcode/utils/ShiroUtils.java b/hoj/DataBackup/src/main/java/top/hcode/utils/ShiroUtils.java new file mode 100644 index 00000000..d88cb85d --- /dev/null +++ b/hoj/DataBackup/src/main/java/top/hcode/utils/ShiroUtils.java @@ -0,0 +1,16 @@ +package top.hcode.utils; + +import org.apache.shiro.SecurityUtils; +import top.hcode.shiro.AccountProfile; + + +/** + * @Author: Himit_ZH + * @Date: 2020/7/20 14:13 + * @Description: + */ +public class ShiroUtils { + public static AccountProfile getProfile(){ + return (AccountProfile) SecurityUtils.getSubject().getPrincipal(); + } +} \ No newline at end of file diff --git a/hoj/DataBackup/src/main/resources/application.yml b/hoj/DataBackup/src/main/resources/application.yml new file mode 100644 index 00000000..b886f6e0 --- /dev/null +++ b/hoj/DataBackup/src/main/resources/application.yml @@ -0,0 +1,76 @@ +server: + port: 8080 + +# 消费者将要去访问的微服务名称(注册成功进入nacos的微服务提供者) + +#service-url: +# nacos-user-service: http://sentinel-dept-provider + +# 激活Sentinel对Feign的支持 +#feign: +# sentinel: +# enabled: true + +spring: + profiles: + active: dev + mail: + properties.mail.smtp.ssl.enable: true + username: 372347736@qq.com + password: neainmvuetxhbgfa + host: smtp.qq.com + redis: + host: 129.204.177.72 + port: 6371 +# application: +# name: hoj-data-backup +# cloud: +# nacos: +# discovery: +# server-addr: 129.204.177.72:8848 + datasource: + username: root + password: Hzh&hy2020 + url: jdbc:mysql://129.204.177.72:3306/hoj?serverTimezone=UTC&useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2b8 + driver-class-name: com.mysql.cj.jdbc.Driver + type: com.alibaba.druid.pool.DruidDataSource + initial-size: 10 # 初始化时建立物理连接的个数。初始化发生在显示调用init方法,或者第一次getConnection时 + min-idle: 10 # 最小连接池数量 + maxActive: 200 # 最大连接池数量 + maxWait: 60000 # 获取连接时最大等待时间,单位毫秒。配置了maxWait之后,缺省启用公平锁,并发效率会有所下降,如果需要可以通过配置 + timeBetweenEvictionRunsMillis: 60000 # 关闭空闲连接的检测时间间隔.Destroy线程会检测连接的间隔时间,如果连接空闲时间大于等于minEvictableIdleTimeMillis则关闭物理连接。 + minEvictableIdleTimeMillis: 300000 # 连接的最小生存时间.连接保持空闲而不被驱逐的最小时间 + validationQuery: SELECT 1 FROM DUAL # 验证数据库服务可用性的sql.用来检测连接是否有效的sql 因数据库方言而差, 例如 oracle 应该写成 SELECT 1 FROM DUAL + testWhileIdle: true # 申请连接时检测空闲时间,根据空闲时间再检测连接是否有效.建议配置为true,不影响性能,并且保证安全性。申请连接的时候检测,如果空闲时间大于timeBetweenEvictionRun + testOnBorrow: false # 申请连接时直接检测连接是否有效.申请连接时执行validationQuery检测连接是否有效,做了这个配置会降低性能。 + testOnReturn: false # 归还连接时检测连接是否有效.归还连接时执行validationQuery检测连接是否有效,做了这个配置会降低性能。 + poolPreparedStatements: true # 开启PSCache + maxPoolPreparedStatementPerConnectionSize: 20 #设置PSCache值 + connectionErrorRetryAttempts: 3 # 连接出错后再尝试连接三次 + breakAfterAcquireFailure: true # 数据库服务宕机自动重连机制 + timeBetweenConnectErrorMillis: 300000 # 连接出错后重试时间间隔 + asyncInit: true # 异步初始化策略 + remove-abandoned: true # 是否自动回收超时连接 + remove-abandoned-timeout: 1800 # 超时时间(以秒数为单位) + transaction-query-timeout: 6000 # 事务超时时间 + filters: stat,wall,log4j #数据库日志 + connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=500 + + + + +mybatis-plus: + mapper-locations: classpath*:top/hcode/dao/xml/**Mapper.xml + type-aliases-package: top.hcode.entity + +shiro-redis: + enabled: true + redis-manager: + host: 129.204.177.72:6371 +hoj: + jwt: + # 加密秘钥 + secret: zsc-acm-hoj + # token有效时长,1小时,单位秒 + expire: 3600 + header: token \ No newline at end of file diff --git a/hoj/DataBackup/src/test/java/top/hcode/DataBackupApplicationTests.java b/hoj/DataBackup/src/test/java/top/hcode/DataBackupApplicationTests.java new file mode 100644 index 00000000..c2d34df9 --- /dev/null +++ b/hoj/DataBackup/src/test/java/top/hcode/DataBackupApplicationTests.java @@ -0,0 +1,28 @@ +package top.hcode; + +import cn.hutool.core.util.IdUtil; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import top.hcode.common.dto.RegisterDto; +import top.hcode.dao.UserInfoMapper; +import top.hcode.entity.UserInfo; + +/** + * @Author: Himit_ZH + * @Date: 2020/10/24 17:24 + * @Description: + */ +@SpringBootTest +public class DataBackupApplicationTests { + + @Autowired + UserInfoMapper userInfoMapper; + + @Test + public void Test1(){ + int test = userInfoMapper.addUser(new RegisterDto().setUuid(IdUtil.simpleUUID()).setEmail("372347736@qq.com").setNickname("test") + .setUsername("111").setPassword("123456").setNumber("2018030801054")); + System.out.println(test); + } +} \ No newline at end of file diff --git a/hoj/DataBackup/target/classes/application.yml b/hoj/DataBackup/target/classes/application.yml new file mode 100644 index 00000000..b886f6e0 --- /dev/null +++ b/hoj/DataBackup/target/classes/application.yml @@ -0,0 +1,76 @@ +server: + port: 8080 + +# 消费者将要去访问的微服务名称(注册成功进入nacos的微服务提供者) + +#service-url: +# nacos-user-service: http://sentinel-dept-provider + +# 激活Sentinel对Feign的支持 +#feign: +# sentinel: +# enabled: true + +spring: + profiles: + active: dev + mail: + properties.mail.smtp.ssl.enable: true + username: 372347736@qq.com + password: neainmvuetxhbgfa + host: smtp.qq.com + redis: + host: 129.204.177.72 + port: 6371 +# application: +# name: hoj-data-backup +# cloud: +# nacos: +# discovery: +# server-addr: 129.204.177.72:8848 + datasource: + username: root + password: Hzh&hy2020 + url: jdbc:mysql://129.204.177.72:3306/hoj?serverTimezone=UTC&useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2b8 + driver-class-name: com.mysql.cj.jdbc.Driver + type: com.alibaba.druid.pool.DruidDataSource + initial-size: 10 # 初始化时建立物理连接的个数。初始化发生在显示调用init方法,或者第一次getConnection时 + min-idle: 10 # 最小连接池数量 + maxActive: 200 # 最大连接池数量 + maxWait: 60000 # 获取连接时最大等待时间,单位毫秒。配置了maxWait之后,缺省启用公平锁,并发效率会有所下降,如果需要可以通过配置 + timeBetweenEvictionRunsMillis: 60000 # 关闭空闲连接的检测时间间隔.Destroy线程会检测连接的间隔时间,如果连接空闲时间大于等于minEvictableIdleTimeMillis则关闭物理连接。 + minEvictableIdleTimeMillis: 300000 # 连接的最小生存时间.连接保持空闲而不被驱逐的最小时间 + validationQuery: SELECT 1 FROM DUAL # 验证数据库服务可用性的sql.用来检测连接是否有效的sql 因数据库方言而差, 例如 oracle 应该写成 SELECT 1 FROM DUAL + testWhileIdle: true # 申请连接时检测空闲时间,根据空闲时间再检测连接是否有效.建议配置为true,不影响性能,并且保证安全性。申请连接的时候检测,如果空闲时间大于timeBetweenEvictionRun + testOnBorrow: false # 申请连接时直接检测连接是否有效.申请连接时执行validationQuery检测连接是否有效,做了这个配置会降低性能。 + testOnReturn: false # 归还连接时检测连接是否有效.归还连接时执行validationQuery检测连接是否有效,做了这个配置会降低性能。 + poolPreparedStatements: true # 开启PSCache + maxPoolPreparedStatementPerConnectionSize: 20 #设置PSCache值 + connectionErrorRetryAttempts: 3 # 连接出错后再尝试连接三次 + breakAfterAcquireFailure: true # 数据库服务宕机自动重连机制 + timeBetweenConnectErrorMillis: 300000 # 连接出错后重试时间间隔 + asyncInit: true # 异步初始化策略 + remove-abandoned: true # 是否自动回收超时连接 + remove-abandoned-timeout: 1800 # 超时时间(以秒数为单位) + transaction-query-timeout: 6000 # 事务超时时间 + filters: stat,wall,log4j #数据库日志 + connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=500 + + + + +mybatis-plus: + mapper-locations: classpath*:top/hcode/dao/xml/**Mapper.xml + type-aliases-package: top.hcode.entity + +shiro-redis: + enabled: true + redis-manager: + host: 129.204.177.72:6371 +hoj: + jwt: + # 加密秘钥 + secret: zsc-acm-hoj + # token有效时长,1小时,单位秒 + expire: 3600 + header: token \ No newline at end of file diff --git a/hoj/DataBackup/target/classes/top/hcode/DataBackupApplication.class b/hoj/DataBackup/target/classes/top/hcode/DataBackupApplication.class new file mode 100644 index 00000000..cb4a5a97 Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/DataBackupApplication.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/common/dto/LoginDto.class b/hoj/DataBackup/target/classes/top/hcode/common/dto/LoginDto.class new file mode 100644 index 00000000..18d9b31a Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/common/dto/LoginDto.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/common/dto/RegisterDto.class b/hoj/DataBackup/target/classes/top/hcode/common/dto/RegisterDto.class new file mode 100644 index 00000000..2c8bca63 Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/common/dto/RegisterDto.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/common/exception/GlobalExceptionHandler.class b/hoj/DataBackup/target/classes/top/hcode/common/exception/GlobalExceptionHandler.class new file mode 100644 index 00000000..5ed5bb0f Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/common/exception/GlobalExceptionHandler.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/common/result/CommonResult.class b/hoj/DataBackup/target/classes/top/hcode/common/result/CommonResult.class new file mode 100644 index 00000000..045101f0 Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/common/result/CommonResult.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/config/CorsConfig.class b/hoj/DataBackup/target/classes/top/hcode/config/CorsConfig.class new file mode 100644 index 00000000..7c3f8a74 Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/config/CorsConfig.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/config/MybatisPlusConfig.class b/hoj/DataBackup/target/classes/top/hcode/config/MybatisPlusConfig.class new file mode 100644 index 00000000..fac982e9 Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/config/MybatisPlusConfig.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/config/RedisConfig.class b/hoj/DataBackup/target/classes/top/hcode/config/RedisConfig.class new file mode 100644 index 00000000..60d40239 Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/config/RedisConfig.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/config/ShiroConfig.class b/hoj/DataBackup/target/classes/top/hcode/config/ShiroConfig.class new file mode 100644 index 00000000..b4a9332c Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/config/ShiroConfig.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/config/SwaggerConfig.class b/hoj/DataBackup/target/classes/top/hcode/config/SwaggerConfig.class new file mode 100644 index 00000000..daea2319 Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/config/SwaggerConfig.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/controller/AccountController.class b/hoj/DataBackup/target/classes/top/hcode/controller/AccountController.class new file mode 100644 index 00000000..199856bf Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/controller/AccountController.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/dao/AuthMapper.class b/hoj/DataBackup/target/classes/top/hcode/dao/AuthMapper.class new file mode 100644 index 00000000..f0b0374a Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/dao/AuthMapper.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/dao/CommentMapper.class b/hoj/DataBackup/target/classes/top/hcode/dao/CommentMapper.class new file mode 100644 index 00000000..196898bb Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/dao/CommentMapper.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/dao/CommentTagMapper.class b/hoj/DataBackup/target/classes/top/hcode/dao/CommentTagMapper.class new file mode 100644 index 00000000..bf282f9b Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/dao/CommentTagMapper.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/dao/ContestAnnouncementMapper.class b/hoj/DataBackup/target/classes/top/hcode/dao/ContestAnnouncementMapper.class new file mode 100644 index 00000000..96416b36 Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/dao/ContestAnnouncementMapper.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/dao/ContestExplanationMapper.class b/hoj/DataBackup/target/classes/top/hcode/dao/ContestExplanationMapper.class new file mode 100644 index 00000000..fc170a45 Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/dao/ContestExplanationMapper.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/dao/ContestMapper.class b/hoj/DataBackup/target/classes/top/hcode/dao/ContestMapper.class new file mode 100644 index 00000000..027e97c5 Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/dao/ContestMapper.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/dao/ContestProblemMapper.class b/hoj/DataBackup/target/classes/top/hcode/dao/ContestProblemMapper.class new file mode 100644 index 00000000..c22fda72 Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/dao/ContestProblemMapper.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/dao/ContestRecordMapper.class b/hoj/DataBackup/target/classes/top/hcode/dao/ContestRecordMapper.class new file mode 100644 index 00000000..331db82c Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/dao/ContestRecordMapper.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/dao/ContestRegisterMapper.class b/hoj/DataBackup/target/classes/top/hcode/dao/ContestRegisterMapper.class new file mode 100644 index 00000000..847a3523 Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/dao/ContestRegisterMapper.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/dao/ContestScoreMapper.class b/hoj/DataBackup/target/classes/top/hcode/dao/ContestScoreMapper.class new file mode 100644 index 00000000..f8af17c9 Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/dao/ContestScoreMapper.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/dao/JudgeCaseMapper.class b/hoj/DataBackup/target/classes/top/hcode/dao/JudgeCaseMapper.class new file mode 100644 index 00000000..56fb827b Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/dao/JudgeCaseMapper.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/dao/JudgeMapper.class b/hoj/DataBackup/target/classes/top/hcode/dao/JudgeMapper.class new file mode 100644 index 00000000..e4e6633c Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/dao/JudgeMapper.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/dao/ProblemCountMapper.class b/hoj/DataBackup/target/classes/top/hcode/dao/ProblemCountMapper.class new file mode 100644 index 00000000..378bc395 Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/dao/ProblemCountMapper.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/dao/ProblemMapper.class b/hoj/DataBackup/target/classes/top/hcode/dao/ProblemMapper.class new file mode 100644 index 00000000..cbb5cddd Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/dao/ProblemMapper.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/dao/RoleAuthMapper.class b/hoj/DataBackup/target/classes/top/hcode/dao/RoleAuthMapper.class new file mode 100644 index 00000000..62eb41ed Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/dao/RoleAuthMapper.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/dao/RoleMapper.class b/hoj/DataBackup/target/classes/top/hcode/dao/RoleMapper.class new file mode 100644 index 00000000..c4eaf9d3 Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/dao/RoleMapper.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/dao/UserAcproblemMapper.class b/hoj/DataBackup/target/classes/top/hcode/dao/UserAcproblemMapper.class new file mode 100644 index 00000000..dabfd294 Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/dao/UserAcproblemMapper.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/dao/UserInfoMapper.class b/hoj/DataBackup/target/classes/top/hcode/dao/UserInfoMapper.class new file mode 100644 index 00000000..b7fcdf51 Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/dao/UserInfoMapper.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/dao/UserRecordMapper.class b/hoj/DataBackup/target/classes/top/hcode/dao/UserRecordMapper.class new file mode 100644 index 00000000..60b9bf11 Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/dao/UserRecordMapper.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/dao/UserRoleMapper.class b/hoj/DataBackup/target/classes/top/hcode/dao/UserRoleMapper.class new file mode 100644 index 00000000..98967048 Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/dao/UserRoleMapper.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/dao/xml/AuthMapper.xml b/hoj/DataBackup/target/classes/top/hcode/dao/xml/AuthMapper.xml new file mode 100644 index 00000000..d2316d4c --- /dev/null +++ b/hoj/DataBackup/target/classes/top/hcode/dao/xml/AuthMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hoj/DataBackup/target/classes/top/hcode/dao/xml/CommentMapper.xml b/hoj/DataBackup/target/classes/top/hcode/dao/xml/CommentMapper.xml new file mode 100644 index 00000000..22d20be8 --- /dev/null +++ b/hoj/DataBackup/target/classes/top/hcode/dao/xml/CommentMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hoj/DataBackup/target/classes/top/hcode/dao/xml/CommentTagMapper.xml b/hoj/DataBackup/target/classes/top/hcode/dao/xml/CommentTagMapper.xml new file mode 100644 index 00000000..611ed73b --- /dev/null +++ b/hoj/DataBackup/target/classes/top/hcode/dao/xml/CommentTagMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hoj/DataBackup/target/classes/top/hcode/dao/xml/ContestAnnouncementMapper.xml b/hoj/DataBackup/target/classes/top/hcode/dao/xml/ContestAnnouncementMapper.xml new file mode 100644 index 00000000..0b2c2672 --- /dev/null +++ b/hoj/DataBackup/target/classes/top/hcode/dao/xml/ContestAnnouncementMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hoj/DataBackup/target/classes/top/hcode/dao/xml/ContestExplanationMapper.xml b/hoj/DataBackup/target/classes/top/hcode/dao/xml/ContestExplanationMapper.xml new file mode 100644 index 00000000..ff9941ab --- /dev/null +++ b/hoj/DataBackup/target/classes/top/hcode/dao/xml/ContestExplanationMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hoj/DataBackup/target/classes/top/hcode/dao/xml/ContestMapper.xml b/hoj/DataBackup/target/classes/top/hcode/dao/xml/ContestMapper.xml new file mode 100644 index 00000000..af4de1d0 --- /dev/null +++ b/hoj/DataBackup/target/classes/top/hcode/dao/xml/ContestMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hoj/DataBackup/target/classes/top/hcode/dao/xml/ContestProblemMapper.xml b/hoj/DataBackup/target/classes/top/hcode/dao/xml/ContestProblemMapper.xml new file mode 100644 index 00000000..1b091917 --- /dev/null +++ b/hoj/DataBackup/target/classes/top/hcode/dao/xml/ContestProblemMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hoj/DataBackup/target/classes/top/hcode/dao/xml/ContestRecordMapper.xml b/hoj/DataBackup/target/classes/top/hcode/dao/xml/ContestRecordMapper.xml new file mode 100644 index 00000000..9315e9e4 --- /dev/null +++ b/hoj/DataBackup/target/classes/top/hcode/dao/xml/ContestRecordMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hoj/DataBackup/target/classes/top/hcode/dao/xml/ContestRegisterMapper.xml b/hoj/DataBackup/target/classes/top/hcode/dao/xml/ContestRegisterMapper.xml new file mode 100644 index 00000000..022d2cf6 --- /dev/null +++ b/hoj/DataBackup/target/classes/top/hcode/dao/xml/ContestRegisterMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hoj/DataBackup/target/classes/top/hcode/dao/xml/ContestScoreMapper.xml b/hoj/DataBackup/target/classes/top/hcode/dao/xml/ContestScoreMapper.xml new file mode 100644 index 00000000..f01f02d2 --- /dev/null +++ b/hoj/DataBackup/target/classes/top/hcode/dao/xml/ContestScoreMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hoj/DataBackup/target/classes/top/hcode/dao/xml/JudgeCaseMapper.xml b/hoj/DataBackup/target/classes/top/hcode/dao/xml/JudgeCaseMapper.xml new file mode 100644 index 00000000..b1b09574 --- /dev/null +++ b/hoj/DataBackup/target/classes/top/hcode/dao/xml/JudgeCaseMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hoj/DataBackup/target/classes/top/hcode/dao/xml/JudgeMapper.xml b/hoj/DataBackup/target/classes/top/hcode/dao/xml/JudgeMapper.xml new file mode 100644 index 00000000..0abbce7e --- /dev/null +++ b/hoj/DataBackup/target/classes/top/hcode/dao/xml/JudgeMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hoj/DataBackup/target/classes/top/hcode/dao/xml/ProblemCountMapper.xml b/hoj/DataBackup/target/classes/top/hcode/dao/xml/ProblemCountMapper.xml new file mode 100644 index 00000000..76b5051e --- /dev/null +++ b/hoj/DataBackup/target/classes/top/hcode/dao/xml/ProblemCountMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hoj/DataBackup/target/classes/top/hcode/dao/xml/ProblemMapper.xml b/hoj/DataBackup/target/classes/top/hcode/dao/xml/ProblemMapper.xml new file mode 100644 index 00000000..c436265e --- /dev/null +++ b/hoj/DataBackup/target/classes/top/hcode/dao/xml/ProblemMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hoj/DataBackup/target/classes/top/hcode/dao/xml/RoleAuthMapper.xml b/hoj/DataBackup/target/classes/top/hcode/dao/xml/RoleAuthMapper.xml new file mode 100644 index 00000000..d1660d81 --- /dev/null +++ b/hoj/DataBackup/target/classes/top/hcode/dao/xml/RoleAuthMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hoj/DataBackup/target/classes/top/hcode/dao/xml/RoleMapper.xml b/hoj/DataBackup/target/classes/top/hcode/dao/xml/RoleMapper.xml new file mode 100644 index 00000000..a71fdd36 --- /dev/null +++ b/hoj/DataBackup/target/classes/top/hcode/dao/xml/RoleMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hoj/DataBackup/target/classes/top/hcode/dao/xml/UserAcproblemMapper.xml b/hoj/DataBackup/target/classes/top/hcode/dao/xml/UserAcproblemMapper.xml new file mode 100644 index 00000000..4ba9e06e --- /dev/null +++ b/hoj/DataBackup/target/classes/top/hcode/dao/xml/UserAcproblemMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hoj/DataBackup/target/classes/top/hcode/dao/xml/UserInfoMapper.xml b/hoj/DataBackup/target/classes/top/hcode/dao/xml/UserInfoMapper.xml new file mode 100644 index 00000000..85e404a4 --- /dev/null +++ b/hoj/DataBackup/target/classes/top/hcode/dao/xml/UserInfoMapper.xml @@ -0,0 +1,9 @@ + + + + + insert into user_info(uuid,username,password,nickname,email,number) values ( + #{uuid}, #{username},#{password},#{nickname},#{email},#{number} + ) + + diff --git a/hoj/DataBackup/target/classes/top/hcode/dao/xml/UserRecordMapper.xml b/hoj/DataBackup/target/classes/top/hcode/dao/xml/UserRecordMapper.xml new file mode 100644 index 00000000..d51473df --- /dev/null +++ b/hoj/DataBackup/target/classes/top/hcode/dao/xml/UserRecordMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hoj/DataBackup/target/classes/top/hcode/dao/xml/UserRoleMapper.xml b/hoj/DataBackup/target/classes/top/hcode/dao/xml/UserRoleMapper.xml new file mode 100644 index 00000000..0f583fbb --- /dev/null +++ b/hoj/DataBackup/target/classes/top/hcode/dao/xml/UserRoleMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hoj/DataBackup/target/classes/top/hcode/service/AuthService.class b/hoj/DataBackup/target/classes/top/hcode/service/AuthService.class new file mode 100644 index 00000000..a4eb55df Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/service/AuthService.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/service/CommentService.class b/hoj/DataBackup/target/classes/top/hcode/service/CommentService.class new file mode 100644 index 00000000..8a189603 Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/service/CommentService.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/service/CommentTagService.class b/hoj/DataBackup/target/classes/top/hcode/service/CommentTagService.class new file mode 100644 index 00000000..28e48c9c Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/service/CommentTagService.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/service/ContestAnnouncementService.class b/hoj/DataBackup/target/classes/top/hcode/service/ContestAnnouncementService.class new file mode 100644 index 00000000..6b8f9882 Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/service/ContestAnnouncementService.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/service/ContestExplanationService.class b/hoj/DataBackup/target/classes/top/hcode/service/ContestExplanationService.class new file mode 100644 index 00000000..b0d96ba6 Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/service/ContestExplanationService.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/service/ContestProblemService.class b/hoj/DataBackup/target/classes/top/hcode/service/ContestProblemService.class new file mode 100644 index 00000000..543fe051 Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/service/ContestProblemService.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/service/ContestRecordService.class b/hoj/DataBackup/target/classes/top/hcode/service/ContestRecordService.class new file mode 100644 index 00000000..5f42b9c5 Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/service/ContestRecordService.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/service/ContestRegisterService.class b/hoj/DataBackup/target/classes/top/hcode/service/ContestRegisterService.class new file mode 100644 index 00000000..6bdd7186 Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/service/ContestRegisterService.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/service/ContestScoreService.class b/hoj/DataBackup/target/classes/top/hcode/service/ContestScoreService.class new file mode 100644 index 00000000..5fbd4ee2 Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/service/ContestScoreService.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/service/ContestService.class b/hoj/DataBackup/target/classes/top/hcode/service/ContestService.class new file mode 100644 index 00000000..77a70233 Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/service/ContestService.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/service/EmailService.class b/hoj/DataBackup/target/classes/top/hcode/service/EmailService.class new file mode 100644 index 00000000..61e41d5f Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/service/EmailService.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/service/JudgeCaseService.class b/hoj/DataBackup/target/classes/top/hcode/service/JudgeCaseService.class new file mode 100644 index 00000000..804168a4 Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/service/JudgeCaseService.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/service/JudgeService.class b/hoj/DataBackup/target/classes/top/hcode/service/JudgeService.class new file mode 100644 index 00000000..6362196e Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/service/JudgeService.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/service/ProblemCountService.class b/hoj/DataBackup/target/classes/top/hcode/service/ProblemCountService.class new file mode 100644 index 00000000..be599523 Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/service/ProblemCountService.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/service/ProblemService.class b/hoj/DataBackup/target/classes/top/hcode/service/ProblemService.class new file mode 100644 index 00000000..b52ddaa0 Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/service/ProblemService.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/service/RoleAuthService.class b/hoj/DataBackup/target/classes/top/hcode/service/RoleAuthService.class new file mode 100644 index 00000000..336e30f8 Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/service/RoleAuthService.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/service/RoleService.class b/hoj/DataBackup/target/classes/top/hcode/service/RoleService.class new file mode 100644 index 00000000..10034cbe Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/service/RoleService.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/service/UserAcproblemService.class b/hoj/DataBackup/target/classes/top/hcode/service/UserAcproblemService.class new file mode 100644 index 00000000..b94ca38e Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/service/UserAcproblemService.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/service/UserInfoService.class b/hoj/DataBackup/target/classes/top/hcode/service/UserInfoService.class new file mode 100644 index 00000000..4944e04a Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/service/UserInfoService.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/service/UserRecordService.class b/hoj/DataBackup/target/classes/top/hcode/service/UserRecordService.class new file mode 100644 index 00000000..ba8b4ecb Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/service/UserRecordService.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/service/UserRoleService.class b/hoj/DataBackup/target/classes/top/hcode/service/UserRoleService.class new file mode 100644 index 00000000..613e609f Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/service/UserRoleService.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/service/impl/AuthServiceImpl.class b/hoj/DataBackup/target/classes/top/hcode/service/impl/AuthServiceImpl.class new file mode 100644 index 00000000..8a8d7cb3 Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/service/impl/AuthServiceImpl.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/service/impl/CommentServiceImpl.class b/hoj/DataBackup/target/classes/top/hcode/service/impl/CommentServiceImpl.class new file mode 100644 index 00000000..27b8788f Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/service/impl/CommentServiceImpl.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/service/impl/CommentTagServiceImpl.class b/hoj/DataBackup/target/classes/top/hcode/service/impl/CommentTagServiceImpl.class new file mode 100644 index 00000000..44b391c5 Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/service/impl/CommentTagServiceImpl.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/service/impl/ContestAnnouncementServiceImpl.class b/hoj/DataBackup/target/classes/top/hcode/service/impl/ContestAnnouncementServiceImpl.class new file mode 100644 index 00000000..4bcde131 Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/service/impl/ContestAnnouncementServiceImpl.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/service/impl/ContestExplanationServiceImpl.class b/hoj/DataBackup/target/classes/top/hcode/service/impl/ContestExplanationServiceImpl.class new file mode 100644 index 00000000..aaf2cbb3 Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/service/impl/ContestExplanationServiceImpl.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/service/impl/ContestProblemServiceImpl.class b/hoj/DataBackup/target/classes/top/hcode/service/impl/ContestProblemServiceImpl.class new file mode 100644 index 00000000..b4cdb9e8 Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/service/impl/ContestProblemServiceImpl.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/service/impl/ContestRecordServiceImpl.class b/hoj/DataBackup/target/classes/top/hcode/service/impl/ContestRecordServiceImpl.class new file mode 100644 index 00000000..f4fdd865 Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/service/impl/ContestRecordServiceImpl.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/service/impl/ContestRegisterServiceImpl.class b/hoj/DataBackup/target/classes/top/hcode/service/impl/ContestRegisterServiceImpl.class new file mode 100644 index 00000000..c841de2a Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/service/impl/ContestRegisterServiceImpl.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/service/impl/ContestScoreServiceImpl.class b/hoj/DataBackup/target/classes/top/hcode/service/impl/ContestScoreServiceImpl.class new file mode 100644 index 00000000..fe8fce7d Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/service/impl/ContestScoreServiceImpl.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/service/impl/ContestServiceImpl.class b/hoj/DataBackup/target/classes/top/hcode/service/impl/ContestServiceImpl.class new file mode 100644 index 00000000..c633a944 Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/service/impl/ContestServiceImpl.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/service/impl/EmailServiceImpl.class b/hoj/DataBackup/target/classes/top/hcode/service/impl/EmailServiceImpl.class new file mode 100644 index 00000000..44d4df34 Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/service/impl/EmailServiceImpl.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/service/impl/JudgeCaseServiceImpl.class b/hoj/DataBackup/target/classes/top/hcode/service/impl/JudgeCaseServiceImpl.class new file mode 100644 index 00000000..6f11a652 Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/service/impl/JudgeCaseServiceImpl.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/service/impl/JudgeServiceImpl.class b/hoj/DataBackup/target/classes/top/hcode/service/impl/JudgeServiceImpl.class new file mode 100644 index 00000000..4e6fa97f Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/service/impl/JudgeServiceImpl.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/service/impl/ProblemCountServiceImpl.class b/hoj/DataBackup/target/classes/top/hcode/service/impl/ProblemCountServiceImpl.class new file mode 100644 index 00000000..95afa273 Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/service/impl/ProblemCountServiceImpl.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/service/impl/ProblemServiceImpl.class b/hoj/DataBackup/target/classes/top/hcode/service/impl/ProblemServiceImpl.class new file mode 100644 index 00000000..7510914b Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/service/impl/ProblemServiceImpl.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/service/impl/RoleAuthServiceImpl.class b/hoj/DataBackup/target/classes/top/hcode/service/impl/RoleAuthServiceImpl.class new file mode 100644 index 00000000..ad15eadc Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/service/impl/RoleAuthServiceImpl.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/service/impl/RoleServiceImpl.class b/hoj/DataBackup/target/classes/top/hcode/service/impl/RoleServiceImpl.class new file mode 100644 index 00000000..b0059a4d Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/service/impl/RoleServiceImpl.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/service/impl/UserAcproblemServiceImpl.class b/hoj/DataBackup/target/classes/top/hcode/service/impl/UserAcproblemServiceImpl.class new file mode 100644 index 00000000..c64a81dc Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/service/impl/UserAcproblemServiceImpl.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/service/impl/UserInfoServiceImpl.class b/hoj/DataBackup/target/classes/top/hcode/service/impl/UserInfoServiceImpl.class new file mode 100644 index 00000000..5aafcecb Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/service/impl/UserInfoServiceImpl.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/service/impl/UserRecordServiceImpl.class b/hoj/DataBackup/target/classes/top/hcode/service/impl/UserRecordServiceImpl.class new file mode 100644 index 00000000..abf38bf2 Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/service/impl/UserRecordServiceImpl.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/service/impl/UserRoleServiceImpl.class b/hoj/DataBackup/target/classes/top/hcode/service/impl/UserRoleServiceImpl.class new file mode 100644 index 00000000..fbd387e8 Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/service/impl/UserRoleServiceImpl.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/shiro/AccountProfile.class b/hoj/DataBackup/target/classes/top/hcode/shiro/AccountProfile.class new file mode 100644 index 00000000..d3c082b5 Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/shiro/AccountProfile.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/shiro/AccountRealm.class b/hoj/DataBackup/target/classes/top/hcode/shiro/AccountRealm.class new file mode 100644 index 00000000..25b08a6c Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/shiro/AccountRealm.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/shiro/JwtFilter.class b/hoj/DataBackup/target/classes/top/hcode/shiro/JwtFilter.class new file mode 100644 index 00000000..2aa29070 Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/shiro/JwtFilter.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/shiro/JwtToken.class b/hoj/DataBackup/target/classes/top/hcode/shiro/JwtToken.class new file mode 100644 index 00000000..dba81dce Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/shiro/JwtToken.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/utils/JwtUtils.class b/hoj/DataBackup/target/classes/top/hcode/utils/JwtUtils.class new file mode 100644 index 00000000..9131600c Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/utils/JwtUtils.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/utils/RedisUtils.class b/hoj/DataBackup/target/classes/top/hcode/utils/RedisUtils.class new file mode 100644 index 00000000..e19df7c7 Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/utils/RedisUtils.class differ diff --git a/hoj/DataBackup/target/classes/top/hcode/utils/ShiroUtils.class b/hoj/DataBackup/target/classes/top/hcode/utils/ShiroUtils.class new file mode 100644 index 00000000..ddcba010 Binary files /dev/null and b/hoj/DataBackup/target/classes/top/hcode/utils/ShiroUtils.class differ diff --git a/hoj/DataBackup/target/test-classes/top/hcode/DataBackupApplicationTests.class b/hoj/DataBackup/target/test-classes/top/hcode/DataBackupApplicationTests.class new file mode 100644 index 00000000..968dcadc Binary files /dev/null and b/hoj/DataBackup/target/test-classes/top/hcode/DataBackupApplicationTests.class differ diff --git a/hoj/api/pom.xml b/hoj/api/pom.xml new file mode 100644 index 00000000..0aafa8d7 --- /dev/null +++ b/hoj/api/pom.xml @@ -0,0 +1,42 @@ + + + + hoj + top.hcode + 1.0-SNAPSHOT + + 4.0.0 + + api + + + + io.springfox + springfox-swagger2 + 2.9.2 + + + io.springfox + springfox-swagger-ui + 2.9.2 + + + org.springframework.cloud + spring-cloud-starter-openfeign + + + com.baomidou + mybatis-plus-boot-starter + 3.2.0 + + + org.projectlombok + lombok + true + + + + + \ No newline at end of file diff --git a/hoj/api/src/main/java/top/hcode/entity/Auth.java b/hoj/api/src/main/java/top/hcode/entity/Auth.java new file mode 100644 index 00000000..326f2aed --- /dev/null +++ b/hoj/api/src/main/java/top/hcode/entity/Auth.java @@ -0,0 +1,51 @@ +package top.hcode.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value="Auth对象", description="") +public class Auth implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty(value = "权限名称") + private String name; + + @ApiModelProperty(value = "权限字符串") + private String permission; + + @ApiModelProperty(value = "0可用,1不可用") + private Integer status; + + @TableField(fill = FieldFill.INSERT) + private Date gmtCreate; + + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date gmtModified; + + +} diff --git a/hoj/api/src/main/java/top/hcode/entity/Comment.java b/hoj/api/src/main/java/top/hcode/entity/Comment.java new file mode 100644 index 00000000..e0aa7226 --- /dev/null +++ b/hoj/api/src/main/java/top/hcode/entity/Comment.java @@ -0,0 +1,59 @@ +package top.hcode.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value="Comment对象", description="") +public class Comment implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + private String uid; + + @ApiModelProperty(value = "讨论标题") + private String title; + + @ApiModelProperty(value = "讨论详情") + private String content; + + @ApiModelProperty(value = "标签id,0表示无") + private Long tid; + + @ApiModelProperty(value = "0表示无引用题目") + private Long pid; + + @ApiModelProperty(value = "0表示无引用比赛") + private Long cid; + + @TableField(fill = FieldFill.INSERT) + private Date gmtCreate; + + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date gmtModified; + + +} diff --git a/hoj/api/src/main/java/top/hcode/entity/CommentTag.java b/hoj/api/src/main/java/top/hcode/entity/CommentTag.java new file mode 100644 index 00000000..9ffc265e --- /dev/null +++ b/hoj/api/src/main/java/top/hcode/entity/CommentTag.java @@ -0,0 +1,48 @@ +package top.hcode.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value="CommentTag对象", description="") +public class CommentTag implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty(value = "标签名字") + private String name; + + @ApiModelProperty(value = "标签颜色") + private String color; + + @TableField(fill = FieldFill.INSERT) + private Date gmtCreate; + + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date gmtModified; + + +} diff --git a/hoj/api/src/main/java/top/hcode/entity/Contest.java b/hoj/api/src/main/java/top/hcode/entity/Contest.java new file mode 100644 index 00000000..77658a87 --- /dev/null +++ b/hoj/api/src/main/java/top/hcode/entity/Contest.java @@ -0,0 +1,72 @@ +package top.hcode.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value="Contest对象", description="") +public class Contest implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty(value = "比赛创建者id") + private String uid; + + @ApiModelProperty(value = "比赛标题") + private String title; + + @ApiModelProperty(value = "0为acm赛制,1为比分赛制") + private Integer type; + + @ApiModelProperty(value = "比赛说明") + private String explain; + + @ApiModelProperty(value = "比赛来源,原创为0,克隆赛为比赛id") + private Integer source; + + @ApiModelProperty(value = "0为公开赛,1为私有赛(有密码),2为报名赛") + private Integer auth; + + @ApiModelProperty(value = "比赛密码") + private String pwd; + + @ApiModelProperty(value = "开始时间") + private Date startTime; + + @ApiModelProperty(value = "结束时间") + private Date endTime; + + @ApiModelProperty(value = "比赛时长(分)") + private Integer duration; + + @TableField(fill = FieldFill.INSERT) + private Date gmtCreate; + + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date gmtModified; + + +} diff --git a/hoj/api/src/main/java/top/hcode/entity/ContestAnnouncement.java b/hoj/api/src/main/java/top/hcode/entity/ContestAnnouncement.java new file mode 100644 index 00000000..69e1d641 --- /dev/null +++ b/hoj/api/src/main/java/top/hcode/entity/ContestAnnouncement.java @@ -0,0 +1,53 @@ +package top.hcode.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value="ContestAnnouncement对象", description="") +public class ContestAnnouncement implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + private Long cid; + + @ApiModelProperty(value = "通知标题") + private String title; + + @ApiModelProperty(value = "通知内容") + private String content; + + @ApiModelProperty(value = "发布者(必须为比赛创建者或者超级管理员才能)") + private String uid; + + @TableField(fill = FieldFill.INSERT) + private Date gmtCreate; + + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date gmtModified; + + +} diff --git a/hoj/api/src/main/java/top/hcode/entity/ContestExplanation.java b/hoj/api/src/main/java/top/hcode/entity/ContestExplanation.java new file mode 100644 index 00000000..e328be88 --- /dev/null +++ b/hoj/api/src/main/java/top/hcode/entity/ContestExplanation.java @@ -0,0 +1,50 @@ +package top.hcode.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value="ContestExplanation对象", description="") +public class ContestExplanation implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + private Long cid; + + @ApiModelProperty(value = "发布者(必须为比赛创建者或者超级管理员才能)") + private String uid; + + @ApiModelProperty(value = "内容(支持markdown)") + private String content; + + @TableField(fill = FieldFill.INSERT) + private Date gmtCreate; + + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date gmtModified; + + +} diff --git a/hoj/api/src/main/java/top/hcode/entity/ContestProblem.java b/hoj/api/src/main/java/top/hcode/entity/ContestProblem.java new file mode 100644 index 00000000..f3e06d8d --- /dev/null +++ b/hoj/api/src/main/java/top/hcode/entity/ContestProblem.java @@ -0,0 +1,54 @@ +package top.hcode.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value="ContestProblem对象", description="") +public class ContestProblem implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty(value = "比赛id") + private Long cid; + + @ApiModelProperty(value = "题目id") + private Long pid; + + @ApiModelProperty(value = "该题目在比赛中的标题,默认为原名字") + private String cpName; + + @ApiModelProperty(value = "该题目在比赛中的顺序id") + private String cpNum; + + @TableField(fill = FieldFill.INSERT) + private Date gmtCreate; + + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date gmtModified; + + +} diff --git a/hoj/api/src/main/java/top/hcode/entity/ContestRecord.java b/hoj/api/src/main/java/top/hcode/entity/ContestRecord.java new file mode 100644 index 00000000..16e62a09 --- /dev/null +++ b/hoj/api/src/main/java/top/hcode/entity/ContestRecord.java @@ -0,0 +1,60 @@ +package top.hcode.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value="ContestRecord对象", description="") +public class ContestRecord implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + private Long cid; + + private String uid; + + private Long pid; + + @ApiModelProperty(value = "比赛中的题目顺序id") + private Long cpid; + + @ApiModelProperty(value = "提交id,用于可重判") + private Long submitId; + + @ApiModelProperty(value = "提交结果,0不加罚时,-1加罚时,1表示AC") + private Integer status; + + @ApiModelProperty(value = "提交时间") + private Date time; + + @TableField(fill = FieldFill.INSERT) + private Date gmtCreate; + + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date gmtModified; + + +} diff --git a/hoj/api/src/main/java/top/hcode/entity/ContestRegister.java b/hoj/api/src/main/java/top/hcode/entity/ContestRegister.java new file mode 100644 index 00000000..25ad1b9a --- /dev/null +++ b/hoj/api/src/main/java/top/hcode/entity/ContestRegister.java @@ -0,0 +1,51 @@ +package top.hcode.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value="ContestRegister对象", description="") +public class ContestRegister implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty(value = "比赛id") + private Long cid; + + @ApiModelProperty(value = "用户id") + private String uid; + + @ApiModelProperty(value = "默认为0表示正常,1为失效。") + private Integer status; + + @TableField(fill = FieldFill.INSERT) + private Date gmtCreate; + + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date gmtModified; + + +} diff --git a/hoj/api/src/main/java/top/hcode/entity/ContestScore.java b/hoj/api/src/main/java/top/hcode/entity/ContestScore.java new file mode 100644 index 00000000..0289dc3e --- /dev/null +++ b/hoj/api/src/main/java/top/hcode/entity/ContestScore.java @@ -0,0 +1,53 @@ +package top.hcode.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value="ContestScore对象", description="") +public class ContestScore implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + private Long cid; + + @ApiModelProperty(value = "比赛前的score得分") + private Integer last; + + @ApiModelProperty(value = "Score比分变化") + private Integer change; + + @ApiModelProperty(value = "现在的score") + private Integer now; + + @TableField(fill = FieldFill.INSERT) + private Date gmtCreate; + + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date gmtModified; + + +} diff --git a/hoj/api/src/main/java/top/hcode/entity/Judge.java b/hoj/api/src/main/java/top/hcode/entity/Judge.java new file mode 100644 index 00000000..212d9578 --- /dev/null +++ b/hoj/api/src/main/java/top/hcode/entity/Judge.java @@ -0,0 +1,84 @@ +package top.hcode.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value="Judge对象", description="") +public class Judge implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(value = "submit_id", type = IdType.AUTO) + private Long submitId; + + private Long pid; + + private String uid; + + private Date submitTime; + + @ApiModelProperty(value = "结果码具体参考文档") + private Integer status; + + @ApiModelProperty(value = "0为代码全部人可见,1为仅自己可见。") + private Integer auth; + + @ApiModelProperty(value = "错误提醒(编译错误,或者vj提醒)") + private String errorMessage; + + @ApiModelProperty(value = "运行时间") + private Integer time; + + @ApiModelProperty(value = "运行内存") + private Integer memory; + + @ApiModelProperty(value = "代码长度") + private Integer length; + + @ApiModelProperty(value = "代码") + private String code; + + @ApiModelProperty(value = "代码语言") + private String language; + + @ApiModelProperty(value = "比赛id,非比赛题目默认为0") + private Long cid; + + @ApiModelProperty(value = "比赛中题目排序id,非比赛题目默认为0") + private Long cpid; + + @ApiModelProperty(value = "判题机ip") + private String judger; + + @ApiModelProperty(value = "提交者所在ip") + private String ip; + + @TableField(fill = FieldFill.INSERT) + private Date gmtCreate; + + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date gmtModified; + + +} diff --git a/hoj/api/src/main/java/top/hcode/entity/JudgeCase.java b/hoj/api/src/main/java/top/hcode/entity/JudgeCase.java new file mode 100644 index 00000000..1b90fd0e --- /dev/null +++ b/hoj/api/src/main/java/top/hcode/entity/JudgeCase.java @@ -0,0 +1,68 @@ +package top.hcode.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.sql.Blob; +import java.util.Date; + +/** + *

+ * + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value="JudgeCase对象", description="") +public class JudgeCase implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(value = "submit_id", type = IdType.ID_WORKER) + private Long submitId; + + private String uid; + + private Long pid; + + @ApiModelProperty(value = "具体看结果码") + private Integer status; + + @ApiModelProperty(value = "运行时间") + private Integer time; + + @ApiModelProperty(value = "运行内存") + private Integer memory; + + @ApiModelProperty(value = "测试样例id") + private String caseId; + + @ApiModelProperty(value = "样例输入,比赛不可看") + private String inputData; + + @ApiModelProperty(value = "样例输出,比赛不可看") + private String outputData; + + @ApiModelProperty(value = "用户样例输出,比赛不可看") + private Blob userOutput; + + @TableField(fill = FieldFill.INSERT) + private Date gmtCreate; + + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date gmtModified; + + +} diff --git a/hoj/api/src/main/java/top/hcode/entity/Problem.java b/hoj/api/src/main/java/top/hcode/entity/Problem.java new file mode 100644 index 00000000..a0428231 --- /dev/null +++ b/hoj/api/src/main/java/top/hcode/entity/Problem.java @@ -0,0 +1,76 @@ +package top.hcode.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value="Problem对象", description="") +public class Problem implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + private String title; + + private String author; + + @ApiModelProperty(value = "单位ms") + private Integer timeLimit; + + @ApiModelProperty(value = "单位kb") + private Integer memoryLimit; + + @ApiModelProperty(value = "描述") + private String description; + + @ApiModelProperty(value = "输入描述") + private String input; + + @ApiModelProperty(value = "输出描述") + private String output; + + @ApiModelProperty(value = "多样例用(#)隔开") + private String inputSample; + + @ApiModelProperty(value = "多样例用(#)隔开") + private String outputSample; + + @ApiModelProperty(value = "题目来源") + private String source; + + @ApiModelProperty(value = "备注") + private String comment; + + @ApiModelProperty(value = "默认为1公开,2为私有,3为比赛中") + private Integer auth; + + @TableField(fill = FieldFill.INSERT) + private Date gmtCreate; + + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date gmtModified; + + +} diff --git a/hoj/api/src/main/java/top/hcode/entity/ProblemCount.java b/hoj/api/src/main/java/top/hcode/entity/ProblemCount.java new file mode 100644 index 00000000..1dd196e3 --- /dev/null +++ b/hoj/api/src/main/java/top/hcode/entity/ProblemCount.java @@ -0,0 +1,70 @@ +package top.hcode.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value="ProblemCount对象", description="") +public class ProblemCount implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(value = "pid", type = IdType.ID_WORKER) + private Long pid; + + private Integer total; + + private Integer ac; + + @ApiModelProperty(value = "空间超限") + private Integer mle; + + @ApiModelProperty(value = "时间超限") + private Integer tle; + + @ApiModelProperty(value = "运行错误") + private Integer re; + + @ApiModelProperty(value = "格式错误") + private Integer pe; + + @ApiModelProperty(value = "编译错误") + private Integer ce; + + @ApiModelProperty(value = "答案错误") + private Integer wa; + + @ApiModelProperty(value = "系统错误") + private Integer se; + + @ApiModelProperty(value = "题目分数,默认为100") + private Integer score; + + @TableField(fill = FieldFill.INSERT) + private Date gmtCreate; + + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date gmtModified; + + +} diff --git a/hoj/api/src/main/java/top/hcode/entity/Role.java b/hoj/api/src/main/java/top/hcode/entity/Role.java new file mode 100644 index 00000000..b7f56839 --- /dev/null +++ b/hoj/api/src/main/java/top/hcode/entity/Role.java @@ -0,0 +1,53 @@ +package top.hcode.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value="Role对象", description="") +public class Role implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.ID_WORKER) + private Long id; + + @ApiModelProperty(value = "角色") + private String role; + + @ApiModelProperty(value = "描述") + private String description; + + @ApiModelProperty(value = "默认0可用,1不可用") + private Integer status; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date gmtCreate; + + @ApiModelProperty(value = "修改时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date gmtModified; + + +} diff --git a/hoj/api/src/main/java/top/hcode/entity/RoleAuth.java b/hoj/api/src/main/java/top/hcode/entity/RoleAuth.java new file mode 100644 index 00000000..0c6b8284 --- /dev/null +++ b/hoj/api/src/main/java/top/hcode/entity/RoleAuth.java @@ -0,0 +1,40 @@ +package top.hcode.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import io.swagger.annotations.ApiModel; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value="RoleAuth对象", description="") +public class RoleAuth implements Serializable { + + private static final long serialVersionUID = 1L; + + private Long authId; + + private Long roleId; + + @TableField(fill = FieldFill.INSERT) + private Date gmtCreate; + + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date gmtModified; + + +} diff --git a/hoj/api/src/main/java/top/hcode/entity/UserAcproblem.java b/hoj/api/src/main/java/top/hcode/entity/UserAcproblem.java new file mode 100644 index 00000000..2a409923 --- /dev/null +++ b/hoj/api/src/main/java/top/hcode/entity/UserAcproblem.java @@ -0,0 +1,48 @@ +package top.hcode.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value="UserAcproblem对象", description="") +public class UserAcproblem implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty(value = "用户id") + private String uid; + + @ApiModelProperty(value = "ac的题目id") + private Long pid; + + @TableField(fill = FieldFill.INSERT) + private Date gmtCreate; + + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date gmtModified; + + +} diff --git a/hoj/api/src/main/java/top/hcode/entity/UserInfo.java b/hoj/api/src/main/java/top/hcode/entity/UserInfo.java new file mode 100644 index 00000000..8169d77e --- /dev/null +++ b/hoj/api/src/main/java/top/hcode/entity/UserInfo.java @@ -0,0 +1,80 @@ +package top.hcode.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value="UserInfo对象", description="") +public class UserInfo implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(value = "uuid",type =IdType.UUID) + private String uuid; + + @ApiModelProperty(value = "用户名") + private String username; + + @ApiModelProperty(value = "密码") + private String password; + + @ApiModelProperty(value = "昵称") + private String nickname; + + @ApiModelProperty(value = "学校") + private String school; + + @ApiModelProperty(value = "专业") + private String course; + + @ApiModelProperty(value = "学号") + private String number; + + @ApiModelProperty(value = "真实姓名") + private String realname; + + @ApiModelProperty(value = "cf的username") + private String cfUsername; + + @ApiModelProperty(value = "邮箱") + private String email; + + @ApiModelProperty(value = "头像地址") + private String avatar; + + @ApiModelProperty(value = "个性签名") + private String signature; + + @ApiModelProperty(value = "0可用,-1不可用") + private int status; + + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date gmtCreate; + + @ApiModelProperty(value = "修改时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date gmtModified; + + +} diff --git a/hoj/api/src/main/java/top/hcode/entity/UserRecord.java b/hoj/api/src/main/java/top/hcode/entity/UserRecord.java new file mode 100644 index 00000000..d84de0a0 --- /dev/null +++ b/hoj/api/src/main/java/top/hcode/entity/UserRecord.java @@ -0,0 +1,61 @@ +package top.hcode.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value="UserRecord对象", description="") +public class UserRecord implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty(value = "用户id") + private String uid; + + @ApiModelProperty(value = "总做题数") + private Integer total; + + @ApiModelProperty(value = "总提交数") + private Integer submissions; + + @ApiModelProperty(value = "总通过数") + private Integer ac; + + @ApiModelProperty(value = "cf得分") + @TableField("Rating") + private Integer Rating; + + @ApiModelProperty(value = "io制比赛得分") + private Integer score; + + @TableField(fill = FieldFill.INSERT) + private Date gmtCreate; + + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date gmtModified; + + +} diff --git a/hoj/api/src/main/java/top/hcode/entity/UserRole.java b/hoj/api/src/main/java/top/hcode/entity/UserRole.java new file mode 100644 index 00000000..dc44c77c --- /dev/null +++ b/hoj/api/src/main/java/top/hcode/entity/UserRole.java @@ -0,0 +1,40 @@ +package top.hcode.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import io.swagger.annotations.ApiModel; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * + *

+ * + * @author Himit_ZH + * @since 2020-10-23 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value="UserRole对象", description="") +public class UserRole implements Serializable { + + private static final long serialVersionUID = 1L; + + private String uid; + + private Long roleId; + + @TableField(fill = FieldFill.INSERT) + private Date gmtCreate; + + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date gmtModified; + + +} diff --git a/hoj/api/target/classes/top/hcode/entity/Auth.class b/hoj/api/target/classes/top/hcode/entity/Auth.class new file mode 100644 index 00000000..4f62887b Binary files /dev/null and b/hoj/api/target/classes/top/hcode/entity/Auth.class differ diff --git a/hoj/api/target/classes/top/hcode/entity/Comment.class b/hoj/api/target/classes/top/hcode/entity/Comment.class new file mode 100644 index 00000000..4eb0ae9d Binary files /dev/null and b/hoj/api/target/classes/top/hcode/entity/Comment.class differ diff --git a/hoj/api/target/classes/top/hcode/entity/CommentTag.class b/hoj/api/target/classes/top/hcode/entity/CommentTag.class new file mode 100644 index 00000000..de93c7e7 Binary files /dev/null and b/hoj/api/target/classes/top/hcode/entity/CommentTag.class differ diff --git a/hoj/api/target/classes/top/hcode/entity/Contest.class b/hoj/api/target/classes/top/hcode/entity/Contest.class new file mode 100644 index 00000000..f9ce0ca9 Binary files /dev/null and b/hoj/api/target/classes/top/hcode/entity/Contest.class differ diff --git a/hoj/api/target/classes/top/hcode/entity/ContestAnnouncement.class b/hoj/api/target/classes/top/hcode/entity/ContestAnnouncement.class new file mode 100644 index 00000000..d7dea7b0 Binary files /dev/null and b/hoj/api/target/classes/top/hcode/entity/ContestAnnouncement.class differ diff --git a/hoj/api/target/classes/top/hcode/entity/ContestExplanation.class b/hoj/api/target/classes/top/hcode/entity/ContestExplanation.class new file mode 100644 index 00000000..e5dfdba6 Binary files /dev/null and b/hoj/api/target/classes/top/hcode/entity/ContestExplanation.class differ diff --git a/hoj/api/target/classes/top/hcode/entity/ContestProblem.class b/hoj/api/target/classes/top/hcode/entity/ContestProblem.class new file mode 100644 index 00000000..a40da4da Binary files /dev/null and b/hoj/api/target/classes/top/hcode/entity/ContestProblem.class differ diff --git a/hoj/api/target/classes/top/hcode/entity/ContestRecord.class b/hoj/api/target/classes/top/hcode/entity/ContestRecord.class new file mode 100644 index 00000000..a5a23665 Binary files /dev/null and b/hoj/api/target/classes/top/hcode/entity/ContestRecord.class differ diff --git a/hoj/api/target/classes/top/hcode/entity/ContestRegister.class b/hoj/api/target/classes/top/hcode/entity/ContestRegister.class new file mode 100644 index 00000000..f26e14b3 Binary files /dev/null and b/hoj/api/target/classes/top/hcode/entity/ContestRegister.class differ diff --git a/hoj/api/target/classes/top/hcode/entity/ContestScore.class b/hoj/api/target/classes/top/hcode/entity/ContestScore.class new file mode 100644 index 00000000..abc69ecd Binary files /dev/null and b/hoj/api/target/classes/top/hcode/entity/ContestScore.class differ diff --git a/hoj/api/target/classes/top/hcode/entity/Judge.class b/hoj/api/target/classes/top/hcode/entity/Judge.class new file mode 100644 index 00000000..685f1010 Binary files /dev/null and b/hoj/api/target/classes/top/hcode/entity/Judge.class differ diff --git a/hoj/api/target/classes/top/hcode/entity/JudgeCase.class b/hoj/api/target/classes/top/hcode/entity/JudgeCase.class new file mode 100644 index 00000000..58d64225 Binary files /dev/null and b/hoj/api/target/classes/top/hcode/entity/JudgeCase.class differ diff --git a/hoj/api/target/classes/top/hcode/entity/Problem.class b/hoj/api/target/classes/top/hcode/entity/Problem.class new file mode 100644 index 00000000..aa2dc692 Binary files /dev/null and b/hoj/api/target/classes/top/hcode/entity/Problem.class differ diff --git a/hoj/api/target/classes/top/hcode/entity/ProblemCount.class b/hoj/api/target/classes/top/hcode/entity/ProblemCount.class new file mode 100644 index 00000000..7187ecb1 Binary files /dev/null and b/hoj/api/target/classes/top/hcode/entity/ProblemCount.class differ diff --git a/hoj/api/target/classes/top/hcode/entity/Role.class b/hoj/api/target/classes/top/hcode/entity/Role.class new file mode 100644 index 00000000..acfddb6f Binary files /dev/null and b/hoj/api/target/classes/top/hcode/entity/Role.class differ diff --git a/hoj/api/target/classes/top/hcode/entity/RoleAuth.class b/hoj/api/target/classes/top/hcode/entity/RoleAuth.class new file mode 100644 index 00000000..879535a5 Binary files /dev/null and b/hoj/api/target/classes/top/hcode/entity/RoleAuth.class differ diff --git a/hoj/api/target/classes/top/hcode/entity/UserAcproblem.class b/hoj/api/target/classes/top/hcode/entity/UserAcproblem.class new file mode 100644 index 00000000..300d45df Binary files /dev/null and b/hoj/api/target/classes/top/hcode/entity/UserAcproblem.class differ diff --git a/hoj/api/target/classes/top/hcode/entity/UserInfo.class b/hoj/api/target/classes/top/hcode/entity/UserInfo.class new file mode 100644 index 00000000..8c37acd9 Binary files /dev/null and b/hoj/api/target/classes/top/hcode/entity/UserInfo.class differ diff --git a/hoj/api/target/classes/top/hcode/entity/UserRecord.class b/hoj/api/target/classes/top/hcode/entity/UserRecord.class new file mode 100644 index 00000000..d57f770a Binary files /dev/null and b/hoj/api/target/classes/top/hcode/entity/UserRecord.class differ diff --git a/hoj/api/target/classes/top/hcode/entity/UserRole.class b/hoj/api/target/classes/top/hcode/entity/UserRole.class new file mode 100644 index 00000000..3dc0b18d Binary files /dev/null and b/hoj/api/target/classes/top/hcode/entity/UserRole.class differ diff --git a/hoj/hoj.iml b/hoj/hoj.iml new file mode 100644 index 00000000..78b2cc53 --- /dev/null +++ b/hoj/hoj.iml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/hoj/pom.xml b/hoj/pom.xml new file mode 100644 index 00000000..ff6f9f47 --- /dev/null +++ b/hoj/pom.xml @@ -0,0 +1,101 @@ + + + 4.0.0 + + top.hcode + hoj + 1.0-SNAPSHOT + + DataBackup + api + + pom + + + + UTF-8 + 1.8 + 1.8 + 4.12 + 1.16.10 + 1.2.17 + 8.0.19 + 1.1.20 + 2.1.1 + + + + + + org.springframework.cloud + spring-cloud-dependencies + Hoxton.SR1 + pom + import + + + + com.alibaba.cloud + spring-cloud-alibaba-dependencies + 2.2.0.RELEASE + pom + import + + + + org.springframework.boot + spring-boot-dependencies + 2.2.6.RELEASE + pom + import + + + + mysql + mysql-connector-java + ${mysql.version} + + + com.alibaba + druid + ${druid.version} + + + + com.baomidou + mybatis-plus-boot-starter + 3.2.0 + + + org.crazycake + shiro-redis-spring-boot-starter + 3.2.1 + + + + log4j + log4j + ${log4j.version} + + + ch.qos.logback + logback-core + 1.2.3 + + + + junit + junit + ${junit.version} + + + + org.projectlombok + lombok + ${lombok.version} + + + + \ No newline at end of file diff --git a/hoj开发文档.md b/hoj开发文档.md new file mode 100644 index 00000000..bc493c16 --- /dev/null +++ b/hoj开发文档.md @@ -0,0 +1,496 @@ +[TOC] + +# 一、介绍 + +基于前后端分离,分布式架构的在线测评平台(hoj)....待续 + +> 开发记录 + +| 时间 | 更新内容 | 更新者 | +| ---------- | ------------------------------------------ | -------- | +| 2020-10-26 | 数据库设计,登录和注册接口,文档记录开始。 | Himit_ZH | + +# 二、系统架构 + +> 总概五大系统 + +1. 前端vue页面显示系统(电脑端,手机端) + +2. 数据交互后台系统 + +3. 判题后台系统 + +4. 判题机系统 + +5. 爬虫系统 + +> 概述 + +前端使用element UI + +后端主要逻辑: + +1. 前端提交数据。 +2. 后端数据交互后台微服务,将提交写入数据库,使用springcloud alibaba通过nacos注册中心调用判题后台系统微服务。 +3. 判题后台系统微服务,使用RabbitMQ告知判题机系统(传递submitId集合) 。 +4. 判题机系统启用多台判题机(多个进程,有限,防宕机)进行测评,最后将结果更新到数据库。 +5. 爬虫系统负责爬取用户相关的codeforces的积分,vjudge的做题数等。 + +# 三、数据库 + +## 用户资料模块 + +user_info表 + +| 列名 | 实体属性类型 | 键 | 备注 | +| ------------ | ------------ | ---- | -------------------- | +| userId | String | 主键 | uuid | +| username | String | | 登录账号 | +| password | String | | 登录密码 | +| nickname | String | | 用户昵称 | +| school | String | | 学校 | +| course | String | | 专业 | +| number | String | | 学号 | +| classes | String | | 班级 | +| realname | String | | 真实名字 | +| email | Srting | | 邮箱 | +| avatar | String | | 头像图片地址 | +| signature | String | | 个性签名 | +| cf_name | String | | codeforces的username | +| Status | int | | 0可用,1不可用 | +| gmt_create | datetime | | 创建时间 | +| gmt_modified | datetime | | 修改时间 | + + + +role 角色表 + +| 列名 | 实体属性类型 | 键 | 备注 | +| ------------ | ------------ | ---- | -------------------------- | +| id | long | 主键 | auto_increment | +| role | String | | “admin”,”tourist”,“user” | +| description | String | | 角色描述 | +| Status | int | | 是否可用,0可用 1不可用 | +| gmt_create | datetime | | 创建时间 | +| gmt_modified | datetime | | 修改时间 | + + + +user_role表 + +| 列名 | 实体属性类型 | 键 | 备注 | +| ------------ | ------------ | ---- | -------------- | +| id | long | 主键 | auto_increment | +| userId | String | 外键 | 用户id | +| role_id | int | 外键 | 角色id | +| gmt_create | datetime | | 创建时间 | +| gmt_modified | datetime | | 修改时间 | + + + + auth权限表 + +| 列名 | 实体属性类型 | 键 | 备注 | +| ------------ | ------------ | ---- | ------------------------------------------------------------ | +| id | long | 主键 | auto_increment | +| name | String | | 权限名称,“superadmin”,”contest”,“admin”,”common” 普通用户默认为“common” | +| permission | String | | 权限字符串,例如“contest:1001”,发布某场比赛。 “all”,”select”,”update”等等, | +| status | int | | 0可用,1不可用 | +| gmt_create | datetime | | 创建时间 | +| gmt_modified | datetime | | 修改时间 | + + + +role_auth表 + +| 列名 | 实体属性类型 | 键 | 备注 | +| ------------ | ------------ | ---- | -------------- | +| id | long | 主键 | auto_increment | +| role_id | int | | 角色id | +| auth_id | int | | 权限id | +| gmt_create | datetime | | 创建时间 | +| gmt_modified | datetime | | 修改时间 | + + + + user_record表 个人做题记录表 + +| 列名 | 实体属性类型 | 键 | 备注 | +| ------------ | ------------ | ----------- | ---------------------------- | +| id | long | primary key | auto_increment | +| userId | String | 外键 | 用户id | +| total | int | | 总做题数 | +| submissions | int | | 总提交数 | +| accept | int | | 通过数 | +| Rating | int | | Cf得分,未参加过默认为1500 | +| score | int | | IO制比赛得分,比赛ac一题得100 | +| gmt_create | datetime | | 创建时间 | +| gmt_modified | datetime | | 修改时间 | + + + +user_acproblem表 + +| 列名 | 实体属性类型 | 键 | 备注 | +| ------ | ------------ | ----------- | -------------- | +| id | long | primary key | auto_increment | +| userId | String | 外键 | 用户id | +| Pid | int | 外键 | Ac的题目id | + + + + + +## 题目详情模块 + + + +problem表 + +| 列名 | 实体属性类型 | 键 | 备注 | +| ------------ | ------------ | ----------- | ------------------------------------------- | +| id | long | primary key | auto_increment 1000开始 | +| title | String | | 题目 | +| author | String | | 默认可为无 | +| timeLimit | int | | 时间限制(ms),默认为c/c++限制,其它语言为2倍 | +| memoryLimit | int | | 空间限制(k),默认为c/c++限制,其它语言为2倍 | +| description | String | | 内容描述 | +| Input | String | | 输入描述 | +| Output | String | | 输出描述 | +| sampleInput | Srting | | 输入样例,多样例用(#)隔开 | +| sampleOutput | String | | 输出样例 | +| source | int | | 题目来源(比赛id),默认为hoj,可能为爬虫vj | +| comment | String | | 备注 | +| auth | int | | 默认为1公开,2为私有,3为比赛中。 | +| gmt_create | datetime | | 创建时间 | +| gmt_modified | datetime | | 修改时间 | + + + +problem_count表 + +| 列名 | 实体属性类型 | 键 | 备注 | +| ------------ | ------------ | ---- | ------------------- | +| pid | int | | 题目id | +| total | int | | 总提交数 | +| Ac | int | | 通过数 | +| Mle | int | | 空间超限 | +| Tle | int | | 时间超限 | +| Re | int | | 运行错误 | +| pe | int | | 格式错误 | +| ce | int | | 编译错误 | +| wa | int | | 答案错误 | +| Se | int | | 系统错误 | +| score | int | | 题目分数,默认为100 | +| gmt_create | datetime | | 创建时间 | +| gmt_modified | datetime | | 修改时间 | + + + + + + + +## 提交评测模块 + +> 判题结果status + +STATUS_ACCPET = 0 + +STATUS__WRONG_ANSWER = -1 + +STATUS__CPU_TIME_LIMIT_EXCEEDED = 1 + +STATUS__REAL_TIME_LIMIT_EXCEEDED = 2 + +STATUS__MEMORY_LIMIT_EXCEEDED = 3 + +STATUS__RUNTIME_ERROR = 4 + +STATUS__SYSTEM_ERROR = 5 + + + +judge表 + +| 列名 | 实体属性类型 | 键 | 备注 | +| ------------ | ------------ | ----------- | ---------------------------------- | +| submitId | long | primary key | auto_increment | +| problemId | long | 外键 | 题目id | +| userId | String | 外键 | 提交用户的id | +| submitTime | datetime | | 提交时间 | +| status | String | | 判题结果 | +| auth | int | | 0为代码全部人可见,1为仅自己可见。 | +| errorMessage | String | | 错误提醒(编译错误,或者vj提醒) | +| Time | int | | 运行时间 | +| memory | int | | 所耗内存 | +| length | int | | 代码长度 | +| code | String | | 代码 | +| language | String | | 代码语言 | +| cpid | int | | 比赛中的题目编号id | +| Judger | String | | 判题机ip | +| Ip | String | | 提交者ip | +| cid | int | | 题目来源的比赛id,默认为0 | +| gmt_create | datetime | | 创建时间 | +| gmt_modified | datetime | | 修改时间 | + + + +jugdeCase表 评测单个样例结果表 + + + +| 列名 | 实体属性类型 | 键 | 备注 | +| ------------ | ------------ | ---- | ------------------------ | +| submitId | long | 外键 | 提交id | +| problemId | String | 外键 | 题目id | +| userId | String | 外键 | 提交用户的id | +| Status | String | | 单个样例评测结果 | +| Time | int | | 运行时间 | +| memory | int | | 运行内存 | +| Case_id | String | | 测试样例id | +| inputData | String | | 样例输入,比赛不可看 | +| OutputData | String | | 样例输出,比赛不可看 | +| Useroutput | Srting | | 用户样例输出,比赛不可看 | +| gmt_create | datetime | | 创建时间 | +| gmt_modified | datetime | | 修改时间 | + + + + + + + +## 比赛模块 + + + +contest表 + +| 列名 | 实体属性类型 | 键 | 备注 | +| ------------ | ------------ | ----------- | ------------------------------------------- | +| id | long | primary key | auto_increment 1000起步 | +| userId | String | 外键 | 创建者id | +| title | String | | 比赛标题 | +| type | int | | Acm赛制或者Rating | +| Source | int | | 比赛来源,原创为0,克隆赛为比赛id | +| Auth | int | | 0为公开赛,1为私有赛(有密码),2为报名赛。 | +| pwd | string | | 比赛密码 | +| startTime | datetime | | 开始时间 | +| endTime | datetime | | 结束时间 | +| duration | int | | 比赛时长(分) | +| explain | Srting | | 比赛说明 | +| gmt_create | datetime | | 创建时间 | +| gmt_modified | datetime | | 修改时间 | + + + + + +contest_problem表 + +| 列名 | 实体属性类型 | 键 | 备注 | +| ------------ | ------------ | ----------- | ---------------------- | +| id | long | primary key | auto_increment | +| ContestId | int | 外键 | 比赛id | +| Pid | int | 外键 | 题目id | +| CpName | String | | 用于当场比赛的题目标题 | +| cpNum | String | | 比赛题目的顺序id | +| gmt_create | datetime | | 创建时间 | +| gmt_modified | datetime | | 修改时间 | + + + +contest_register表 比赛报名表 + +| 列名 | 实体属性类型 | 键 | 备注 | +| ------------ | ------------ | ---- | -------------------------- | +| id | long | 主键 | auto_increment | +| ContestId | int | 外键 | 比赛id | +| Userid | int | 外键 | 用户id | +| Status | int | | 默认为0表示正常,1为失效。 | +| gmt_create | datetime | | 创建时间 | +| gmt_modified | datetime | | 修改时间 | + + + +contest_score表 rating赛制中获得的分数更改记录表 + +| 列名 | 实体属性类型 | 键 | 备注 | +| ------------ | ------------ | ---- | ----------------- | +| id | long | 主键 | auto_increment | +| ContestId | int | 外键 | 比赛id | +| Last | int | | 比赛前的score得分 | +| Change | int | | Score比分变化 | +| Now | int | | 现在的score | +| gmt_create | datetime | | 创建时间 | +| gmt_modified | datetime | | 修改时间 | + + + +contest_record表 比赛记录表 + +| 列名 | 实体属性类型 | 键 | 备注 | +| ------------ | ------------ | ---- | -------------------------------------- | +| id | long | 主键 | auto_increment | +| ContestId | int | 外键 | 比赛id | +| userId | String | 外键 | 用户id | +| problemId | int | | 题目id | +| Cpid | int | 外键 | 比赛中的题目顺序id | +| submitId | int | 外键 | 提交id,用于可重判 | +| status | String | | 提交结果,0不加罚时,-1加罚时,1表示AC | +| time | datetime | | 提交时间 | +| gmt_create | datetime | | 创建时间 | +| gmt_modified | datetime | | 修改时间 | + + + +contest_announcement表 比赛时的通知表 + +| 列名 | 实体属性类型 | 键 | 备注 | +| ------------ | ------------ | ---- | ---------------------------------------------- | +| id | long | 主键 | auto_increment | +| ContestId | int | 外键 | 比赛id | +| Title | String | 外键 | 通知标题 | +| content | String | | 内容 | +| uid | String | 外键 | 发布者id(必须为比赛创建者或者超级管理员才能) | +| gmt_create | datetime | | 创建时间 | +| gmt_modified | datetime | | 修改时间 | + + + +contest_explanation表 赛后题解表 + +| 列名 | 实体属性类型 | 键 | 备注 | +| ------------ | ------------ | ---- | -------------------------------------------- | +| id | long | 主键 | auto_increment | +| ContestId | int | 外键 | 比赛id | +| content | String | | 内容(支持markdown) | +| userid | int | | 发布者(必须为比赛创建者或者超级管理员才能) | +| gmt_create | datetime | | 创建时间 | +| gmt_modified | datetime | | 修改时间 | + + + + + +## 讨论模块 + +> 包括平时与比赛 + + + +comment表,只存储发布者相关题目内容,评论内容采用learncloud + +| 列名 | 实体属性类型 | 键 | 备注 | +| ------------ | ------------ | ---- | ---------------- | +| id | long | 主键 | auto_increment | +| userid | int | 外键 | 发布讨论的用户id | +| title | String | 外键 | 讨论标题 | +| content | String | | 讨论详情 | +| tagid | String | 外键 | 讨论标签id | +| pid | int | 外键 | 引用的题目id | +| cid | int | 外键 | 引用的比赛id | +| gmt_create | datetime | | 创建时间 | +| gmt_modified | datetime | | 修改时间 | + + + +comment_tag表 讨论标签表 + +| 列名 | 实体属性类型 | 键 | 备注 | +| ------------ | ------------ | ---- | -------------- | +| id | long | 主键 | auto_increment | +| Name | String | | 标签名字 | +| Color | String | | 标签颜色 | +| gmt_create | datetime | | 创建时间 | +| gmt_modified | datetime | | 修改时间 | + + + +# 四、后端数据接口 + +> 后端返回数据的状态码说明 + +``` +STATUS_SUCCESS = 200; // 成功 +STATUS_FAIL = 400; // 失败 +STATUS_ERROR = 500; // 系统出错 +STATUS_ACCESS_DENIED = 401;// 无权限 +``` + +##1. 注册接口 + +###1.1 请求地址 + +> /register + +###1.2 请求方式 + +> POST + +###1.3 请求参数 + +> 格式:json + +| 字段名 | 实体属性类型 | 说明 | 能否为空 | +| -------- | ------------ | ------ | -------- | +| username | String | 账号 | 不能 | +| password | String | 密码 | 不能 | +| nickname | String | 昵称 | 不能 | +| email | String | 邮箱 | 不能 | +| number | String | 学号 | 不能 | +| code | String | 验证码 | 不能 | + +###1.4 返回数据 + +> 格式:json + +| 字段名 | 实体属性类型 | 说明 | +| ------ | ------------ | ------------------------ | +| status | int | 状态码,详情见状态码说明 | +| data | json | 后台查询数据存储于这 | +| msg | String | 消息 | + +##2. 注册接口 + +###2.1 请求地址 + +> /login + +###2.2 请求方式 + +> POST + +###2.3 请求参数 + +> 格式:json + +| 字段名 | 实体属性类型 | 说明 | 能否为空 | +| -------- | ------------ | ---- | -------- | +| username | String | 账号 | 不能 | +| password | String | 密码 | 不能 | + +###2.4 返回数据 + +> 格式:json + +| 字段名 | 实体属性类型 | 说明 | +| ------ | ------------ | ------------------------ | +| status | int | 状态码,详情见状态码说明 | +| data | json | 后台查询数据存储于这 | +| msg | String | 消息 | + + + +data数据 + +| 字段名 | 实体属性类型 | 说明 | +| -------- | ------------ | -------- | +| uid | String | 用户id | +| username | String | 账号 | +| nickname | String | 昵称 | +| avatar | String | 头像地址 | +| email | String | 邮箱 | + +### \ No newline at end of file