Browse Source

初次提交

master
李磊 4 years ago
parent
commit
ef2dda139a
  1. 3
      META-INF/MANIFEST.MF
  2. 17
      README.md
  3. 224
      pom.xml
  4. 41
      src/main/java/com/stone/Application.java
  5. 123
      src/main/java/com/stone/api/enums/BusinessExceptionEnum.java
  6. 94
      src/main/java/com/stone/api/enums/ResultCode.java
  7. 19
      src/main/java/com/stone/base/BaseController.java
  8. 42
      src/main/java/com/stone/base/BaseEntity.java
  9. 8
      src/main/java/com/stone/base/BaseMapper.java
  10. 24
      src/main/java/com/stone/base/BaseService.java
  11. 48
      src/main/java/com/stone/conf/WebMvcConfig.java
  12. 51
      src/main/java/com/stone/conf/datasource/intermediate/DruidIntermediate.java
  13. 56
      src/main/java/com/stone/conf/datasource/senior/DruidSenior.java
  14. 15
      src/main/java/com/stone/conf/enums/Constants.java
  15. 37
      src/main/java/com/stone/conf/enums/EquipmentCodeEnum.java
  16. 52
      src/main/java/com/stone/conf/enums/ErrorEnum.java
  17. 13
      src/main/java/com/stone/conf/enums/FilePathConstants.java
  18. 18
      src/main/java/com/stone/conf/enums/LinkConstants.java
  19. 13
      src/main/java/com/stone/conf/enums/MagicValueConstants.java
  20. 21
      src/main/java/com/stone/conf/enums/StateConstants.java
  21. 12
      src/main/java/com/stone/conf/enums/VersionConstants.java
  22. 54
      src/main/java/com/stone/conf/exception/BusinessException.java
  23. 34
      src/main/java/com/stone/conf/exception/CommonJsonException.java
  24. 36
      src/main/java/com/stone/conf/exception/DataConflictException.java
  25. 38
      src/main/java/com/stone/conf/exception/DataNotFoundException.java
  26. 30
      src/main/java/com/stone/conf/exception/InternalServerException.java
  27. 37
      src/main/java/com/stone/conf/exception/MethodNotAllowException.java
  28. 37
      src/main/java/com/stone/conf/exception/ParameterInvalidException.java
  29. 36
      src/main/java/com/stone/conf/exception/PermissionForbiddenException.java
  30. 36
      src/main/java/com/stone/conf/exception/RemoteAccessException.java
  31. 22
      src/main/java/com/stone/conf/exception/UserNotLoginException.java
  32. 67
      src/main/java/com/stone/conf/filter/AjaxPermissionsAuthorizationFilter.java
  33. 43
      src/main/java/com/stone/conf/redis/RedisConfig.java
  34. 132
      src/main/java/com/stone/conf/redis/RedisHelper.java
  35. 63
      src/main/java/com/stone/conf/session/ShiroSessionListener.java
  36. 61
      src/main/java/com/stone/conf/shiro/MyShiroRealm.java
  37. 189
      src/main/java/com/stone/conf/shiro/ShiroConfig.java
  38. 33
      src/main/java/com/stone/conf/shiro/ShiroSessionIdGenerator.java
  39. 38
      src/main/java/com/stone/controller/CategoryController.java
  40. 46
      src/main/java/com/stone/controller/DownloadController.java
  41. 49
      src/main/java/com/stone/controller/SearchController.java
  42. 41
      src/main/java/com/stone/controller/UserController.java
  43. 11
      src/main/java/com/stone/mapper/intermediate/BjdIntermediateMapper.java
  44. 11
      src/main/java/com/stone/mapper/intermediate/HzdIntermediateMapper.java
  45. 11
      src/main/java/com/stone/mapper/intermediate/RenwuIntermediateMapper.java
  46. 11
      src/main/java/com/stone/mapper/intermediate/ReportIntermediateMapper.java
  47. 11
      src/main/java/com/stone/mapper/intermediate/YsjlIntermediateMapper.java
  48. 10
      src/main/java/com/stone/mapper/senior/BjdSeniorMapper.java
  49. 10
      src/main/java/com/stone/mapper/senior/CategoryMapper.java
  50. 11
      src/main/java/com/stone/mapper/senior/RenwuSeniorMapper.java
  51. 10
      src/main/java/com/stone/mapper/senior/TemplateMapper.java
  52. 11
      src/main/java/com/stone/mapper/senior/YsjlSeniorMapper.java
  53. 17
      src/main/java/com/stone/model/dto/UserDTO.java
  54. 39
      src/main/java/com/stone/model/po/bjd/BjdIntermediate.java
  55. 53
      src/main/java/com/stone/model/po/bjd/BjdSenior.java
  56. 39
      src/main/java/com/stone/model/po/bjd/HzdIntermediate.java
  57. 40
      src/main/java/com/stone/model/po/dic/Category.java
  58. 65
      src/main/java/com/stone/model/po/renwu/RenwuIntermediate.java
  59. 81
      src/main/java/com/stone/model/po/renwu/RenwuSenior.java
  60. 63
      src/main/java/com/stone/model/po/report/Report.java
  61. 26
      src/main/java/com/stone/model/po/template/Template.java
  62. 49
      src/main/java/com/stone/model/po/ysjl/YsjlIntermediate.java
  63. 112
      src/main/java/com/stone/model/po/ysjl/YsjlSenior.java
  64. 43
      src/main/java/com/stone/model/vo/PageVO.java
  65. 46
      src/main/java/com/stone/model/vo/SearchSeniorVO.java
  66. 14
      src/main/java/com/stone/service/CategoryService.java
  67. 26
      src/main/java/com/stone/service/DownloadService.java
  68. 32
      src/main/java/com/stone/service/SearchService.java
  69. 20
      src/main/java/com/stone/service/UserService.java
  70. 37
      src/main/java/com/stone/service/impl/CategoryServiceImpl.java
  71. 112
      src/main/java/com/stone/service/impl/DownloadServiceImpl.java
  72. 253
      src/main/java/com/stone/service/impl/SearchServiceImpl.java
  73. 62
      src/main/java/com/stone/service/impl/UserServiceImpl.java
  74. 55
      src/main/java/com/stone/util/Swagger.java
  75. 127
      src/main/java/com/stone/util/common/AttributeReflectUtil.java
  76. 112
      src/main/java/com/stone/util/common/ReturnJSONUtils.java
  77. 127
      src/main/resources/application.yml
  78. 14
      src/main/resources/banner.txt
  79. 29
      src/test/java/com/stone/test/CountryServiceTest.java

3
META-INF/MANIFEST.MF

@ -0,0 +1,3 @@
Manifest-Version: 1.0
Main-Class: com.stone.Application

17
README.md

@ -1,2 +1,17 @@
# DYBG
# DYBGManager
打印报告
济南16版报检到18版出具承压报告时间 和 济南18版报检到16版出具机电报告时间的报告都得做特殊的处理。
> 全部从18版报检,承压走18版查询报告,机电走16版查询报告
>
>
# aspose在pdf里添加电子印章
https://www.evget.com/article/2013/3/13/18632.html
https://www.evget.com/article/2011/9/2/16570.html
http://www.componentcn.com/kongjianjishu/kongjianjishu/2015-06-15/2823.html

224
pom.xml

@ -0,0 +1,224 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<!-- 认认真真的注释一下maven的配置文件 -->
<!-- 声明项目描述符遵循哪一个POM模型版本。模型本身的版本很少改变,虽然如此,但它仍然是必不可少的,这是为了当Maven引入了新的特性或者其他模型变更的时候,确保稳定性。-->
<modelVersion>4.0.0</modelVersion>
<!-- 项目的全球唯一标识符,通常使用全限定的包名区分该项目和其他项目。并且构建时生成的路径也是由此生成 -->
<groupId>com.stone</groupId>
<!-- 构件的标识符,它和group ID一起唯一标识一个构件;在某个 特定的group ID下,artifact ID也必须是唯一的。构件是项目产生的或使用的一个东西,Maven为项目产生的构件包括:JARs,源码,二进制发布和WARs等。-->
<artifactId>DYBGManager</artifactId>
<packaging>war</packaging>
<!-- 父项目的坐标。如果项目中没有规定某个元素的值,那么父项目中的对应值即为项目的默认值。 坐标包括group ID,artifact ID和 version。-->
<parent>
<!-- Spring boot的项目必须要将parent设置为spring boot的parent,该parent包含了大量默认的配置,大大简化了我们的开发 -->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.0.RELEASE</version>
</parent>
<!-- 以值替代名称,Properties可以在整个POM中使用,也可以作为触发条件;格式是<name>value</name>。-->
<properties>
<java.version>1.8</java.version>
<mybatis.spring.version>1.2.4</mybatis.spring.version>
<mapper.starter.version>2.0.4</mapper.starter.version>
<pagehelper.starter.version>1.2.9</pagehelper.starter.version>
</properties>
<!-- 该元素描述了项目相关的所有依赖。这些依赖组成了项目构建过程中的一个个环节。它们自动从项目定义的仓库中下载。-->
<dependencies>
<!-- 导入spring boot的web支持 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<!-- 去除内嵌tomcat 生产环境下开启-->
<!--<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>-->
</dependency>
<!-- 导入spring boot对数据库jdbc的支持 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<!-- 使用spring-aop和AspectJ 支持面向切面编程 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
<!-- 对常用的测试框架Junit,Hamcrest 和 Mockito的支持 包含spring-test的模块 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
</dependency>
<!-- 增加redis数据库配置 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<!-- 可以从被@ConfigurationProperties注解的节点轻松的产生自己的配置元数据文件 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<!-- 导入mysql连接设置 -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.13</version>
</dependency>
<!-- 导入oracle连接设置 -->
<!--<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc14</artifactId>
<version>10.2.0.4.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/resources/generator/ojdbc14.jar</systemPath>
</dependency>-->
<!-- 导入sqlserver连接设置 -->
<!--<dependency>
<groupId>com.microsoft</groupId>
<artifactId>sqlserver</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/resources/generator/sqljdbc2008.jar</systemPath>
</dependency>-->
<!-- 导入大圣之前写的消红jar包 -->
<!--<dependency>
<groupId>org.tempuri</groupId>
<artifactId>webclient</artifactId>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/resources/generator/webclient.jar</systemPath>
</dependency>-->
<!-- 导入spring对Apache Shiro的 -->
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-spring</artifactId>
<version>1.4.2</version>
</dependency>
<!-- springBoot与mybatis的整合 -->
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>tk.mybatis</groupId>
<artifactId>mapper-spring-boot-starter</artifactId>
<version>${mapper.starter.version}</version>
</dependency>
<!-- springBoot的分页工具 -->
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>${pagehelper.starter.version}</version>
<!-- 当计算传递依赖时, 从依赖构件列表里,列出被排除的依赖构件集。即告诉maven你只依赖指定的项目,不依赖项目的依赖。此元素主要用于解决版本冲突问题 -->
<exclusions>
<exclusion>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- 添加druid数据库连接池对springBoot的支持 -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>1.1.10</version>
</dependency>
<!-- 添加hutool工具类 -->
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>4.1.19</version>
</dependency>
<!-- 添加fastjson对json串的处理 -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.51</version>
</dependency>
<!-- 添加shiro+redis缓存插件 -->
<dependency>
<groupId>org.crazycake</groupId>
<artifactId>shiro-redis</artifactId>
<version>3.2.3</version>
</dependency>
<!-- 添加lombok插件简化实体类冗余代码 -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.4</version>
</dependency>
<!-- Swagger API文档 -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version>
<exclusions>
<exclusion>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
</exclusion>
<exclusion>
<groupId>io.swagger</groupId>
<artifactId>swagger-models</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.9.2</version>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>1.5.21</version>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-models</artifactId>
<version>1.5.21</version>
</dependency>
<!--添加servlet的依赖 生产环境下开启-->
<!--<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.1</version>
<scope>provided</scope>
</dependency>-->
<!-- 增加打包构建插件 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.1.8.RELEASE</version>
</dependency>
</dependencies>
<!-- 构建项目需要的信息 -->
<build>
<!-- 打包项目名称 -->
<finalName>${project.artifactId}</finalName>
<!-- 使用的插件列表 -->
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
</plugin>
</plugins>
</build>
</project>

41
src/main/java/com/stone/Application.java

@ -0,0 +1,41 @@
package com.stone;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.stereotype.Controller;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import tk.mybatis.spring.annotation.MapperScan;
/**
* @author zichen
*/
@Controller
@EnableWebMvc
@SpringBootApplication
@MapperScan(basePackages = "com.stone.mapper")
public class Application extends SpringBootServletInitializer implements CommandLineRunner {
private Logger logger = LoggerFactory.getLogger(Application.class);
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
/*// 生产环境
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(Application.class);
}*/
@Override
public void run(String... args) {
logger.info("服务启动完成!");
}
}

123
src/main/java/com/stone/api/enums/BusinessExceptionEnum.java

@ -0,0 +1,123 @@
package com.stone.api.enums;
import com.stone.conf.exception.*;
import org.springframework.http.HttpStatus;
/**
* 异常HTTP状态码默认自定义返回码 映射类
*/
public enum BusinessExceptionEnum {
/**
* 无效参数
*/
PARAMETER_INVALID(ParameterInvalidException.class, HttpStatus.BAD_REQUEST, ResultCode.PARAM_IS_INVALID),
/**
* 数据未找到
*/
NOT_FOUND(DataNotFoundException.class, HttpStatus.NOT_FOUND, ResultCode.RESULE_DATA_NONE),
/**
* 接口方法不允许
*/
METHOD_NOT_ALLOWED(MethodNotAllowException.class, HttpStatus.METHOD_NOT_ALLOWED, ResultCode.INTERFACE_ADDRESS_INVALID),
/**
* 数据已存在
*/
CONFLICT(DataConflictException.class, HttpStatus.CONFLICT, ResultCode.DATA_ALREADY_EXISTED),
/**
* 用户未登录
*/
UNAUTHORIZED(UserNotLoginException.class, HttpStatus.UNAUTHORIZED, ResultCode.USER_NOT_LOGGED_IN),
/**
* 无访问权限
*/
FORBIDDEN(PermissionForbiddenException.class, HttpStatus.FORBIDDEN, ResultCode.PERMISSION_NO_ACCESS),
/**
* 远程访问时错误
*/
REMOTE_ACCESS_ERROR(RemoteAccessException.class, HttpStatus.INTERNAL_SERVER_ERROR, ResultCode.INTERFACE_OUTTER_INVOKE_ERROR),
/**
* 系统内部错误
*/
INTERNAL_SERVER_ERROR(InternalServerException.class, HttpStatus.INTERNAL_SERVER_ERROR, ResultCode.SYSTEM_INNER_ERROR);
private Class<? extends BusinessException> eClass;
private HttpStatus httpStatus;
private ResultCode resultCode;
BusinessExceptionEnum(Class<? extends BusinessException> eClass, HttpStatus httpStatus, ResultCode resultCode) {
this.eClass = eClass;
this.httpStatus = httpStatus;
this.resultCode = resultCode;
}
public Class<? extends BusinessException> getEClass() {
return eClass;
}
public HttpStatus getHttpStatus() {
return httpStatus;
}
public ResultCode getResultCode() {
return resultCode;
}
public static boolean isSupportHttpStatus(int httpStatus) {
for (BusinessExceptionEnum exceptionEnum : BusinessExceptionEnum.values()) {
if (exceptionEnum.httpStatus.value() == httpStatus) {
return true;
}
}
return false;
}
public static boolean isSupportException(Class<?> z) {
for (BusinessExceptionEnum exceptionEnum : BusinessExceptionEnum.values()) {
if (exceptionEnum.eClass.equals(z)) {
return true;
}
}
return false;
}
public static BusinessExceptionEnum getByHttpStatus(HttpStatus httpStatus) {
if (httpStatus == null) {
return null;
}
for (BusinessExceptionEnum exceptionEnum : BusinessExceptionEnum.values()) {
if (httpStatus.equals(exceptionEnum.httpStatus)) {
return exceptionEnum;
}
}
return null;
}
public static BusinessExceptionEnum getByEClass(Class<? extends BusinessException> eClass) {
if (eClass == null) {
return null;
}
for (BusinessExceptionEnum exceptionEnum : BusinessExceptionEnum.values()) {
if (eClass.equals(exceptionEnum.eClass)) {
return exceptionEnum;
}
}
return null;
}
}

94
src/main/java/com/stone/api/enums/ResultCode.java

@ -0,0 +1,94 @@
package com.stone.api.enums;
/**
* API 统一返回状态码
*/
public enum ResultCode {
/* 成功状态码 */
SUCCESS(1, "成功"),
/* 参数错误:10001-19999 */
PARAM_IS_INVALID(10001, "参数无效"),
PARAM_IS_BLANK(10002, "参数为空"),
PARAM_TYPE_BIND_ERROR(10003, "参数类型错误"),
PARAM_NOT_COMPLETE(10004, "参数缺失"),
/* 用户错误:20001-29999*/
USER_NOT_LOGGED_IN(20001, "用户未登录"),
USER_LOGIN_ERROR(20002, "账号不存在或密码错误"),
USER_ACCOUNT_FORBIDDEN(20003, "账号已被禁用"),
USER_NOT_EXIST(20004, "用户不存在"),
USER_HAS_EXISTED(20005, "用户已存在"),
LOGIN_CREDENTIAL_EXISTED(20006, "凭证已存在"),
USER_SIGN_PASSWORD_ERROR(20007, "签名密码错误,请重新输入"),
/* 业务错误:30001-39999 */
SPECIFIED_QUESTIONED_USER_NOT_EXIST(30001, "业务错误"),
/* 系统错误:40001-49999 */
SYSTEM_INNER_ERROR(40001, "系统繁忙,请稍后重试"),
/* 数据错误:50001-599999 */
RESULE_DATA_NONE(50001, "数据未找到"),
DATA_IS_WRONG(50002, "数据有误"),
DATA_ALREADY_EXISTED(50003, "数据已存在"),
/* 接口错误:60001-69999 */
INTERFACE_INNER_INVOKE_ERROR(60001, "内部系统接口调用异常"),
INTERFACE_OUTTER_INVOKE_ERROR(60002, "外部系统接口调用异常"),
INTERFACE_FORBID_VISIT(60003, "该接口禁止访问"),
INTERFACE_ADDRESS_INVALID(60004, "接口地址无效"),
INTERFACE_REQUEST_TIMEOUT(60005, "接口请求超时"),
INTERFACE_EXCEED_LOAD(60006, "接口负载过高"),
/* 权限错误:70001-79999 */
PERMISSION_NO_ACCESS(70001, "无访问权限"),
RESOURCE_EXISTED(70002, "资源已存在"),
RESOURCE_NOT_EXISTED(70003, "资源不存在"),
/* 预览错误:80001-89999 */
PREVIEW_CHILD_PARAM_ERROR(80001, "子报告生成参数异常"),
PREVIEW_CONVERT_PDF_ERROR(80002, "转换 PDF 文件异常");
private Integer code;
private String message;
ResultCode(Integer code, String message) {
this.code = code;
this.message = message;
}
public Integer code() {
return this.code;
}
public String message() {
return this.message;
}
public static String getMessage(String name) {
for (ResultCode item : ResultCode.values()) {
if (item.name().equals(name)) {
return item.message;
}
}
return name;
}
public static Integer getCode(String name) {
for (ResultCode item : ResultCode.values()) {
if (item.name().equals(name)) {
return item.code;
}
}
return null;
}
@Override
public String toString() {
return this.name();
}
}

19
src/main/java/com/stone/base/BaseController.java

@ -0,0 +1,19 @@
package com.stone.base;
import org.springframework.beans.factory.annotation.Autowired;
import java.io.Serializable;
/**
* @author zichen
*/
public abstract class BaseController<E, ID extends Serializable> {
/**
* 获取service
* @return
*/
@Autowired
public abstract BaseService<E,ID> getService();
}

42
src/main/java/com/stone/base/BaseEntity.java

@ -0,0 +1,42 @@
package com.stone.base;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import javax.persistence.Column;
import java.io.Serializable;
import java.util.Date;
/**
* 基础信息
* @author zichen
*/
@Data
public abstract class BaseEntity implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "创建时间")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Column(name = "create_time")
private Date createTime;
@ApiModelProperty(value = "创建人")
@Column(name = "create_by")
private String createBy;
@ApiModelProperty(value = "修改时间")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Column(name = "update_time")
private Date updateTime;
@ApiModelProperty(value = "修改人")
@Column(name = "update_by")
private String updateBy;
}

8
src/main/java/com/stone/base/BaseMapper.java

@ -0,0 +1,8 @@
package com.stone.base;
import tk.mybatis.mapper.common.Mapper;
import tk.mybatis.mapper.common.MySqlMapper;
public interface BaseMapper<T> extends Mapper<T>, MySqlMapper<T> {
// FIXME 特别注意,该接口不能被扫描到,否则会出错
}

24
src/main/java/com/stone/base/BaseService.java

@ -0,0 +1,24 @@
package com.stone.base;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.session.Session;
import org.apache.shiro.subject.Subject;
import java.io.Serializable;
import java.util.List;
/**
* JDK8函数式接口注解 仅能包含一个抽象方法
* @author zichen
*/
@FunctionalInterface
public interface BaseService<E, ID extends Serializable> {
BaseMapper<E> getRepository();
default Session getSession() {
Subject sub = SecurityUtils.getSubject();
return sub.getSession();
}
}

48
src/main/java/com/stone/conf/WebMvcConfig.java

@ -0,0 +1,48 @@
package com.stone.conf;
import com.stone.conf.enums.FilePathConstants;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.Ordered;
import org.springframework.http.HttpHeaders;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import java.util.Arrays;
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
@Value("${front.ip}")
private String frontIp;
@Value("${front.projectName}")
private String projectName;
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
// 定义PDF预览网络路径
registry.addResourceHandler(projectName + "18/pdf/**")
.addResourceLocations("file:" + FilePathConstants.TEMPLATE_18 + projectName + "/pdf/");
// 定义图片资源路径
registry.addResourceHandler(projectName + "16/pdf/**")
.addResourceLocations("file:" + FilePathConstants.TEMPLATE_16 + "/PDF/" + projectName);
}
/**
* 允许跨域访问
*/
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedHeaders("*")
.allowedMethods("*")
.allowedOrigins(frontIp) //此处为前台项目的ip地址
.allowCredentials(true)
.exposedHeaders(HttpHeaders.SET_COOKIE);
}
}

51
src/main/java/com/stone/conf/datasource/intermediate/DruidIntermediate.java

@ -0,0 +1,51 @@
package com.stone.conf.datasource.intermediate;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionFactoryBean;
import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import tk.mybatis.spring.annotation.MapperScan;
import javax.sql.DataSource;
/**
* @author zichen
*/
@Configuration
@MapperScan(basePackages = "com.stone.mapper.intermediate", sqlSessionFactoryRef = "SessionTemplateIntermediate")
public class DruidIntermediate {
@Bean
@ConfigurationProperties(prefix = "spring.datasource.intermediate")
public DataSourceProperties DataSourcePropertiesIntermediate(){
return new DataSourceProperties();
}
@Bean
@ConfigurationProperties(prefix = "spring.datasource.intermediate")
public DataSource DataSourceIntermediates() {
return DataSourcePropertiesIntermediate().initializeDataSourceBuilder().build();
// return DataSourceBuilder.create().build();
}
@Bean
public DataSourceTransactionManager TransactionManagerIntermediate() {
DataSourceTransactionManager dataSourceTransactionManager = new DataSourceTransactionManager();
dataSourceTransactionManager.setDataSource(DataSourceIntermediates());
return dataSourceTransactionManager;
}
@Bean(name = "SessionTemplateIntermediate")
public SqlSessionFactory SqlSessionFactoryIntermediate() throws Exception {
SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean();
sessionFactory.setDataSource(DataSourceIntermediates());
sessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver()
.getResources( "classpath*:mapper/intermediate/*.xml"));
return sessionFactory.getObject();
}
}

56
src/main/java/com/stone/conf/datasource/senior/DruidSenior.java

@ -0,0 +1,56 @@
package com.stone.conf.datasource.senior;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionFactoryBean;
import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import tk.mybatis.spring.annotation.MapperScan;
import javax.sql.DataSource;
/**
* @author zichen
*/
@Configuration
@MapperScan(basePackages = "com.stone.mapper.senior", sqlSessionFactoryRef = "SessionTemplateSenior")
public class DruidSenior {
@Bean
@Primary
@ConfigurationProperties(prefix = "spring.datasource.senior")
public DataSourceProperties DataSourcePropertiesSenior(){
return new DataSourceProperties();
}
@Bean
@Primary
@ConfigurationProperties(prefix = "spring.datasource.senior")
public DataSource DataSourceSeniors() {
return DataSourcePropertiesSenior().initializeDataSourceBuilder().build();
// return DataSourceBuilder.create().build();
}
@Bean
@Primary
public DataSourceTransactionManager TransactionManagerSenior() {
DataSourceTransactionManager dataSourceTransactionManager = new DataSourceTransactionManager();
dataSourceTransactionManager.setDataSource(DataSourceSeniors());
return dataSourceTransactionManager;
}
@Bean(name = "SessionTemplateSenior")
@Primary
public SqlSessionFactory SqlSessionFactorySenior() throws Exception {
SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean();
sessionFactory.setDataSource(DataSourceSeniors());
sessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver()
.getResources( "classpath*:mapper/senior/*.xml"));
return sessionFactory.getObject();
}
}

15
src/main/java/com/stone/conf/enums/Constants.java

@ -0,0 +1,15 @@
package com.stone.conf.enums;
public class Constants {
public static final String SUCCESS_CODE = "100";
public static final String SUCCESS_MSG = "请求成功";
/**
* session中存放用户信息的key值
*/
public static final String SESSION_USER_PERMISSION = "userPermission";
public final static String SESSION_USER_OBJECT = "SESSION_USER_OBJECT_EXP";
}

37
src/main/java/com/stone/conf/enums/EquipmentCodeEnum.java

@ -0,0 +1,37 @@
package com.stone.conf.enums;
import io.swagger.annotations.ApiModel;
import lombok.*;
/**
* @author zichen
*/
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(value = "设备种类代码")
public enum EquipmentCodeEnum {
/*
* 错误信息
* */
GL("1000", "锅炉"),
YLRQ("2000", "压力容器"),
DT("3000", "电梯"),
QZJ("4000", "起重机"),
CC("5000", "厂车"),
YLGDYJ("7000", "压力管道原件"),
YLGD("8000", "压力管道");
@Getter @Setter
private String code;
@Getter @Setter
private String name;
}

52
src/main/java/com/stone/conf/enums/ErrorEnum.java

@ -0,0 +1,52 @@
package com.stone.conf.enums;
public enum ErrorEnum {
/*
* 错误信息
* */
E_400("400", "请求处理异常,请稍后再试"),
E_10009("10009", "账户已存在"),
E_10008("10008", "原始密码输入错误,请重试"),
E_10007("10007", "签名密码输入错误,请重试"),
E_10006("10006", "模板文件不存在,请上传后下载"),
E_10005("10005", "上传文件格式有误,请核对后导入"),
E_20011("20011", "登陆已过期,请重新登陆"),
E_90003("90003", "缺少必填参数");
private String errorCode;
private String errorMsg;
ErrorEnum() {
}
ErrorEnum(String errorCode, String errorMsg) {
this.errorCode = errorCode;
this.errorMsg = errorMsg;
}
public String getErrorCode() {
return errorCode;
}
public void setErrorCode(String errorCode) {
this.errorCode = errorCode;
}
public String getErrorMsg() {
return errorMsg;
}
public void setErrorMsg(String errorMsg) {
this.errorMsg = errorMsg;
}
}

13
src/main/java/com/stone/conf/enums/FilePathConstants.java

@ -0,0 +1,13 @@
package com.stone.conf.enums;
/**
* 文件路径
* @author zichen
*/
public final class FilePathConstants {
public static final String TEMPLATE_18 = "D:/static/";
public static final String TEMPLATE_16 = "D:/SDMA/";
}

18
src/main/java/com/stone/conf/enums/LinkConstants.java

@ -0,0 +1,18 @@
package com.stone.conf.enums;
/**
* @author zichen
*/
public final class LinkConstants {
public final static String BJ = "bjState";
public final static String RENWU = "fpState";
public final static String ALLOT_RENWU = "renwuState";
public final static String YSJL = "ysjlState";
public final static String REPORT = "reportState";
}

13
src/main/java/com/stone/conf/enums/MagicValueConstants.java

@ -0,0 +1,13 @@
package com.stone.conf.enums;
import io.swagger.annotations.ApiModelProperty;
/**
* @author zichen
*/
public class MagicValueConstants {
@ApiModelProperty(value = "日期格式化")
public final static String DATE_FORMAT = "yyyy-MM-dd";
}

21
src/main/java/com/stone/conf/enums/StateConstants.java

@ -0,0 +1,21 @@
package com.stone.conf.enums;
import lombok.Getter;
import lombok.Setter;
/**
* @author zichen
*/
public final class StateConstants {
public final static String BJ = "bjState";
public final static String RENWU = "fpState";
public final static String ALLOT_RENWU = "renwuState";
public final static String YSJL = "ysjlState";
public final static String REPORT = "reportState";
}

12
src/main/java/com/stone/conf/enums/VersionConstants.java

@ -0,0 +1,12 @@
package com.stone.conf.enums;
/**
* @author zichen
*/
public class VersionConstants {
public final static String SENIOR = "18";
public final static String Intermediate = "16";
}

54
src/main/java/com/stone/conf/exception/BusinessException.java

@ -0,0 +1,54 @@
package com.stone.conf.exception;
import cn.hutool.core.util.StrUtil;
import com.stone.api.enums.BusinessExceptionEnum;
import com.stone.api.enums.ResultCode;
import lombok.Data;
import lombok.EqualsAndHashCode;
@EqualsAndHashCode(callSuper = true)
@Data
public class BusinessException extends RuntimeException {
private static final long serialVersionUID = 194906846739586856L;
protected String code;
protected String message;
protected ResultCode resultCode;
protected Object data;
public BusinessException() {
BusinessExceptionEnum exceptionEnum = BusinessExceptionEnum.getByEClass(this.getClass());
if (exceptionEnum != null) {
resultCode = exceptionEnum.getResultCode();
code = exceptionEnum.getResultCode().code().toString();
message = exceptionEnum.getResultCode().message();
}
}
public BusinessException(String message) {
this();
this.message = message;
}
public BusinessException(String format, Object... objects) {
this();
this.message = StrUtil.format(format, "{}", objects);
}
public BusinessException(ResultCode resultCode, Object data) {
this(resultCode);
this.data = data;
}
public BusinessException(ResultCode resultCode) {
this.resultCode = resultCode;
this.code = resultCode.code().toString();
this.message = resultCode.message();
}
}

34
src/main/java/com/stone/conf/exception/CommonJsonException.java

@ -0,0 +1,34 @@
package com.stone.conf.exception;
import com.alibaba.fastjson.JSONObject;
import com.stone.conf.enums.ErrorEnum;
import com.stone.util.common.ReturnJSONUtils;
/**
* 本系统使用的自定义错误类
* 比如在校验参数时,如果不符合要求,可以抛出此错误类
* 拦截器可以统一拦截此错误,将其中json返回给前端
*/
public class CommonJsonException extends RuntimeException {
private JSONObject resultJson;
/**
* 调用时可以在任何代码处直接throws这个Exception,
* 都会统一被拦截,并封装好json返回给前台
* @param errorEnum 以错误的ErrorEnum做参数
*/
public CommonJsonException(ErrorEnum errorEnum) {
this.resultJson = ReturnJSONUtils.errorJson(errorEnum);
}
public CommonJsonException(JSONObject resultJson) {
this.resultJson = resultJson;
}
public JSONObject getResultJson() {
return resultJson;
}
}

36
src/main/java/com/stone/conf/exception/DataConflictException.java

@ -0,0 +1,36 @@
package com.stone.conf.exception;
import com.stone.api.enums.ResultCode;
/**
* 数据已经存在异常
*/
public class DataConflictException extends BusinessException {
private static final long serialVersionUID = 3721036867889297081L;
public DataConflictException() {
super();
}
public DataConflictException(Object data) {
super.data = data;
}
public DataConflictException(ResultCode resultCode) {
super(resultCode);
}
public DataConflictException(ResultCode resultCode, Object data) {
super(resultCode, data);
}
public DataConflictException(String msg) {
super(msg);
}
public DataConflictException(String formatMsg, Object... objects) {
super(formatMsg, objects);
}
}

38
src/main/java/com/stone/conf/exception/DataNotFoundException.java

@ -0,0 +1,38 @@
package com.stone.conf.exception;
import com.stone.api.enums.ResultCode;
/**
* 数据没有找到异常
*/
public class DataNotFoundException extends BusinessException {
private static final long serialVersionUID = 3721036867889297081L;
public DataNotFoundException() {
super();
}
public DataNotFoundException(Object data) {
super();
super.data = data;
}
public DataNotFoundException(ResultCode resultCode) {
super(resultCode);
}
public DataNotFoundException(ResultCode resultCode, Object data) {
super(resultCode, data);
}
public DataNotFoundException(String msg) {
super(msg);
}
public DataNotFoundException(String formatMsg, Object... objects) {
super(formatMsg, objects);
}
}

30
src/main/java/com/stone/conf/exception/InternalServerException.java

@ -0,0 +1,30 @@
package com.stone.conf.exception;
/**
* 内部服务异常
*/
public class InternalServerException extends BusinessException {
private static final long serialVersionUID = 2659909836556958676L;
public InternalServerException() {
super();
}
public InternalServerException(String msg, Throwable cause) {
super(msg, cause);
}
public InternalServerException(String msg, Throwable cause, Object... objects) {
super(msg, cause, objects);
}
public InternalServerException(String msg) {
super(msg);
}
public InternalServerException(String formatMsg, Object... objects) {
super(formatMsg, objects);
}
}

37
src/main/java/com/stone/conf/exception/MethodNotAllowException.java

@ -0,0 +1,37 @@
package com.stone.conf.exception;
import com.stone.api.enums.ResultCode;
/**
* 方法不允许异常
*/
public class MethodNotAllowException extends BusinessException {
private static final long serialVersionUID = -3813290937049524713L;
public MethodNotAllowException() {
super();
}
public MethodNotAllowException(Object data) {
super.data = data;
}
public MethodNotAllowException(ResultCode resultCode) {
super(resultCode);
}
public MethodNotAllowException(ResultCode resultCode, Object data) {
super(resultCode, data);
}
public MethodNotAllowException(String msg) {
super(msg);
}
public MethodNotAllowException(String formatMsg, Object... objects) {
super(formatMsg, objects);
}
}

37
src/main/java/com/stone/conf/exception/ParameterInvalidException.java

@ -0,0 +1,37 @@
package com.stone.conf.exception;
import com.stone.api.enums.ResultCode;
/**
* 参数无效异常
*/
public class ParameterInvalidException extends BusinessException {
private static final long serialVersionUID = 3721036867889297081L;
public ParameterInvalidException() {
super();
}
public ParameterInvalidException(Object data) {
super();
super.data = data;
}
public ParameterInvalidException(ResultCode resultCode) {
super(resultCode);
}
public ParameterInvalidException(ResultCode resultCode, Object data) {
super(resultCode, data);
}
public ParameterInvalidException(String msg) {
super(msg);
}
public ParameterInvalidException(String formatMsg, Object... objects) {
super(formatMsg, objects);
}
}

36
src/main/java/com/stone/conf/exception/PermissionForbiddenException.java

@ -0,0 +1,36 @@
package com.stone.conf.exception;
import com.stone.api.enums.ResultCode;
/**
* 权限不足异常
*/
public class PermissionForbiddenException extends BusinessException {
private static final long serialVersionUID = 3721036867889297081L;
public PermissionForbiddenException() {
super();
}
public PermissionForbiddenException(Object data) {
super.data = data;
}
public PermissionForbiddenException(ResultCode resultCode) {
super(resultCode);
}
public PermissionForbiddenException(ResultCode resultCode, Object data) {
super(resultCode, data);
}
public PermissionForbiddenException(String msg) {
super(msg);
}
public PermissionForbiddenException(String formatMsg, Object... objects) {
super(formatMsg, objects);
}
}

36
src/main/java/com/stone/conf/exception/RemoteAccessException.java

@ -0,0 +1,36 @@
package com.stone.conf.exception;
import com.stone.api.enums.ResultCode;
/**
* 远程访问异常
*/
public class RemoteAccessException extends BusinessException {
private static final long serialVersionUID = -832464574076215195L;
public RemoteAccessException() {
super();
}
public RemoteAccessException(Object data) {
super.data = data;
}
public RemoteAccessException(ResultCode resultCode) {
super(resultCode);
}
public RemoteAccessException(ResultCode resultCode, Object data) {
super(resultCode, data);
}
public RemoteAccessException(String msg) {
super(msg);
}
public RemoteAccessException(String formatMsg, Object... objects) {
super(formatMsg, objects);
}
}

22
src/main/java/com/stone/conf/exception/UserNotLoginException.java

@ -0,0 +1,22 @@
package com.stone.conf.exception;
/**
* 用户未登录异常
*/
public class UserNotLoginException extends BusinessException {
private static final long serialVersionUID = -1879503946782379204L;
public UserNotLoginException() {
super();
}
public UserNotLoginException(String msg) {
super(msg);
}
public UserNotLoginException(String formatMsg, Object... objects) {
super(formatMsg, objects);
}
}

67
src/main/java/com/stone/conf/filter/AjaxPermissionsAuthorizationFilter.java

@ -0,0 +1,67 @@
package com.stone.conf.filter;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import com.stone.api.enums.ResultCode;
import com.stone.conf.redis.RedisHelper;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import org.apache.shiro.web.filter.authc.FormAuthenticationFilter;
import org.apache.shiro.web.util.WebUtils;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.PrintWriter;
/**
* 对没有登录的请求进行拦截, 全部返回json信息.
* 覆盖掉shiro原本的跳转login.jsp的拦截方式
*/
public class AjaxPermissionsAuthorizationFilter extends FormAuthenticationFilter {
@Override
protected boolean onAccessDenied(ServletRequest request, ServletResponse response) {
if ("OPTIONS".equals(WebUtils.toHttp(request).getMethod())) {
return true;
}
String token = WebUtils.toHttp(request).getHeader("Authorization");
if (StrUtil.isEmpty(token) || (StrUtil.isNotEmpty(token) && !RedisHelper.exists(token))) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("returnCode", 20011);
jsonObject.put("returnMsg", "用户未登录");
PrintWriter out = null;
HttpServletResponse res = (HttpServletResponse) response;
// 接下来的几句话是个坑,一定要加上,跨域访问才可以正常退出。
res.setHeader("Access-Control-Allow-Origin", ((HttpServletRequest) request).getHeader("Origin"));
res.setHeader("Access-Control-Allow-Headers", "Content-Type, Authorization");
res.setHeader("Access-Control-Allow-Methods", "GET, POST, OPTIONS, PUT, DELETE");
res.setHeader("Access-Control-Allow-Credentials", "true");
try {
res.setCharacterEncoding("UTF-8");
res.setContentType("application/json");
out = response.getWriter();
out.println(jsonObject);
} catch (Exception ignored) {
} finally {
if (out != null) {
out.flush();
out.close();
}
}
return false;
}
return true;
}
@Bean
public FilterRegistrationBean<AjaxPermissionsAuthorizationFilter> registration(AjaxPermissionsAuthorizationFilter filter) {
FilterRegistrationBean<AjaxPermissionsAuthorizationFilter> registration = new FilterRegistrationBean<>(filter);
registration.setEnabled(false);
return registration;
}
}

43
src/main/java/com/stone/conf/redis/RedisConfig.java

@ -0,0 +1,43 @@
package com.stone.conf.redis;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cache.annotation.CachingConfigurerSupport;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig;
@Configuration
@EnableCaching
public class RedisConfig extends CachingConfigurerSupport {
private Logger logger = LoggerFactory.getLogger(RedisConfig.class);
@Value("${spring.redis.host}")
private String host;
@Value("${spring.redis.port}")
private int port;
@Value("${spring.redis.timeout}")
private int timeout;
@Value("${spring.redis.jedis.pool.max-idle}")
private int maxIdle;
@Value("${spring.redis.jedis.pool.max-wait}")
private long maxWaitMillis;
@Bean
public JedisPool redisPoolFactory() {
logger.info("JedisPool注入成功!!");
logger.info("redis地址:" + host + ":" + port);
JedisPoolConfig jedisPoolConfig = new JedisPoolConfig();
jedisPoolConfig.setMaxIdle(maxIdle);
jedisPoolConfig.setMaxWaitMillis(maxWaitMillis);
return new JedisPool(jedisPoolConfig, host, port, timeout);
}
}

132
src/main/java/com/stone/conf/redis/RedisHelper.java

@ -0,0 +1,132 @@
package com.stone.conf.redis;
import redis.clients.jedis.Jedis;
import java.io.*;
/**
* redis 序列化辅助类
*
* @author zhoujl
* @date 2019-04-30
*/
public class RedisHelper {
/**
* 添加缓存信息
*/
public static void add(String key, Object value) {
Jedis jedis = new Jedis("localhost");
try {
jedis.set(key.getBytes(), ObjectTranscoder.serialize(value));
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 获取缓存信息
*/
public static Object get(String key) {
Jedis jedis = new Jedis("localhost");
if (!jedis.exists(key.getBytes())) {
return null;
}
byte[] in = jedis.get(key.getBytes());
return ObjectTranscoder.deserialize(in);
}
/**
* 判断 key 是否存在
*
* @param key 键信息
* @return 是否存在
*/
public static Boolean exists(String key) {
Jedis jedis = new Jedis("localhost");
return jedis.exists(key.getBytes());
}
/**
* 删除key
*
* @param key 键信息
*/
public static void delKey(String key) {
Jedis jedis = new Jedis("localhost");
jedis.del(key.getBytes());
}
static class ObjectTranscoder {
/**
* 序列化参数
*
* @param value object
* @return byte
*/
static byte[] serialize(Object value) {
if (value == null) {
throw new NullPointerException("参数不能为空");
}
byte[] rv;
ByteArrayOutputStream bos = null;
ObjectOutputStream os = null;
try {
bos = new ByteArrayOutputStream();
os = new ObjectOutputStream(bos);
os.writeObject(value);
os.close();
bos.close();
rv = bos.toByteArray();
} catch (IOException e) {
throw new IllegalArgumentException("该对象不可序列化", e);
} finally {
try {
if (os != null)
os.close();
if (bos != null)
bos.close();
} catch (Exception e2) {
e2.printStackTrace();
}
}
return rv;
}
/**
* 反序列化参数
*
* @param in byte
* @return object
*/
static Object deserialize(byte[] in) {
Object rv = null;
ByteArrayInputStream bis = null;
ObjectInputStream is = null;
try {
if (in != null) {
bis = new ByteArrayInputStream(in);
is = new ObjectInputStream(bis);
rv = is.readObject();
is.close();
bis.close();
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (is != null)
is.close();
if (bis != null)
bis.close();
} catch (Exception e2) {
e2.printStackTrace();
}
}
return rv;
}
}
}

63
src/main/java/com/stone/conf/session/ShiroSessionListener.java

@ -0,0 +1,63 @@
package com.stone.conf.session;
import com.stone.conf.redis.RedisHelper;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.session.Session;
import org.apache.shiro.session.SessionListener;
import java.util.concurrent.atomic.AtomicInteger;
/**
* shiro session监听
*
* @author zhoujl
* @date 2019-09-17
*/
@Slf4j
public class ShiroSessionListener implements SessionListener {
/**
* 统计在线人数
*/
private final AtomicInteger sessionCount = new AtomicInteger(0);
/**
* 会话创建时触发
*/
@Override
public void onStart(Session session) {
log.info("会话创建:" + session.getId());
// 会话创建,在线人数加一
sessionCount.incrementAndGet();
}
/**
* 退出会话时触发
*/
@Override
public void onStop(Session session) {
log.info("会话退出:" + session.getId());
// 会话退出,在线人数减一
sessionCount.decrementAndGet();
}
/**
* 会话过期时触发
*/
@Override
public void onExpiration(Session session) {
log.info("会话过期:" + session.getId());
// 会话过期,在线人数减一
sessionCount.decrementAndGet();
RedisHelper.delKey(session.getId() + "");
}
/**
* 获取在线人数使用
* @return 在线人数
*/
public AtomicInteger getSessionCount() {
return sessionCount;
}
}

61
src/main/java/com/stone/conf/shiro/MyShiroRealm.java

@ -0,0 +1,61 @@
package com.stone.conf.shiro;
import com.stone.conf.redis.RedisHelper;
import com.stone.mapper.senior.BjdSeniorMapper;
import com.stone.model.po.bjd.BjdSenior;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.AuthenticationInfo;
import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.authc.SimpleAuthenticationInfo;
import org.apache.shiro.authz.AuthorizationInfo;
import org.apache.shiro.realm.AuthorizingRealm;
import org.apache.shiro.subject.PrincipalCollection;
import org.apache.shiro.subject.Subject;
import tk.mybatis.mapper.weekend.Weekend;
import tk.mybatis.mapper.weekend.WeekendSqls;
import javax.annotation.Resource;
public class MyShiroRealm extends AuthorizingRealm {
@Resource
private BjdSeniorMapper bjdSeniorMapper;
/**
* 获取授权信息
*/
@Override
protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) {
return null;
}
/**
* 获取身份验证信息
* Shiro中最终是通过 Realm 来获取应用程序中的用户角色及权限信息的
*
* @param token 用户身份信息 token
* @return 返回封装了用户信息的 AuthenticationInfo 实例
*/
@Override
protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws AuthenticationException {
// 获取用户的输入的账号.
String loginName = (String) token.getPrincipal();
// 通过username从数据库中查找 User对象,如果找到,没找到.
// 实际项目中,这里可以根据实际情况做缓存,如果不做,Shiro自己也是有时间间隔机制,2分钟内不会重复执行该方法
BjdSenior user = bjdSeniorMapper.selectOneByExample(Weekend.builder(BjdSenior.class).where(WeekendSqls.<BjdSenior>custom()
.andEqualTo(BjdSenior::getSerialNumber, loginName)).build());
if (user == null) {
return null;
}
Subject subject = SecurityUtils.getSubject();
// 将用户信息存入redis中
RedisHelper.add(subject.getSession().getId() + "", user);
return new SimpleAuthenticationInfo(
user.getSerialNumber(), //用户名
user.getWwcxmima(), //密码
getName() //realm name
);
}
}

189
src/main/java/com/stone/conf/shiro/ShiroConfig.java

@ -0,0 +1,189 @@
package com.stone.conf.shiro;
import com.stone.conf.filter.AjaxPermissionsAuthorizationFilter;
import com.stone.conf.session.ShiroSessionListener;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authc.credential.HashedCredentialsMatcher;
import org.apache.shiro.codec.Base64;
import org.apache.shiro.mgt.RememberMeManager;
import org.apache.shiro.mgt.SecurityManager;
import org.apache.shiro.session.SessionListener;
import org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor;
import org.apache.shiro.spring.web.ShiroFilterFactoryBean;
import org.apache.shiro.web.filter.authc.FormAuthenticationFilter;
import org.apache.shiro.web.mgt.CookieRememberMeManager;
import org.apache.shiro.web.mgt.DefaultWebSecurityManager;
import org.apache.shiro.web.servlet.SimpleCookie;
import org.apache.shiro.web.session.mgt.DefaultWebSessionManager;
import org.crazycake.shiro.RedisCacheManager;
import org.crazycake.shiro.RedisManager;
import org.crazycake.shiro.RedisSessionDAO;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import javax.servlet.Filter;
import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* shiro 配置核心类
*
* @author zhoujl
* @since 2018-07-05
*/
@Slf4j
@Configuration
public class ShiroConfig {
@Value("${spring.redis.host}")
private String host;
@Value("${spring.redis.port}")
private int port;
@Value("${spring.redis.timeout}")
private int timeout;
/**
* cacheManager 缓存 redis实现
* 使用的是shiro-redis开源插件
*/
private RedisCacheManager cacheManager() {
RedisCacheManager redisCacheManager = new RedisCacheManager();
redisCacheManager.setRedisManager(redisManager());
final String CACHE_KEY = "shiro:cache:";
redisCacheManager.setKeyPrefix(CACHE_KEY);
// 配置缓存的话要求放在session里面的实体类必须有个id标识
redisCacheManager.setPrincipalIdFieldName("id");
return redisCacheManager;
}
/**
* 配置shiro redisManager
* 使用的是shiro-redis开源插件
*/
private RedisManager redisManager() {
RedisManager redisManager = new RedisManager();
redisManager.setHost(host + ":" + port);
redisManager.setTimeout(timeout);
return redisManager;
}
/**
* RedisSessionDAO shiro sessionDao层的实现 通过redis
* 使用的是shiro-redis开源插件
*/
@Bean
public RedisSessionDAO redisSessionDAO() {
RedisSessionDAO redisSessionDAO = new RedisSessionDAO();
redisSessionDAO.setRedisManager(redisManager());
redisSessionDAO.setSessionIdGenerator(sessionIdGenerator());
String SESSION_KEY = "shiro:session:";
redisSessionDAO.setKeyPrefix(SESSION_KEY);
int EXPIRE = 1800;
redisSessionDAO.setExpire(EXPIRE);
return redisSessionDAO;
}
/**
* SessionID生成器
*/
@Bean
public ShiroSessionIdGenerator sessionIdGenerator(){
return new ShiroSessionIdGenerator();
}
/**
* 配置保存sessionId的cookie
*/
@Bean("sessionIdCookie")
public SimpleCookie sessionIdCookie(){
//这个参数是cookie的名称
SimpleCookie simpleCookie = new SimpleCookie("sid");
//setcookie的httponly属性如果设为true的话,会增加对xss防护的安全系数
simpleCookie.setHttpOnly(true);
simpleCookie.setPath("/");
//maxAge=-1表示浏览器关闭时失效此Cookie
simpleCookie.setMaxAge(-1);
return simpleCookie;
}
/**
* 配置session监听
*/
@Bean("sessionListener")
public ShiroSessionListener sessionListener(){
return new ShiroSessionListener();
}
/**
* Session Manager
* 使用的是shiro-redis开源插件
*/
@Bean
public DefaultWebSessionManager sessionManager() {
DefaultWebSessionManager webSessionManager = new DefaultWebSessionManager();
Collection<SessionListener> listeners = new ArrayList<>();
// 配置监听
listeners.add(sessionListener());
webSessionManager.setSessionListeners(listeners);
webSessionManager.setSessionIdCookie(sessionIdCookie());
webSessionManager.setSessionDAO(redisSessionDAO());
// 全局会话超时时间(单位毫秒)
webSessionManager.setGlobalSessionTimeout(30 * 60 * 1000);
// 是否开启删除无效的session对象 默认为true
webSessionManager.setDeleteInvalidSessions(true);
// 是否开启定时调度器进行检测过期session 默认为true
webSessionManager.setSessionValidationSchedulerEnabled(true);
// 设置session失效的扫描时间, 清理用户直接关闭浏览器造成的孤立会话 默认为 1个小时
webSessionManager.setSessionValidationInterval(60 * 1000);
// 取消url 后面的 JSESSIONID
webSessionManager.setSessionIdUrlRewritingEnabled(false);
return webSessionManager;
}
@Bean("shiroFilter")
public ShiroFilterFactoryBean shiroFilter(SecurityManager securityManager) {
ShiroFilterFactoryBean shiroFilterFactoryBean = new ShiroFilterFactoryBean();
shiroFilterFactoryBean.setSecurityManager(securityManager);
// 拦截器.
Map<String, String> filterChainDefinitionMap = new LinkedHashMap<>();
// 配置不会被拦截的链接 顺序判断
// <!-- 过滤链定义,从上向下顺序执行,一般将/**放在最为下边 -->:这是一个坑呢,一不小心代码就不好使了;
// 配置swagger访问路径 加载顺序不可改变
// <!-- authc:所有url都必须认证通过才可以访问; anon:所有url都都可以匿名访问-->
filterChainDefinitionMap.put("/user/login", "anon");
filterChainDefinitionMap.put("/**", "user");
// 自定义拦截器
Map<String, Filter> filtersMap = new LinkedHashMap<>();
filtersMap.put("user", new AjaxPermissionsAuthorizationFilter());
shiroFilterFactoryBean.setFilters(filtersMap);
shiroFilterFactoryBean.setFilterChainDefinitionMap(filterChainDefinitionMap);
return shiroFilterFactoryBean;
}
/**
* 注入 securityManager
*/
@Bean(name = "securityManager")
public SecurityManager securityManager() {
DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager();
// 设置realm.
securityManager.setRealm(myShiroRealm());
// 自定义缓存实现 使用redis
securityManager.setCacheManager(cacheManager());
// 自定义session管理 使用redis
securityManager.setSessionManager(sessionManager());
return securityManager;
}
/**
* 身份验证器
*/
@Bean
public MyShiroRealm myShiroRealm() {
return new MyShiroRealm();
}
}

33
src/main/java/com/stone/conf/shiro/ShiroSessionIdGenerator.java

@ -0,0 +1,33 @@
package com.stone.conf.shiro;
import org.apache.shiro.session.Session;
import org.apache.shiro.session.mgt.eis.JavaUuidSessionIdGenerator;
import org.apache.shiro.session.mgt.eis.SessionIdGenerator;
import org.springframework.beans.factory.annotation.Value;
import java.io.Serializable;
/**
* 自定义SessionId生成器
*
* @author zhoujl
* @date 2019-09-16
*/
public class ShiroSessionIdGenerator implements SessionIdGenerator {
@Value("${projectName}")
private String projectName;
/**
* 实现sessionId生成
*
* @param session session对象
* @return id
*/
@Override
public Serializable generateId(Session session) {
Serializable sessionId = new JavaUuidSessionIdGenerator().generateId(session);
return String.format(projectName + "_login_token_%s", sessionId);
}
}

38
src/main/java/com/stone/controller/CategoryController.java

@ -0,0 +1,38 @@
package com.stone.controller;
import com.stone.model.vo.PageVO;
import com.stone.service.CategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
* 检验类别接口
*
* @author zhoujl
* @date 2019-03-25
*/
@RestController
@RequestMapping("/category")
@Api(tags = "检验类别接口")
public class CategoryController {
@Resource
private CategoryService categoryService;
/**
* 查询检验类别列表
*
* @return 检验类别分页信息
*/
@GetMapping("/pull")
@ApiOperation(value = "查询检验类别列表", response = PageVO.class, notes = "根据条件查询检验类别列表并进行分页", httpMethod = "GET")
public PageVO pull() {
return categoryService.pull();
}
}

46
src/main/java/com/stone/controller/DownloadController.java

@ -0,0 +1,46 @@
package com.stone.controller;
import com.stone.base.BaseController;
import com.stone.base.BaseService;
import com.stone.model.vo.PageVO;
import com.stone.service.DownloadService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
* @author zichen
*/
@RequestMapping("/download")
@RestController
public class DownloadController extends BaseController {
@Resource
private DownloadService downloadService;
/**
* 获取service
*
* @return
*/
@Override
public BaseService getService() {
return downloadService;
}
@GetMapping("/pullSeniorPath")
@ResponseBody
public PageVO pullSeniorPath(String id, String type) {
return downloadService.pullSeniorPath(id, type);
}
@GetMapping("/pullIntermediatePath")
@ResponseBody
public PageVO pullIntermediatePath(String id, String type) {
return downloadService.pullIntermediatePath(id, type);
}
}

49
src/main/java/com/stone/controller/SearchController.java

@ -0,0 +1,49 @@
package com.stone.controller;
import com.stone.base.BaseController;
import com.stone.base.BaseService;
import com.stone.model.vo.PageVO;
import com.stone.service.SearchService;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
/**
* @author zichen
*/
@RequestMapping("/search")
@RestController
public class SearchController extends BaseController {
@Resource
private SearchService searchService;
/**
* 获取service
*
* @return
*/
@Override
public BaseService getService() {
return searchService;
}
@GetMapping("/intermediate")
@ResponseBody
public PageVO pullIntermediate(String id) {
return searchService.pullIntermediate(id);
}
@GetMapping("/senior")
@ResponseBody
public PageVO pullSenior(@RequestParam(name = "id") String id) {
return searchService.pullSenior(id);
}
@GetMapping("/progress")
@ResponseBody
public PageVO pullProgress(@RequestParam(name = "id") String id, @RequestParam(name = "bianhao") String bianhao) {
return searchService.pullProgress(id, bianhao);
}
}

41
src/main/java/com/stone/controller/UserController.java

@ -0,0 +1,41 @@
package com.stone.controller;
import com.stone.base.BaseController;
import com.stone.base.BaseService;
import com.stone.model.dto.UserDTO;
import com.stone.model.po.bjd.BjdSenior;
import com.stone.model.vo.PageVO;
import com.stone.service.UserService;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
/**
* @author zichen
*/
@Api(value = "企业用户")
@RequestMapping("/user")
@RestController
public class UserController extends BaseController<BjdSenior, Integer> {
@Resource
private UserService userService;
/**
* 获取service
*
* @return
*/
@Override
public BaseService<BjdSenior, Integer> getService() {
return userService;
}
@PostMapping("/login")
@ResponseBody
public PageVO login(@RequestBody UserDTO userDTO) {
return userService.login(userDTO);
}
}

11
src/main/java/com/stone/mapper/intermediate/BjdIntermediateMapper.java

@ -0,0 +1,11 @@
package com.stone.mapper.intermediate;
import com.stone.base.BaseMapper;
import com.stone.model.po.bjd.BjdIntermediate;
import com.stone.model.po.bjd.BjdSenior;
/**
* @author zichen
*/
public interface BjdIntermediateMapper extends BaseMapper<BjdIntermediate> {
}

11
src/main/java/com/stone/mapper/intermediate/HzdIntermediateMapper.java

@ -0,0 +1,11 @@
package com.stone.mapper.intermediate;
import com.stone.base.BaseMapper;
import com.stone.model.po.bjd.BjdIntermediate;
import com.stone.model.po.bjd.HzdIntermediate;
/**
* @author zichen
*/
public interface HzdIntermediateMapper extends BaseMapper<HzdIntermediate> {
}

11
src/main/java/com/stone/mapper/intermediate/RenwuIntermediateMapper.java

@ -0,0 +1,11 @@
package com.stone.mapper.intermediate;
import com.stone.base.BaseMapper;
import com.stone.model.po.renwu.RenwuIntermediate;
/**
* @author zichen
*/
public interface RenwuIntermediateMapper extends BaseMapper<RenwuIntermediate> {
}

11
src/main/java/com/stone/mapper/intermediate/ReportIntermediateMapper.java

@ -0,0 +1,11 @@
package com.stone.mapper.intermediate;
import com.stone.base.BaseMapper;
import com.stone.model.po.report.Report;
/**
* @author zichen
*/
public interface ReportIntermediateMapper extends BaseMapper<Report> {
}

11
src/main/java/com/stone/mapper/intermediate/YsjlIntermediateMapper.java

@ -0,0 +1,11 @@
package com.stone.mapper.intermediate;
import com.stone.base.BaseMapper;
import com.stone.model.po.ysjl.YsjlIntermediate;
/**
* @author zichen
*/
public interface YsjlIntermediateMapper extends BaseMapper<YsjlIntermediate> {
}

10
src/main/java/com/stone/mapper/senior/BjdSeniorMapper.java

@ -0,0 +1,10 @@
package com.stone.mapper.senior;
import com.stone.base.BaseMapper;
import com.stone.model.po.bjd.BjdSenior;
/**
* @author zichen
*/
public interface BjdSeniorMapper extends BaseMapper<BjdSenior> {
}

10
src/main/java/com/stone/mapper/senior/CategoryMapper.java

@ -0,0 +1,10 @@
package com.stone.mapper.senior;
import com.stone.base.BaseMapper;
import com.stone.model.po.dic.Category;
/**
* @author zichen
*/
public interface CategoryMapper extends BaseMapper<Category> {
}

11
src/main/java/com/stone/mapper/senior/RenwuSeniorMapper.java

@ -0,0 +1,11 @@
package com.stone.mapper.senior;
import com.stone.base.BaseMapper;
import com.stone.model.po.renwu.RenwuSenior;
import com.stone.model.po.ysjl.YsjlSenior;
/**
* @author zichen
*/
public interface RenwuSeniorMapper extends BaseMapper<RenwuSenior> {
}

10
src/main/java/com/stone/mapper/senior/TemplateMapper.java

@ -0,0 +1,10 @@
package com.stone.mapper.senior;
import com.stone.base.BaseMapper;
import com.stone.model.po.template.Template;
/**
* @author zichen
*/
public interface TemplateMapper extends BaseMapper<Template> {
}

11
src/main/java/com/stone/mapper/senior/YsjlSeniorMapper.java

@ -0,0 +1,11 @@
package com.stone.mapper.senior;
import com.stone.base.BaseMapper;
import com.stone.model.po.ysjl.YsjlSenior;
/**
* @author zichen
*/
public interface YsjlSeniorMapper extends BaseMapper<YsjlSenior> {
}

17
src/main/java/com/stone/model/dto/UserDTO.java

@ -0,0 +1,17 @@
package com.stone.model.dto;
import io.swagger.annotations.ApiModel;
import lombok.Data;
/**
* @author zichen
*/
@ApiModel("用户登录验证传输对象")
@Data
public class UserDTO {
private String username;
private String password;
}

39
src/main/java/com/stone/model/po/bjd/BjdIntermediate.java

@ -0,0 +1,39 @@
package com.stone.model.po.bjd;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.Id;
import javax.persistence.Table;
/**
* @author zichen
*/
@AllArgsConstructor
@NoArgsConstructor
@Builder
@Data
@Table(name = "biz_bjd")
@ApiModel(description = "16版报检单对象")
public class BjdIntermediate {
@Id
private String annalid;
@ApiModelProperty("编号")
private String bianhao;
@ApiModelProperty("使用单位")
private String shiyongdanwei;
@ApiModelProperty("报检状态:0:新建、1:已办结、2:补正通知、3:不予受理、4:异常退回、5:撤检")
private String bjstate;
@ApiModelProperty("作废状态")
private Boolean zfstate;
}

53
src/main/java/com/stone/model/po/bjd/BjdSenior.java

@ -0,0 +1,53 @@
package com.stone.model.po.bjd;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import javax.persistence.*;
import java.io.Serializable;
/**
* 企业用户
* @author zichen
*/
@AllArgsConstructor
@NoArgsConstructor
@Builder
@Data
@Table(name = "biz_bjd")
@ApiModel(description = "18版用户对象")
public class BjdSenior implements Serializable {
@Id
@ApiModelProperty(value = "主键")
private Integer id;
@ApiModelProperty(value = "报检单编号")
private String serialNumber;
@ApiModelProperty(value = "外网查询密码")
private String wwcxmima;
@ApiModelProperty("使用单位")
private String shiyongdanwei;
@ApiModelProperty("设备种类代码")
private String shebeizhongleidaima;
/**
* 0: 新建/预审
* 1: 待审核
* 2: 审核通过
* 3不予受理
* 4补证通知
* 5: 异常收回
* 6异常退回
*/
@ApiModelProperty(value = "报检状态")
private String bjState;
@ApiModelProperty(value = "作废状态")
private Boolean zfState;
}

39
src/main/java/com/stone/model/po/bjd/HzdIntermediate.java

@ -0,0 +1,39 @@
package com.stone.model.po.bjd;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.Id;
import javax.persistence.Table;
/**
* @author zichen
*/
@AllArgsConstructor
@NoArgsConstructor
@Builder
@Data
@Table(name = "biz_hzd")
@ApiModel(description = "16版用户对象")
public class HzdIntermediate {
@Id
private String annalid;
@ApiModelProperty("报检单_ID")
private String bjdId;
@ApiModelProperty("编号")
private String bianhao;
@ApiModelProperty("外网查询密码")
private String wwcxmima;
@ApiModelProperty("作废状态")
private Boolean zfstate;
}

40
src/main/java/com/stone/model/po/dic/Category.java

@ -0,0 +1,40 @@
package com.stone.model.po.dic;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.persistence.*;
import java.io.Serializable;
/**
* 检验类别
* @author zichen
*/
@Data
@Table(name = "sys_category")
public class Category implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@ApiModelProperty(value = "主键")
private Integer id;
@ApiModelProperty(value = "检验类别名称")
private String name;
@ApiModelProperty(value = "检验类别代码")
private String code;
@ApiModelProperty(value = "设备种类 (以逗号分隔)")
private String species;
@Column(name = "parent_id")
@ApiModelProperty(value = "父类主键")
private Byte parentId;
@ApiModelProperty(value = "排序")
private Byte sort;
}

65
src/main/java/com/stone/model/po/renwu/RenwuIntermediate.java

@ -0,0 +1,65 @@
package com.stone.model.po.renwu;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import javax.persistence.*;
import java.time.LocalDate;
/**
* @author zichen
*/
@AllArgsConstructor
@NoArgsConstructor
@Builder
@Data
@Table(name = "biz_renwu")
@ApiModel(description = "任务")
public class RenwuIntermediate {
@Id
@ApiModelProperty(value = "主键")
private Integer annalid;
@ApiModelProperty(value = "检验类别")
private String renwuId;
@ApiModelProperty(value = "检验类别")
private String jianyanleibie;
@ApiModelProperty(value = "注册代码")
private String zhucedaima;
@ApiModelProperty(value = "产品编号")
private String chanpinbianhao;
@ApiModelProperty(value = "使用登记编号")
private String shiyongdengjibianhao;
@ApiModelProperty(value = "区划名称")
private String quhuamingcheng;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty(value = "受理日期")
private LocalDate shouliriqi;
@ApiModelProperty(value = "任务状态:0代办 1已约 2已办 3异常退回 4任务终止 5任务撤检")
private String rwstate;
@ApiModelProperty(value = "分配状态")
private Boolean fpstate;
@ApiModelProperty(value = "交费状态")
private Boolean jfstate;
@ApiModelProperty(value = "作废状态")
private Boolean zfstate;
}

81
src/main/java/com/stone/model/po/renwu/RenwuSenior.java

@ -0,0 +1,81 @@
package com.stone.model.po.renwu;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import javax.persistence.*;
import java.time.LocalDate;
/**
* @author zichen
*/
@AllArgsConstructor
@NoArgsConstructor
@Builder
@Data
@Table(name = "biz_renwu")
@ApiModel(description = "任务")
public class RenwuSenior {
@Id
@ApiModelProperty(value = "主键")
private Integer id;
@Column(name = "id_2016")
private Integer id16;
@ApiModelProperty(value = "报检单主键")
@Column(name = "bjd_id")
private Integer bjdId;
@ApiModelProperty(value = "检验类别")
private String jianyanleibie;
@ApiModelProperty(value = "注册代码")
private String zhucedaima;
@ApiModelProperty(value = "产品编号")
private String chanpinbianhao;
@ApiModelProperty(value = "使用登记编号")
private String shiyongdengjibianhao;
@ApiModelProperty(value = "区划名称")
private String quhuamingcheng;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty(value = "受理日期")
private LocalDate shouliriqi;
@ApiModelProperty(value = "任务状态")
@Column(name = "rw_state")
private String rwState;
@ApiModelProperty(value = "分配状态")
@Column(name = "fp_state")
private Boolean fpState;
@Column(name = "jf_state")
@ApiModelProperty(value = "交费状态")
private Boolean jfState;
/**
* 0待补交
* 1已补交
* */
@Column(name = "bj_state")
@ApiModelProperty(value = "补交状态")
private Boolean bjState;
@Column(name = "zf_state")
@ApiModelProperty(value = "作废状态")
private Boolean zfState;
}

63
src/main/java/com/stone/model/po/report/Report.java

@ -0,0 +1,63 @@
package com.stone.model.po.report;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Table;
import java.time.LocalDate;
/**
* @author zichen
*/
@AllArgsConstructor
@NoArgsConstructor
@Builder
@Data
@Table(name = "biz_report")
@ApiModel(description = "检验报告")
public class Report {
@Id
private String annalid;
private String ysjlId;
private String renwuId;
private String baogaobianhao;
private String jianyanleibie;
private String zhucedaima;
private String shiyongdengjibianhao;
private String chanpinbianhao;
private String shebeizhongleidaima;
private LocalDate jianyanriqi;
private LocalDate jianyanjieshuriqi;
private LocalDate shenpiriqi;
private Integer bglx;
private Integer flowstatus;
private Boolean zfstate;
@Column(name = "gdState")
private String gdState;
@ApiModelProperty(value = "电子印章")
private Boolean signState;
}

26
src/main/java/com/stone/model/po/template/Template.java

@ -0,0 +1,26 @@
package com.stone.model.po.template;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.persistence.*;
import java.io.Serializable;
/**
* 模板
* @author zichen
*/
@Data
@Table(name = "flow_template")
public class Template implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@ApiModelProperty(value = "主键")
private Integer id;
@Column(name = "temp_name")
@ApiModelProperty(value = "模板名称")
private String tempName;
}

49
src/main/java/com/stone/model/po/ysjl/YsjlIntermediate.java

@ -0,0 +1,49 @@
package com.stone.model.po.ysjl;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.Id;
import javax.persistence.Table;
import java.time.LocalDate;
/**
* @author zichen
*/
@AllArgsConstructor
@NoArgsConstructor
@Builder
@Data
@Table(name = "biz_ysjl")
@ApiModel(description = "原始记录")
public class YsjlIntermediate {
@Id
private String annalid;
private String renwuId;
private String jilubianhao;
private String jianyanleibie;
private String zhucedaima;
private String shiyongdengjibianhao;
private String chanpinbianhao;
private LocalDate jianyanriqi;
private LocalDate jianyanjieshuriqi;
@ApiModelProperty(value = "原始记录状态:0待办 1已办")
private String jlstate;
private Boolean zfstate;
}

112
src/main/java/com/stone/model/po/ysjl/YsjlSenior.java

@ -0,0 +1,112 @@
package com.stone.model.po.ysjl;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import javax.persistence.*;
import java.time.LocalDate;
/**
* @author zichen
*/
@AllArgsConstructor
@NoArgsConstructor
@Builder
@Data
@Table(name = "biz_ysjl")
@ApiModel(description = "原始记录/检验报告")
public class YsjlSenior {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@ApiModelProperty(value = "报告表主键")
private Integer id;
@ApiModelProperty(value = "任务主键")
private Integer renwuId;
@ApiModelProperty(value = "模板主键")
private Integer modelId;
@ApiModelProperty(value = "创建时间")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@Column(name = "create_time")
private LocalDate createTime;
@ApiModelProperty(value = "设备种类代码")
private String shebeizhongleidaima;
@ApiModelProperty(value = "记录编号")
private String jilubianhao;
@ApiModelProperty(value = "报告编号")
private String baogaobianhao;
@ApiModelProperty(value = "注册代码")
private String zhucedaima;
@ApiModelProperty(value = "使用登记证编号")
private String shiyongdengjibianhao;
@ApiModelProperty(value = "产品编号/出厂编号/管道编号/锅炉使用编号")
private String chanpinbianhao;
@ApiModelProperty(value = "报告类型")
private Integer bglx;
@ApiModelProperty(value = "作废状态")
private Boolean zfState;
@ApiModelProperty(value = "内部类别")
private String neibuleibie;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty(value = "检验日期/检验结束日期")
private LocalDate jianyanjieshuriqi;
/**
* ysjl数据是原始记录
* bggl数据是报告
*/
@ApiModelProperty(value = "记录所处的状态")
@Column(name = "cj_state")
private String cjState;
/**
* null 原始记录待办
* 1 起草报告
* 2 审核报告
* 3 审批报告
* 4 办结报告
*/
@ApiModelProperty(value = "报告状态")
private Integer flowstatus;
@ApiModelProperty(value = "当前报告的处理人")
private String renlingren;
@Column(name = "guidang_state")
@ApiModelProperty(value = "归档状态")
private Boolean guidangState;
@Column(name = "fafang_state")
@ApiModelProperty(value = "发放状态")
private Boolean fafangState;
@Column(name = "generate_pdf_state")
@ApiModelProperty(value = "生成PDF状态 true-办结已生成PDF false/null-办结未生成PDF")
private Boolean generatePdfState;
@Column(name = "jf_state")
@ApiModelProperty(value = "交费状态")
private Boolean jfState;
}

43
src/main/java/com/stone/model/vo/PageVO.java

@ -0,0 +1,43 @@
package com.stone.model.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* @author zichen
*/
@ApiModel(description = "VO")
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class PageVO<T> {
@ApiModelProperty(value = "数据")
private T data;
@ApiModelProperty(value = "列表数据")
private List<T> list;
@ApiModelProperty(value = "总行数")
private Long total;
@ApiModelProperty(value = "请求状态")
private String statusCode;
@ApiModelProperty(value = "提示")
private String tip;
@ApiModelProperty(value = "版本:16、18")
private String version;
@ApiModelProperty(value = "token")
private String token;
}

46
src/main/java/com/stone/model/vo/SearchSeniorVO.java

@ -0,0 +1,46 @@
package com.stone.model.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author zichen
*/
@ApiModel(description = "VO")
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class SearchSeniorVO {
private String id;
private String baogaobinahao;
private String jianyanleibie;
private String shiyongdanwei;
private String zhucedaima;
private String chanpinbianhao;
private String shiyongdengjibianhao;
private String quhuamingcheng;
private String shouliriqi;
private String jianyanriqi;
@ApiModelProperty(value = "环节:bjd>renwu>ysjl>report")
private String link;
@ApiModelProperty(value = "当对应环节下的状态")
private String status;
}

14
src/main/java/com/stone/service/CategoryService.java

@ -0,0 +1,14 @@
package com.stone.service;
import com.stone.base.BaseService;
import com.stone.model.vo.PageVO;
public interface CategoryService extends BaseService {
/**
* 获取检验类别列表
* @return
*/
PageVO pull();
}

26
src/main/java/com/stone/service/DownloadService.java

@ -0,0 +1,26 @@
package com.stone.service;
import com.stone.base.BaseService;
import com.stone.model.vo.PageVO;
/**
* @author zichen
*/
public interface DownloadService extends BaseService {
/**
* 获取18版下载地址
* @param id 原始记录主键
* @param type 类型JYBG报告HGZ合格证
* @return
*/
PageVO pullSeniorPath(String id, String type);
/**
* 获取16版下载地址
* @param id 检验报告主键
* @param type 类型JYBG报告HGZ合格证
* @return
*/
PageVO pullIntermediatePath(String id, String type);
}

32
src/main/java/com/stone/service/SearchService.java

@ -0,0 +1,32 @@
package com.stone.service;
import com.stone.base.BaseService;
import com.stone.model.vo.PageVO;
/**
* @author zichen
*/
public interface SearchService extends BaseService {
/**
* 16版拉取设备进度信息
* @param id 报检单ID
* @return
*/
PageVO pullIntermediate(String id);
/**
* 18版拉取设备进度信息
* @param id 报检单ID
* @return
*/
PageVO pullSenior(String id);
/**
* 根据编号查询报检单然后根据设备种类选择查询进度的方式返回当前进度
* @param id
* @param bianhao
* @return
*/
PageVO pullProgress(String id, String bianhao);
}

20
src/main/java/com/stone/service/UserService.java

@ -0,0 +1,20 @@
package com.stone.service;
import com.stone.base.BaseService;
import com.stone.model.dto.UserDTO;
import com.stone.model.po.bjd.BjdSenior;
import com.stone.model.vo.PageVO;
/**
* @author zichen
*/
public interface UserService extends BaseService<BjdSenior, Integer> {
/**
* 用户登录验证
* @param userDTO
* @return
*/
PageVO login(UserDTO userDTO);
}

37
src/main/java/com/stone/service/impl/CategoryServiceImpl.java

@ -0,0 +1,37 @@
package com.stone.service.impl;
import com.stone.base.BaseMapper;
import com.stone.mapper.senior.CategoryMapper;
import com.stone.model.vo.PageVO;
import com.stone.service.CategoryService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* @author zichen
*/
@Service
public class CategoryServiceImpl implements CategoryService {
@Resource
private CategoryMapper categoryMapper;
@Override
public BaseMapper getRepository() {
return categoryMapper;
}
/**
* 获取检验类别列表
*
* @return
*/
@Override
public PageVO pull() {
List list = categoryMapper.selectAll();
return PageVO.builder().list(list).build();
}
}

112
src/main/java/com/stone/service/impl/DownloadServiceImpl.java

@ -0,0 +1,112 @@
package com.stone.service.impl;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.stone.base.BaseMapper;
import com.stone.conf.enums.EquipmentCodeEnum;
import com.stone.conf.exception.BusinessException;
import com.stone.mapper.intermediate.RenwuIntermediateMapper;
import com.stone.mapper.intermediate.ReportIntermediateMapper;
import com.stone.mapper.senior.TemplateMapper;
import com.stone.mapper.senior.YsjlSeniorMapper;
import com.stone.model.po.renwu.RenwuIntermediate;
import com.stone.model.po.report.Report;
import com.stone.model.po.ysjl.YsjlSenior;
import com.stone.model.vo.PageVO;
import com.stone.service.DownloadService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
/**
* @author zichen
*/
@Service
public class DownloadServiceImpl implements DownloadService {
@Resource
private YsjlSeniorMapper ysjlSeniorMapper;
@Resource
private TemplateMapper templateMapper;
@Resource
private ReportIntermediateMapper reportIntermediateMapper;
@Resource
private RenwuIntermediateMapper renwuIntermediateMapper;
@Resource
private HttpServletRequest request;
@Value("${server.servlet.context-path}")
private String contextPath;
@Override
public BaseMapper getRepository() {
return null;
}
/**
* 获取18版下载地址
* 报告打印路径示例http://192.168.1.130:9093/DYBGManager/JNJY18/pdf/JYBG/2000/2020/3/RD(2020)-0153(6459)压力容器定期检验报告.pdf
* 合格证打印路径示例http://192.168.1.130:9093/DYBGManager/JNJY18/pdf/HGZ/2000/2020/3/RD(2020)-0114(6370)压力容器打印合格证.pdf
* @param id 原始记录主键
* @param type 类型JYBG报告HGZ合格证
* @return
*/
@Override
public PageVO pullSeniorPath(String id, String type) {
YsjlSenior ysjlSenior = ysjlSeniorMapper.selectByPrimaryKey(id);
// 0. 判断是否已办结
if (ObjectUtil.isNotNull(ysjlSenior.getFlowstatus()) && ysjlSenior.getFlowstatus() > 3) {
throw new BusinessException("报告流程在检验结束时才可以进行打印!");
}
// 1. 判断是否交费
// 需要判断补交状态吗?任务里有个补交状态
if (!ysjlSenior.getJfState()) {
throw new BusinessException("交费后才能打印!");
}
// 2. 获取打印路径
String tempName = "";
if (StrUtil.equals(type, "JYBG")) {
tempName = templateMapper.selectByPrimaryKey(ysjlSenior.getModelId()).getTempName().replace("记录", "报告");
} else {
tempName = EquipmentCodeEnum.valueOf(ysjlSenior.getShebeizhongleidaima()).getName() + "打印合格证";
}
return PageVO.builder().data(request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + contextPath + "/JNJY18/pdf/" + type + "/"
+ ysjlSenior.getShebeizhongleidaima() + "/" + ysjlSenior.getCreateTime().getYear() + "/" + ysjlSenior.getCreateTime().getMonthValue()
+ "/" + ysjlSenior.getBaogaobianhao() + "(" + ysjlSenior.getId() + ")" + tempName + ".pdf").build();
}
/**
* 获取16版下载地址
*
* @param id 检验报告主键
* @param type 类型JYBG报告HGZ合格证
* @return
*/
@Override
public PageVO pullIntermediatePath(String id, String type) {
Report report = reportIntermediateMapper.selectByPrimaryKey(id);
if (ObjectUtil.isNotNull(report.getFlowstatus()) && report.getFlowstatus() > 3) {
throw new BusinessException("报告流程在检验结束时才可以进行打印!");
}
RenwuIntermediate renwuIntermediate = RenwuIntermediate.builder().renwuId(report.getRenwuId()).build();
renwuIntermediate = renwuIntermediateMapper.selectOne(renwuIntermediate);
// 1. 判断是否交费
// 需要判断补交状态吗?
/*if (!renwuIntermediate.getJfstate()) {
throw new BusinessException("交费后才能打印!");
}*/
// 2. 获取打印路径
String path = "";
return PageVO.builder().data(request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + contextPath + "/JNJY16/pdf/"
+ report.getShenpiriqi().getYear() + "/" + report.getShebeizhongleidaima() + "/" + type + "/" + (StrUtil.equals(report.getJianyanleibie(), "定期检验") ?
"dqjy" : "jdjy") + "/" + (StrUtil.equals(type, "HGZ") ? "hgz" : report.getShenpiriqi().getMonthValue()) + "/" + report.getBaogaobianhao() + "-"
+ report.getAnnalid() + (StrUtil.equals(type, "HGZ") ? "-hgz" : "") + ".pdf").build();
}
}

253
src/main/java/com/stone/service/impl/SearchServiceImpl.java

@ -0,0 +1,253 @@
package com.stone.service.impl;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.stone.base.BaseMapper;
import com.stone.conf.enums.EquipmentCodeEnum;
import com.stone.conf.enums.LinkConstants;
import com.stone.conf.enums.VersionConstants;
import com.stone.mapper.intermediate.RenwuIntermediateMapper;
import com.stone.mapper.intermediate.ReportIntermediateMapper;
import com.stone.mapper.intermediate.YsjlIntermediateMapper;
import com.stone.mapper.senior.BjdSeniorMapper;
import com.stone.mapper.senior.RenwuSeniorMapper;
import com.stone.mapper.senior.YsjlSeniorMapper;
import com.stone.model.po.bjd.BjdSenior;
import com.stone.model.po.renwu.RenwuIntermediate;
import com.stone.model.po.renwu.RenwuSenior;
import com.stone.model.po.report.Report;
import com.stone.model.po.ysjl.YsjlIntermediate;
import com.stone.model.po.ysjl.YsjlSenior;
import com.stone.model.vo.PageVO;
import com.stone.model.vo.SearchSeniorVO;
import com.stone.service.SearchService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicReference;
/**
* @author zichen
*/
@Service
public class SearchServiceImpl implements SearchService {
@Resource
private BjdSeniorMapper bjdSeniorMapper;
@Resource
private RenwuSeniorMapper renwuSeniorMapper;
@Resource
private YsjlSeniorMapper ysjlSeniorMapper;
@Resource
private YsjlIntermediateMapper ysjlIntermediateMapper;
@Resource
private ReportIntermediateMapper reportIntermediateMapper;
@Resource
private RenwuIntermediateMapper renwuIntermediateMapper;
@Override
public BaseMapper getRepository() {
return null;
}
/**
* 16版拉取设备进度信息
*
* @param id 报检单ID
* @return
*/
@Override
public PageVO pullIntermediate(String id) {
return pullIntermediate(bjdSeniorMapper.selectByPrimaryKey(id));
}
public PageVO pullIntermediate(BjdSenior bjdSenior) {
List<Object> list = new ArrayList<>();
AtomicReference<String> link = new AtomicReference<>();
AtomicReference<String> status = new AtomicReference<>();
if (ObjectUtil.isNotNull(bjdSenior)) {
if (!StrUtil.equals(bjdSenior.getBjState(), "2")) {
// 报检
link.set(LinkConstants.BJ);
status.set(bjdSenior.getBjState());
}
List<RenwuSenior> renwuSeniors = renwuSeniorMapper.select(RenwuSenior.builder().bjdId(bjdSenior.getId()).zfState(false).build());
if (renwuSeniors.size() != 0) {
renwuSeniors.forEach(renwu -> {
SearchSeniorVO searchSeniorVO = SearchSeniorVO.builder()
.link(link.get())
.status(status.get())
.zhucedaima(renwu.getZhucedaima())
.jianyanleibie(renwu.getJianyanleibie())
.chanpinbianhao(renwu.getChanpinbianhao())
.quhuamingcheng(renwu.getQuhuamingcheng())
.shiyongdanwei(bjdSenior.getShiyongdanwei())
.shiyongdengjibianhao(renwu.getShiyongdengjibianhao())
.shouliriqi(renwu.getShouliriqi().toString())
.build();
if (StrUtil.isEmpty(link.get())) {
if (renwu.getFpState()) {
// 已分配
searchSeniorVO.setLink(LinkConstants.ALLOT_RENWU);
searchSeniorVO.setStatus(renwu.getRwState());
RenwuIntermediate renwuIntermediate = renwuIntermediateMapper.selectByPrimaryKey(renwu.getId16());
if (ObjectUtil.isNotNull(renwuIntermediate)) {
YsjlIntermediate ysjlIntermediate = YsjlIntermediate.builder().renwuId(String.valueOf(renwuIntermediate.getRenwuId())).zfstate(false).build();
ysjlIntermediate = ysjlIntermediateMapper.selectOne(ysjlIntermediate);
if (ObjectUtil.isNotNull(ysjlIntermediate)) {
searchSeniorVO.setZhucedaima(ysjlIntermediate.getZhucedaima());
searchSeniorVO.setJianyanleibie(ysjlIntermediate.getJianyanleibie());
searchSeniorVO.setChanpinbianhao(ysjlIntermediate.getChanpinbianhao());
searchSeniorVO.setShiyongdengjibianhao(ysjlIntermediate.getShiyongdengjibianhao());
searchSeniorVO.setJianyanriqi(ObjectUtil.isNotNull(ysjlIntermediate.getJianyanjieshuriqi()) ?
ysjlIntermediate.getJianyanjieshuriqi().toString() : ysjlIntermediate.getJianyanriqi().toString());
if (StrUtil.equals(ysjlIntermediate.getJlstate(), "0") || StrUtil.isEmpty(ysjlIntermediate.getJlstate())) {
// 待办原始记录
searchSeniorVO.setLink(LinkConstants.YSJL);
searchSeniorVO.setStatus("0");
searchSeniorVO.setBaogaobinahao(ysjlIntermediate.getJilubianhao());
} else {
// 检验报告
Report report = Report.builder().ysjlId(ysjlIntermediate.getAnnalid()).bglx(1).zfstate(false).build();
report = reportIntermediateMapper.selectOne(report);
if (ObjectUtil.isNotNull(report)) {
searchSeniorVO.setLink(LinkConstants.REPORT);
searchSeniorVO.setStatus(String.valueOf(report.getFlowstatus()));
searchSeniorVO.setId(report.getAnnalid());
searchSeniorVO.setBaogaobinahao(report.getBaogaobianhao());
}
}
} else {
// 如果没有出具原始记录,直接出具检验报告
Report report = Report.builder().renwuId(renwuIntermediate.getRenwuId()).bglx(1).zfstate(false).build();
report = reportIntermediateMapper.selectOne(report);
if (ObjectUtil.isNotNull(report)) {
searchSeniorVO.setLink(LinkConstants.REPORT);
searchSeniorVO.setStatus(String.valueOf(report.getFlowstatus()));
searchSeniorVO.setId(report.getAnnalid());
searchSeniorVO.setBaogaobinahao(report.getBaogaobianhao());
searchSeniorVO.setZhucedaima(report.getZhucedaima());
searchSeniorVO.setJianyanleibie(report.getJianyanleibie());
searchSeniorVO.setChanpinbianhao(report.getChanpinbianhao());
searchSeniorVO.setShiyongdengjibianhao(report.getShiyongdengjibianhao());
searchSeniorVO.setJianyanriqi(ObjectUtil.isNotNull(report.getJianyanjieshuriqi()) ?
report.getJianyanjieshuriqi().toString() : report.getJianyanriqi().toString());
}
}
}
} else {
// 待分配
searchSeniorVO.setLink(LinkConstants.RENWU);
searchSeniorVO.setStatus("0");
}
}
list.add(searchSeniorVO);
});
}
}
return PageVO.builder().list(list).version(VersionConstants.Intermediate).build();
}
/**
* 18版拉取设备进度信息
*
* @param id 报检单ID
* @return
*/
@Override
public PageVO<Object> pullSenior(String id) {
BjdSenior bjdSenior = bjdSeniorMapper.selectByPrimaryKey(id);
return pullSenior(bjdSenior);
}
public PageVO<Object> pullSenior(BjdSenior bjdSenior) {
List<Object> list = new ArrayList<>();
AtomicReference<String> link = new AtomicReference<>();
AtomicReference<String> status = new AtomicReference<>();
// 报检单状态 0: 新建/预审、1: 待审核 2: 审核通过 3:不予受理 4:补证通知 5: 异常收回 6:异常退回
if (ObjectUtil.isNotNull(bjdSenior)) {
if (!StrUtil.equals(bjdSenior.getBjState(), "2")) {
// 报检
link.set(LinkConstants.BJ);
status.set(bjdSenior.getBjState());
}
List<RenwuSenior> renwuSeniors = renwuSeniorMapper.select(RenwuSenior.builder().bjdId(bjdSenior.getId()).zfState(false).build());
if (renwuSeniors.size() != 0) {
renwuSeniors.forEach(renwu -> {
SearchSeniorVO searchSeniorVO = SearchSeniorVO.builder()
.link(link.get())
.status(status.get())
.zhucedaima(renwu.getZhucedaima())
.jianyanleibie(renwu.getJianyanleibie())
.chanpinbianhao(renwu.getChanpinbianhao())
.quhuamingcheng(renwu.getQuhuamingcheng())
.shiyongdanwei(bjdSenior.getShiyongdanwei())
.shiyongdengjibianhao(renwu.getShiyongdengjibianhao())
.shouliriqi(renwu.getShouliriqi().toString())
.build();
if (StrUtil.isEmpty(link.get())) {
if (renwu.getFpState()) {
// 已分配
searchSeniorVO.setLink(LinkConstants.ALLOT_RENWU);
searchSeniorVO.setStatus(renwu.getRwState());
YsjlSenior ysjlSenior = YsjlSenior.builder().renwuId(renwu.getId()).zfState(false).bglx(1).build();
ysjlSenior = ysjlSeniorMapper.selectOne(ysjlSenior);
if (ObjectUtil.isNotNull(ysjlSenior)) {
if (StrUtil.equals(ysjlSenior.getCjState(), "ysjl")) {
// 待办原始记录
searchSeniorVO.setLink(LinkConstants.YSJL);
searchSeniorVO.setStatus("0");
searchSeniorVO.setBaogaobinahao(ysjlSenior.getJilubianhao());
} else {
// 检验报告
searchSeniorVO.setLink(LinkConstants.REPORT);
searchSeniorVO.setStatus(String.valueOf(ysjlSenior.getFlowstatus()));
searchSeniorVO.setId(String.valueOf(ysjlSenior.getId()));
searchSeniorVO.setBaogaobinahao(ysjlSenior.getBaogaobianhao());
}
searchSeniorVO.setZhucedaima(ysjlSenior.getZhucedaima());
searchSeniorVO.setJianyanleibie(ysjlSenior.getNeibuleibie());
searchSeniorVO.setChanpinbianhao(ysjlSenior.getChanpinbianhao());
searchSeniorVO.setShiyongdengjibianhao(ysjlSenior.getShiyongdengjibianhao());
searchSeniorVO.setJianyanriqi(ysjlSenior.getJianyanjieshuriqi().toString());
}
} else {
// 待分配
searchSeniorVO.setLink(LinkConstants.RENWU);
searchSeniorVO.setStatus("0");
}
}
list.add(searchSeniorVO);
});
}
}
return PageVO.builder().list(list).version(VersionConstants.SENIOR).build();
}
/**
* 根据编号查询报检单然后根据设备种类选择查询进度的方式返回当前进度
*
* @param id
* @param bianhao
* @return
*/
@Override
public PageVO pullProgress(String id, String bianhao) {
BjdSenior bjdSenior = BjdSenior.builder().id(Integer.valueOf(id)).serialNumber(bianhao).zfState(false).build();
bjdSenior = bjdSeniorMapper.selectOne(bjdSenior);
String sbzldm = bjdSenior.getShebeizhongleidaima();
if (StrUtil.equals(sbzldm, EquipmentCodeEnum.DT.getCode()) || StrUtil.equals(sbzldm, EquipmentCodeEnum.QZJ.getCode()) || StrUtil.equals(sbzldm, EquipmentCodeEnum.CC.getCode())) {
return pullIntermediate(bjdSenior);
} else {
return pullSenior(bjdSenior);
}
}
}

62
src/main/java/com/stone/service/impl/UserServiceImpl.java

@ -0,0 +1,62 @@
package com.stone.service.impl;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.stone.base.BaseMapper;
import com.stone.conf.enums.EquipmentCodeEnum;
import com.stone.conf.enums.VersionConstants;
import com.stone.conf.exception.BusinessException;
import com.stone.mapper.senior.BjdSeniorMapper;
import com.stone.model.dto.UserDTO;
import com.stone.model.po.bjd.BjdSenior;
import com.stone.model.vo.PageVO;
import com.stone.service.UserService;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.UsernamePasswordToken;
import org.apache.shiro.subject.Subject;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
* @author zichen
*/
@Service
public class UserServiceImpl implements UserService {
@Resource
private BjdSeniorMapper bjdSeniorMapper;
@Override
public BaseMapper<BjdSenior> getRepository() {
return bjdSeniorMapper;
}
/**
* 用户登录验证
*
* @param userDTO
* @return
*/
@Override
public PageVO login(UserDTO userDTO) {
Subject currentUser = SecurityUtils.getSubject();
BjdSenior bjdSenior = getRepository().selectOne(BjdSenior.builder().serialNumber(userDTO.getUsername()).zfState(false).build());
if (ObjectUtil.isNotNull(bjdSenior)) {
if (StrUtil.equals(bjdSenior.getWwcxmima(), userDTO.getPassword())) {
String version = VersionConstants.SENIOR;
if (StrUtil.equals(bjdSenior.getShebeizhongleidaima(), EquipmentCodeEnum.DT.getCode()) || StrUtil.equals(bjdSenior.getShebeizhongleidaima(), EquipmentCodeEnum.QZJ.getCode())
|| StrUtil.equals(bjdSenior.getShebeizhongleidaima(), EquipmentCodeEnum.CC.getCode())) {
version = VersionConstants.Intermediate;
}
UsernamePasswordToken token = new UsernamePasswordToken(bjdSenior.getSerialNumber(), bjdSenior.getWwcxmima());
currentUser.login(token);
return PageVO.builder().data(bjdSenior).version(version).token(String.valueOf(currentUser.getSession().getId())).build();
} else {
throw new BusinessException("密码不正确!");
}
} else {
throw new BusinessException("回执单账号不存在!");
}
}
}

55
src/main/java/com/stone/util/Swagger.java

@ -0,0 +1,55 @@
package com.stone.util;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
/**
* Swagger核心配置类
*/
@Configuration
@EnableSwagger2
public class Swagger implements WebMvcConfigurer {
@Value("${swagger.enable}")
private boolean enableSwagger;
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/");
registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
}
@Bean
public Docket createRestApi() {
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo())
.enable(enableSwagger)
.select()
// 指定controller存放的目录路径
.apis(RequestHandlerSelectors.basePackage("com.stone.controller"))
.paths(PathSelectors.any())
.build();
}
private ApiInfo apiInfo() {
return new ApiInfoBuilder()
// 文档标题
.title("明安接口文档")
// 文档描述
.description("https://github.com/SuperZhouDaLu")
.termsOfServiceUrl("https://github.com/SuperZhouDaLu")
.version("v1.0")
.build();
}
}

127
src/main/java/com/stone/util/common/AttributeReflectUtil.java

@ -0,0 +1,127 @@
package com.stone.util.common;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import com.stone.conf.enums.MagicValueConstants;
import io.swagger.annotations.ApiModelProperty;
import javax.persistence.Column;
import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.Date;
/**
* 复制对象工具类
* 利用反射复制对象属性
* @author zichen
*/
public class AttributeReflectUtil {
/**
* 反射obj对象 字段的 注解 jObj 对象的key进行比对然后将其值写入字段
* @param jObj {注解的值: 字段的值, ...}
* @param obj 映射对象
* @return 映射完值的obj对象
*/
public static Object convertDataByApiModelProperty(JSONObject jObj, Object obj){
if (ObjectUtil.isNull(jObj) || ObjectUtil.isNull(obj)) {
return null;
}
Class cls = obj.getClass();
for (Field field : cls.getDeclaredFields()) {
if (field.getName().toLowerCase().contains("id")) {
continue;
}
ApiModelProperty annotation = field.getAnnotation(ApiModelProperty.class);
String value = jObj.getString(annotation.value());
if (StrUtil.isEmpty(value)) {
continue;
}
boolean access = field.isAccessible();
field.setAccessible(true);
try {
switch (field.getGenericType().toString()) {
case "class java.lang.String":
field.set(obj, value);
break;
case "class java.util.Date":
field.set(obj, DateUtil.parse(value, MagicValueConstants.DATE_FORMAT));
break;
default:
break;
}
} catch (IllegalAccessException e) {
e.printStackTrace();
}
field.setAccessible(access);
}
return obj;
}
/**
* 根据result字段的Column注解将source里面的值映射到result字段里
* @param source 源对象
* @param result 结果对象
* @return 处理后的结果对象
*/
public static Object convertDataByAnnotation(Object source, Object result, Class annotationClass, String annotationAttribute) {
if (ObjectUtil.isNull(source) || ObjectUtil.isNull(result)) {
return null;
}
Class sourceCls = source.getClass();
Class resultCls = result.getClass();
for (Field resultField : resultCls.getDeclaredFields()) {
boolean access = resultField.isAccessible();
resultField.setAccessible(true);
try {
String resultFieldVal = (String) invokeAnnotationAttribute(resultField, annotationClass, annotationAttribute);
assert resultFieldVal != null;
Field sourceField = sourceCls.getDeclaredField(resultFieldVal);
boolean sourceAccess = sourceField.isAccessible();
sourceField.setAccessible(true);
switch (sourceField.getGenericType().toString()) {
case "class java.lang.String":
resultField.set(result, sourceField.get(source));
break;
case "class java.util.Date":
resultField.set(result, DateUtil.format((Date) sourceField.get(source), MagicValueConstants.DATE_FORMAT));
break;
default:
break;
}
sourceField.setAccessible(sourceAccess);
} catch (NullPointerException | NoSuchFieldException | IllegalAccessException e) {
e.printStackTrace();
}
resultField.setAccessible(access);
}
return result;
}
/**
* 获取字段的注解中的值
* @param field 字段
* @param annotationClass 注解class
* @param annotationAttribute 注解方法名
* @return 字段的注解中的值
*/
private static Object invokeAnnotationAttribute(Field field, Class annotationClass, String annotationAttribute) {
try {
Annotation annotation = field.getAnnotation(annotationClass);
if (ObjectUtil.isNotNull(annotation)) {
Method method = annotation.getClass().getDeclaredMethod(annotationAttribute);
return method.invoke(annotation);
}
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
e.printStackTrace();
}
return null;
}
}

112
src/main/java/com/stone/util/common/ReturnJSONUtils.java

@ -0,0 +1,112 @@
package com.stone.util.common;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import com.stone.conf.enums.Constants;
import com.stone.conf.enums.ErrorEnum;
import com.stone.conf.exception.CommonJsonException;
import javax.servlet.http.HttpServletRequest;
import java.util.Enumeration;
import java.util.List;
/**
* 后台接口json工具类
*/
public class ReturnJSONUtils {
/**
* 返回一个returnData为空对象的成功消息的json
*/
public static JSONObject successJson() {
return successJson(new JSONObject());
}
/**
* 返回一个返回码为100的json
*/
public static JSONObject successJson(Object returnData) {
return new JSONObject()
.fluentPut("returnCode", Constants.SUCCESS_CODE)
.fluentPut("returnMsg", Constants.SUCCESS_MSG)
.fluentPut("returnData", returnData);
}
/**
* 返回错误信息JSON
*/
public static JSONObject errorJson(ErrorEnum errorEnum) {
return new JSONObject()
.fluentPut("returnCode", errorEnum.getErrorCode())
.fluentPut("returnMsg", errorEnum.getErrorMsg())
.fluentPut("returnData", new JSONObject());
}
/**
* 查询分页结果后的封装工具方法
*
* @param list 查询分页对象list
*/
public static JSONObject successPage(List<?> list) {
return successJson().fluentPut("returnData", new JSONObject().fluentPut("list", list));
}
/**
* 查询分页结果后的封装工具方法
*
* @param list 查询分页对象list
* @param totalCount 查询出记录的总条数
*/
public static JSONObject successPage(List<?> list, Long totalCount) {
return successJson().fluentPut("returnData", new JSONObject().fluentPut("list", list).fluentPut("totalCount", totalCount));
}
/**
* 将request参数值转为json
*/
public static JSONObject request2Json(HttpServletRequest request) {
JSONObject requestJson = new JSONObject();
Enumeration paramNames = request.getParameterNames();
while (paramNames.hasMoreElements()) {
String paramName = (String) paramNames.nextElement();
String[] pv = request.getParameterValues(paramName);
StringBuilder sb = new StringBuilder();
for (int i = 0; i < pv.length; i++) {
if (pv[i].length() > 0) {
if (i > 0) {
sb.append(",");
}
sb.append(pv[i]);
}
}
requestJson.put(paramName, sb.toString());
}
return requestJson;
}
/**
* 验证是否含有全部必填字段
*/
public static void hasAllRequired(final JSONObject jsonObject, String requiredColumns) {
if (!StrUtil.isEmpty(requiredColumns)) {
//验证字段非空
String[] columns = requiredColumns.trim().split(",");
StringBuilder missCol = new StringBuilder();
for (String column : columns) {
Object val = jsonObject.get(column.trim());
if (StrUtil.isEmpty((String) val)) {
missCol.append(column).append(" ");
}
}
if (!StrUtil.isEmpty(missCol.toString())) {
jsonObject.clear();
throw new CommonJsonException(jsonObject
.fluentPut("returnCode", ErrorEnum.E_90003.getErrorCode())
.fluentPut("returnMsg", "缺少必填参数:" + missCol.toString().trim())
.fluentPut("returnData", new JSONObject()));
}
}
}
}

127
src/main/resources/application.yml

@ -0,0 +1,127 @@
env: dev
projectName: JNJY
# 层级目录 【环境集群-地市-环境-与环境相关字段】
envs:
frontAllIp: '*' # 开发环境允许所有ip访问
showSwagger: true # 开发环境可展示swagger文档
hideSwagger: false # 正式环境可隐藏swagger文档
senior: # 18版
prod: # 正式环境
ip: ${envs.frontAllIp}
swagger: ${envs.hideSwagger}
url: jdbc:mysql://172.18.223.67:3306/jinan_front?useSSL=FALSE&serverTimezone=Asia/Shanghai
username: tejianxiangmu
password: Mingantejian2018
dev: # 开发环境
ip: ${envs.frontAllIp}
swagger: ${envs.showSwagger}
url: jdbc:mysql://114.215.66.31:3309/wangchaotest?useSSL=FALSE&serverTimezone=Asia/Shanghai
username: tejianxiangmu
password: MingAnTeJian2019
test:
ip: ${envs.frontAllIp}
swagger: ${envs.showSwagger}
url: jdbc:mysql://127.0.0.1:3309/wangchaotest?useSSL=FALSE&serverTimezone=Asia/Shanghai
username: root
password: root2008
intermediate: # 16版
prod: # 正式环境
ip: ${envs.frontAllIp}
swagger: ${envs.hideSwagger}
url: jdbc:mysql://172.18.223.67:3306/jinan_jianyan?useSSL=FALSE&serverTimezone=Asia/Shanghai
username: tejianxiangmu
password: Mingantejian2018
dev: # 开发环境
ip: ${envs.frontAllIp}
swagger: ${envs.showSwagger}
url: jdbc:mysql://114.215.66.31:3309/jinan_jianyan?useSSL=FALSE&serverTimezone=Asia/Shanghai
username: tejianxiangmu
password: MingAnTeJian2019
test:
ip: ${envs.frontAllIp}
swagger: ${envs.showSwagger}
url: jdbc:mysql://127.0.0.1:3309/jinan_jianyan?useSSL=FALSE&serverTimezone=Asia/Shanghai
username: root
password: root2008
#端口号
server:
#开发环境
port: 9094
#生产环境
#port: 8080
servlet:
context-path: /DYBGManager
session:
timeout: 30M
#日志等级
logging:
level:
BJD: DEBUG
com.stone.mapper: DEBUG
#swagger配置
swagger:
#开发环境
enable: true
#生产环境
#enable: false
#前台ip地址
front:
#开发环境
ip: '*'
#生产环境
#ip: http://127.0.0.1:8080
projectName: JNJY
spring:
datasource:
# 18数据源配置
senior:
url: ${envs.senior.${env}.url}
username: ${envs.senior.${env}.username}
password: ${envs.senior.${env}.password}
type: com.alibaba.druid.pool.DruidDataSource
# 16数据源配置
intermediate:
# # 测试环境
url: ${envs.intermediate.${env}.url}
username: ${envs.intermediate.${env}.username}
password: ${envs.intermediate.${env}.password}
type: com.alibaba.druid.pool.DruidDataSource
#redis配置
redis:
host: localhost
port: 6379
jedis:
pool:
max-idle: 8
min-idle: 0
max-active: 8
max-wait: -1
timeout: 0
jmx:
default-domain: DYBGManager
#mybatis扫描路径
mybatis:
type-aliases-package: com.stone.model
mapper-locations: classpath:mapper/*.xml
#通用mapper
mapper:
mappers:
- com.stone.base.BaseMapper
not-empty: false
identity: MYSQL
before: true
#分页mapper
pagehelper:
helperDialect: mysql
reasonable: true
supportMethodsArguments: true
params: count=countSql

14
src/main/resources/banner.txt

@ -0,0 +1,14 @@
${AnsiColor.BRIGHT_YELLOW}
╭───────────────╮ ╭───────────────╮
│ ┃ │ ┃
│ ${AnsiColor.RED}┅┅┅┅┅┅╮ ${AnsiColor.BRIGHT_YELLOW}┃ │ ${AnsiColor.RED}╭┅┅┅┅┅┅ ${AnsiColor.BRIGHT_YELLOW}┃
│ ${AnsiColor.RED} ╱ ${AnsiColor.BRIGHT_YELLOW}┃ │ ${AnsiColor.RED}┇ ${AnsiColor.BRIGHT_YELLOW}┃
│ ${AnsiColor.RED} ╱ ${AnsiColor.BRIGHT_YELLOW}┃ │ ${AnsiColor.RED}┇ ${AnsiColor.BRIGHT_YELLOW}┃
│ ${AnsiColor.RED} ╱ ${AnsiColor.BRIGHT_YELLOW}┃ │ ${AnsiColor.RED}┇ ${AnsiColor.BRIGHT_YELLOW}┃
│ ${AnsiColor.RED} ╱ ${AnsiColor.BRIGHT_YELLOW}┃ │ ${AnsiColor.RED}┇ ${AnsiColor.BRIGHT_YELLOW}┃
│ ${AnsiColor.RED} ╱ ${AnsiColor.BRIGHT_YELLOW}┃ │ ${AnsiColor.RED}┇ ${AnsiColor.BRIGHT_YELLOW}┃
│ ${AnsiColor.RED}╰┅┅┅┅┅┅ ${AnsiColor.BRIGHT_YELLOW}┃ │ ${AnsiColor.RED}╰┅┅┅┅┅┅ ${AnsiColor.BRIGHT_YELLOW}┃
│ ┃ │ ┃
╰━━━━━━━━━━━━━━━╯ ╰━━━━━━━━━━━━━━━╯
${AnsiColor.BRIGHT_BLUE}
紫宸启动专用

29
src/test/java/com/stone/test/CountryServiceTest.java

@ -0,0 +1,29 @@
package com.stone.test;
import com.stone.Application;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.annotation.Import;
import org.springframework.test.context.junit4.SpringRunner;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@RunWith(SpringRunner.class)
@SpringBootTest
@Import(Application.class)
public class CountryServiceTest {
@Resource
private HttpServletResponse response;
@Resource
private HttpServletRequest request;
@Test
public void test() {
}
}
Loading…
Cancel
Save