mengshibin %!s(int64=4) %!d(string=hai) anos
achega
40ea33bbcb
Modificáronse 100 ficheiros con 4765 adicións e 0 borrados
  1. 17 0
      pom.xml
  2. 73 0
      zhoushan-system-api/pom.xml
  3. 22 0
      zhoushan-system-api/src/main/java/com/fdage/ZhoushanSystemApiApplication.java
  4. 14 0
      zhoushan-system-api/src/main/java/com/fdage/aop/WebControllerLog.java
  5. 115 0
      zhoushan-system-api/src/main/java/com/fdage/aop/WebLogAspect.java
  6. 29 0
      zhoushan-system-api/src/main/java/com/fdage/config/InterceptorConfig.java
  7. 190 0
      zhoushan-system-api/src/main/java/com/fdage/controller/ApiController.java
  8. 210 0
      zhoushan-system-api/src/main/java/com/fdage/controller/CollectionController.java
  9. 150 0
      zhoushan-system-api/src/main/java/com/fdage/controller/DataStatisticsController.java
  10. 112 0
      zhoushan-system-api/src/main/java/com/fdage/controller/EquipmentController.java
  11. 280 0
      zhoushan-system-api/src/main/java/com/fdage/controller/ExhibitionController.java
  12. 181 0
      zhoushan-system-api/src/main/java/com/fdage/controller/InformationController.java
  13. 49 0
      zhoushan-system-api/src/main/java/com/fdage/controller/LogController.java
  14. 126 0
      zhoushan-system-api/src/main/java/com/fdage/controller/LoginController.java
  15. 32 0
      zhoushan-system-api/src/main/java/com/fdage/controller/PositionController.java
  16. 39 0
      zhoushan-system-api/src/main/java/com/fdage/controller/ResourceController.java
  17. 157 0
      zhoushan-system-api/src/main/java/com/fdage/controller/RoleController.java
  18. 124 0
      zhoushan-system-api/src/main/java/com/fdage/controller/SseController.java
  19. 280 0
      zhoushan-system-api/src/main/java/com/fdage/controller/UserController.java
  20. 59 0
      zhoushan-system-api/src/main/java/com/fdage/listner/LoggerInterceptor.java
  21. 87 0
      zhoushan-system-api/src/main/java/com/fdage/listner/Swagger2.java
  22. 164 0
      zhoushan-system-api/src/main/java/com/fdage/shiro/JWTFilter.java
  23. 23 0
      zhoushan-system-api/src/main/java/com/fdage/shiro/JWTToken.java
  24. 73 0
      zhoushan-system-api/src/main/java/com/fdage/shiro/JWTUtil.java
  25. 34 0
      zhoushan-system-api/src/main/java/com/fdage/shiro/JwtAuthenticationException.java
  26. 225 0
      zhoushan-system-api/src/main/java/com/fdage/shiro/JwtUtil2.java
  27. 148 0
      zhoushan-system-api/src/main/java/com/fdage/shiro/MyRealm.java
  28. 156 0
      zhoushan-system-api/src/main/java/com/fdage/shiro/ShiroConfig.java
  29. 676 0
      zhoushan-system-api/src/main/java/com/fdage/util/FileUtil.java
  30. 39 0
      zhoushan-system-api/src/main/java/com/fdage/util/VerifyCodeUtil.java
  31. 66 0
      zhoushan-system-api/src/main/resources/application.yml
  32. BIN=BIN
      zhoushan-system-api/src/main/resources/static/collection/importData.xlsx
  33. BIN=BIN
      zhoushan-system-api/src/main/resources/static/exhibition/1596186417162_blob
  34. BIN=BIN
      zhoushan-system-api/src/main/resources/static/exhibition/1596189084442_blob
  35. BIN=BIN
      zhoushan-system-api/src/main/resources/static/exhibition/1596189140546_blob
  36. BIN=BIN
      zhoushan-system-api/src/main/resources/static/exhibition/1596189564593_blob
  37. BIN=BIN
      zhoushan-system-api/src/main/resources/static/exhibition/1596189869919_blob
  38. BIN=BIN
      zhoushan-system-api/src/main/resources/static/exhibition/1596190721836_6.png
  39. BIN=BIN
      zhoushan-system-api/src/main/resources/static/exhibition/1596190788080_2_compressed.jpg
  40. BIN=BIN
      zhoushan-system-api/src/main/resources/static/exhibition/1596190825036_6.png
  41. BIN=BIN
      zhoushan-system-api/src/main/resources/static/exhibition/1596190848270_6.png
  42. BIN=BIN
      zhoushan-system-api/src/main/resources/static/exhibition/1596190887905_6.png
  43. BIN=BIN
      zhoushan-system-api/src/main/resources/static/exhibition/1596190919878_72578776_13.jpg
  44. BIN=BIN
      zhoushan-system-api/src/main/resources/static/exhibition/1596191321390_6.png
  45. BIN=BIN
      zhoushan-system-api/src/main/resources/static/exhibition/1596447050697_1_compressed.jpg
  46. BIN=BIN
      zhoushan-system-api/src/main/resources/static/exhibition/1596447392511_72578776_13.jpg
  47. BIN=BIN
      zhoushan-system-api/src/main/resources/static/exhibition/1596447392511_72578776_14.jpg
  48. BIN=BIN
      zhoushan-system-api/src/main/resources/static/exhibition/1596447392511_72578776_18.jpg
  49. BIN=BIN
      zhoushan-system-api/src/main/resources/static/exhibition/1596447392516_72578776_22.jpg
  50. BIN=BIN
      zhoushan-system-api/src/main/resources/static/exhibition/1596447643716_72578776_13.jpg
  51. BIN=BIN
      zhoushan-system-api/src/main/resources/static/exhibition/1596447972662_2_compressed.jpg
  52. BIN=BIN
      zhoushan-system-api/src/main/resources/static/exhibition/1596448196988_6.png
  53. BIN=BIN
      zhoushan-system-api/src/main/resources/static/exhibition/1596448574587_1_compressed.jpg
  54. BIN=BIN
      zhoushan-system-api/src/main/resources/static/exhibition/1596448574587_2.png
  55. BIN=BIN
      zhoushan-system-api/src/main/resources/static/exhibition/1596448574587_2_compressed.jpg
  56. BIN=BIN
      zhoushan-system-api/src/main/resources/static/exhibition/1596448574587_6.png
  57. BIN=BIN
      zhoushan-system-api/src/main/resources/static/exhibition/1596448575033_7.png
  58. BIN=BIN
      zhoushan-system-api/src/main/resources/static/exhibition/1596448575155_1.png
  59. BIN=BIN
      zhoushan-system-api/src/main/resources/static/exhibition/1596448575323_baoli.png
  60. BIN=BIN
      zhoushan-system-api/src/main/resources/static/exhibition/1596449245116_2.png
  61. BIN=BIN
      zhoushan-system-api/src/main/resources/static/exhibition/1596449245116_6.png
  62. BIN=BIN
      zhoushan-system-api/src/main/resources/static/exhibition/1596449607618_1422.png
  63. BIN=BIN
      zhoushan-system-api/src/main/resources/static/exhibition/1596449725286_1422.png
  64. BIN=BIN
      zhoushan-system-api/src/main/resources/static/exhibition/1596450062428_1422.png
  65. BIN=BIN
      zhoushan-system-api/src/main/resources/static/head/1568800765341_timg (1).jpg
  66. BIN=BIN
      zhoushan-system-api/src/main/resources/static/head/1568801143326_timg.jpg
  67. BIN=BIN
      zhoushan-system-api/src/main/resources/static/head/1568801751741_timg.jpg
  68. BIN=BIN
      zhoushan-system-api/src/main/resources/static/head/1568801890654_timg (1).jpg
  69. BIN=BIN
      zhoushan-system-api/src/main/resources/static/head/1569382213805_2016-08-01_10_33_43.mp4
  70. BIN=BIN
      zhoushan-system-api/src/main/resources/static/head/1569383057144_20190924141422.h264
  71. BIN=BIN
      zhoushan-system-api/src/main/resources/static/head/1596440670606_72578776_13.jpg
  72. BIN=BIN
      zhoushan-system-api/src/main/resources/static/head/1596440976130_app-icon.png
  73. BIN=BIN
      zhoushan-system-api/src/main/resources/static/head/test.h264
  74. 123 0
      zhoushan-system-api/src/main/resources/static/index.html
  75. BIN=BIN
      zhoushan-system-api/src/main/resources/static/information/1568776657385_timg (1).jpg
  76. BIN=BIN
      zhoushan-system-api/src/main/resources/static/information/1568776834246_timg (1).jpg
  77. BIN=BIN
      zhoushan-system-api/src/main/resources/static/information/1568776847364_timg (1).jpg
  78. BIN=BIN
      zhoushan-system-api/src/main/resources/static/information/1568776868001_timg.jpg
  79. BIN=BIN
      zhoushan-system-api/src/main/resources/static/information/1568777449690_timg (1).jpg
  80. BIN=BIN
      zhoushan-system-api/src/main/resources/static/information/1568778077444_微信图片_20190830113544.jpg
  81. BIN=BIN
      zhoushan-system-api/src/main/resources/static/information/1568778144730_timg.jpg
  82. BIN=BIN
      zhoushan-system-api/src/main/resources/static/information/1568778265057_timg.jpg
  83. 16 0
      zhoushan-system-api/src/test/java/com/fdage/VirtualHouseApiApplicationTests.java
  84. 162 0
      zhoushan-system-api/zhoushan-system-api.iml
  85. 162 0
      zhoushan-system-common/pom.xml
  86. 12 0
      zhoushan-system-common/src/main/java/com/fdage/config/CommonConf.java
  87. 9 0
      zhoushan-system-common/src/main/java/com/fdage/constant/ConstantExcel.java
  88. 13 0
      zhoushan-system-common/src/main/java/com/fdage/constant/ConstantUrl.java
  89. 51 0
      zhoushan-system-common/src/main/java/com/fdage/dto/ResourceTree.java
  90. 30 0
      zhoushan-system-common/src/main/java/com/fdage/enums/ResponEnum.java
  91. 28 0
      zhoushan-system-common/src/main/java/com/fdage/enums/TypeEnum.java
  92. 15 0
      zhoushan-system-common/src/main/java/com/fdage/request/RequestBase.java
  93. 42 0
      zhoushan-system-common/src/main/java/com/fdage/request/RequestCollection.java
  94. 20 0
      zhoushan-system-common/src/main/java/com/fdage/request/RequestEquipment.java
  95. 32 0
      zhoushan-system-common/src/main/java/com/fdage/request/RequestExhibition.java
  96. 32 0
      zhoushan-system-common/src/main/java/com/fdage/request/RequestInformation.java
  97. 14 0
      zhoushan-system-common/src/main/java/com/fdage/request/RequestLog.java
  98. 24 0
      zhoushan-system-common/src/main/java/com/fdage/request/RequestRole.java
  99. 30 0
      zhoushan-system-common/src/main/java/com/fdage/request/RequestUser.java
  100. 0 0
      zhoushan-system-common/src/main/java/com/fdage/respon/ResponCollection.java

+ 17 - 0
pom.xml

@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>com.fdage</groupId>
+  <artifactId>zhoushan-system</artifactId>
+  <version>0.0.1-SNAPSHOT</version>
+  <packaging>pom</packaging>
+
+
+  <modules>
+    <module>zhoushan-system-api</module>
+    <module>zhoushan-system-service</module>
+    <module>zhoushan-system-dao</module>
+    <module>zhoushan-system-common</module>
+  </modules>
+</project>

+ 73 - 0
zhoushan-system-api/pom.xml

@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+	<parent>
+		<groupId>org.springframework.boot</groupId>
+		<artifactId>spring-boot-starter-parent</artifactId>
+		<version>2.0.7.RELEASE</version>
+		<relativePath/> <!-- lookup parent from repository -->
+	</parent>
+	<groupId>com.fdage</groupId>
+	<artifactId>zhoushan-system-api</artifactId>
+	<version>0.0.1-SNAPSHOT</version>
+	<packaging>war</packaging>
+	<name>zhoushan-system-api</name>
+	<description>Demo project for Spring Boot</description>
+
+	<properties>
+		<java.version>1.8</java.version>
+	</properties>
+
+	<dependencies>
+		<dependency>
+			<groupId>org.springframework.boot</groupId>
+			<artifactId>spring-boot-starter-web</artifactId>
+		</dependency>
+
+		<dependency>
+			<groupId>org.springframework.boot</groupId>
+			<artifactId>spring-boot-starter-test</artifactId>
+			<scope>test</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>org.springframework.boot</groupId>
+			<artifactId>spring-boot-starter-actuator</artifactId>
+		</dependency>
+
+		<dependency>
+			<groupId>org.springframework.boot</groupId>
+			<artifactId>spring-boot-starter-tomcat</artifactId>
+			<scope>provided</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>com.fdage</groupId>
+			<artifactId>zhoushan-system-service</artifactId>
+			<version>0.0.1-SNAPSHOT</version>
+		</dependency>
+
+		<dependency>
+			<groupId>com.fdage</groupId>
+			<artifactId>zhoushan-system-common</artifactId>
+			<version>0.0.1-SNAPSHOT</version>
+		</dependency>
+
+		<dependency>
+			<groupId>com.github.pagehelper</groupId>
+			<artifactId>pagehelper-spring-boot-starter</artifactId>
+			<version>1.2.3</version>
+		</dependency>
+	</dependencies>
+
+	<build>
+		<plugins>
+			<plugin>
+				<groupId>org.springframework.boot</groupId>
+				<artifactId>spring-boot-maven-plugin</artifactId>
+			</plugin>
+		</plugins>
+	</build>
+
+</project>

+ 22 - 0
zhoushan-system-api/src/main/java/com/fdage/ZhoushanSystemApiApplication.java

@@ -0,0 +1,22 @@
+package com.fdage;
+
+import org.mybatis.spring.annotation.MapperScan;
+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;
+
+@SpringBootApplication(scanBasePackages = "com.fdage.*")
+@MapperScan({"com.fdage.dao.*"})
+public class ZhoushanSystemApiApplication extends SpringBootServletInitializer {
+
+	@Override
+	protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
+		return application.sources(ZhoushanSystemApiApplication.class);
+	}
+
+	public static void main(String[] args) {
+		SpringApplication.run(ZhoushanSystemApiApplication.class, args);
+	}
+
+}

+ 14 - 0
zhoushan-system-api/src/main/java/com/fdage/aop/WebControllerLog.java

@@ -0,0 +1,14 @@
+package com.fdage.aop;
+
+import java.lang.annotation.*;
+
+/**
+ * Created by Hb_zzZ on 2020/2/27.
+ */
+@Target({ElementType.PARAMETER, ElementType.METHOD})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+public @interface WebControllerLog {
+    String description() default "";
+
+}

+ 115 - 0
zhoushan-system-api/src/main/java/com/fdage/aop/WebLogAspect.java

@@ -0,0 +1,115 @@
+package com.fdage.aop;
+
+import com.fdage.pojo.TbLog;
+import com.fdage.service.ILogService;
+import com.fdage.shiro.JwtUtil2;
+import lombok.extern.slf4j.Slf4j;
+import org.aspectj.lang.JoinPoint;
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.Before;
+import org.aspectj.lang.annotation.Pointcut;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import javax.servlet.http.HttpServletRequest;
+import java.lang.reflect.Method;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * Created by owen on 2020/2/25 0025 9:24
+ */
+@Slf4j
+@Aspect
+@Component
+public class WebLogAspect {
+
+    @Autowired
+    private ILogService logService;
+
+    @Autowired
+    private HttpServletRequest request;
+
+    @Pointcut("@annotation(com.fdage.aop.WebControllerLog)")//切入点描述 这个是controller包的切入点
+    public void controllerLog(){}//签名,可以理解成这个切入点的一个名称
+
+    @Before("controllerLog()") //在切入点的方法run之前要干的
+    public void logBeforeController(JoinPoint joinPoint) throws Exception{
+
+        // 获取token
+        String token = request.getHeader("token");
+        Long userId = null;
+        if (token != null) {
+             userId = JwtUtil2.getUserId(token);
+        }
+
+
+        // 记录下请求内容
+//        log.info("request URL : {}" , request.getRequestURL().toString());
+        log.info("request Method : {}" , request.getMethod());
+        log.info("request IP : {}" , request.getRemoteAddr());
+        log.info("request Args : {}" , Arrays.toString(joinPoint.getArgs()));
+
+        String description = getControllerLogDescription(joinPoint);
+
+        log.info("request description : {}", description);
+
+        //下面这个getSignature().getDeclaringTypeName()是获取包+类名的   然后后面的joinPoint.getSignature.getName()获取了方法名
+        log.info("request Class_Method : {}" , joinPoint.getSignature().getDeclaringTypeName() + "." + joinPoint.getSignature().getName());
+
+        // 保存数据库
+        List<String> detail = getDetail(description);
+        TbLog logEntity = new TbLog();
+        logEntity.setCreateTime(new Date());
+        logEntity.setType(detail.get(0));
+        logEntity.setDescription(detail.get(1));
+        logEntity.setUserId(userId);
+
+        logService.save(logEntity);
+
+    }
+
+    /**
+     * 获取注解中对方法的描述信息 用于Controller层注解
+     *
+     * @param joinPoint
+     *            切点
+     * @return 方法描述
+     * @throws Exception
+     */
+    public static String getControllerLogDescription(JoinPoint joinPoint) throws Exception {
+        String targetName = joinPoint.getTarget().getClass().getName();
+        String methodName = joinPoint.getSignature().getName();
+        Object[] arguments = joinPoint.getArgs();
+        Class targetClass = Class.forName(targetName);
+        Method[] methods = targetClass.getMethods();
+        String description = "";
+        for (Method method : methods) {
+            if (method.getName().equals(methodName)) {
+                Class[] clazzs = method.getParameterTypes();
+                if (clazzs.length == arguments.length) {
+                    description = method.getAnnotation(WebControllerLog.class).description();
+                    break;
+                }
+            }
+        }
+        return description;
+    }
+
+    private static List<String> getDetail(String str){
+        String[] split = str.split("-");
+        return Arrays.asList(split);
+    }
+
+//    public static void main(String[] args) {
+//        String str = "aaaaaaa-bb";
+//        String[] detail = getDetail(str);
+//        List<String> list = Arrays.asList(detail);
+//
+//
+//        for (String i:detail) {
+//            System.out.println(i);
+//        }
+//    }
+}

+ 29 - 0
zhoushan-system-api/src/main/java/com/fdage/config/InterceptorConfig.java

@@ -0,0 +1,29 @@
+package com.fdage.config;
+
+import com.fdage.listner.LoggerInterceptor;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
+
+/**
+ * Created by Hb_zzZ on 2018/12/6.
+ */
+@Configuration
+public class InterceptorConfig extends WebMvcConfigurerAdapter {
+
+    @Bean
+    public LoggerInterceptor loggerInterceptor(){
+        return new LoggerInterceptor();
+    }
+
+    @Override
+    public void addInterceptors(InterceptorRegistry registry) {
+        //这里可以添加多个拦截器
+        registry.addInterceptor(loggerInterceptor()).addPathPatterns("/**")
+                .excludePathPatterns("/","","/error","/login","/register","/resetPassword");
+        super.addInterceptors(registry);
+    }
+
+
+}

+ 190 - 0
zhoushan-system-api/src/main/java/com/fdage/controller/ApiController.java

@@ -0,0 +1,190 @@
+package com.fdage.controller;
+
+import com.fdage.aop.WebControllerLog;
+import com.fdage.enums.ResponEnum;
+import com.fdage.request.RequestCollection;
+import com.fdage.request.RequestExhibition;
+import com.fdage.request.RequestInformation;
+import com.fdage.respon.ResponCollection;
+import com.fdage.respon.ResponExhibition;
+import com.fdage.respon.ResponInformation;
+import com.fdage.service.ICollectionService;
+import com.fdage.service.IExhibitionService;
+import com.fdage.service.IInformationService;
+import com.fdage.util.AjaxJson;
+import com.fdage.util.DateUtil;
+import com.github.pagehelper.PageInfo;
+import com.github.pagehelper.util.StringUtil;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import java.util.List;
+
+/**
+ * Created by Hb_zzZ on 2020/7/30.
+ */
+@Api(tags = "对外api模块")
+@Controller
+@RequestMapping("/api")
+@Slf4j
+public class ApiController {
+
+    @Autowired
+    private IInformationService informationService;
+
+    @Autowired
+    private IExhibitionService exhibitionService;
+
+    @Autowired
+    private ICollectionService collectionService;
+
+    @PostMapping("informationList")
+    @ResponseBody
+    @ApiOperation("获取资讯列表")
+    public AjaxJson informationList(){
+        List<ResponInformation> list = informationService.findList(null);
+        for(ResponInformation information : list){
+            if(StringUtils.isNotEmpty(information.getStartTime())){
+                information.setStartTime(String.valueOf(DateUtil.convert2CST(information.getStartTime())));
+            }
+            if(StringUtils.isNotEmpty(information.getEndTime())){
+                information.setEndTime(String.valueOf(DateUtil.convert2CST(information.getEndTime())));
+            }
+            if(StringUtils.isNotEmpty(information.getCreateTime())){
+                information.setCreateTime(String.valueOf(DateUtil.convert2CST(information.getCreateTime())));
+            }
+
+            information.setUrlArray(information.getContentUrl().replace("\"", "").replace("[", "").replace("]", "").split(","));
+        }
+        return AjaxJson.success(list);
+    }
+
+//    @PostMapping("getExhibitionById")
+//    @ResponseBody
+//    @ApiOperation("通过展示方案找文物")
+//    @ApiImplicitParams({
+//            @ApiImplicitParam(name = "exhibitionId", value = "展览方案id", dataType = "String")})
+//    public AjaxJson getExhibitionById(@RequestBody RequestExhibition bo){
+//        if(bo == null || bo.getExhibitionId() == null){
+//            return AjaxJson.failure(ResponEnum.NOT_NULL.getCode(), ResponEnum.NOT_NULL.getMessage());
+//        }
+//
+//        return AjaxJson.success(exhibitionService.getExhibitionById(bo.getExhibitionId()));
+//    }
+
+    @PostMapping("exhibitionList")
+    @ResponseBody
+    @ApiOperation("获取展览方案列表")
+    public AjaxJson exhibitionList(){
+        List<ResponExhibition> list = exhibitionService.findList(null);
+        for(ResponExhibition exhibition : list){
+            exhibition.setCreateTime(String.valueOf(DateUtil.convert2CST(exhibition.getCreateTime())));
+        }
+        return AjaxJson.success(list);
+    }
+
+    @PostMapping("collectionList")
+    @ResponseBody
+    @ApiOperation("获取所有文物列表")
+    public AjaxJson collectionList(){
+        List<ResponCollection> list = collectionService.findList(null);
+        return AjaxJson.success(list);
+    }
+
+    @PostMapping("collectionFindById")
+    @ResponseBody
+    @ApiOperation("查询文物详情")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "文物id", dataType = "String")})
+    public AjaxJson findById(@RequestBody RequestCollection bo){
+        if(bo == null || bo.getId() == null){
+            return AjaxJson.failure(ResponEnum.NOT_NULL.getCode(), ResponEnum.NOT_NULL.getMessage());
+        }
+
+        return AjaxJson.success(collectionService.findById(bo.getId()));
+    }
+
+    @PostMapping("likeCollection")
+    @ResponseBody
+    @ApiOperation("文物点赞")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "文物id", dataType = "String")})
+    public AjaxJson likeCollection(@RequestBody RequestCollection bo){
+        if(bo.getId() == null){
+            return AjaxJson.failure("id不能为空");
+        }
+        collectionService.addLikeNumById(bo.getId());
+        return AjaxJson.success();
+    }
+
+    @PostMapping("getExhibitionById")
+    @ResponseBody
+    @ApiOperation("通过id获取展示方案")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "id", dataType = "String")})
+    public AjaxJson getExhibitionById(@RequestBody RequestExhibition bo){
+        if(bo == null || bo.getId() == null){
+            return AjaxJson.failure(ResponEnum.NOT_NULL.getCode(), ResponEnum.NOT_NULL.getMessage());
+        }
+
+        ResponExhibition responExhibition = exhibitionService.getExhibitionById(bo.getId());
+
+        exhibitionService.addOpenNum(bo.getId());
+        return AjaxJson.success(responExhibition);
+    }
+
+    @PostMapping("typeList")
+    @ResponseBody
+    @ApiOperation("获取文物类别列表")
+    public AjaxJson typeList(){
+        RequestCollection bo = new RequestCollection();
+        bo.setState(0);
+        return AjaxJson.success(collectionService.typeList(bo));
+    }
+
+    @PostMapping("searchCollection")
+    @ResponseBody
+    @ApiOperation("搜索文物")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "展览方案id", dataType = "String"),
+            @ApiImplicitParam(name = "name", value = "文物名称", dataType = "String")})
+    public AjaxJson searchCollection(@RequestBody RequestCollection bo){
+        return AjaxJson.success(collectionService.searchCollection(bo));
+    }
+
+    @PostMapping("addSearchNum")
+    @ResponseBody
+    @ApiOperation("增加文物搜索次数")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "文物id", dataType = "String")})
+    public AjaxJson addSearchNum(@RequestBody RequestCollection bo){
+        if(bo.getId() == null){
+            return AjaxJson.failure("id不能为空");
+        }
+        collectionService.addSearchNum(bo.getId());
+        return AjaxJson.success();
+    }
+
+    @PostMapping("addDownloadNum")
+    @ResponseBody
+    @ApiOperation("增加文物下载次数")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "文物id", dataType = "String")})
+    public AjaxJson addDownloadNum(@RequestBody RequestCollection bo){
+        if(bo.getId() == null){
+            return AjaxJson.failure("id不能为空");
+        }
+        collectionService.addDownloadNum(bo.getId());
+        return AjaxJson.success();
+    }
+}

+ 210 - 0
zhoushan-system-api/src/main/java/com/fdage/controller/CollectionController.java

@@ -0,0 +1,210 @@
+package com.fdage.controller;
+
+import com.fdage.aop.WebControllerLog;
+import com.fdage.constant.ConstantUrl;
+import com.fdage.enums.ResponEnum;
+import com.fdage.pojo.TbCollection;
+import com.fdage.request.RequestCollection;
+import com.fdage.respon.ResponCollection;
+import com.fdage.service.ICollectionService;
+import com.fdage.util.AjaxJson;
+import com.fdage.util.FileUtil;
+import com.github.pagehelper.PageInfo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.List;
+
+/**
+ * Created by Hb_zzZ on 2019/9/11.
+ */
+@Api(tags = "文物库模块")
+@Controller
+@RequestMapping("/zhoushan/collection")
+@Slf4j
+public class CollectionController {
+
+    @Autowired
+    private ICollectionService service;
+
+    @Value("${upload.collection}")
+    private String uploadPath;
+
+    @PostMapping("timeList")
+    @ResponseBody
+    @ApiOperation("获取年代列表")
+    public AjaxJson timeList(){
+        return AjaxJson.success(service.timeList());
+    }
+
+    @PostMapping("typeList")
+    @ResponseBody
+    @ApiOperation("获取文物类别列表")
+    public AjaxJson typeList(@RequestBody RequestCollection bo){
+        return AjaxJson.success(service.typeList(bo));
+    }
+
+    @PostMapping("addCollection")
+    @ResponseBody
+    @WebControllerLog(description = "文物库-新增文物")
+    @ApiOperation("新增文物")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "name", value = "文物名称", dataType = "String"),
+            @ApiImplicitParam(name = "description", value = "文物描述", dataType = "String"),
+            @ApiImplicitParam(name = "timeId", value = "年代id", dataType = "String"),
+            @ApiImplicitParam(name = "typeId", value = "类型id", dataType = "String"),
+            @ApiImplicitParam(name = "modelUrl", value = "文物模型url", dataType = "String"),
+            @ApiImplicitParam(name = "discoveryTime", value = "文物发现时间", dataType = "String"),
+            @ApiImplicitParam(name = "repairTime", value = "文物维修时间", dataType = "String"),
+            @ApiImplicitParam(name = "venue", value = "文物所在场馆", dataType = "String"),
+            @ApiImplicitParam(name = "contentUrl", value = "多媒体内容Url", dataType = "String"),
+            @ApiImplicitParam(name = "pic", value = "4dmodel文物的封面图", dataType = "String"),
+            @ApiImplicitParam(name = "num", value = "藏品编号", dataType = "String"),
+            @ApiImplicitParam(name = "state", value = "状态,0:展示,1:隐藏", dataType = "String")})
+    public AjaxJson addCollection(@RequestBody RequestCollection bo){
+        if(bo == null || StringUtils.isEmpty(bo.getName())  ||
+                bo.getTimeId() == null  || bo.getTypeId() == null){
+            return AjaxJson.failure(ResponEnum.NOT_NULL.getCode(), ResponEnum.NOT_NULL.getMessage());
+        }
+
+        TbCollection collection = new TbCollection();
+        BeanUtils.copyProperties(bo, collection);
+//        collection.setPic(ConstantUrl.FDMODEL_PIC + bo.getModelUrl().substring(
+//                bo.getModelUrl().indexOf("m=") + 2) + "/thumbnail.jpg");
+        service.insert(collection);
+        return AjaxJson.success();
+    }
+
+    @PostMapping("updateCollection")
+    @ResponseBody
+    @WebControllerLog(description = "文物库-修改文物")
+    @ApiOperation("修改文物")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "文物id", dataType = "String"),
+            @ApiImplicitParam(name = "name", value = "文物名称", dataType = "String"),
+            @ApiImplicitParam(name = "description", value = "文物描述", dataType = "String"),
+            @ApiImplicitParam(name = "timeId", value = "年代id", dataType = "String"),
+            @ApiImplicitParam(name = "typeId", value = "类型id", dataType = "String"),
+            @ApiImplicitParam(name = "modelUrl", value = "文物模型url", dataType = "String"),
+            @ApiImplicitParam(name = "discoveryTime", value = "文物发现时间", dataType = "String"),
+            @ApiImplicitParam(name = "repairTime", value = "文物维修时间", dataType = "String"),
+            @ApiImplicitParam(name = "venue", value = "文物所在场馆", dataType = "String"),
+            @ApiImplicitParam(name = "contentUrl", value = "多媒体内容Url", dataType = "String"),
+            @ApiImplicitParam(name = "pic", value = "4dmodel文物的封面图", dataType = "String"),
+            @ApiImplicitParam(name = "num", value = "藏品编号", dataType = "String"),
+            @ApiImplicitParam(name = "state", value = "状态,0:展示,1:隐藏", dataType = "String")})
+    public AjaxJson updateCollection(@RequestBody RequestCollection bo){
+        if(bo == null || StringUtils.isEmpty(bo.getName()) ||
+                bo.getTimeId() == null  || bo.getTypeId() == null ){
+            return AjaxJson.failure(ResponEnum.NOT_NULL.getCode(), ResponEnum.NOT_NULL.getMessage());
+        }
+
+        TbCollection collection = new TbCollection();
+        BeanUtils.copyProperties(bo, collection);
+        service.update(collection);
+        return AjaxJson.success();
+    }
+
+    @PostMapping("deleteCollection")
+    @ResponseBody
+    @WebControllerLog(description = "文物库-删除文物")
+    @ApiOperation("删除文物")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "文物id", dataType = "String")})
+    public AjaxJson deleteCollection(@RequestBody RequestCollection bo){
+        if(bo == null || bo.getId() == null){
+            return AjaxJson.failure(ResponEnum.NOT_NULL.getCode(), ResponEnum.NOT_NULL.getMessage());
+        }
+        service.deleteById(bo.getId());
+        return AjaxJson.success();
+    }
+
+    @PostMapping("findById")
+    @ResponseBody
+    @WebControllerLog(description = "文物库-查询文物库详情")
+    @ApiOperation("查询文物库详情")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "文物id", dataType = "String")})
+    public AjaxJson findById(@RequestBody RequestCollection bo){
+        if(bo == null || bo.getId() == null){
+            return AjaxJson.failure(ResponEnum.NOT_NULL.getCode(), ResponEnum.NOT_NULL.getMessage());
+        }
+
+        return AjaxJson.success(service.findById(bo.getId()));
+    }
+
+    @PostMapping("list")
+    @ResponseBody
+    @WebControllerLog(description = "文物库-获取文物列表")
+    @ApiOperation("获取文物列表")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "timeId", value = "年代id", dataType = "String"),
+            @ApiImplicitParam(name = "typeId", value = "类型id", dataType = "String"),
+            @ApiImplicitParam(name = "name", value = "文物名称", dataType = "String"),
+            @ApiImplicitParam(name = "pageNum", value = "页码", dataType = "String"),
+            @ApiImplicitParam(name = "pageSize", value = "每页数量", dataType = "String")})
+    public AjaxJson list(@RequestBody RequestCollection bo){
+        List<ResponCollection> list = service.findList(bo);
+        PageInfo<ResponCollection> pageInfo = new PageInfo<>(list);
+        return AjaxJson.success(pageInfo);
+    }
+
+    @RequestMapping("/upload")
+    @ResponseBody
+    @ApiOperation("上传文物图片")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "file", value = "文件流", dataType = "String")})
+    public AjaxJson upload(@RequestParam(value = "filename", defaultValue = "") String name, @RequestParam("file") MultipartFile file){
+        if(file == null){
+            return AjaxJson.failure("参数不能为空");
+        }
+        String fileName = System.currentTimeMillis() + "_";
+        if(StringUtils.isNotEmpty(name)){
+            fileName = fileName + name;
+        }else {
+            fileName = fileName + file.getOriginalFilename();
+        }
+        log.info("图片地址:" + fileName);
+        boolean flag = FileUtil.upload(file, uploadPath, fileName);
+
+        if(!flag){
+            return AjaxJson.failure("上传图片失败");
+        }
+
+//        Map<String, String> map = new HashMap<>();
+//        map.put(path + "/" + fileName, "company/" + fileName);
+//        uploadToAlibabaService.upload(map);
+
+        return AjaxJson.success((Object) ("/collection/" + fileName));
+    }
+
+    @RequestMapping("/importCollection")
+    @ResponseBody
+    @ApiOperation("导入文物数据")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "file", value = "文件流", dataType = "String")})
+    public AjaxJson importCollection(@RequestParam("file") MultipartFile file){
+        if(file == null){
+            return AjaxJson.failure("参数不能为空");
+        }
+        String fileName = System.currentTimeMillis() + "_" +  file.getOriginalFilename();
+        log.info("导入文物数据地址:" + fileName);
+        boolean flag = FileUtil.upload(file, uploadPath, fileName);
+
+        if(!flag){
+            return AjaxJson.failure("导入文物数据失败");
+        }
+
+        return service.importCollection(uploadPath + "/" + fileName);
+    }
+}

+ 150 - 0
zhoushan-system-api/src/main/java/com/fdage/controller/DataStatisticsController.java

@@ -0,0 +1,150 @@
+package com.fdage.controller;
+
+import com.fdage.constant.ConstantExcel;
+import com.fdage.respon.ResponCollection;
+import com.fdage.respon.ResponStatistics;
+import com.fdage.service.ICollectionService;
+import com.fdage.service.IExhibitionService;
+import com.fdage.util.AjaxJson;
+import com.fdage.util.ExcelUtil;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.*;
+import java.net.URLEncoder;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+/**
+ * Created by Hb_zzZ on 2020/9/8.
+ */
+@Api(tags = "数据统计模块")
+@Controller
+@RequestMapping("/zhoushan/statistics")
+@Slf4j
+public class DataStatisticsController {
+
+    @Autowired
+    private IExhibitionService exhibitionService;
+
+    @Autowired
+    private ICollectionService collectionService;
+
+    @Value("${upload.collection}")
+    private String collectionPath;
+
+    @PostMapping("collectionTotal")
+    @ResponseBody
+    @ApiOperation("数据总量")
+    public AjaxJson collectionTotal(){
+        return AjaxJson.success(collectionService.findList(null));
+    }
+
+    @PostMapping("exportCollectionTotal")
+    @ResponseBody
+    @ApiOperation("数据总量")
+    public void exportCollectionTotal(HttpServletRequest request, HttpServletResponse response){
+        List<ResponCollection> list = collectionService.findList(null);
+
+        //导出的数据
+        int serNum = 1;
+        Map<String, Object> item = null;
+        List<Map> dataList = new ArrayList<Map>();
+
+        for(ResponCollection collection : list){
+            item = new HashMap();
+            item.put(ConstantExcel.COLLECTION_NAME[0], String.valueOf(serNum));
+            item.put(ConstantExcel.COLLECTION_NAME[1], collection.getName());
+            item.put(ConstantExcel.COLLECTION_NAME[2], collection.getTypeName());
+            item.put(ConstantExcel.COLLECTION_NAME[3], collection.getTimeName());
+            item.put(ConstantExcel.COLLECTION_NAME[4], collection.getLikeNum());
+            item.put(ConstantExcel.COLLECTION_NAME[5], collection.getDownloadNum());
+            item.put(ConstantExcel.COLLECTION_NAME[6], collection.getSearchNum());
+
+            serNum++;
+            dataList.add(item);
+        }
+
+        try{
+            DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
+            String dateStr = dateFormat.format(new Date());
+            String fileName = "文物数据-" + dateStr + ".xls";
+            File file = new File(collectionPath + File.separator + fileName + ".xls");
+
+            ExcelUtil.writeExcel(dataList, collectionPath + File.separator + fileName + ".xls");
+
+            String agent = request.getHeader("User-Agent");
+            if (agent != null && (agent.contains("MSIE")||agent.contains("Trident"))) {
+                fileName = URLEncoder.encode(fileName, "UTF-8");
+            } else {
+                //非IE浏览器的处理:
+                fileName = new String(fileName.getBytes("UTF-8"), "ISO-8859-1");
+            }
+            response.setHeader("Content-Disposition", "attachment; filename=\""+fileName+"\"");
+            response.setContentType(request.getServletContext().getMimeType(fileName));
+            response.setContentLength((int) file.length());
+            output(response, file);
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+    }
+
+    @PostMapping("total")
+    @ResponseBody
+    @ApiOperation("数据总量")
+    public AjaxJson total(){
+
+        ResponStatistics result = collectionService.collectionTotal();
+
+        Long exhibitionTotal = exhibitionService.exhibitionTotal();
+        result.setExhibitionTotal(exhibitionTotal);
+
+        result.setExhibitionList(exhibitionService.findListOrderBy());
+
+        Map<String, String> map = new HashMap<>();
+        map.put("order", "desc");
+        map.put("sidx", "a.search_num");
+        result.setCollectionSearchList(collectionService.findListOrderBy(map).subList(0, 5));
+        map.put("sidx", "a.like_num");
+        result.setCollectionLikeList(collectionService.findListOrderBy(map).subList(0, 10));
+        map.put("sidx", "a.open_num");
+        result.setCollectionOpenList(collectionService.findListOrderBy(map).subList(0, 3));
+
+        result.setCollectionTypeTotal(collectionService.typeTotal());
+
+        return AjaxJson.success(result);
+    }
+
+    private static void output(HttpServletResponse resp, File file) {
+        OutputStream os = null;
+        BufferedInputStream bis = null;
+        byte[] buff = new byte[1024];
+        try {
+            os = resp.getOutputStream();
+            bis = new BufferedInputStream(new FileInputStream(file));
+            int i = 0;
+            while ((i = bis.read(buff)) != -1) {
+                os.write(buff, 0, i);
+                os.flush();
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                bis.close();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+    }
+}

+ 112 - 0
zhoushan-system-api/src/main/java/com/fdage/controller/EquipmentController.java

@@ -0,0 +1,112 @@
+package com.fdage.controller;
+
+import com.fdage.aop.WebControllerLog;
+import com.fdage.enums.ResponEnum;
+import com.fdage.pojo.TbEquipment;
+import com.fdage.pojo.TbUser;
+import com.fdage.request.RequestEquipment;
+import com.fdage.request.RequestUser;
+import com.fdage.respon.ResponEquipment;
+import com.fdage.service.IEquipmentService;
+import com.fdage.util.AjaxJson;
+import com.fdage.util.PasswordUtils;
+import com.github.pagehelper.PageInfo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import java.util.List;
+
+/**
+ * Created by Hb_zzZ on 2019/9/11.
+ */
+@Controller
+@RequestMapping("/zhoushan/equipment")
+@Slf4j
+@Api(tags = "设备管理模块")
+public class EquipmentController {
+
+    @Autowired
+    private IEquipmentService service;
+
+    @PostMapping("addEquipment")
+    @ResponseBody
+    @WebControllerLog(description = "设备管理-新增设备")
+    @ApiOperation("新增设备")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "name", value = "设备名称", dataType = "String"),
+            @ApiImplicitParam(name = "uuid", value = "设备id", dataType = "String"),
+            @ApiImplicitParam(name = "positionId", value = "位置id", dataType = "String"),
+            @ApiImplicitParam(name = "state", value = "状态,0:启用,1:禁用", dataType = "String")})
+    public AjaxJson addEquipment(@RequestBody RequestEquipment bo){
+        if(bo == null || StringUtils.isEmpty(bo.getName()) || bo.getPositionId() == null ||
+                StringUtils.isEmpty(bo.getUuid()) || bo.getState() == null){
+            return AjaxJson.failure(ResponEnum.NOT_NULL.getCode(), ResponEnum.NOT_NULL.getMessage());
+        }
+        TbEquipment equipment = new TbEquipment();
+        BeanUtils.copyProperties(bo, equipment);
+        service.insert(equipment);
+        return AjaxJson.success();
+    }
+
+    @PostMapping("updateEquipment")
+    @ResponseBody
+    @WebControllerLog(description = "设备管理-修改设备")
+    @ApiOperation("修改设备")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "文物id", dataType = "String"),
+            @ApiImplicitParam(name = "name", value = "设备名称", dataType = "String"),
+            @ApiImplicitParam(name = "uuid", value = "设备id", dataType = "String"),
+            @ApiImplicitParam(name = "positionId", value = "位置id", dataType = "String"),
+            @ApiImplicitParam(name = "state", value = "状态,0:启用,1:禁用", dataType = "String")})
+    public AjaxJson updateEquipment(@RequestBody RequestEquipment bo){
+        if(bo == null || StringUtils.isEmpty(bo.getName()) || bo.getPositionId() == null ||
+                StringUtils.isEmpty(bo.getUuid()) || bo.getState() == null || bo.getId() == null){
+            return AjaxJson.failure(ResponEnum.NOT_NULL.getCode(), ResponEnum.NOT_NULL.getMessage());
+        }
+        TbEquipment equipment = new TbEquipment();
+        BeanUtils.copyProperties(bo, equipment);
+        service.update(equipment);
+        return AjaxJson.success();
+    }
+
+    @PostMapping("updateState")
+    @ResponseBody
+    @WebControllerLog(description = "设备管理-设备启用/停用")
+    @ApiOperation("设备启用/停用")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "文物id", dataType = "String"),
+            @ApiImplicitParam(name = "state", value = "状态,0:启用,1:禁用", dataType = "String")})
+    public AjaxJson updateState(@RequestBody RequestEquipment bo){
+        if(bo == null || bo.getState() == null || bo.getId() == null){
+            return AjaxJson.failure(ResponEnum.NOT_NULL.getCode(), ResponEnum.NOT_NULL.getMessage());
+        }
+        TbEquipment equipment = new TbEquipment();
+        BeanUtils.copyProperties(bo, equipment);
+        service.update(equipment);
+        return AjaxJson.success();
+    }
+
+    @PostMapping("list")
+    @ResponseBody
+    @WebControllerLog(description = "设备管理-获取设备列表")
+    @ApiOperation("获取设备列表")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "pageNum", value = "页码", dataType = "String"),
+            @ApiImplicitParam(name = "pageSize", value = "每页数量", dataType = "String")})
+    public AjaxJson list(@RequestBody RequestEquipment bo){
+        List<ResponEquipment> list = service.findList(bo);
+        PageInfo<ResponEquipment> pageInfo = new PageInfo<>(list);
+        return AjaxJson.success(pageInfo);
+    }
+}

+ 280 - 0
zhoushan-system-api/src/main/java/com/fdage/controller/ExhibitionController.java

@@ -0,0 +1,280 @@
+package com.fdage.controller;
+
+import com.alibaba.fastjson.JSONObject;
+import com.fdage.aop.WebControllerLog;
+import com.fdage.enums.ResponEnum;
+import com.fdage.pojo.TbExhibition;
+import com.fdage.pojo.TbExhibitionCollection;
+import com.fdage.request.RequestCollection;
+import com.fdage.request.RequestExhibition;
+import com.fdage.respon.ResponExhibition;
+import com.fdage.respon.ResponInformation;
+import com.fdage.service.IExhibitionService;
+import com.fdage.util.AjaxJson;
+import com.fdage.util.DateUtil;
+import com.fdage.util.FileUtil;
+import com.github.pagehelper.PageInfo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Controller;
+import org.springframework.util.StringUtils;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * Created by Hb_zzZ on 2019/9/12.
+ */
+@Controller
+@RequestMapping("/zhoushan/exhibition")
+@Slf4j
+@Api(tags = "展示管理模块")
+public class ExhibitionController {
+
+    @Value("${upload.exhibition}")
+    private String uploadPath;
+
+    @Autowired
+    private IExhibitionService service;
+
+    @PostMapping("insertExhibitionCollection")
+    @ResponseBody
+    @ApiOperation("新增展览方案-推送给文通")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "exhibitionId", value = "展览id", dataType = "String"),
+            @ApiImplicitParam(name = "collectionId", value = "文物id", dataType = "String")})
+    public AjaxJson insertExhibitionCollection(@RequestBody RequestExhibition bo){
+        if(bo == null || bo.getExhibitionId() == null || StringUtils.isEmpty(bo.getCollectionId())){
+            return AjaxJson.failure(ResponEnum.NOT_NULL.getCode(), ResponEnum.NOT_NULL.getMessage());
+        }
+        String[] ids = bo.getCollectionId().split(",");
+        TbExhibitionCollection exhibitionCollection = new TbExhibitionCollection();
+        for(int i = 0, len = ids.length; i < len; i++){
+            exhibitionCollection.setExhibitionId(bo.getExhibitionId());
+            exhibitionCollection.setCollectionId(Long.valueOf(ids[i]));
+            service.insertExhibitionCollection(exhibitionCollection);
+        }
+
+        //发送sse消息
+        SseController.send("data:" + "0\r\n");
+        return AjaxJson.success();
+    }
+
+    @PostMapping("updateExhibitionCollection")
+    @ResponseBody
+    @ApiOperation("修改展览方案-推送给文通")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "exhibitionId", value = "展览id", dataType = "String"),
+            @ApiImplicitParam(name = "collectionId", value = "文物id", dataType = "String")})
+    public AjaxJson updateExhibitionCollection(@RequestBody RequestExhibition bo){
+        if(bo == null || bo.getExhibitionId() == null || StringUtils.isEmpty(bo.getCollectionId())){
+            return AjaxJson.failure(ResponEnum.NOT_NULL.getCode(), ResponEnum.NOT_NULL.getMessage());
+        }
+
+        service.deleteExhibitionCollection(bo.getExhibitionId());
+
+
+        String[] ids = bo.getCollectionId().split(",");
+        TbExhibitionCollection exhibitionCollection = new TbExhibitionCollection();
+        for(int i = 0, len = ids.length; i < len; i++){
+            exhibitionCollection.setExhibitionId(bo.getExhibitionId());
+            exhibitionCollection.setCollectionId(Long.valueOf(ids[i]));
+            service.insertExhibitionCollection(exhibitionCollection);
+        }
+
+        //发送sse消息
+        SseController.send("data:" + "0\r\n");
+        return AjaxJson.success();
+    }
+
+    @PostMapping("addExhibition")
+    @ResponseBody
+    @WebControllerLog(description = "展示管理-新增展览方案")
+    @ApiOperation("新增展览方案")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "name", value = "展览方案名称", dataType = "String"),
+            @ApiImplicitParam(name = "exhibitionId", value = "展览id", dataType = "String"),
+            @ApiImplicitParam(name = "equipmentId", value = "关联设备id", dataType = "String"),
+            @ApiImplicitParam(name = "webUrl", value = "展示封面", dataType = "String"),
+            @ApiImplicitParam(name = "state", value = "状态,0:启用,1:禁用", dataType = "String")})
+    public AjaxJson addExhibition(@RequestBody RequestExhibition bo){
+        if(bo == null || StringUtils.isEmpty(bo.getName()) || bo.getTypeId() == null || bo.getState() == null){
+            return AjaxJson.failure(ResponEnum.NOT_NULL.getCode(), ResponEnum.NOT_NULL.getMessage());
+        }
+
+        TbExhibition exhibition = new TbExhibition();
+        BeanUtils.copyProperties(bo, exhibition);
+        service.insert(exhibition);
+        return AjaxJson.success(exhibition);
+    }
+
+    @PostMapping("updateExhibition")
+    @ResponseBody
+    @WebControllerLog(description = "展示管理-修改展览方案")
+    @ApiOperation("修改展览方案")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "isSend", value = "是否推送给问题,1推送", dataType = "String"),
+            @ApiImplicitParam(name = "id", value = "展览方案id", dataType = "String"),
+            @ApiImplicitParam(name = "name", value = "展览方案名称", dataType = "String"),
+            @ApiImplicitParam(name = "exhibitionId", value = "展览id", dataType = "String"),
+            @ApiImplicitParam(name = "equipmentId", value = "关联设备id", dataType = "String"),
+            @ApiImplicitParam(name = "state", value = "状态,0:启用,1:禁用", dataType = "String")})
+    public AjaxJson updateExhibition(@RequestBody RequestExhibition bo){
+        if(bo == null || StringUtils.isEmpty(bo.getName()) || bo.getTypeId() == null || bo.getState() == null){
+            return AjaxJson.failure(ResponEnum.NOT_NULL.getCode(), ResponEnum.NOT_NULL.getMessage());
+        }
+
+        TbExhibition exhibition = new TbExhibition();
+        BeanUtils.copyProperties(bo, exhibition);
+        exhibition.setCreateTime(new Date());
+        service.update(exhibition);
+        if(bo.getIsSend() != null && bo.getIsSend() == 1){
+            //发送sse消息
+            SseController.send("data:" + "0\r\n");
+        }
+        return AjaxJson.success(exhibition);
+    }
+
+    @PostMapping("deleteExhibition")
+    @ResponseBody
+    @WebControllerLog(description = "展示管理-删除展览方案")
+    @ApiOperation("删除展览方案")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "展览方案id", dataType = "String")})
+    public AjaxJson deleteExhibition(@RequestBody RequestExhibition bo){
+        if(bo == null || bo.getId() == null){
+            return AjaxJson.failure(ResponEnum.NOT_NULL.getCode(), ResponEnum.NOT_NULL.getMessage());
+        }
+
+        service.delete(bo.getId());
+        return AjaxJson.success();
+    }
+
+    @PostMapping("copyExhibition")
+    @ResponseBody
+    @WebControllerLog(description = "展示管理-复制展览方案")
+    @ApiOperation("复制展览方案")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "展览方案id", dataType = "String")})
+    public AjaxJson copyExhibition(@RequestBody RequestExhibition bo){
+        if(bo == null || bo.getId() == null){
+            return AjaxJson.failure(ResponEnum.NOT_NULL.getCode(), ResponEnum.NOT_NULL.getMessage());
+        }
+
+        TbExhibition exhibition = service.findById(bo.getId());
+        exhibition.setId(null);
+        exhibition.setState(1);
+        service.insert(exhibition);
+
+        List<ResponExhibition> list = service.findExhibitionCollection(bo.getId());
+        TbExhibitionCollection exhibitionCollection = new TbExhibitionCollection();
+        for(ResponExhibition responExhibition : list){
+            exhibitionCollection.setExhibitionId(exhibition.getId());
+            exhibitionCollection.setCollectionId(responExhibition.getCollectionId());
+            service.insertExhibitionCollection(exhibitionCollection);
+        }
+        return AjaxJson.success();
+    }
+
+    @PostMapping("findCollectionByExhibition")
+    @ResponseBody
+    @ApiOperation("通过展示方案找文物")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "exhibitionId", value = "展览方案id", dataType = "String")})
+    public AjaxJson findCollectionByExhibition(@RequestBody RequestExhibition bo){
+        if(bo == null || bo.getExhibitionId() == null){
+            return AjaxJson.failure(ResponEnum.NOT_NULL.getCode(), ResponEnum.NOT_NULL.getMessage());
+        }
+
+        return AjaxJson.success(service.findCollectionByExhibition(bo.getExhibitionId()));
+    }
+
+    @PostMapping("list")
+    @ResponseBody
+    @WebControllerLog(description = "展示管理-获取展览方案列表")
+    @ApiOperation("获取展览方案列表")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "name", value = "方案名称", dataType = "String"),
+            @ApiImplicitParam(name = "pageNum", value = "页码", dataType = "String"),
+            @ApiImplicitParam(name = "pageSize", value = "每页数量", dataType = "String")})
+    public AjaxJson list(@RequestBody RequestExhibition bo){
+        List<ResponExhibition> list = service.findList(bo);
+        for(ResponExhibition exhibition : list){
+            exhibition.setCreateTime(String.valueOf(DateUtil.convert2CST(exhibition.getCreateTime())));
+        }
+        PageInfo<ResponExhibition> pageInfo = new PageInfo<>(list);
+        return AjaxJson.success(pageInfo);
+    }
+
+    @PostMapping("getExhibitionByEquipmentId")
+    @ResponseBody
+    @ApiOperation("通过设备id获取展示方案")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "equipmentId", value = "设备id", dataType = "String")})
+    public AjaxJson getExhibitionByEquipmentId(@RequestBody RequestExhibition bo){
+        if(bo == null || bo.getEquipmentId() == null){
+            return AjaxJson.failure(ResponEnum.NOT_NULL.getCode(), ResponEnum.NOT_NULL.getMessage());
+        }
+
+        ResponExhibition responExhibition = service.getExhibitionByEquipmentId(bo.getEquipmentId());
+        return AjaxJson.success(responExhibition);
+    }
+
+    @PostMapping("getExhibitionById")
+    @ResponseBody
+    @ApiOperation("通过id获取展示方案")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "id", dataType = "String")})
+    public AjaxJson getExhibitionById(@RequestBody RequestExhibition bo){
+        if(bo == null || bo.getId() == null){
+            return AjaxJson.failure(ResponEnum.NOT_NULL.getCode(), ResponEnum.NOT_NULL.getMessage());
+        }
+
+        ResponExhibition responExhibition = service.getExhibitionById(bo.getId());
+        return AjaxJson.success(responExhibition);
+    }
+
+    @PostMapping("/upload")
+    @ResponseBody
+    @ApiOperation("上传展示方案图片")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "file", value = "文件流", dataType = "String")})
+    public AjaxJson upload(@RequestParam(value = "filename", defaultValue = "") String name, @RequestParam("file") MultipartFile file){
+        if(file == null){
+            return AjaxJson.failure("参数不能为空");
+        }
+        String fileName = System.currentTimeMillis() + "_";
+        if(org.apache.commons.lang3.StringUtils.isNotEmpty(name)){
+            fileName = fileName + name;
+        }else {
+            fileName = fileName + file.getOriginalFilename();
+        }
+        log.info("图片地址:" + fileName);
+        boolean flag = FileUtil.upload(file, uploadPath, fileName);
+
+        if(!flag){
+            return AjaxJson.failure("上传图片失败");
+        }
+
+//        Map<String, String> map = new HashMap<>();
+//        map.put(path + "/" + fileName, "company/" + fileName);
+//        uploadToAlibabaService.upload(map);
+
+        return AjaxJson.success((Object) ("/exhibition/" + fileName));
+    }
+
+    @PostMapping("typeList")
+    @ResponseBody
+    @ApiOperation("获取展示类别列表")
+    public AjaxJson typeList(){
+        return AjaxJson.success(service.typeList());
+    }
+}

+ 181 - 0
zhoushan-system-api/src/main/java/com/fdage/controller/InformationController.java

@@ -0,0 +1,181 @@
+package com.fdage.controller;
+
+import com.alibaba.fastjson.JSONObject;
+import com.fdage.aop.WebControllerLog;
+import com.fdage.constant.ConstantUrl;
+import com.fdage.enums.ResponEnum;
+import com.fdage.pojo.TbInformation;
+import com.fdage.request.RequestInformation;
+import com.fdage.respon.ResponInformation;
+import com.fdage.service.IInformationService;
+import com.fdage.util.AjaxJson;
+import com.fdage.util.DateUtil;
+import com.fdage.util.FileUtil;
+import com.github.pagehelper.PageInfo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.List;
+
+/**
+ * Created by Hb_zzZ on 2019/9/11.
+ */
+@Controller
+@RequestMapping("/zhoushan/information")
+@Slf4j
+@Api(tags = "资讯管理模块")
+public class InformationController {
+
+    @Autowired
+    private IInformationService service;
+
+    @Value("${upload.information}")
+    private String uploadPath;
+
+    @PostMapping("addInformation")
+    @ResponseBody
+    @WebControllerLog(description = "资讯管理-新增资讯")
+    @ApiOperation("新增资讯")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "name", value = "资讯名称", dataType = "String"),
+            @ApiImplicitParam(name = "type", value = "资讯类型", dataType = "String"),
+            @ApiImplicitParam(name = "contentUrl", value = "轮播内容,视频为url,图片类型为json", dataType = "String"),
+            @ApiImplicitParam(name = "contentNum", value = "轮播板式", dataType = "String"),
+            @ApiImplicitParam(name = "description", value = "资讯说明", dataType = "String"),
+            @ApiImplicitParam(name = "orderNum", value = "展示顺序编码", dataType = "String"),
+            @ApiImplicitParam(name = "startTime", value = "轮播开始时间", dataType = "String"),
+            @ApiImplicitParam(name = "endTime", value = "轮播结束时间", dataType = "String"),
+            @ApiImplicitParam(name = "state", value = "状态,0:启用,1:禁用", dataType = "String")})
+    public AjaxJson addInformation(@RequestBody RequestInformation bo){
+        if(bo == null || StringUtils.isEmpty(bo.getName()) ||
+                bo.getType() == null  || StringUtils.isEmpty(bo.getContentUrl())){
+            return AjaxJson.failure(ResponEnum.NOT_NULL.getCode(), ResponEnum.NOT_NULL.getMessage());
+        }
+
+        TbInformation information = new TbInformation();
+        BeanUtils.copyProperties(bo, information);
+        service.insert(information);
+        //发送sse消息
+        SseController.send("data:" + "1\r\n");
+        return AjaxJson.success();
+    }
+
+    @PostMapping("updateInformation")
+    @ResponseBody
+    @WebControllerLog(description = "资讯管理-修改资讯")
+    @ApiOperation("修改资讯")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "id", dataType = "String"),
+            @ApiImplicitParam(name = "name", value = "资讯名称", dataType = "String"),
+            @ApiImplicitParam(name = "type", value = "资讯类型", dataType = "String"),
+            @ApiImplicitParam(name = "contentUrl", value = "轮播内容,视频为url,图片类型为json", dataType = "String"),
+            @ApiImplicitParam(name = "contentNum", value = "轮播板式", dataType = "String"),
+            @ApiImplicitParam(name = "description", value = "资讯说明", dataType = "String"),
+            @ApiImplicitParam(name = "orderNum", value = "展示顺序编码", dataType = "String"),
+            @ApiImplicitParam(name = "startTime", value = "轮播开始时间", dataType = "String"),
+            @ApiImplicitParam(name = "endTime", value = "轮播结束时间", dataType = "String"),
+            @ApiImplicitParam(name = "state", value = "状态,0:启用,1:禁用", dataType = "String")})
+    public AjaxJson updateInformation(@RequestBody RequestInformation bo){
+        if(bo == null || StringUtils.isEmpty(bo.getName()) ||
+                bo.getType() == null  || StringUtils.isEmpty(bo.getContentUrl())){
+            return AjaxJson.failure(ResponEnum.NOT_NULL.getCode(), ResponEnum.NOT_NULL.getMessage());
+        }
+
+        TbInformation information = new TbInformation();
+        BeanUtils.copyProperties(bo, information);
+        service.update(information);
+
+        //发送sse消息
+        SseController.send("data:" + "1\r\n");
+        return AjaxJson.success();
+    }
+
+    @PostMapping("deleteInformation")
+    @ResponseBody
+    @WebControllerLog(description = "资讯管理-删除资讯")
+    @ApiOperation("删除资讯")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "id", dataType = "String")})
+    public AjaxJson deleteInformation(@RequestBody RequestInformation bo){
+        if(bo == null || bo.getId() == null ){
+            return AjaxJson.failure(ResponEnum.NOT_NULL.getCode(), ResponEnum.NOT_NULL.getMessage());
+        }
+        service.delete(bo.getId());
+
+        //发送sse消息
+        SseController.send("data:" + "1\r\n");
+        return AjaxJson.success();
+    }
+
+    @PostMapping("list")
+    @ResponseBody
+    @WebControllerLog(description = "资讯管理-获取资讯列表")
+    @ApiOperation("获取资讯列表")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "type", value = "资讯类型,0表示海报,1表示视频", dataType = "String"),
+            @ApiImplicitParam(name = "name", value = "资讯名称", dataType = "String"),
+            @ApiImplicitParam(name = "pageNum", value = "页码", dataType = "String"),
+            @ApiImplicitParam(name = "pageSize", value = "每页数量", dataType = "String")})
+    public AjaxJson list(@RequestBody RequestInformation bo){
+        List<ResponInformation> list = service.findList(bo);
+        for(ResponInformation information : list){
+            if(StringUtils.isNotEmpty(information.getStartTime())){
+                information.setStartTime(String.valueOf(DateUtil.convert2CST(information.getStartTime())));
+            }
+            if(StringUtils.isNotEmpty(information.getEndTime())){
+                information.setEndTime(String.valueOf(DateUtil.convert2CST(information.getEndTime())));
+            }
+            if(StringUtils.isNotEmpty(information.getCreateTime())){
+                information.setCreateTime(String.valueOf(DateUtil.convert2CST(information.getCreateTime())));
+            }
+        }
+        PageInfo<ResponInformation> pageInfo = new PageInfo<>(list);
+        return AjaxJson.success(pageInfo);
+    }
+
+    @PostMapping("listAll")
+    @ResponseBody
+    @ApiOperation("所有资讯")
+    public AjaxJson listAll(){
+        return AjaxJson.success(service.listAll());
+    }
+
+    @PostMapping("/upload")
+    @ResponseBody
+    @ApiOperation("上传资讯图片")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "file", value = "文件流", dataType = "String")})
+    public AjaxJson upload(@RequestParam(value = "filename", defaultValue = "") String name, @RequestParam("file") MultipartFile file){
+        if(file == null){
+            return AjaxJson.failure("参数不能为空");
+        }
+        String fileName = System.currentTimeMillis() + "_";
+        if(StringUtils.isNotEmpty(name)){
+            fileName = fileName + name;
+        }else {
+            fileName = fileName + file.getOriginalFilename();
+        }
+        log.info("图片地址:" + fileName);
+        boolean flag = FileUtil.upload(file, uploadPath, fileName);
+
+        if(!flag){
+            return AjaxJson.failure("上传图片失败");
+        }
+
+//        Map<String, String> map = new HashMap<>();
+//        map.put(path + "/" + fileName, "company/" + fileName);
+//        uploadToAlibabaService.upload(map);
+
+        return AjaxJson.success((Object) ("/information/" + fileName));
+    }
+}

+ 49 - 0
zhoushan-system-api/src/main/java/com/fdage/controller/LogController.java

@@ -0,0 +1,49 @@
+package com.fdage.controller;
+
+import com.fdage.aop.WebControllerLog;
+import com.fdage.pojo.TbLog;
+import com.fdage.request.RequestLog;
+import com.fdage.service.ILogService;
+import com.fdage.util.AjaxJson;
+import com.github.pagehelper.PageInfo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import java.util.List;
+
+/**
+ * Created by Hb_zzZ on 2020/7/28.
+ */
+@Controller
+@RequestMapping("/zhoushan/log")
+@Slf4j
+@Api(tags = "工作日志模块")
+public class LogController {
+
+    @Autowired
+    private ILogService logService;
+
+    @PostMapping("list")
+    @ResponseBody
+    @WebControllerLog(description = "工作日志-获取日志列表")
+    @ApiOperation("获取日志列表")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "type", value = "资讯类型,0表示海报,1表示视频", dataType = "String"),
+            @ApiImplicitParam(name = "name", value = "资讯名称", dataType = "String"),
+            @ApiImplicitParam(name = "pageNum", value = "页码", dataType = "String"),
+            @ApiImplicitParam(name = "pageSize", value = "每页数量", dataType = "String")})
+    public AjaxJson list(@RequestBody RequestLog bo){
+        List<TbLog> list = logService.findList(bo);
+        PageInfo<TbLog> pageInfo = new PageInfo<>(list);
+        return AjaxJson.success(pageInfo);
+    }
+}

+ 126 - 0
zhoushan-system-api/src/main/java/com/fdage/controller/LoginController.java

@@ -0,0 +1,126 @@
+package com.fdage.controller;
+
+import com.fdage.dto.ResourceTree;
+import com.fdage.enums.ResponEnum;
+import com.fdage.pojo.TbLog;
+import com.fdage.pojo.TbUser;
+import com.fdage.request.RequestUser;
+import com.fdage.respon.ResponUser;
+import com.fdage.service.ILogService;
+import com.fdage.service.IResourceService;
+import com.fdage.service.IRoleService;
+import com.fdage.service.IUserService;
+import com.fdage.shiro.JwtUtil2;
+import com.fdage.util.AjaxJson;
+import com.fdage.util.PasswordUtils;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * Created by Hb_zzZ on 2019/9/11.
+ */
+@Slf4j
+@Controller
+@Api(tags = "登陆模块")
+public class LoginController {
+
+    @Autowired
+    private IUserService userService;
+
+    @Autowired
+    private IResourceService resourceService;
+
+    @Autowired
+    private RedisTemplate<String, String> redisTemplate;
+
+    @Autowired
+    private ILogService logService;
+
+    @PostMapping("login")
+    @ResponseBody
+    @ApiOperation("登陆")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "userName", value = "用户名", dataType = "String"),
+            @ApiImplicitParam(name = "password", value = "密码", dataType = "String")})
+    public AjaxJson login(@RequestBody RequestUser bo){
+        if(bo == null || StringUtils.isEmpty(bo.getUserName()) || StringUtils.isEmpty(bo.getPassword())){
+            return AjaxJson.failure(ResponEnum.NOT_NULL.getCode(), ResponEnum.NOT_NULL.getMessage());
+        }
+
+        TbUser user = userService.findByUserName(bo.getUserName());
+        if(user == null){
+            return AjaxJson.failure(ResponEnum.USER_NOT_EXIST.getCode(), ResponEnum.USER_NOT_EXIST.getMessage());
+        }
+
+        String encryptPwd = PasswordUtils.encrypt(bo.getPassword(), bo.getUserName(), PasswordUtils.getStaticSalt());
+        if(!encryptPwd.equals(user.getPassword())){
+            return AjaxJson.failure(ResponEnum.PASSWORD_ERROR.getCode(), ResponEnum.PASSWORD_ERROR.getMessage());
+        }
+
+        // 检查账号是否启用
+        if (user.getState() != 0) {
+            log.error("账号已停用: {}", user.getUserName());
+            return AjaxJson.failure(ResponEnum.USER_STOP_USING.getCode(), ResponEnum.USER_STOP_USING.getMessage());
+        }
+
+//        ResponUser result = new ResponUser();
+//        BeanUtils.copyProperties(user, result);
+
+
+        List<ResourceTree> resourcesTreeByUserPermission = resourceService.getResourcesAllByUserPermission(user);
+//        log.info("获取权限 success");
+
+        // 获取用户角色
+        List<String> roles = userService.findRoleByUserId(user.getId());
+//        log.info("获取角色 success");
+
+
+        // 创建新token
+        HashMap<String, Object> tokenMap = new HashMap<>();
+        tokenMap.put("userName", user.getUserName());
+        tokenMap.put("id", user.getId());
+        tokenMap.put("role", roles);
+
+
+        String token = JwtUtil2.createJWT(-1, tokenMap);
+
+        HashMap<String, Object> result = new HashMap<>();
+        result.put("user", user);
+        result.put("token", token);
+        result.put("permission", resourcesTreeByUserPermission);
+        result.put("role", roles);
+//        log.info("token create");
+
+
+        // 更新到 redis, 有效期24h, 旧token无效
+        redisTemplate.opsForValue().set(user.getUserName(), token, Long.parseLong("23"), TimeUnit.HOURS);
+
+        TbLog logEntity = new TbLog();
+        logEntity.setCreateTime(new Date());
+        logEntity.setType("登陆");
+        logEntity.setDescription("登陆系统");
+        logEntity.setUserId(user.getId());
+
+        logService.save(logEntity);
+
+        return AjaxJson.success(result);
+    }
+}

+ 32 - 0
zhoushan-system-api/src/main/java/com/fdage/controller/PositionController.java

@@ -0,0 +1,32 @@
+package com.fdage.controller;
+
+import com.fdage.service.IPositionService;
+import com.fdage.util.AjaxJson;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+/**
+ * Created by Hb_zzZ on 2019/9/11.
+ */
+@Controller
+@RequestMapping("/zhoushan/position")
+@Slf4j
+@Api(tags = "位置模块")
+public class PositionController {
+
+    @Autowired
+    private IPositionService service;
+
+    @PostMapping("list")
+    @ResponseBody
+    @ApiOperation("获取所有位置")
+    public AjaxJson list(){
+        return AjaxJson.success(service.list());
+    }
+}

+ 39 - 0
zhoushan-system-api/src/main/java/com/fdage/controller/ResourceController.java

@@ -0,0 +1,39 @@
+package com.fdage.controller;
+
+import com.fdage.dto.ResourceTree;
+import com.fdage.service.IResourceService;
+import com.fdage.util.AjaxJson;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import java.util.List;
+
+/**
+ * Created by Hb_zzZ on 2020/7/28.
+ */
+@Controller
+@RequestMapping("/zhoushan/resource")
+@Slf4j
+@Api(tags = "权限资源模块")
+public class ResourceController {
+
+    @Autowired
+    private IResourceService resourceService;
+
+    @PostMapping("find")
+    @ResponseBody
+    @ApiOperation("获取所以资源(树形结构)")
+    public AjaxJson find() throws Exception {
+//        List<ResourceEntity> result = resourceService.findList(Sort.by("sort").ascending());
+        List<ResourceTree> listTree = resourceService.getTree();
+        return AjaxJson.success(listTree);
+    }
+
+
+}

+ 157 - 0
zhoushan-system-api/src/main/java/com/fdage/controller/RoleController.java

@@ -0,0 +1,157 @@
+package com.fdage.controller;
+
+import com.fdage.aop.WebControllerLog;
+import com.fdage.pojo.TbRole;
+import com.fdage.request.RequestBase;
+import com.fdage.request.RequestRole;
+import com.fdage.respon.ResponRole;
+import com.fdage.service.IResourceService;
+import com.fdage.service.IRoleService;
+import com.fdage.util.AjaxJson;
+import com.github.pagehelper.PageInfo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import java.util.List;
+
+/**
+ * Created by Hb_zzZ on 2020/7/28.
+ */
+@Controller
+@RequestMapping("/zhoushan/role")
+@Slf4j
+@Api(tags = "角色管理模块")
+public class RoleController {
+
+    @Autowired
+    private IRoleService roleService;
+
+    @Autowired
+    private IResourceService resourceService;
+
+    @PostMapping("save")
+    @ResponseBody
+    @WebControllerLog(description = "角色管理-新增/修改角色")
+    @ApiOperation("新增/修改角色")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "roleName", value = "角色名称", dataType = "String"),
+            @ApiImplicitParam(name = "resources", value = "资源id集合", dataType = "String"),
+            @ApiImplicitParam(name = "id", value = "id", dataType = "String"),
+            @ApiImplicitParam(name = "description", value = "角色描述", dataType = "String"),
+            @ApiImplicitParam(name = "state", value = "状态,0:启用,1:禁用", dataType = "String"),
+            @ApiImplicitParam(name = "roleKey", value = "角色key", dataType = "String")})
+    public AjaxJson save(@RequestBody RequestRole param){
+
+        if (StringUtils.isBlank(param.getRoleName())){
+            log.error("角色名称不能为空");
+            return AjaxJson.failure("角色名称不能为空");
+        }
+
+        if (param.getResources() == null){
+            log.error("权限不能为空");
+            return AjaxJson.failure("权限不能为空");
+        }
+
+
+        TbRole roleEntity = null;
+        int n = 0;
+
+        if (param.getId() == null) {
+            roleEntity = new TbRole();
+            BeanUtils.copyProperties(param, roleEntity);
+            n = roleService.save(roleEntity);
+        } else {
+            roleEntity = roleService.findById(param.getId());
+            if (roleEntity == null) {
+                return AjaxJson.failure("该角色不存在");
+
+            }
+            BeanUtils.copyProperties(param, roleEntity);
+            n = roleService.update(roleEntity);
+
+            // 每次修改,删除角色资源表信息,重新添加
+            roleService.deleteRoleResource(param.getId());
+        }
+
+        // 添加权限
+        if (n >= 0){
+            if (param.getResources() != null){
+                for (long i : param.getResources()) {
+                    roleService.saveRoleResource(roleEntity.getId(), i);
+                }
+                return AjaxJson.success();
+            }
+        }
+
+        return AjaxJson.failure("新增角色失败");
+    }
+
+    @PostMapping("list")
+    @ResponseBody
+    @WebControllerLog(description = "角色管理-获取角色列表")
+    @ApiOperation("获取角色列表")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "pageNum", value = "页码", dataType = "String"),
+            @ApiImplicitParam(name = "pageSize", value = "每页数量", dataType = "String")})
+    public AjaxJson list(@RequestBody RequestBase bo){
+        List<ResponRole> list = roleService.findRoleList(bo);
+        PageInfo<ResponRole> pageInfo = new PageInfo<>(list);
+        return AjaxJson.success(pageInfo);
+    }
+
+    @PostMapping("findUserListByRoleId")
+    @ResponseBody
+    @ApiOperation("获取角色关联的用户列表")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "角色id", dataType = "String")})
+    public AjaxJson findUserListByRoleId(@RequestBody RequestRole bo){
+        return AjaxJson.success(roleService.findUserListByRoleId(bo.getId()));
+    }
+
+    @PostMapping("updateState")
+    @ResponseBody
+    @ApiOperation("角色启用/停用")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "角色id", dataType = "String"),
+            @ApiImplicitParam(name = "state", value = "状态,0:启用,1:禁用", dataType = "String")})
+    public AjaxJson updateState(@RequestBody RequestRole bo){
+        if(bo.getId() == null || bo.getState() == null){
+            return AjaxJson.failure("id或者状态不能为空");
+        }
+
+        List<String> list = roleService.findUserNameByRoleId(bo.getId());
+        if(list != null && list.size() > 0){
+            return AjaxJson.failure("当前角色还有关联用户,请先处理用户角色");
+        }
+        TbRole role = new TbRole();
+        role.setId(bo.getId());
+        role.setState(bo.getState());
+        roleService.update(role);
+        return AjaxJson.success();
+    }
+
+    @PostMapping("findRoleById")
+    @ResponseBody
+    @ApiOperation("根据id获取角色详情")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "角色id", dataType = "String")})
+    public AjaxJson findRoleById(@RequestBody RequestRole bo){
+        if(bo.getId() == null){
+            return AjaxJson.failure("id不能为空");
+        }
+        ResponRole responRole = roleService.findRoleById(bo.getId());
+        responRole.setResources(resourceService.getResourcesAllByRolePermission(bo.getId()));
+        return AjaxJson.success(responRole);
+    }
+}

+ 124 - 0
zhoushan-system-api/src/main/java/com/fdage/controller/SseController.java

@@ -0,0 +1,124 @@
+package com.fdage.controller;
+
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import javax.servlet.AsyncContext;
+import javax.servlet.AsyncEvent;
+import javax.servlet.AsyncListener;
+import javax.servlet.ServletException;
+import javax.servlet.annotation.WebServlet;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * Created by Hb_zzZ on 2019/9/16.
+ */
+@WebServlet(urlPatterns = { "/sendMessage" }, asyncSupported = true)
+@Controller
+public class SseController extends HttpServlet {
+
+    private static final long serialVersionUID = 1L;
+    private final static int DEFAULT_TIME_OUT = 10 * 60 * 1000;
+    public static List<AsyncContext> actxList =new ArrayList<AsyncContext>();
+
+    @Override
+    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
+        // TODO Auto-generated method stub
+        resp.setContentType("text/event-stream");
+        resp.setCharacterEncoding("UTF-8");
+        req.setAttribute("org.apache.catalina.ASYNC_SUPPORTED", true);//注意这里
+
+        AsyncContext actx = req.startAsync(req, resp);
+        actx.setTimeout(DEFAULT_TIME_OUT);
+        actx.addListener(new AsyncListener() {
+            @Override
+            public void onComplete(AsyncEvent arg0) throws IOException {
+                // TODO Auto-generated method stub
+                System.out.println("[echo]event complete:" + arg0.getSuppliedRequest().getRemoteAddr());
+            }
+
+            @Override
+            public void onError(AsyncEvent arg0) throws IOException {
+                // TODO Auto-generated method stub
+                System.out.println("[echo]event has error");
+            }
+
+            @Override
+            public void onStartAsync(AsyncEvent arg0) throws IOException {
+                // TODO Auto-generated method stub
+                System.out.println("[echo]event start:" + arg0.getSuppliedRequest().getRemoteAddr());
+            }
+
+            @Override
+            public void onTimeout(AsyncEvent arg0) throws IOException {
+                // TODO Auto-generated method stub
+                System.out.println("[echo]event time lost");
+            }
+        });
+
+        actxList.add(actx);
+
+//        PrintWriter out = actx.getResponse().getWriter();
+//        out.println("data:" + new Date().getTime());  //js页面EventSource接收数据格式:data:数据 + "\r\n"
+//        out.flush();
+//        new Thread(new AsyncWebService(actx)).start();
+    }
+
+    @GetMapping("send")
+    @ResponseBody
+    public static String send(String msg){
+        //打印当前AsyncContext
+        System.out.println(actxList.size());
+        if(actxList.size()>0){
+            for(int i = 0;i<actxList.size();i++){
+                AsyncContext obj = actxList.get(i);
+                PrintWriter out;
+
+                try {
+                    if (obj.getTimeout()>0){
+                        out = obj.getResponse().getWriter();
+                        out.println(msg);  //js页面EventSource接收数据格式:data:数据 + "\r\n"
+                        out.flush();
+                    }
+                } catch (Exception e) {
+                    // TODO Auto-generated catch block
+                    e.printStackTrace();
+                }
+            }
+        }
+        return "发送消息";
+    }
+
+//    class AsyncWebService implements Runnable {
+//        AsyncContext ctx;
+//
+//        public AsyncWebService(AsyncContext ctx) {
+//            this.ctx = ctx;
+//        }
+//
+//        public void run() {
+//            try {
+//                //等待十秒钟,以模拟业务方法的执行
+//                Thread.sleep(10000);
+//                PrintWriter out = ctx.getResponse().getWriter();
+//                out.println("data:中文" + new Date() + "\r\n");  //js页面EventSource接收数据格式:data:数据 + "\r\n"
+//
+//                out.flush();
+//                ctx.complete();
+//            } catch (Exception e) {
+//                e.printStackTrace();
+//            }
+//
+//        }
+//
+//    }
+}

+ 280 - 0
zhoushan-system-api/src/main/java/com/fdage/controller/UserController.java

@@ -0,0 +1,280 @@
+package com.fdage.controller;
+
+import com.fdage.aop.WebControllerLog;
+import com.fdage.constant.ConstantUrl;
+import com.fdage.enums.ResponEnum;
+import com.fdage.pojo.TbRole;
+import com.fdage.pojo.TbUser;
+import com.fdage.request.RequestUser;
+import com.fdage.respon.ResponUser;
+import com.fdage.service.IRoleService;
+import com.fdage.service.IUserService;
+import com.fdage.util.AjaxJson;
+import com.fdage.util.FileUtil;
+import com.fdage.util.PasswordUtils;
+import com.github.pagehelper.PageInfo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.List;
+
+/**
+ * Created by Hb_zzZ on 2019/9/11.
+ */
+@Controller
+@RequestMapping("/zhoushan/user")
+@Slf4j
+@Api(tags = "用户管理模块")
+public class UserController {
+
+    @Autowired
+    private IUserService userService;
+
+    @Autowired
+    private IRoleService roleService;
+
+    @Value("${upload.head}")
+    private String userHead;
+
+    @PostMapping("addUser")
+    @ResponseBody
+    @WebControllerLog(description = "用户管理-新增用户")
+    @ApiOperation("新增用户")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "userName", value = "用户名", dataType = "String"),
+            @ApiImplicitParam(name = "roleId", value = "角色id", dataType = "String"),
+            @ApiImplicitParam(name = "phone", value = "手机号码", dataType = "String"),
+            @ApiImplicitParam(name = "head", value = "头像连接地址", dataType = "String"),
+            @ApiImplicitParam(name = "state", value = "状态,0:启用,1:禁用", dataType = "String")})
+    public AjaxJson addUser(@RequestBody RequestUser bo){
+        if(bo == null || StringUtils.isEmpty(bo.getUserName()) ||
+                bo.getRoleId() == null || StringUtils.isEmpty(bo.getPhone()) || bo.getState() == null){
+            return AjaxJson.failure(ResponEnum.NOT_NULL.getCode(), ResponEnum.NOT_NULL.getMessage());
+        }
+
+        TbUser user = userService.findByUserName(bo.getUserName());
+        if(user != null){
+            return AjaxJson.failure(ResponEnum.USER_EXIST.getCode(), ResponEnum.USER_EXIST.getMessage());
+        }
+
+        user = new TbUser();
+        BeanUtils.copyProperties(bo, user);
+        user.setPassword(PasswordUtils.encrypt("1234abcd", bo.getUserName(), PasswordUtils.getStaticSalt()));
+        userService.insert(user);
+
+        roleService.saveRoleUser(bo.getRoleId(), user.getId());
+        return AjaxJson.success(user);
+    }
+
+    @PostMapping("updateUser")
+    @ResponseBody
+    @WebControllerLog(description = "用户管理-修改用户")
+    @ApiOperation("修改用户")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "id", dataType = "String"),
+            @ApiImplicitParam(name = "userName", value = "用户名", dataType = "String"),
+            @ApiImplicitParam(name = "roleId", value = "角色id", dataType = "String"),
+            @ApiImplicitParam(name = "phone", value = "手机号码", dataType = "String"),
+            @ApiImplicitParam(name = "head", value = "头像连接地址", dataType = "String"),
+            @ApiImplicitParam(name = "state", value = "状态,0:启用,1:禁用", dataType = "String")})
+    public AjaxJson updateUser(@RequestBody RequestUser bo){
+        if(bo == null || StringUtils.isEmpty(bo.getUserName()) ||
+                bo.getRoleId() == null || StringUtils.isEmpty(bo.getPhone()) || bo.getState() == null ){
+            return AjaxJson.failure(ResponEnum.NOT_NULL.getCode(), ResponEnum.NOT_NULL.getMessage());
+        }
+
+        TbUser user = userService.findByUserName(bo.getUserName());
+        if(user == null){
+            return AjaxJson.failure(ResponEnum.USER_NOT_EXIST.getCode(), ResponEnum.USER_NOT_EXIST.getMessage());
+        }
+
+        bo.setId(user.getId());
+        BeanUtils.copyProperties(bo, user);
+        user.setPassword(PasswordUtils.encrypt(bo.getPassword(), bo.getUserName(), PasswordUtils.getStaticSalt()));
+        userService.update(user);
+
+        roleService.deleteRoleUser(user.getId());
+        roleService.saveRoleUser(bo.getRoleId(), user.getId());
+        return AjaxJson.success();
+    }
+
+    @PostMapping("deleteUser")
+    @ResponseBody
+    @WebControllerLog(description = "用户管理-删除用户")
+    @ApiOperation("删除用户")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "id", dataType = "String")})
+    public AjaxJson deleteUser(@RequestBody RequestUser bo){
+        if(bo == null || bo.getId() == null){
+            return AjaxJson.failure(ResponEnum.NOT_NULL.getCode(), ResponEnum.NOT_NULL.getMessage());
+        }
+
+        TbUser user = userService.findById(bo.getId());
+        if(user == null){
+            return AjaxJson.failure(ResponEnum.USER_NOT_EXIST.getCode(), ResponEnum.USER_NOT_EXIST.getMessage());
+        }
+
+        userService.delete(user.getId());
+        roleService.deleteRoleUser(user.getId());
+        return AjaxJson.success();
+    }
+
+    @PostMapping("updateState")
+    @ResponseBody
+    @WebControllerLog(description = "用户管理-用户启用/停用")
+    @ApiOperation("用户启用/停用")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "id", dataType = "String"),
+            @ApiImplicitParam(name = "state", value = "状态,0:启用,1:禁用", dataType = "String")})
+    public AjaxJson updateState(@RequestBody RequestUser bo){
+        if(bo == null || bo.getId() == null || bo.getState() == null){
+            return AjaxJson.failure(ResponEnum.NOT_NULL.getCode(), ResponEnum.NOT_NULL.getMessage());
+        }
+
+        TbUser user = userService.findById(bo.getId());
+        if(user == null){
+            return AjaxJson.failure(ResponEnum.USER_NOT_EXIST.getCode(), ResponEnum.USER_NOT_EXIST.getMessage());
+        }
+
+        user.setState(bo.getState());
+        userService.update(user);
+        return AjaxJson.success();
+    }
+
+    @PostMapping("findById")
+    @ResponseBody
+    @ApiOperation("通过id查找用户")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "id", dataType = "String")})
+    public AjaxJson findById(@RequestBody RequestUser bo){
+        if(bo == null || bo.getId() == null){
+            return AjaxJson.failure(ResponEnum.NOT_NULL.getCode(), ResponEnum.NOT_NULL.getMessage());
+        }
+
+        TbUser user = userService.findById(bo.getId());
+        if(user == null){
+            return AjaxJson.failure(ResponEnum.USER_NOT_EXIST.getCode(), ResponEnum.USER_NOT_EXIST.getMessage());
+        }
+
+        user.setPassword("");
+        return AjaxJson.success(user);
+    }
+
+    @PostMapping("updatePassword")
+    @ResponseBody
+    @WebControllerLog(description = "用户管理-用户修改密码")
+    @ApiOperation("用户修改密码")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "id", dataType = "String"),
+            @ApiImplicitParam(name = "repeatPassword", value = "重复新密码", dataType = "String"),
+            @ApiImplicitParam(name = "newPassword", value = "新密码", dataType = "String"),
+            @ApiImplicitParam(name = "password", value = "当前密码", dataType = "String")})
+    public AjaxJson updatePassword(@RequestBody RequestUser bo){
+        if(bo == null || bo.getId() == null || StringUtils.isEmpty(bo.getPassword()) ||
+                StringUtils.isEmpty(bo.getRepeatPassword()) || StringUtils.isEmpty(bo.getNewPassword())){
+            return AjaxJson.failure(ResponEnum.NOT_NULL.getCode(), ResponEnum.NOT_NULL.getMessage());
+        }
+
+        if(!bo.getRepeatPassword().equals(bo.getNewPassword())){
+            return AjaxJson.failure(ResponEnum.PASSWORD_INCONSISTENCY.getCode(), ResponEnum.PASSWORD_INCONSISTENCY.getMessage());
+        }
+
+        TbUser user = userService.findById(bo.getId());
+        if(user == null){
+            return AjaxJson.failure(ResponEnum.USER_NOT_EXIST.getCode(), ResponEnum.USER_NOT_EXIST.getMessage());
+        }
+
+        String encryptPwd = PasswordUtils.encrypt(bo.getPassword(), user.getUserName(), PasswordUtils.getStaticSalt());
+        if(!encryptPwd.equals(user.getPassword())){
+            return AjaxJson.failure(ResponEnum.PASSWORD_ERROR.getCode(), ResponEnum.PASSWORD_ERROR.getMessage());
+        }
+
+        user.setPassword(PasswordUtils.encrypt(bo.getNewPassword(), user.getUserName(), PasswordUtils.getStaticSalt()));
+        userService.update(user);
+        return AjaxJson.success();
+    }
+
+    @PostMapping("resetPassword")
+    @ResponseBody
+    @WebControllerLog(description = "用户管理-用户重置密码")
+    @ApiOperation("用户重置密码")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "id", dataType = "String")})
+    public AjaxJson resetPassword(@RequestBody RequestUser bo){
+        if(bo == null || bo.getId() == null){
+            return AjaxJson.failure(ResponEnum.NOT_NULL.getCode(), ResponEnum.NOT_NULL.getMessage());
+        }
+
+        TbUser user = userService.findById(bo.getId());
+        if(user == null){
+            return AjaxJson.failure(ResponEnum.USER_NOT_EXIST.getCode(), ResponEnum.USER_NOT_EXIST.getMessage());
+        }
+
+        user.setPassword(PasswordUtils.encrypt("1234abcd", user.getUserName(), PasswordUtils.getStaticSalt()));
+        userService.update(user);
+        return AjaxJson.success();
+    }
+
+    @PostMapping("list")
+    @ResponseBody
+    @WebControllerLog(description = "用户管理-获取用户列表")
+    @ApiOperation("获取用户列表")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "status", value = "状态,0:启用,1:禁用", dataType = "String"),
+            @ApiImplicitParam(name = "userName", value = "用户名", dataType = "String"),
+            @ApiImplicitParam(name = "pageNum", value = "页码", dataType = "String"),
+            @ApiImplicitParam(name = "pageSize", value = "每页数量", dataType = "String")})
+    public AjaxJson list(@RequestBody RequestUser bo){
+        List<ResponUser> list = userService.findUserList(bo);
+        PageInfo<ResponUser> pageInfo = new PageInfo<>(list);
+        return AjaxJson.success(pageInfo);
+    }
+
+    @PostMapping("roleList")
+    @ResponseBody
+    @ApiOperation("获取所有角色")
+    public AjaxJson roleList(){
+        List<TbRole> list = userService.roleList();
+        return AjaxJson.success(list);
+    }
+
+    @RequestMapping("/uploadHead")
+    @ResponseBody
+    @WebControllerLog(description = "用户管理-用户上传头像")
+    @ApiOperation("用户上传头像")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "file", value = "文件流", dataType = "String")})
+    public AjaxJson upload(@RequestParam(value = "filename", defaultValue = "") String name,@RequestParam("file") MultipartFile file){
+        if(file == null){
+            return AjaxJson.failure("参数不能为空");
+        }
+        String fileName = System.currentTimeMillis() + "_";
+        if(StringUtils.isNotEmpty(name)){
+            fileName = fileName + name;
+        }else {
+            fileName = fileName + file.getOriginalFilename();
+        }
+        log.info("图片地址:" + fileName);
+        boolean flag = FileUtil.upload(file, userHead, fileName);
+
+        if(!flag){
+            return AjaxJson.failure("上传图片失败");
+        }
+
+//        Map<String, String> map = new HashMap<>();
+//        map.put(path + "/" + fileName, "company/" + fileName);
+//        uploadToAlibabaService.upload(map);
+
+        return AjaxJson.success((Object) ("/head/" + fileName));
+    }
+}

+ 59 - 0
zhoushan-system-api/src/main/java/com/fdage/listner/LoggerInterceptor.java

@@ -0,0 +1,59 @@
+package com.fdage.listner;
+
+//import com.fdage.util.JwtUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+        import org.springframework.web.servlet.HandlerInterceptor;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * Created by Hb_zzZ on 2018/12/6.
+ */
+@Slf4j
+@Component
+public class LoggerInterceptor implements HandlerInterceptor {
+
+    @Override
+    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
+        String uri = request.getRequestURI();
+        log.info("进入" + uri + "请求");
+
+//        String token = request.getHeader("token");
+//        if(StringUtils.isEmpty(token) || "null".equals(token)){
+//            log.info(uri + "请求token为空");
+//            response.setContentType("text/html;charset=UTF-8");
+//            JSONObject responseJson = new JSONObject();
+//            responseJson.put("code", 202);
+//            responseJson.put("message", "token不能为空");
+//            response.getWriter().println(responseJson);
+//            return false;
+//        }
+//        Claims claims = JwtUtil.parseJWT(token);
+//        Object obj = redisUtils.get(CommonConf.REDIS_LOGIN_TOKEN + claims.get("username", String.class));
+//        if(obj == null || !obj.equals(token)){
+//            log.info(uri + "请求token错误被拦截");
+//            response.setContentType("text/html;charset=UTF-8");
+//            JSONObject responseJson = new JSONObject();
+//            responseJson.put("code", 202);
+//            responseJson.put("message", "token不正确请重新登陆");
+//            response.getWriter().println(responseJson);
+//            return false;
+//        }
+        return true;
+    }
+
+    @Override
+    public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
+
+    }
+
+    @Override
+    public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
+        String uri = request.getRequestURI();
+        log.info(uri + "请求结束");
+    }
+}

+ 87 - 0
zhoushan-system-api/src/main/java/com/fdage/listner/Swagger2.java

@@ -0,0 +1,87 @@
+package com.fdage.listner;
+
+import com.google.common.collect.Lists;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import springfox.documentation.builders.ApiInfoBuilder;
+import springfox.documentation.builders.PathSelectors;
+import springfox.documentation.builders.RequestHandlerSelectors;
+import springfox.documentation.service.ApiInfo;
+import springfox.documentation.service.ApiKey;
+import springfox.documentation.service.AuthorizationScope;
+import springfox.documentation.service.SecurityReference;
+import springfox.documentation.spi.DocumentationType;
+import springfox.documentation.spi.service.contexts.SecurityContext;
+import springfox.documentation.spring.web.plugins.Docket;
+import springfox.documentation.swagger2.annotations.EnableSwagger2;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Created by owen on 2020/2/18
+ *
+ * 集成Swagger有3步:
+ * 1.pom.xml添加依赖
+ * 2.添加Swagger2.class
+ * 3.Application.class 加上注解@EnableSwagger2 表示开启Swagger
+ * 4.http://localhost:8080/doc.html#/
+ *
+ * 2.9.2 不需要字启动类配置注解
+ */
+//@EnableKnife4j 开启动态响应值
+@Configuration
+@EnableSwagger2
+public class Swagger2 {
+    @Bean
+    public Docket createRestApi() {
+        return new Docket(DocumentationType.SWAGGER_2)
+                .apiInfo(apiInfo())
+                .select()
+                .apis(RequestHandlerSelectors.basePackage("com.fdage.controller"))
+                .paths(PathSelectors.any())
+                .build()
+                //添加登录认证,可以使用token
+                .securityContexts(securityContexts())
+                .securitySchemes(securitySchemes())
+                ;
+    }
+
+    private ApiInfo apiInfo() {
+        return new ApiInfoBuilder()
+                .title("舟山博物馆")
+                .description("舟山博物馆Api接口文档")
+                .version("1.0")
+                .build();
+    }
+
+    private List<ApiKey> securitySchemes() {
+        //设置请求头信息
+        List<ApiKey> result = new ArrayList<>();
+//        ApiKey apiKey = new ApiKey("Authorization", "Authorization", "header");
+        ApiKey apiKey = new ApiKey("Authorization", "token", "header");
+        result.add(apiKey);
+        return result;
+
+    }
+
+
+    private List<SecurityContext> securityContexts() {
+
+        SecurityContext context = SecurityContext.builder()
+                .securityReferences(defaultAuth())
+                .build();
+
+        return Lists.newArrayList(context);
+
+    }
+
+    private List<SecurityReference> defaultAuth() {
+        List<SecurityReference> result = new ArrayList<>();
+        AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything");
+        AuthorizationScope[] authorizationScopes = new AuthorizationScope[1];
+        authorizationScopes[0] = authorizationScope;
+        result.add(new SecurityReference("Authorization", authorizationScopes));
+        return result;
+    }
+}

+ 164 - 0
zhoushan-system-api/src/main/java/com/fdage/shiro/JWTFilter.java

@@ -0,0 +1,164 @@
+package com.fdage.shiro;
+
+import com.alibaba.fastjson.JSONObject;
+import lombok.extern.log4j.Log4j2;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.shiro.web.filter.authc.BasicHttpAuthenticationFilter;
+import org.springframework.http.HttpStatus;
+import org.springframework.web.bind.annotation.RequestMethod;
+
+import javax.servlet.ServletOutputStream;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.PrintWriter;
+
+
+/**
+ * 自定义拦截规则
+ */
+@Log4j2
+public class JWTFilter extends BasicHttpAuthenticationFilter {
+
+
+
+    /**
+     * 判断用户是否想要登入。
+     * 检测header里面是否包含token字段即可
+     *
+     * return false:直接不校验就可以访问api
+     */
+    @Override
+    protected boolean isLoginAttempt(ServletRequest request, ServletResponse response) {
+        HttpServletRequest req = (HttpServletRequest) request;
+        String token = req.getHeader("token");
+
+        if (StringUtils.isEmpty(token)) {
+            log.error("token is null");
+
+            // 先这样抛出异常,这个种不是接口的形式
+//            throw new AuthenticationException("token is null");
+//            throw new JwtAuthenticationException(5008, "token is null 123");
+//            throw new BaseRuntimeException(5001, "token is null");
+
+            // 直接返回Response信息
+//            JSONObject jsonObject = new JSONObject();
+//            jsonObject.put("status", 5001);
+//            jsonObject.put("message", "token is null 123");
+//            this.writeResponse(response, jsonObject);
+
+            // 直接返回false, ExceptionController的ShiroException.class是能捕捉到5003那个异常的
+//            return false;
+        }
+
+        return true;
+
+    }
+
+
+
+    /**
+     * 执行登录验证
+     */
+    @Override
+    protected boolean executeLogin(ServletRequest request, ServletResponse response) {
+        HttpServletRequest httpServletRequest = (HttpServletRequest) request;
+        String token = httpServletRequest.getHeader("token");
+        JWTToken jwtToken = new JWTToken(token);
+
+        // 提交给realm进行登入,如果错误他会抛出异常并被捕获
+        getSubject(request, response).login(jwtToken);
+
+        // 如果没有抛出异常则代表登入成功,返回true
+        return true;
+    }
+
+    /**
+     * 这里我们详细说明下为什么最终返回的都是true,即允许访问
+     * 例如我们提供一个地址 GET /article
+     * 登入用户和游客看到的内容是不同的
+     * 如果在这里返回了false,请求会被直接拦截,用户看不到任何东西
+     * 所以我们在这里返回true,Controller中可以通过 subject.isAuthenticated() 来判断用户是否登入
+     * 如果有些资源只有登入用户才能访问,我们只需要在方法上面加上 @RequiresAuthentication 注解即可
+     * 但是这样做有一个缺点,就是不能够对GET,POST等请求进行分别过滤鉴权(因为我们重写了官方的方法),但实际上对应用影响不大
+     *
+     * owen:
+     *  return false ,表示全局拦截,必须登录才可以访问接口,除非配置了免拦截
+     *  "" @RequiresAuthentication 现在不需要配置这个注解来免登录
+     *
+     */
+    @Override
+    protected boolean isAccessAllowed(ServletRequest request, ServletResponse response, Object mappedValue) {
+        if (isLoginAttempt(request, response)) {
+            try {
+                executeLogin(request, response);
+
+            } catch (Exception e) {
+                /** 这个异常需要自己写,全局捕获不了*/
+
+                // 认证出现异常,传递错误信息msg
+                String msg = e.getMessage();
+                // 获取应用异常(该Cause是导致抛出此throwable(异常)的throwable(异常))
+                Throwable throwable = e.getCause();
+                JSONObject jsonObject = new JSONObject();
+                if (throwable instanceof JwtAuthenticationException) {
+                    jsonObject.put("code", ((JwtAuthenticationException) throwable).getCode());
+                    jsonObject.put("msg", ((JwtAuthenticationException) throwable).getMsg());
+                }else{
+                    log.error(msg);
+                    jsonObject.put("code", 5002);
+                    jsonObject.put("msg", "token invalid");
+                }
+                // 直接返回Response信息
+                this.writeResponse(response, jsonObject);
+//                return false;
+            }
+        }
+        // return false 前端没有响应,接收不到异常
+        return true;
+    }
+
+    /**
+     * 对跨域提供支持
+     * 只对需要token验证的有效,不需要验证的还是需要用注解处理一下
+     *
+     */
+    @Override
+    protected boolean preHandle(ServletRequest request, ServletResponse response) throws Exception {
+        HttpServletRequest httpServletRequest = (HttpServletRequest) request;
+        HttpServletResponse httpServletResponse = (HttpServletResponse) response;
+        httpServletResponse.setHeader("Access-control-Allow-Origin", httpServletRequest.getHeader("Origin"));
+        httpServletResponse.setHeader("Access-Control-Allow-Methods", "GET,POST,OPTIONS,PUT,DELETE");
+        httpServletResponse.setHeader("Access-Control-Allow-Headers", httpServletRequest.getHeader("Access-Control-Request-Headers"));
+        // 跨域时会首先发送一个option请求,这里我们给option请求直接返回正常状态
+        if (httpServletRequest.getMethod().equals(RequestMethod.OPTIONS.name())) {
+            httpServletResponse.setStatus(HttpStatus.OK.value());
+            return false;
+        }
+        return super.preHandle(request, response);
+    }
+
+
+    /**
+     * 无需转发,直接返回Response信息
+     *
+     */
+    private void writeResponse(ServletResponse response, JSONObject msg) {
+        response.setCharacterEncoding("UTF-8");
+        response.setContentType("application/json; charset=utf-8");
+        ServletOutputStream outputStream = null;
+        try {
+            outputStream = response.getOutputStream();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        assert outputStream != null;
+        PrintWriter printWriter = new PrintWriter(outputStream, true);
+        printWriter.write(msg.toString());//直接将json输出到页面
+        printWriter.flush();
+        printWriter.close();
+
+    }
+}

+ 23 - 0
zhoushan-system-api/src/main/java/com/fdage/shiro/JWTToken.java

@@ -0,0 +1,23 @@
+package com.fdage.shiro;
+
+import org.apache.shiro.authc.AuthenticationToken;
+
+public class JWTToken implements AuthenticationToken {
+
+    // 密钥
+    private String token;
+
+    public JWTToken(String token) {
+        this.token = token;
+    }
+
+    @Override
+    public Object getPrincipal() {
+        return token;
+    }
+
+    @Override
+    public Object getCredentials() {
+        return token;
+    }
+}

+ 73 - 0
zhoushan-system-api/src/main/java/com/fdage/shiro/JWTUtil.java

@@ -0,0 +1,73 @@
+package com.fdage.shiro;//package com.xiaoan.web.shiro;
+//
+//import com.auth0.jwt.JWT;
+//import com.auth0.jwt.JWTVerifier;
+//import com.auth0.jwt.algorithms.Algorithm;
+//import com.auth0.jwt.exceptions.JWTDecodeException;
+//import com.auth0.jwt.interfaces.DecodedJWT;
+//import lombok.extern.log4j.Log4j2;
+//
+//import java.io.UnsupportedEncodingException;
+//import java.util.Date;
+//
+//@Log4j2
+//public class JWTUtil {
+//
+//    // 过期时间24小时
+//    private static final long EXPIRE_TIME = 24*60*60*1000;
+//
+//
+//    /**
+//     * 校验token是否正确
+//     * @param token 密钥
+//     * @param secret 用户的密码
+//     * @return 是否正确
+//     */
+//    public static boolean verify(String token, String username, String secret) {
+//        try {
+//            Algorithm algorithm = Algorithm.HMAC256(secret);
+//            JWTVerifier verifier = JWT.require(algorithm)
+//                    .withClaim("username", username)
+//                    .build();
+//            DecodedJWT jwt = verifier.verify(token);
+//            return true;
+//        } catch (Exception e) {
+//            e.getMessage();
+//            log.error(e.getMessage());
+//            return false;
+//        }
+//    }
+//
+//    /**
+//     * 获得token中的信息无需secret解密也能获得
+//     * @return token中包含的用户名
+//     */
+//    public static String getUsername(String token) {
+//        try {
+//            DecodedJWT jwt = JWT.decode(token);
+//            return jwt.getClaim("username").asString();
+//        } catch (JWTDecodeException e) {
+//            return null;
+//        }
+//    }
+//
+//    /**
+//     * 生成签名,5min后过期
+//     * @param username 用户名
+//     * @param secret 用户的密码
+//     * @return 加密的token
+//     */
+//    public static String sign(String username, String secret) {
+//        try {
+//            Date date = new Date(System.currentTimeMillis()+EXPIRE_TIME);
+//            Algorithm algorithm = Algorithm.HMAC256(secret);
+//            // 附带username信息
+//            return JWT.create()
+//                    .withClaim("username", username)
+//                    .withExpiresAt(date)
+//                    .sign(algorithm);
+//        } catch (UnsupportedEncodingException e) {
+//            return null;
+//        }
+//    }
+//}

+ 34 - 0
zhoushan-system-api/src/main/java/com/fdage/shiro/JwtAuthenticationException.java

@@ -0,0 +1,34 @@
+package com.fdage.shiro;
+
+import org.apache.shiro.ShiroException;
+
+public class JwtAuthenticationException extends ShiroException {
+
+    private static final long serialVersionUID = 2899335020273674736L;
+
+    private int code;
+
+    private String msg;
+
+    public JwtAuthenticationException(int code, String msg){
+        super(msg);
+        this.code = code;
+        this.msg = msg;
+    }
+
+    public int getCode() {
+        return code;
+    }
+
+    public void setCode(int code) {
+        this.code = code;
+    }
+
+    public String getMsg() {
+        return msg;
+    }
+
+    public void setMsg(String msg) {
+        this.msg = msg;
+    }
+}

+ 225 - 0
zhoushan-system-api/src/main/java/com/fdage/shiro/JwtUtil2.java

@@ -0,0 +1,225 @@
+package com.fdage.shiro;
+
+import com.auth0.jwt.JWT;
+import com.auth0.jwt.exceptions.JWTDecodeException;
+import com.auth0.jwt.interfaces.Claim;
+import com.auth0.jwt.interfaces.DecodedJWT;
+import io.jsonwebtoken.Claims;
+import io.jsonwebtoken.JwtBuilder;
+import io.jsonwebtoken.Jwts;
+import io.jsonwebtoken.SignatureAlgorithm;
+
+import java.util.*;
+
+public class JwtUtil2 {
+
+    //生成签名的时候使用的秘钥secret
+    private static final String SECRET = "XX#$%()(#*!()!KL<><MQLMNQNQJQK&sdfkjsdrow32234545fdf>?N<:{LWPW";
+
+    /**
+     * 用户登录成功后生成Jwt
+     * 使用Hs256算法  私匙使用用户密码
+     *
+     * @param ttlMillis jwt过期时间
+     * @param userName  用户名
+     * @return
+     */
+    public static String createJWT(long ttlMillis, String userName) {
+        //指定签名的时候使用的签名算法,也就是header那部分,jjwt已经将这部分内容封装好了。
+        SignatureAlgorithm signatureAlgorithm = SignatureAlgorithm.HS256;
+
+        //生成JWT的时间
+        long nowMillis = System.currentTimeMillis();
+        Date now = new Date(nowMillis);
+
+        //创建payload的私有声明(根据特定的业务需要添加,如果要拿这个做验证,一般是需要和jwt的接收方提前沟通好验证方式的)
+        Map<String, Object> claims = new HashMap<String, Object>();
+        claims.put("userName", userName);
+
+        //下面就是在为payload添加各种标准声明和私有声明了
+        //这里其实就是new一个JwtBuilder,设置jwt的body
+        JwtBuilder builder = Jwts.builder()
+                //如果有私有声明,一定要先设置这个自己创建的私有的声明,这个是给builder的claim赋值,一旦写在标准的声明赋值之后,就是覆盖了那些标准的声明的
+                .setClaims(claims)
+                //设置jti(JWT ID):是JWT的唯一标识,根据业务需要,这个可以设置为一个不重复的值,主要用来作为一次性token,从而回避重放攻击。
+                .setId(UUID.randomUUID().toString())
+                //iat: jwt的签发时间
+                .setIssuedAt(now)
+                //代表这个JWT的主体,即它的所有人,这个是一个json格式的字符串,可以存放什么userid,roldid之类的,作为什么用户的唯一标志。
+                .setSubject(userName)
+                //设置签名使用的签名算法和签名使用的秘钥
+                .signWith(signatureAlgorithm, SECRET);
+
+        if (ttlMillis >= 0) {
+            long expMillis = nowMillis + ttlMillis;
+            Date exp = new Date(expMillis);
+            //设置过期时间
+            builder.setExpiration(exp);
+        }/*else{
+            //设置过期时间半小时
+            DateTime expDate = new DateTime().plusMinutes(30);
+            builder.setExpiration(expDate.toDate());
+        }*/
+        return builder.compact();
+    }
+
+
+    /**
+     * Token的解密
+     * @param token 加密后的token
+     * @return
+     */
+    public static Claims parseJWT(String token) {
+        //得到DefaultJwtParser
+        Claims claims = Jwts.parser()
+                //设置签名的秘钥
+                .setSigningKey(SECRET)
+                //设置需要解析的jwt
+                .parseClaimsJws(token).getBody();
+        return claims;
+    }
+
+
+    /**
+     * 校验token
+     * 在这里可以使用官方的校验,我这里校验的是token中携带的密码于数据库一致的话就校验通过
+     * @param token
+     * @param userName
+     * @return
+     */
+    public static Boolean isVerify(String token, String userName) {
+
+        //得到DefaultJwtParser
+        Claims claims = Jwts.parser()
+                //设置签名的秘钥
+                .setSigningKey(SECRET)
+                //设置需要解析的jwt
+                .parseClaimsJws(token).getBody();
+
+        if (claims.get("userName").equals(userName)) {
+            return true;
+        }
+        return false;
+    }
+
+    /**
+     * 获得token中的信息无需secret解密也能获得
+     *
+     * @return token中包含的用户名
+     */
+    public static String getUsername(String token) {
+        try {
+            DecodedJWT jwt = JWT.decode(token);
+            return jwt.getClaim("userName").asString();
+        } catch (JWTDecodeException e) {
+            return null;
+        }
+    }
+
+
+
+    public static List getUserRole(String token) {
+//        try {
+            DecodedJWT jwt = JWT.decode(token);
+            Claim role = jwt.getClaim("role");
+            return role.as(List.class);
+//        } catch (JWTDecodeException e) {
+//            return null;
+//        }
+    }
+
+
+    public static String createJWT(long ttlMillis, Map<String, Object> paramMap) {
+        //指定签名的时候使用的签名算法,也就是header那部分,jjwt已经将这部分内容封装好了。
+        SignatureAlgorithm signatureAlgorithm = SignatureAlgorithm.HS256;
+
+        String userName = paramMap.get("userName").toString();
+
+        //生成JWT的时间
+        long nowMillis = System.currentTimeMillis();
+        Date now = new Date(nowMillis);
+
+        //创建payload的私有声明(根据特定的业务需要添加,如果要拿这个做验证,一般是需要和jwt的接收方提前沟通好验证方式的)
+        Map<String, Object> claims = new HashMap<String, Object>();
+        claims.put("userName", userName);
+        claims.put("id", paramMap.get("id"));
+        claims.put("role", paramMap.get("role"));
+
+        //下面就是在为payload添加各种标准声明和私有声明了
+        //这里其实就是new一个JwtBuilder,设置jwt的body
+        JwtBuilder builder = Jwts.builder()
+                //如果有私有声明,一定要先设置这个自己创建的私有的声明,这个是给builder的claim赋值,一旦写在标准的声明赋值之后,就是覆盖了那些标准的声明的
+                .setClaims(claims)
+                //设置jti(JWT ID):是JWT的唯一标识,根据业务需要,这个可以设置为一个不重复的值,主要用来作为一次性token,从而回避重放攻击。
+                .setId(UUID.randomUUID().toString())
+                //iat: jwt的签发时间
+                .setIssuedAt(now)
+                //代表这个JWT的主体,即它的所有人,这个是一个json格式的字符串,可以存放什么userid,roldid之类的,作为什么用户的唯一标志。
+                .setSubject(userName)
+                //设置签名使用的签名算法和签名使用的秘钥
+                .signWith(signatureAlgorithm, SECRET);
+
+        if (ttlMillis >= 0) {
+            long expMillis = nowMillis + ttlMillis;
+            Date exp = new Date(expMillis);
+            //设置过期时间
+            builder.setExpiration(exp);
+        }/*else{
+            //设置过期时间半小时
+            DateTime expDate = new DateTime().plusMinutes(30);
+            builder.setExpiration(expDate.toDate());
+        }*/
+        return builder.compact();
+    }
+
+    public static Long getUserId(String token) {
+        try {
+            DecodedJWT jwt = JWT.decode(token);
+            Claim id = jwt.getClaim("id");
+            return id.asLong();
+        } catch (JWTDecodeException e) {
+            return null;
+        }
+    }
+
+    public static void main(String[] args) {
+//        test3();
+//        test2();
+        long nowMillis = System.currentTimeMillis();
+        System.out.println(nowMillis);
+        Date exp = new Date(nowMillis);
+        System.out.println(exp);
+    }
+
+    public static void test2(){
+        String token = "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJhZG1pbiIsInJvbGUiOlsiYWRtaW4iLCJyb290Il0sImlkIjoxLCJ1c2VyTmFtZSI6ImFkbWluIiwiaWF0IjoxNTgzODA5MzkzLCJqdGkiOiJkNjZiZTFkYi00MTQ0LTQxMTYtYTNlNi01ZDBjNjhlNTI3ODAifQ.-4AdsVP2RwmPS2grtO4aC8ov9PwkilzaGdThGetBJok";
+        System.out.println(getUserRole(token));
+
+    }
+
+    public static void test3(){
+        HashMap<String, Object> map = new HashMap<>();
+
+        ArrayList<Object> list = new ArrayList<>();
+        list.add("admin");
+        list.add("root");
+
+        map.put("userName", "admin");
+        map.put("id", Long.valueOf("1"));
+        map.put("role", list);
+
+        String token = createJWT(-1, map);
+        System.out.println(token);
+
+        Boolean isVerify = isVerify(token, "admin");
+        System.out.println(isVerify);
+
+    }
+
+    private static void testList(){
+        ArrayList<Object> list = new ArrayList<>();
+        list.add("admin");
+        list.add("root");
+    }
+
+}

+ 148 - 0
zhoushan-system-api/src/main/java/com/fdage/shiro/MyRealm.java

@@ -0,0 +1,148 @@
+package com.fdage.shiro;
+
+import com.fdage.pojo.TbResource;
+import com.fdage.pojo.TbRole;
+import com.fdage.pojo.TbUser;
+import com.fdage.service.IResourceService;
+import com.fdage.service.IRoleService;
+import com.fdage.service.IUserService;
+import lombok.extern.log4j.Log4j2;
+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.authz.SimpleAuthorizationInfo;
+import org.apache.shiro.realm.AuthorizingRealm;
+import org.apache.shiro.subject.PrincipalCollection;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.stereotype.Service;
+
+import java.math.BigInteger;
+import java.util.*;
+
+/**
+ * 配置不校验的话,是不会走这个方法的
+ */
+@Log4j2
+@Service
+public class MyRealm extends AuthorizingRealm {
+
+
+
+    @Autowired
+    private RedisTemplate<String, String> redisTemplate;
+
+    @Autowired
+    private IUserService userService;
+
+    @Autowired
+    private IRoleService roleService;
+
+    @Autowired
+    private IResourceService resourceService;
+
+
+
+    /**
+     * 大坑!,必须重写此方法,不然Shiro会报错
+     */
+    @Override
+    public boolean supports(AuthenticationToken token) {
+        return token instanceof JWTToken;
+    }
+
+    /**
+     * 只有当需要检测用户权限的时候才会调用此方法,例如checkRole,checkPermission之类的
+     *
+     * principals: 是token
+     */
+    @Override
+    protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) {
+        String username = JwtUtil2.getUsername(principals.toString());
+
+        TbUser dbUserEntity = userService.findByUserName(username);
+
+        SimpleAuthorizationInfo simpleAuthorizationInfo = new SimpleAuthorizationInfo();
+
+        Map<String, Set<String>> resultMap = getRole(dbUserEntity);
+        Set<String> rolekeys = resultMap.get("role");
+
+
+        // 获取用户权限
+        Set<String> permissions = new HashSet<>();
+        try {
+            List<TbResource> userPermissionList = resourceService.getResourcesByUserPermission(dbUserEntity);
+            for (TbResource i : userPermissionList) {
+                permissions.add(i.getResourceKey());
+            }
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        // 设置角色、权限
+        simpleAuthorizationInfo.addRoles(rolekeys);
+        simpleAuthorizationInfo.addStringPermissions(permissions);
+        return simpleAuthorizationInfo;
+    }
+
+    /**
+     * 获取角色相关信息
+     */
+    private Map<String, Set<String>> getRole(TbUser userEntity){
+
+        Set<Long> roleIds = userService.findUserRoleByUserId(userEntity.getId());
+        Set<String> roleKeys = new HashSet<>();
+        for (Long i : roleIds) {
+            TbRole dbRoleEntity = roleService.findById(i.longValue());
+            roleKeys.add(dbRoleEntity.getRoleKey());
+        }
+
+        HashMap<String, Set<String>> resultMap = new HashMap<>();
+        resultMap.put("role", roleKeys);
+
+        return resultMap;
+    }
+
+    /**
+     * 默认使用此方法进行用户名正确与否验证,错误抛出异常即可。
+     */
+    @Override
+    protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken auth) throws AuthenticationException {
+        String token = (String) auth.getCredentials();
+        // 解密获得username,用于和数据库进行对比
+        if(token == null){
+            log.error("error token");
+            throw new JwtAuthenticationException(5001, "token is null");
+        }
+        String username = JwtUtil2.getUsername(token);
+        if (username == null) {
+            log.error("error token username");
+            throw new JwtAuthenticationException(5001, "token invalid");
+        }
+
+        TbUser userEntity = userService.findByUserName(username);
+        if (userEntity == null) {
+            log.error("error token userEntity");
+            throw new JwtAuthenticationException(5001, "User didn't existed!");
+        }
+
+        // 校验请求token是否跟redis token一致
+        String redisToken = redisTemplate.opsForValue().get(userEntity.getUserName());
+        if (!token.equals(redisToken)) {
+            log.error("error token redis");
+            throw new JwtAuthenticationException(5001, "token invalid");
+
+        }
+
+
+        if (! JwtUtil2.isVerify(token, username)) {
+            log.error("error token username or password");
+            throw new JwtAuthenticationException(5001, "token invalid");
+        }
+
+
+        return new SimpleAuthenticationInfo(token, token, "my_realm");
+    }
+}

+ 156 - 0
zhoushan-system-api/src/main/java/com/fdage/shiro/ShiroConfig.java

@@ -0,0 +1,156 @@
+package com.fdage.shiro;
+
+import com.alibaba.fastjson.serializer.SerializerFeature;
+import com.alibaba.fastjson.support.config.FastJsonConfig;
+import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter;
+import lombok.extern.log4j.Log4j2;
+import org.apache.shiro.mgt.DefaultSessionStorageEvaluator;
+import org.apache.shiro.mgt.DefaultSubjectDAO;
+import org.apache.shiro.spring.LifecycleBeanPostProcessor;
+import org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor;
+import org.apache.shiro.spring.web.ShiroFilterFactoryBean;
+import org.apache.shiro.web.mgt.DefaultWebSecurityManager;
+import org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator;
+import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.DependsOn;
+import org.springframework.http.MediaType;
+
+import javax.servlet.Filter;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Log4j2
+@Configuration
+public class ShiroConfig {
+
+    @Bean("securityManager")
+    public DefaultWebSecurityManager getManager(MyRealm realm) {
+        DefaultWebSecurityManager manager = new DefaultWebSecurityManager();
+        // 使用自己的realm
+        manager.setRealm(realm);
+
+        /*
+         * 关闭shiro自带的session,详情见文档
+         * http://shiro.apache.org/session-management.html#SessionManagement-StatelessApplications%28Sessionless%29
+         */
+        DefaultSubjectDAO subjectDAO = new DefaultSubjectDAO();
+        DefaultSessionStorageEvaluator defaultSessionStorageEvaluator = new DefaultSessionStorageEvaluator();
+        defaultSessionStorageEvaluator.setSessionStorageEnabled(false);
+        subjectDAO.setSessionStorageEvaluator(defaultSessionStorageEvaluator);
+        manager.setSubjectDAO(subjectDAO);
+
+        return manager;
+    }
+
+    @Bean("shiroFilter")
+    public ShiroFilterFactoryBean factory(DefaultWebSecurityManager securityManager) {
+        ShiroFilterFactoryBean factoryBean = new ShiroFilterFactoryBean();
+
+        // 添加自己的过滤器并且取名为jwt
+        Map<String, Filter> filterMap = new HashMap<>();
+        filterMap.put("jwt", new JWTFilter());
+
+        factoryBean.setFilters(filterMap);
+
+        factoryBean.setSecurityManager(securityManager);
+        factoryBean.setUnauthorizedUrl("/401");
+
+        /*
+         * 自定义url规则
+         * http://shiro.apache.org/web.html#urls-
+         */
+        Map<String, String> filterRuleMap = new HashMap<>();
+
+        // 不拦截
+        filterRuleMap.put("/login", "anon");
+        filterRuleMap.put("/logout", "anon");
+        filterRuleMap.put("/", "anon");
+
+
+        // swagger 不拦截
+        filterRuleMap.put("/swagger-resources/**", "anon");
+        filterRuleMap.put("/webjars/**", "anon");
+        filterRuleMap.put("/v2/**", "anon");
+        filterRuleMap.put("/doc.html/**", "anon");
+
+
+        // 所有请求通过我们自己的JWT Filter
+        filterRuleMap.put("/zhoushan/**", "jwt");
+
+
+        // 访问401和404页面不通过我们的Filter
+        filterRuleMap.put("/401", "anon");
+        factoryBean.setFilterChainDefinitionMap(filterRuleMap);
+        return factoryBean;
+    }
+
+    /**
+     * 下面的代码是添加注解支持
+     */
+    @Bean
+    @DependsOn("lifecycleBeanPostProcessor")
+    public DefaultAdvisorAutoProxyCreator defaultAdvisorAutoProxyCreator() {
+        DefaultAdvisorAutoProxyCreator defaultAdvisorAutoProxyCreator = new DefaultAdvisorAutoProxyCreator();
+        // 强制使用cglib,防止重复代理和可能引起代理出错的问题
+        // https://zhuanlan.zhihu.com/p/29161098
+        defaultAdvisorAutoProxyCreator.setProxyTargetClass(true);
+        return defaultAdvisorAutoProxyCreator;
+    }
+
+    @Bean
+    public LifecycleBeanPostProcessor lifecycleBeanPostProcessor() {
+        return new LifecycleBeanPostProcessor();
+    }
+
+    @Bean
+    public AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor(DefaultWebSecurityManager securityManager) {
+        AuthorizationAttributeSourceAdvisor advisor = new AuthorizationAttributeSourceAdvisor();
+        advisor.setSecurityManager(securityManager);
+        return advisor;
+    }
+
+
+    /**
+     * fastJson相关设置
+     * Dto包含json,需要配置不然会异常
+     * @return
+     */
+    @Bean
+    public HttpMessageConverters customConverters() {
+//        log.warn("run customConverters");
+
+
+        FastJsonHttpMessageConverter fastJson = new FastJsonHttpMessageConverter();
+
+        // 创建FastJson信息转换对象
+        FastJsonConfig fastJsonConfig = new FastJsonConfig();
+
+
+        // 设置全程返回时间
+        fastJsonConfig.setDateFormat("yyyy-MM-dd HH:mm:ss");
+        // 设置返回值为null是时输出,不写的话,null 字段 不返回。也可以设置返回空串
+        fastJsonConfig.setSerializerFeatures(SerializerFeature.WriteNullStringAsEmpty);
+        fastJson.setFastJsonConfig(fastJsonConfig);
+
+        //3、中文乱码解决方案
+        List<MediaType> mediaTypeList = new ArrayList<>();
+        mediaTypeList.add(MediaType.APPLICATION_JSON_UTF8);
+        mediaTypeList.add(MediaType.valueOf("text/html;charset=UTF-8"));
+
+
+        //4、将转换规则应用于转换对象
+        fastJson.setSupportedMediaTypes(mediaTypeList);
+
+
+        return new HttpMessageConverters(fastJson);
+    }
+
+
+
+
+
+}

+ 676 - 0
zhoushan-system-api/src/main/java/com/fdage/util/FileUtil.java

@@ -0,0 +1,676 @@
+package com.fdage.util;
+
+import com.alibaba.fastjson.JSONObject;
+import com.fdage.respon.ResponExhibition;
+import lombok.extern.slf4j.Slf4j;
+//import org.apache.commons.codec.digest.DigestUtils;
+//import org.apache.tools.zip.ZipEntry;
+//import org.apache.tools.zip.ZipFile;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.*;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.List;
+
+/**
+ * 文件管理工具类
+ * Created by Hb_zzZ on 2018/11/26.
+ */
+@Slf4j
+public class FileUtil {
+
+    /**
+     * 上传文件
+     * @param file 文件
+     * @param path 文件存放路径
+     * @param fileName 源文件名
+     * @return
+     */
+    public static boolean upload(MultipartFile file, String path, String fileName){
+
+        // 生成新的文件名
+        //String realPath = path + "/" + FileNameUtils.getFileName(fileName);
+
+        //使用原文件名
+        String realPath = path + "/" + fileName;
+
+        File dest = new File(realPath);
+
+        //判断文件父目录是否存在
+        if(!dest.getParentFile().exists()){
+            dest.getParentFile().mkdir();
+        }
+
+        try {
+            //保存文件
+            file.transferTo(dest);
+            return true;
+        } catch (IllegalStateException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+            return false;
+        } catch (IOException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+            return false;
+        }
+    }
+
+    public static void writeFile(String filePath,String str) throws IOException {
+        File fout = new File(filePath);
+        FileOutputStream fos = new FileOutputStream(fout);
+        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(fos));
+        bw.write(str);
+        bw.close();
+    }
+
+    //按行读文件
+    public static String readFile(String path)throws Exception
+    {
+        File f = new File(path);
+        if(!f.exists()){
+            return null;
+        }
+
+        ByteArrayOutputStream bos = new ByteArrayOutputStream((int)f.length());
+        BufferedInputStream in = null;
+        try{
+            in = new BufferedInputStream(new FileInputStream(f));
+            int buf_size = 1024;
+            byte[] buffer = new byte[buf_size];
+            int len = 0;
+            while(-1 != (len = in.read(buffer,0,buf_size))){
+                bos.write(buffer,0,len);
+            }
+            return bos.toString();
+        }catch (IOException e) {
+            e.printStackTrace();
+            throw e;
+        }finally{
+            try{
+                in.close();
+            }catch (IOException e) {
+                e.printStackTrace();
+            }
+            bos.close();
+        }
+    }
+
+    //按行读文件
+    public static int readLineCount(String path)throws Exception
+    {
+        File f = new File(path);
+        if(!f.exists()){
+            return 0;
+        }
+
+        int count = 0;
+        //BufferedReader是可以按行读取文件
+        FileInputStream inputStream = new FileInputStream(path);
+        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
+
+        String str = null;
+        while((str = bufferedReader.readLine()) != null)
+        {
+            if(str==null||str.trim().equals(""))
+            {
+                continue;
+            }
+            else
+            {
+                ++count;
+            }
+        }
+
+        //close
+        inputStream.close();
+        bufferedReader.close();
+
+        return count;
+    }
+
+    //按行读文件
+    public static List<String> readFileByLine(String path)throws Exception
+    {
+        File f = new File(path);
+        if(!f.exists()){
+            return null;
+        }
+
+        List<String> result = new ArrayList<String>();
+        //BufferedReader是可以按行读取文件
+        FileInputStream inputStream = new FileInputStream(path);
+        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
+
+        String str = null;
+        while((str = bufferedReader.readLine()) != null)
+        {
+            if(str==null||str.trim().equals(""))
+            {
+                continue;
+            }
+            else
+            {
+                result.add(str);
+            }
+        }
+
+        //close
+        inputStream.close();
+        bufferedReader.close();
+
+        return result;
+    }
+
+    public static void decodeBase64(String path,String str) throws Exception{
+        byte[] bt = null;
+        try {
+            sun.misc.BASE64Decoder decoder = new sun.misc.BASE64Decoder();
+
+            if(str.startsWith("data:image/png;base64,"))
+            {
+                bt = decoder.decodeBuffer( str.replace("data:image/png;base64,", "") );
+            }
+            else if(str.startsWith("data:image/jpeg;base64,"))
+            {
+                bt = decoder.decodeBuffer( str.replace("data:image/jpeg;base64,", "") );
+            }
+            else if(str.startsWith("data:image/bmp;base64,"))
+            {
+                bt = decoder.decodeBuffer( str.replace("data:image/bmp;base64,", "") );
+            }
+            else
+            {
+                log.error("FileUtil-decodeBase64:"+path);
+                return;
+            }
+
+            //bt = decoder.decodeBuffer(str);
+            writeBinary(bt,path);
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+    }
+
+    public static void writeBinary(byte[] buf,String filePath)throws Exception
+    {
+        File fout = new File(filePath);
+        if(!fout.getParentFile().exists())
+        {
+            fout.getParentFile().mkdirs();
+        }
+        FileOutputStream fos = new FileOutputStream(fout);
+        ByteArrayInputStream stream = new ByteArrayInputStream(buf);
+        BufferedOutputStream bos = new BufferedOutputStream(fos);//设置输出路径
+        BufferedInputStream bis = new BufferedInputStream(stream);
+        int b = -1;
+        while ((b = bis.read()) != -1) {
+            bos.write(b);
+        }
+        bis.close();
+        bos.close();
+    }
+
+    public static boolean deleteFile(String sPath) {
+
+        boolean flag = false;
+        File file = new File(sPath);
+        // 路径为文件且不为空则进行删除
+        if (file.isFile() && file.exists()) {
+            file.delete();
+            flag = true;
+        }
+        return flag;
+    }
+
+    //下载多个文件
+//    public static void downLoadFromUrls(String urlStr,String fileName,String savePath,String projectNum){
+//
+//        try
+//        {
+//            File file = new File(savePath+File.separator+fileName);
+//            if(file.exists())
+//            {
+//                List<String> list = readFileByLine(savePath+File.separator+fileName);
+//                for(int i=0;i<list.size();++i)
+//                {
+//                    String str = list.get(i);
+//                    String name = str.substring(str.lastIndexOf("/")+1);
+//                    downLoadFromUrl( str, name, savePath+File.separator+name, projectNum);
+//                }
+//            }
+//            else
+//            {
+//                downLoadFromUrl( urlStr, fileName, savePath, projectNum);
+//            }
+//        }
+//        catch(Exception e)
+//        {
+//            log.info("下载场景文件失败!"+projectNum+":"+urlStr);
+//            e.printStackTrace();
+//            StringWriter trace=new StringWriter();
+//            e.printStackTrace(new PrintWriter(trace));
+//            log.error(trace.toString());
+//            deleteFile(savePath+File.separator+fileName);
+//            downLoadFromUrls( urlStr, fileName, savePath, projectNum);
+//        }
+//    }
+
+//    public static void downLoadFromUrl(String urlStr,String fileName,String savePath,String projectNum){
+//        try
+//        {
+//            URL url = new URL(urlStr);
+//            HttpURLConnection conn = (HttpURLConnection)url.openConnection();
+//            //设置超时间为3秒
+//            conn.setConnectTimeout(3*1000);
+//            //防止屏蔽程序抓取而返回403错误
+//            conn.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)");
+//
+//            //得到输入流
+//            InputStream inputStream = conn.getInputStream();
+//            //获取自己数组
+//            byte[] getData = readInputStream(inputStream);
+//
+//            //文件保存位置
+//            File saveDir = new File(savePath);
+//            if(!saveDir.exists()){
+//                saveDir.mkdir();
+//            }
+//            File file = new File(saveDir+File.separator+fileName);
+//            FileOutputStream fos = new FileOutputStream(file);
+//            fos.write(getData);
+//
+//            //获取文件md5
+//            DigestUtils.md5Hex(new FileInputStream(saveDir+File.separator+fileName));
+//            if(fos!=null){
+//                fos.close();
+//            }
+//            if(inputStream!=null){
+//                inputStream.close();
+//            }
+//            log.info("下载场景文件成功!"+projectNum+":"+urlStr);
+//        }
+//        catch(FileNotFoundException e)
+//        {
+//            log.info("要下载场景的文件不存在"+projectNum+":"+urlStr);
+//        }
+//        catch(Exception e)
+//        {
+//            log.info("下载场景文件失败!"+projectNum+":"+urlStr);
+//            e.printStackTrace();
+//            StringWriter trace=new StringWriter();
+//            e.printStackTrace(new PrintWriter(trace));
+//            log.error(trace.toString());
+//            deleteFile(savePath+File.separator+fileName);
+//            downLoadFromUrl( urlStr, fileName, savePath, projectNum);
+//        }
+//    }
+
+    public static void downLoadFromUrl(String urlStr,String fileName,String savePath){
+        try
+        {
+            //文件保存位置
+            File saveDir = new File(savePath);
+            if(!saveDir.exists()){
+                saveDir.mkdir();
+            }
+            File file = new File(savePath+File.separator+fileName);
+            if(file.exists())
+            {
+                return;
+            }
+
+            URL url = new URL(urlStr);
+            HttpURLConnection conn = (HttpURLConnection)url.openConnection();
+            //设置超时间为3秒
+            conn.setConnectTimeout(3*1000);
+            //防止屏蔽程序抓取而返回403错误
+            conn.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)");
+
+            //得到输入流
+            InputStream inputStream = conn.getInputStream();
+            //获取自己数组
+            byte[] getData = readInputStream(inputStream);
+
+            FileOutputStream fos = new FileOutputStream(file);
+            fos.write(getData);
+            if(fos!=null){
+                fos.close();
+            }
+            if(inputStream!=null){
+                inputStream.close();
+            }
+            log.info("下载文件成功!"+":"+urlStr);
+        }
+        catch(FileNotFoundException e)
+        {
+            log.info("要下载的文件不存在:"+urlStr);
+        }
+        catch(Exception e)
+        {
+            log.info("下载文件失败!"+":"+urlStr);
+            e.printStackTrace();
+            StringWriter trace=new StringWriter();
+            e.printStackTrace(new PrintWriter(trace));
+            log.error(trace.toString());
+            deleteFile(savePath+File.separator+fileName);
+            downLoadFromUrl( urlStr, fileName, savePath);
+        }
+    }
+
+    public static byte[] readInputStream(InputStream inputStream) throws IOException {
+        byte[] buffer = new byte[1024];
+        int len = 0;
+        ByteArrayOutputStream bos = new ByteArrayOutputStream();
+        while((len = inputStream.read(buffer)) != -1) {
+            bos.write(buffer, 0, len);
+        }
+        bos.close();
+        return bos.toByteArray();
+    }
+
+//    public static void decompress(String srcPath, String dest) throws Exception {
+//
+//        File file = new File(srcPath);
+//
+//        if (!file.exists()) {
+//
+//            throw new RuntimeException(srcPath + "所指文件不存在");
+//
+//        }
+//
+//        ZipFile zf = new ZipFile(file);
+//
+//        Enumeration entries = zf.getEntries();
+//
+//        ZipEntry entry = null;
+//
+//        while (entries.hasMoreElements()) {
+//
+//            entry = (ZipEntry) entries.nextElement();
+//
+//            log.info("解压" + entry.getName());
+//
+//            if (entry.isDirectory()) {
+//
+//                String dirPath = dest + File.separator + entry.getName();
+//
+//                File dir = new File(dirPath);
+//
+//                dir.mkdirs();
+//
+//            } else {
+//
+//                // 表示文件
+//
+//                File f = new File(dest + File.separator + entry.getName());
+//
+//                if (!f.exists()) {
+//
+//                    //String dirs = FileUtils.getParentPath(f);
+//                    String dirs =  f.getParent();
+//
+//                    File parentDir = new File(dirs);
+//
+//                    parentDir.mkdirs();
+//
+//
+//
+//                }
+//
+//                f.createNewFile();
+//
+//                // 将压缩文件内容写入到这个文件中
+//
+//                InputStream is = zf.getInputStream(entry);
+//
+//                FileOutputStream fos = new FileOutputStream(f);
+//
+//
+//
+//                int count;
+//
+//                byte[] buf = new byte[8192];
+//
+//                while ((count = is.read(buf)) != -1) {
+//
+//                    fos.write(buf, 0, count);
+//
+//                }
+//
+//                is.close();
+//
+//                fos.close();
+//
+//            }
+//
+//        }
+//
+//    }
+
+    public static boolean copyFile(String srcFileName, String destFileName,  boolean overlay) {
+        File srcFile = new File(srcFileName);
+
+        // 判断源文件是否存在
+        if (!srcFile.exists()) {
+            return false;
+        } else if (!srcFile.isFile()) {
+            return false;
+        }
+
+        // 判断目标文件是否存在
+        File destFile = new File(destFileName);
+        if (destFile.exists()) {
+            // 如果目标文件存在并允许覆盖
+            if (overlay) {
+                // 删除已经存在的目标文件,无论目标文件是目录还是单个文件
+                new File(destFileName).delete();
+            }
+        } else {
+            // 如果目标文件所在目录不存在,则创建目录
+            if (!destFile.getParentFile().exists()) {
+                // 目标文件所在目录不存在
+                if (!destFile.getParentFile().mkdirs()) {
+                    // 复制文件失败:创建目标文件所在目录失败
+                    return false;
+                }
+            }
+        }
+
+        // 复制文件
+        int byteread = 0; // 读取的字节数
+        InputStream in = null;
+        OutputStream out = null;
+
+        try {
+            in = new FileInputStream(srcFile);
+            out = new FileOutputStream(destFile);
+            byte[] buffer = new byte[1024];
+
+            while ((byteread = in.read(buffer)) != -1) {
+                out.write(buffer, 0, byteread);
+            }
+            return true;
+        } catch (FileNotFoundException e) {
+            return false;
+        } catch (IOException e) {
+            return false;
+        } finally {
+            try {
+                if (out != null)
+                    out.close();
+                if (in != null)
+                    in.close();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+    }
+
+    public static String[]readfileNamesForDirectory(String path) throws Exception{
+        File file = new File(path);
+        if(file.isDirectory()) {
+            String[] fileNames = file.list();
+            return fileNames;
+        }
+        return null;
+    }
+
+    public static List<String> readfileNamesForDirectory(String path,String except) throws Exception{
+        File file = new File(path);
+        if(file.isDirectory())
+        {
+            String[] fileNames = file.list();
+            List<String> list = new ArrayList<String>();
+            if(fileNames!=null)
+            {
+                for(int i=0;i<fileNames.length;++i)
+                {
+                    if(fileNames[i].toLowerCase().endsWith(except) )
+                    {
+                        list.add(fileNames[i]);
+                    }
+                }
+            }
+
+            return list;
+        }
+        return null;
+    }
+
+    //删除文件夹
+    public static void delFolder(String folderPath) {
+        try {
+            delAllFile(folderPath); //删除完里面所有内容
+            String filePath = folderPath;
+            filePath = filePath.toString();
+            File myFilePath = new File(filePath);
+            myFilePath.delete(); //删除空文件夹
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    //删除指定文件夹下的所有文件
+    public static boolean delAllFile(String path) {
+        boolean flag = false;
+        File file = new File(path);
+        if (!file.exists()) {
+            return flag;
+        }
+        if (!file.isDirectory()) {
+            return flag;
+        }
+        String[] tempList = file.list();
+        File temp = null;
+        if(tempList!=null)
+        {
+            for (int i = 0; i < tempList.length; i++) {
+                if (path.endsWith(File.separator)) {
+                    temp = new File(path + tempList[i]);
+                } else {
+                    temp = new File(path + File.separator + tempList[i]);
+                }
+                if (temp.isFile()) {
+                    temp.delete();
+                }
+                if (temp.isDirectory()) {
+                    delAllFile(path + "/" + tempList[i]);//先删除文件夹里面的文件
+                    delFolder(path + "/" + tempList[i]);//再删除空文件夹
+                    flag = true;
+                }
+            }
+        }
+
+        //再删除当前空文件夹
+        file.delete();
+        return flag;
+    }
+
+    // 流转化成字符串
+    public static String inputStream2String(InputStream is) throws IOException
+    {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        int i = -1;
+        while ((i = is.read()) != -1)
+        {
+            baos.write(i);
+        }
+        return baos.toString();
+    }
+
+    // 流转化成文件
+    public static void inputStream2File(InputStream is, String savePath)throws Exception
+    {
+        log.info("来自app的录屏音频文件保存路径为:" + savePath);
+        File file = new File(savePath);
+        if(file.exists())
+        {
+            deleteFile(savePath);
+        }
+        InputStream inputSteam = is;
+        BufferedInputStream fis = new BufferedInputStream(inputSteam);
+        FileOutputStream fos = new FileOutputStream(file);
+        int f;
+        while ((f = fis.read()) != -1)
+        {
+            fos.write(f);
+        }
+        fos.flush();
+        fos.close();
+        fis.close();
+        inputSteam.close();
+    }
+
+    public static void saveImageToDisk(String accessToken, String mediaId, String picName, String picPath,InputStream inputStream)
+            throws Exception {
+        byte[] data = new byte[10240];
+        int len = 0;
+        FileOutputStream fileOutputStream = null;
+        try {
+            fileOutputStream = new FileOutputStream(picPath+picName+".amr");
+            while ((len = inputStream.read(data)) != -1) {
+                fileOutputStream.write(data, 0, len);
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+        } finally {
+            if (inputStream != null) {
+                try {
+                    inputStream.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+            if (fileOutputStream != null) {
+                try {
+                    fileOutputStream.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+    }
+
+    public static void main(String[] args) {
+        try{
+//            FileUtil.writeFile("G:\\java project\\test.json","{\"scenePsd\":\"\",\"public\":0,\"sceneType\":\"0\",\"sceneName\":\"1314家装互联网峰会\",\"shootCount\":\"40\",\"thumbImg\":0,\"floorLogo\":0,\"version\":1,\"hasBGM\":\"欢快\"}");
+//            File saveDir = new File("G:\\java project\\test.json");
+//            System.out.println("路径:" + saveDir);
+//            String parametr = "7sd:;szx";
+//            Integer resolution = new Integer(1);
+//            parametr += ":;" + (resolution == null ? 0 : resolution.intValue());
+            ResponExhibition responExhibition = new ResponExhibition();
+            responExhibition.setName("123asd");
+            JSONObject jsonObject = new JSONObject();
+            jsonObject.put("type", 0);
+            jsonObject.put("data", responExhibition);
+            System.out.println(jsonObject.toJSONString());
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+    }
+}

+ 39 - 0
zhoushan-system-api/src/main/java/com/fdage/util/VerifyCodeUtil.java

@@ -0,0 +1,39 @@
+package com.fdage.util;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+import java.time.LocalDateTime;
+import java.time.ZoneId;
+
+/**
+ * Created by Hb_zzZ on 2019/4/29.
+ */
+public class VerifyCodeUtil {
+
+    public static String validImage(HttpServletRequest request, HttpSession session) {
+        String code = request.getParameter("code");
+        Object verCode = session.getAttribute("verCode");
+        if (null == verCode) {
+            request.setAttribute("errmsg", "验证码已失效,请重新输入");
+            return "-1";
+//            return "验证码已失效,请重新输入";
+        }
+        String verCodeStr = verCode.toString();
+        LocalDateTime localDateTime = (LocalDateTime) session.getAttribute("codeTime");
+        long past = localDateTime.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli();
+        long now = LocalDateTime.now().atZone(ZoneId.systemDefault()).toInstant().toEpochMilli();
+        if (verCodeStr == null || code == null || code.isEmpty() || !verCodeStr.equalsIgnoreCase(code)) {
+            request.setAttribute("errmsg", "验证码错误");
+            return "-2";
+//            return "验证码错误";
+        } else if ((now - past) / 1000 / 60 > 5) {
+            request.setAttribute("errmsg", "验证码已过期,重新获取");
+            return "-3";
+//            return "验证码已过期,重新获取";
+        } else {
+            //验证成功,删除存储的验证码
+            session.removeAttribute("verCode");
+            return "200";
+        }
+    }
+}

+ 66 - 0
zhoushan-system-api/src/main/resources/application.yml

@@ -0,0 +1,66 @@
+
+spring:
+  jmx:
+    default-domain: zhoushan_system
+    enabled: false
+  application:
+    name: zhoushan_system
+  servlet:
+    multipart:
+      maxFileSize: 1000MB
+      maxRequestSize: 1000MB
+  datasource:
+#    url: jdbc:mysql://120.24.64.23:3306/zhoushan_system?useSSL=false&useUnicode=true&characterEncoding=utf-8&autoReconnect=true
+#    username: root
+#    password: 4dagecui2019
+    url: jdbc:mysql://127.0.0.1:3306/zhoushan_system?useSSL=false&useUnicode=true&characterEncoding=utf-8&autoReconnect=true
+    username: root
+    password: 123456
+    driver-class-name: com.mysql.jdbc.Driver
+# Redis数据库索引(默认为0)
+  redis:
+    database: 0
+    host: 127.0.0.1
+    port: 6379
+    password:
+# 连接超时时间 单位 ms(毫秒)
+    timeout: 3000ms
+# 连接池中的最大空闲连接,默认值也是8。
+    jedis:
+      pool:
+        max-idle: 8
+#连接池中的最小空闲连接,默认值也是0。
+        min-idle: 0
+# 如果赋值为-1,则表示不限制;如果pool已经分配了maxActive个jedis实例,则此时pool的状态为exhausted(耗尽)。
+        max-active: 8
+# 等待可用连接的最大时间,单位毫秒,默认值为-1,表示永不超时。如果超过等待时间,则直接抛出JedisConnectionException
+        max-wait: -1ms
+
+server:
+  port: 8100
+
+mybatis:
+  mapperLocations: classpath*:mapper/*/*.xml
+  typeAliasesPackage: com.fdage.pojo
+
+logging:
+  level:
+    com:
+      fdage:
+        dao: debug
+
+pagehelper:
+  helperDialect: mysql
+  reasonable: true
+  supportMethodsArguments: true
+  params: count=countSql
+
+
+upload:
+  head: G:\javaProject\zhoushan-system\zhoushan-system-api\src\main\resources\static\head
+  information: G:\javaProject\zhoushan-system\zhoushan-system-api\src\main\resources\static\information
+  collection: G:\javaProject\zhoushan-system\zhoushan-system-api\src\main\resources\static\collection
+  exhibition: G:\javaProject\zhoushan-system\zhoushan-system-api\src\main\resources\static\exhibition
+
+
+

BIN=BIN
zhoushan-system-api/src/main/resources/static/collection/importData.xlsx


BIN=BIN
zhoushan-system-api/src/main/resources/static/exhibition/1596186417162_blob


BIN=BIN
zhoushan-system-api/src/main/resources/static/exhibition/1596189084442_blob


BIN=BIN
zhoushan-system-api/src/main/resources/static/exhibition/1596189140546_blob


BIN=BIN
zhoushan-system-api/src/main/resources/static/exhibition/1596189564593_blob


BIN=BIN
zhoushan-system-api/src/main/resources/static/exhibition/1596189869919_blob


BIN=BIN
zhoushan-system-api/src/main/resources/static/exhibition/1596190721836_6.png


BIN=BIN
zhoushan-system-api/src/main/resources/static/exhibition/1596190788080_2_compressed.jpg


BIN=BIN
zhoushan-system-api/src/main/resources/static/exhibition/1596190825036_6.png


BIN=BIN
zhoushan-system-api/src/main/resources/static/exhibition/1596190848270_6.png


BIN=BIN
zhoushan-system-api/src/main/resources/static/exhibition/1596190887905_6.png


BIN=BIN
zhoushan-system-api/src/main/resources/static/exhibition/1596190919878_72578776_13.jpg


BIN=BIN
zhoushan-system-api/src/main/resources/static/exhibition/1596191321390_6.png


BIN=BIN
zhoushan-system-api/src/main/resources/static/exhibition/1596447050697_1_compressed.jpg


BIN=BIN
zhoushan-system-api/src/main/resources/static/exhibition/1596447392511_72578776_13.jpg


BIN=BIN
zhoushan-system-api/src/main/resources/static/exhibition/1596447392511_72578776_14.jpg


BIN=BIN
zhoushan-system-api/src/main/resources/static/exhibition/1596447392511_72578776_18.jpg


BIN=BIN
zhoushan-system-api/src/main/resources/static/exhibition/1596447392516_72578776_22.jpg


BIN=BIN
zhoushan-system-api/src/main/resources/static/exhibition/1596447643716_72578776_13.jpg


BIN=BIN
zhoushan-system-api/src/main/resources/static/exhibition/1596447972662_2_compressed.jpg


BIN=BIN
zhoushan-system-api/src/main/resources/static/exhibition/1596448196988_6.png


BIN=BIN
zhoushan-system-api/src/main/resources/static/exhibition/1596448574587_1_compressed.jpg


BIN=BIN
zhoushan-system-api/src/main/resources/static/exhibition/1596448574587_2.png


BIN=BIN
zhoushan-system-api/src/main/resources/static/exhibition/1596448574587_2_compressed.jpg


BIN=BIN
zhoushan-system-api/src/main/resources/static/exhibition/1596448574587_6.png


BIN=BIN
zhoushan-system-api/src/main/resources/static/exhibition/1596448575033_7.png


BIN=BIN
zhoushan-system-api/src/main/resources/static/exhibition/1596448575155_1.png


BIN=BIN
zhoushan-system-api/src/main/resources/static/exhibition/1596448575323_baoli.png


BIN=BIN
zhoushan-system-api/src/main/resources/static/exhibition/1596449245116_2.png


BIN=BIN
zhoushan-system-api/src/main/resources/static/exhibition/1596449245116_6.png


BIN=BIN
zhoushan-system-api/src/main/resources/static/exhibition/1596449607618_1422.png


BIN=BIN
zhoushan-system-api/src/main/resources/static/exhibition/1596449725286_1422.png


BIN=BIN
zhoushan-system-api/src/main/resources/static/exhibition/1596450062428_1422.png


BIN=BIN
zhoushan-system-api/src/main/resources/static/head/1568800765341_timg (1).jpg


BIN=BIN
zhoushan-system-api/src/main/resources/static/head/1568801143326_timg.jpg


BIN=BIN
zhoushan-system-api/src/main/resources/static/head/1568801751741_timg.jpg


BIN=BIN
zhoushan-system-api/src/main/resources/static/head/1568801890654_timg (1).jpg


BIN=BIN
zhoushan-system-api/src/main/resources/static/head/1569382213805_2016-08-01_10_33_43.mp4


BIN=BIN
zhoushan-system-api/src/main/resources/static/head/1569383057144_20190924141422.h264


BIN=BIN
zhoushan-system-api/src/main/resources/static/head/1596440670606_72578776_13.jpg


BIN=BIN
zhoushan-system-api/src/main/resources/static/head/1596440976130_app-icon.png


BIN=BIN
zhoushan-system-api/src/main/resources/static/head/test.h264


+ 123 - 0
zhoushan-system-api/src/main/resources/static/index.html

@@ -0,0 +1,123 @@
+<!DOCTYPE html>
+<!--<html>-->
+<!--<head>-->
+	<!--<title>数据库管理系统-应用列表</title>-->
+	<!--<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">-->
+	<!--<link rel="stylesheet" type="text/css" href="./static/css/index.css">-->
+<!--</head>-->
+<!--<body>-->
+	<!--<div class="open">-->
+		<!--<div id="nav">-->
+			<!--<ul>-->
+				<!--<li>-->
+					<!--<div>-->
+						<!--<img src="./static/img/application.png" alt="应用">-->
+						<!--<p>应用</p>-->
+					<!--</div>-->
+				<!--</li>-->
+			<!--</ul>-->
+		<!--</div>-->
+		<!--<div id="main">-->
+			<!--<div class="main-top">-->
+				<!--<button class="btn-create"> + 创建应用 </button>-->
+				<!--<div class="user-msg">-->
+					<!--<img src="./static/img/people_fill.png">-->
+					<!--<p id="name"></p>-->
+					<!--<p id="logout">登出</p>-->
+				<!--</div>-->
+			<!--</div>-->
+			<!--<div class="main-middle"></div>-->
+		<!--</div>-->
+	<!--</div>-->
+	<!--<div class="modal">-->
+		<!--<div class="modal-content">-->
+			<!--<div class="modal-header">-->
+				<!--<h4>创建应用</h4>-->
+				<!--<button class="btn-close">×</button>-->
+			<!--</div>-->
+			<!--<div>-->
+				<!--<div class="modal-body">-->
+					<!--<div class="form-group">-->
+						<!--<label>应用名称:</label>-->
+						<!--<input id="app-name" type="text" class="formControl" placeholder="必填"/>-->
+						<!--<span class="error"></span>-->
+					<!--</div>-->
+				<!--</div>-->
+			<!--</div>-->
+			<!--<div class="modal-footer">-->
+				<!--<button class="button btn-close" type="button">关闭</button>-->
+				<!--<button id="btn" class="submit" type="submit">创建应用</button>-->
+			<!--</div>-->
+		<!--</div>-->
+	<!--</div>-->
+	<!--<div id="hide"></div>-->
+	<!--<script src="./static/js/jquery-3.3.1.min.js"></script>-->
+	<!--<script src="./layer/layer.js"></script>-->
+	<!--<script src="./static/js/index.js"></script>-->
+<!--</body>-->
+<!--</html>-->
+
+
+<html lang="en">
+<head>
+	<title>Server-Sent Events Demo</title>
+	<meta charset="UTF-8" />
+	<script>
+		window.addEventListener("load", function() {
+			var button = document.getElementById("connect");
+			var status = document.getElementById("status");
+			var output = document.getElementById("output");
+			var connectTime = document.getElementById("connecttime");
+			var source;
+
+			function connect() {
+				source = new EventSource("http://192.168.0.207:8100/sendMessage"); //连接的Api
+				source.addEventListener("message", function(event) {
+					output.textContent = event.data;
+					//这是回调的信息
+
+				}, false);
+
+				source.addEventListener("connecttime", function(event) {
+					connectTime.textContent = "Connection was last established at: " + event.data;
+				}, false);
+
+				source.addEventListener("open", function(event) {
+					button.value = "Disconnect";
+					button.onclick = function(event) {
+						source.close();
+						button.value = "Connect";
+						button.onclick = connect;
+						status.textContent = "Connection closed!";
+					};
+					status.textContent = "Connection open!";
+				}, false);
+
+				source.addEventListener("error", function(event) {
+					if (event.target.readyState === EventSource.CLOSED) {
+						source.close();
+						status.textContent = "Connection closed!";
+					} else if (event.target.readyState === EventSource.CONNECTING) {
+						status.textContent = "Connection closed. Attempting to reconnect!";
+					} else {
+						status.textContent = "Connection closed. Unknown error!";
+					}
+				}, false);
+			}
+
+			if (!!window.EventSource) {
+				connect();
+			} else {
+				button.style.display = "none";
+				status.textContent = "浏览器不支持-请用现代浏览器";  //通常是IE浏览器不支持
+			}
+		}, false);
+	</script>
+</head>
+<body>
+<input type="button" id="connect" value="Connect" /><br />
+<span id="status">Connection closed!</span><br />
+<span id="connecttime"></span><br />
+<span id="output"></span>
+</body>
+</html>

BIN=BIN
zhoushan-system-api/src/main/resources/static/information/1568776657385_timg (1).jpg


BIN=BIN
zhoushan-system-api/src/main/resources/static/information/1568776834246_timg (1).jpg


BIN=BIN
zhoushan-system-api/src/main/resources/static/information/1568776847364_timg (1).jpg


BIN=BIN
zhoushan-system-api/src/main/resources/static/information/1568776868001_timg.jpg


BIN=BIN
zhoushan-system-api/src/main/resources/static/information/1568777449690_timg (1).jpg


BIN=BIN
zhoushan-system-api/src/main/resources/static/information/1568778077444_微信图片_20190830113544.jpg


BIN=BIN
zhoushan-system-api/src/main/resources/static/information/1568778144730_timg.jpg


BIN=BIN
zhoushan-system-api/src/main/resources/static/information/1568778265057_timg.jpg


+ 16 - 0
zhoushan-system-api/src/test/java/com/fdage/VirtualHouseApiApplicationTests.java

@@ -0,0 +1,16 @@
+package com.fdage;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest
+public class VirtualHouseApiApplicationTests {
+
+	@Test
+	public void contextLoads() {
+	}
+
+}

+ 162 - 0
zhoushan-system-api/zhoushan-system-api.iml

@@ -0,0 +1,162 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
+  <component name="FacetManager">
+    <facet type="web" name="Web">
+      <configuration>
+        <webroots>
+          <root url="file://$MODULE_DIR$/src/main/webapp" relative="/" />
+        </webroots>
+        <sourceRoots>
+          <root url="file://$MODULE_DIR$/src/main/java" />
+          <root url="file://$MODULE_DIR$/src/main/resources" />
+        </sourceRoots>
+      </configuration>
+    </facet>
+  </component>
+  <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit-compiler-output="false">
+    <output url="file://$MODULE_DIR$/target/classes" />
+    <output-test url="file://$MODULE_DIR$/target/test-classes" />
+    <content url="file://$MODULE_DIR$">
+      <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
+      <excludeFolder url="file://$MODULE_DIR$/target" />
+    </content>
+    <orderEntry type="inheritedJdk" />
+    <orderEntry type="sourceFolder" forTests="false" />
+    <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-web:2.0.7.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:2.0.7.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:2.0.7.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-core:5.0.11.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-context:5.0.11.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:2.0.7.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-logging:2.0.7.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: ch.qos.logback:logback-classic:1.2.3" level="project" />
+    <orderEntry type="library" name="Maven: ch.qos.logback:logback-core:1.2.3" level="project" />
+    <orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-to-slf4j:2.10.0" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.10.0" level="project" />
+    <orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.25" level="project" />
+    <orderEntry type="library" name="Maven: javax.annotation:javax.annotation-api:1.3.2" level="project" />
+    <orderEntry type="library" scope="RUNTIME" name="Maven: org.yaml:snakeyaml:1.19" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-json:2.0.7.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-web:5.0.11.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.9.7" level="project" />
+    <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.9.0" level="project" />
+    <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.9.7" level="project" />
+    <orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.9.7" level="project" />
+    <orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.9.7" level="project" />
+    <orderEntry type="library" name="Maven: com.fasterxml.jackson.module:jackson-module-parameter-names:2.9.7" level="project" />
+    <orderEntry type="library" scope="PROVIDED" name="Maven: org.springframework.boot:spring-boot-starter-tomcat:2.0.7.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.hibernate.validator:hibernate-validator:6.0.13.Final" level="project" />
+    <orderEntry type="library" name="Maven: javax.validation:validation-api:2.0.1.Final" level="project" />
+    <orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging:3.3.2.Final" level="project" />
+    <orderEntry type="library" name="Maven: com.fasterxml:classmate:1.3.4" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-beans:5.0.11.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-webmvc:5.0.11.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-aop:5.0.11.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-expression:5.0.11.RELEASE" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-starter-test:2.0.7.RELEASE" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-test:2.0.7.RELEASE" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-test-autoconfigure:2.0.7.RELEASE" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: com.jayway.jsonpath:json-path:2.4.0" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: net.minidev:json-smart:2.3" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: net.minidev:accessors-smart:1.2" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: org.ow2.asm:asm:5.0.4" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.12" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: org.assertj:assertj-core:3.9.1" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: org.mockito:mockito-core:2.15.0" level="project" />
+    <orderEntry type="library" name="Maven: net.bytebuddy:byte-buddy:1.7.11" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: net.bytebuddy:byte-buddy-agent:1.7.11" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: org.objenesis:objenesis:2.6" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-library:1.3" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: org.skyscreamer:jsonassert:1.5.0" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: com.vaadin.external.google:android-json:0.0.20131108.vaadin1" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.0.11.RELEASE" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: org.springframework:spring-test:5.0.11.RELEASE" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: org.xmlunit:xmlunit-core:2.5.1" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-actuator:2.0.7.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-actuator-autoconfigure:2.0.7.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-actuator:2.0.7.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: io.micrometer:micrometer-core:1.0.8" level="project" />
+    <orderEntry type="library" name="Maven: org.hdrhistogram:HdrHistogram:2.1.10" level="project" />
+    <orderEntry type="library" name="Maven: org.latencyutils:LatencyUtils:2.0.3" level="project" />
+    <orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.tomcat.embed:tomcat-embed-core:8.5.35" level="project" />
+    <orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.tomcat.embed:tomcat-embed-el:8.5.35" level="project" />
+    <orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.tomcat.embed:tomcat-embed-websocket:8.5.35" level="project" />
+    <orderEntry type="module" module-name="zhoushan-system-service" />
+    <orderEntry type="module" module-name="zhoushan-system-dao" />
+    <orderEntry type="module" module-name="zhoushan-system-common" />
+    <orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-starter:1.3.1" level="project" />
+    <orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-starter:1.2.3" level="project" />
+    <orderEntry type="library" name="Maven: com.alibaba:fastjson:1.2.45" level="project" />
+    <orderEntry type="library" name="Maven: com.alibaba:druid:1.1.12" level="project" />
+    <orderEntry type="library" name="Maven: mysql:mysql-connector-java:5.1.47" level="project" />
+    <orderEntry type="library" name="Maven: io.jsonwebtoken:jjwt:0.9.1" level="project" />
+    <orderEntry type="library" name="Maven: org.projectlombok:lombok:1.16.22" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.7" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-data-redis:2.0.7.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework.data:spring-data-redis:2.0.12.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework.data:spring-data-keyvalue:2.0.12.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework.data:spring-data-commons:2.0.12.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-tx:5.0.11.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-oxm:5.0.11.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-context-support:5.0.11.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: redis.clients:jedis:2.9.0" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.commons:commons-pool2:2.5.0" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.shiro:shiro-spring:1.4.0" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.shiro:shiro-core:1.4.0" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.shiro:shiro-lang:1.4.0" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.shiro:shiro-cache:1.4.0" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.shiro:shiro-crypto-hash:1.4.0" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.shiro:shiro-crypto-core:1.4.0" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.shiro:shiro-crypto-cipher:1.4.0" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.shiro:shiro-config-core:1.4.0" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.shiro:shiro-config-ogdl:1.4.0" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.shiro:shiro-event:1.4.0" level="project" />
+    <orderEntry type="library" name="Maven: commons-beanutils:commons-beanutils:1.9.3" level="project" />
+    <orderEntry type="library" name="Maven: commons-collections:commons-collections:3.2.2" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.shiro:shiro-web:1.4.0" level="project" />
+    <orderEntry type="library" name="Maven: com.auth0:java-jwt:3.2.0" level="project" />
+    <orderEntry type="library" name="Maven: commons-codec:commons-codec:1.11" level="project" />
+    <orderEntry type="library" name="Maven: org.bouncycastle:bcprov-jdk15on:1.55" level="project" />
+    <orderEntry type="library" name="Maven: com.github.xiaoymin:knife4j-spring-boot-starter:2.0.2" level="project" />
+    <orderEntry type="library" name="Maven: com.github.xiaoymin:knife4j-spring-boot-autoconfigure:2.0.2" level="project" />
+    <orderEntry type="library" name="Maven: com.github.xiaoymin:knife4j-spring:2.0.2" level="project" />
+    <orderEntry type="library" name="Maven: com.github.xiaoymin:knife4j-annotations:2.0.2" level="project" />
+    <orderEntry type="library" name="Maven: com.github.xiaoymin:knife4j-core:2.0.2" level="project" />
+    <orderEntry type="library" name="Maven: org.javassist:javassist:3.25.0-GA" level="project" />
+    <orderEntry type="library" name="Maven: io.swagger:swagger-models:1.5.22" level="project" />
+    <orderEntry type="library" name="Maven: io.swagger:swagger-annotations:1.5.22" level="project" />
+    <orderEntry type="library" name="Maven: io.springfox:springfox-swagger2:2.9.2" level="project" />
+    <orderEntry type="library" name="Maven: io.springfox:springfox-spi:2.9.2" level="project" />
+    <orderEntry type="library" name="Maven: io.springfox:springfox-core:2.9.2" level="project" />
+    <orderEntry type="library" name="Maven: com.google.guava:guava:20.0" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework.plugin:spring-plugin-core:1.2.0.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework.plugin:spring-plugin-metadata:1.2.0.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: io.springfox:springfox-schema:2.9.2" level="project" />
+    <orderEntry type="library" name="Maven: io.springfox:springfox-swagger-common:2.9.2" level="project" />
+    <orderEntry type="library" name="Maven: io.springfox:springfox-spring-web:2.9.2" level="project" />
+    <orderEntry type="library" name="Maven: org.mapstruct:mapstruct:1.2.0.Final" level="project" />
+    <orderEntry type="library" name="Maven: io.springfox:springfox-bean-validators:2.9.2" level="project" />
+    <orderEntry type="library" name="Maven: com.github.xiaoymin:knife4j-spring-ui:2.0.2" level="project" />
+    <orderEntry type="library" name="Maven: org.aspectj:aspectjweaver:1.8.13" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.poi:poi:3.8" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.poi:poi-ooxml:3.8" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.poi:poi-ooxml-schemas:3.8" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.xmlbeans:xmlbeans:2.3.0" level="project" />
+    <orderEntry type="library" name="Maven: stax:stax-api:1.0.1" level="project" />
+    <orderEntry type="library" name="Maven: dom4j:dom4j:1.6.1" level="project" />
+    <orderEntry type="library" name="Maven: xml-apis:xml-apis:1.4.01" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-jdbc:2.0.7.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: com.zaxxer:HikariCP:2.7.9" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-jdbc:5.0.11.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-autoconfigure:1.3.1" level="project" />
+    <orderEntry type="library" name="Maven: org.mybatis:mybatis:3.4.5" level="project" />
+    <orderEntry type="library" name="Maven: org.mybatis:mybatis-spring:1.3.1" level="project" />
+    <orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-autoconfigure:1.2.3" level="project" />
+    <orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper:5.1.2" level="project" />
+    <orderEntry type="library" name="Maven: com.github.jsqlparser:jsqlparser:1.0" level="project" />
+  </component>
+</module>

+ 162 - 0
zhoushan-system-common/pom.xml

@@ -0,0 +1,162 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-starter-parent</artifactId>
+        <version>2.0.7.RELEASE</version>
+        <relativePath/> <!-- lookup parent from repository -->
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <groupId>com.fdage</groupId>
+    <version>0.0.1-SNAPSHOT</version>
+    <artifactId>zhoushan-system-common</artifactId>
+    <packaging>jar</packaging>
+    <name>zhoushan-system-common</name>
+    <description>Demo project for Spring Boot</description>
+
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+        <java.version>1.8</java.version>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-actuator</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-test</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>fastjson</artifactId>
+            <version>1.2.45</version>
+        </dependency>
+
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>druid</artifactId>
+            <version>1.1.12</version>
+        </dependency>
+
+        <dependency>
+            <groupId>mysql</groupId>
+            <artifactId>mysql-connector-java</artifactId>
+            <version>5.1.41</version>
+        </dependency>
+
+        <dependency>
+            <groupId>io.jsonwebtoken</groupId>
+            <artifactId>jjwt</artifactId>
+            <version>0.9.1</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.projectlombok</groupId>
+            <artifactId>lombok</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-lang3</artifactId>
+            <version>3.4</version>
+        </dependency>
+
+        <!-- Spring Boot Redis依赖 -->
+        <!-- 注意:1.5版本的依赖和2.0的依赖不一样,注意看哦 1.5我记得名字里面应该没有“data”, 2.0必须是“spring-boot-starter-data-redis” 这个才行-->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-data-redis</artifactId>
+            <!-- 1.5的版本默认采用的连接池技术是jedis  2.0以上版本默认连接池是lettuce, 在这里采用jedis,所以需要排除lettuce的jar -->
+            <exclusions>
+                <exclusion>
+                    <groupId>redis.clients</groupId>
+                    <artifactId>jedis</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>io.lettuce</groupId>
+                    <artifactId>lettuce-core</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+
+        <!-- 添加jedis客户端 -->
+        <dependency>
+            <groupId>redis.clients</groupId>
+            <artifactId>jedis</artifactId>
+        </dependency>
+
+        <!--spring2.0集成redis所需common-pool2-->
+        <!-- 必须加上,jedis依赖此  -->
+        <!-- spring boot 2.0 的操作手册有标注 大家可以去看看 地址是:https://docs.spring.io/spring-boot/docs/2.0.3.RELEASE/reference/htmlsingle/-->
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-pool2</artifactId>
+            <version>2.5.0</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.projectlombok</groupId>
+            <artifactId>lombok</artifactId>
+        </dependency>
+
+        <!-- shiro -->
+        <dependency>
+            <groupId>org.apache.shiro</groupId>
+            <artifactId>shiro-spring</artifactId>
+            <version>1.4.0</version>
+        </dependency>
+
+        <!-- jwt -->
+        <dependency>
+            <groupId>com.auth0</groupId>
+            <artifactId>java-jwt</artifactId>
+            <version>3.2.0</version>
+        </dependency>
+
+        <dependency>
+            <groupId>com.github.xiaoymin</groupId>
+            <artifactId>knife4j-spring-boot-starter</artifactId>
+            <version>2.0.2</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.aspectj</groupId>
+            <artifactId>aspectjweaver</artifactId>
+            <version>1.9.3</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.poi</groupId>
+            <artifactId>poi</artifactId>
+            <version>3.8</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.poi</groupId>
+            <artifactId>poi-ooxml</artifactId>
+            <version>3.8</version>
+        </dependency>
+
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+                <configuration>
+                    <skip>true</skip>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>

+ 12 - 0
zhoushan-system-common/src/main/java/com/fdage/config/CommonConf.java

@@ -0,0 +1,12 @@
+package com.fdage.config;
+
+/**
+ * Created by Hb_zzZ on 2019/4/29.
+ */
+public class CommonConf {
+
+    /**
+     * redis 相关
+     */
+    public static final String REDIS_LOGIN_TOKEN = "ZHOUSHAN.HOSE.TOKEN.";               //redis新增token
+}

+ 9 - 0
zhoushan-system-common/src/main/java/com/fdage/constant/ConstantExcel.java

@@ -0,0 +1,9 @@
+package com.fdage.constant;
+
+/**
+ * Created by Hb_zzZ on 2020/9/14.
+ */
+public class ConstantExcel {
+
+    public static final String[] COLLECTION_NAME = {"序号","文物名称","文物类别","文物年代","点赞数","下载数","搜索数"};
+}

+ 13 - 0
zhoushan-system-common/src/main/java/com/fdage/constant/ConstantUrl.java

@@ -0,0 +1,13 @@
+package com.fdage.constant;
+
+/**
+ * Created by Hb_zzZ on 2019/9/11.
+ */
+public class ConstantUrl {
+
+//    public static final String MAIN_URL = "http://127.0.0.1:8100/";
+
+    public static final String MAIN_URL = "http://119.23.129.199:8100/";
+
+    public static final String FDMODEL_PIC = "http://model3d.4dage.com/model/";
+}

+ 51 - 0
zhoushan-system-common/src/main/java/com/fdage/dto/ResourceTree.java

@@ -0,0 +1,51 @@
+package com.fdage.dto;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class ResourceTree {
+
+    private Long id;
+
+    private String name;
+
+    private Long parentId;
+
+    @JSONField(serialize = false)
+    private boolean checked = false;
+
+    @JSONField(serialize = false)
+    private boolean spread = false;
+
+    @JSONField(serialize = false)
+    private String isHeader = "0";
+
+    @JSONField(serialize = false)
+    private String url;
+
+    @JSONField(serialize = false)
+    private String icon;
+
+    @JSONField(serialize = false)
+    private String resourceKey;
+
+    @JSONField(serialize = false)
+    private String resourceType;
+
+    @JSONField(serialize = false)
+    private String order = "1";
+
+    // 子菜单/或按钮
+    private List<ResourceTree> children;
+
+    @JSONField(serialize = false)
+    private int level;
+
+    // 默认都没有权限
+    private boolean authority ;
+
+
+}

+ 30 - 0
zhoushan-system-common/src/main/java/com/fdage/enums/ResponEnum.java

@@ -0,0 +1,30 @@
+package com.fdage.enums;
+
+/**
+ * Created by Hb_zzZ on 2019/9/11.
+ */
+public enum ResponEnum {
+
+    NOT_NULL(3001, "参数不能为空"),
+    USER_NOT_EXIST(3002, "用户不存在"),
+    PASSWORD_ERROR(3003, "密码错误"),
+    USER_EXIST(3004, "用户已存在"),
+    PASSWORD_INCONSISTENCY(3005, "两次密码不一致"),
+    USER_STOP_USING(3006, "用户已停用");
+
+    private final int code;
+    private final String message;
+
+    ResponEnum(int code, String message) {
+        this.code = code;
+        this.message = message;
+    }
+
+    public String getMessage() {
+        return this.message;
+    }
+
+    public int getCode() {
+        return this.code;
+    }
+}

+ 28 - 0
zhoushan-system-common/src/main/java/com/fdage/enums/TypeEnum.java

@@ -0,0 +1,28 @@
+package com.fdage.enums;
+
+/**
+ * Created by Hb_zzZ on 2019/5/5.
+ */
+public enum  TypeEnum {
+
+    STRING(0, "字符串"),
+    NUM(1, "数字"),
+    DATA(2, "日期"),
+    FILE(3, "文件");
+
+    private final int code;
+    private final String message;
+
+    private TypeEnum(int code, String message) {
+        this.code = code;
+        this.message = message;
+    }
+
+    public String getMessage() {
+        return this.message;
+    }
+
+    public int getCode() {
+        return this.code;
+    }
+}

+ 15 - 0
zhoushan-system-common/src/main/java/com/fdage/request/RequestBase.java

@@ -0,0 +1,15 @@
+package com.fdage.request;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+public class RequestBase implements Serializable {
+
+    private int pageNum;
+
+    private int pageSize;
+
+    private int start;
+}

+ 42 - 0
zhoushan-system-common/src/main/java/com/fdage/request/RequestCollection.java

@@ -0,0 +1,42 @@
+package com.fdage.request;
+
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * Created by Hb_zzZ on 2019/9/11.
+ */
+@Data
+public class RequestCollection extends RequestBase{
+
+    private Long id;
+
+    private String name;
+
+    private Long typeId;
+
+    private Long timeId;
+
+    private Date discoveryTime;
+
+    private Date repairTime;
+
+    private String venue;
+
+    private String modelUrl;
+
+    private String contentUrl;
+
+    private Integer state;
+
+    private String description;
+
+    private String pic;
+
+    private String num;
+
+    private String unityPic;
+
+    private String unityUrl;
+}

+ 20 - 0
zhoushan-system-common/src/main/java/com/fdage/request/RequestEquipment.java

@@ -0,0 +1,20 @@
+package com.fdage.request;
+
+import lombok.Data;
+
+/**
+ * Created by Hb_zzZ on 2019/9/11.
+ */
+@Data
+public class RequestEquipment extends RequestBase{
+
+    private Long id;
+
+    private String name;
+
+    private String uuid;
+
+    private Long positionId;
+
+    private Integer state;
+}

+ 32 - 0
zhoushan-system-common/src/main/java/com/fdage/request/RequestExhibition.java

@@ -0,0 +1,32 @@
+package com.fdage.request;
+
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * Created by Hb_zzZ on 2019/9/12.
+ */
+@Data
+public class RequestExhibition extends RequestBase{
+
+    private Long id;
+
+    private String name;
+
+    private Long typeId;
+
+    private Long equipmentId;
+
+    private Integer state;
+
+    private String description;
+
+    private Long exhibitionId;
+
+    private String collectionId;
+
+    private Integer isSend;
+
+    private String webUrl;
+}

+ 32 - 0
zhoushan-system-common/src/main/java/com/fdage/request/RequestInformation.java

@@ -0,0 +1,32 @@
+package com.fdage.request;
+
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * Created by Hb_zzZ on 2019/9/11.
+ */
+@Data
+public class RequestInformation extends RequestBase{
+
+    private Long id;
+
+    private String name;
+
+    private Integer type;
+
+    private String contentUrl;
+
+    private Integer contentNum;
+
+    private Integer orderNum;
+
+    private Integer state;
+
+    private Date startTime;
+
+    private Date endTime;
+
+    private String description;
+}

+ 14 - 0
zhoushan-system-common/src/main/java/com/fdage/request/RequestLog.java

@@ -0,0 +1,14 @@
+package com.fdage.request;
+
+import lombok.Data;
+
+/**
+ * Created by Hb_zzZ on 2020/7/28.
+ */
+@Data
+public class RequestLog extends RequestBase{
+
+    private String type;
+
+    private String description;
+}

+ 24 - 0
zhoushan-system-common/src/main/java/com/fdage/request/RequestRole.java

@@ -0,0 +1,24 @@
+package com.fdage.request;
+
+import lombok.Data;
+
+import java.util.Set;
+
+/**
+ * Created by Hb_zzZ on 2020/7/28.
+ */
+@Data
+public class RequestRole {
+
+    private Long id;
+
+    private String roleName;
+
+    private Set<Long> resources;
+
+    private String description;
+
+    private Integer state;
+
+    private String roleKey;
+}

+ 30 - 0
zhoushan-system-common/src/main/java/com/fdage/request/RequestUser.java

@@ -0,0 +1,30 @@
+package com.fdage.request;
+
+import lombok.Data;
+
+/**
+ * Created by Hb_zzZ on 2019/9/11.
+ */
+@Data
+public class RequestUser extends RequestBase{
+
+    private Long id;
+
+    private String userName;
+
+    private String password;
+
+    private String repeatPassword;
+
+    private String newPassword;
+
+    private Long roleId;
+
+    private String phone;
+
+    private String head;
+
+    private Integer state;
+
+    private String searchKey;
+}

+ 0 - 0
zhoushan-system-common/src/main/java/com/fdage/respon/ResponCollection.java


Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio