huliguo
2025-04-30 ea9b12465c90fc72c40f3bd87c90785dfc2984e2
基础代码
73个文件已添加
3698 ■■■■■ 已修改文件
pom.xml 115 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/cl/CanLianScreenApplication.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/cl/common/constant/DelFlagConstant.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/cl/common/constant/JwtClaimsConstant.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/cl/common/constant/MessageConstant.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/cl/common/constant/StatusConstant.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/cl/common/context/BaseContext.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/cl/common/exception/BaseException.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/cl/common/exception/data/DataException.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/cl/common/exception/institution/InstitutionException.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/cl/common/exception/user/AddUserException.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/cl/common/exception/user/InterceptorException.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/cl/common/exception/user/LoginErrorException.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/cl/common/exception/user/UserException.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/cl/common/handler/GlobalExceptionHandler.java 82 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/cl/common/json/JacksonObjectMapper.java 51 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/cl/common/result/Result.java 46 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/cl/config/CorsConfig.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/cl/config/MybatisPlusConfig.java 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/cl/config/WebMvcConfiguration.java 121 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/cl/controller/DataController.java 97 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/cl/controller/InstitutionController.java 90 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/cl/controller/UserController.java 219 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/cl/interceptor/JwtTokenInterceptor.java 99 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/cl/mapper/DataMapper.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/cl/mapper/InstitutionMapper.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/cl/mapper/UserMapper.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/cl/pojo/dto/AddDataDTO.java 250 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/cl/pojo/dto/AddInstitutionDTO.java 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/cl/pojo/dto/AddUserDTO.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/cl/pojo/dto/EditInstitutionDTO.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/cl/pojo/dto/EditUserDTO.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/cl/pojo/dto/LoginDTO.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/cl/pojo/dto/PasswordDTO.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/cl/pojo/entity/DataEntity.java 263 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/cl/pojo/entity/Institution.java 46 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/cl/pojo/entity/User.java 53 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/cl/pojo/vo/DataDetailVO.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/cl/pojo/vo/DataRateVO.java 233 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/cl/pojo/vo/DataVO.java 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/cl/pojo/vo/EditDataDTO.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/cl/pojo/vo/InstitutionVO.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/cl/pojo/vo/UserVO.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/cl/pojo/vo/screen/AssistiveDeviceGradeVO.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/cl/pojo/vo/screen/AssistiveDeviceTypeVO.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/cl/pojo/vo/screen/AssistiveDeviceVO.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/cl/pojo/vo/screen/CertificateVO.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/cl/pojo/vo/screen/DifficultyVO.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/cl/pojo/vo/screen/DrillVO.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/cl/pojo/vo/screen/EducationVO.java 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/cl/pojo/vo/screen/EmployedVO.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/cl/pojo/vo/screen/HighSchoolVO.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/cl/pojo/vo/screen/RightDownVO.java 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/cl/pojo/vo/screen/SalvationVO.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/cl/pojo/vo/screen/ScreenVO.java 62 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/cl/pojo/vo/screen/StatutoryCertificateVO.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/cl/pojo/vo/screen/WorkerVO.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/cl/service/DataService.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/cl/service/InstitutionService.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/cl/service/UserService.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/cl/service/impl/DataServiceImpl.java 281 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/cl/service/impl/InstitutionServiceImpl.java 103 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/cl/service/impl/TokenBlacklistService.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/cl/service/impl/UserServiceImpl.java 146 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/cl/util/BCryptPasswordEncoder.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/cl/util/JwtUtil.java 69 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/cl/util/LoginAttempt.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/cl/util/LoginAttemptService.java 60 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/application.yml 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/DataMapper.xml 127 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/InstitutionMapper.xml 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/UserMapper.xml 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/test/java/DatabaseConnectionTest.java 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pom.xml
New file
@@ -0,0 +1,115 @@
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.cl</groupId>
    <artifactId>canlian_daping</artifactId>
    <version>1.0-SNAPSHOT</version>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.7.3</version> <!-- 可根据需要调整版本 -->
        <relativePath/>
    </parent>
    <properties>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <mybatis-plus.version>3.5.3.1</mybatis-plus.version>
        <swagger.version>3.0.0</swagger.version>
        <jjwt.version>0.9.1</jjwt.version>
    </properties>
    <dependencies>
        <!-- Spring Boot Starter Web -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <!-- MySQL Driver -->
        <dependency>
            <groupId>com.mysql</groupId>
            <artifactId>mysql-connector-j</artifactId>
            <version>8.2.0</version>
            <scope>runtime</scope>
        </dependency>
        <!-- MyBatis-Plus Starter -->
        <dependency>
            <groupId>com.baomidou</groupId>
            <artifactId>mybatis-plus-boot-starter</artifactId>
            <version>${mybatis-plus.version}</version>
        </dependency>
        <!-- Swagger 3 (OpenAPI) -->
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-boot-starter</artifactId>
            <version>${swagger.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springdoc</groupId>
            <artifactId>springdoc-openapi-ui</artifactId>
            <version>1.6.14</version>
        </dependency>
        <!-- Lombok (可选但推荐) -->
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <optional>true</optional>
        </dependency>
        <!-- JWT -->
        <dependency>
            <groupId>io.jsonwebtoken</groupId>
            <artifactId>jjwt</artifactId>
            <version>${jjwt.version}</version>
        </dependency>
        <!-- Spring Boot Test -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <!--BCrypt-->
        <dependency>
            <groupId>org.mindrot</groupId>
            <artifactId>jbcrypt</artifactId>
            <version>0.4</version>
        </dependency>
        <!-- Apache Commons Codec (MD5加密) -->
        <dependency>
            <groupId>commons-codec</groupId>
            <artifactId>commons-codec</artifactId>
            <version>1.15</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate.validator</groupId>
            <artifactId>hibernate-validator</artifactId>
            <version>6.2.5.Final</version>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <excludes>
                        <exclude>
                            <groupId>org.projectlombok</groupId>
                            <artifactId>lombok</artifactId>
                        </exclude>
                    </excludes>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
src/main/java/com/cl/CanLianScreenApplication.java
New file
@@ -0,0 +1,18 @@
package com.cl;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@EnableSwagger2
@SpringBootApplication
public class CanLianScreenApplication {
    public static void main(String[] args)
    {
        // System.setProperty("spring.devtools.restart.enabled", "false");
        SpringApplication.run(CanLianScreenApplication.class, args);
        System.out.println("(♥◠‿◠)ノ゙  启动成功   ლ(´ڡ`ლ)゙  \n");
    }
}
src/main/java/com/cl/common/constant/DelFlagConstant.java
New file
@@ -0,0 +1,10 @@
package com.cl.common.constant;
public class DelFlagConstant {
    //删除
    public static final Integer DELETE = 1;
    //未删除
    public static final Integer UNDELETE = 0;
}
src/main/java/com/cl/common/constant/JwtClaimsConstant.java
New file
@@ -0,0 +1,9 @@
package com.cl.common.constant;
public class JwtClaimsConstant {
    public static final String USER_PHONE = "phone";
    public static final String USER_ID = "id";
}
src/main/java/com/cl/common/constant/MessageConstant.java
New file
@@ -0,0 +1,26 @@
package com.cl.common.constant;
/**
 * 信息提示常量类
 */
public class MessageConstant {
    public static final String PASSWORD_ERROR = "密码错误";
    public static final String PHONE_NOT_FOUND = "手机号不存在";
    public static final String ACCOUNT_LOCKED = "账号被锁定";
    public static final String PHONE_REPEAT="手机号重复";
    public static final String VERIFICATION_CODE_ERROR="验证码错误";
    public static final String PASSWORD_INCONSISTENCY="两次密码不一致";
    public static final String ALREADY_EXISTS="已存在";
    public static final String UNKNOWN_ERROR = "未知错误";
    public static final String QUESTION_ID_NOT_FOUNT="该问题未找到答案";
    public static final String USER_NOT_LOGIN = "用户未登录";
    public static final String TOKEN_EXPIRED = "token过期";
}
src/main/java/com/cl/common/constant/StatusConstant.java
New file
@@ -0,0 +1,13 @@
package com.cl.common.constant;
/**
 * 状态常量,启用或者禁用
 */
public class StatusConstant {
    //启用
    public static final Integer ENABLE = 0;
    //禁用
    public static final Integer DISABLE = 1;
}
src/main/java/com/cl/common/context/BaseContext.java
New file
@@ -0,0 +1,22 @@
package com.cl.common.context;
import com.cl.pojo.entity.User;
import java.util.Map;
public class BaseContext {
    public static ThreadLocal<User> threadLocal = new ThreadLocal<>();
    public static void setCurrentUser(User user) {
        threadLocal.set(user);
    }
    public static User getCurrentUser() {
        return threadLocal.get();
    }
    public static void removeCurrentPhone() {
        threadLocal.remove();
    }
}
src/main/java/com/cl/common/exception/BaseException.java
New file
@@ -0,0 +1,15 @@
package com.cl.common.exception;
/**
 * 业务异常
 */
public class BaseException extends RuntimeException {
    public BaseException() {
    }
    public BaseException(String msg) {
        super(msg);
    }
}
src/main/java/com/cl/common/exception/data/DataException.java
New file
@@ -0,0 +1,11 @@
package com.cl.common.exception.data;
import com.cl.common.exception.BaseException;
public class DataException extends BaseException {
    public DataException() {}
    public DataException(String message) {
        super(message);
    }
}
src/main/java/com/cl/common/exception/institution/InstitutionException.java
New file
@@ -0,0 +1,10 @@
package com.cl.common.exception.institution;
import com.cl.common.exception.BaseException;
public class InstitutionException extends BaseException {
    public InstitutionException(String message) {
        super(message);
    }
    public InstitutionException() {}
}
src/main/java/com/cl/common/exception/user/AddUserException.java
New file
@@ -0,0 +1,10 @@
package com.cl.common.exception.user;
import com.cl.common.exception.BaseException;
public class AddUserException extends BaseException {
    public AddUserException(String message) {
        super(message);
    }
    public AddUserException(){}
}
src/main/java/com/cl/common/exception/user/InterceptorException.java
New file
@@ -0,0 +1,10 @@
package com.cl.common.exception.user;
import com.cl.common.exception.BaseException;
public class InterceptorException extends BaseException {
    public InterceptorException(String msg) {
        super(msg);
    }
    public InterceptorException() {}
}
src/main/java/com/cl/common/exception/user/LoginErrorException.java
New file
@@ -0,0 +1,13 @@
package com.cl.common.exception.user;
import com.cl.common.exception.BaseException;
/**
 * 登录失败
 */
public class LoginErrorException extends BaseException {
    public LoginErrorException(){}
    public LoginErrorException(String msg){
        super(msg);
    }
}
src/main/java/com/cl/common/exception/user/UserException.java
New file
@@ -0,0 +1,10 @@
package com.cl.common.exception.user;
import com.cl.common.exception.BaseException;
public class UserException extends BaseException {
    public UserException(String message) {
        super(message);
    }
    public UserException(){}
}
src/main/java/com/cl/common/handler/GlobalExceptionHandler.java
New file
@@ -0,0 +1,82 @@
package com.cl.common.handler;
import com.cl.common.constant.MessageConstant;
import com.cl.common.exception.BaseException;
import com.cl.common.result.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.ObjectError;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import java.sql.SQLIntegrityConstraintViolationException;
/**
 * 全局异常处理器,处理项目中抛出的业务异常
 */
@RestControllerAdvice
@Slf4j
public class GlobalExceptionHandler {
    /**
     * 捕获业务异常
     * @param ex
     * @return
     */
    @ExceptionHandler
    public Result exceptionHandler(BaseException ex){
        log.error("异常信息:{}", ex.getMessage());
        return Result.error(ex.getMessage());
    }
    /**
     * 数据校验异常
     * @param e
     * @return
     */
    @ExceptionHandler(value = MethodArgumentNotValidException.class)
    public Result errorHandler(MethodArgumentNotValidException e){
//        BindingResult bindingResult=exception.getBindingResult();
        String message="";
//        String message=bindingResult.getAllErrors().stream().map(DefaultMessageSourceResolvable::getDefaultMessage).collect(Collectors.joining());
//        for(ObjectError s:e.getAllErrors()){
//            message+=s.getDefaultMessage();
//            break;
//        }
        message= String.valueOf(e.getAllErrors().get(0).getDefaultMessage());
        log.info("数据校验错误:{}",message);
        return Result.error(message);
    }
    /**
     * 处理sql异常
     * @param ex
     * @return
     */
    @ExceptionHandler
    public Result exceptionHandler(SQLIntegrityConstraintViolationException ex){
        //Duplicate entry 'zhangsan' for key 'idx_username'
        String message = ex.getMessage();
        if (message.contains("Duplicate entry")){
            String[] split = message.split(" ");
            String username=split[2];
            String msg=username+ MessageConstant.ALREADY_EXISTS;
            return Result.error(msg);
        }else {
            log.error(message,ex);
            return Result.error(MessageConstant.UNKNOWN_ERROR);
        }
    }
}
src/main/java/com/cl/common/json/JacksonObjectMapper.java
New file
@@ -0,0 +1,51 @@
package com.cl.common.json;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.module.SimpleModule;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalTimeSerializer;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import static com.fasterxml.jackson.databind.DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES;
/**
 * 对象映射器:基于jackson将Java对象转为json,或者将json转为Java对象
 * 将JSON解析为Java对象的过程称为 [从JSON反序列化Java对象]
 * 从Java对象生成JSON的过程称为 [序列化Java对象到JSON]
 */
public class JacksonObjectMapper extends ObjectMapper {
    public static final String DEFAULT_DATE_FORMAT = "yyyy-MM-dd";
    //public static final String DEFAULT_DATE_TIME_FORMAT = "yyyy-MM-dd HH:mm:ss";
    public static final String DEFAULT_DATE_TIME_FORMAT = "yyyy-MM-dd HH:mm";
    public static final String DEFAULT_TIME_FORMAT = "HH:mm:ss";
    public JacksonObjectMapper() {
        super();
        //收到未知属性时不报异常
        this.configure(FAIL_ON_UNKNOWN_PROPERTIES, false);
        //反序列化时,属性不存在的兼容处理
        this.getDeserializationConfig().withoutFeatures(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
        SimpleModule simpleModule = new SimpleModule()
                .addDeserializer(LocalDateTime.class, new LocalDateTimeDeserializer(DateTimeFormatter.ofPattern(DEFAULT_DATE_TIME_FORMAT)))
                .addDeserializer(LocalDate.class, new LocalDateDeserializer(DateTimeFormatter.ofPattern(DEFAULT_DATE_FORMAT)))
                .addDeserializer(LocalTime.class, new LocalTimeDeserializer(DateTimeFormatter.ofPattern(DEFAULT_TIME_FORMAT)))
                .addSerializer(LocalDateTime.class, new LocalDateTimeSerializer(DateTimeFormatter.ofPattern(DEFAULT_DATE_TIME_FORMAT)))
                .addSerializer(LocalDate.class, new LocalDateSerializer(DateTimeFormatter.ofPattern(DEFAULT_DATE_FORMAT)))
                .addSerializer(LocalTime.class, new LocalTimeSerializer(DateTimeFormatter.ofPattern(DEFAULT_TIME_FORMAT)));
        //注册功能模块 例如,可以添加自定义序列化器和反序列化器
        this.registerModule(simpleModule);
    }
}
src/main/java/com/cl/common/result/Result.java
New file
@@ -0,0 +1,46 @@
package com.cl.common.result;
import lombok.Data;
import java.io.Serializable;
/**
 * 后端统一返回结果
 * @param <T>
 */
@Data
public class Result<T> implements Serializable {
    private Integer code; //编码:1成功,0和其它数字为失败
    private String message; //错误信息
    private T data; //数据
    public static <T> Result<T> success() {
        Result<T> result = new Result<T>();
        result.code = 200;
        return result;
    }
    public static <T> Result<T> success(T object) {
        Result<T> result = new Result<T>();
        result.data = object;
        result.code = 200;
        return result;
    }
    public static <T> Result<T> success(String message,T object) {
        Result<T> result = new Result<T>();
        result.data = object;
        result.message=message;
        result.code = 200;
        return result;
    }
    public static <T> Result<T> error(String msg) {
        Result result = new Result();
        result.message = msg;
        result.code = 500;
        return result;
    }
}
src/main/java/com/cl/config/CorsConfig.java
New file
@@ -0,0 +1,26 @@
package com.cl.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;
@Configuration
public class CorsConfig {
    // 当前跨域请求最大有效时长。这里默认1天
    private static final long MAX_AGE = 24 * 60 * 60;
    @Bean
    public CorsFilter corsFilter() {
        UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
        CorsConfiguration corsConfiguration = new CorsConfiguration();
        corsConfiguration.addAllowedOrigin("*"); // 1 设置访问源地址
        corsConfiguration.addAllowedHeader("*"); // 2 设置访问源请求头
        corsConfiguration.addAllowedMethod("*"); // 3 设置访问源请求方法
        corsConfiguration.setMaxAge(MAX_AGE);
        source.registerCorsConfiguration("/**", corsConfiguration); // 4 对接口配置跨域设置
        return new CorsFilter(source);
    }
}
src/main/java/com/cl/config/MybatisPlusConfig.java
New file
@@ -0,0 +1,28 @@
package com.cl.config;
import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionTemplate;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
@MapperScan("com.cl.mapper")
public class MybatisPlusConfig {
    /**
     * 添加分页插件
     */
    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor() {
        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
        interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));//如果配置多个插件,切记分页最后添加
        //interceptor.addInnerInterceptor(new PaginationInnerInterceptor()); 如果有多数据源可以不配具体类型 否则都建议配上具体的DbType
        return interceptor;
    }
}
src/main/java/com/cl/config/WebMvcConfiguration.java
New file
@@ -0,0 +1,121 @@
package com.cl.config;
import com.cl.common.json.JacksonObjectMapper;
import com.cl.interceptor.JwtTokenInterceptor;
import com.cl.util.LoginAttemptService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.ParameterBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.schema.ModelRef;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Parameter;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import java.util.ArrayList;
import java.util.List;
/**
 * 配置类,注册web层相关组件
 */
@Configuration
@Slf4j
public class WebMvcConfiguration extends WebMvcConfigurationSupport {
    @Autowired
    private JwtTokenInterceptor jwtTokenInterceptor;
    /**
     * 注册自定义拦截器
     *
     * @param registry
     */
    protected void addInterceptors(InterceptorRegistry registry) {
        log.info("开始注册自定义拦截器...");
        registry.addInterceptor(jwtTokenInterceptor)
                .addPathPatterns("/user/**","/data/**","/institution/**")
                .excludePathPatterns("/user/login","user/loginOut");
    }
    /**
     * 通过knife4j生成接口文档
     * @return
     */
    @Bean
    public Docket docket() {
        ApiInfo apiInfo = new ApiInfoBuilder()
                .title("残联大屏项目接口文档")
                .version("3.0")
                .description("残联大屏项目接口文档")
                .build();
        // 定义请求头参数
        ParameterBuilder tokenParamBuilder = new ParameterBuilder();
        tokenParamBuilder.name("token") // 参数名
                .description("请求头token") // 描述
                .modelRef(new ModelRef("string"))
                .parameterType("header") // 参数类型为请求头
                .required(false) // 是否必填
                .build();
        List<Parameter> parameters = new ArrayList<>();
        parameters.add(tokenParamBuilder.build());
        Docket docket = new Docket(DocumentationType.SWAGGER_2)
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.cl.controller"))
                .paths(PathSelectors.any())
                .build()
                .globalOperationParameters(parameters)
                .apiInfo(apiInfo); // 全局设置请求头参数;
        return docket;
    }
    /**
     * 设置静态资源映射
     * @param registry
     */
    protected void addResourceHandlers(ResourceHandlerRegistry registry) {
        // For Springfox 3.x
        registry.addResourceHandler("/swagger-ui/**")
                .addResourceLocations("classpath:/META-INF/resources/webjars/springfox-swagger-ui/")
                .resourceChain(false);
    }
    /**
     * 扩展Spring MVC框架的消息转换器
     * @param converters
     */
    @Override
    protected void extendMessageConverters(List<HttpMessageConverter<?>> converters) {
        log.info("扩展消息转换器");
        //创建一个消息装换器对象
        MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter();
        //需要为消息转换器设置一个对象转换器,对象装换器可以将java对象序列化为json数据
        converter.setObjectMapper(new JacksonObjectMapper());
        //将自己的消息转换器加入到容器中
        converters.add(0,converter);
    }
    /**
     * 登录密码错误次数校验
     */
    @Bean
    public LoginAttemptService loginAttemptService() {
        return new LoginAttemptService();
    }
}
src/main/java/com/cl/controller/DataController.java
New file
@@ -0,0 +1,97 @@
package com.cl.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.cl.common.result.Result;
import com.cl.pojo.dto.AddDataDTO;
import com.cl.pojo.entity.DataEntity;
import com.cl.pojo.vo.DataDetailVO;
import com.cl.pojo.vo.DataVO;
import com.cl.pojo.vo.EditDataDTO;
import com.cl.pojo.vo.screen.ScreenVO;
import com.cl.service.DataService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
@RestController
@RequestMapping("/data")
@Slf4j
@Api(tags = "数据")
public class DataController {
    @Autowired
    private DataService dataService;
    /**
     * 新增
     */
    @PostMapping("/add")
    @ApiOperation("数据上报")
    public Result<String> add(@RequestBody @Valid AddDataDTO addDataDTO) {
        dataService.add(addDataDTO);
        return Result.success("上传成功");
    }
    /**
     * 分页
     */
    @GetMapping("/pageList")
    @ApiOperation("用户分页查询")
    public Result<IPage<DataVO>>  selectPageUser(@RequestParam(value = "pageNum",defaultValue = "1")Integer pageNum,
                                                 @RequestParam(value = "pageSize",defaultValue = "10")Integer pageSize,
                                                 @RequestParam(value = "county",required = false)Integer county,
                                                 @RequestParam(value = "name",required = false)String name){
        IPage<DataEntity> page = new Page<>(pageNum, pageSize);
        IPage<DataVO> iPage=dataService.pageList(page,county,name);
        return Result.success(iPage);
    }
    /**
     * 查看详情(数据回显) 返回两次数据 查询该id和该id上一次数据   同比增加减少
     */
    @PostMapping("/detail")
    @ApiOperation("查看详情")
    public Result<DataDetailVO> detail(@RequestParam(value = "id")Integer id) {
        return Result.success( dataService.detail(id));
    }
    /**
     * 修改
     */
    @PutMapping("/edit")
    @ApiOperation("数据修改")
    public Result<String> edit(@RequestBody @Valid EditDataDTO editDataDTO) {
        dataService.edit(editDataDTO);
        return Result.success("修改成功");
    }
    /**
     * 删除
     */
    @DeleteMapping("/delete/{id}")
    @ApiOperation("删除数据")
    public Result<String> delete(@PathVariable Integer id) {
        dataService.delete(id);
        return Result.success("删除成功");
    }
    /**
     * 大屏数据
     */
    @PostMapping("/screen")
    @ApiOperation("大屏数据")
    public Result<ScreenVO> screen(@RequestParam(value = "county",required = false)Integer county) {
        return Result.success( dataService.screen(county==null?0:county));
    }
}
src/main/java/com/cl/controller/InstitutionController.java
New file
@@ -0,0 +1,90 @@
package com.cl.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.cl.common.result.Result;
import com.cl.pojo.dto.AddInstitutionDTO;
import com.cl.pojo.dto.EditInstitutionDTO;
import com.cl.pojo.entity.Institution;
import com.cl.pojo.vo.InstitutionVO;
import com.cl.service.InstitutionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
@RestController
@RequestMapping("/institution")
@Slf4j
@Api(tags = "机构")
@Validated
public class InstitutionController {
    @Autowired
    private InstitutionService institutionService;
    /**
     * 添加
     */
    @PostMapping("/add")
    @ApiOperation("添加机构")
    public Result<String> add(@RequestBody @Valid AddInstitutionDTO addDTO) {
        institutionService.add(addDTO);
        return Result.success("添加成功");
    }
    /**
     * 分页
     */
    @GetMapping("/pageList")
    @ApiOperation("机构分页")
    public Result<IPage<InstitutionVO> > pageList(@RequestParam(value = "pageNum",defaultValue = "1")Integer pageNum,
                                   @RequestParam(value = "pageSize",defaultValue = "10")Integer pageSize,
                                   @RequestParam(value = "county",required = false)Integer county,//0-查所有
                                   @RequestParam(value = "name",required = false)String name) {
        IPage<Institution> page = new Page<>(pageNum, pageSize);
        return Result.success(institutionService.pageList(page,county,name));
    }
    /**
     * 编辑回显
     */
    @GetMapping("/read/{id}")
    @ApiOperation("详情(回显)")
    public Result<InstitutionVO> read(@PathVariable("id")Integer id) {
        return Result.success(institutionService.read(id));
    }
    /**
     * 编辑
     */
    @PutMapping("/edit")
    @ApiOperation("修改机构")
    public Result<String> edit(@RequestBody @Valid EditInstitutionDTO editDTO) {
        institutionService.edit(editDTO);
        return Result.success("修改成功");
    }
    /**
     * 删除
     */
    @DeleteMapping("/delete/{id}")
    @ApiOperation("删除机构")
    public Result<String> delete(@PathVariable("id")Integer id) {
        institutionService.delete(id);
        return Result.success("删除成功");
    }
    /**
     * 大屏数据
     */
    @GetMapping("/getAll/{county}")
    @ApiOperation("大屏滚动数据")
    public Result<List<InstitutionVO>> getAll(@PathVariable("county") Integer county) {
        return Result.success(institutionService.getAll(county));
    }
}
src/main/java/com/cl/controller/UserController.java
New file
@@ -0,0 +1,219 @@
package com.cl.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.cl.common.constant.DelFlagConstant;
import com.cl.common.constant.StatusConstant;
import com.cl.common.context.BaseContext;
import com.cl.common.exception.user.LoginErrorException;
import com.cl.common.exception.user.UserException;
import com.cl.common.result.Result;
import com.cl.pojo.dto.AddUserDTO;
import com.cl.pojo.dto.EditUserDTO;
import com.cl.pojo.dto.LoginDTO;
import com.cl.pojo.dto.PasswordDTO;
import com.cl.pojo.entity.User;
import com.cl.pojo.vo.UserVO;
import com.cl.service.UserService;
import com.cl.service.impl.TokenBlacklistService;
import com.cl.util.BCryptPasswordEncoder;
import com.cl.util.JwtUtil;
import com.cl.util.LoginAttemptService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
@RestController
@RequestMapping("/user")
@Slf4j
@Api(tags = "用户")
public class UserController {
    @Autowired
    private UserService userService;
    @Autowired
    private LoginAttemptService loginAttemptService;
    @Autowired
    private TokenBlacklistService blacklistService;
    /**
     * 登录
     */
    @PostMapping("/login")
    @ApiOperation("用户登录")
    public Result<Map<String,String>> login(@RequestBody @Valid LoginDTO dto) {
        //校验该手机号登录失败是否锁定
        boolean locked = loginAttemptService.isLocked(dto.getPhone());
        if (locked) {
            throw new LoginErrorException("连续登录失败,请稍后再试");
        }
        //校验手机号是否存在
        User user = userService.getOne(new LambdaQueryWrapper<User>()
                .eq(User::getPhone, dto.getPhone())
                .eq(User::getDelFlag, DelFlagConstant.UNDELETE));
        if (user == null) {
            throw new LoginErrorException("用户不存在");
        }
        if (!Objects.equals(user.getStatus(), StatusConstant.ENABLE)){
            throw new LoginErrorException("该账号已被冻结");
        }
        //校验密码是否正确
        if (!BCryptPasswordEncoder.matches(dto.getPassword(), user.getPassword())) {
            //失败
            //将手机号加入线程中记录
            loginAttemptService.recordFailedAttempt(dto.getPhone());
            throw new LoginErrorException("登录失败,手机号/密码错误");
        }
        //成功
        loginAttemptService.clearAttempts(dto.getPhone());
        //token加密
        Map<String, Object> claims=new HashMap<>();
        claims.put("phone", dto.getPhone());
        claims.put("id", user.getId());
        String token = JwtUtil.createJWT(claims);
        Map<String,String> map=new HashMap<>();
        map.put("token", token);
        map.put("is_first",user.getIsFirst().toString());
        if (1==user.getIsFirst()){
            User user1 = new User();
            user1.setId(user.getId());
            user1.setIsFirst(0);
            userService.updateById(user1);
        }
        return Result.success(map);
    }
    /**
     * 退出登录
     */
    @PostMapping("/logout")
    @ApiOperation("退出登录")
    public Result<String> logout(@RequestHeader("Authorization") String token) {
        // 1. 将令牌加入黑名单
        blacklistService.addToBlacklist(token);
        return Result.success("退出成功");
    }
    /**
     * 修改密码
     */
    @PutMapping("/password")
    @ApiOperation("修改密码")
    public Result<String> password(@RequestBody @Valid PasswordDTO passwordDTO,
                                   @RequestHeader("Authorization") String token) {
        userService.password(passwordDTO,token);
        return Result.success("修改成功");
    }
    /**
     * 添加
     */
    @PostMapping("/addUser")
    @ApiOperation("添加用户")
    public Result<String> addUser(@RequestBody @Valid AddUserDTO addUserDTO) {
        userService.addUser(addUserDTO);
        return Result.success("添加成功");
    }
    /**
     * 用户列表查询
     */
    @GetMapping("/pageList")
    @ApiOperation("用户分页查询")
    public Result<IPage<UserVO>>  selectPageUser(@RequestParam(value = "pageNum",defaultValue = "1")Integer pageNum,
                                                 @RequestParam(value = "pageSize",defaultValue = "10")Integer pageSize,
                                                 @RequestParam(value = "name",required = false)String name,
                                                 @RequestParam(value = "phone",required = false)String phone){
        IPage<User> page = new Page<>(pageNum, pageSize);
        IPage<UserVO> iPage=userService.pageList(page,name,phone);
        return Result.success(iPage);
    }
    /**
     * 用户回显
     */
    @GetMapping("/read/{id}")
    @ApiOperation("查看用户(编辑回显)")
    public Result<UserVO> read(@PathVariable("id")Integer id){
        if (id==1){
            throw new UserException("管理员账号,不可操作");
        }
        User user = userService.getById(id);
        UserVO userVO=new UserVO();
        BeanUtils.copyProperties(user,userVO);
        return Result.success(userVO);
    }
    /**
     * 编辑用户
     */
    @PutMapping("/editUser")
    @ApiOperation("编辑用户")
    public Result<String> editUser(@RequestBody @Valid EditUserDTO editUserDTO) {
        if (editUserDTO.getId()==1){
            throw new UserException("管理员账号,不可操作");
        }
        userService.editUser(editUserDTO);
        return Result.success("修改成功");
    }
    /**
     * 冻结/解冻
     */
    @PutMapping("/frozen/{id}")
    @ApiOperation("冻结/解冻")
    public Result<String> frozen(@PathVariable("id") Integer id) {
        if (id==1){
            throw new UserException("管理员账号,不可操作");
        }
        userService.frozen(id);
        return Result.success("修改成功");
    }
    /**
     * 删除
     */
    @DeleteMapping("/delete/{id}")
    @ApiOperation("删除用户")
    public Result<String> deleteUser(@PathVariable("id")Integer id){
        if (id==1){
            throw new UserException("管理员账号,不可操作");
        }
        LambdaQueryWrapper<User> queryWrapper=new LambdaQueryWrapper<>();
        queryWrapper.eq(User::getId,id);
        queryWrapper.eq(User::getDelFlag,DelFlagConstant.UNDELETE);
        User user = userService.getOne(queryWrapper);
        if (null==user){
            throw new UserException("用户不存在");
        }
        user.setDelFlag(DelFlagConstant.DELETE);
        user.setUpdateBy(BaseContext.getCurrentUser().getId());
        user.setUpdateTime(LocalDateTime.now());
        userService.updateById(user);
        return Result.success("删除成功");
    }
    /**
     * 重置密码
     */
    @PutMapping("/resetPassword/{id}")
    @ApiOperation("重置密码")
    public Result<String> resetPassword(@PathVariable("id")Integer id){
        if (id==1){
            throw new UserException("管理员账号,不可操作");
        }
        userService.resetPassword(id);
        return Result.success("删除成功");
    }
}
src/main/java/com/cl/interceptor/JwtTokenInterceptor.java
New file
@@ -0,0 +1,99 @@
package com.cl.interceptor;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.cl.common.constant.DelFlagConstant;
import com.cl.common.constant.JwtClaimsConstant;
import com.cl.common.constant.MessageConstant;
import com.cl.common.constant.StatusConstant;
import com.cl.common.context.BaseContext;
import com.cl.common.exception.user.InterceptorException;
import com.cl.common.exception.user.LoginErrorException;
import com.cl.mapper.UserMapper;
import com.cl.pojo.entity.User;
import com.cl.service.impl.TokenBlacklistService;
import com.cl.util.JwtUtil;
import io.jsonwebtoken.Claims;
import io.jsonwebtoken.ExpiredJwtException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.HandlerInterceptor;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Objects;
/**
 * jwt令牌校验的拦截器
 */
@Component
@Slf4j
public class JwtTokenInterceptor implements HandlerInterceptor {
    @Autowired
    private JwtUtil jwtUtil;
    @Autowired
    private UserMapper userMapper;
    @Autowired
    private TokenBlacklistService blacklistService;
    /**
     * 校验jwt
     *
     * @param request
     * @param response
     * @param handler
     * @return
     * @throws Exception
     */
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        //判断当前拦截到的是Controller的方法还是其他资源
        if (!(handler instanceof HandlerMethod)) {
            //当前拦截到的不是动态方法,直接放行
            return true;
        }
        //1、从请求头中获取令牌
        String token = request.getHeader(jwtUtil.getTokenName());
        if (token == null || token.isEmpty()) {
            log.warn("JWT令牌为空,访问URI: {}", request.getRequestURI());
            throw new LoginErrorException(MessageConstant.USER_NOT_LOGIN);
        }
        // 检查令牌是否在黑名单中
        if (blacklistService.isBlacklisted(token)) {
            response.sendError(HttpStatus.UNAUTHORIZED.value(), "令牌已失效");
            throw new LoginErrorException("您已退出登录");
        }
        //2、校验令牌
        try {
            log.info("jwt校验:{}", token);
            Claims claims = JwtUtil.parseJWT(token);
            String phone=String.valueOf(claims.get(JwtClaimsConstant.USER_PHONE).toString());
            String id=String.valueOf(claims.get(JwtClaimsConstant.USER_ID).toString());
            User user = userMapper.selectById(id);
            if (user==null || user.getDelFlag().equals(DelFlagConstant.DELETE)){
                throw new InterceptorException("用户不存在");
            }
            if (Objects.equals(user.getStatus(), StatusConstant.DISABLE)){
                throw new InterceptorException("该用户已被冻结");
            }
            log.info("当前用户phone:{}", phone);
            log.info("当前用户id:{}", id);
            BaseContext.setCurrentUser(user);
            //3、通过,放行
            return true;
        }catch (ExpiredJwtException ex) {
            log.warn("JWT已过期,Token: {}", token);
            throw new LoginErrorException(MessageConstant.TOKEN_EXPIRED);
        } catch (InterceptorException ex) {
            log.warn("JWT已过期,Token: {}", token);
            throw new InterceptorException("该用户已被冻结");
        }catch (Exception ex) {
            //4、不通过,响应401状态码
            throw new LoginErrorException(MessageConstant.USER_NOT_LOGIN);
        }
    }
}
src/main/java/com/cl/mapper/DataMapper.java
New file
@@ -0,0 +1,17 @@
package com.cl.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.cl.pojo.entity.DataEntity;
import com.cl.pojo.vo.DataVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface DataMapper extends BaseMapper<DataEntity> {
    DataEntity screen(Integer county);
    IPage<DataVO> pageList(IPage<DataEntity> page, @Param("county") Integer county,@Param("name") String name);
    DataEntity beforeOne(@Param("id") Integer id);
}
src/main/java/com/cl/mapper/InstitutionMapper.java
New file
@@ -0,0 +1,17 @@
package com.cl.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.cl.pojo.entity.Institution;
import com.cl.pojo.vo.InstitutionVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface InstitutionMapper extends BaseMapper<Institution> {
    IPage<InstitutionVO> pageList(IPage<Institution> page, @Param("county") Integer county, @Param("name") String name);
    List<InstitutionVO> getAll(@Param("county") Integer county);
}
src/main/java/com/cl/mapper/UserMapper.java
New file
@@ -0,0 +1,15 @@
package com.cl.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.cl.pojo.entity.User;
import com.cl.pojo.vo.UserVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface UserMapper extends BaseMapper<User> {
    IPage<UserVO> pageList(IPage<User> page, @Param("name") String name, @Param("phone") String phone);
}
src/main/java/com/cl/pojo/dto/AddDataDTO.java
New file
@@ -0,0 +1,250 @@
package com.cl.pojo.dto;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;
@Data
@ApiModel("上传数据DTO")
public class AddDataDTO {
    @ApiModelProperty(value = "区县,1-东区,2-西区,3-仁和区,4-米易县,5-盐边县")
    @Min(value = 1,message = "区县选择范围为1-5")
    @Max(value = 5,message = "区县选择范围为1-5")
    @NotNull(message = "区县选择不能为空")
    private Integer county;
    @ApiModelProperty(value = "调研时间")
    @NotNull(message = "调研时间不能为空")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime investigateTime;
    @ApiModelProperty(value = "持证残疾人数-视力")
    private Integer certificateEyesight = 0;
    @ApiModelProperty(value = "持证残疾人数-智力")
    private Integer certificateIntellect = 0;
    @ApiModelProperty(value = "持证残疾人数-肢体")
    private Integer certificateLimb = 0;
    @ApiModelProperty(value = "持证残疾人数-言语")
    private Integer certificateSpeech = 0;
    @ApiModelProperty(value = "持证残疾人数-听力")
    private Integer certificateHearing = 0;
    @ApiModelProperty(value = "持证残疾人数-精神")
    private Integer certificateSpirit = 0;
    @ApiModelProperty(value = "持证残疾人数-多重")
    private Integer certificateMultiple = 0;
    @ApiModelProperty(value = "残疾人工作者队伍人数-市残联")
    private Integer workerCity = 0;
    @ApiModelProperty(value = "残疾人工作者队伍人数-五大专门协会")
    private Integer workerAssociation = 0;
    @ApiModelProperty(value = "残疾人工作者队伍人数-攀狮服务队")
    private Integer workerServiceCorps = 0;
    @ApiModelProperty(value = "残疾人工作者队伍人数-县区残联")
    private Integer workerCounty = 0;
    @ApiModelProperty(value = "残疾人工作者队伍人数-乡镇残联")
    private Integer workerTownship = 0;
    @ApiModelProperty(value = "残疾人工作者队伍人数-村社区残联")
    private Integer workerVillage = 0;
    @ApiModelProperty(value = "残疾儿童康复训练人数-孤独症")
    private Integer drillAutism = 0;
    @ApiModelProperty(value = "残疾儿童康复训练人数-智力")
    private Integer drillIntellect = 0;
    @ApiModelProperty(value = "残疾儿童康复训练人数-肢体")
    private Integer drillLimb = 0;
    @ApiModelProperty(value = "残疾儿童康复训练人数-言语")
    private Integer drillSpeech = 0;
    @ApiModelProperty(value = "残疾儿童康复训练人数-听力")
    private Integer drillHearing = 0;
    @ApiModelProperty(value = "残疾儿童康复训练人数-精神")
    private Integer drillSpirit = 0;
    @ApiModelProperty(value = "残疾儿童康复救助人数-0-6岁")
    private Integer salvationBeforeSeven = 0;
    @ApiModelProperty(value = "残疾儿童康复救助人数-7岁之后")
    private Integer salvationAfterSeven = 0;
    @ApiModelProperty(value = "残疾儿童康复救助人数-孤独症")
    private Integer salvationAutism = 0;
    @ApiModelProperty(value = "残疾儿童康复救助人数-智力")
    private Integer salvationIntellect = 0;
    @ApiModelProperty(value = "残疾儿童康复救助人数-肢体")
    private Integer salvationLimb = 0;
    @ApiModelProperty(value = "残疾儿童康复救助人数-言语")
    private Integer salvationSpeech = 0;
    @ApiModelProperty(value = "困难精神残疾人医疗救助人数-门诊服药")
    private Integer difficultyMedication = 0;
    @ApiModelProperty(value = "困难精神残疾人医疗救助人数-住院治疗")
    private Integer difficultyHospitalisation = 0;
    @ApiModelProperty(value = "残疾人基本辅助器具适配补贴人数-补贴总人数")
    private Integer assistiveDeviceTotal = 0;
    @ApiModelProperty(value = "残疾人基本辅助器具适配补贴人数-辅具一")
    private Integer assistiveDeviceOne = 0;
    @ApiModelProperty(value = "残疾人基本辅助器具适配补贴人数-辅具二")
    private Integer assistiveDeviceTwo = 0;
    @ApiModelProperty(value = "残疾人基本辅助器具适配补贴人数-辅具三")
    private Integer assistiveDeviceThree = 0;
    @ApiModelProperty(value = "残疾人基本辅助器具适配补贴人数-其他")
    private Integer assistiveDeviceOther = 0;
    @ApiModelProperty(value = "残疾人基本辅助器具适配补贴人数-类别一")
    private Integer assistiveDeviceTypeOne = 0;
    @ApiModelProperty(value = "残疾人基本辅助器具适配补贴人数-类别二")
    private Integer assistiveDeviceTypeTwo = 0;
    @ApiModelProperty(value = "残疾人基本辅助器具适配补贴人数-类别三")
    private Integer assistiveDeviceTypeThree = 0;
    @ApiModelProperty(value = "残疾人基本辅助器具适配补贴人数-类别四")
    private Integer assistiveDeviceTypeFour = 0;
    @ApiModelProperty(value = "残疾人基本辅助器具适配补贴人数-等级一")
    private Integer assistiveDeviceGradeOne = 0;
    @ApiModelProperty(value = "残疾人基本辅助器具适配补贴人数-等级二")
    private Integer assistiveDeviceGradeTwo = 0;
    @ApiModelProperty(value = "残疾人基本辅助器具适配补贴人数-等级三")
    private Integer assistiveDeviceGradeThree = 0;
    @ApiModelProperty(value = "残疾人基本辅助器具适配补贴人数-等级四")
    private Integer assistiveDeviceGradeFour = 0;
    @ApiModelProperty(value = "职业技能和实用技术培训人数")
    private Integer technicalTraining = 0;
    @ApiModelProperty(value = "居家灵活就业及一次性创业补贴发放数")
    private Integer homeAllowance = 0;
    @ApiModelProperty(value = "法定就业年龄段持证残疾人数占比-视力")
    private Integer statutoryCertificateEyesight = 0;
    @ApiModelProperty(value = "法定就业年龄段持证残疾人数占比-智力")
    private Integer statutoryCertificateIntellect = 0;
    @ApiModelProperty(value = "法定就业年龄段持证残疾人数占比-肢体")
    private Integer statutoryCertificateLimb = 0;
    @ApiModelProperty(value = "法定就业年龄段持证残疾人数占比-言语")
    private Integer statutoryCertificateSpeech = 0;
    @ApiModelProperty(value = "法定就业年龄段持证残疾人数占比-听力")
    private Integer statutoryCertificateHearing = 0;
    @ApiModelProperty(value = "已就业残疾人数-就业")
    private Integer employedEmployment = 0;
    @ApiModelProperty(value = "已就业残疾人数-集中就业")
    private Integer employedConcentrated = 0;
    @ApiModelProperty(value = "已就业残疾人数-公益性岗位")
    private Integer employedPublicWelfare = 0;
    @ApiModelProperty(value = "已就业残疾人数-辅助性就业")
    private Integer employedAuxiliary = 0;
    @ApiModelProperty(value = "已就业残疾人数-个体就业")
    private Integer employedIndividual = 0;
    @ApiModelProperty(value = "应届高校残疾毕业生数-就业")
    private Integer highSchoolEmployment = 0;
    @ApiModelProperty(value = "应届高校残疾毕业生数-个体就业")
    private Integer highSchoolIndividual = 0;
    @ApiModelProperty(value = "应届高校残疾毕业生数-灵活就业")
    private Integer highSchoolFlexible = 0;
    @ApiModelProperty(value = "适龄残疾儿童少年义务教育-一年级")
    private Integer educationOne = 0;
    @ApiModelProperty(value = "适龄残疾儿童少年义务教育-二年级")
    private Integer educationTwo = 0;
    @ApiModelProperty(value = "适龄残疾儿童少年义务教育-三年级")
    private Integer educationThree = 0;
    @ApiModelProperty(value = "适龄残疾儿童少年义务教育-四年级")
    private Integer educationFour = 0;
    @ApiModelProperty(value = "适龄残疾儿童少年义务教育-五年级")
    private Integer educationFive = 0;
    @ApiModelProperty(value = "适龄残疾儿童少年义务教育-六年级")
    private Integer educationSix = 0;
    @ApiModelProperty(value = "适龄残疾儿童少年义务教育-七年级")
    private Integer educationSeven = 0;
    @ApiModelProperty(value = "适龄残疾儿童少年义务教育-八年级")
    private Integer educationEight = 0;
    @ApiModelProperty(value = "适龄残疾儿童少年义务教育-九年级")
    private Integer educationNine = 0;
    @ApiModelProperty(value = "九年义务教育在读残疾儿童生活补贴发放数")
    private Integer educationSubsidy = 0;
    @ApiModelProperty(value = "公益文体活动-开展次数")
    private Integer activityFrequency = 0;
    @ApiModelProperty(value = "公益文体活动-参加人数")
    private Integer educationNumber = 0;
    @ApiModelProperty(value = "服务”一件事“办件数")
    private Integer matter = 0;
    @ApiModelProperty(value = "家庭医生签约增值服务数")
    private Integer doctorApprecitation = 0;
    @ApiModelProperty(value = "困难重度残疾人家庭无障碍改造实施改造户数")
    private Integer remould = 0;
    @ApiModelProperty(value = "残疾人接访情况-办公室接访")
    private Integer interviewsOffice = 0;
    @ApiModelProperty(value = "残疾人接访情况-电话接访")
    private Integer interviewsPhone = 0;
    @ApiModelProperty(value = "残疾人接访情况-上级交办")
    private Integer interviewsSuperior = 0;
    @ApiModelProperty(value = "残疾人接访情况-12345交办")
    private Integer interviewsHotline = 0;
}
src/main/java/com/cl/pojo/dto/AddInstitutionDTO.java
New file
@@ -0,0 +1,38 @@
package com.cl.pojo.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
@Data
@ApiModel("添加机构")
public class AddInstitutionDTO {
    @Min(value = 1,message = "区县选择范围为1-5")
    @Max(value = 5,message = "区县选择范围为1-5")
    @NotNull(message = "区县选择不能为空")
    @ApiModelProperty(value = "区县,1-东区,2-西区,3-仁和区,4-米易县,5-盐边县")
    private Integer county;
    @Min(value = 1,message = "机构类型选择范围为1-2")
    @Max(value = 2,message = "机构类型选择范围为1-2")
    @NotNull(message = "机构类型选择不能为空")
    @ApiModelProperty(value = "机构类型,1-残疾人定点康复机构,2-残疾人友好医疗机构")
    private Integer type;
    @NotEmpty(message = "机构名称不能为空")
    @ApiModelProperty(value = "机构名称")
    private String name;
    @NotEmpty(message = "详细地址不能为空")
    @ApiModelProperty(value = "详细地址")
    private String address;
    @NotEmpty(message = "联系电话不能为空")
    @ApiModelProperty(value = "联系电话")
    private String phone;
}
src/main/java/com/cl/pojo/dto/AddUserDTO.java
New file
@@ -0,0 +1,16 @@
package com.cl.pojo.dto;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Pattern;
@Data
public class AddUserDTO {
    @NotEmpty(message = "姓名不能为空")
    private String name;
    @NotEmpty(message = "联系方式不能为空")
    @Pattern(regexp = "^1[3-9]\\d{9}$", message = "手机号格式不正确")
    private String phone;
    private String remark;//备注
}
src/main/java/com/cl/pojo/dto/EditInstitutionDTO.java
New file
@@ -0,0 +1,12 @@
package com.cl.pojo.dto;
import lombok.Getter;
import lombok.Setter;
import javax.validation.constraints.NotNull;
@Getter
@Setter
public class EditInstitutionDTO extends AddInstitutionDTO{
    @NotNull(message = "id不能为空")
    private Integer id;
}
src/main/java/com/cl/pojo/dto/EditUserDTO.java
New file
@@ -0,0 +1,16 @@
package com.cl.pojo.dto;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import javax.validation.constraints.NotNull;
@Getter
@Setter
public class EditUserDTO extends AddUserDTO {
    @NotNull(message = "用户id不能为空")
    private Integer id;
}
src/main/java/com/cl/pojo/dto/LoginDTO.java
New file
@@ -0,0 +1,16 @@
package com.cl.pojo.dto;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import java.io.Serializable;
@Data
@ApiModel("登录")
public class LoginDTO implements Serializable {
    private static final long serialVersionUID = 1L;
    @NotEmpty(message = "手机号不能为空")
    private String phone;
    @NotEmpty(message = "密码不能为空")
    private String password;
}
src/main/java/com/cl/pojo/dto/PasswordDTO.java
New file
@@ -0,0 +1,13 @@
package com.cl.pojo.dto;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
@Data
public class PasswordDTO {
    @NotEmpty(message = "旧密码不能为空")
    private String password;
    @NotEmpty(message = "新密码不能为空")
    private String newPassword;
}
src/main/java/com/cl/pojo/entity/DataEntity.java
New file
@@ -0,0 +1,263 @@
package com.cl.pojo.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.LocalDateTime;
import java.util.Date;
@Data
@ApiModel("数据上报表")
@TableName("t_data")
public class DataEntity {
    @TableId(type = IdType.AUTO)
    @ApiModelProperty(value = "主键")
    private Integer id;
    @ApiModelProperty(value = "区县,1-东区,2-西区,3-仁和区,4-米易县,5-盐边县")
    private Integer county;
    @ApiModelProperty(value = "调研时间")
    private LocalDateTime investigateTime;
    @ApiModelProperty(value = "创建者、调研者")
    private Integer createBy;
    @ApiModelProperty(value = "创建时间")
    private LocalDateTime createTime;
    @ApiModelProperty(value = "更新者")
    private Integer updateBy;
    @ApiModelProperty(value = "更新时间")
    private LocalDateTime updateTime;
    @ApiModelProperty(value = "删除标志,0-未删除,1-删除")
    private Integer delFlag;
    @ApiModelProperty(value = "持证残疾人数-视力")
    private Integer certificateEyesight;
    @ApiModelProperty(value = "持证残疾人数-智力")
    private Integer certificateIntellect;
    @ApiModelProperty(value = "持证残疾人数-肢体")
    private Integer certificateLimb;
    @ApiModelProperty(value = "持证残疾人数-言语")
    private Integer certificateSpeech;
    @ApiModelProperty(value = "持证残疾人数-听力")
    private Integer certificateHearing;
    @ApiModelProperty(value = "持证残疾人数-精神")
    private Integer certificateSpirit;
    @ApiModelProperty(value = "持证残疾人数-多重")
    private Integer certificateMultiple;
    @ApiModelProperty(value = "残疾人工作者队伍人数-市残联")
    private Integer workerCity;
    @ApiModelProperty(value = "残疾人工作者队伍人数-五大专门协会")
    private Integer workerAssociation;
    @ApiModelProperty(value = "残疾人工作者队伍人数-攀狮服务队")
    private Integer workerServiceCorps;
    @ApiModelProperty(value = "残疾人工作者队伍人数-县区残联")
    private Integer workerCounty;
    @ApiModelProperty(value = "残疾人工作者队伍人数-乡镇残联")
    private Integer workerTownship;
    @ApiModelProperty(value = "残疾人工作者队伍人数-村社区残联")
    private Integer workerVillage;
    @ApiModelProperty(value = "残疾儿童康复训练人数-孤独症")
    private Integer drillAutism;
    @ApiModelProperty(value = "残疾儿童康复训练人数-智力")
    private Integer drillIntellect;
    @ApiModelProperty(value = "残疾儿童康复训练人数-肢体")
    private Integer drillLimb;
    @ApiModelProperty(value = "残疾儿童康复训练人数-言语")
    private Integer drillSpeech;
    @ApiModelProperty(value = "残疾儿童康复训练人数-听力")
    private Integer drillHearing;
    @ApiModelProperty(value = "残疾儿童康复训练人数-精神")
    private Integer drillSpirit;
    @ApiModelProperty(value = "残疾儿童康复救助人数-0-6岁")
    private Integer salvationBeforeSeven;
    @ApiModelProperty(value = "残疾儿童康复救助人数-7岁之后")
    private Integer salvationAfterSeven;
    @ApiModelProperty(value = "残疾儿童康复救助人数-孤独症")
    private Integer salvationAutism;
    @ApiModelProperty(value = "残疾儿童康复救助人数-智力")
    private Integer salvationIntellect;
    @ApiModelProperty(value = "残疾儿童康复救助人数-肢体")
    private Integer salvationLimb;
    @ApiModelProperty(value = "残疾儿童康复救助人数-言语")
    private Integer salvationSpeech;
    @ApiModelProperty(value = "困难精神残疾人医疗救助人数-门诊服药")
    private Integer difficultyMedication;
    @ApiModelProperty(value = "困难精神残疾人医疗救助人数-住院治疗")
    private Integer difficultyHospitalisation;
    @ApiModelProperty(value = "残疾人基本辅助器具适配补贴人数-补贴总人数")
    private Integer assistiveDeviceTotal;
    @ApiModelProperty(value = "残疾人基本辅助器具适配补贴人数-辅具一")
    private Integer assistiveDeviceOne;
    @ApiModelProperty(value = "残疾人基本辅助器具适配补贴人数-辅具二")
    private Integer assistiveDeviceTwo;
    @ApiModelProperty(value = "残疾人基本辅助器具适配补贴人数-辅具三")
    private Integer assistiveDeviceThree;
    @ApiModelProperty(value = "残疾人基本辅助器具适配补贴人数-其他")
    private Integer assistiveDeviceOther;
    @ApiModelProperty(value = "残疾人基本辅助器具适配补贴人数-类别一")
    private Integer assistiveDeviceTypeOne;
    @ApiModelProperty(value = "残疾人基本辅助器具适配补贴人数-类别二")
    private Integer assistiveDeviceTypeTwo;
    @ApiModelProperty(value = "残疾人基本辅助器具适配补贴人数-类别三")
    private Integer assistiveDeviceTypeThree;
    @ApiModelProperty(value = "残疾人基本辅助器具适配补贴人数-类别四")
    private Integer assistiveDeviceTypeFour;
    @ApiModelProperty(value = "残疾人基本辅助器具适配补贴人数-等级一")
    private Integer assistiveDeviceGradeOne;
    @ApiModelProperty(value = "残疾人基本辅助器具适配补贴人数-等级二")
    private Integer assistiveDeviceGradeTwo;
    @ApiModelProperty(value = "残疾人基本辅助器具适配补贴人数-等级三")
    private Integer assistiveDeviceGradeThree;
    @ApiModelProperty(value = "残疾人基本辅助器具适配补贴人数-等级四")
    private Integer assistiveDeviceGradeFour;
    @ApiModelProperty(value = "职业技能和实用技术培训人数")
    private Integer technicalTraining;
    @ApiModelProperty(value = "居家灵活就业及一次性创业补贴发放数")
    private Integer homeAllowance;
    @ApiModelProperty(value = "法定就业年龄段持证残疾人数占比-视力")
    private Integer statutoryCertificateEyesight;
    @ApiModelProperty(value = "法定就业年龄段持证残疾人数占比-智力")
    private Integer statutoryCertificateIntellect;
    @ApiModelProperty(value = "法定就业年龄段持证残疾人数占比-肢体")
    private Integer statutoryCertificateLimb;
    @ApiModelProperty(value = "法定就业年龄段持证残疾人数占比-言语")
    private Integer statutoryCertificateSpeech;
    @ApiModelProperty(value = "法定就业年龄段持证残疾人数占比-听力")
    private Integer statutoryCertificateHearing;
    @ApiModelProperty(value = "已就业残疾人数-就业")
    private Integer employedEmployment;
    @ApiModelProperty(value = "已就业残疾人数-集中就业")
    private Integer employedConcentrated;
    @ApiModelProperty(value = "已就业残疾人数-公益性岗位")
    private Integer employedPublicWelfare;
    @ApiModelProperty(value = "已就业残疾人数-辅助性就业")
    private Integer employedAuxiliary;
    @ApiModelProperty(value = "已就业残疾人数-个体就业")
    private Integer employedIndividual;
    @ApiModelProperty(value = "应届高校残疾毕业生数-就业")
    private Integer highSchoolEmployment;
    @ApiModelProperty(value = "应届高校残疾毕业生数-个体就业")
    private Integer highSchoolIndividual;
    @ApiModelProperty(value = "应届高校残疾毕业生数-灵活就业")
    private Integer highSchoolFlexible;
    @ApiModelProperty(value = "适龄残疾儿童少年义务教育-一年级")
    private Integer educationOne;
    @ApiModelProperty(value = "适龄残疾儿童少年义务教育-二年级")
    private Integer educationTwo;
    @ApiModelProperty(value = "适龄残疾儿童少年义务教育-三年级")
    private Integer educationThree;
    @ApiModelProperty(value = "适龄残疾儿童少年义务教育-四年级")
    private Integer educationFour;
    @ApiModelProperty(value = "适龄残疾儿童少年义务教育-五年级")
    private Integer educationFive;
    @ApiModelProperty(value = "适龄残疾儿童少年义务教育-六年级")
    private Integer educationSix;
    @ApiModelProperty(value = "适龄残疾儿童少年义务教育-七年级")
    private Integer educationSeven;
    @ApiModelProperty(value = "适龄残疾儿童少年义务教育-八年级")
    private Integer educationEight;
    @ApiModelProperty(value = "适龄残疾儿童少年义务教育-九年级")
    private Integer educationNine;
    @ApiModelProperty(value = "九年义务教育在读残疾儿童生活补贴发放数")
    private Integer educationSubsidy;
    @ApiModelProperty(value = "公益文体活动-开展次数")
    private Integer activityFrequency;
    @ApiModelProperty(value = "公益文体活动-参加人数")
    private Integer educationNumber;
    @ApiModelProperty(value = "服务”一件事“办件数")
    private Integer matter;
    @ApiModelProperty(value = "家庭医生签约增值服务数")
    private Integer doctorApprecitation;
    @ApiModelProperty(value = "困难重度残疾人家庭无障碍改造实施改造户数")
    private Integer remould;
    @ApiModelProperty(value = "残疾人接访情况-办公室接访")
    private Integer interviewsOffice;
    @ApiModelProperty(value = "残疾人接访情况-电话接访")
    private Integer interviewsPhone;
    @ApiModelProperty(value = "残疾人接访情况-上级交办")
    private Integer interviewsSuperior;
    @ApiModelProperty(value = "残疾人接访情况-12345交办")
    private Integer interviewsHotline;
}
src/main/java/com/cl/pojo/entity/Institution.java
New file
@@ -0,0 +1,46 @@
package com.cl.pojo.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.LocalDateTime;
@Data
@ApiModel("机构表")
@TableName("t_institution")
public class Institution {
    @ApiModelProperty(value = "机构ID")
    private Integer id;
    @ApiModelProperty(value = "区县,1-东区,2-西区,3-仁和区,4-米易县,5-盐边县")
    private Integer county;
    @ApiModelProperty(value = "机构类型,1-残疾人定点康复机构,2-残疾人友好医疗机构")
    private Integer type;
    @ApiModelProperty(value = "机构名称")
    private String name;
    @ApiModelProperty(value = "详细地址")
    private String address;
    @ApiModelProperty(value = "联系电话")
    private String phone;
    @ApiModelProperty(value = "删除标志(0代表存在 1代表删除)")
    private Integer delFlag;
    @ApiModelProperty(value = "创建者")
    private Integer createBy;
    @ApiModelProperty(value = "创建时间")
    private LocalDateTime createTime;
    @ApiModelProperty(value = "更新者")
    private Integer updateBy;
    @ApiModelProperty(value = "更新时间")
    private LocalDateTime updateTime;
}
src/main/java/com/cl/pojo/entity/User.java
New file
@@ -0,0 +1,53 @@
package com.cl.pojo.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
@Data
@TableName("t_user")
@ApiModel("用户表")
public class User implements Serializable {
    private static final long serialVersionUID = 1L;
    @TableId(type = IdType.AUTO)
    @ApiModelProperty(value = "用户ID")
    private Integer id;
    @ApiModelProperty(value = "手机号")
    private String phone;
    @ApiModelProperty(value = "姓名")
    private String name;
    @ApiModelProperty(value = "密码")
    private String password;
    @ApiModelProperty(value = "帐号状态(0正常 1停用)")
    private Integer status;
    @ApiModelProperty(value = "删除标志(0代表存在 1代表删除)")
    private Integer delFlag;
    @ApiModelProperty(value = "创建者")
    private Integer createBy;
    @ApiModelProperty(value = "创建时间")
    private LocalDateTime createTime;
    @ApiModelProperty(value = "更新者")
    private Integer updateBy;
    @ApiModelProperty(value = "更新时间")
    private LocalDateTime updateTime;
    @ApiModelProperty(value = "备注")
    private String remark;
    @ApiModelProperty(value = "是否第一次登录/重置密码后登录,0-否,1-是")
    private Integer isFirst;
}
src/main/java/com/cl/pojo/vo/DataDetailVO.java
New file
@@ -0,0 +1,17 @@
package com.cl.pojo.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ApiModel("查看数据详情VO")
@Data
public class DataDetailVO {
    @ApiModelProperty("详情数据")
    private EditDataDTO data;
    @ApiModelProperty("上次填报")
    private EditDataDTO beforeData;
    @ApiModelProperty("同比增加减少")
    private DataRateVO rateVO;
}
src/main/java/com/cl/pojo/vo/DataRateVO.java
New file
@@ -0,0 +1,233 @@
package com.cl.pojo.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel("比率VO")
public class DataRateVO {
    @ApiModelProperty(value = "持证残疾人数-视力")
    private String certificateEyesight;
    @ApiModelProperty(value = "持证残疾人数-智力")
    private String certificateIntellect;
    @ApiModelProperty(value = "持证残疾人数-肢体")
    private String certificateLimb;
    @ApiModelProperty(value = "持证残疾人数-言语")
    private String certificateSpeech;
    @ApiModelProperty(value = "持证残疾人数-听力")
    private String certificateHearing;
    @ApiModelProperty(value = "持证残疾人数-精神")
    private String certificateSpirit;
    @ApiModelProperty(value = "持证残疾人数-多重")
    private String certificateMultiple;
    @ApiModelProperty(value = "残疾人工作者队伍人数-市残联")
    private String workerCity;
    @ApiModelProperty(value = "残疾人工作者队伍人数-五大专门协会")
    private String workerAssociation;
    @ApiModelProperty(value = "残疾人工作者队伍人数-攀狮服务队")
    private String workerServiceCorps;
    @ApiModelProperty(value = "残疾人工作者队伍人数-县区残联")
    private String workerCounty;
    @ApiModelProperty(value = "残疾人工作者队伍人数-乡镇残联")
    private String workerTownship;
    @ApiModelProperty(value = "残疾人工作者队伍人数-村社区残联")
    private String workerVillage;
    @ApiModelProperty(value = "残疾儿童康复训练人数-孤独症")
    private String drillAutism;
    @ApiModelProperty(value = "残疾儿童康复训练人数-智力")
    private String drillIntellect;
    @ApiModelProperty(value = "残疾儿童康复训练人数-肢体")
    private String drillLimb;
    @ApiModelProperty(value = "残疾儿童康复训练人数-言语")
    private String drillSpeech;
    @ApiModelProperty(value = "残疾儿童康复训练人数-听力")
    private String drillHearing;
    @ApiModelProperty(value = "残疾儿童康复训练人数-精神")
    private String drillSpirit;
    @ApiModelProperty(value = "残疾儿童康复救助人数-0-6岁")
    private String salvationBeforeSeven;
    @ApiModelProperty(value = "残疾儿童康复救助人数-7岁之后")
    private String salvationAfterSeven;
    @ApiModelProperty(value = "残疾儿童康复救助人数-孤独症")
    private String salvationAutism;
    @ApiModelProperty(value = "残疾儿童康复救助人数-智力")
    private String salvationIntellect;
    @ApiModelProperty(value = "残疾儿童康复救助人数-肢体")
    private String salvationLimb;
    @ApiModelProperty(value = "残疾儿童康复救助人数-言语")
    private String salvationSpeech;
    @ApiModelProperty(value = "困难精神残疾人医疗救助人数-门诊服药")
    private String difficultyMedication;
    @ApiModelProperty(value = "困难精神残疾人医疗救助人数-住院治疗")
    private String difficultyHospitalisation;
    @ApiModelProperty(value = "残疾人基本辅助器具适配补贴人数-补贴总人数")
    private String assistiveDeviceTotal;
    @ApiModelProperty(value = "残疾人基本辅助器具适配补贴人数-辅具一")
    private String assistiveDeviceOne;
    @ApiModelProperty(value = "残疾人基本辅助器具适配补贴人数-辅具二")
    private String assistiveDeviceTwo;
    @ApiModelProperty(value = "残疾人基本辅助器具适配补贴人数-辅具三")
    private String assistiveDeviceThree;
    @ApiModelProperty(value = "残疾人基本辅助器具适配补贴人数-其他")
    private String assistiveDeviceOther;
    @ApiModelProperty(value = "残疾人基本辅助器具适配补贴人数-类别一")
    private String assistiveDeviceTypeOne;
    @ApiModelProperty(value = "残疾人基本辅助器具适配补贴人数-类别二")
    private String assistiveDeviceTypeTwo;
    @ApiModelProperty(value = "残疾人基本辅助器具适配补贴人数-类别三")
    private String assistiveDeviceTypeThree;
    @ApiModelProperty(value = "残疾人基本辅助器具适配补贴人数-类别四")
    private String assistiveDeviceTypeFour;
    @ApiModelProperty(value = "残疾人基本辅助器具适配补贴人数-等级一")
    private String assistiveDeviceGradeOne;
    @ApiModelProperty(value = "残疾人基本辅助器具适配补贴人数-等级二")
    private String assistiveDeviceGradeTwo;
    @ApiModelProperty(value = "残疾人基本辅助器具适配补贴人数-等级三")
    private String assistiveDeviceGradeThree;
    @ApiModelProperty(value = "残疾人基本辅助器具适配补贴人数-等级四")
    private String assistiveDeviceGradeFour;
    @ApiModelProperty(value = "职业技能和实用技术培训人数")
    private String technicalTraining;
    @ApiModelProperty(value = "居家灵活就业及一次性创业补贴发放数")
    private String homeAllowance;
    @ApiModelProperty(value = "法定就业年龄段持证残疾人数占比-视力")
    private String statutoryCertificateEyesight;
    @ApiModelProperty(value = "法定就业年龄段持证残疾人数占比-智力")
    private String statutoryCertificateIntellect;
    @ApiModelProperty(value = "法定就业年龄段持证残疾人数占比-肢体")
    private String statutoryCertificateLimb;
    @ApiModelProperty(value = "法定就业年龄段持证残疾人数占比-言语")
    private String statutoryCertificateSpeech;
    @ApiModelProperty(value = "法定就业年龄段持证残疾人数占比-听力")
    private String statutoryCertificateHearing;
    @ApiModelProperty(value = "已就业残疾人数-就业")
    private String employedEmployment;
    @ApiModelProperty(value = "已就业残疾人数-集中就业")
    private String employedConcentrated;
    @ApiModelProperty(value = "已就业残疾人数-公益性岗位")
    private String employedPublicWelfare;
    @ApiModelProperty(value = "已就业残疾人数-辅助性就业")
    private String employedAuxiliary;
    @ApiModelProperty(value = "已就业残疾人数-个体就业")
    private String employedIndividual;
    @ApiModelProperty(value = "应届高校残疾毕业生数-就业")
    private String highSchoolEmployment;
    @ApiModelProperty(value = "应届高校残疾毕业生数-个体就业")
    private String highSchoolIndividual;
    @ApiModelProperty(value = "应届高校残疾毕业生数-灵活就业")
    private String highSchoolFlexible;
    @ApiModelProperty(value = "适龄残疾儿童少年义务教育-一年级")
    private String educationOne;
    @ApiModelProperty(value = "适龄残疾儿童少年义务教育-二年级")
    private String educationTwo;
    @ApiModelProperty(value = "适龄残疾儿童少年义务教育-三年级")
    private String educationThree;
    @ApiModelProperty(value = "适龄残疾儿童少年义务教育-四年级")
    private String educationFour;
    @ApiModelProperty(value = "适龄残疾儿童少年义务教育-五年级")
    private String educationFive;
    @ApiModelProperty(value = "适龄残疾儿童少年义务教育-六年级")
    private String educationSix;
    @ApiModelProperty(value = "适龄残疾儿童少年义务教育-七年级")
    private String educationSeven;
    @ApiModelProperty(value = "适龄残疾儿童少年义务教育-八年级")
    private String educationEight;
    @ApiModelProperty(value = "适龄残疾儿童少年义务教育-九年级")
    private String educationNine;
    @ApiModelProperty(value = "九年义务教育在读残疾儿童生活补贴发放数")
    private String educationSubsidy;
    @ApiModelProperty(value = "公益文体活动-开展次数")
    private String activityFrequency;
    @ApiModelProperty(value = "公益文体活动-参加人数")
    private String educationNumber;
    @ApiModelProperty(value = "服务”一件事“办件数")
    private String matter;
    @ApiModelProperty(value = "家庭医生签约增值服务数")
    private String doctorApprecitation;
    @ApiModelProperty(value = "困难重度残疾人家庭无障碍改造实施改造户数")
    private String remould;
    @ApiModelProperty(value = "残疾人接访情况-办公室接访")
    private String interviewsOffice;
    @ApiModelProperty(value = "残疾人接访情况-电话接访")
    private String interviewsPhone;
    @ApiModelProperty(value = "残疾人接访情况-上级交办")
    private String interviewsSuperior;
    @ApiModelProperty(value = "残疾人接访情况-12345交办")
    private String interviewsHotline;
}
src/main/java/com/cl/pojo/vo/DataVO.java
New file
@@ -0,0 +1,33 @@
package com.cl.pojo.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.LocalDateTime;
@Data
@ApiModel("大屏分页VO")
public class DataVO {
    @ApiModelProperty(value = "区县,1-东区,2-西区,3-仁和区,4-米易县,5-盐边县")
    private Integer county;
    @ApiModelProperty(value = "调研时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime investigateTime;
    @ApiModelProperty(value = "上报时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;
    @ApiModelProperty(value = "上报人")
    private String createName;
    @ApiModelProperty(value = "最近更新时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;
    @ApiModelProperty(value = "更新操作人")
    private String updateName;
}
src/main/java/com/cl/pojo/vo/EditDataDTO.java
New file
@@ -0,0 +1,14 @@
package com.cl.pojo.vo;
import com.cl.pojo.dto.AddDataDTO;
import lombok.Getter;
import lombok.Setter;
import javax.validation.constraints.NotNull;
@Getter
@Setter
public class EditDataDTO extends AddDataDTO {
    @NotNull(message = "修改数据id不能为空")
    private Integer id;
}
src/main/java/com/cl/pojo/vo/InstitutionVO.java
New file
@@ -0,0 +1,20 @@
package com.cl.pojo.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel("机构VO")
public class InstitutionVO {
    @ApiModelProperty(value = "机构ID")
    private Integer id;
    @ApiModelProperty(value = "机构名称")
    private String name;
    @ApiModelProperty(value = "机构类型,1-残疾人定点康复机构,2-残疾人友好医疗机构")
    private Integer type;
    @ApiModelProperty(value = "区县,1-东区,2-西区,3-仁和区,4-米易县,5-盐边县")
    private Integer county;
    @ApiModelProperty(value = "联系电话")
    private String phone;
}
src/main/java/com/cl/pojo/vo/UserVO.java
New file
@@ -0,0 +1,21 @@
package com.cl.pojo.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel("用户VO")
public class UserVO {
    @ApiModelProperty("主键")
    private Integer id;
    @ApiModelProperty("姓名")
    private String name;
    @ApiModelProperty("联系方式")
    private String phone;
    @ApiModelProperty("备注")
    private String remark;
    @ApiModelProperty("状态:0-正常,1-停用")
    private Integer status;
}
src/main/java/com/cl/pojo/vo/screen/AssistiveDeviceGradeVO.java
New file
@@ -0,0 +1,21 @@
package com.cl.pojo.vo.screen;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ApiModel("残疾人基本辅助器具适配补贴人数-等级VO")
@Data
public class AssistiveDeviceGradeVO {
    @ApiModelProperty(value = "残疾人基本辅助器具适配补贴人数-等级一")
    private Integer assistiveDeviceGradeOne;
    @ApiModelProperty(value = "残疾人基本辅助器具适配补贴人数-等级二")
    private Integer assistiveDeviceGradeTwo;
    @ApiModelProperty(value = "残疾人基本辅助器具适配补贴人数-等级三")
    private Integer assistiveDeviceGradeThree;
    @ApiModelProperty(value = "残疾人基本辅助器具适配补贴人数-等级四")
    private Integer assistiveDeviceGradeFour;
}
src/main/java/com/cl/pojo/vo/screen/AssistiveDeviceTypeVO.java
New file
@@ -0,0 +1,21 @@
package com.cl.pojo.vo.screen;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ApiModel("残疾人基本辅助器具适配补贴人数-各残疾类别VO")
@Data
public class AssistiveDeviceTypeVO {
    @ApiModelProperty(value = "残疾人基本辅助器具适配补贴人数-类别一")
    private Integer assistiveDeviceTypeOne;
    @ApiModelProperty(value = "残疾人基本辅助器具适配补贴人数-类别二")
    private Integer assistiveDeviceTypeTwo;
    @ApiModelProperty(value = "残疾人基本辅助器具适配补贴人数-类别三")
    private Integer assistiveDeviceTypeThree;
    @ApiModelProperty(value = "残疾人基本辅助器具适配补贴人数-类别四")
    private Integer assistiveDeviceTypeFour;
}
src/main/java/com/cl/pojo/vo/screen/AssistiveDeviceVO.java
New file
@@ -0,0 +1,22 @@
package com.cl.pojo.vo.screen;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ApiModel("残疾人基本辅助器具适配补贴人数-各辅具VO")
@Data
public class AssistiveDeviceVO {
    @ApiModelProperty(value = "残疾人基本辅助器具适配补贴人数-辅具一")
    private Integer assistiveDeviceOne;
    @ApiModelProperty(value = "残疾人基本辅助器具适配补贴人数-辅具二")
    private Integer assistiveDeviceTwo;
    @ApiModelProperty(value = "残疾人基本辅助器具适配补贴人数-辅具三")
    private Integer assistiveDeviceThree;
    @ApiModelProperty(value = "残疾人基本辅助器具适配补贴人数-其他")
    private Integer assistiveDeviceOther;
}
src/main/java/com/cl/pojo/vo/screen/CertificateVO.java
New file
@@ -0,0 +1,30 @@
package com.cl.pojo.vo.screen;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ApiModel("持证残疾人数VO")
@Data
public class CertificateVO {
    @ApiModelProperty(value = "持证残疾人数-视力")
    private Integer certificateEyesight;
    @ApiModelProperty(value = "持证残疾人数-智力")
    private Integer certificateIntellect;
    @ApiModelProperty(value = "持证残疾人数-肢体")
    private Integer certificateLimb;
    @ApiModelProperty(value = "持证残疾人数-言语")
    private Integer certificateSpeech;
    @ApiModelProperty(value = "持证残疾人数-听力")
    private Integer certificateHearing;
    @ApiModelProperty(value = "持证残疾人数-精神")
    private Integer certificateSpirit;
    @ApiModelProperty(value = "持证残疾人数-多重")
    private Integer certificateMultiple;
}
src/main/java/com/cl/pojo/vo/screen/DifficultyVO.java
New file
@@ -0,0 +1,15 @@
package com.cl.pojo.vo.screen;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ApiModel("困难精神残疾人医疗救助人数VO")
@Data
public class DifficultyVO {
    @ApiModelProperty(value = "困难精神残疾人医疗救助人数-门诊服药")
    private Integer difficultyMedication;
    @ApiModelProperty(value = "困难精神残疾人医疗救助人数-住院治疗")
    private Integer difficultyHospitalisation;
}
src/main/java/com/cl/pojo/vo/screen/DrillVO.java
New file
@@ -0,0 +1,27 @@
package com.cl.pojo.vo.screen;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ApiModel("残疾儿童康复训练人数VO")
@Data
public class DrillVO {
    @ApiModelProperty(value = "残疾儿童康复训练人数-孤独症")
    private Integer drillAutism;
    @ApiModelProperty(value = "残疾儿童康复训练人数-智力")
    private Integer drillIntellect;
    @ApiModelProperty(value = "残疾儿童康复训练人数-肢体")
    private Integer drillLimb;
    @ApiModelProperty(value = "残疾儿童康复训练人数-言语")
    private Integer drillSpeech;
    @ApiModelProperty(value = "残疾儿童康复训练人数-听力")
    private Integer drillHearing;
    @ApiModelProperty(value = "残疾儿童康复训练人数-精神")
    private Integer drillSpirit;
}
src/main/java/com/cl/pojo/vo/screen/EducationVO.java
New file
@@ -0,0 +1,36 @@
package com.cl.pojo.vo.screen;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ApiModel("右下角模块数据VO")
@Data
public class EducationVO {
    @ApiModelProperty(value = "适龄残疾儿童少年义务教育-一年级")
    private Integer educationOne;
    @ApiModelProperty(value = "适龄残疾儿童少年义务教育-二年级")
    private Integer educationTwo;
    @ApiModelProperty(value = "适龄残疾儿童少年义务教育-三年级")
    private Integer educationThree;
    @ApiModelProperty(value = "适龄残疾儿童少年义务教育-四年级")
    private Integer educationFour;
    @ApiModelProperty(value = "适龄残疾儿童少年义务教育-五年级")
    private Integer educationFive;
    @ApiModelProperty(value = "适龄残疾儿童少年义务教育-六年级")
    private Integer educationSix;
    @ApiModelProperty(value = "适龄残疾儿童少年义务教育-七年级")
    private Integer educationSeven;
    @ApiModelProperty(value = "适龄残疾儿童少年义务教育-八年级")
    private Integer educationEight;
    @ApiModelProperty(value = "适龄残疾儿童少年义务教育-九年级")
    private Integer educationNine;
}
src/main/java/com/cl/pojo/vo/screen/EmployedVO.java
New file
@@ -0,0 +1,24 @@
package com.cl.pojo.vo.screen;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ApiModel("已就业残疾人数VO")
@Data
public class EmployedVO {
    @ApiModelProperty(value = "已就业残疾人数-就业")
    private Integer employedEmployment;
    @ApiModelProperty(value = "已就业残疾人数-集中就业")
    private Integer employedConcentrated;
    @ApiModelProperty(value = "已就业残疾人数-公益性岗位")
    private Integer employedPublicWelfare;
    @ApiModelProperty(value = "已就业残疾人数-辅助性就业")
    private Integer employedAuxiliary;
    @ApiModelProperty(value = "已就业残疾人数-个体就业")
    private Integer employedIndividual;
}
src/main/java/com/cl/pojo/vo/screen/HighSchoolVO.java
New file
@@ -0,0 +1,18 @@
package com.cl.pojo.vo.screen;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ApiModel("应届高校残疾毕业生数VO")
@Data
public class HighSchoolVO {
    @ApiModelProperty(value = "应届高校残疾毕业生数-就业")
    private Integer highSchoolEmployment;
    @ApiModelProperty(value = "应届高校残疾毕业生数-个体就业")
    private Integer highSchoolIndividual;
    @ApiModelProperty(value = "应届高校残疾毕业生数-灵活就业")
    private Integer highSchoolFlexible;
}
src/main/java/com/cl/pojo/vo/screen/RightDownVO.java
New file
@@ -0,0 +1,36 @@
package com.cl.pojo.vo.screen;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ApiModel("大屏数据")
@Data
public class RightDownVO {
    @ApiModelProperty(value = "公益文体活动-开展次数")
    private Integer activityFrequency;
    @ApiModelProperty(value = "公益文体活动-参加人数")
    private Integer educationNumber;
    @ApiModelProperty(value = "服务”一件事“办件数")
    private Integer matter;
    @ApiModelProperty(value = "家庭医生签约增值服务数")
    private Integer doctorApprecitation;
    @ApiModelProperty(value = "困难重度残疾人家庭无障碍改造实施改造户数")
    private Integer remould;
    @ApiModelProperty(value = "残疾人接访情况-办公室接访")
    private Integer interviewsOffice;
    @ApiModelProperty(value = "残疾人接访情况-电话接访")
    private Integer interviewsPhone;
    @ApiModelProperty(value = "残疾人接访情况-上级交办")
    private Integer interviewsSuperior;
    @ApiModelProperty(value = "残疾人接访情况-12345交办")
    private Integer interviewsHotline;
}
src/main/java/com/cl/pojo/vo/screen/SalvationVO.java
New file
@@ -0,0 +1,27 @@
package com.cl.pojo.vo.screen;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ApiModel("残疾儿童康复救助人数VO")
@Data
public class SalvationVO {
    @ApiModelProperty(value = "残疾儿童康复救助人数-0-6岁")
    private Integer salvationBeforeSeven;
    @ApiModelProperty(value = "残疾儿童康复救助人数-7岁之后")
    private Integer salvationAfterSeven;
    @ApiModelProperty(value = "残疾儿童康复救助人数-孤独症")
    private Integer salvationAutism;
    @ApiModelProperty(value = "残疾儿童康复救助人数-智力")
    private Integer salvationIntellect;
    @ApiModelProperty(value = "残疾儿童康复救助人数-肢体")
    private Integer salvationLimb;
    @ApiModelProperty(value = "残疾儿童康复救助人数-言语")
    private Integer salvationSpeech;
}
src/main/java/com/cl/pojo/vo/screen/ScreenVO.java
New file
@@ -0,0 +1,62 @@
package com.cl.pojo.vo.screen;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.LocalDateTime;
import java.util.Date;
@ApiModel("大屏数据")
@Data
public class ScreenVO {
    @ApiModelProperty("持证残疾人数")
    private CertificateVO certificateVO;
    @ApiModelProperty("残疾人工作者队伍人数")
    private WorkerVO workerVO;
    @ApiModelProperty("残疾儿童康复训练人数")
    private DrillVO drillVO;
    @ApiModelProperty("残疾儿童康复救助人数")
    private SalvationVO salvationVO;
    @ApiModelProperty("困难精神残疾人医疗救助人数")
    private DifficultyVO difficultyVO;
    @ApiModelProperty(value = "残疾人基本辅助器具适配补贴人数-补贴总人数")
    private Integer assistiveDeviceTotal;
    @ApiModelProperty(value = "残疾人基本辅助器具适配补贴人数-旁边时间")
    @JsonFormat(pattern = "yyyy")
    private LocalDateTime createTime;
    @ApiModelProperty(value = "残疾人基本辅助器具适配补贴人数-各辅具")
    private AssistiveDeviceVO assistiveDeviceVO;
    @ApiModelProperty(value = "残疾人基本辅助器具适配补贴人数-各残疾类别")
    private AssistiveDeviceTypeVO assistiveDeviceTypeVO;
    @ApiModelProperty(value = "残疾人基本辅助器具适配补贴人数-各残疾等级")
    private AssistiveDeviceGradeVO assistiveDeviceGradeVO;
    @ApiModelProperty(value = "职业技能和实用技术培训人数")
    private Integer technicalTraining;
    @ApiModelProperty(value = "居家灵活就业及一次性创业补贴发放数")
    private Integer homeAllowance;
    @ApiModelProperty(value = "法定就业年龄段持证残疾人数占比")
    private StatutoryCertificateVO statutoryCertificateVO;
    @ApiModelProperty(value = "已就业残疾人数")
    private EmployedVO employedVO;
    @ApiModelProperty(value = "应届高校残疾毕业生数")
    private HighSchoolVO highSchoolVO;
    @ApiModelProperty(value = "适龄残疾儿童少年义务教育")
    private EducationVO educationVO;
    @ApiModelProperty(value = "九年义务教育在读残疾儿童生活补贴发放数")
    private Integer educationSubsidy;
    @ApiModelProperty(value = "右下角模块数据")
    private RightDownVO rightDownVO;
}
src/main/java/com/cl/pojo/vo/screen/StatutoryCertificateVO.java
New file
@@ -0,0 +1,24 @@
package com.cl.pojo.vo.screen;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ApiModel("法定就业年龄段持证残疾人数占比VO")
@Data
public class StatutoryCertificateVO {
    @ApiModelProperty(value = "法定就业年龄段持证残疾人数占比-视力")
    private Integer statutoryCertificateEyesight;
    @ApiModelProperty(value = "法定就业年龄段持证残疾人数占比-智力")
    private Integer statutoryCertificateIntellect;
    @ApiModelProperty(value = "法定就业年龄段持证残疾人数占比-肢体")
    private Integer statutoryCertificateLimb;
    @ApiModelProperty(value = "法定就业年龄段持证残疾人数占比-言语")
    private Integer statutoryCertificateSpeech;
    @ApiModelProperty(value = "法定就业年龄段持证残疾人数占比-听力")
    private Integer statutoryCertificateHearing;
}
src/main/java/com/cl/pojo/vo/screen/WorkerVO.java
New file
@@ -0,0 +1,27 @@
package com.cl.pojo.vo.screen;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ApiModel("残疾人工作者队伍人数VO")
@Data
public class WorkerVO {
    @ApiModelProperty(value = "残疾人工作者队伍人数-市残联")
    private Integer workerCity;
    @ApiModelProperty(value = "残疾人工作者队伍人数-五大专门协会")
    private Integer workerAssociation;
    @ApiModelProperty(value = "残疾人工作者队伍人数-攀狮服务队")
    private Integer workerServiceCorps;
    @ApiModelProperty(value = "残疾人工作者队伍人数-县区残联")
    private Integer workerCounty;
    @ApiModelProperty(value = "残疾人工作者队伍人数-乡镇残联")
    private Integer workerTownship;
    @ApiModelProperty(value = "残疾人工作者队伍人数-村社区残联")
    private Integer workerVillage;
}
src/main/java/com/cl/service/DataService.java
New file
@@ -0,0 +1,25 @@
package com.cl.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.cl.pojo.dto.AddDataDTO;
import com.cl.pojo.entity.DataEntity;
import com.cl.pojo.vo.DataDetailVO;
import com.cl.pojo.vo.DataVO;
import com.cl.pojo.vo.EditDataDTO;
import com.cl.pojo.vo.screen.ScreenVO;
public interface DataService  extends IService<DataEntity> {
    ScreenVO screen(Integer county);
    void add( AddDataDTO addDataDTO);
    IPage<DataVO> pageList(IPage<DataEntity> page,  Integer county, String name);
    void delete(Integer id);
    void edit( EditDataDTO editDataDTO);
    DataDetailVO detail(Integer id);
}
src/main/java/com/cl/service/InstitutionService.java
New file
@@ -0,0 +1,25 @@
package com.cl.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.cl.pojo.dto.AddInstitutionDTO;
import com.cl.pojo.dto.EditInstitutionDTO;
import com.cl.pojo.entity.Institution;
import com.cl.pojo.vo.InstitutionVO;
import javax.validation.Valid;
import java.util.List;
public interface InstitutionService  extends IService<Institution> {
    void add(@Valid AddInstitutionDTO addDTO);
    IPage<InstitutionVO> pageList(IPage<Institution> page, Integer county, String name);
    InstitutionVO read(Integer id);
    void edit(@Valid EditInstitutionDTO editDTO);
    void delete(Integer id);
    List<InstitutionVO> getAll(Integer county);
}
src/main/java/com/cl/service/UserService.java
New file
@@ -0,0 +1,27 @@
package com.cl.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.cl.pojo.dto.AddUserDTO;
import com.cl.pojo.dto.EditUserDTO;
import com.cl.pojo.dto.PasswordDTO;
import com.cl.pojo.entity.User;
import com.cl.pojo.vo.UserVO;
import javax.validation.Valid;
public interface UserService  extends IService<User> {
    void addUser(AddUserDTO addUserDTO);
    IPage<UserVO> pageList(IPage<User> page, String name, String phone);
    void editUser(@Valid EditUserDTO editUserDTO);
    void password(PasswordDTO passwordDTO,String token);
    void resetPassword(Integer id);
    void frozen(Integer id);
}
src/main/java/com/cl/service/impl/DataServiceImpl.java
New file
@@ -0,0 +1,281 @@
package com.cl.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cl.common.constant.DelFlagConstant;
import com.cl.common.context.BaseContext;
import com.cl.common.exception.data.DataException;
import com.cl.mapper.DataMapper;
import com.cl.pojo.dto.AddDataDTO;
import com.cl.pojo.entity.DataEntity;
import com.cl.pojo.vo.DataDetailVO;
import com.cl.pojo.vo.DataRateVO;
import com.cl.pojo.vo.DataVO;
import com.cl.pojo.vo.EditDataDTO;
import com.cl.pojo.vo.screen.*;
import com.cl.service.DataService;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import java.text.DecimalFormat;
import java.time.LocalDateTime;
@Service
public class DataServiceImpl extends ServiceImpl<DataMapper, DataEntity> implements DataService {
    private final DataMapper dataMapper;
    public DataServiceImpl(DataMapper dataMapper) {
        this.dataMapper = dataMapper;
    }
    @Override
    public ScreenVO screen(Integer county) {
        ScreenVO screenVO = new ScreenVO();
        DataEntity data =dataMapper.screen(county);
        screenVO.setAssistiveDeviceTotal(data.getAssistiveDeviceTotal());
        screenVO.setCreateTime(data.getCreateTime());
        screenVO.setTechnicalTraining(data.getTechnicalTraining());
        screenVO.setHomeAllowance(data.getHomeAllowance());
        screenVO.setEducationSubsidy(data.getEducationSubsidy());
        CertificateVO certificateVO = new CertificateVO();
        BeanUtils.copyProperties(data,certificateVO);
        screenVO.setCertificateVO(certificateVO);
        WorkerVO workerVO = new WorkerVO();
        BeanUtils.copyProperties(data,workerVO);
        screenVO.setWorkerVO(workerVO);
        DrillVO drillVO = new DrillVO();
        BeanUtils.copyProperties(data,drillVO);
        screenVO.setDrillVO(drillVO);
        SalvationVO salvationVO = new SalvationVO();
        BeanUtils.copyProperties(data,salvationVO);
        screenVO.setSalvationVO(salvationVO);
        DifficultyVO difficultyVO = new DifficultyVO();
        BeanUtils.copyProperties(data,difficultyVO);
        screenVO.setDifficultyVO(difficultyVO);
        AssistiveDeviceVO assistiveDeviceVO = new AssistiveDeviceVO();
        BeanUtils.copyProperties(data,assistiveDeviceVO);
        screenVO.setAssistiveDeviceVO(assistiveDeviceVO);
        AssistiveDeviceTypeVO assistiveDeviceTypeVO = new AssistiveDeviceTypeVO();
        BeanUtils.copyProperties(data,assistiveDeviceTypeVO);
        screenVO.setAssistiveDeviceTypeVO(assistiveDeviceTypeVO);
        AssistiveDeviceGradeVO assistiveDeviceGradeVO = new AssistiveDeviceGradeVO();
        BeanUtils.copyProperties(data,assistiveDeviceGradeVO);
        screenVO.setAssistiveDeviceGradeVO(assistiveDeviceGradeVO);
        StatutoryCertificateVO statutoryCertificateVO = new StatutoryCertificateVO();
        BeanUtils.copyProperties(data,statutoryCertificateVO);
        screenVO.setStatutoryCertificateVO(statutoryCertificateVO);
        EmployedVO employedVO = new EmployedVO();
        BeanUtils.copyProperties(data,employedVO);
        screenVO.setEmployedVO(employedVO);
        HighSchoolVO highSchoolVO = new HighSchoolVO();
        BeanUtils.copyProperties(data,highSchoolVO);
        screenVO.setHighSchoolVO(highSchoolVO);
        EducationVO educationVO = new EducationVO();
        BeanUtils.copyProperties(data,educationVO);
        screenVO.setEducationVO(educationVO);
        RightDownVO rightDownVO = new RightDownVO();
        BeanUtils.copyProperties(data,rightDownVO);
        screenVO.setRightDownVO(rightDownVO);
        return screenVO;
    }
    @Override
    public void add(AddDataDTO addDataDTO) {
        DataEntity dataEntity = new DataEntity();
        BeanUtils.copyProperties(addDataDTO,dataEntity);
        dataEntity.setCreateTime(LocalDateTime.now());
        dataEntity.setCreateBy(BaseContext.getCurrentUser().getId());
        int insert = dataMapper.insert(dataEntity);
        if (insert != 1) {
            throw new DataException("保存数据失败");
        }
    }
    @Override
    public IPage<DataVO> pageList(IPage<DataEntity> page, Integer county, String name) {
        return dataMapper.pageList(page,county,name);
    }
    @Override
    public void delete(Integer id) {
        LambdaQueryWrapper<DataEntity> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(DataEntity::getId,id);
        queryWrapper.eq(DataEntity::getDelFlag, DelFlagConstant.UNDELETE);
        DataEntity dataEntity = dataMapper.selectOne(queryWrapper);
        if (dataEntity == null) {
            throw new DataException("删除数据失败,数据不存在");
        }
        dataEntity.setDelFlag(DelFlagConstant.DELETE);
        dataEntity.setUpdateTime(LocalDateTime.now());
        dataEntity.setUpdateBy(BaseContext.getCurrentUser().getId());
        int i = dataMapper.updateById(dataEntity);
        if (i != 1) {
            throw new DataException("删除失败");
        }
    }
    @Override
    public void edit(EditDataDTO editDataDTO) {
        LambdaQueryWrapper<DataEntity> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(DataEntity::getId,editDataDTO.getId());
        queryWrapper.eq(DataEntity::getDelFlag, DelFlagConstant.UNDELETE);
        DataEntity data = dataMapper.selectOne(queryWrapper);
        if (data == null) {
            throw new DataException("修改数据失败,数据id不存在");
        }
        DataEntity dataEntity = new DataEntity();
        BeanUtils.copyProperties(editDataDTO,dataEntity);
        dataEntity.setUpdateTime(LocalDateTime.now());
        dataEntity.setUpdateBy(BaseContext.getCurrentUser().getId());
        int i = dataMapper.updateById(dataEntity);
        if (i != 1) {
            throw new DataException("修改失败");
        }
    }
    @Override
    public DataDetailVO detail(Integer id) {
        LambdaQueryWrapper<DataEntity> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(DataEntity::getId,id);
        queryWrapper.eq(DataEntity::getDelFlag, DelFlagConstant.UNDELETE);
        DataEntity dataEntity = dataMapper.selectOne(queryWrapper);
        if (dataEntity == null) {
            throw new DataException("该条数据不存在");
        }
        DataDetailVO dataDetailVO = new DataDetailVO();
        //当前数据
        EditDataDTO data=new EditDataDTO();
        BeanUtils.copyProperties(dataEntity,data);
        dataDetailVO.setData(data);
        //当前数据的前一条数据
        EditDataDTO beforeData=new EditDataDTO();
        DataEntity beforeDataEntity= dataMapper.beforeOne(id);
        if (beforeDataEntity != null) {
            BeanUtils.copyProperties(beforeDataEntity,beforeData);
        }
        dataDetailVO.setBeforeData(beforeData);
        //计算比率
        DataRateVO dataRateVO = getRateVO(data,beforeData);
        dataDetailVO.setRateVO(dataRateVO);
        return dataDetailVO;
    }
    private DataRateVO getRateVO(EditDataDTO data, EditDataDTO beforeData) {
        if (beforeData == null || beforeData.equals(new EditDataDTO())) {
            return null;
        }
        DataRateVO dataRateVO = new DataRateVO();
        //计算每个字段
        dataRateVO.setCertificateEyesight(calcRate(data.getCertificateEyesight(),beforeData.getCertificateEyesight()));
        dataRateVO.setCertificateIntellect(calcRate(data.getCertificateIntellect(),beforeData.getCertificateIntellect()));
        dataRateVO.setCertificateLimb(calcRate(data.getCertificateLimb(),beforeData.getCertificateLimb()));
        dataRateVO.setCertificateSpeech(calcRate(data.getCertificateSpeech(), beforeData.getCertificateSpeech()));
        dataRateVO.setCertificateHearing(calcRate(data.getCertificateHearing(), beforeData.getCertificateHearing()));
        dataRateVO.setCertificateSpirit(calcRate(data.getCertificateSpirit(), beforeData.getCertificateSpirit()));
        dataRateVO.setCertificateMultiple(calcRate(data.getCertificateMultiple(), beforeData.getCertificateMultiple()));
        dataRateVO.setWorkerCity(calcRate(data.getWorkerCity(), beforeData.getWorkerCity()));
        dataRateVO.setWorkerAssociation(calcRate(data.getWorkerAssociation(), beforeData.getWorkerAssociation()));
        dataRateVO.setWorkerServiceCorps(calcRate(data.getWorkerServiceCorps(), beforeData.getWorkerServiceCorps()));
        dataRateVO.setWorkerCounty(calcRate(data.getWorkerCounty(), beforeData.getWorkerCounty()));
        dataRateVO.setWorkerTownship(calcRate(data.getWorkerTownship(), beforeData.getWorkerTownship()));
        dataRateVO.setWorkerVillage(calcRate(data.getWorkerVillage(), beforeData.getWorkerVillage()));
        dataRateVO.setDrillAutism(calcRate(data.getDrillAutism(), beforeData.getDrillAutism()));
        dataRateVO.setDrillIntellect(calcRate(data.getDrillIntellect(), beforeData.getDrillIntellect()));
        dataRateVO.setDrillLimb(calcRate(data.getDrillLimb(), beforeData.getDrillLimb()));
        dataRateVO.setDrillSpeech(calcRate(data.getDrillSpeech(), beforeData.getDrillSpeech()));
        dataRateVO.setDrillHearing(calcRate(data.getDrillHearing(), beforeData.getDrillHearing()));
        dataRateVO.setDrillSpirit(calcRate(data.getDrillSpirit(), beforeData.getDrillSpirit()));
        dataRateVO.setSalvationBeforeSeven(calcRate(data.getSalvationBeforeSeven(), beforeData.getSalvationBeforeSeven()));
        dataRateVO.setSalvationAfterSeven(calcRate(data.getSalvationAfterSeven(), beforeData.getSalvationAfterSeven()));
        dataRateVO.setSalvationAutism(calcRate(data.getSalvationAutism(), beforeData.getSalvationAutism()));
        dataRateVO.setSalvationIntellect(calcRate(data.getSalvationIntellect(), beforeData.getSalvationIntellect()));
        dataRateVO.setSalvationLimb(calcRate(data.getSalvationLimb(), beforeData.getSalvationLimb()));
        dataRateVO.setSalvationSpeech(calcRate(data.getSalvationSpeech(), beforeData.getSalvationSpeech()));
        dataRateVO.setDifficultyMedication(calcRate(data.getDifficultyMedication(), beforeData.getDifficultyMedication()));
        dataRateVO.setDifficultyHospitalisation(calcRate(data.getDifficultyHospitalisation(), beforeData.getDifficultyHospitalisation()));
        dataRateVO.setAssistiveDeviceTotal(calcRate(data.getAssistiveDeviceTotal(), beforeData.getAssistiveDeviceTotal()));
        dataRateVO.setAssistiveDeviceOne(calcRate(data.getAssistiveDeviceOne(), beforeData.getAssistiveDeviceOne()));
        dataRateVO.setAssistiveDeviceTwo(calcRate(data.getAssistiveDeviceTwo(), beforeData.getAssistiveDeviceTwo()));
        dataRateVO.setAssistiveDeviceThree(calcRate(data.getAssistiveDeviceThree(), beforeData.getAssistiveDeviceThree()));
        dataRateVO.setAssistiveDeviceOther(calcRate(data.getAssistiveDeviceOther(), beforeData.getAssistiveDeviceOther()));
        dataRateVO.setAssistiveDeviceTypeOne(calcRate(data.getAssistiveDeviceTypeOne(), beforeData.getAssistiveDeviceTypeOne()));
        dataRateVO.setAssistiveDeviceTypeTwo(calcRate(data.getAssistiveDeviceTypeTwo(), beforeData.getAssistiveDeviceTypeTwo()));
        dataRateVO.setAssistiveDeviceTypeThree(calcRate(data.getAssistiveDeviceTypeThree(), beforeData.getAssistiveDeviceTypeThree()));
        dataRateVO.setAssistiveDeviceTypeFour(calcRate(data.getAssistiveDeviceTypeFour(), beforeData.getAssistiveDeviceTypeFour()));
        dataRateVO.setAssistiveDeviceGradeOne(calcRate(data.getAssistiveDeviceGradeOne(), beforeData.getAssistiveDeviceGradeOne()));
        dataRateVO.setAssistiveDeviceGradeTwo(calcRate(data.getAssistiveDeviceGradeTwo(), beforeData.getAssistiveDeviceGradeTwo()));
        dataRateVO.setAssistiveDeviceGradeThree(calcRate(data.getAssistiveDeviceGradeThree(), beforeData.getAssistiveDeviceGradeThree()));
        dataRateVO.setAssistiveDeviceGradeFour(calcRate(data.getAssistiveDeviceGradeFour(), beforeData.getAssistiveDeviceGradeFour()));
        dataRateVO.setTechnicalTraining(calcRate(data.getTechnicalTraining(), beforeData.getTechnicalTraining()));
        dataRateVO.setHomeAllowance(calcRate(data.getHomeAllowance(), beforeData.getHomeAllowance()));
        dataRateVO.setStatutoryCertificateEyesight(calcRate(data.getStatutoryCertificateEyesight(), beforeData.getStatutoryCertificateEyesight()));
        dataRateVO.setStatutoryCertificateIntellect(calcRate(data.getStatutoryCertificateIntellect(), beforeData.getStatutoryCertificateIntellect()));
        dataRateVO.setStatutoryCertificateLimb(calcRate(data.getStatutoryCertificateLimb(), beforeData.getStatutoryCertificateLimb()));
        dataRateVO.setStatutoryCertificateSpeech(calcRate(data.getStatutoryCertificateSpeech(), beforeData.getStatutoryCertificateSpeech()));
        dataRateVO.setStatutoryCertificateHearing(calcRate(data.getStatutoryCertificateHearing(), beforeData.getStatutoryCertificateHearing()));
        dataRateVO.setEmployedEmployment(calcRate(data.getEmployedEmployment(), beforeData.getEmployedEmployment()));
        dataRateVO.setEmployedConcentrated(calcRate(data.getEmployedConcentrated(), beforeData.getEmployedConcentrated()));
        dataRateVO.setEmployedPublicWelfare(calcRate(data.getEmployedPublicWelfare(), beforeData.getEmployedPublicWelfare()));
        dataRateVO.setEmployedAuxiliary(calcRate(data.getEmployedAuxiliary(), beforeData.getEmployedAuxiliary()));
        dataRateVO.setEmployedIndividual(calcRate(data.getEmployedIndividual(), beforeData.getEmployedIndividual()));
        dataRateVO.setHighSchoolEmployment(calcRate(data.getHighSchoolEmployment(), beforeData.getHighSchoolEmployment()));
        dataRateVO.setHighSchoolIndividual(calcRate(data.getHighSchoolIndividual(), beforeData.getHighSchoolIndividual()));
        dataRateVO.setHighSchoolFlexible(calcRate(data.getHighSchoolFlexible(), beforeData.getHighSchoolFlexible()));
        dataRateVO.setEducationOne(calcRate(data.getEducationOne(), beforeData.getEducationOne()));
        dataRateVO.setEducationTwo(calcRate(data.getEducationTwo(), beforeData.getEducationTwo()));
        dataRateVO.setEducationThree(calcRate(data.getEducationThree(), beforeData.getEducationThree()));
        dataRateVO.setEducationFour(calcRate(data.getEducationFour(), beforeData.getEducationFour()));
        dataRateVO.setEducationFive(calcRate(data.getEducationFive(), beforeData.getEducationFive()));
        dataRateVO.setEducationSix(calcRate(data.getEducationSix(), beforeData.getEducationSix()));
        dataRateVO.setEducationSeven(calcRate(data.getEducationSeven(), beforeData.getEducationSeven()));
        dataRateVO.setEducationEight(calcRate(data.getEducationEight(), beforeData.getEducationEight()));
        dataRateVO.setEducationNine(calcRate(data.getEducationNine(), beforeData.getEducationNine()));
        dataRateVO.setEducationSubsidy(calcRate(data.getEducationSubsidy(), beforeData.getEducationSubsidy()));
        dataRateVO.setActivityFrequency(calcRate(data.getActivityFrequency(), beforeData.getActivityFrequency()));
        dataRateVO.setEducationNumber(calcRate(data.getEducationNumber(), beforeData.getEducationNumber()));
        dataRateVO.setMatter(calcRate(data.getMatter(), beforeData.getMatter()));
        dataRateVO.setDoctorApprecitation(calcRate(data.getDoctorApprecitation(), beforeData.getDoctorApprecitation()));
        dataRateVO.setRemould(calcRate(data.getRemould(), beforeData.getRemould()));
        dataRateVO.setInterviewsOffice(calcRate(data.getInterviewsOffice(), beforeData.getInterviewsOffice()));
        dataRateVO.setInterviewsPhone(calcRate(data.getInterviewsPhone(), beforeData.getInterviewsPhone()));
        dataRateVO.setInterviewsSuperior(calcRate(data.getInterviewsSuperior(), beforeData.getInterviewsSuperior()));
        dataRateVO.setInterviewsHotline(calcRate(data.getInterviewsHotline(), beforeData.getInterviewsHotline()));
        return dataRateVO;
    }
    private String calcRate(Integer currentValue, Integer previousValue) {
        //去年的数据为0的情况
        if (previousValue == 0){
            return currentValue == 0 ? "同比持平" : "无同比数据";
        }
        // 计算变化率
        double changeRate = (currentValue - previousValue) * 100.0 / previousValue;
        // 格式化输出(保留两位小数,带正负号)
        DecimalFormat df = new DecimalFormat("0.00");
        String absoluteValue = df.format(Math.abs(changeRate));
        if (changeRate > 0) {
            return "同比增加" + absoluteValue + "%";
        } else if (changeRate < 0) {
            return "同比减少" + absoluteValue + "%";
        } else {
            return "同比持平";
        }
    }
}
src/main/java/com/cl/service/impl/InstitutionServiceImpl.java
New file
@@ -0,0 +1,103 @@
package com.cl.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cl.common.constant.DelFlagConstant;
import com.cl.common.context.BaseContext;
import com.cl.common.exception.institution.InstitutionException;
import com.cl.mapper.InstitutionMapper;
import com.cl.pojo.dto.AddInstitutionDTO;
import com.cl.pojo.dto.EditInstitutionDTO;
import com.cl.pojo.entity.Institution;
import com.cl.pojo.vo.InstitutionVO;
import com.cl.service.InstitutionService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.util.List;
@Service
public class InstitutionServiceImpl extends ServiceImpl<InstitutionMapper, Institution> implements InstitutionService {
    @Autowired
    private InstitutionMapper institutionMapper;
    @Override
    public void add(AddInstitutionDTO addDTO) {
        Institution institution = new Institution();
        BeanUtils.copyProperties(addDTO, institution);
        institution.setCreateBy(BaseContext.getCurrentUser().getId());
        institution.setCreateTime(LocalDateTime.now());
        boolean save = this.save(institution);
        if (!save) {
            throw new InstitutionException("机构新增保存失败");
        }
    }
    @Override
    public IPage<InstitutionVO> pageList(IPage<Institution> page, Integer county, String name) {
        return institutionMapper.pageList(page,county,name);
    }
    @Override
    public InstitutionVO read(Integer id) {
        LambdaQueryWrapper<Institution> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(Institution::getId, id);
        queryWrapper.eq(Institution::getDelFlag, DelFlagConstant.UNDELETE);
        Institution institution = institutionMapper.selectOne(queryWrapper);
        if (institution == null) {
            throw new InstitutionException("机构id不存在");
        }
        InstitutionVO institutionVO = new InstitutionVO();
        BeanUtils.copyProperties(institution, institutionVO);
        return institutionVO;
    }
    @Override
    public void edit(EditInstitutionDTO editDTO) {
        LambdaQueryWrapper<Institution> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(Institution::getId, editDTO.getId());
        queryWrapper.eq(Institution::getDelFlag, DelFlagConstant.UNDELETE);
        Institution institution = institutionMapper.selectOne(queryWrapper);
        if (institution == null) {
            throw new InstitutionException("机构id不存在");
        }
        institution.setCounty(editDTO.getCounty());
        institution.setType(editDTO.getType());
        institution.setName(editDTO.getName());
        institution.setAddress(editDTO.getAddress());
        institution.setPhone(editDTO.getPhone());
        institution.setUpdateBy(BaseContext.getCurrentUser().getId());
        institution.setUpdateTime(LocalDateTime.now());
        int i = institutionMapper.updateById(institution);
        if (i != 1) {
            throw new InstitutionException("机构信息更新失败");
        }
    }
    @Override
    public void delete(Integer id) {
        LambdaQueryWrapper<Institution> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(Institution::getId, id);
        queryWrapper.eq(Institution::getDelFlag, DelFlagConstant.UNDELETE);
        Institution institution = institutionMapper.selectOne(queryWrapper);
        if (institution == null) {
            throw new InstitutionException("机构id不存在");
        }
        institution.setDelFlag(DelFlagConstant.DELETE);
        institution.setUpdateBy(BaseContext.getCurrentUser().getId());
        institution.setUpdateTime(LocalDateTime.now());
        int i = institutionMapper.updateById(institution);
        if (i != 1) {
            throw new InstitutionException("删除机构信息失败");
        }
    }
    @Override
    public List<InstitutionVO> getAll(Integer county) {
        return institutionMapper.getAll(county);
    }
}
src/main/java/com/cl/service/impl/TokenBlacklistService.java
New file
@@ -0,0 +1,25 @@
package com.cl.service.impl;
import org.springframework.stereotype.Service;
import java.util.Collections;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
@Service
public class TokenBlacklistService {
    // 使用ConcurrentHashMap或Redis存储黑名单
    private final Set<String> blacklist = Collections.newSetFromMap(new ConcurrentHashMap<>());
    public void addToBlacklist(String token) {
        blacklist.add(token);
    }
    public boolean isBlacklisted(String token) {
        return blacklist.contains(token);
    }
}
src/main/java/com/cl/service/impl/UserServiceImpl.java
New file
@@ -0,0 +1,146 @@
package com.cl.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cl.common.constant.DelFlagConstant;
import com.cl.common.constant.StatusConstant;
import com.cl.common.context.BaseContext;
import com.cl.common.exception.user.AddUserException;
import com.cl.common.exception.user.UserException;
import com.cl.mapper.UserMapper;
import com.cl.pojo.dto.AddUserDTO;
import com.cl.pojo.dto.EditUserDTO;
import com.cl.pojo.dto.PasswordDTO;
import com.cl.pojo.entity.User;
import com.cl.pojo.vo.UserVO;
import com.cl.service.UserService;
import com.cl.util.BCryptPasswordEncoder;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.codec.digest.DigestUtils;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.util.Objects;
@Service
@Slf4j
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {
    private final UserMapper userMapper;
    private final TokenBlacklistService tokenBlacklistService;
    public UserServiceImpl(UserMapper userMapper, TokenBlacklistService tokenBlacklistService) {
        this.userMapper = userMapper;
        this.tokenBlacklistService = tokenBlacklistService;
    }
    @Override
    public void addUser(AddUserDTO addUserDTO) {
        String phone = addUserDTO.getPhone();
        //查询手机号是否存在
        User user1 = userMapper.selectOne(new LambdaQueryWrapper<User>().eq(User::getPhone, phone)
                .eq(User::getDelFlag, DelFlagConstant.UNDELETE));
        if (user1 != null) {
            throw new AddUserException("该用户已存在");
        }
        log.info("开始添加用户:{}",addUserDTO);
        User user = new User();
        user.setPhone(phone);
        user.setName(addUserDTO.getName());
        user.setRemark(addUserDTO.getRemark());
        user.setPassword(BCryptPasswordEncoder.encode(DigestUtils.md5Hex(phone.substring(phone.length() - 6))));
        user.setCreateBy(BaseContext.getCurrentUser().getId());
        user.setCreateTime(LocalDateTime.now());
        boolean save = this.save(user);
        if (!save) {
            throw new UserException("新增用户失败");
        }
    }
    @Override
    public IPage<UserVO> pageList(IPage<User> page, String name, String phone) {
        return userMapper.pageList(page,name,phone);
    }
    @Override
    public void editUser(EditUserDTO editUserDTO) {
        User user = userMapper.selectById(editUserDTO.getId());
        if (user == null) {
            throw new UserException("该用户不存在");
        }
        LambdaUpdateWrapper<User> updateWrapper= new LambdaUpdateWrapper<>();
        updateWrapper.eq(User::getId, editUserDTO.getId());
        updateWrapper.set(User::getName, editUserDTO.getName());
        User phoneUser = userMapper.selectOne(new LambdaQueryWrapper<User>().eq(User::getPhone, editUserDTO.getPhone())
                .eq(User::getDelFlag, DelFlagConstant.UNDELETE)
                .ne(User::getId, editUserDTO.getId()));
        if (phoneUser != null) {
            throw new UserException("该手机号用户已存在");
        }
        updateWrapper.set(User::getPhone, editUserDTO.getPhone());
        updateWrapper.set(User::getRemark, editUserDTO.getRemark());
        updateWrapper.set(User::getUpdateBy, BaseContext.getCurrentUser().getPhone());
        updateWrapper.set(User::getUpdateTime, LocalDateTime.now());
        int update = userMapper.update(new User(), updateWrapper);
        if (update != 1) {
            throw new UserException("修改用户失败");
        }
    }
    @Override
    public void password(PasswordDTO passwordDTO,String token) {
        User user = userMapper.selectById(BaseContext.getCurrentUser().getId());
        //校验原密码
        if (!BCryptPasswordEncoder.matches(passwordDTO.getPassword(), user.getPassword())) {
            //不通过
            throw new UserException("原密码错误");
        }
        //修改密码
        user.setPassword(BCryptPasswordEncoder.encode(passwordDTO.getNewPassword()));
        user.setUpdateBy(user.getId());
        user.setUpdateTime(LocalDateTime.now());
        boolean save = this.save(user);
        if (!save) {
            throw new UserException("修改密码失败");
        }
        //将令牌加入黑名单
        tokenBlacklistService.addToBlacklist(token);
    }
    @Override
    public void resetPassword(Integer id) {
        User user = userMapper.selectById(id);
        if (null==user){
            throw new UserException("该用户不存在");
        }
        user.setPassword(BCryptPasswordEncoder.encode(DigestUtils.md5Hex(user.getPhone().substring(user.getPhone().length() - 6))));
        user.setIsFirst(1);
        user.setUpdateBy(BaseContext.getCurrentUser().getId());
        user.setUpdateTime(LocalDateTime.now());
        boolean save = this.save(user);
        if (!save) {
            throw new UserException("重置密码失败");
        }
    }
    @Override
    public void frozen(Integer id) {
        User user = userMapper.selectById(id);
        if (null==user){
            throw new UserException("用户不存在");
        }
        user.setStatus(Objects.equals(user.getStatus(), StatusConstant.DISABLE) ? StatusConstant.ENABLE : StatusConstant.DISABLE);
        user.setUpdateBy(BaseContext.getCurrentUser().getId());
        user.setUpdateTime(LocalDateTime.now());
        boolean save = this.save(user);
        if (!save) {
            throw new UserException("冻结/解冻用户失败");
        }
    }
}
src/main/java/com/cl/util/BCryptPasswordEncoder.java
New file
@@ -0,0 +1,23 @@
package com.cl.util;
import org.apache.commons.codec.digest.DigestUtils;
import org.mindrot.jbcrypt.BCrypt;
public class BCryptPasswordEncoder {
    // 加密密码(自动生成盐值)
    public static String encode(String rawPassword) {
        return BCrypt.hashpw(rawPassword, BCrypt.gensalt());
    }
    // 验证密码
    public static boolean matches(String rawPassword, String encodedPassword) {
        return BCrypt.checkpw(rawPassword, encodedPassword);
    }
    public static void main(String[] args) {
        BCryptPasswordEncoder encoder = new BCryptPasswordEncoder();
        System.out.println(encoder.encode("123456"));
        System.out.println(DigestUtils.md5Hex("111111"));
    }
}
src/main/java/com/cl/util/JwtUtil.java
New file
@@ -0,0 +1,69 @@
package com.cl.util;
import io.jsonwebtoken.Claims;
import io.jsonwebtoken.JwtBuilder;
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import java.nio.charset.StandardCharsets;
import java.util.Date;
import java.util.Map;
@Component
public class JwtUtil {
    /**
     * 用户生成jwt令牌相关配置
     */
    private static final String secretKey = "xx";
    private static final long ttl =7200000;
    private static final String tokenName = "Authorization";
    /**
     * 生成jwt
     * 使用Hs256算法, 私匙使用固定秘钥
     * @param claims    设置的信息
     * @return
     */
    public static String createJWT( Map<String, Object> claims) {
        // 指定签名的时候使用的签名算法,也就是header那部分
        SignatureAlgorithm signatureAlgorithm = SignatureAlgorithm.HS256;
        // 生成JWT的时间
        long expMillis = System.currentTimeMillis() + ttl;
        Date exp = new Date(expMillis);
        // 设置jwt的body
        JwtBuilder builder = Jwts.builder()
                // 如果有私有声明,一定要先设置这个自己创建的私有的声明,这个是给builder的claim赋值,一旦写在标准的声明赋值之后,就是覆盖了那些标准的声明的
                .setClaims(claims)
                // 设置签名使用的签名算法和签名使用的秘钥
                .signWith(signatureAlgorithm, secretKey.getBytes(StandardCharsets.UTF_8))
                // 设置过期时间
                .setExpiration(exp);
        return builder.compact();
    }
    /**
     * Token解密
     * @param token     加密后的token
     * @return
     */
    public static Claims parseJWT( String token) {
        // 得到DefaultJwtParser
        Claims claims = Jwts.parser()
                // 设置签名的秘钥
                .setSigningKey(secretKey.getBytes(StandardCharsets.UTF_8))
                // 设置需要解析的jwt
                .parseClaimsJws(token).getBody();
        return claims;
    }
    public String getTokenName() {
        return tokenName;
    }
}
src/main/java/com/cl/util/LoginAttempt.java
New file
@@ -0,0 +1,17 @@
package com.cl.util;
import lombok.Data;
/**
 * 系统缓存密码错误账号
 */
@Data
public class LoginAttempt {
    private final int lockCount;//次数
    private final long lastAttemptTime;//最后一次尝试时间
    public LoginAttempt(int lockCount, long lastAttemptTime) {
        this.lockCount = lockCount;
        this.lastAttemptTime = lastAttemptTime;
    }
}
src/main/java/com/cl/util/LoginAttemptService.java
New file
@@ -0,0 +1,60 @@
package com.cl.util;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.Scheduled;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
// 使用ConcurrentHashMap作为临时存储
public class LoginAttemptService {
    private static final int MAX_ATTEMPTS = 5;
    private static final long LOCK_TIME_MS = 5 * 60 * 1000; // 5分钟
    private final Map<String, LoginAttempt> attemptsCache = new ConcurrentHashMap<>();
    /**
     * 是否被锁了
     */
    public boolean isLocked(String phone) {
        LoginAttempt attempt = attemptsCache.get(phone);
        return attempt != null
               && attempt.getLockCount() >= MAX_ATTEMPTS
               && System.currentTimeMillis() < attempt.getLastAttemptTime() + LOCK_TIME_MS;
    }
    /**
     * 添加密码错误记录
     */
    public void recordFailedAttempt(String phone) {
        attemptsCache.compute(phone, (k, v) -> {
            long now = System.currentTimeMillis();
            if (v == null) {
                return new LoginAttempt(1, now);
            }
            // 如果上次尝试超过锁定时间,则重置
            if (now - v.getLastAttemptTime() > LOCK_TIME_MS) {
                return new LoginAttempt(1, now);
            }
            return new LoginAttempt(v.getLockCount() + 1, now);
        });
    }
    /**
     * 清除
     */
    public void clearAttempts(String phone) {
        attemptsCache.remove(phone);
    }
    @Scheduled(fixedRate = 60 * 60 * 1000) // 每小时清理一次过期记录
    public void cleanupExpiredAttempts() {
        long now = System.currentTimeMillis();
        attemptsCache.entrySet().removeIf(entry ->
            now - entry.getValue().getLastAttemptTime() > LOCK_TIME_MS * 2
        );
    }
}
src/main/resources/application.yml
New file
@@ -0,0 +1,24 @@
port: 8080
spring:
  main:
    allow-circular-references: true
  datasource:
      url: jdbc:mysql://127.0.0.1:3306/canlian?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
      username: root
      password: 123456
      driver-class-name: com.mysql.cj.jdbc.Driver
mybatis-plus:
  #mapper配置文件
  mapper-locations: classpath*:/mapper/*.xml
  type-aliases-package: com.cl.pojo.entity
  configuration:
    #开启驼峰命名
    map-underscore-to-camel-case: true
    # 开启SQL日志
    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
#jwt:
#  secret-key: xx
#  ttl: 7200000
#  token-name: Authorization
src/main/resources/mapper/DataMapper.xml
New file
@@ -0,0 +1,127 @@
<?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.cl.mapper.DataMapper">
    <select id="screen" resultType="com.cl.pojo.entity.DataEntity">
        WITH latest_records AS (
            SELECT
                *,
                ROW_NUMBER() OVER (PARTITION BY county ORDER BY create_time DESC) AS rn
            FROM t_data
            WHERE county=#{county} or #{county}=0 AND del_flag = 0
        )
        SELECT
            create_time,
            sum(certificate_eyesight) AS certificate_eyesight,
            sum(certificate_intellect) AS certificate_intellect ,
            sum(certificate_limb) AS certificate_limb ,
            sum(certificate_speech) AS certificate_speech,
            sum(certificate_hearing) AS certificate_hearing,
            sum(certificate_spirit) AS certificate_spirit,
            sum(certificate_multiple) AS certificate_multiple,
            sum(worker_city) AS worker_city,
            sum(worker_association) AS worker_association,
            sum(worker_service_corps) AS worker_service_corps,
            sum(worker_county  ) AS worker_county,
            sum(worker_township  ) AS worker_township,
            sum(worker_village  ) AS worker_village,
            sum(drill_autism  ) AS drill_autism,
            sum(drill_intellect  ) AS drill_intellect,
            sum(drill_limb  ) AS drill_limb,
            sum(drill_speech  ) AS drill_speech,
            sum(drill_hearing  ) AS drill_hearing,
            sum(drill_spirit  ) AS drill_spirit,
            sum(salvation_before_seven  ) AS salvation_before_seven,
            sum(salvation_after_seven  ) AS salvation_after_seven,
            sum(salvation_autism  ) AS salvation_autism,
            sum(salvation_intellect  ) AS salvation_intellect,
            sum(salvation_limb  ) AS salvation_limb,
            sum(salvation_speech  ) AS salvation_speech,
            sum(difficulty_medication  ) AS difficulty_medication,
            sum(difficulty_hospitalisation  ) AS difficulty_hospitalisation,
            sum(assistive_device_total  ) AS assistive_device_total,
            sum(assistive_device_one  ) AS assistive_device_one,
            sum(assistive_device_two  ) AS assistive_device_two,
            sum(assistive_device_three  ) AS assistive_device_three,
            sum(assistive_device_other  ) AS assistive_device_other,
            sum(assistive_device_type_one  ) AS assistive_device_type_one,
            sum(assistive_device_type_two  ) AS assistive_device_type_two,
            sum(assistive_device_type_three  ) AS assistive_device_type_three,
            sum(assistive_device_type_four  ) AS assistive_device_type_four,
            sum(assistive_device_grade_one  ) AS assistive_device_grade_one ,
            sum( assistive_device_grade_two) as  assistive_device_grade_two,
            sum(assistive_device_grade_three ) as  assistive_device_grade_three,
            sum(assistive_device_grade_four ) as assistive_device_grade_four ,
            sum(technical_training ) as technical_training ,
            sum(home_allowance ) as home_allowance  ,
            sum(statutory_certificate_eyesight ) as statutory_certificate_eyesight ,
            sum(statutory_certificate_intellect ) as  statutory_certificate_intellect,
            sum(statutory_certificate_limb ) as  statutory_certificate_limb,
            sum(statutory_certificate_speech ) as statutory_certificate_speech ,
            sum(statutory_certificate_hearing ) as statutory_certificate_hearing  ,
            sum(employed_employment ) as  employed_employment,
            sum(employed_concentrated ) as employed_concentrated ,
            sum(employed_public_welfare ) as employed_public_welfare ,
            sum(employed_auxiliary ) as employed_auxiliary ,
            sum(employed_individual ) as employed_individual ,
            sum(high_school_employment ) as high_school_employment ,
            sum(high_school_individual ) as high_school_individual ,
            sum(high_school_flexible ) as  high_school_flexible,
            sum(education_one ) as  education_one,
            sum(education_two ) as education_two ,
            sum( education_three) as education_three ,
            sum(education_four ) as  education_four,
            sum(education_five ) as education_five ,
            sum(education_six ) as education_six ,
            sum(education_seven ) as education_seven ,
            sum(education_eight ) as education_eight ,
            sum(education_nine ) as education_nine ,
            sum(education_subsidy ) as education_subsidy ,
            sum(activity_frequency ) as  activity_frequency,
            sum(education_number ) as education_number,
            sum(matter) as matter,
            sum(doctor_apprecitation) as doctor_apprecitation,
            sum(remould) as remould,
            sum(interviews_office) as interviews_office,
            sum(interviews_phone) as interviews_phone ,
            sum(interviews_superior) as interviews_superior,
            sum(interviews_hotline) as interviews_hotline
        FROM latest_records
        WHERE rn = 1;
    </select>
    <select id="pageList" resultType="com.cl.pojo.vo.DataVO">
        SELECT
            d.county,
            d.investigate_time,
            d.create_time,
            creator.name AS createName,
            d.update_time,
            updater.name AS updateName
        FROM
            t_data d
                LEFT JOIN
            t_user creator ON d.create_by = creator.id
                LEFT JOIN
            t_user updater ON d.update_by = updater.id
        WHERE
            d.del_flag=0
        <if test="county != null and county != 0">
            and d.county =#{county}
        </if>
        <if test="name!=null and ''!=name">
            and creator.name like concat('%',#{name},'%')
        </if>
    </select>
    <select id="beforeOne" resultType="com.cl.pojo.entity.DataEntity">
        SELECT *
        FROM t_data
        WHERE del_flag = 0
        AND county = (SELECT county FROM t_data WHERE id = #{id} AND del_flag = 0)
        AND create_time &lt; (SELECT create_time FROM t_data WHERE id = #{id} AND del_flag = 0)
        ORDER BY create_time DESC
        LIMIT 1;
    </select>
</mapper>
src/main/resources/mapper/InstitutionMapper.xml
New file
@@ -0,0 +1,36 @@
<?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.cl.mapper.InstitutionMapper">
    <select id="pageList" resultType="com.cl.pojo.vo.InstitutionVO">
        select
            id , name, type, county, phone
        from
            t_institution
        where
            del_flag=0
        <if test="null!=county and county!=0">
            and county=#{county}
        </if>
        <if test="null!=phone and ''!=phone">
            and phone like concat('%',#{phone},'%')
        </if>
        order by id desc
    </select>
    <select id="getAll" resultType="com.cl.pojo.vo.InstitutionVO">
        select id,type,name,address,phone,county
        from
            t_institution
        where
        del_flag=0
        <if test="null!=county and county!=0">
            and county=#{county}
        </if>
        order by id desc
    </select>
</mapper>
src/main/resources/mapper/UserMapper.xml
New file
@@ -0,0 +1,20 @@
<?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.cl.mapper.UserMapper">
    <select id="pageList" resultType="com.cl.pojo.vo.UserVO">
        select id,name,phone,remark,status
        from t_user
        where
            del_flag = 0
          and id != 1
        <if test="null != name and ''!=name">
            and `name` like concat('%',#{name},'%')
        </if>
        <if test="null!=phone and ''!=phone">
            and phone like concat('%',#{phone},'%')
        </if>
        ORDER BY id DESC
    </select>
</mapper>
src/test/java/DatabaseConnectionTest.java
New file
@@ -0,0 +1,39 @@
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.text.DecimalFormat;
public class DatabaseConnectionTest {
    public static void main(String[] args) {
        /*String url = "jdbc:mysql://localhost:3306/canlian?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8";
        String username = "root";
        String password = "123456";
        try (Connection connection = DriverManager.getConnection(url, username, password)) {
            System.out.println("数据库连接成功!");
        } catch (SQLException e) {
            System.out.println("数据库连接失败:" + e.getMessage());
        }*/
        String s = calcRate(5, 4);
        System.out.println(s);
    }
    public static String calcRate(Integer currentValue, Integer previousValue) {
        //去年的数据为0的情况
        if (previousValue == 0){
            return currentValue == 0 ? "同比持平" : "无同比数据";
        }
        // 计算变化率
        double changeRate = (currentValue - previousValue) * 100.0 / previousValue;
        // 格式化输出(保留两位小数,带正负号)
        DecimalFormat df = new DecimalFormat("0.00");
        String absoluteValue = df.format(Math.abs(changeRate));
        if (changeRate > 0) {
            return "同比增加" + absoluteValue + "%";
        } else if (changeRate < 0) {
            return "同比减少" + absoluteValue + "%";
        } else {
            return "同比持平";
        }
    }
}