Pārlūkot izejas kodu

兼职培训V1.0

chchen 5 gadi atpakaļ
revīzija
bb083bb5dc
41 mainītis faili ar 6235 papildinājumiem un 0 dzēšanām
  1. 144 0
      pom.xml
  2. 15 0
      src/main/java/com/aijia/peixun/PeixunApplication.java
  3. 47 0
      src/main/java/com/aijia/peixun/config/AjaxPermissionsAuthorizationFilter.java
  4. 38 0
      src/main/java/com/aijia/peixun/config/GlobalCorsConfig.java
  5. 65 0
      src/main/java/com/aijia/peixun/config/RedisConfig.java
  6. 122 0
      src/main/java/com/aijia/peixun/config/ShiroConfiguration.java
  7. 87 0
      src/main/java/com/aijia/peixun/config/UserRealm.java
  8. 134 0
      src/main/java/com/aijia/peixun/controller/FileUploadController.java
  9. 218 0
      src/main/java/com/aijia/peixun/controller/JzPeiXunController.java
  10. 37 0
      src/main/java/com/aijia/peixun/dao/FileMapper.java
  11. 43 0
      src/main/java/com/aijia/peixun/dao/UserMapper.java
  12. 34 0
      src/main/java/com/aijia/peixun/dao/examinationMapper.java
  13. 131 0
      src/main/java/com/aijia/peixun/entity/File.java
  14. 221 0
      src/main/java/com/aijia/peixun/entity/User.java
  15. 178 0
      src/main/java/com/aijia/peixun/entity/examination.java
  16. 25 0
      src/main/java/com/aijia/peixun/service/JzFileService.java
  17. 70 0
      src/main/java/com/aijia/peixun/service/JzFileServiceImpl.java
  18. 27 0
      src/main/java/com/aijia/peixun/service/JzPeiXunService.java
  19. 147 0
      src/main/java/com/aijia/peixun/service/JzPeiXunServiceImpl.java
  20. 163 0
      src/main/java/com/aijia/peixun/utils/AliyunSmsUtil.java
  21. 383 0
      src/main/java/com/aijia/peixun/utils/Constant.java
  22. 19 0
      src/main/java/com/aijia/peixun/utils/Constants.java
  23. 44 0
      src/main/java/com/aijia/peixun/utils/EmptyUtil.java
  24. 41 0
      src/main/java/com/aijia/peixun/utils/ErrorEnum.java
  25. 86 0
      src/main/java/com/aijia/peixun/utils/FileMD5Util.java
  26. 66 0
      src/main/java/com/aijia/peixun/utils/PhoneFormatCheckUtils.java
  27. 2124 0
      src/main/java/com/aijia/peixun/utils/RedisUtil.java
  28. 88 0
      src/main/java/com/aijia/peixun/utils/ResponseConstant.java
  29. 152 0
      src/main/java/com/aijia/peixun/utils/ResponseEntity.java
  30. 53 0
      src/main/java/com/aijia/peixun/utils/SmsUtils.java
  31. 50 0
      src/main/java/com/aijia/peixun/utils/StringUtil.java
  32. 47 0
      src/main/java/com/aijia/peixun/utils/Uuid.java
  33. 120 0
      src/main/java/com/aijia/peixun/utils/ZipFileUtil.java
  34. 90 0
      src/main/java/com/aijia/peixun/utils/httpClient.java
  35. 40 0
      src/main/java/com/aijia/peixun/utils/httpClientGet.java
  36. 141 0
      src/main/java/com/aijia/peixun/vo/MultipartFileParam.java
  37. 89 0
      src/main/java/com/aijia/peixun/vo/UserVo.java
  38. 27 0
      src/main/resources/application.yml
  39. 166 0
      src/main/resources/mapper/FileMapper.xml
  40. 260 0
      src/main/resources/mapper/UserMapper.xml
  41. 203 0
      src/main/resources/mapper/examinationMapper.xml

+ 144 - 0
pom.xml

@@ -0,0 +1,144 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-starter-parent</artifactId>
+        <version>2.5.2</version>
+        <relativePath/> <!-- lookup parent from repository -->
+    </parent>
+    <groupId>com.aijia</groupId>
+    <artifactId>peixun</artifactId>
+    <version>0.0.1-SNAPSHOT</version>
+    <name>peixun</name>
+    <description>Demo project for Spring Boot</description>
+    <properties>
+        <java.version>1.8</java.version>
+    </properties>
+    <dependencies>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-thymeleaf</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.mybatis.spring.boot</groupId>
+            <artifactId>mybatis-spring-boot-starter</artifactId>
+            <version>2.2.0</version>
+        </dependency>
+        <dependency>
+            <groupId>mysql</groupId>
+            <artifactId>mysql-connector-java</artifactId>
+            <scope>runtime</scope>
+            <version>8.0.15</version>
+        </dependency>
+        <dependency>
+            <groupId>com.aliyun</groupId>
+            <artifactId>aliyun-java-sdk-core</artifactId>
+            <version>4.0.6</version>
+        </dependency>
+        <dependency>
+            <groupId>com.aliyun</groupId>
+            <artifactId>aliyun-java-sdk-dysmsapi</artifactId>
+            <version>1.1.0</version>
+        </dependency>
+        <dependency>
+            <groupId>com.alipay.sdk</groupId>
+            <artifactId>alipay-sdk-java</artifactId>
+            <version>3.6.0.ALL</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-lang3</artifactId>
+            <version>3.12.0</version>
+        </dependency>
+        <dependency>
+            <groupId>redis.clients</groupId>
+            <artifactId>jedis</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.shiro</groupId>
+            <artifactId>shiro-spring</artifactId>
+            <version>1.4.0</version>
+        </dependency>
+        <dependency>
+            <groupId>de.knightsoft-net</groupId>
+            <artifactId>gwt-time-dummy</artifactId>
+            <version>1.7.6</version>
+        </dependency>
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>fastjson</artifactId>
+            <version>1.2.47</version>
+        </dependency>
+        <dependency>
+            <groupId>commons-io</groupId>
+            <artifactId>commons-io</artifactId>
+            <version>2.10.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.httpcomponents</groupId>
+            <artifactId>httpclient</artifactId>
+            <version>4.5.2</version>
+        </dependency>
+        <dependency>
+            <groupId>com.sun.jersey.contribs</groupId>
+            <artifactId>jersey-multipart</artifactId>
+            <version>1.17</version>
+        </dependency>
+<!--        &lt;!&ndash;引入 aliyun oss sdk&ndash;&gt;-->
+<!--        <dependency>-->
+<!--            <groupId>com.aliyun.oss</groupId>-->
+<!--            <artifactId>aliyun-sdk-oss</artifactId>-->
+<!--            <version>3.10.2</version>-->
+<!--        </dependency>-->
+
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-data-redis</artifactId>
+        </dependency>
+
+
+
+
+
+
+
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-test</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <groupId>org.mybatis.generator</groupId>
+                <artifactId>mybatis-generator-maven-plugin</artifactId>
+                <version>1.4.0</version>
+                <configuration>
+                    <verbose>true</verbose>
+                    <overwrite>true</overwrite>
+                    <configurationFile>src/main/resources/generatorConfig.xml</configurationFile>
+                </configuration>
+                <dependencies>
+                    <dependency>
+                        <groupId>mysql</groupId>
+                        <artifactId>mysql-connector-java</artifactId>
+                        <version>8.0.15</version>
+                    </dependency>
+                </dependencies>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>

+ 15 - 0
src/main/java/com/aijia/peixun/PeixunApplication.java

@@ -0,0 +1,15 @@
+package com.aijia.peixun;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.ComponentScan;
+
+@SpringBootApplication
+public class PeixunApplication {
+    public static void main(String[] args) {
+        SpringApplication.run(PeixunApplication.class, args);
+    }
+}
+

+ 47 - 0
src/main/java/com/aijia/peixun/config/AjaxPermissionsAuthorizationFilter.java

@@ -0,0 +1,47 @@
+package com.aijia.peixun.config;
+
+import com.aijia.peixun.utils.ErrorEnum;
+import com.alibaba.fastjson.JSONObject;
+import org.apache.shiro.web.filter.authc.FormAuthenticationFilter;
+import org.springframework.boot.web.servlet.FilterRegistrationBean;
+import org.springframework.context.annotation.Bean;
+
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletResponse;
+import java.io.PrintWriter;
+
+
+public class AjaxPermissionsAuthorizationFilter extends FormAuthenticationFilter {
+
+    @Override
+    protected boolean onAccessDenied(ServletRequest request, ServletResponse response) {
+        JSONObject jsonObject = new JSONObject();
+        jsonObject.put("code", ErrorEnum.E_20011.getErrorCode());
+        jsonObject.put("msg", ErrorEnum.E_20011.getErrorMsg());
+        PrintWriter out = null;
+        HttpServletResponse res = (HttpServletResponse) response;
+        try {
+            res.setCharacterEncoding("UTF-8");
+            res.setContentType("application/json");
+            out = response.getWriter();
+            out.println(jsonObject);
+        } catch (Exception e) {
+        } finally {
+            if (null != out) {
+                out.flush();
+                out.close();
+            }
+        }
+        return false;
+    }
+
+    @Bean
+    public FilterRegistrationBean registration(AjaxPermissionsAuthorizationFilter filter) {
+        FilterRegistrationBean registration = new FilterRegistrationBean(filter);
+        registration.setEnabled(false);
+        return registration;
+    }
+
+
+}

+ 38 - 0
src/main/java/com/aijia/peixun/config/GlobalCorsConfig.java

@@ -0,0 +1,38 @@
+package com.aijia.peixun.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.cors.CorsConfiguration;
+import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
+import org.springframework.web.filter.CorsFilter;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Configuration
+public class GlobalCorsConfig {
+
+    private CorsConfiguration buildConfig() {
+        CorsConfiguration corsConfiguration = new CorsConfiguration();
+        corsConfiguration.setAllowCredentials(true); //sessionid 多次访问一致
+
+        // 允许访问的客户端域名
+        List<String> allowedOriginPatterns = new ArrayList<>();
+        allowedOriginPatterns.add("*");
+        corsConfiguration.setAllowedOriginPatterns(allowedOriginPatterns);
+        //  corsConfiguration.addAllowedOrigin("*"); // 允许任何域名使用
+        corsConfiguration.addAllowedHeader("*"); // 允许任何头
+        corsConfiguration.addAllowedMethod("*"); // 允许任何方法(post、get等)
+        return corsConfiguration;
+    }
+
+    @Bean
+    public CorsFilter corsFilter() {
+        UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
+        source.registerCorsConfiguration("/**", buildConfig()); // 对接口配置跨域设置
+        return new CorsFilter(source);
+    }
+
+
+
+}

+ 65 - 0
src/main/java/com/aijia/peixun/config/RedisConfig.java

@@ -0,0 +1,65 @@
+package com.aijia.peixun.config;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import redis.clients.jedis.HostAndPort;
+import redis.clients.jedis.JedisCluster;
+import redis.clients.jedis.JedisPoolConfig;
+
+import java.util.HashSet;
+
+@Configuration
+public class RedisConfig {
+
+//    @Value("${spring.redis.timeout}")
+    @Value("3000")
+    private int timeout;
+
+//    @Value("${spring.redis.cluster.pool.max-idle}")
+    @Value("8")
+    private int maxIdle;
+
+//    @Value("${spring.redis.cluster.pool.max-wait}")
+    @Value("-1")
+    private long maxWaitMillis;
+
+//    @Value("${spring.redis.block-when-exhausted}")
+    @Value("true")
+    private boolean blockWhenExhausted;
+
+//    @Value("${spring.redis.cluster.nodes}")
+//    @Value("192.168.2.118:7000,192.168.2.118:7001,192.168.2.118:7002,192.168.2.118:7003,192.168.2.118:7004,192.168.2.118:7005")
+    @Value("47.119.147.170:7000")
+    private String clusterNodes;
+
+//    @Value("${spring.redis.password}")
+//    @Value("123")
+    @Value("aijia@78342")
+    private String password;
+
+    @Bean
+    public JedisCluster redisPoolFactory() throws Exception {
+        JedisPoolConfig jedisPoolConfig = new JedisPoolConfig();
+        jedisPoolConfig.setMaxIdle(maxIdle);
+        jedisPoolConfig.setMaxWaitMillis(maxWaitMillis);
+        // 连接耗尽时是否阻塞, false报异常,ture阻塞直到超时, 默认true
+        jedisPoolConfig.setBlockWhenExhausted(blockWhenExhausted);
+        // 是否启用pool的jmx管理功能, 默认true
+        jedisPoolConfig.setJmxEnabled(true);
+        String[] cNodes = clusterNodes.split(",");
+        HashSet<HostAndPort> nodes = new HashSet<>();
+        // 分割集群节点
+        for (String node : cNodes) {
+            String[] hp = node.split(":");
+            nodes.add(new HostAndPort(hp[0], Integer.parseInt(hp[1])));
+        }
+        // 创建集群对象
+        // JedisCluster jedisCluster = new JedisCluster(nodes, timeout,
+        // jedisPoolConfig);
+
+        return new JedisCluster(nodes, timeout, timeout, 5, password, jedisPoolConfig);
+        // return new JedisCluster(nodes, timeout, jedisPoolConfig);
+    }
+
+}

+ 122 - 0
src/main/java/com/aijia/peixun/config/ShiroConfiguration.java

@@ -0,0 +1,122 @@
+package com.aijia.peixun.config;
+
+import org.apache.shiro.authc.credential.HashedCredentialsMatcher;
+import org.apache.shiro.mgt.SecurityManager;
+import org.apache.shiro.spring.LifecycleBeanPostProcessor;
+import org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor;
+import org.apache.shiro.spring.web.ShiroFilterFactoryBean;
+import org.apache.shiro.web.mgt.DefaultWebSecurityManager;
+import org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.DependsOn;
+
+import javax.servlet.Filter;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+@Configuration
+public class ShiroConfiguration {
+    /**
+     * Shiro的Web过滤器Factory 命名:shiroFilter
+     */
+    @Bean(name = "shiroFilter")
+    public ShiroFilterFactoryBean shiroFilterFactoryBean(SecurityManager securityManager) {
+        ShiroFilterFactoryBean shiroFilterFactoryBean = new ShiroFilterFactoryBean();
+        //Shiro的核心安全接口,这个属性是必须的
+        shiroFilterFactoryBean.setSecurityManager(securityManager);
+        Map<String, Filter> filterMap = new LinkedHashMap<>();
+        filterMap.put("authc", new AjaxPermissionsAuthorizationFilter());
+        shiroFilterFactoryBean.setFilters(filterMap);
+        /*定义shiro过滤链  Map结构
+         * Map中key(xml中是指value值)的第一个'/'代表的路径是相对于HttpServletRequest.getContextPath()的值来的
+         * anon:它对应的过滤器里面是空的,什么都没做,这里.do和.jsp后面的*表示参数,比方说login.jsp?main这种
+         * authc:该过滤器下的页面必须验证后才能访问,它是Shiro内置的一个拦截器org.apache.shiro.web.filter.authc.FormAuthenticationFilter
+         */
+        Map<String, String> filterChainDefinitionMap = new LinkedHashMap<>();
+         /* 过滤链定义,从上向下顺序执行,一般将 / ** 放在最为下边:这是一个坑呢,一不小心代码就不好使了;
+          authc:所有url都必须认证通过才可以访问; anon:所有url都都可以匿名访问 */
+        filterChainDefinitionMap.put("/", "anon");
+        filterChainDefinitionMap.put("/static/**", "anon");
+        filterChainDefinitionMap.put("/login/auth", "anon");
+        filterChainDefinitionMap.put("/login/logout", "anon");
+
+        //放行swagger
+//		filterChainDefinitionMap.put("/swagger-ui.html", "anon");
+//		filterChainDefinitionMap.put("/swagger-resources", "anon");
+//		filterChainDefinitionMap.put("/v2/api-docs", "anon");
+//		filterChainDefinitionMap.put("/webjars/springfox-swagger-ui/**", "anon");
+
+        filterChainDefinitionMap.put("/error", "anon");
+        //filterChainDefinitionMap.put("/**", "authc");
+        shiroFilterFactoryBean.setFilterChainDefinitionMap(filterChainDefinitionMap);
+        return shiroFilterFactoryBean;
+    }
+
+    /**
+     * 不指定名字的话,自动创建一个方法名第一个字母小写的bean
+     */
+    @Bean
+    public SecurityManager securityManager() {
+        DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager();
+        securityManager.setRealm(userRealm());
+//		securityManager.setCacheManager(new MemoryConstrainedCacheManager());
+
+        return securityManager;
+    }
+
+    /**
+     * Shiro Realm 继承自AuthorizingRealm的自定义Realm,即指定Shiro验证用户登录的类为自定义的
+     */
+    @Bean
+    public UserRealm userRealm() {
+        UserRealm userRealm = new UserRealm();
+        return userRealm;
+    }
+
+    /**
+     * 凭证匹配器
+     * (由于我们的密码校验交给Shiro的SimpleAuthenticationInfo进行处理了
+     * 所以我们需要修改下doGetAuthenticationInfo中的代码;
+     * )
+     * 可以扩展凭证匹配器,实现 输入密码错误次数后锁定等功能,下一次
+     */
+    @Bean(name = "credentialsMatcher")
+    public HashedCredentialsMatcher hashedCredentialsMatcher() {
+        HashedCredentialsMatcher hashedCredentialsMatcher = new HashedCredentialsMatcher();
+        //散列算法:这里使用MD5算法;
+        hashedCredentialsMatcher.setHashAlgorithmName("md5");
+        //散列的次数,比如散列两次,相当于 md5(md5(""));
+        hashedCredentialsMatcher.setHashIterations(2);
+        //storedCredentialsHexEncoded默认是true,此时用的是密码加密用的是Hex编码;false时用Base64编码
+        hashedCredentialsMatcher.setStoredCredentialsHexEncoded(true);
+        return hashedCredentialsMatcher;
+    }
+
+    /**
+     * Shiro生命周期处理器
+     */
+    @Bean
+    public LifecycleBeanPostProcessor lifecycleBeanPostProcessor() {
+        return new LifecycleBeanPostProcessor();
+    }
+
+    /**
+     * 开启Shiro的注解(如@RequiresRoles,@RequiresPermissions),需借助SpringAOP扫描使用Shiro注解的类,并在必要时进行安全逻辑验证
+     * 配置以下两个bean(DefaultAdvisorAutoProxyCreator(可选)和AuthorizationAttributeSourceAdvisor)即可实现此功能
+     */
+    @Bean
+    @DependsOn({"lifecycleBeanPostProcessor"})
+    public DefaultAdvisorAutoProxyCreator advisorAutoProxyCreator() {
+        DefaultAdvisorAutoProxyCreator advisorAutoProxyCreator = new DefaultAdvisorAutoProxyCreator();
+        advisorAutoProxyCreator.setProxyTargetClass(true);
+        return advisorAutoProxyCreator;
+    }
+
+    @Bean
+    public AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor() {
+        AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor = new AuthorizationAttributeSourceAdvisor();
+        authorizationAttributeSourceAdvisor.setSecurityManager(securityManager());
+        return authorizationAttributeSourceAdvisor;
+    }
+}

+ 87 - 0
src/main/java/com/aijia/peixun/config/UserRealm.java

@@ -0,0 +1,87 @@
+package com.aijia.peixun.config;
+
+import com.aijia.peixun.entity.User;
+import com.aijia.peixun.service.JzPeiXunService;
+import com.aijia.peixun.utils.Constants;
+import com.alibaba.fastjson.JSONObject;
+import org.apache.shiro.SecurityUtils;
+import org.apache.shiro.authc.*;
+import org.apache.shiro.authz.AuthorizationInfo;
+import org.apache.shiro.authz.SimpleAuthorizationInfo;
+import org.apache.shiro.realm.AuthorizingRealm;
+import org.apache.shiro.session.Session;
+import org.apache.shiro.subject.PrincipalCollection;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.util.Collection;
+import java.util.Objects;
+
+public class UserRealm extends AuthorizingRealm {
+    private Logger logger = LoggerFactory.getLogger(UserRealm.class);
+
+    @Autowired
+    private JzPeiXunService jzPeiXunService;
+
+    @Override
+    @SuppressWarnings("unchecked")
+    protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) {
+        Session session = SecurityUtils.getSubject().getSession();
+        //查询用户的权限
+        JSONObject permission = (JSONObject) session.getAttribute(Constants.SESSION_USER_PERMISSION);
+        logger.info("permission的值为:" + permission);
+        logger.info("本用户权限为:" + permission.get("permissionList"));
+        //为当前用户设置角色和权限
+        SimpleAuthorizationInfo authorizationInfo = new SimpleAuthorizationInfo();
+        authorizationInfo.addStringPermissions((Collection<String>) permission.get("permissionList"));
+        return authorizationInfo;
+    }
+
+    /**
+     * 验证当前登录的Subject
+     * LoginController.login()方法中执行Subject.login()时 执行此方法
+     */
+    @Override
+    protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authcToken) throws AuthenticationException {
+        //获取用户的账号名称 -- 手机号
+        String loginName = (String) authcToken.getPrincipal();
+        // 获取用户密码
+        String password = new String((char[]) authcToken.getCredentials());
+
+        User user = new User();
+        //存储用户名
+        user.setTelephoneno(loginName);
+        //存储验证码
+        user.setBackup2(password);
+
+        //因为是手机号+短息验证码登录,即使没有此手机号账号,也可以登录,可以为null
+//        if (user == null) {
+//            //没找到帐号
+//            throw new UnknownAccountException();
+//        }
+        //交给AuthenticatingRealm使用CredentialsMatcher进行密码匹配,如果觉得人家的不好可以自定义实现
+        SimpleAuthenticationInfo authenticationInfo = new SimpleAuthenticationInfo(
+                user,
+//                user.getTelephoneno(),
+                user.getBackup2(),
+                //ByteSource.Util.bytes("salt"), salt=username+salt,采用明文访问时,不需要此句
+                getName()
+        );
+        //session中不需要保存密码
+//        user.remove("password");
+        //将用户信息放入session中
+        SecurityUtils.getSubject().getSession().setAttribute(Constants.SESSION_USER_INFO, user);
+        System.out.println(authenticationInfo);
+        return authenticationInfo;
+    }
+
+    public static String getUser(){
+        Session session = SecurityUtils.getSubject().getSession();
+        JSONObject userInfo = (JSONObject) session.getAttribute(Constants.SESSION_USER_INFO);
+        if (Objects.isNull(userInfo)) {
+            return null;
+        }
+        return userInfo.getString("username");
+    }
+}

+ 134 - 0
src/main/java/com/aijia/peixun/controller/FileUploadController.java

@@ -0,0 +1,134 @@
+package com.aijia.peixun.controller;
+
+import com.aijia.peixun.entity.File;
+import com.aijia.peixun.service.JzFileService;
+import com.aijia.peixun.utils.ResponseEntity;
+import com.aijia.peixun.utils.httpClient;
+import com.alibaba.fastjson.JSONObject;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+
+
+@RestController
+@RequestMapping(value = "/file")
+public class FileUploadController {
+
+    @Autowired
+    JzFileService jzFileService;
+
+    //全局map
+    HashMap map = new HashMap();
+
+    final static String uploadeFile = "上传文件";
+    final static String downLodeFile = "获取文件";
+    final static String doExsercise = "做练习题";
+    final static String checkeExsercise = "考评打分";
+    final static String getResult = "获取考试成绩";
+
+    //1. 保存上传文件路径---系统管理员web端上传文件,服务端保存文件url
+    private Logger logger = LoggerFactory.getLogger(this.getClass());
+    @RequestMapping(value = "/saveUploadfilePath", method = RequestMethod.POST)
+    public ResponseEntity getUploadfilePath(@RequestBody JSONObject data) {
+      try {
+          String userId = data.get("userid").toString();
+          String filePath = data.get("filepath").toString();
+          String fileName = data.get("filename").toString();
+          //设置上传文件对应兼职教师的类型
+          Integer fileType = data.getInteger("typeofjob");
+          SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+          String time = df.format(new Date());
+          File file = new File();
+          file.setUploadeuser(userId);
+          //设置上传文件对应兼职教师的类型
+          file.setFiletype(fileType);
+          file.setFilename(fileName);
+          file.setBackup1(filePath);
+          file.setUploadetime(time);
+          jzFileService.SaveFileData(file);
+      }catch (Exception e){
+            e.printStackTrace();
+        }
+        return new ResponseEntity().success("上传文件成功");
+    }
+
+    //2. 系统管理员获取上传文件(学习资料)  ----  批量获取
+    @RequestMapping(value = "/getFile",method = RequestMethod.POST)
+    public List<File> getFile(@RequestBody JSONObject data){
+
+        List<File> list = new ArrayList<>();
+        try {
+            Integer userId = data.getInteger("userid");
+//            Integer fileId = data.getInteger("fileid");
+            //依据userid,进行多个查询;
+            list = jzFileService.GetFileDataList(userId.toString());
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+        return list;
+    }
+
+    //3. 系统管理员获取上传文件(学习资料)  ----  单个获取
+    @RequestMapping(value = "/getFilebyOne",method = RequestMethod.POST)
+    public File getFilebyOne(@RequestBody JSONObject data){
+                File file = new File();
+        try {
+            Integer fileId = data.getInteger("fileid");
+            //依据文件id,单个查询
+            file = jzFileService.GetFileData(fileId);
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+        return file;
+    }
+
+
+    //4. 兼职教师 -- 获取上传文件(学习资料),依据兼职教师的类型,获取类型匹配的学习资料(pdf,音频,视频,图片等)
+    @RequestMapping(value = "/getFilebytype",method = RequestMethod.POST)
+    public List<File> getFilebytype(@RequestBody JSONObject data){
+
+        List list = new ArrayList();
+        try {
+            String userId = data.get("userid").toString();
+            Integer typeofjob = data.getInteger("typeofjob");
+            list=jzFileService.GetFileByType(typeofjob);
+
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+        return list;
+    }
+
+
+    //5. 教师考试做习题(Kmt实现),依据兼职教师类型,获取考试习题,且检测考试次数;
+    @RequestMapping(value = "/getExamina",method = RequestMethod.POST)
+    public List<File> getExamina(@RequestBody JSONObject data){
+
+        try {
+            String correctingsub = data.getString("correctingsub");
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+
+        return null;
+    }
+
+
+
+}
+
+
+
+
+

+ 218 - 0
src/main/java/com/aijia/peixun/controller/JzPeiXunController.java

@@ -0,0 +1,218 @@
+package com.aijia.peixun.controller;
+
+import com.aijia.peixun.dao.examinationMapper;
+import com.aijia.peixun.entity.User;
+import com.aijia.peixun.entity.examination;
+import com.aijia.peixun.service.JzPeiXunService;
+import com.aijia.peixun.utils.*;
+import com.alibaba.fastjson.JSONObject;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import java.util.*;
+
+@RestController
+@RequestMapping(value = "/jzpeixun")
+public class JzPeiXunController {
+
+    @Resource
+    RedisUtil redisUtil;
+    @Autowired
+    JzPeiXunService jzPeiXunService;
+    //定义全局map,存储短信验证码
+    HashMap map1 = new HashMap();
+
+
+    //1. 发短息
+    @RequestMapping(value = "/sendsms", method = RequestMethod.POST)
+//    public ResponseEntity sendSMSLogin(@RequestParam String telephoneNo, @RequestParam int type){
+    public ResponseEntity sendSMSLogin(@RequestBody JSONObject data) {
+
+        String telephoneNo = data.getString("telephoneNo");
+        Integer type = data.getInteger("type");
+
+        ResponseEntity responseEntity = null;
+        try {
+            if (PhoneFormatCheckUtils.isChinaPhoneLegal(telephoneNo) == true && PhoneFormatCheckUtils.isNumeric(String.valueOf(type))) {
+                //发短信息,手机号与短息验证码写入redis
+                SmsUtils smsUtils = new SmsUtils();
+//                responseEntity = smsUtils.sendSms(telephoneNo, type);
+                String code = smsUtils.sendSms(telephoneNo, type);
+//                redisUtil.set(telephoneNo,code);
+//                String code2 = redisUtil.get(telephoneNo);
+                //短信验证码写入map
+                map1.put(telephoneNo,code);
+                String code2 = map1.get(telephoneNo).toString();
+                System.out.println(code2+"发出短信验证码");
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            return responseEntity.failure(ResponseConstant.CODE_000, "");
+        }
+        return responseEntity;
+    }
+
+    //2.手机号+短信验证码,注册登录
+    @RequestMapping(value = "/smslogin", method = RequestMethod.POST)
+    public ResponseEntity SmsLogin(@RequestBody JSONObject data) {
+        ResponseEntity responseEntity = null;
+        HashMap map = new HashMap();
+        try {
+                    String telephoneNo = data.getString("telephoneNo");
+                    String smsCode = data.getString("smsCode");
+            //判断手机号格式是否正确
+            if (PhoneFormatCheckUtils.isChinaPhoneLegal(telephoneNo) == true) {
+                //依据手机号,从redis中取出code
+//                String code1 = redisUtil.get(telephoneNo);
+                String code1 = map1.get(telephoneNo).toString();
+                System.out.println(code1+"map存储获取的验证码");
+                if (code1.equals(smsCode)){
+                //执行登录操作
+                User user = jzPeiXunService.getUserInfoByTelePhone(telephoneNo);
+                if (user.equals(null)) {
+                    //注册用户 ---- 兼职教师登录
+                    jzPeiXunService.addUser(telephoneNo);
+                    jzPeiXunService.authLogin(telephoneNo, smsCode);
+                } else {
+                    //直接登录 --- 已注册兼职教师后者管理员登录
+                    jzPeiXunService.authLogin(telephoneNo, smsCode);
+                }
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            return new ResponseEntity().failure("404", "登录失败");
+        }
+        System.out.println("登录成功");
+        return new ResponseEntity().success("505", "登录成功");
+    }
+
+
+    //3.用户退出
+    @RequestMapping(value = "/logout", method = RequestMethod.POST)
+    public ResponseEntity logout() {
+        try {
+            jzPeiXunService.logout();
+        } catch (Exception e) {
+            e.printStackTrace();
+            return new ResponseEntity().failure("fail", "退出失败");
+        }
+        return new ResponseEntity().success("logoutSuccess", "退出成功");
+    }
+
+    //4. 编辑用户资料
+    @RequestMapping(value = "/editUser", method = RequestMethod.POST)
+    public ResponseEntity editUser(@RequestBody JSONObject data) {
+        try {
+            if (data.equals(null)) {
+                return new ResponseEntity().failure("404", "输入信息为空", "");
+            }
+            User user = new User();
+//         String telephoneNo = data.getString("telephoneNo");
+            String name = data.getString("name");
+            String email = data.getString("email");
+            String sex = data.getString("sex");
+            String age = data.getString("age");
+            String correctingsub = data.getString("correctingsub");
+
+            Integer typeofjob = Integer.parseInt(data.getString("typeofjob"));
+            String createtime = data.getString("createtime");
+            Integer userstate = Integer.parseInt(data.getString("userstate"));
+            String area = data.getString("area");
+            Integer id = data.getInteger("id");
+
+            user.setName(name);
+            user.setEmail(email);
+            user.setSex(sex);
+            user.setAge(age);
+            user.setCorrectingsub(correctingsub);
+            user.setTypeofjob(typeofjob);
+            user.setUserstate(userstate);
+            user.setArea(area);
+            user.setId(id);
+            jzPeiXunService.updateUser(user);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return new ResponseEntity().success("", "用户资料编辑成功");
+    }
+
+    //4. 获取用户个人资料
+    @RequestMapping(value = "/getUserInfo", method = RequestMethod.POST)
+    public ResponseEntity selectUserInfo(@RequestBody JSONObject data) {
+        User user = null;
+        if (data.equals(null)) {
+            return new ResponseEntity().failure("404", "输入信息为空", "");
+        }
+        try {
+            Integer userId = data.getInteger("userid");
+            user = jzPeiXunService.getUserInfo(userId);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return new ResponseEntity().success(user, "获取用户资料成功");
+    }
+
+
+    //5. 教师状态获取,正在学习,考试中,已考试,考试通过,考试未通过等;
+    @RequestMapping(value = "/getLearnTeacherStauts", method = RequestMethod.POST)
+    public List<User> getLearnTeacherStauts(@RequestBody JSONObject data) {
+        List<User> list = null;
+        try {
+            Integer userState = data.getInteger("userstate");
+            list = jzPeiXunService.getLearnTeacher(userState);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return list;
+    }
+
+
+
+    //6. 兼职教师获取考试试卷
+    @RequestMapping(value = "/getexaminationData", method = RequestMethod.POST)
+    public examination getexaminationData(@RequestBody JSONObject data) {
+
+        examination examination = null;
+        try {
+            String subject = data.get("subject").toString();
+            examination = jzPeiXunService.getexam(subject);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return examination;
+    }
+
+
+    //7.兼职教师依据做考试试卷
+//    @RequestMapping(value = "/dotexam", method = RequestMethod.POST)
+//    public examination dotexaminationData(@RequestBody JSONObject data) {
+//
+//        try{
+//            String userid = data.getString("userid");
+//            String
+//
+//
+//        }catch (Exception e){
+//
+//        }
+//
+//    }
+//
+//
+//    //8. 系统管理员阅卷
+//    @RequestMapping(value = "/checkexam", method = RequestMethod.POST)
+//    public examination checkexaminationData(@RequestBody JSONObject data) {
+//
+//
+//    }
+
+
+
+
+}
+
+
+
+

+ 37 - 0
src/main/java/com/aijia/peixun/dao/FileMapper.java

@@ -0,0 +1,37 @@
+package com.aijia.peixun.dao;
+
+import com.aijia.peixun.entity.File;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.ResultMap;
+import org.apache.ibatis.annotations.Select;
+
+import java.util.List;
+
+@Mapper
+public interface FileMapper {
+    int deleteByPrimaryKey(Integer id);
+
+    int insert(File record);
+
+    int insertSelective(File record);
+
+    File selectByPrimaryKey(Integer id);
+
+    int updateByPrimaryKeySelective(File record);
+
+    int updateByPrimaryKey(File record);
+
+    //新增:依据文件类别获取文件List
+    @Select("select id," + "filename," + "filetype," + "uploadetime," + "uploadeuser," + "filestate,"
+            +"backup1,"+"backup2,"+"backup3,"+ "backup4," +"filestate,"+" backup5 from jianzhi_peixun_file where filetype = #{filetype}")
+    @ResultMap("BaseResultMap")
+    List<File> selectbyUserType (Integer filetype);
+
+
+
+    //新增:依据用户id获取文件List
+    @Select("select id," + "filename," + "filetype," + "uploadetime," + "uploadeuser," + "filestate,"
+            +"backup1,"+"backup2,"+"backup3,"+ "backup4," +"filestate,"+" backup5 from jianzhi_peixun_file where uploadeuser = #{uploadeuser}")
+    @ResultMap("BaseResultMap")
+    List<File> selectbyUploadeType (String uploadeuser);
+}

+ 43 - 0
src/main/java/com/aijia/peixun/dao/UserMapper.java

@@ -0,0 +1,43 @@
+package com.aijia.peixun.dao;
+
+import com.aijia.peixun.entity.File;
+import com.aijia.peixun.entity.User;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.ResultMap;
+import org.apache.ibatis.annotations.Select;
+
+import java.util.List;
+
+@Mapper
+public interface UserMapper {
+    int deleteByPrimaryKey(Integer id);
+
+    int insert(User record);
+
+    int insertSelective(User record);
+
+    User selectByPrimaryKey(Integer id);
+
+    int updateByPrimaryKeySelective(User record);
+
+    int updateByPrimaryKey(User record);
+
+
+    //1.新增:依据电话号码找用户对象
+    @Select("select id," + "name," + "telephoneNo," + "email," + "sex," + "age,"
+            +"correctingsub,"+"typeofjob,"+"createtime,"+ "userstate," +"area,"+
+            "typeofuser,"+"examinetime,"+"examinenum,"+ "backup1,"+"backup2,"+"backup3,"+"backup4,"+
+            " backup5 from jianzhi_peixun_user where telephoneNo = #{telephoneNo}")
+    @ResultMap("BaseResultMap")
+    public User selectByTelephone(String telephoneNo);
+
+
+    //2.新增:依据用户状态用户List
+    @Select("select id," + "name," + "telephoneNo," + "email," + "sex," + "age,"
+            +"correctingsub,"+"typeofjob,"+"createtime,"+ "userstate," +"area,"+
+            "typeofuser,"+"examinetime,"+"examinenum,"+ "backup1,"+"backup2,"+"backup3,"+"backup4,"+
+            " backup5 from jianzhi_peixun_user where userstate = #{userstate}")
+    @ResultMap("BaseResultMap")
+    public List<User> selectbyUserState(Integer userstate);
+
+}

+ 34 - 0
src/main/java/com/aijia/peixun/dao/examinationMapper.java

@@ -0,0 +1,34 @@
+package com.aijia.peixun.dao;
+
+import com.aijia.peixun.entity.User;
+import com.aijia.peixun.entity.examination;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.ResultMap;
+import org.apache.ibatis.annotations.Select;
+
+import java.util.List;
+
+@Mapper
+public interface examinationMapper {
+    int deleteByPrimaryKey(String id);
+
+    int insert(examination record);
+
+    int insertSelective(examination record);
+
+    examination selectByPrimaryKey(String id);
+
+    int updateByPrimaryKeySelective(examination record);
+
+    int updateByPrimaryKey(examination record);
+
+
+    //1.新增:依据科目找考试试题内容
+    @Select("select id," + "user_id," + "grade," + "subject," + "version," + "name,"
+            +"pdf_without_answer_url,"+"pdf_with_answer_url,"+"status,"+ "description," +"answer_time,"+
+            "deleted,"+"update_time,"+"create_time from tb_examination_paper where subject = #{subject}")
+    @ResultMap("BaseResultMap")
+     public examination getExaminationData(String subject);
+
+
+}

+ 131 - 0
src/main/java/com/aijia/peixun/entity/File.java

@@ -0,0 +1,131 @@
+package com.aijia.peixun.entity;
+
+public class File {
+    private Integer id;
+
+    private String filename;
+
+    private Integer filetype;
+
+    private String uploadetime;
+
+    private String uploadeuser;
+
+    private Integer filestate;
+
+    private String backup1;
+
+    private String backup2;
+
+    private String backup3;
+
+    private String backup4;
+
+    private String backup5;
+
+    public File(Integer id, String filename, Integer filetype, String uploadetime, String uploadeuser, Integer filestate, String backup1, String backup2, String backup3, String backup4, String backup5) {
+        this.id = id;
+        this.filename = filename;
+        this.filetype = filetype;
+        this.uploadetime = uploadetime;
+        this.uploadeuser = uploadeuser;
+        this.filestate = filestate;
+        this.backup1 = backup1;
+        this.backup2 = backup2;
+        this.backup3 = backup3;
+        this.backup4 = backup4;
+        this.backup5 = backup5;
+    }
+
+    public File() {
+        super();
+    }
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public String getFilename() {
+        return filename;
+    }
+
+    public void setFilename(String filename) {
+        this.filename = filename == null ? null : filename.trim();
+    }
+
+    public Integer getFiletype() {
+        return filetype;
+    }
+
+    public void setFiletype(Integer filetype) {
+        this.filetype = filetype;
+    }
+
+    public String getUploadetime() {
+        return uploadetime;
+    }
+
+    public void setUploadetime(String uploadetime) {
+        this.uploadetime = uploadetime == null ? null : uploadetime.trim();
+    }
+
+    public String getUploadeuser() {
+        return uploadeuser;
+    }
+
+    public void setUploadeuser(String uploadeuser) {
+        this.uploadeuser = uploadeuser == null ? null : uploadeuser.trim();
+    }
+
+    public Integer getFilestate() {
+        return filestate;
+    }
+
+    public void setFilestate(Integer filestate) {
+        this.filestate = filestate;
+    }
+
+    public String getBackup1() {
+        return backup1;
+    }
+
+    public void setBackup1(String backup1) {
+        this.backup1 = backup1 == null ? null : backup1.trim();
+    }
+
+    public String getBackup2() {
+        return backup2;
+    }
+
+    public void setBackup2(String backup2) {
+        this.backup2 = backup2 == null ? null : backup2.trim();
+    }
+
+    public String getBackup3() {
+        return backup3;
+    }
+
+    public void setBackup3(String backup3) {
+        this.backup3 = backup3 == null ? null : backup3.trim();
+    }
+
+    public String getBackup4() {
+        return backup4;
+    }
+
+    public void setBackup4(String backup4) {
+        this.backup4 = backup4 == null ? null : backup4.trim();
+    }
+
+    public String getBackup5() {
+        return backup5;
+    }
+
+    public void setBackup5(String backup5) {
+        this.backup5 = backup5 == null ? null : backup5.trim();
+    }
+}

+ 221 - 0
src/main/java/com/aijia/peixun/entity/User.java

@@ -0,0 +1,221 @@
+package com.aijia.peixun.entity;
+
+import java.util.Date;
+
+public class User {
+    private Integer id;
+
+    private String name;
+
+    private String telephoneno;
+
+    private String email;
+
+    private String sex;
+
+    private String age;
+
+    private String correctingsub;
+
+    private Integer typeofjob;
+
+    private Date createtime;
+
+    private Integer userstate;
+
+    private String area;
+
+    private Integer typeofuser;
+
+    private Date examinetime;
+
+    private Integer examinenum;
+
+    private String backup1;
+
+    private String backup2;
+
+    private String backup3;
+
+    private String backup4;
+
+    private String backup5;
+
+    public User(Integer id, String name, String telephoneno, String email, String sex, String age, String correctingsub, Integer typeofjob, Date createtime, Integer userstate, String area, Integer typeofuser, Date examinetime, Integer examinenum, String backup1, String backup2, String backup3, String backup4, String backup5) {
+        this.id = id;
+        this.name = name;
+        this.telephoneno = telephoneno;
+        this.email = email;
+        this.sex = sex;
+        this.age = age;
+        this.correctingsub = correctingsub;
+        this.typeofjob = typeofjob;
+        this.createtime = createtime;
+        this.userstate = userstate;
+        this.area = area;
+        this.typeofuser = typeofuser;
+        this.examinetime = examinetime;
+        this.examinenum = examinenum;
+        this.backup1 = backup1;
+        this.backup2 = backup2;
+        this.backup3 = backup3;
+        this.backup4 = backup4;
+        this.backup5 = backup5;
+    }
+
+    public User() {
+        super();
+    }
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name == null ? null : name.trim();
+    }
+
+    public String getTelephoneno() {
+        return telephoneno;
+    }
+
+    public void setTelephoneno(String telephoneno) {
+        this.telephoneno = telephoneno == null ? null : telephoneno.trim();
+    }
+
+    public String getEmail() {
+        return email;
+    }
+
+    public void setEmail(String email) {
+        this.email = email == null ? null : email.trim();
+    }
+
+    public String getSex() {
+        return sex;
+    }
+
+    public void setSex(String sex) {
+        this.sex = sex == null ? null : sex.trim();
+    }
+
+    public String getAge() {
+        return age;
+    }
+
+    public void setAge(String age) {
+        this.age = age == null ? null : age.trim();
+    }
+
+    public String getCorrectingsub() {
+        return correctingsub;
+    }
+
+    public void setCorrectingsub(String correctingsub) {
+        this.correctingsub = correctingsub == null ? null : correctingsub.trim();
+    }
+
+    public Integer getTypeofjob() {
+        return typeofjob;
+    }
+
+    public void setTypeofjob(Integer typeofjob) {
+        this.typeofjob = typeofjob;
+    }
+
+    public Date getCreatetime() {
+        return createtime;
+    }
+
+    public void setCreatetime(Date createtime) {
+        this.createtime = createtime;
+    }
+
+    public Integer getUserstate() {
+        return userstate;
+    }
+
+    public void setUserstate(Integer userstate) {
+        this.userstate = userstate;
+    }
+
+    public String getArea() {
+        return area;
+    }
+
+    public void setArea(String area) {
+        this.area = area == null ? null : area.trim();
+    }
+
+    public Integer getTypeofuser() {
+        return typeofuser;
+    }
+
+    public void setTypeofuser(Integer typeofuser) {
+        this.typeofuser = typeofuser;
+    }
+
+    public Date getExaminetime() {
+        return examinetime;
+    }
+
+    public void setExaminetime(Date examinetime) {
+        this.examinetime = examinetime;
+    }
+
+    public Integer getExaminenum() {
+        return examinenum;
+    }
+
+    public void setExaminenum(Integer examinenum) {
+        this.examinenum = examinenum;
+    }
+
+    public String getBackup1() {
+        return backup1;
+    }
+
+    public void setBackup1(String backup1) {
+        this.backup1 = backup1 == null ? null : backup1.trim();
+    }
+
+    public String getBackup2() {
+        return backup2;
+    }
+
+    public void setBackup2(String backup2) {
+        this.backup2 = backup2 == null ? null : backup2.trim();
+    }
+
+    public String getBackup3() {
+        return backup3;
+    }
+
+    public void setBackup3(String backup3) {
+        this.backup3 = backup3 == null ? null : backup3.trim();
+    }
+
+    public String getBackup4() {
+        return backup4;
+    }
+
+    public void setBackup4(String backup4) {
+        this.backup4 = backup4 == null ? null : backup4.trim();
+    }
+
+    public String getBackup5() {
+        return backup5;
+    }
+
+    public void setBackup5(String backup5) {
+        this.backup5 = backup5 == null ? null : backup5.trim();
+    }
+}

+ 178 - 0
src/main/java/com/aijia/peixun/entity/examination.java

@@ -0,0 +1,178 @@
+package com.aijia.peixun.entity;
+
+import java.util.Date;
+
+public class examination {
+    private String id;
+
+    private String userId;
+
+    private String grade;
+
+    private String subject;
+
+    private Byte version;
+
+    private String name;
+
+    private String pdfWithoutAnswerUrl;
+
+    private String pdfWithAnswerUrl;
+
+    private Byte status;
+
+    private String description;
+
+    private Byte answerTime;
+//    private int answerTime;
+
+    private Boolean deleted;
+
+    private Date updateTime;
+
+    private Date createTime;
+
+    public examination(String id, String userId, String grade, String subject, Byte version, String name, String pdfWithoutAnswerUrl, String pdfWithAnswerUrl, Byte status, String description,
+                       Byte answerTime,
+//                       int answerTime,
+                       Boolean deleted, Date updateTime, Date createTime) {
+        this.id = id;
+        this.userId = userId;
+        this.grade = grade;
+        this.subject = subject;
+        this.version = version;
+        this.name = name;
+        this.pdfWithoutAnswerUrl = pdfWithoutAnswerUrl;
+        this.pdfWithAnswerUrl = pdfWithAnswerUrl;
+        this.status = status;
+        this.description = description;
+        this.answerTime = answerTime;
+        this.deleted = deleted;
+        this.updateTime = updateTime;
+        this.createTime = createTime;
+    }
+
+    public examination() {
+        super();
+    }
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id == null ? null : id.trim();
+    }
+
+    public String getUserId() {
+        return userId;
+    }
+
+    public void setUserId(String userId) {
+        this.userId = userId == null ? null : userId.trim();
+    }
+
+    public String getGrade() {
+        return grade;
+    }
+
+    public void setGrade(String grade) {
+        this.grade = grade == null ? null : grade.trim();
+    }
+
+    public String getSubject() {
+        return subject;
+    }
+
+    public void setSubject(String subject) {
+        this.subject = subject == null ? null : subject.trim();
+    }
+
+    public Byte getVersion() {
+        return version;
+    }
+
+    public void setVersion(Byte version) {
+        this.version = version;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name == null ? null : name.trim();
+    }
+
+    public String getPdfWithoutAnswerUrl() {
+        return pdfWithoutAnswerUrl;
+    }
+
+    public void setPdfWithoutAnswerUrl(String pdfWithoutAnswerUrl) {
+        this.pdfWithoutAnswerUrl = pdfWithoutAnswerUrl == null ? null : pdfWithoutAnswerUrl.trim();
+    }
+
+    public String getPdfWithAnswerUrl() {
+        return pdfWithAnswerUrl;
+    }
+
+    public void setPdfWithAnswerUrl(String pdfWithAnswerUrl) {
+        this.pdfWithAnswerUrl = pdfWithAnswerUrl == null ? null : pdfWithAnswerUrl.trim();
+    }
+
+    public Byte getStatus() {
+        return status;
+    }
+
+    public void setStatus(Byte status) {
+        this.status = status;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description == null ? null : description.trim();
+    }
+
+    public Byte getAnswerTime() {
+        return answerTime;
+    }
+//    public int getAnswerTime() {
+//        return answerTime;
+//    }
+
+
+    public void setAnswerTime(Byte answerTime) {
+        this.answerTime = answerTime;
+    }
+
+//    public void setAnswerTime(int answerTime) {
+//        this.answerTime = answerTime;
+//    }
+
+    public Boolean getDeleted() {
+        return deleted;
+    }
+
+    public void setDeleted(Boolean deleted) {
+        this.deleted = deleted;
+    }
+
+    public Date getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+}

+ 25 - 0
src/main/java/com/aijia/peixun/service/JzFileService.java

@@ -0,0 +1,25 @@
+package com.aijia.peixun.service;
+
+import com.aijia.peixun.entity.File;
+import com.aijia.peixun.utils.ResponseEntity;
+import com.aijia.peixun.vo.MultipartFileParam;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.IOException;
+import java.util.List;
+
+public interface JzFileService {
+
+   //1. 上传信息数据保存
+    public void SaveFileData(File file) throws Exception;
+
+   //2. 依据文件id,获取文件
+    public File GetFileData(Integer id) throws Exception;
+
+    //3.依据兼职教师类型获取对应的资料
+    public List<File> GetFileByType(Integer filetype) throws Exception;
+
+    //4.依据UserId,获取文件List
+    public List<File> GetFileDataList(String userId) throws Exception;
+
+}

+ 70 - 0
src/main/java/com/aijia/peixun/service/JzFileServiceImpl.java

@@ -0,0 +1,70 @@
+package com.aijia.peixun.service;
+
+import com.aijia.peixun.dao.FileMapper;
+import com.aijia.peixun.entity.File;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+
+@Service
+public class JzFileServiceImpl implements JzFileService {
+
+    @Autowired
+    FileMapper fileMapper;
+
+    //1. 上传信息数据保存
+    @Override
+    public void SaveFileData(File file) throws Exception{
+
+        try {
+        fileMapper.insert(file);
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+    }
+
+    //2. 依据文件id,获取文件
+    @Override
+    public File GetFileData(Integer id) throws Exception{
+          File file = new File();
+        try {
+            file = fileMapper.selectByPrimaryKey(id);
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+        return file;
+    }
+
+    //3.依据兼职教师类型获取对应的资料
+    @Override
+    public List<File> GetFileByType(Integer filetype) throws Exception{
+
+        List<File> list = new ArrayList();
+        try {
+            list = fileMapper.selectbyUserType(filetype);
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+        return list;
+    }
+
+    //4.依据UserId
+    @Override
+    public List<File> GetFileDataList(String userId) throws Exception{
+        List<File> list = new ArrayList();
+        try {
+            //依据userId查询List
+            list = fileMapper.selectbyUploadeType(userId);
+        }catch (Exception e){
+            e.printStackTrace();
+
+        }
+          return list;
+    }
+
+
+
+}

+ 27 - 0
src/main/java/com/aijia/peixun/service/JzPeiXunService.java

@@ -0,0 +1,27 @@
+package com.aijia.peixun.service;
+
+import com.aijia.peixun.entity.User;
+import com.aijia.peixun.entity.examination;
+import com.aijia.peixun.utils.ResponseEntity;
+
+import java.util.List;
+
+public interface JzPeiXunService {
+    //1.用户登录
+    public ResponseEntity authLogin(String telephoneNo,String smsCode) throws Exception;
+    //2.根据手机号码找到用户信息
+    public User getUserInfoByTelePhone(String telephoneNo) throws Exception;
+    //3.用户退出
+    public ResponseEntity logout() throws Exception;
+    //4.新增用户信息
+    public ResponseEntity addUser(String telephoneNo) throws Exception;
+    //5.编辑用户信息
+    public ResponseEntity updateUser(User user) throws Exception;
+    //6.获取用户资料信息
+    public User getUserInfo(Integer userid) throws Exception;
+    //7.获取正在学习教师
+    public List<User> getLearnTeacher(Integer userState) throws Exception;
+    //8.依据科目获取
+    public examination getexam(String subject) throws Exception;
+
+}

+ 147 - 0
src/main/java/com/aijia/peixun/service/JzPeiXunServiceImpl.java

@@ -0,0 +1,147 @@
+package com.aijia.peixun.service;
+
+import com.aijia.peixun.dao.UserMapper;
+import com.aijia.peixun.dao.examinationMapper;
+import com.aijia.peixun.entity.User;
+import com.aijia.peixun.entity.examination;
+import com.aijia.peixun.utils.ResponseEntity;
+import com.google.gson.JsonObject;
+import org.apache.shiro.SecurityUtils;
+import org.apache.shiro.authc.UsernamePasswordToken;
+import org.apache.shiro.subject.Subject;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class JzPeiXunServiceImpl implements JzPeiXunService{
+
+    @Autowired
+    private UserMapper userMapper;
+    @Autowired
+    private examinationMapper examinationMapper;
+
+    //1.用户登录
+    @Override
+    public ResponseEntity authLogin(String telephoneNo, String smsCode) throws Exception{
+
+        UsernamePasswordToken token = null;
+
+        System.out.println("---------开始注册登录-------");
+
+        try{
+            JsonObject object = new JsonObject();
+            Subject currentUser = SecurityUtils.getSubject();
+            //手机号+SmsCode 封装成 UsernamePasswordToken 对象;
+            token = new UsernamePasswordToken(telephoneNo,smsCode);
+            System.out.println(token);
+            //执行登录
+            currentUser.login(token);
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+        System.out.println("--------Shiro----执行登录成功------");
+        return new ResponseEntity().success("result","success");
+    }
+
+    @Override
+    public User getUserInfoByTelePhone(String telephoneNo) throws Exception{
+        User user = null;
+        try {
+            //依据电话号码查询用户对象
+            user = userMapper.selectByTelephone(telephoneNo);
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+        return user;
+    }
+
+    //3.用户退出
+    @Override
+    public ResponseEntity logout() throws Exception{
+        try {
+            Subject currentUser = SecurityUtils.getSubject();
+            currentUser.logout();
+        } catch (Exception e) {
+        }
+        return new ResponseEntity().success("success","退出成功");
+    }
+
+    //4. 增加用户
+    @Override
+    public ResponseEntity addUser(String telephoneNo) throws Exception{
+        try {
+            User user = new User();
+            user.setTelephoneno(telephoneNo);
+            userMapper.insert(user);
+        }catch (Exception e){
+            e.printStackTrace();
+            return new ResponseEntity().failure("新增用户失败");
+        }
+        return new ResponseEntity().success("新增用户成功");
+    }
+
+    //5.编辑用户信息
+    @Override
+    public ResponseEntity updateUser(User user) throws Exception{
+        try {
+//            int result = userMapper.updateByPrimaryKey(user);
+            int result = userMapper.updateByPrimaryKeySelective(user);
+            System.out.println(result);
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+        return new ResponseEntity().success("","用户资料编辑成功");
+    }
+
+    //6.获取用户资料信息
+    @Override
+    public User getUserInfo(Integer userid) throws Exception{
+        User user =null;
+        try {
+            user=userMapper.selectByPrimaryKey(userid);
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+        return user;
+    }
+
+    //7.获取正在学习教师状态
+    @Override
+    public List<User> getLearnTeacher(Integer userState) throws Exception{
+        List<User> list =null;
+        try {
+            list = userMapper.selectbyUserState(userState);
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+        return list;
+    }
+
+    //8.兼职教师依据科目获取考试试卷
+    @Override
+    public examination getexam(String subject) throws Exception{
+
+        examination examination = null;
+        try{
+           examination = examinationMapper.getExaminationData(subject);
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+         return examination;
+    }
+
+
+    //9.兼职教师依据做考试试卷
+
+
+
+
+
+    //10. 系统管理员阅卷
+
+
+
+
+}

+ 163 - 0
src/main/java/com/aijia/peixun/utils/AliyunSmsUtil.java

@@ -0,0 +1,163 @@
+package com.aijia.peixun.utils;
+
+import com.aliyuncs.DefaultAcsClient;
+import com.aliyuncs.IAcsClient;
+import com.aliyuncs.dysmsapi.model.v20170525.QuerySendDetailsRequest;
+import com.aliyuncs.dysmsapi.model.v20170525.QuerySendDetailsResponse;
+import com.aliyuncs.dysmsapi.model.v20170525.SendSmsRequest;
+import com.aliyuncs.dysmsapi.model.v20170525.SendSmsResponse;
+import com.aliyuncs.exceptions.ClientException;
+import com.aliyuncs.profile.DefaultProfile;
+import com.aliyuncs.profile.IClientProfile;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Random;
+
+/**
+ * 阿里云短信服务工具类
+ * @author Mount Liu
+ * @date 2018/9/19
+ */
+
+public class AliyunSmsUtil {
+    //产品名称:云通信短信API产品,开发者无需替换
+    static final String product = "Dysmsapi";
+    //产品域名,开发者无需替换
+    static final String domain = "dysmsapi.aliyuncs.com";
+
+    // TODO 此处需要替换成开发者自己的AK(在阿里云访问控制台寻找)
+    static final String accessKeyId = "LTAIvFRB8Hf45wjd";
+    static final String accessKeySecret = "BW01drLwzxPHQhJIs9xa8LROcoddq0";
+
+    /**
+     * 发送短信
+     * @param phoneNumber
+     * @param code 验证码
+     * @param templateCode 短信模板
+     * @return
+     * @throws ClientException
+     */
+    public static SendSmsResponse sendSms(String phoneNumber, String code, String templateCode) throws ClientException {
+
+        //可自助调整超时时间
+        System.setProperty("sun.net.client.defaultConnectTimeout", "10000");
+        System.setProperty("sun.net.client.defaultReadTimeout", "10000");
+
+        //初始化acsClient,暂不支持region化
+        IClientProfile profile = DefaultProfile.getProfile("cn-hangzhou", accessKeyId, accessKeySecret);
+        DefaultProfile.addEndpoint("cn-hangzhou", "cn-hangzhou", product, domain);
+        IAcsClient acsClient = new DefaultAcsClient(profile);
+
+        //组装请求对象-具体描述见控制台-文档部分内容
+        SendSmsRequest request = new SendSmsRequest();
+        //必填:待发送手机号
+        request.setPhoneNumbers(phoneNumber);
+        //必填:短信签名-可在短信控制台中找到
+        request.setSignName("私塾家");
+        //必填:短信模板-可在短信控制台中找到
+        request.setTemplateCode(templateCode);
+        //可选:模板中的变量替换JSON串,如模板内容为"亲爱的${name},您的验证码为${code}"时,此处的值为
+        if(StringUtil.isNotBlank(code)){
+            request.setTemplateParam("{\"code\":\""+code+"\"}");
+        }else{
+            request.setTemplateParam("{\"code\":\""+getRandNum()+"\"}");
+        }
+
+        //选填-上行短信扩展码(无特殊需求用户请忽略此字段)
+        //request.setSmsUpExtendCode("90997");
+
+        //可选:outId为提供给业务方扩展字段,最终在短信回执消息中将此值带回给调用者
+        request.setOutId("yourOutId");
+
+        //hint 此处可能会抛出异常,注意catch
+        SendSmsResponse sendSmsResponse = acsClient.getAcsResponse(request);
+
+        return sendSmsResponse;
+    }
+
+    /**
+     * 短信明细查询
+     * @param bizId
+     * @param phoneNumber
+     * @return
+     * @throws ClientException
+     */
+    public static QuerySendDetailsResponse querySendDetails(String bizId, String phoneNumber) throws ClientException {
+
+        //可自助调整超时时间
+        System.setProperty("sun.net.client.defaultConnectTimeout", "10000");
+        System.setProperty("sun.net.client.defaultReadTimeout", "10000");
+
+        //初始化acsClient,暂不支持region化
+        IClientProfile profile = DefaultProfile.getProfile("cn-hangzhou", accessKeyId, accessKeySecret);
+        DefaultProfile.addEndpoint("cn-hangzhou", "cn-hangzhou", product, domain);
+        IAcsClient acsClient = new DefaultAcsClient(profile);
+
+        //组装请求对象
+        QuerySendDetailsRequest request = new QuerySendDetailsRequest();
+        //必填-号码
+        request.setPhoneNumber(phoneNumber);
+        //可选-流水号
+        request.setBizId(bizId);
+        //必填-发送日期 支持30天内记录查询,格式yyyyMMdd
+        SimpleDateFormat ft = new SimpleDateFormat("yyyyMMdd");
+        request.setSendDate(ft.format(new Date()));
+        //必填-页大小
+        request.setPageSize(10L);
+        //必填-当前页码从1开始计数
+        request.setCurrentPage(1L);
+
+        //hint 此处可能会抛出异常,注意catch
+        QuerySendDetailsResponse querySendDetailsResponse = acsClient.getAcsResponse(request);
+
+        return querySendDetailsResponse;
+    }
+
+    /**
+     * 生成6位随机数
+     * @return
+     */
+    public static String getRandNum() {
+        String randNum = new Random().nextInt(1000000) + "";
+        //如果生成的不是6位数随机数则返回该方法继续生成
+        if (randNum.length() != 6) {
+            return getRandNum();
+        }
+        return randNum;
+    }
+
+    public static void main(String[] args) throws ClientException, InterruptedException {
+        //发短信
+        SendSmsResponse response = sendSms("18611015740",null,null);
+        System.out.println("短信接口返回的数据----------------");
+        System.out.println("Code=" + response.getCode());
+        System.out.println("Message=" + response.getMessage());
+        System.out.println("RequestId=" + response.getRequestId());
+        System.out.println("BizId=" + response.getBizId());
+        Thread.sleep(3000L);
+        //查明细
+        if (response.getCode() != null && response.getCode().equals("OK")) {
+            QuerySendDetailsResponse querySendDetailsResponse = querySendDetails(response.getBizId(), "18611015740");
+            System.out.println("短信明细查询接口返回数据----------------");
+            System.out.println("Code=" + querySendDetailsResponse.getCode());
+            System.out.println("Message=" + querySendDetailsResponse.getMessage());
+            int i = 0;
+            for (QuerySendDetailsResponse.SmsSendDetailDTO smsSendDetailDTO : querySendDetailsResponse.getSmsSendDetailDTOs()) {
+                System.out.println("SmsSendDetailDTO[" + i + "]:");
+                System.out.println("Content=" + smsSendDetailDTO.getContent());
+                System.out.println("ErrCode=" + smsSendDetailDTO.getErrCode());
+                System.out.println("OutId=" + smsSendDetailDTO.getOutId());
+                System.out.println("PhoneNum=" + smsSendDetailDTO.getPhoneNum());
+                System.out.println("ReceiveDate=" + smsSendDetailDTO.getReceiveDate());
+                System.out.println("SendDate=" + smsSendDetailDTO.getSendDate());
+                System.out.println("SendStatus=" + smsSendDetailDTO.getSendStatus());
+                System.out.println("Template=" + smsSendDetailDTO.getTemplateCode());
+            }
+            System.out.println("TotalCount=" + querySendDetailsResponse.getTotalCount());
+            System.out.println("RequestId=" + querySendDetailsResponse.getRequestId());
+        }
+    }
+
+
+}

+ 383 - 0
src/main/java/com/aijia/peixun/utils/Constant.java

@@ -0,0 +1,383 @@
+package com.aijia.peixun.utils;
+
+import java.util.*;
+
+public class Constant {
+
+    /**
+     * 作业批注超时时间,30分钟
+     */
+    public static final int HOME_WORK_OUTTIME = 30;
+
+    /**
+     * 难题解答超时时间,20分钟
+     */
+    public static final int PROBLEM_OUTTIME = 20;
+
+    /**
+     * tb_lib_manager中校长的类别
+     */
+    public static final int SCHOOL_MASTER_TYPE = 6;
+
+    /**
+     * tb_lib_manager中馆长的类别
+     */
+    public static final int CURATOR = 4;
+
+    /**
+     * tb_lib_manager中在馆老师的类别
+     */
+    public static final int TEACHER_TYPE = 2;
+
+    /**
+     * tb_lib_manager一对一的老师类别
+     */
+    public static final int KMT_121_TEACHER_TYPE = 7;
+
+    /**
+     * tb_lib_manager中线上老师,和kmt 的老师
+     */
+    public static final int KMT_122_TEACHER_TYPE = 8;
+
+    /**
+     * tb_lib_manager小课老师的type
+     */
+    public static final int GROUP_TEACHER_TYPE = 9;
+
+    /**
+     * tb_lib_manager中学科老师的类别
+     */
+    public static final int ORG_TEACHER_TYPE = 10;
+
+    /**
+     * tb_lib_manager中管理员的类别
+     */
+    public static final int CORRECT_MANAGER = 11;
+
+    /**
+     * tb_lib_manager中批注质检员的类别
+     */
+    public static final int CORRECT_CHECKER = 50;
+
+
+    /**
+     * tb_lib_manager中超级管理员的类别
+     */
+    public static final int CORRECT_SUPER_MANAGER = 12;
+
+    /**
+     * tb_lib_manager中匹配知识点老师的类别
+     */
+    public static final int KNOW_MATCH_TYPE = 13;
+
+    /**
+     * 质检员类别
+     */
+    public static final int HOMEWORK_CHECK_TYPE = 14;
+
+    /**
+     * tb_lib_manager 机构作业自批注老师
+     */
+    public static final int LIB_TEACHER_TYPE = 15;
+
+    /**
+     * 作业批注
+     */
+    public static final int TEACHER_TASK_HOMEWORK = 1;
+
+    /**
+     * 难题反馈
+     */
+    public static final int TEACHER_TASK_RPOBLEM = 2;
+
+    /**
+     * 作业批注
+     */
+    public static final int TEACHER_TASK_WORKFEEDBACK = 3;
+
+    /**
+     * 年级
+     */
+    public static final List<String> GRADE_LIST = Arrays.asList("一年级", "二年级", "三年级", "四年级", "五年级", "六年级");
+
+    /**
+     * 学期
+     */
+    public static final List<Integer> SEMESTER_LIST = Arrays.asList(1, 2);
+
+    /**
+     * 知识点类型
+     */
+    public static final List<Integer> SEMESTER_REVIEW_KNOWLEDGE_TYPE_LIST = Arrays.asList(-1, 0, 1);
+
+    /**
+     * 服务列表
+     */
+    public static final Map<String, String> SERVICE_MAP = new HashMap<String, String>();
+    /**
+     * 录入
+     */
+    public static final String CMB_DF_STATUS_I = "I";
+    /**
+     * 成功
+     */
+    public static final String CMB_DF_STATUS_S = "S";
+    /**
+     * 失败
+     */
+    public static final String CMB_DF_STATUS_F = "F";
+
+    /**
+     * 正在获取状态
+     */
+    public static final String CMB_DF_STATUS_C = "C";
+
+    /**
+     * 录入
+     */
+    public static final String WITHDRAWAL_STATUS_INIT = "INIT";
+    /**
+     * 重新
+     */
+    public static final String WITHDRAWAL_STATUS_REINIT = "REINIT";
+    /**
+     * 错误
+     */
+    public static final String WITHDRAWAL_STATUS_ERROR = "ERROR";
+    /**
+     * 成功
+     */
+    public static final String WITHDRAWAL_STATUS_SUCCESS = "SUCCESS";
+    /**
+     * 失败
+     */
+    public static final String WITHDRAWAL_STATUS_FAIL = "FAIL";
+
+    /**
+     * 注册老师
+     */
+    public static final String REGISTER_TEACHER = "注册老师";
+
+    /**
+     * 资深老师
+     */
+    public static final String SENIOR_TEACHER = "资深老师";
+    /**
+     * 明星老师
+     */
+    public static final String STAR_TEACHER = "明星老师";
+    /**
+     * 学霸老师
+     */
+    public static final String SUPER_TEACHER = "学霸老师";
+
+    /**
+     * 小课老师
+     */
+    public static final String GROUP_TEACHER = "小课老师";
+
+    /**
+     * redis中已离开馆学生键值对的key的前缀,完整key为:key的前缀+馆id
+     */
+    public static final String EXITED_STUDENT_PREFIX = "EXITED_STUDENT_";
+
+    /**
+     * redis中同步锁key的前缀,完整key为:key的前缀+学生id
+     */
+    public static final String SIGN_LOCK_PREFIX = "SIGN_LOCK_";
+
+    /**
+     * redis中es保存出错的题目id的key
+     */
+    public static final String ES_SAVE_ERROR_QUESTIONS = "ES_SAVE_ERROR_QUESTIONS";
+
+    /**
+     * 各端app平台类型
+     */
+    public static final Integer CONCH_PLATFORM_TYPE = 1;
+    public static final Integer PARENT_PLATFORM_TYPE = 2;
+    public static final Integer STUDENT_PLATFORM_TYPE = 3;
+    public static final Integer TEACHER_PLATFORM_TYPE = 4;
+    public static final Integer SCHOOL_MASTER_PLATFORM_TYPE = 5;
+
+    public static final String PREVIOUS50_HOMEWORK_RANK = "PREVIOUS50_HOMEWORK_RANK";
+
+    /**
+     * 提分训练,推题时排除这些考点
+     */
+    public static final String EXCLUDED_KD_ID_OF_TRAIN_RECOMMEND = "EXCLUDED_KD_ID_OF_TRAIN_RECOMMEND";
+
+    /**
+     * 提分训练,推题时排除这些知识点
+     */
+    public static final String EXCLUDED_HOW_DETAIL_ID_OF_TRAIN_RECOMMEND = "EXCLUDED_HOW_DETAIL_ID_OF_TRAIN_RECOMMEND";
+
+    public static final Map<String, String> ZYB_CARD_TYPE = new HashMap<String, String>();
+
+    public static final String TEACHERAPP_URL = "https://img.sharingschool.com/aijiaH5/SSJAPPDownload/teacher.html";
+
+    public static final String PARENTAPP_URL = "https://img.sharingschool.com/aijiaH5/SSJAPPDownload/user.html";
+
+    /**
+     * 练习册最大数量
+     */
+    public static final int MAX_ROWS_COUNT = 5000;
+
+//    /**
+//     * 题目类型
+//     */
+//    public static final List<QuestionSubjectAttribute> QUESTION_TYPES = JSONArray.parseArray(PropertiesUtil.getValue("QUESTION_TYPES"), QuestionSubjectAttribute.class);
+//
+//    /**
+//     * 难度级别
+//     */
+//    public static final List<KnowledgeBaseDto> DIFFICULTY_LEVELS = JSONArray.parseArray(PropertiesUtil.getValue("DIFFICULTY_LEVELS"), KnowledgeBaseDto.class);
+//
+//    /**
+//     * 真题例题练习题
+//     */
+//    public static final List<KnowledgeBaseDto> REAL_EXAM_TYPE = JSONArray.parseArray(PropertiesUtil.getValue("REAL_EXAM_TYPE"), KnowledgeBaseDto.class);
+//
+//    /**
+//     * 能力
+//     */
+//    public static final List<QuestionSubjectAttribute> TRAINING_SKILL =  JSONArray.parseArray(PropertiesUtil.getValue("TRAINING_SKILL"), QuestionSubjectAttribute.class);
+
+
+    /**
+     * 保存文件所在路径的key,eg.FILE_MD5:1243jkalsjflkwaejklgjawe
+     */
+    public static final String FILE_MD5_KEY = "FILE_MD5:";
+    /**
+     * 保存上传文件的状态
+     */
+    public static final String FILE_UPLOAD_STATUS = "FILE_UPLOAD_STATUS";
+
+    /**
+     * 练习册题目类型
+     */
+    public static final Map<Integer, String> QUESTION_TYPE_MAP = new HashMap<>();
+
+    static {
+        SERVICE_MAP.put("S003", "作业吧");
+        SERVICE_MAP.put("S010", "一对一");
+
+        ZYB_CARD_TYPE.put("C001", "年卡");
+        ZYB_CARD_TYPE.put("C002", "半年卡");
+        ZYB_CARD_TYPE.put("C003", "月卡");
+        ZYB_CARD_TYPE.put("C004", "作业吧月卡");
+        ZYB_CARD_TYPE.put("C005", "作业吧半年卡");
+        ZYB_CARD_TYPE.put("C006", "作业吧年卡");
+        ZYB_CARD_TYPE.put("C015", "季度卡");
+
+        QUESTION_TYPE_MAP.put(1, "选择题");
+        QUESTION_TYPE_MAP.put(2, "多选项");
+        QUESTION_TYPE_MAP.put(3, "填空题");
+        QUESTION_TYPE_MAP.put(4, "简答题");
+        QUESTION_TYPE_MAP.put(6, "计算题");
+        QUESTION_TYPE_MAP.put(7, "作文题");
+        QUESTION_TYPE_MAP.put(8, "判断题");
+        QUESTION_TYPE_MAP.put(9, "连线题");
+        QUESTION_TYPE_MAP.put(10, "翻译题");
+        QUESTION_TYPE_MAP.put(11, "匹配题");
+        QUESTION_TYPE_MAP.put(12, "阅读题");
+        QUESTION_TYPE_MAP.put(13, "语音题");
+        QUESTION_TYPE_MAP.put(14, "操作题");
+        QUESTION_TYPE_MAP.put(16, "课外阅读题");
+        QUESTION_TYPE_MAP.put(17, "解决问题");
+        QUESTION_TYPE_MAP.put(18, "看图列式");
+        QUESTION_TYPE_MAP.put(19, "情景交际");
+        QUESTION_TYPE_MAP.put(20, "听力题");
+        QUESTION_TYPE_MAP.put(21, "口语题");
+        QUESTION_TYPE_MAP.put(22, "课内阅读题");
+        QUESTION_TYPE_MAP.put(23, "朗读背诵题");
+    }
+
+    public static final String getSubjectFromRequest(String subject) {
+        if ("YUWEN".equals(subject)) {
+            subject = "语文";
+        } else if ("YINGYU".equals(subject)) {
+            subject = "英语";
+        } else if ("SHUXUE".equals(subject)) {
+            subject = "数学";
+        }
+        return subject;
+    }
+
+    /**
+     * 获取中文汉字数字
+     * @param num
+     * @return
+     */
+    public static String getChineseNumberByNumber (int num){
+        String[] chinese = { "零", "一", "二", "三", "四", "五", "六", "七", "八", "九" };
+        String[] unit = { "十", "百", "千", "万", "十", "百", "千", "亿", "十", "百", "千" };
+        if (num > 0){
+            char[] numChar = (num + "").toCharArray();
+            StringBuffer sb = new StringBuffer();
+            int size = numChar.length;
+            for (int i = 0; i < numChar.length; i++) {
+                int tempNum = Integer.parseInt(String.valueOf(numChar[i]));
+                if(i != 0){
+                    if (sb.length() > 0 && "零".equals(sb.substring(sb.length() - 1, sb.length()))){
+                        if (tempNum != 0){
+                            sb.append(chinese[tempNum]);
+                        }
+                    } else {
+                        sb.append(unit[size-i-1]+chinese[tempNum]);
+                    }
+                } else {
+                    sb.append(chinese[tempNum]);
+                }
+            }
+            if (sb.length() > 2 && "一十".equals(sb.substring(0, 2))){
+                sb.deleteCharAt(0);
+            }
+            if (sb.length() > 0 && "零".equals(sb.substring(sb.length() - 1, sb.length()))){
+                sb.deleteCharAt(sb.length() - 1);
+            }
+            return sb.toString();
+        } else {
+            return "";
+        }
+    }
+
+    /**
+     * 把解析json转成html
+     *
+     * @return
+     */
+    public static final String changeAnalysisJson2AnalysisHtml(List<Map> arr) {
+        String result = null;
+        if (arr != null && arr.size() > 0) {
+            List<String> htmlList = new ArrayList<>();
+            for (Map<String, Object> a : arr) {
+                List<Map<String, Object>> list = (List<Map<String, Object>>) a.get("list");
+                List<String> htmlLi = new ArrayList<>();
+                for (Map<String, Object> c : list) {
+                    Map<String, Object> style = (Map<String, Object>) c.get("style");
+                    String value = (String) c.get("value");
+                    int type = (int) c.get("type");
+                    int width = (int) style.get("width");
+                    int height = (int) style.get("height");
+                    if (type == 1) {
+                        htmlLi.add("<span>" + value + "</span>");
+                    } else if (type == 2) {
+                        htmlLi.add("<img src=\"" + value + "\" style=\"width: " + width + "px; height: " + height
+                                + "px;\" alt=\"题目解析\"/>");
+                    }
+                }
+                if (htmlLi.size() > 0) {
+                    htmlList.add(
+                            "<div style=\"display: -webkit-flex; display: flex; -webkit-flex-direction: row; flex-direction: row; -webkit-flex-wrap: wrap; flex-wrap: wrap; -webkit-justify-content: flex-start; justify-content: flex-start; -webkit-align-items: flex-start; align-items: flex-start; margin: 0 50px 25px 0;\">"
+                                    + StringUtil.join(htmlLi, "") + "</div>");
+                }
+            }
+            result = "<div style=\"width: 100%; display: -webkit-flex; display: flex; -webkit-flex-direction: column; flex-direction: column; -webkit-flex-wrap: wrap; flex-wrap: wrap; -webkit-justify-content: flex-start; justify-content: flex-start; -webkit-align-items: flex-start; align-items: flex-start;\">"
+                    + StringUtil.join(htmlList, "") + "</div>";
+        }
+        return result;
+    }
+
+
+}

+ 19 - 0
src/main/java/com/aijia/peixun/utils/Constants.java

@@ -0,0 +1,19 @@
+package com.aijia.peixun.utils;
+
+public class Constants {
+
+    public static final String SUCCESS_CODE = "100";
+    public static final String SUCCESS_MSG = "请求成功";
+
+    public static final String CUSTOM_CODE = "502";
+    public static final String CUSTOM_MSG = "权限不足";
+
+    public static final String PWD_CODE = "302";
+    public static final String PWD_MSG = "第一次登陆修改密码";
+    public static final String SESSION_USER_PERMISSION = "userPermission";
+    /**
+     * session中存放用户信息的key值
+     */
+    public static final String SESSION_USER_INFO = "userInfo";
+
+}

+ 44 - 0
src/main/java/com/aijia/peixun/utils/EmptyUtil.java

@@ -0,0 +1,44 @@
+package com.aijia.peixun.utils;
+
+import java.util.List;
+
+public class EmptyUtil {
+
+    /**
+     * 判断对象为空
+     *
+     * @param obj
+     *      对象名
+     * @return 是否为空
+     */
+    @SuppressWarnings("rawtypes")
+    public static boolean isEmpty(Object obj)
+    {
+        if (obj == null)
+        {
+            return true;
+        }
+        if ((obj instanceof List))
+        {
+            return ((List) obj).size() == 0;
+        }
+        if ((obj instanceof String))
+        {
+            return ((String) obj).trim().equals("");
+        }
+        return false;
+    }
+
+    /**
+     * 判断对象不为空
+     *
+     * @param obj
+     *      对象名
+     * @return 是否不为空
+     */
+    public static boolean isNotEmpty(Object obj)
+    {
+        return !isEmpty(obj);
+    }
+
+}

+ 41 - 0
src/main/java/com/aijia/peixun/utils/ErrorEnum.java

@@ -0,0 +1,41 @@
+package com.aijia.peixun.utils;
+
+public enum ErrorEnum {
+    /*
+     * 错误信息
+     * */
+    E_400("400", "请求处理异常,请稍后再试"),
+    E_500("500", "请求方式有误,请检查 GET/POST"),
+    E_501("501", "请求路径不存在"),
+    E_502("502", "权限不足"),
+    E_10008("10008", "角色删除失败,尚有用户属于此角色"),
+    E_10009("10009", "账户已存在"),
+
+    E_20011("20011", "登陆已过期,请重新登陆"),
+
+    E_90003("90003", "缺少必填参数"),
+
+    E_90004("90004", "参数输入错误"),
+    E_90005("90005", "请输入正确的参数格式"),
+
+    E_90006("90006", "输入的原始密码不正确"),
+    E_90007("90007", "原始密码与新密码一致");
+
+    private String errorCode;
+
+    private String errorMsg;
+
+    ErrorEnum(String errorCode, String errorMsg) {
+        this.errorCode = errorCode;
+        this.errorMsg = errorMsg;
+    }
+
+    public String getErrorCode() {
+        return errorCode;
+    }
+
+    public String getErrorMsg() {
+        return errorMsg;
+    }
+
+}

+ 86 - 0
src/main/java/com/aijia/peixun/utils/FileMD5Util.java

@@ -0,0 +1,86 @@
+package com.aijia.peixun.utils;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import sun.nio.ch.FileChannelImpl;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.lang.reflect.Method;
+import java.math.BigInteger;
+import java.nio.MappedByteBuffer;
+import java.nio.channels.FileChannel;
+import java.security.AccessController;
+import java.security.MessageDigest;
+import java.security.PrivilegedAction;
+
+public class FileMD5Util {
+    private final static Logger logger = LoggerFactory.getLogger(FileMD5Util.class);
+
+    public static String getFileMD5(File file) throws FileNotFoundException {
+        String value = null;
+        FileInputStream in = new FileInputStream(file);
+        MappedByteBuffer byteBuffer = null;
+        try {
+            byteBuffer = in.getChannel().map(FileChannel.MapMode.READ_ONLY, 0, file.length());
+            MessageDigest md5 = MessageDigest.getInstance("MD5");
+            md5.update(byteBuffer);
+            BigInteger bi = new BigInteger(1, md5.digest());
+            value = bi.toString(16);
+            if (value.length() < 32) {
+                value = "0" + value;
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            if (null != in) {
+                try {
+                    in.getChannel().close();
+                    in.close();
+                } catch (IOException e) {
+                    logger.error("get file md5 error!!!", e);
+                }
+            }
+            if (null != byteBuffer) {
+                freedMappedByteBuffer(byteBuffer);
+            }
+        }
+        return value;
+    }
+
+    /**
+     * 在MappedByteBuffer释放后再对它进行读操作的话就会引发jvm crash,在并发情况下很容易发生
+     * 正在释放时另一个线程正开始读取,于是crash就发生了。所以为了系统稳定性释放前一般需要检 查是否还有线程在读或写
+     *
+     * @param mappedByteBuffer
+     */
+    public static void freedMappedByteBuffer(final MappedByteBuffer mappedByteBuffer) {
+        try {
+            if (mappedByteBuffer == null) {
+                return;
+            }
+
+            mappedByteBuffer.force();
+            AccessController.doPrivileged(new PrivilegedAction<Object>() {
+                @Override
+                public Object run() {
+                    try {
+                        Method m = FileChannelImpl.class.getDeclaredMethod("unmap",
+                                MappedByteBuffer.class);
+                        m.setAccessible(true);
+                        m.invoke(FileChannelImpl.class, mappedByteBuffer);
+                    } catch (Exception e) {
+                        logger.error("clean MappedByteBuffer error!!!", e);
+                    }
+                    logger.info("clean MappedByteBuffer completed!!!");
+                    return null;
+                }
+            });
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+}

+ 66 - 0
src/main/java/com/aijia/peixun/utils/PhoneFormatCheckUtils.java

@@ -0,0 +1,66 @@
+package com.aijia.peixun.utils;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.util.regex.PatternSyntaxException;
+
+/**
+ * @since :手机号码校验工具类
+ * @author :Jgm
+ * @Date: 20210706
+ */
+
+public class PhoneFormatCheckUtils {
+
+    /**
+     * 大陆号码或香港号码均可
+     */
+    public static boolean isPhoneLegal(String str) throws PatternSyntaxException {
+        return isChinaPhoneLegal(str) || isHKPhoneLegal(str);
+    }
+
+    /**
+     * 大陆手机号码11位数,匹配格式:前三位固定格式+后8位任意数
+     * 此方法中前三位格式有:
+     * 13+任意数
+     * 145,147,149
+     * 15+除4的任意数(不要写^4,这样的话字母也会被认为是正确的)
+     * 166
+     * 17+3,5,6,7,8
+     * 18+任意数
+     * 198,199
+     */
+    public static boolean isChinaPhoneLegal(String str) throws PatternSyntaxException {
+        // ^ 匹配输入字符串开始的位置
+        // \d 匹配一个或多个数字,其中 \ 要转义,所以是 \\d
+        // $ 匹配输入字符串结尾的位置
+        String regExp = "^((13[0-9])|(14[5,7,9])|(15[0-3,5-9])|(166)|(17[3,5,6,7,8])" +
+                "|(18[0-9])|(19[8,9]))\\d{8}$";
+        Pattern p = Pattern.compile(regExp);
+        Matcher m = p.matcher(str);
+        return m.matches();
+    }
+
+    /**
+     * 香港手机号码8位数,5|6|8|9开头+7位任意数
+     */
+    public static boolean isHKPhoneLegal(String str) throws PatternSyntaxException {
+        // ^ 匹配输入字符串开始的位置
+        // \d 匹配一个或多个数字,其中 \ 要转义,所以是 \\d
+        // $ 匹配输入字符串结尾的位置
+        String regExp = "^(5|6|8|9)\\d{7}$";
+        Pattern p = Pattern.compile(regExp);
+        Matcher m = p.matcher(str);
+        return m.matches();
+    }
+
+    /**
+     *
+     * 判断是否是正整数的方法
+     */
+    public static boolean isNumeric(String string){
+        Pattern pattern = Pattern.compile("[0-9]+");
+        return pattern.matcher(string).matches();
+    }
+
+}

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 2124 - 0
src/main/java/com/aijia/peixun/utils/RedisUtil.java


+ 88 - 0
src/main/java/com/aijia/peixun/utils/ResponseConstant.java

@@ -0,0 +1,88 @@
+package com.aijia.peixun.utils;
+
+/**
+ *
+ * 类名称:Response<br>
+ * 类描述:Response 类<br>
+ * @version v1.0
+ *
+ */
+
+public class ResponseConstant {
+    /**
+     * 成功状态
+     */
+    public static final String CODE_999 = "999";
+
+    /**
+     * 用户名不存在
+     */
+    public static final String CODE_000 = "000";
+
+    /**
+     * 用户名和密码不匹配
+     */
+    public static final String CODE_001 = "001";
+
+    /**
+     * 用户密码不符合规范,需要重置密码
+     */
+    public static final String CODE_011 = "011";
+
+    /**
+     * 网络问题
+     */
+    public static final String CODE_002 = "002";
+    /**
+     * 会员卡为空
+     */
+    public static final String CODE_004 = "004";
+    /**
+     *图书isbn编号为空
+     */
+    public static final String CODE_005 = "005";
+    /**
+     *图书馆ID为空
+     */
+    public static final String CODE_006 = "006";
+    /**
+     *图书库存不足
+     */
+    public static final String CODE_007 = "007";
+    /**
+     *图书不存在
+     */
+    public static final String CODE_008 = "008";
+
+    /**
+     * 401 Unauthorized
+     */
+    public static final String CODE_401 = "401";
+
+    /**
+     * 403 Forbidden
+     */
+    public static final String CODE_403 = "403";
+
+    /**
+     * 404 Not Found
+     */
+    public static final String CODE_404 = "404";
+
+    /**
+     * 服务器问题
+     */
+    public static final String CODE_500 = "500";
+    /**
+     * 没有服务
+     */
+    public static final String CODE_003 = "003";
+    /**
+     * 请求太频繁
+     */
+    public static final String CODE_503 = "503";
+    /**
+     * 小程序根据code获取不到uninoid
+     */
+    public static final String CODE_888 = "888";
+}

+ 152 - 0
src/main/java/com/aijia/peixun/utils/ResponseEntity.java

@@ -0,0 +1,152 @@
+package com.aijia.peixun.utils;
+
+import java.io.Serializable;
+import java.util.Map;
+
+/**
+ *
+ * 类名称:Response<br>
+ * 类描述:Response 类<br>
+ * @version v1.0
+ *
+ */
+
+public class ResponseEntity {
+
+    /**
+     *
+     */
+    private static final long serialVersionUID = 8731218855844435111L;
+    private static final String ERROR = "error";
+    private static final String SUCCESS = "success";
+
+    private String status;
+    private String code;
+    private String msg;
+    private Object data;
+
+    public ResponseEntity success() {
+        this.status = SUCCESS;
+        this.msg = "成功";
+        this.code = com.aijia.peixun.utils.ResponseConstant.CODE_999;
+        return this;
+    }
+
+    public ResponseEntity success(String msg) {
+        this.status = SUCCESS;
+        this.msg = msg;
+        this.code = com.aijia.peixun.utils.ResponseConstant.CODE_999;
+        return this;
+    }
+
+    public ResponseEntity success(String code, String msg) {
+        this.status = SUCCESS;
+        this.code = code;
+        this.msg = msg;
+        return this;
+    }
+
+    public ResponseEntity success(Map<String, Object> data, String msg) {
+        this.status = SUCCESS;
+        this.code = ResponseConstant.CODE_999;
+        this.msg = msg;
+        this.data = data;
+        return this;
+    }
+
+    public ResponseEntity success(Object data, String msg) {
+        this.status = SUCCESS;
+        this.code = ResponseConstant.CODE_999;
+        this.msg = msg;
+        this.data = data;
+        return this;
+    }
+
+    public ResponseEntity success(String code, String msg, Map<String, Object> data) {
+        this.status = SUCCESS;
+        this.code = code;
+        this.msg = msg;
+        this.data = data;
+        return this;
+    }
+
+    public ResponseEntity failure(String code, String msg) {
+        this.status = ERROR;
+        this.code = code;
+        this.msg = msg;
+        return this;
+    }
+
+    public ResponseEntity failure(String msg) {
+        this.status = ERROR;
+        this.code = ResponseConstant.CODE_000;
+        this.msg = msg;
+        return this;
+    }
+
+    public ResponseEntity failure(Object data, String msg) {
+        this.status = ERROR;
+        this.code = ResponseConstant.CODE_000;
+        this.msg = msg;
+        this.data = data;
+        return this;
+    }
+
+    public ResponseEntity failure(String code, String msg, Object data) {
+        this.status = ERROR;
+        this.code = code;
+        this.msg = msg;
+        this.data = data;
+        return this;
+    }
+
+    public String getStatus() {
+        return status;
+    }
+
+    public String getCode() {
+        return code;
+    }
+
+    public String getMsg() {
+        return msg;
+    }
+
+    public void setMsg(String msg) {
+        this.msg = msg;
+    }
+
+    public Object getData() {
+        return data;
+    }
+
+    public void setData(ResponseData data) {
+        this.data = data;
+    }
+
+    public class ResponseData implements Serializable {
+        /**
+         *
+         */
+        private static final long serialVersionUID = 4460263954067427230L;
+        private Map<String, Object> data;
+
+        public ResponseData() {
+            super();
+        }
+
+        public ResponseData(Map<String, Object> data) {
+            super();
+            this.data = data;
+        }
+
+        public Map<String, Object> getData() {
+            return data;
+        }
+
+        public void setData(Map<String, Object> data) {
+            this.data = data;
+        }
+    }
+
+}

+ 53 - 0
src/main/java/com/aijia/peixun/utils/SmsUtils.java

@@ -0,0 +1,53 @@
+package com.aijia.peixun.utils;
+
+
+import javax.annotation.Resource;
+
+public class SmsUtils {
+
+    //1. 发短息
+//    public ResponseEntity sendSms(String phoneNumber, int type) throws Exception{
+        public String sendSms(String phoneNumber, int type) throws Exception{
+        ResponseEntity responseEntity = null;
+        String code = null;
+        try {
+            responseEntity = new ResponseEntity();
+            //判断手机号是否已经注册逻辑
+            //获取6位随机验证码
+            code = AliyunSmsUtil.getRandNum();
+            //所有验证码使用通用验证码:验证码${code},若非本人操作,请勿泄露。
+            AliyunSmsUtil.sendSms(phoneNumber, code,"SMS_175541171");
+            //1:用户注册或登陆确认;2:绑定手机号;3:设置支付密码;4:忘记支付密码;5:添加银行卡;6:换绑手机号
+		/*if (type == 1) {
+			User user = userService.findByMobile(phoneNumber);
+			if(user != null){
+				//登陆确认
+				AliyunSmsUtil.sendSms(phoneNumber, code,"SMS_146410129");
+			}else {
+				//用户注册
+				AliyunSmsUtil.sendSms(phoneNumber, code,"SMS_146410127");
+			}
+		} else if (type == 2) {
+            AliyunSmsUtil.sendSms(phoneNumber, code,"SMS_151548213");
+		} else if (type == 3) {
+            AliyunSmsUtil.sendSms(phoneNumber, code,"SMS_151548220");
+        } else if (type == 4) {
+            AliyunSmsUtil.sendSms(phoneNumber, code,"SMS_175120586");
+        } else if (type == 5) {
+            AliyunSmsUtil.sendSms(phoneNumber, code,"SMS_151578201");
+        } else if (type == 6) {
+            AliyunSmsUtil.sendSms(phoneNumber, code,"SMS_151578199");
+        }*/
+//        tokenManager.setString(phoneNumber, code, 300);
+
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+
+        //返回手机号与验证码
+//        return responseEntity.success(phoneNumber,code);
+            return code;
+    }
+
+
+}

+ 50 - 0
src/main/java/com/aijia/peixun/utils/StringUtil.java

@@ -0,0 +1,50 @@
+package com.aijia.peixun.utils;
+
+import org.apache.commons.lang3.StringUtils;
+
+import java.util.Collection;
+import java.util.Map;
+
+
+public class StringUtil extends StringUtils {
+
+    public static <T> boolean isEmpty(T[] obj) {
+        return (obj == null) || (obj.length == 0);
+    }
+
+    public static boolean isEmpty(Object obj) {
+        if (obj == null) {
+            return true;
+        }
+        if ((obj instanceof String)) {
+            return (String.valueOf(obj)).trim().isEmpty();
+        }
+        if (obj instanceof CharSequence) {
+            return ((CharSequence) obj).length() == 0;
+        }
+        if (obj instanceof Number) {
+            return false;
+        }
+        return false;
+    }
+    public static String formateStr (String str){
+        if (isEmpty(str)){
+            return "";
+        } else {
+            return str;
+        }
+    }
+    @SuppressWarnings("rawtypes")
+    public static boolean isEmpty(Collection obj) {
+        return (obj == null) || (obj.isEmpty());
+    }
+
+    @SuppressWarnings("rawtypes")
+    public static boolean isEmpty(Map obj) {
+        return (obj == null) || (obj.isEmpty());
+    }
+
+
+   
+
+}

+ 47 - 0
src/main/java/com/aijia/peixun/utils/Uuid.java

@@ -0,0 +1,47 @@
+package com.aijia.peixun.utils;
+
+import java.util.UUID;
+
+public class Uuid {
+    // 得到16位的UUID-(数字)
+    public static String getUUID_16() {
+        int machineId = 1;// 最大支持1-9个集群机器部署
+
+        int hashCodeV = UUID.randomUUID().toString().hashCode();
+        if (hashCodeV < 0) {// 有可能是负数
+            hashCodeV = -hashCodeV;
+        }
+        String string = machineId + String.format("%015d", hashCodeV);
+        return string;
+    }
+
+    // 得到32位的UUID-(数字)
+    public static String getUUID_32() {
+        return UUID.randomUUID().toString().replace("-", "").toLowerCase();
+    }
+
+    //得到8位的UUID-(码)
+    public static String[] chars = new String[] { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n",
+            "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "0", "1", "2", "3", "4", "5", "6", "7", "8",
+            "9", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T",
+            "U", "V", "W", "X", "Y", "Z" };
+
+    public static String getUUID_8() {
+        StringBuffer shortBuffer = new StringBuffer();
+        String uuid = UUID.randomUUID().toString().replace("-", "");
+        for (int i = 0; i < 8; i++) {
+            String str = uuid.substring(i * 4, i * 4 + 4);
+            int x = Integer.parseInt(str, 16);
+            shortBuffer.append(chars[x % 0x3E]);
+        }
+        return shortBuffer.toString();
+
+    }
+
+    public static void main(String[] args) {
+
+        System.out.println(getUUID_8());
+    }
+
+}
+

+ 120 - 0
src/main/java/com/aijia/peixun/utils/ZipFileUtil.java

@@ -0,0 +1,120 @@
+package com.aijia.peixun.utils;
+
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.*;
+import java.nio.charset.Charset;
+import java.util.Enumeration;
+import java.util.UUID;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+
+public class ZipFileUtil {
+
+    /**
+     * 解压文件到指定目录
+     */
+    public static void unZipFiles(File zipFile, String descDir)throws IOException {
+        File pathFile = new File(descDir);
+        if(!pathFile.exists())
+        {
+            pathFile.mkdirs();
+        }
+        //解决zip文件中有中文目录或者中文文件
+        ZipFile zip = new ZipFile(zipFile, Charset.forName("GBK"));
+        for(Enumeration entries = zip.entries(); entries.hasMoreElements();)
+        {
+            ZipEntry entry = (ZipEntry)entries.nextElement();
+            String zipEntryName = entry.getName();
+            InputStream in = zip.getInputStream(entry);
+            String outPath = (descDir+zipEntryName).replaceAll("\\*", "/");;
+            //判断路径是否存在,不存在则创建文件路径
+            File file = new File(outPath.substring(0, outPath.lastIndexOf('/')));
+            if(!file.exists())
+            {
+                file.mkdirs();
+            }
+            //判断文件全路径是否为文件夹,如果是上面已经上传,不需要解压
+            if(new File(outPath).isDirectory())
+            {
+                continue;
+            }
+            //输出文件路径信息
+            System.out.println(outPath);
+            OutputStream out = new FileOutputStream(outPath);
+            byte[] buf1 = new byte[1024];
+            int len;
+            while((len=in.read(buf1))>0)
+            {
+                out.write(buf1,0,len);
+            }
+            in.close();
+            out.close();
+        }
+        System.out.println("******************解压完毕********************");
+    }
+
+    //MultipartFile 转 File
+    public static File multipartFileToFile(MultipartFile multipartFile){
+
+        // 获取文件名
+        String fileName = multipartFile.getOriginalFilename();
+        // 获取文件后缀
+        String prefix=fileName.substring(fileName.lastIndexOf("."));
+
+        File excelFile = null;
+
+        try {
+            // 用时间作为文件名,防止生成的临时文件重复
+            excelFile = File.createTempFile(UUID.randomUUID().toString(), prefix);
+            multipartFile.transferTo(excelFile);
+        }catch (Exception e){
+//            log.error("==========={}文件=================转换异常", fileName);
+            e.printStackTrace();
+        }
+        return excelFile;
+    }
+
+
+    /**
+     * File文件转String
+     * @param file
+     * @return
+     * @throws IOException
+     */
+    public static String file2String(final File file) throws IOException {
+        if (file.exists()) {
+            byte[] data = new byte[(int) file.length()];
+            boolean result;
+            FileInputStream inputStream = null;
+            try {
+                inputStream = new FileInputStream(file);
+                int len = inputStream.read(data);
+                result = len == data.length;
+            } finally {
+                if (inputStream != null) {
+                    inputStream.close();
+                }
+            }
+            if (result) {
+                return new String(data);
+            }
+        }
+        return null;
+    }
+
+
+
+    public static void main(String[] args) throws IOException {
+        /**
+         * 解压文件
+         */
+        File zipFile = new File("F:/exercise/扫描文件/已完成练习册扫描20201010.zip");
+        String path = "F:/exercise/扫描文件/111/";
+        unZipFiles(zipFile, path);
+    }
+
+
+
+
+}

+ 90 - 0
src/main/java/com/aijia/peixun/utils/httpClient.java

@@ -0,0 +1,90 @@
+package com.aijia.peixun.utils;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import org.apache.http.Consts;
+import org.apache.http.HttpEntity;
+import org.apache.http.NameValuePair;
+import org.apache.http.client.entity.UrlEncodedFormEntity;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.message.BasicNameValuePair;
+import org.apache.http.util.EntityUtils;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.*;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ *  与KMT通信链接,发数据端
+ */
+
+public class httpClient extends HttpServlet {
+
+    final static String uploadeFile = "上传文件";
+    final static String downLodeFile = "获取文件";
+    final static String doExsercise = "做练习题";
+    final static String checkeExsercise = "考评打分";
+    final static String getResult = "获取考试成绩";
+
+
+//  1. 发送Http请求,发送文件
+   public String doGet(HttpServletRequest request, HttpServletResponse response,String data)throws ServletException,IOException{
+       String tline=null;
+       try {
+           request.setCharacterEncoding("UTF-8");
+           response.setContentType("text/html;charset=utf-8");
+           System.out.println("兼职培训系统开始发送数据给Kmt");
+           //设置链接kmt项目的servlet的Url
+           String http = "http://localhost:3901/aijia-kmt/KmtAndPeixunHttpConectGet";
+           URL url = new URL(http);
+           HttpURLConnection httpURLConnection = (HttpURLConnection)url.openConnection();
+           httpURLConnection.setDoOutput(true);
+           httpURLConnection.setRequestMethod("POST");
+           httpURLConnection.setConnectTimeout(30000);
+           OutputStreamWriter writer = new OutputStreamWriter(httpURLConnection.getOutputStream(),"utf-8");
+           //写入文件数据
+           writer.write(data);
+           writer.flush();
+           writer.close();
+           int responseCode = httpURLConnection.getResponseCode();
+           //表示请求成功
+           if(responseCode==HttpURLConnection.HTTP_OK){
+               System.out.println("OK"+responseCode);
+               //获得服务端的输出流,得到返回的数据
+               InputStream urlstream=httpURLConnection.getInputStream();
+               BufferedReader reader=new BufferedReader(new InputStreamReader(urlstream));
+               String line;
+//               String tline="";
+               while((line=reader.readLine())!=null){
+                   tline+=line;
+               }
+               //输出所有的数据
+               System.out.println(tline);
+           }else{
+               System.out.println("ERR"+responseCode);
+           }
+
+       }catch (Exception e){
+           e.printStackTrace();
+       }
+       return tline;
+   }
+
+    public void doPost(HttpServletRequest request, HttpServletResponse response,String data)
+            throws ServletException, IOException {
+        this.doGet(request, response, data);
+
+    }
+
+}

+ 40 - 0
src/main/java/com/aijia/peixun/utils/httpClientGet.java

@@ -0,0 +1,40 @@
+package com.aijia.peixun.utils;
+
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+// 与kmt链接,接受http数据端
+
+public class httpClientGet extends HttpServlet {
+
+    public void doGet(HttpServletRequest request, HttpServletResponse response)
+            throws ServletException, IOException {
+        request.setCharacterEncoding("utf-8");
+        response.setContentType("text/html;charset=utf-8");
+        System.out.println("test2");
+        System.out.println(request.getParameter("username"));
+        System.out.println(request.getParameter("password"));
+        //获得发送HTTP请求的参数
+        String username=request.getParameter("username");
+        String password=request.getParameter("password");
+        //向HTTP发送方返回响应数据
+        if("123".equals(username)&&"456".equals(password)){
+            response.getWriter().write("{\"falg\":\"success\"}");
+        }else{
+            response.getWriter().write("{\"falg\":\"error\"}");
+        }
+    }
+
+
+    public void doPost(HttpServletRequest request, HttpServletResponse response)
+            throws ServletException, IOException {
+        this.doGet(request, response);
+    }
+
+
+
+}

+ 141 - 0
src/main/java/com/aijia/peixun/vo/MultipartFileParam.java

@@ -0,0 +1,141 @@
+package com.aijia.peixun.vo;
+
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.Serializable;
+
+public class MultipartFileParam implements Serializable {
+
+    private static final long serialVersionUID = -5802485240718558864L;
+    // 用户id
+    private String uid;
+    //任务ID
+    private String id;
+    //总分片数量
+    private int chunks;
+    //当前为第几块分片
+    private int chunk;
+    //当前分片大小
+    private long size = 0L;
+    //文件名
+    private String name;
+    //分片对象
+    private MultipartFile file;
+    // MD5
+    private String md5;
+
+    private Integer filetype;
+
+    private String username;
+
+    //用户类型
+    private String typeofjob;
+
+    public String getUid() {
+        return uid;
+    }
+
+    public void setUid(String uid) {
+        this.uid = uid;
+    }
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public int getChunks() {
+        return chunks;
+    }
+
+    public void setChunks(int chunks) {
+        this.chunks = chunks;
+    }
+
+    public int getChunk() {
+        return chunk;
+    }
+
+    public void setChunk(int chunk) {
+        this.chunk = chunk;
+    }
+
+    public long getSize() {
+        return size;
+    }
+
+    public void setSize(long size) {
+        this.size = size;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public MultipartFile getFile() {
+        return file;
+    }
+
+    public void setFile(MultipartFile file) {
+        this.file = file;
+    }
+
+    public String getMd5() {
+        return md5;
+    }
+
+    public void setMd5(String md5) {
+        this.md5 = md5;
+    }
+
+
+    public String gettypeofjob() {
+        return typeofjob;
+    }
+    public void settypeofjob(String typeofjob) {
+        this.typeofjob = typeofjob;
+    }
+
+
+    public Integer getfiletype() {
+        return filetype;
+    }
+
+    public void setfiletype(Integer filetype) {
+        this.filetype = filetype;
+    }
+
+
+    public String getusername() {
+        return username;
+    }
+
+    public void setusername(String username) {
+        this.username = username;
+    }
+
+
+
+
+    @Override
+    public String toString() {
+        return "MultipartFileParam{" +
+                "uid='" + uid + '\'' +
+                ", id='" + id + '\'' +
+                ", chunks=" + chunks +
+                ", chunk=" + chunk +
+                ", size=" + size +
+                ", name='" + name + '\'' +
+                ", file=" + file +
+                ", md5='" + md5 + '\'' +
+                '}';
+    }
+
+}

+ 89 - 0
src/main/java/com/aijia/peixun/vo/UserVo.java

@@ -0,0 +1,89 @@
+package com.aijia.peixun.vo;
+
+
+public class UserVo {
+
+    private String UserName;
+    private String telephoneNo;
+    private String email;
+    private String correctingsub;
+    private String typeofjob;
+    private String createtime;
+    private String area;
+    private String typeofuser;
+
+    private void setUserName(String UserName){
+        this.UserName=UserName;
+    }
+
+    private String getUserName(){
+        return UserName;
+    }
+
+    private void settelephoneNo(String telephoneNo){
+        this.telephoneNo=telephoneNo;
+    }
+
+    private String gettelephoneNo(){
+        return telephoneNo;
+    }
+
+    private void setemail(String telephoneNo){
+        this.email=email;
+    }
+
+    private String getemail(){
+        return email;
+    }
+
+    private void setcorrectingsub(String correctingsub){
+        this.correctingsub=correctingsub;
+    }
+
+    private String getcorrectingsub(){
+        return correctingsub;
+    }
+
+    private void settypeofjob(String typeofjob){
+        this.typeofjob=typeofjob;
+    }
+
+    private String gettypeofjob(){
+        return typeofjob;
+    }
+
+    private void setcreatetime(String createtime){
+        this.createtime=createtime;
+    }
+
+    private String getcreatetime(){
+        return createtime;
+    }
+
+    private void setarea(String area){
+        this.area=area;
+    }
+
+    private String getarea(){
+        return area;
+    }
+
+    private void settypeofuser(String typeofuser){
+        this.typeofuser=typeofuser;
+    }
+
+    private String gettypeofuser(){
+        return typeofuser;
+    }
+
+
+
+
+
+
+
+
+
+
+
+}

+ 27 - 0
src/main/resources/application.yml

@@ -0,0 +1,27 @@
+spring:
+  datasource:
+    url: jdbc:mysql://8.135.141.120:9906/aijia?useSSL=false
+    username: root
+    password: ZnjyAi@629_db
+    driver-class-name: com.mysql.cj.jdbc.Driver
+  thymeleaf:
+    check-template: false
+    check-template-location: false
+  redis:
+    host: 47.119.147.170
+    port: 7000
+    password: aijia@78342
+    connect-timeout: 60000ms
+    jedis:
+      pool:
+        max-active: 200
+        max-wait: -1
+        max-idle: 10
+        min-idle: 0
+
+mybatis:
+  mapper-locations: classpath:mapper/*.xml
+  type-aliases-package: com.aijia.peixun.entity
+#  config-location:
+
+

+ 166 - 0
src/main/resources/mapper/FileMapper.xml

@@ -0,0 +1,166 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.aijia.peixun.dao.FileMapper">
+  <resultMap id="BaseResultMap" type="com.aijia.peixun.entity.File">
+    <constructor>
+      <idArg column="id" javaType="java.lang.Integer" jdbcType="INTEGER" />
+      <arg column="filename" javaType="java.lang.String" jdbcType="VARCHAR" />
+      <arg column="filetype" javaType="java.lang.Integer" jdbcType="INTEGER" />
+      <arg column="uploadetime" javaType="java.lang.String" jdbcType="VARCHAR" />
+      <arg column="uploadeuser" javaType="java.lang.String" jdbcType="VARCHAR" />
+      <arg column="filestate" javaType="java.lang.Integer" jdbcType="INTEGER" />
+      <arg column="backup1" javaType="java.lang.String" jdbcType="VARCHAR" />
+      <arg column="backup2" javaType="java.lang.String" jdbcType="VARCHAR" />
+      <arg column="backup3" javaType="java.lang.String" jdbcType="VARCHAR" />
+      <arg column="backup4" javaType="java.lang.String" jdbcType="VARCHAR" />
+      <arg column="backup5" javaType="java.lang.String" jdbcType="VARCHAR" />
+    </constructor>
+  </resultMap>
+  <sql id="Base_Column_List">
+    id, filename, filetype, uploadetime, uploadeuser, filestate, backup1, backup2, backup3, 
+    backup4, backup5
+  </sql>
+  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
+    select 
+    <include refid="Base_Column_List" />
+    from jianzhi_peixun_file
+    where id = #{id,jdbcType=INTEGER}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
+    delete from jianzhi_peixun_file
+    where id = #{id,jdbcType=INTEGER}
+  </delete>
+  <insert id="insert" parameterType="com.aijia.peixun.entity.File">
+    insert into jianzhi_peixun_file (id, filename, filetype, 
+      uploadetime, uploadeuser, filestate, 
+      backup1, backup2, backup3, 
+      backup4, backup5)
+    values (#{id,jdbcType=INTEGER}, #{filename,jdbcType=VARCHAR}, #{filetype,jdbcType=INTEGER}, 
+      #{uploadetime,jdbcType=VARCHAR}, #{uploadeuser,jdbcType=VARCHAR}, #{filestate,jdbcType=INTEGER}, 
+      #{backup1,jdbcType=VARCHAR}, #{backup2,jdbcType=VARCHAR}, #{backup3,jdbcType=VARCHAR}, 
+      #{backup4,jdbcType=VARCHAR}, #{backup5,jdbcType=VARCHAR})
+  </insert>
+  <insert id="insertSelective" parameterType="com.aijia.peixun.entity.File">
+    insert into jianzhi_peixun_file
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="id != null">
+        id,
+      </if>
+      <if test="filename != null">
+        filename,
+      </if>
+      <if test="filetype != null">
+        filetype,
+      </if>
+      <if test="uploadetime != null">
+        uploadetime,
+      </if>
+      <if test="uploadeuser != null">
+        uploadeuser,
+      </if>
+      <if test="filestate != null">
+        filestate,
+      </if>
+      <if test="backup1 != null">
+        backup1,
+      </if>
+      <if test="backup2 != null">
+        backup2,
+      </if>
+      <if test="backup3 != null">
+        backup3,
+      </if>
+      <if test="backup4 != null">
+        backup4,
+      </if>
+      <if test="backup5 != null">
+        backup5,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="id != null">
+        #{id,jdbcType=INTEGER},
+      </if>
+      <if test="filename != null">
+        #{filename,jdbcType=VARCHAR},
+      </if>
+      <if test="filetype != null">
+        #{filetype,jdbcType=INTEGER},
+      </if>
+      <if test="uploadetime != null">
+        #{uploadetime,jdbcType=VARCHAR},
+      </if>
+      <if test="uploadeuser != null">
+        #{uploadeuser,jdbcType=VARCHAR},
+      </if>
+      <if test="filestate != null">
+        #{filestate,jdbcType=INTEGER},
+      </if>
+      <if test="backup1 != null">
+        #{backup1,jdbcType=VARCHAR},
+      </if>
+      <if test="backup2 != null">
+        #{backup2,jdbcType=VARCHAR},
+      </if>
+      <if test="backup3 != null">
+        #{backup3,jdbcType=VARCHAR},
+      </if>
+      <if test="backup4 != null">
+        #{backup4,jdbcType=VARCHAR},
+      </if>
+      <if test="backup5 != null">
+        #{backup5,jdbcType=VARCHAR},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKeySelective" parameterType="com.aijia.peixun.entity.File">
+    update jianzhi_peixun_file
+    <set>
+      <if test="filename != null">
+        filename = #{filename,jdbcType=VARCHAR},
+      </if>
+      <if test="filetype != null">
+        filetype = #{filetype,jdbcType=INTEGER},
+      </if>
+      <if test="uploadetime != null">
+        uploadetime = #{uploadetime,jdbcType=VARCHAR},
+      </if>
+      <if test="uploadeuser != null">
+        uploadeuser = #{uploadeuser,jdbcType=VARCHAR},
+      </if>
+      <if test="filestate != null">
+        filestate = #{filestate,jdbcType=INTEGER},
+      </if>
+      <if test="backup1 != null">
+        backup1 = #{backup1,jdbcType=VARCHAR},
+      </if>
+      <if test="backup2 != null">
+        backup2 = #{backup2,jdbcType=VARCHAR},
+      </if>
+      <if test="backup3 != null">
+        backup3 = #{backup3,jdbcType=VARCHAR},
+      </if>
+      <if test="backup4 != null">
+        backup4 = #{backup4,jdbcType=VARCHAR},
+      </if>
+      <if test="backup5 != null">
+        backup5 = #{backup5,jdbcType=VARCHAR},
+      </if>
+    </set>
+    where id = #{id,jdbcType=INTEGER}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.aijia.peixun.entity.File">
+    update jianzhi_peixun_file
+    set filename = #{filename,jdbcType=VARCHAR},
+      filetype = #{filetype,jdbcType=INTEGER},
+      uploadetime = #{uploadetime,jdbcType=VARCHAR},
+      uploadeuser = #{uploadeuser,jdbcType=VARCHAR},
+      filestate = #{filestate,jdbcType=INTEGER},
+      backup1 = #{backup1,jdbcType=VARCHAR},
+      backup2 = #{backup2,jdbcType=VARCHAR},
+      backup3 = #{backup3,jdbcType=VARCHAR},
+      backup4 = #{backup4,jdbcType=VARCHAR},
+      backup5 = #{backup5,jdbcType=VARCHAR}
+    where id = #{id,jdbcType=INTEGER}
+  </update>
+</mapper>

+ 260 - 0
src/main/resources/mapper/UserMapper.xml

@@ -0,0 +1,260 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.aijia.peixun.dao.UserMapper">
+  <resultMap id="BaseResultMap" type="com.aijia.peixun.entity.User">
+    <constructor>
+      <idArg column="id" javaType="java.lang.Integer" jdbcType="INTEGER" />
+      <arg column="name" javaType="java.lang.String" jdbcType="VARCHAR" />
+      <arg column="telephoneNo" javaType="java.lang.String" jdbcType="VARCHAR" />
+      <arg column="email" javaType="java.lang.String" jdbcType="VARCHAR" />
+      <arg column="sex" javaType="java.lang.String" jdbcType="VARCHAR" />
+      <arg column="age" javaType="java.lang.String" jdbcType="VARCHAR" />
+      <arg column="correctingsub" javaType="java.lang.String" jdbcType="VARCHAR" />
+      <arg column="typeofjob" javaType="java.lang.Integer" jdbcType="INTEGER" />
+      <arg column="createtime" javaType="java.util.Date" jdbcType="TIMESTAMP" />
+      <arg column="userstate" javaType="java.lang.Integer" jdbcType="INTEGER" />
+      <arg column="area" javaType="java.lang.String" jdbcType="VARCHAR" />
+      <arg column="typeofuser" javaType="java.lang.Integer" jdbcType="INTEGER" />
+      <arg column="examinetime" javaType="java.util.Date" jdbcType="TIMESTAMP" />
+      <arg column="examinenum" javaType="java.lang.Integer" jdbcType="INTEGER" />
+      <arg column="backup1" javaType="java.lang.String" jdbcType="VARCHAR" />
+      <arg column="backup2" javaType="java.lang.String" jdbcType="VARCHAR" />
+      <arg column="backup3" javaType="java.lang.String" jdbcType="VARCHAR" />
+      <arg column="backup4" javaType="java.lang.String" jdbcType="VARCHAR" />
+      <arg column="backup5" javaType="java.lang.String" jdbcType="VARCHAR" />
+    </constructor>
+  </resultMap>
+  <sql id="Base_Column_List">
+    id, name, telephoneNo, email, sex, age, correctingsub, typeofjob, createtime, userstate, 
+    area, typeofuser, examinetime, examinenum, backup1, backup2, backup3, backup4, backup5
+  </sql>
+  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
+    select 
+    <include refid="Base_Column_List" />
+    from jianzhi_peixun_user
+    where id = #{id,jdbcType=INTEGER}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
+    delete from jianzhi_peixun_user
+    where id = #{id,jdbcType=INTEGER}
+  </delete>
+  <insert id="insert" parameterType="com.aijia.peixun.entity.User">
+    insert into jianzhi_peixun_user (id, name, telephoneNo, 
+      email, sex, age, correctingsub, 
+      typeofjob, createtime, userstate, 
+      area, typeofuser, examinetime, 
+      examinenum, backup1, backup2, 
+      backup3, backup4, backup5
+      )
+    values (#{id,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, #{telephoneno,jdbcType=VARCHAR}, 
+      #{email,jdbcType=VARCHAR}, #{sex,jdbcType=VARCHAR}, #{age,jdbcType=VARCHAR}, #{correctingsub,jdbcType=VARCHAR}, 
+      #{typeofjob,jdbcType=INTEGER}, #{createtime,jdbcType=TIMESTAMP}, #{userstate,jdbcType=INTEGER}, 
+      #{area,jdbcType=VARCHAR}, #{typeofuser,jdbcType=INTEGER}, #{examinetime,jdbcType=TIMESTAMP}, 
+      #{examinenum,jdbcType=INTEGER}, #{backup1,jdbcType=VARCHAR}, #{backup2,jdbcType=VARCHAR}, 
+      #{backup3,jdbcType=VARCHAR}, #{backup4,jdbcType=VARCHAR}, #{backup5,jdbcType=VARCHAR}
+      )
+  </insert>
+  <insert id="insertSelective" parameterType="com.aijia.peixun.entity.User">
+    insert into jianzhi_peixun_user
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="id != null">
+        id,
+      </if>
+      <if test="name != null">
+        name,
+      </if>
+      <if test="telephoneno != null">
+        telephoneNo,
+      </if>
+      <if test="email != null">
+        email,
+      </if>
+      <if test="sex != null">
+        sex,
+      </if>
+      <if test="age != null">
+        age,
+      </if>
+      <if test="correctingsub != null">
+        correctingsub,
+      </if>
+      <if test="typeofjob != null">
+        typeofjob,
+      </if>
+      <if test="createtime != null">
+        createtime,
+      </if>
+      <if test="userstate != null">
+        userstate,
+      </if>
+      <if test="area != null">
+        area,
+      </if>
+      <if test="typeofuser != null">
+        typeofuser,
+      </if>
+      <if test="examinetime != null">
+        examinetime,
+      </if>
+      <if test="examinenum != null">
+        examinenum,
+      </if>
+      <if test="backup1 != null">
+        backup1,
+      </if>
+      <if test="backup2 != null">
+        backup2,
+      </if>
+      <if test="backup3 != null">
+        backup3,
+      </if>
+      <if test="backup4 != null">
+        backup4,
+      </if>
+      <if test="backup5 != null">
+        backup5,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="id != null">
+        #{id,jdbcType=INTEGER},
+      </if>
+      <if test="name != null">
+        #{name,jdbcType=VARCHAR},
+      </if>
+      <if test="telephoneno != null">
+        #{telephoneno,jdbcType=VARCHAR},
+      </if>
+      <if test="email != null">
+        #{email,jdbcType=VARCHAR},
+      </if>
+      <if test="sex != null">
+        #{sex,jdbcType=VARCHAR},
+      </if>
+      <if test="age != null">
+        #{age,jdbcType=VARCHAR},
+      </if>
+      <if test="correctingsub != null">
+        #{correctingsub,jdbcType=VARCHAR},
+      </if>
+      <if test="typeofjob != null">
+        #{typeofjob,jdbcType=INTEGER},
+      </if>
+      <if test="createtime != null">
+        #{createtime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="userstate != null">
+        #{userstate,jdbcType=INTEGER},
+      </if>
+      <if test="area != null">
+        #{area,jdbcType=VARCHAR},
+      </if>
+      <if test="typeofuser != null">
+        #{typeofuser,jdbcType=INTEGER},
+      </if>
+      <if test="examinetime != null">
+        #{examinetime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="examinenum != null">
+        #{examinenum,jdbcType=INTEGER},
+      </if>
+      <if test="backup1 != null">
+        #{backup1,jdbcType=VARCHAR},
+      </if>
+      <if test="backup2 != null">
+        #{backup2,jdbcType=VARCHAR},
+      </if>
+      <if test="backup3 != null">
+        #{backup3,jdbcType=VARCHAR},
+      </if>
+      <if test="backup4 != null">
+        #{backup4,jdbcType=VARCHAR},
+      </if>
+      <if test="backup5 != null">
+        #{backup5,jdbcType=VARCHAR},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKeySelective" parameterType="com.aijia.peixun.entity.User">
+    update jianzhi_peixun_user
+    <set>
+      <if test="name != null">
+        name = #{name,jdbcType=VARCHAR},
+      </if>
+      <if test="telephoneno != null">
+        telephoneNo = #{telephoneno,jdbcType=VARCHAR},
+      </if>
+      <if test="email != null">
+        email = #{email,jdbcType=VARCHAR},
+      </if>
+      <if test="sex != null">
+        sex = #{sex,jdbcType=VARCHAR},
+      </if>
+      <if test="age != null">
+        age = #{age,jdbcType=VARCHAR},
+      </if>
+      <if test="correctingsub != null">
+        correctingsub = #{correctingsub,jdbcType=VARCHAR},
+      </if>
+      <if test="typeofjob != null">
+        typeofjob = #{typeofjob,jdbcType=INTEGER},
+      </if>
+      <if test="createtime != null">
+        createtime = #{createtime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="userstate != null">
+        userstate = #{userstate,jdbcType=INTEGER},
+      </if>
+      <if test="area != null">
+        area = #{area,jdbcType=VARCHAR},
+      </if>
+      <if test="typeofuser != null">
+        typeofuser = #{typeofuser,jdbcType=INTEGER},
+      </if>
+      <if test="examinetime != null">
+        examinetime = #{examinetime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="examinenum != null">
+        examinenum = #{examinenum,jdbcType=INTEGER},
+      </if>
+      <if test="backup1 != null">
+        backup1 = #{backup1,jdbcType=VARCHAR},
+      </if>
+      <if test="backup2 != null">
+        backup2 = #{backup2,jdbcType=VARCHAR},
+      </if>
+      <if test="backup3 != null">
+        backup3 = #{backup3,jdbcType=VARCHAR},
+      </if>
+      <if test="backup4 != null">
+        backup4 = #{backup4,jdbcType=VARCHAR},
+      </if>
+      <if test="backup5 != null">
+        backup5 = #{backup5,jdbcType=VARCHAR},
+      </if>
+    </set>
+    where id = #{id,jdbcType=INTEGER}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.aijia.peixun.entity.User">
+    update jianzhi_peixun_user
+    set name = #{name,jdbcType=VARCHAR},
+      telephoneNo = #{telephoneno,jdbcType=VARCHAR},
+      email = #{email,jdbcType=VARCHAR},
+      sex = #{sex,jdbcType=VARCHAR},
+      age = #{age,jdbcType=VARCHAR},
+      correctingsub = #{correctingsub,jdbcType=VARCHAR},
+      typeofjob = #{typeofjob,jdbcType=INTEGER},
+      createtime = #{createtime,jdbcType=TIMESTAMP},
+      userstate = #{userstate,jdbcType=INTEGER},
+      area = #{area,jdbcType=VARCHAR},
+      typeofuser = #{typeofuser,jdbcType=INTEGER},
+      examinetime = #{examinetime,jdbcType=TIMESTAMP},
+      examinenum = #{examinenum,jdbcType=INTEGER},
+      backup1 = #{backup1,jdbcType=VARCHAR},
+      backup2 = #{backup2,jdbcType=VARCHAR},
+      backup3 = #{backup3,jdbcType=VARCHAR},
+      backup4 = #{backup4,jdbcType=VARCHAR},
+      backup5 = #{backup5,jdbcType=VARCHAR}
+    where id = #{id,jdbcType=INTEGER}
+  </update>
+</mapper>

+ 203 - 0
src/main/resources/mapper/examinationMapper.xml

@@ -0,0 +1,203 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.aijia.peixun.dao.examinationMapper">
+  <resultMap id="BaseResultMap" type="com.aijia.peixun.entity.examination">
+    <constructor>
+      <idArg column="id" javaType="java.lang.String" jdbcType="CHAR" />
+      <arg column="user_id" javaType="java.lang.String" jdbcType="CHAR" />
+      <arg column="grade" javaType="java.lang.String" jdbcType="VARCHAR" />
+      <arg column="subject" javaType="java.lang.String" jdbcType="VARCHAR" />
+      <arg column="version" javaType="java.lang.Byte" jdbcType="TINYINT" />
+      <arg column="name" javaType="java.lang.String" jdbcType="VARCHAR" />
+      <arg column="pdf_without_answer_url" javaType="java.lang.String" jdbcType="VARCHAR" />
+      <arg column="pdf_with_answer_url" javaType="java.lang.String" jdbcType="VARCHAR" />
+      <arg column="status" javaType="java.lang.Byte" jdbcType="TINYINT" />
+      <arg column="description" javaType="java.lang.String" jdbcType="VARCHAR" />
+      <arg column="answer_time" javaType="java.lang.Byte" jdbcType="TINYINT" />
+      <arg column="deleted" javaType="java.lang.Boolean" jdbcType="BIT" />
+      <arg column="update_time" javaType="java.util.Date" jdbcType="TIMESTAMP" />
+      <arg column="create_time" javaType="java.util.Date" jdbcType="TIMESTAMP" />
+    </constructor>
+  </resultMap>
+  <sql id="Base_Column_List">
+    id, user_id, grade, subject, version, name, pdf_without_answer_url, pdf_with_answer_url, 
+    status, description, answer_time, deleted, update_time, create_time
+  </sql>
+  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
+    select 
+    <include refid="Base_Column_List" />
+    from tb_examination_paper
+    where id = #{id,jdbcType=CHAR}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
+    delete from tb_examination_paper
+    where id = #{id,jdbcType=CHAR}
+  </delete>
+  <insert id="insert" parameterType="com.aijia.peixun.entity.examination">
+    insert into tb_examination_paper (id, user_id, grade, 
+      subject, version, name, 
+      pdf_without_answer_url, pdf_with_answer_url, 
+      status, description, answer_time, 
+      deleted, update_time, create_time
+      )
+    values (#{id,jdbcType=CHAR}, #{userId,jdbcType=CHAR}, #{grade,jdbcType=VARCHAR}, 
+      #{subject,jdbcType=VARCHAR}, #{version,jdbcType=TINYINT}, #{name,jdbcType=VARCHAR}, 
+      #{pdfWithoutAnswerUrl,jdbcType=VARCHAR}, #{pdfWithAnswerUrl,jdbcType=VARCHAR}, 
+      #{status,jdbcType=TINYINT}, #{description,jdbcType=VARCHAR}, #{answerTime,jdbcType=TINYINT}, 
+      #{deleted,jdbcType=BIT}, #{updateTime,jdbcType=TIMESTAMP}, #{createTime,jdbcType=TIMESTAMP}
+      )
+  </insert>
+  <insert id="insertSelective" parameterType="com.aijia.peixun.entity.examination">
+    insert into tb_examination_paper
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="id != null">
+        id,
+      </if>
+      <if test="userId != null">
+        user_id,
+      </if>
+      <if test="grade != null">
+        grade,
+      </if>
+      <if test="subject != null">
+        subject,
+      </if>
+      <if test="version != null">
+        version,
+      </if>
+      <if test="name != null">
+        name,
+      </if>
+      <if test="pdfWithoutAnswerUrl != null">
+        pdf_without_answer_url,
+      </if>
+      <if test="pdfWithAnswerUrl != null">
+        pdf_with_answer_url,
+      </if>
+      <if test="status != null">
+        status,
+      </if>
+      <if test="description != null">
+        description,
+      </if>
+      <if test="answerTime != null">
+        answer_time,
+      </if>
+      <if test="deleted != null">
+        deleted,
+      </if>
+      <if test="updateTime != null">
+        update_time,
+      </if>
+      <if test="createTime != null">
+        create_time,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="id != null">
+        #{id,jdbcType=CHAR},
+      </if>
+      <if test="userId != null">
+        #{userId,jdbcType=CHAR},
+      </if>
+      <if test="grade != null">
+        #{grade,jdbcType=VARCHAR},
+      </if>
+      <if test="subject != null">
+        #{subject,jdbcType=VARCHAR},
+      </if>
+      <if test="version != null">
+        #{version,jdbcType=TINYINT},
+      </if>
+      <if test="name != null">
+        #{name,jdbcType=VARCHAR},
+      </if>
+      <if test="pdfWithoutAnswerUrl != null">
+        #{pdfWithoutAnswerUrl,jdbcType=VARCHAR},
+      </if>
+      <if test="pdfWithAnswerUrl != null">
+        #{pdfWithAnswerUrl,jdbcType=VARCHAR},
+      </if>
+      <if test="status != null">
+        #{status,jdbcType=TINYINT},
+      </if>
+      <if test="description != null">
+        #{description,jdbcType=VARCHAR},
+      </if>
+      <if test="answerTime != null">
+        #{answerTime,jdbcType=TINYINT},
+      </if>
+      <if test="deleted != null">
+        #{deleted,jdbcType=BIT},
+      </if>
+      <if test="updateTime != null">
+        #{updateTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="createTime != null">
+        #{createTime,jdbcType=TIMESTAMP},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKeySelective" parameterType="com.aijia.peixun.entity.examination">
+    update tb_examination_paper
+    <set>
+      <if test="userId != null">
+        user_id = #{userId,jdbcType=CHAR},
+      </if>
+      <if test="grade != null">
+        grade = #{grade,jdbcType=VARCHAR},
+      </if>
+      <if test="subject != null">
+        subject = #{subject,jdbcType=VARCHAR},
+      </if>
+      <if test="version != null">
+        version = #{version,jdbcType=TINYINT},
+      </if>
+      <if test="name != null">
+        name = #{name,jdbcType=VARCHAR},
+      </if>
+      <if test="pdfWithoutAnswerUrl != null">
+        pdf_without_answer_url = #{pdfWithoutAnswerUrl,jdbcType=VARCHAR},
+      </if>
+      <if test="pdfWithAnswerUrl != null">
+        pdf_with_answer_url = #{pdfWithAnswerUrl,jdbcType=VARCHAR},
+      </if>
+      <if test="status != null">
+        status = #{status,jdbcType=TINYINT},
+      </if>
+      <if test="description != null">
+        description = #{description,jdbcType=VARCHAR},
+      </if>
+      <if test="answerTime != null">
+        answer_time = #{answerTime,jdbcType=TINYINT},
+      </if>
+      <if test="deleted != null">
+        deleted = #{deleted,jdbcType=BIT},
+      </if>
+      <if test="updateTime != null">
+        update_time = #{updateTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="createTime != null">
+        create_time = #{createTime,jdbcType=TIMESTAMP},
+      </if>
+    </set>
+    where id = #{id,jdbcType=CHAR}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.aijia.peixun.entity.examination">
+    update tb_examination_paper
+    set user_id = #{userId,jdbcType=CHAR},
+      grade = #{grade,jdbcType=VARCHAR},
+      subject = #{subject,jdbcType=VARCHAR},
+      version = #{version,jdbcType=TINYINT},
+      name = #{name,jdbcType=VARCHAR},
+      pdf_without_answer_url = #{pdfWithoutAnswerUrl,jdbcType=VARCHAR},
+      pdf_with_answer_url = #{pdfWithAnswerUrl,jdbcType=VARCHAR},
+      status = #{status,jdbcType=TINYINT},
+      description = #{description,jdbcType=VARCHAR},
+      answer_time = #{answerTime,jdbcType=TINYINT},
+      deleted = #{deleted,jdbcType=BIT},
+      update_time = #{updateTime,jdbcType=TIMESTAMP},
+      create_time = #{createTime,jdbcType=TIMESTAMP}
+    where id = #{id,jdbcType=CHAR}
+  </update>
+</mapper>