diff --git b/.mvn/wrapper/MavenWrapperDownloader.java a/.mvn/wrapper/MavenWrapperDownloader.java
new file mode 100644
index 0000000..7f91a56
--- /dev/null
+++ a/.mvn/wrapper/MavenWrapperDownloader.java
@@ -0,0 +1,114 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ https://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+*/
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.net.URL;
+import java.nio.channels.Channels;
+import java.nio.channels.ReadableByteChannel;
+import java.util.Properties;
+
+public class MavenWrapperDownloader {
+
+ /**
+ * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
+ */
+ private static final String DEFAULT_DOWNLOAD_URL =
+ "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar";
+
+ /**
+ * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
+ * use instead of the default one.
+ */
+ private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
+ ".mvn/wrapper/maven-wrapper.properties";
+
+ /**
+ * Path where the maven-wrapper.jar will be saved to.
+ */
+ private static final String MAVEN_WRAPPER_JAR_PATH =
+ ".mvn/wrapper/maven-wrapper.jar";
+
+ /**
+ * Name of the property which should be used to override the default download url for the wrapper.
+ */
+ private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
+
+ public static void main(String args[]) {
+ System.out.println("- Downloader started");
+ File baseDirectory = new File(args[0]);
+ System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
+
+ // If the maven-wrapper.properties exists, read it and check if it contains a custom
+ // wrapperUrl parameter.
+ File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
+ String url = DEFAULT_DOWNLOAD_URL;
+ if (mavenWrapperPropertyFile.exists()) {
+ FileInputStream mavenWrapperPropertyFileInputStream = null;
+ try {
+ mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
+ Properties mavenWrapperProperties = new Properties();
+ mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
+ url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
+ } catch (IOException e) {
+ System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
+ } finally {
+ try {
+ if (mavenWrapperPropertyFileInputStream != null) {
+ mavenWrapperPropertyFileInputStream.close();
+ }
+ } catch (IOException e) {
+ // Ignore ...
+ }
+ }
+ }
+ System.out.println("- Downloading from: : " + url);
+
+ File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
+ if (!outputFile.getParentFile().exists()) {
+ if (!outputFile.getParentFile().mkdirs()) {
+ System.out.println(
+ "- ERROR creating output direcrory '" + outputFile.getParentFile().getAbsolutePath() + "'");
+ }
+ }
+ System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
+ try {
+ downloadFileFromURL(url, outputFile);
+ System.out.println("Done");
+ System.exit(0);
+ } catch (Throwable e) {
+ System.out.println("- Error downloading");
+ e.printStackTrace();
+ System.exit(1);
+ }
+ }
+
+ private static void downloadFileFromURL(String urlString, File destination) throws Exception {
+ URL website = new URL(urlString);
+ ReadableByteChannel rbc;
+ rbc = Channels.newChannel(website.openStream());
+ FileOutputStream fos = new FileOutputStream(destination);
+ fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
+ fos.close();
+ rbc.close();
+ }
+
+}
diff --git b/.mvn/wrapper/maven-wrapper.jar a/.mvn/wrapper/maven-wrapper.jar
new file mode 100644
index 0000000..01e6799
--- /dev/null
+++ a/.mvn/wrapper/maven-wrapper.jar
diff --git b/.mvn/wrapper/maven-wrapper.properties a/.mvn/wrapper/maven-wrapper.properties
new file mode 100644
index 0000000..cd0d451
--- /dev/null
+++ a/.mvn/wrapper/maven-wrapper.properties
@@ -0,0 +1 @@
+distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip
diff --git b/pom.xml a/pom.xml
new file mode 100644
index 0000000..a1dba4e
--- /dev/null
+++ a/pom.xml
@@ -0,0 +1,213 @@
+
+
+ 4.0.0
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ 2.1.6.RELEASE
+
+
+ com.objecteye.vehicle
+ vehicle-simple
+ 0.0.1-SNAPSHOT
+ vehicle
+ Project for Spring Boot
+
+
+ 1.8
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+ mysql
+ mysql-connector-java
+ 8.0.15
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+ org.springframework.boot
+ spring-boot-starter-websocket
+ 1.5.6.RELEASE
+
+
+ org.apache.commons
+ commons-pool2
+ 2.4.2
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-data-redis
+
+
+
+
+
+ com.alibaba
+ druid-spring-boot-starter
+ 1.1.10
+
+
+
+ io.jsonwebtoken
+ jjwt
+ 0.9.0
+
+
+ org.springframework.boot
+ spring-boot-starter-security
+
+
+ org.springframework.security
+ spring-security-jwt
+ 1.0.10.RELEASE
+
+
+
+ net.logstash.logback
+ logstash-logback-encoder
+ 4.8
+
+
+ io.springfox
+ springfox-swagger2
+ 2.7.0
+
+
+ io.springfox
+ springfox-swagger-ui
+ 2.7.0
+
+
+ cn.hutool
+ hutool-all
+ 4.5.7
+
+
+ com.github.pagehelper
+ pagehelper-spring-boot-autoconfigure
+ 1.2.9
+
+
+ com.github.pagehelper
+ pagehelper
+ 5.0.0
+
+
+ org.springframework.boot
+ spring-boot-starter-data-mongodb
+
+
+
+ org.springframework.data
+ spring-data-commons
+ 2.1.5.RELEASE
+
+
+ org.mybatis.spring.boot
+ mybatis-spring-boot-starter
+ 1.2.0
+
+
+ commons-net
+ commons-net
+ 3.6
+
+
+
+ org.mybatis
+ mybatis
+ 3.4.6
+
+
+ org.apache.commons
+ commons-lang3
+ 3.8.1
+
+
+ org.apache.poi
+ poi-ooxml
+ 3.9
+
+
+ com.alibaba
+ fastjson
+ 1.2.54
+
+
+ org.apache.httpcomponents
+ httpclient
+ 4.5.7
+
+
+ org.apache.httpcomponents
+ httpmime
+ 4.5.5
+
+
+ org.junit.jupiter
+ junit-jupiter-api
+ 5.2.0
+ compile
+
+
+ org.projectlombok
+ lombok
+
+
+ net.sf.json-lib
+ json-lib
+ 2.4
+ jdk15
+
+
+ org.springframework.boot
+ spring-boot-starter-amqp
+
+
+ net.sourceforge.owlapi
+ benchmarks
+ 4.1.0-RC2
+ test
+
+
+
+
+
+
+ src/main/java
+
+ **/*.xml
+
+ true
+
+
+ src/main/resources
+ true
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+
diff --git b/src/main/java/com/objecteye/VehicleApplication.java a/src/main/java/com/objecteye/VehicleApplication.java
new file mode 100644
index 0000000..58f09f1
--- /dev/null
+++ a/src/main/java/com/objecteye/VehicleApplication.java
@@ -0,0 +1,43 @@
+package com.objecteye;
+
+import com.objecteye.handle.Ftp2Mongo;
+import com.objecteye.websocket.SelectMongoData;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.context.ConfigurableApplicationContext;
+import org.springframework.context.annotation.Bean;
+import org.springframework.scheduling.TaskScheduler;
+import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
+import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
+import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
+import org.springframework.transaction.annotation.EnableTransactionManagement;
+
+@SpringBootApplication
+@EnableTransactionManagement
+@EnableScheduling
+@EnableWebSecurity
+@EnableGlobalMethodSecurity(prePostEnabled = true)
+public class VehicleApplication {
+
+ public static void main(String[] args) {
+ ConfigurableApplicationContext run = SpringApplication.run(VehicleApplication.class, args);
+
+ //存储系统开始运行时间
+ SelectMongoData selectMongoData = run.getBean(SelectMongoData.class);
+ selectMongoData.setSystemStartTime();
+
+ Ftp2Mongo bean = run.getBean(Ftp2Mongo.class);
+ bean.downloadFile();
+
+ }
+
+ @Bean
+ public TaskScheduler taskScheduler() {
+
+ ThreadPoolTaskScheduler threadPoolTaskScheduler = new ThreadPoolTaskScheduler();
+ threadPoolTaskScheduler.setPoolSize(3);
+ threadPoolTaskScheduler.initialize();
+ return threadPoolTaskScheduler;
+ }
+}
diff --git b/src/main/java/com/objecteye/common/CommonPage.java a/src/main/java/com/objecteye/common/CommonPage.java
new file mode 100644
index 0000000..074d31d
--- /dev/null
+++ a/src/main/java/com/objecteye/common/CommonPage.java
@@ -0,0 +1,84 @@
+package com.objecteye.common;
+
+import com.github.pagehelper.PageInfo;
+import org.springframework.data.domain.Page;
+
+import java.util.List;
+
+/**
+ * 分页数据封装类
+ */
+public class CommonPage {
+ private Integer pageNum;
+ private Integer pageSize;
+ private Integer totalPage;
+ private Long total;
+ private List list;
+
+ /**
+ * 将PageHelper分页后的list转为分页信息
+ */
+ public static CommonPage restPage(List list) {
+ CommonPage result = new CommonPage();
+ PageInfo pageInfo = new PageInfo(list);
+ result.setTotalPage(pageInfo.getPages());
+ result.setPageNum(pageInfo.getPageNum());
+ result.setPageSize(pageInfo.getPageSize());
+ result.setTotal(pageInfo.getTotal());
+ result.setList(pageInfo.getList());
+ return result;
+ }
+
+ /**
+ * 将SpringData分页后的list转为分页信息
+ */
+ public static CommonPage restPage(Page pageInfo) {
+ CommonPage result = new CommonPage();
+ result.setTotalPage(pageInfo.getTotalPages());
+ result.setPageNum(pageInfo.getNumber());
+ result.setPageSize(pageInfo.getSize());
+ result.setTotal(pageInfo.getTotalElements());
+ result.setList(pageInfo.getContent());
+ return result;
+ }
+
+ public Integer getPageNum() {
+ return pageNum;
+ }
+
+ public void setPageNum(Integer pageNum) {
+ this.pageNum = pageNum;
+ }
+
+ public Integer getPageSize() {
+ return pageSize;
+ }
+
+ public void setPageSize(Integer pageSize) {
+ this.pageSize = pageSize;
+ }
+
+ public Integer getTotalPage() {
+ return totalPage;
+ }
+
+ public void setTotalPage(Integer totalPage) {
+ this.totalPage = totalPage;
+ }
+
+ public List getList() {
+ return list;
+ }
+
+ public void setList(List list) {
+ this.list = list;
+ }
+
+ public Long getTotal() {
+ return total;
+ }
+
+ public void setTotal(Long total) {
+ this.total = total;
+ }
+}
diff --git b/src/main/java/com/objecteye/common/CommonResult.java a/src/main/java/com/objecteye/common/CommonResult.java
new file mode 100644
index 0000000..e393c82
--- /dev/null
+++ a/src/main/java/com/objecteye/common/CommonResult.java
@@ -0,0 +1,142 @@
+package com.objecteye.common;
+
+/**
+ * 通用返回对象
+ */
+public class CommonResult {
+ private long code;
+ private String message;
+ private T data;
+
+
+ protected CommonResult() {
+ }
+
+ protected CommonResult(long code, String message, T data) {
+ this.code = code;
+ this.message = message;
+ this.data = data;
+ }
+
+ protected CommonResult(long code, String message) {
+ this.code = code;
+ this.message = message;
+ }
+
+ /**
+ * 成功返回结果
+ *
+ * @param data 获取的数据
+ */
+ public static CommonResult success(T data) {
+ return new CommonResult(ResultCode.SUCCESS.getCode(), ResultCode.SUCCESS.getMessage(), data);
+ }
+
+ /**
+ * 成功返回结果
+ *
+ * @param data 获取的数据
+ * @param message 提示信息
+ */
+ public static CommonResult success(T data, String message) {
+ return new CommonResult(ResultCode.SUCCESS.getCode(), message, data);
+ }
+
+ /**
+ * 成功返回结果
+ *
+ * @param data 获取的数据
+ * @param message 提示信息
+ */
+ public static CommonResult success(int code, String message, T data) {
+ return new CommonResult(code, message, data);
+ }
+
+ /**
+ * 失败返回结果
+ *
+ * @param errorCode 错误码
+ */
+ public static CommonResult failed(IErrorCode errorCode) {
+ return new CommonResult(errorCode.getCode(), errorCode.getMessage(), null);
+ }
+
+ /**
+ * 失败返回结果
+ *
+ * @param message 提示信息
+ */
+ public static CommonResult failed(String message) {
+ return new CommonResult(ResultCode.FAILED.getCode(), message, null);
+ }
+
+ /**
+ * 失败返回结果
+ *
+ * @param message 提示信息
+ */
+ public static CommonResult failed(T data, String message) {
+ return new CommonResult(ResultCode.FAILED.getCode(), message, data);
+ }
+
+ /**
+ * 失败返回结果
+ */
+ public static CommonResult failed() {
+ return failed(ResultCode.FAILED);
+ }
+
+ /**
+ * 参数验证失败返回结果
+ */
+ public static CommonResult validateFailed() {
+ return failed(ResultCode.VALIDATE_FAILED);
+ }
+
+ /**
+ * 参数验证失败返回结果
+ *
+ * @param message 提示信息
+ */
+ public static CommonResult validateFailed(String message) {
+ return new CommonResult(ResultCode.VALIDATE_FAILED.getCode(), message, null);
+ }
+
+ /**
+ * 未登录返回结果
+ */
+ public static CommonResult unauthorized(T data) {
+ return new CommonResult(ResultCode.UNAUTHORIZED.getCode(), ResultCode.UNAUTHORIZED.getMessage(), data);
+ }
+
+ /**
+ * 未授权返回结果
+ */
+ public static CommonResult forbidden(T data) {
+ return new CommonResult(ResultCode.FORBIDDEN.getCode(), ResultCode.FORBIDDEN.getMessage(), data);
+ }
+
+ public long getCode() {
+ return code;
+ }
+
+ public void setCode(long code) {
+ this.code = code;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ public T getData() {
+ return data;
+ }
+
+ public void setData(T data) {
+ this.data = data;
+ }
+}
diff --git b/src/main/java/com/objecteye/common/IErrorCode.java a/src/main/java/com/objecteye/common/IErrorCode.java
new file mode 100644
index 0000000..1a00a92
--- /dev/null
+++ a/src/main/java/com/objecteye/common/IErrorCode.java
@@ -0,0 +1,10 @@
+package com.objecteye.common;
+
+/**
+ * 封装API的错误码
+ */
+public interface IErrorCode {
+ long getCode();
+
+ String getMessage();
+}
diff --git b/src/main/java/com/objecteye/common/ResultCode.java a/src/main/java/com/objecteye/common/ResultCode.java
new file mode 100644
index 0000000..3960161
--- /dev/null
+++ a/src/main/java/com/objecteye/common/ResultCode.java
@@ -0,0 +1,29 @@
+package com.objecteye.common;
+
+/**
+ * 枚举了一些常用API操作码
+ */
+public enum ResultCode implements IErrorCode {
+ SUCCESS(200, "操作成功"),
+ FAILED(500, "操作失败"),
+ VALIDATE_FAILED(404, "参数检验失败"),
+ UNAUTHORIZED(401, "暂未登录或token已经过期"),
+ FORBIDDEN(403, "没有相关权限");
+ private long code;
+ private String message;
+
+ private ResultCode(long code, String message) {
+ this.code = code;
+ this.message = message;
+ }
+
+ @Override
+ public long getCode() {
+ return code;
+ }
+
+ @Override
+ public String getMessage() {
+ return message;
+ }
+}
diff --git b/src/main/java/com/objecteye/component/ParamInterceptor.java a/src/main/java/com/objecteye/component/ParamInterceptor.java
new file mode 100644
index 0000000..d6ea525
--- /dev/null
+++ a/src/main/java/com/objecteye/component/ParamInterceptor.java
@@ -0,0 +1,74 @@
+
+package com.objecteye.component;
+
+/*@Component
+public class ParamInterceptor implements HandlerInterceptor {
+
+ @Autowired
+ private JwtTokenUtil jwtTokenUtil;
+ @Autowired
+ private UserService userService;
+
+
+ @Override
+ public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
+
+ String token = request.getHeader("token");
+ if (!(handler instanceof HandlerMethod)) {
+ return true;
+ }
+ if (token == null || token.equals("")) {
+ printJson(response, "");
+ return false;
+ }
+ String userName = jwtTokenUtil.getUserNameFromToken(token);
+ SyUser user = userService.getAdminByUsername(userName);
+ if (user == null) {
+ printJson(response, "");
+ return false;
+ }
+
+ *//*String userId = user.getId();
+ User sqlUser = getUserService().getUserById(userId);
+ String enterpriseId = getUserEnterpriseService().selectEnterpriseByUser(userId);
+ if (enterpriseId == null) {
+ getRedisService().set(REDIS_USER_SESSION_KEY + ":" + token, sqlUser, SSO_SESSION_EXPIRE);
+ return true;
+ }
+ Enterprise sqlEnterprise = getEnterpriseService().selectEnterpriseById(enterpriseId);
+ getRedisService().set(REDIS_USER_SESSION_KEY + ":" + token, sqlUser, SSO_SESSION_EXPIRE);
+ getRedisService().set(REDIS_ENTERPRISE_SESSION_KEY + ":" + token, sqlEnterprise, SSO_SESSION_EXPIRE);*//*
+
+ 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 {
+
+
+ }
+ private static void printJson(HttpServletResponse response, String code) {
+ printContent(response, "token过期,请重新登陆");
+ }
+
+
+ private static void printContent(HttpServletResponse response, String content) {
+ try {
+ response.reset();
+ response.setContentType("application/json");
+ response.setHeader("Cache-Control", "no-store");
+ response.setCharacterEncoding("UTF-8");
+ PrintWriter pw = response.getWriter();
+ pw.write(content);
+ pw.flush();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+}*/
+
diff --git b/src/main/java/com/objecteye/config/AccessConfirmServiceImpl.java a/src/main/java/com/objecteye/config/AccessConfirmServiceImpl.java
new file mode 100644
index 0000000..f90e732
--- /dev/null
+++ a/src/main/java/com/objecteye/config/AccessConfirmServiceImpl.java
@@ -0,0 +1,82 @@
+package com.objecteye.config;
+
+import com.objecteye.pojo.SpecialAuthenticationUrlConfig;
+import com.objecteye.pojo.UserDetailsMsg;
+import com.objecteye.pojo.UserGroup;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.mongodb.core.MongoTemplate;
+import org.springframework.data.mongodb.core.query.Criteria;
+import org.springframework.data.mongodb.core.query.Query;
+import org.springframework.security.authentication.AnonymousAuthenticationToken;
+import org.springframework.security.core.Authentication;
+import org.springframework.security.core.userdetails.UserDetails;
+import org.springframework.stereotype.Component;
+import org.springframework.util.AntPathMatcher;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Component("accessConfirmService")
+public class AccessConfirmServiceImpl {
+
+ @Autowired
+ private MongoTemplate mongoTemplate;
+
+ private AntPathMatcher antPathMatcher = new AntPathMatcher();
+
+ public boolean hasPermission(HttpServletRequest request, Authentication auth) {
+ // 匿名token不允许访问所有的接口
+ if (auth instanceof AnonymousAuthenticationToken) {
+ return false;
+ }
+
+ UserDetails user = (UserDetails) auth.getPrincipal();
+ Map specialUrlAccessMap = queryUrlByUserName(user.getUsername());
+ for (Map.Entry entry : specialUrlAccessMap.entrySet()) {
+ if (antPathMatcher.match(entry.getKey(), request.getRequestURI())) {
+ return entry.getValue();
+ }
+ }
+ return true;
+ }
+
+ /**
+ * 查询用户权限
+ *
+ * @param userName 用户名
+ * @return key: 需要权限的url; value: 是否可以访问
+ */
+ private Map queryUrlByUserName(String userName) {
+ List userDetailsMsgList = mongoTemplate.find(Query.query(Criteria.where("userName").is(userName)), UserDetailsMsg.class);
+ Map specialUrlLevelMap = new HashMap<>();
+ if (userDetailsMsgList.size() > 0) {
+ List levelList = new ArrayList<>();
+ UserDetailsMsg userDetailsMsg = userDetailsMsgList.get(0);
+ levelList.add(userDetailsMsg.getUserRole());
+ List userGroups = mongoTemplate.find(Query.query(Criteria.where("grouoId").is(userDetailsMsg.getGroup())), UserGroup.class);
+ if (userGroups.size() > 0) {
+ levelList.add(userGroups.get(0).getGroupLevel());
+ }
+ // 保存的是所有的需要特殊权限才能访问的
+ List specialUrlList = mongoTemplate.find(new Query(), SpecialAuthenticationUrlConfig.class);
+ if (specialUrlList.size() > 0) {
+ for (SpecialAuthenticationUrlConfig specialUrlConfig : specialUrlList) {
+ String url = specialUrlConfig.getUrl();
+ Integer level = specialUrlConfig.getLevel();
+ if (specialUrlLevelMap.containsKey(url)) {
+ // 历史数据不允许访问, 当前数据允许访问则刷新是否可以访问的状态
+ if (!specialUrlLevelMap.get(url) && levelList.contains(level)) {
+ specialUrlLevelMap.put(url, true);
+ }
+ } else {
+ specialUrlLevelMap.put(url, levelList.contains(level));
+ }
+ }
+ }
+ }
+ return specialUrlLevelMap;
+ }
+}
diff --git b/src/main/java/com/objecteye/config/AuthenticationHeadFilter.java a/src/main/java/com/objecteye/config/AuthenticationHeadFilter.java
new file mode 100644
index 0000000..80f0074
--- /dev/null
+++ a/src/main/java/com/objecteye/config/AuthenticationHeadFilter.java
@@ -0,0 +1,52 @@
+package com.objecteye.config;
+
+import com.alibaba.fastjson.JSON;
+import com.objecteye.pojo.TokenUser;
+import org.springframework.security.core.context.SecurityContextHolder;
+import org.springframework.security.jwt.Jwt;
+import org.springframework.security.jwt.JwtHelper;
+import org.springframework.security.jwt.crypto.sign.RsaVerifier;
+import org.springframework.security.web.authentication.WebAuthenticationDetails;
+import org.springframework.web.filter.OncePerRequestFilter;
+
+import javax.servlet.FilterChain;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+/**
+ * 拦截request请求做token验证
+ */
+public class AuthenticationHeadFilter extends OncePerRequestFilter {
+
+ private RsaVerifier rsaVerifier;
+
+ public void setRsaVerifier(RsaVerifier rsaVerifier) {
+ this.rsaVerifier = rsaVerifier;
+ }
+
+ @Override
+ protected void doFilterInternal(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, FilterChain filterChain) throws ServletException, IOException {
+ String token = httpServletRequest.getHeader("Authentication");
+ if (token == null || token.isEmpty()) {
+ filterChain.doFilter(httpServletRequest, httpServletResponse);
+ return;
+ }
+
+ TokenUser user;
+ try {
+ Jwt jwt = JwtHelper.decodeAndVerify(token, rsaVerifier);
+ String claims = jwt.getClaims();
+ user = JSON.parseObject(claims, TokenUser.class);
+ } catch (Exception e) {
+ httpServletResponse.setContentType("application/json;charset=UTF-8");
+ httpServletResponse.getWriter().write("Useless token...");
+ return;
+ }
+ AuthenticationToken authenticationToken = new AuthenticationToken(user, "", user.getAuthorities());
+ authenticationToken.setDetails(new WebAuthenticationDetails(httpServletRequest));
+ SecurityContextHolder.getContext().setAuthentication(authenticationToken);
+ filterChain.doFilter(httpServletRequest, httpServletResponse);
+ }
+}
diff --git b/src/main/java/com/objecteye/config/AuthenticationLoginFilter.java a/src/main/java/com/objecteye/config/AuthenticationLoginFilter.java
new file mode 100644
index 0000000..fb715ea
--- /dev/null
+++ a/src/main/java/com/objecteye/config/AuthenticationLoginFilter.java
@@ -0,0 +1,28 @@
+package com.objecteye.config;
+
+import org.springframework.security.core.Authentication;
+import org.springframework.security.core.AuthenticationException;
+import org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter;
+import org.springframework.security.web.authentication.WebAuthenticationDetails;
+import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+public class AuthenticationLoginFilter extends AbstractAuthenticationProcessingFilter {
+
+ public AuthenticationLoginFilter() {
+ super(new AntPathRequestMatcher("/login", "POST"));
+ }
+
+ @Override
+ public Authentication attemptAuthentication(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws AuthenticationException, IOException, ServletException {
+ String userName = httpServletRequest.getParameter("username");
+ String password = httpServletRequest.getParameter("password");
+ AuthenticationToken authenticationToken = new AuthenticationToken(userName, password);
+ authenticationToken.setDetails(new WebAuthenticationDetails(httpServletRequest));
+ return this.getAuthenticationManager().authenticate(authenticationToken);
+ }
+}
diff --git b/src/main/java/com/objecteye/config/AuthenticationProviderConfig.java a/src/main/java/com/objecteye/config/AuthenticationProviderConfig.java
new file mode 100644
index 0000000..2e6d6ba
--- /dev/null
+++ a/src/main/java/com/objecteye/config/AuthenticationProviderConfig.java
@@ -0,0 +1,85 @@
+package com.objecteye.config;
+
+import org.springframework.security.authentication.*;
+import org.springframework.security.core.Authentication;
+import org.springframework.security.core.AuthenticationException;
+import org.springframework.security.core.userdetails.UserDetails;
+import org.springframework.security.core.userdetails.UserDetailsService;
+import org.springframework.security.crypto.password.PasswordEncoder;
+
+public class AuthenticationProviderConfig implements AuthenticationProvider {
+
+ private UserDetailsService userDetailsService;
+
+ private PasswordEncoder passwordEncoder;
+
+ public void setUserDetailsService(UserDetailsService userDetailsService) {
+ this.userDetailsService = userDetailsService;
+ }
+
+ public void setPasswordEncoder(PasswordEncoder passwordEncoder) {
+ this.passwordEncoder = passwordEncoder;
+ }
+
+ /**
+ * 用户默认检查,用户是否锁定过期等
+ */
+ private void defaultCheck(UserDetails user) {
+ if (!user.isAccountNonLocked()) {
+ throw new LockedException("User account is locked");
+ }
+
+ if (!user.isEnabled()) {
+ throw new DisabledException("User is disabled");
+ }
+
+ if (!user.isAccountNonExpired()) {
+ throw new AccountExpiredException("User account has expired");
+ }
+ }
+
+ /**
+ * (附加检查项)检查密码是否正确
+ */
+ private void additionalAuthenticationChecks(UserDetails userDetails,
+ AuthenticationToken authenticationToken) throws AuthenticationException {
+ if (authenticationToken.getCredentials() == null) {
+ throw new BadCredentialsException("username or password is wrong!");
+ }
+ String presentedPassword = authenticationToken.getCredentials().toString();
+ if (!passwordEncoder.matches(presentedPassword, userDetails.getPassword())) {
+ throw new BadCredentialsException("username or password is wrong!");
+ }
+ }
+
+ /**
+ * 创建一个认证成功的Authentication对象,传入的是一个还没有认证的Authentication对象
+ *
+ * @param authentication 未认证的
+ * @return
+ * @throws AuthenticationException
+ * @see AuthenticationToken#AuthenticationToken(Object, Object)
+ */
+ @Override
+ public Authentication authenticate(Authentication authentication) throws AuthenticationException {
+ String userName = authentication.getName();
+ UserDetails userDetails = userDetailsService.loadUserByUsername(userName);
+ AuthenticationToken checkToken = (AuthenticationToken) authentication;
+ defaultCheck(userDetails);
+ additionalAuthenticationChecks(userDetails, checkToken);
+ AuthenticationToken authenticationToken = new AuthenticationToken(userDetails, checkToken.getCredentials(), userDetails.getAuthorities());
+ authenticationToken.setDetails(checkToken.getDetails());
+ return authenticationToken;
+ }
+
+ /**
+ * 判断token是否是该类型
+ *
+ * @param aClass
+ * @return
+ */
+ @Override
+ public boolean supports(Class> aClass) {
+ return AuthenticationToken.class.isAssignableFrom(aClass);
+ }
+}
diff --git b/src/main/java/com/objecteye/config/AuthenticationToken.java a/src/main/java/com/objecteye/config/AuthenticationToken.java
new file mode 100644
index 0000000..5ae9088
--- /dev/null
+++ a/src/main/java/com/objecteye/config/AuthenticationToken.java
@@ -0,0 +1,56 @@
+package com.objecteye.config;
+
+import org.springframework.security.authentication.AbstractAuthenticationToken;
+import org.springframework.security.core.GrantedAuthority;
+
+import java.util.Collection;
+
+public class AuthenticationToken extends AbstractAuthenticationToken {
+
+ private static final long serialVersionUID = 4169946299521307024L;
+ /**
+ * 用户名
+ */
+ private final Object principal;
+ /**
+ * 密码
+ */
+ private Object credentials;
+
+ /**
+ * 创建一个认证成功的token
+ *
+ * @param principal
+ * @param credentials
+ * @param authorities
+ */
+ public AuthenticationToken(Object principal, Object credentials, Collection extends GrantedAuthority> authorities) {
+ super(authorities);
+ this.principal = principal;
+ this.credentials = credentials;
+ super.setAuthenticated(true);
+ }
+
+ /**
+ * 创建一个未认证的token
+ *
+ * @param principal
+ * @param credentials
+ */
+ public AuthenticationToken(Object principal, Object credentials) {
+ super(null);
+ this.principal = principal;
+ this.credentials = credentials;
+ super.setAuthenticated(false);
+ }
+
+ @Override
+ public Object getCredentials() {
+ return this.credentials;
+ }
+
+ @Override
+ public Object getPrincipal() {
+ return this.principal;
+ }
+}
diff --git b/src/main/java/com/objecteye/config/ExecutorConfig.java a/src/main/java/com/objecteye/config/ExecutorConfig.java
new file mode 100644
index 0000000..5d8c78b
--- /dev/null
+++ a/src/main/java/com/objecteye/config/ExecutorConfig.java
@@ -0,0 +1,36 @@
+package com.objecteye.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.core.task.TaskExecutor;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
+
+import java.util.concurrent.ThreadPoolExecutor;
+
+/**
+ * @author yumiu
+ */
+@Configuration
+@Async
+public class ExecutorConfig {
+
+ @Bean
+ public TaskExecutor taskExecutor() {
+ ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
+ // 设置核心线程数
+ executor.setCorePoolSize(5);
+ // 设置最大线程数
+ executor.setMaxPoolSize(20);
+ // 设置队列容量
+ executor.setQueueCapacity(50);
+ // 设置线程活跃时间(秒)
+ executor.setKeepAliveSeconds(60);
+ //executor.setThreadNamePrefix("hello-");
+ // 设置拒绝策略
+ executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
+ // 等待所有任务结束后再关闭线程池
+ executor.setWaitForTasksToCompleteOnShutdown(true);
+ return executor;
+ }
+}
diff --git b/src/main/java/com/objecteye/config/LoginFailureHandler.java a/src/main/java/com/objecteye/config/LoginFailureHandler.java
new file mode 100644
index 0000000..012b9cb
--- /dev/null
+++ a/src/main/java/com/objecteye/config/LoginFailureHandler.java
@@ -0,0 +1,21 @@
+package com.objecteye.config;
+
+import org.springframework.security.core.AuthenticationException;
+import org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+/**
+ * 登录失败处理
+ */
+public class LoginFailureHandler extends SimpleUrlAuthenticationFailureHandler {
+
+ @Override
+ public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response, AuthenticationException exception) throws IOException, ServletException {
+ response.setContentType("application/json;charset=UTF-8");
+ response.getWriter().write("登录失败");
+ }
+}
diff --git b/src/main/java/com/objecteye/config/LoginSuccessHandler.java a/src/main/java/com/objecteye/config/LoginSuccessHandler.java
new file mode 100644
index 0000000..d423b05
--- /dev/null
+++ a/src/main/java/com/objecteye/config/LoginSuccessHandler.java
@@ -0,0 +1,32 @@
+package com.objecteye.config;
+
+import com.alibaba.fastjson.JSON;
+import org.springframework.security.core.Authentication;
+import org.springframework.security.jwt.JwtHelper;
+import org.springframework.security.jwt.crypto.sign.RsaSigner;
+import org.springframework.security.web.authentication.SimpleUrlAuthenticationSuccessHandler;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+/**
+ * 登录成功处理
+ */
+public class LoginSuccessHandler extends SimpleUrlAuthenticationSuccessHandler {
+
+ private RsaSigner signer;
+
+ @Override
+ public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException {
+ response.setContentType("application/json;charset=UTF-8");
+ String userJsonStr = JSON.toJSONString(authentication.getPrincipal());
+ String token = JwtHelper.encode(userJsonStr, signer).getEncoded();
+ //签发token
+ response.getWriter().write("token=" + token);
+ }
+
+ public void setSigner(RsaSigner signer) {
+ this.signer = signer;
+ }
+}
diff --git b/src/main/java/com/objecteye/config/MyBatisConfig.java a/src/main/java/com/objecteye/config/MyBatisConfig.java
new file mode 100644
index 0000000..902ff57
--- /dev/null
+++ a/src/main/java/com/objecteye/config/MyBatisConfig.java
@@ -0,0 +1,10 @@
+package com.objecteye.config;
+
+import org.mybatis.spring.annotation.MapperScan;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+@MapperScan({"com.objecteye.mapper"})
+public class MyBatisConfig {
+
+}
diff --git b/src/main/java/com/objecteye/config/RabbitmqConfig.java a/src/main/java/com/objecteye/config/RabbitmqConfig.java
new file mode 100644
index 0000000..d71ad1a
--- /dev/null
+++ a/src/main/java/com/objecteye/config/RabbitmqConfig.java
@@ -0,0 +1,80 @@
+package com.objecteye.config;
+
+
+import org.springframework.amqp.core.*;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+
+@Configuration
+public class RabbitmqConfig {
+ public static final String QUEUE_INFORM_STORE = "queue_inform_store";
+ public static final String QUEUE_INFORM_ALARM = "queue_inform_alarm";
+ public static final String QUEUE_INFORM_PERSON = "queue_inform_person";
+ public static final String QUEUE_INFORM_FORBIDDEN_TASK = "queue_inform_forbidden";
+
+ public static final String EXCHANGE_TOPICS_INFORM = "exchange_topics_inform";
+
+ /**
+ * 配置交换机
+ * ExchangeBuilder提供了fonout,direct,topic,header的交换机的配置
+ *
+ * @return
+ */
+ @Bean(EXCHANGE_TOPICS_INFORM)
+ public Exchange EXCHANGE_TOPICS_INFORM() {
+ return ExchangeBuilder.topicExchange(EXCHANGE_TOPICS_INFORM).durable(true).build();
+ }
+
+ /**
+ * 声明队列
+ *
+ * @return
+ */
+ @Bean(QUEUE_INFORM_STORE)
+ public Queue QUEUE_INFORM_STORE() {
+ return new Queue(QUEUE_INFORM_STORE);
+ }
+
+ @Bean(QUEUE_INFORM_ALARM)
+ public Queue QUEUE_INFORM_ALARM() {
+ return new Queue(QUEUE_INFORM_ALARM);
+ }
+
+ @Bean(QUEUE_INFORM_PERSON)
+ public Queue QUEUE_INFORM_PERSON() {
+ return new Queue(QUEUE_INFORM_PERSON);
+ }
+
+ @Bean(QUEUE_INFORM_FORBIDDEN_TASK)
+ public Queue QUEUE_INFORM_FORBIDDEN_TASK() {
+ return new Queue(QUEUE_INFORM_FORBIDDEN_TASK);
+ }
+
+ /**
+ * 绑定队列到交换机
+ *
+ * @return
+ */
+ @Bean
+ public Binding BINDING_QUEUE_INFORM_ALARM(@Qualifier(QUEUE_INFORM_ALARM) Queue queue, @Qualifier(EXCHANGE_TOPICS_INFORM) Exchange exchange) {
+ return BindingBuilder.bind(queue).to(exchange).with("inform.#.alarm.#").noargs();
+ }
+
+ //绑定队列到交换机
+ @Bean
+ public Binding BINDING_QUEUE_INFORM_STORE(@Qualifier(QUEUE_INFORM_STORE) Queue queue, @Qualifier(EXCHANGE_TOPICS_INFORM) Exchange exchange) {
+ return BindingBuilder.bind(queue).to(exchange).with("inform.#.store.#").noargs();
+ }
+
+ @Bean
+ public Binding BINDING_QUEUE_INFORM_PERSON(@Qualifier(QUEUE_INFORM_PERSON) Queue queue, @Qualifier(EXCHANGE_TOPICS_INFORM) Exchange exchange) {
+ return BindingBuilder.bind(queue).to(exchange).with("inform.#.person.#").noargs();
+ }
+
+ @Bean
+ public Binding BINDING_QUEUE_INFORM_FORBIDDEN_TASK(@Qualifier(QUEUE_INFORM_FORBIDDEN_TASK) Queue queue, @Qualifier(EXCHANGE_TOPICS_INFORM) Exchange exchange) {
+ return BindingBuilder.bind(queue).to(exchange).with("inform.#.forbidden.#").noargs();
+ }
+}
diff --git b/src/main/java/com/objecteye/config/RestTemplateConfig.java a/src/main/java/com/objecteye/config/RestTemplateConfig.java
new file mode 100644
index 0000000..ad62ec9
--- /dev/null
+++ a/src/main/java/com/objecteye/config/RestTemplateConfig.java
@@ -0,0 +1,30 @@
+package com.objecteye.config;
+
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.http.client.ClientHttpRequestFactory;
+import org.springframework.http.client.SimpleClientHttpRequestFactory;
+import org.springframework.web.client.RestTemplate;
+
+/**
+ * @author yumiu
+ */
+@Configuration
+public class RestTemplateConfig {
+
+ @Bean
+ public RestTemplate restTemplate(ClientHttpRequestFactory factory) {
+ return new RestTemplate(factory);
+ }
+
+ @Bean
+ public ClientHttpRequestFactory simpleClientHttpRequestFactory() {
+ SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory();
+ //单位为ms
+ factory.setReadTimeout(5000);
+ //单位为ms
+ factory.setConnectTimeout(5000);
+ return factory;
+ }
+}
diff --git b/src/main/java/com/objecteye/config/RsaKeyConfig.java a/src/main/java/com/objecteye/config/RsaKeyConfig.java
new file mode 100644
index 0000000..2de3a48
--- /dev/null
+++ a/src/main/java/com/objecteye/config/RsaKeyConfig.java
@@ -0,0 +1,45 @@
+package com.objecteye.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.security.jwt.crypto.sign.RsaSigner;
+import org.springframework.security.jwt.crypto.sign.RsaVerifier;
+
+@Configuration
+public class RsaKeyConfig {
+
+ /**
+ * RSA私钥
+ */
+ private static final String PRIVATE_KEY = "-----BEGIN RSA PRIVATE KEY-----" +
+ "MIICWwIBAAKBgQCM1YBbzMijYIp4/mf1+gdVBXQMJEv5KpuTDh6DiTGJAk1yrsWA" +
+ "RfqjpC83/t0xzpmvHa1M7WykUg5E0PmneNddyD/MTjkCDNhqBgr0AnJTZsTnEjMa" +
+ "PB0cXeVF1ty1p+ZBuvHKMvhJwqgNmQd7uGpl2Rq1gR1L86YTWSkYceSoNwIDAQAB" +
+ "AoGAcYrr+pcGp5l86oGJhWm4IZbM8cENs2vjk9LNTRT9580AbdZ0Cq/gm7ASFZ4X" +
+ "7UD47JMLljrQ3UX+lQK6VIf7cTUGZdR1nVArOqJaMKVvCYkwqR6bm5Gc6qx6XWAW" +
+ "0/PY2LcWt0cW1Q1CU65M1oM08P+ohQvE4kJI45RcoIl6VwkCQQCO0Za4bYiZWtzE" +
+ "UzRka+kHa//h1YjYbQVglPLb5FuOdSm62eGQThfQRpyLU1WD6sATv9yPWxUaRCEL" +
+ "Fh+s/YfrAkEA/HFDLl/Nl439/A5Q05HWhMKWZ8tt8k448mNNlefJUK1ApCuWdDWm" +
+ "kBTk8ytjRvdFlVKvVVXUV8LeSyWMXpR55QJACe/rXMnCR2lbEw33B0W64RlSpJQH" +
+ "AYgUZ7P1cfdhp3fff3DJkRDd90/ydH9H4/Xhh35CCnd78GftJKhVa+P4IQJABYv3" +
+ "je1M9yeHjSJDZGKv8/rSkzVFFS3i0nCcI88T/VHROco7ZBJJtqC+5xjs9YI5ZS6L" +
+ "67QXFlaRy9TnYKyigQJAHjuzdwDgKBj2orf6k05ri+Ks1nGvp5S4JxzcGCmkQB+l" +
+ "6KOJ8lAFma4qxWKaMeNi0ekrzkSrJNEt5yJPbw1Lmg==" +
+ "-----END RSA PRIVATE KEY-----";
+
+ /**
+ * 使用私钥签名
+ */
+ @Bean
+ public RsaSigner getSigner() {
+ return new RsaSigner(PRIVATE_KEY);
+ }
+
+ /**
+ * 使用公钥验签(这里是可以通过私钥生成密钥对,包含公钥)
+ */
+ @Bean
+ public RsaVerifier getVerifier() {
+ return new RsaVerifier(PRIVATE_KEY);
+ }
+}
diff --git b/src/main/java/com/objecteye/config/Swagger2Config.java a/src/main/java/com/objecteye/config/Swagger2Config.java
new file mode 100644
index 0000000..84b3b25
--- /dev/null
+++ a/src/main/java/com/objecteye/config/Swagger2Config.java
@@ -0,0 +1,87 @@
+package com.objecteye.config;
+
+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;
+
+/**
+ * Swagger2API文档的配置
+ */
+@Configuration
+@EnableSwagger2
+public class Swagger2Config {
+ @Bean
+ public Docket createRestApi() {
+ return new Docket(DocumentationType.SWAGGER_2)
+ .apiInfo(apiInfo())
+ .select()
+ .apis(RequestHandlerSelectors.basePackage("com.objecteye.controller"))
+ .paths(PathSelectors.any())
+ .build()
+ .securitySchemes(securitySchemes())
+ .securityContexts(securityContexts());
+ }
+
+ private ApiInfo apiInfo() {
+ return new ApiInfoBuilder()
+ .title("人像平台后台系统")
+ .description("人像平台后台模块")
+ .contact("face")
+ .version("1.0")
+ .build();
+ }
+
+ private List securitySchemes() {
+ //设置请求头信息
+ List result = new ArrayList<>();
+ ApiKey apiKey = new ApiKey("Authorization", "Authorization", "header");
+ result.add(apiKey);
+ return result;
+ }
+
+ private List securityContexts() {
+ //设置需要登录认证的路径
+ List result = new ArrayList<>();
+ result.add(getContextByPath("/alarm/.*"));
+ result.add(getContextByPath("/capture/.*"));
+ result.add(getContextByPath("/deploy/.*"));
+ result.add(getContextByPath("/equipment/.*"));
+ result.add(getContextByPath("/feature/.*"));
+ result.add(getContextByPath("/location/.*"));
+ result.add(getContextByPath("/personnel/.*"));
+ result.add(getContextByPath("/preview/.*"));
+ result.add(getContextByPath("/record/.*"));
+ result.add(getContextByPath("/user/.*"));
+ result.add(getContextByPath("/areaEquipment/.*"));
+ return result;
+ }
+
+ private SecurityContext getContextByPath(String pathRegex) {
+ return SecurityContext.builder()
+ .securityReferences(defaultAuth())
+ .forPaths(PathSelectors.regex(pathRegex))
+ .build();
+ }
+
+ private List defaultAuth() {
+ List 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;
+ }
+}
diff --git b/src/main/java/com/objecteye/config/WebSecurityConfig.java a/src/main/java/com/objecteye/config/WebSecurityConfig.java
new file mode 100644
index 0000000..9e5e9da
--- /dev/null
+++ a/src/main/java/com/objecteye/config/WebSecurityConfig.java
@@ -0,0 +1,74 @@
+package com.objecteye.config;
+
+import com.objecteye.common.ResultCode;
+import com.objecteye.service.impl.UserDetailServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.security.config.annotation.web.builders.HttpSecurity;
+import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
+import org.springframework.security.config.http.SessionCreationPolicy;
+import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
+import org.springframework.security.crypto.password.PasswordEncoder;
+import org.springframework.security.jwt.crypto.sign.RsaSigner;
+import org.springframework.security.jwt.crypto.sign.RsaVerifier;
+import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
+
+@Configuration
+public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
+
+ @Autowired
+ private RsaVerifier verifier;
+
+ @Autowired
+ private RsaSigner signer;
+
+ @Autowired
+ private UserDetailServiceImpl userDetailService;
+
+ @Override
+ protected void configure(HttpSecurity http) throws Exception {
+ AuthenticationLoginFilter authenticationLoginFilter = new AuthenticationLoginFilter();
+ authenticationLoginFilter.setAuthenticationManager(this.authenticationManagerBean());
+
+ LoginSuccessHandler loginSuccessHandler = new LoginSuccessHandler();
+ loginSuccessHandler.setSigner(signer);
+ authenticationLoginFilter.setAuthenticationSuccessHandler(loginSuccessHandler);
+ authenticationLoginFilter.setAuthenticationFailureHandler(new LoginFailureHandler());
+
+ AuthenticationProviderConfig provider = new AuthenticationProviderConfig();
+ provider.setPasswordEncoder(passwordEncoder());
+ provider.setUserDetailsService(userDetailService);
+
+ AuthenticationHeadFilter headFilter = new AuthenticationHeadFilter();
+ headFilter.setRsaVerifier(verifier);
+
+ http.exceptionHandling().authenticationEntryPoint((request, response, authException) -> {
+ response.setContentType("application/json;charset=UTF-8");
+ response.getWriter().write(ResultCode.UNAUTHORIZED.getMessage());
+ })
+ .accessDeniedHandler((httpServletRequest, httpServletResponse, accessDeniedException) -> {
+ httpServletResponse.setContentType("application/json;charset=UTF-8");
+ httpServletResponse.getWriter().write(ResultCode.FORBIDDEN.getMessage());
+ })
+ .and()
+ .authorizeRequests()
+ .anyRequest().access("@accessConfirmService.hasPermission(request , authentication)")
+ .and()
+ //注册授权管理器(AuthenticationManager)
+ .authenticationProvider(provider)
+ .addFilterAfter(authenticationLoginFilter, UsernamePasswordAuthenticationFilter.class)
+ .addFilterAfter(headFilter, AuthenticationLoginFilter.class)
+ //禁用session
+ .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS)
+ .and()
+ .csrf().disable();
+ }
+
+
+ @Bean
+ public PasswordEncoder passwordEncoder() {
+ return new BCryptPasswordEncoder();
+ }
+
+}
diff --git b/src/main/java/com/objecteye/controller/AreaEquipmentController.java a/src/main/java/com/objecteye/controller/AreaEquipmentController.java
new file mode 100644
index 0000000..9246a22
--- /dev/null
+++ a/src/main/java/com/objecteye/controller/AreaEquipmentController.java
@@ -0,0 +1,155 @@
+package com.objecteye.controller;
+
+
+import com.objecteye.common.CommonResult;
+import com.objecteye.entity.SyAreaEquipment;
+import com.objecteye.service.AreaEquipmentService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * controller
+ *
+ * @author Administrator
+ */
+@RestController
+@Api(tags = "AreaEquipmentController", description = "区域设备管理")
+@RequestMapping("/areaEquipment")
+@CrossOrigin
+public class AreaEquipmentController {
+
+ @Autowired
+ private AreaEquipmentService areaEquipmentService;
+
+ /**
+ * 返回全部列表
+ *
+ * @return
+ */
+ @ApiOperation("区域设备树的展示==区域可操作")
+ @RequestMapping(value = "/findAll", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
+ public CommonResult findAll() {
+ if (areaEquipmentService.findAll() == null) {
+ return CommonResult.success("", "无符合条件的数据");
+ }
+ return CommonResult.success(areaEquipmentService.findAll());
+ }
+
+ /**
+ * 返回全部列表
+ *
+ * @return
+ */
+ @ApiOperation("区域设备树的展示==区域设备可操作")
+ @RequestMapping(value = "/findAllEquipAndArea", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
+ public CommonResult findAllEquipAndArea() {
+ if (areaEquipmentService.findAllEquipAndArea() == null) {
+ return CommonResult.success("", "无符合条件的数据");
+ }
+ return CommonResult.success(areaEquipmentService.findAllEquipAndArea());
+ }
+
+ /**
+ * 增加
+ *
+ * @param areaEquipment
+ * @return
+ */
+ @ApiOperation("添加区域")
+ @RequestMapping(value = "/add", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
+ public CommonResult add(@RequestBody SyAreaEquipment areaEquipment) {
+ Integer parentId = areaEquipment.getParentId();
+ if (parentId == 1) {
+ int count = areaEquipmentService.add(areaEquipment);
+ if (count > 0) {
+ return CommonResult.success(count);
+ }
+ }
+ return CommonResult.failed("该区域下只能创建设备");
+ }
+
+ /**
+ * 修改
+ *
+ * @param areaEquipment
+ * @return
+ */
+ @ApiOperation("修改区域名称")
+ @RequestMapping(value = "/update", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
+ public CommonResult update(@RequestBody SyAreaEquipment areaEquipment) {
+ int count = areaEquipmentService.update(areaEquipment);
+ if (count > 0) {
+ return CommonResult.success(count);
+ }
+ return CommonResult.failed("节点id无效");
+ }
+
+ /**
+ * 获取实体
+ *
+ * @return
+ */
+ /*@ApiOperation("查找区域或者设备")
+ @RequestMapping(value = "/findOne",method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
+ public CommonResult findOne(@RequestBody Map map){
+ Integer id = map.get("id");
+ if(areaEquipmentService.findOne(id)==null){
+ return CommonResult.success("","节点无效");
+ }
+ return CommonResult.success(areaEquipmentService.findOne(id));
+ }*/
+
+ /**
+ * 删除区域
+ *
+ * @param map
+ * @return
+ */
+ @ApiOperation("删除区域")
+ @RequestMapping(value = "/delete", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
+ public CommonResult delete(@RequestBody Map map) {
+ try {
+ int[] ids = map.get("ids");
+ areaEquipmentService.delete(ids);
+ return CommonResult.success("删除成功", "删除成功");
+ } catch (Exception e) {
+ e.printStackTrace();
+ return CommonResult.failed(e.getMessage());
+ }
+ }
+
+ @ApiOperation("判断该区域下是否有设备")
+ @RequestMapping(value = "/isHaveChild", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
+ public CommonResult isHaveChild(@RequestBody Map map) {
+ int id = map.get("id");
+ List ids = areaEquipmentService.findCaptureById(id);
+ if (ids == null || ids.size() == 0) {
+ return CommonResult.success(ids, "是否确认删除该区域?");
+ }
+ return CommonResult.success(ids, "该区域下存在设备,且可能存在正在执行的布控任务,请确认是否删除该区域?");
+ }
+
+
+ @ApiOperation("根据id查找该区域下所有设备")
+ @RequestMapping(value = "/findCaptureById", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
+ public CommonResult findCaptureById(@RequestBody Map map) {
+ try {
+ Integer id = map.get("id");
+ List> captureMsgById = areaEquipmentService.findCaptureMsgById(id);
+ if (captureMsgById == null) {
+ return CommonResult.success("", "该区域下无设备");
+ }
+ return CommonResult.success(captureMsgById);
+ } catch (Exception e) {
+ e.printStackTrace();
+ return CommonResult.failed();
+ }
+ }
+
+}
diff --git b/src/main/java/com/objecteye/controller/DataSourceController.java a/src/main/java/com/objecteye/controller/DataSourceController.java
new file mode 100644
index 0000000..b4925c9
--- /dev/null
+++ a/src/main/java/com/objecteye/controller/DataSourceController.java
@@ -0,0 +1,62 @@
+package com.objecteye.controller;
+
+import com.objecteye.common.CommonResult;
+import com.objecteye.handle.PictureHandle;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.web.bind.annotation.CrossOrigin;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.io.File;
+
+@RestController
+@Api(tags = "DataSourceController", description = "数据源上传")
+@RequestMapping("/upload")
+@CrossOrigin
+public class DataSourceController {
+
+ @Autowired
+ private RedisTemplate redisTemplate;
+
+ @Autowired
+ private PictureHandle pictureHandle;
+
+ @Value("${picture.storePath}")
+ private String storePath;
+
+ /**
+ * 上传图片绝对路径到队列中
+ *
+ * @param path
+ * @return
+ */
+ @ApiOperation("根据绝对路径上传数据")
+ @RequestMapping(value = "/findPage", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
+ public CommonResult uploadPicByPath(String path) {
+
+ File file = new File(path);
+ boolean directory = file.isDirectory();
+ boolean exists = file.exists();
+ if (directory && exists) {
+ File[] files = file.listFiles();
+ if (files != null && files.length > 0) {
+ int length = files.length;
+ for (int i = 0; i < length; i++) {
+ File file1 = files[i];
+ String name = file1.getName();
+ String newPath = storePath + name;
+ File file2 = new File(newPath);
+ file1.renameTo(file2);
+ redisTemplate.opsForList().leftPush("picPath", name);
+ pictureHandle.handlePic();
+ }
+ }
+ }
+ return CommonResult.success("{}");
+ }
+}
diff --git b/src/main/java/com/objecteye/controller/DeployController.java a/src/main/java/com/objecteye/controller/DeployController.java
new file mode 100644
index 0000000..6931347
--- /dev/null
+++ a/src/main/java/com/objecteye/controller/DeployController.java
@@ -0,0 +1,252 @@
+package com.objecteye.controller;
+
+import com.alibaba.fastjson.JSONObject;
+import com.objecteye.common.CommonResult;
+import com.objecteye.entity.MonitorMainTableQueryInfo;
+import com.objecteye.entity.PageResult;
+import com.objecteye.entity.SyDeploy;
+import com.objecteye.service.DeployService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * controller
+ *
+ * @author Administrator
+ */
+@RestController
+@Api(tags = "DeployController", description = "布控管理")
+@RequestMapping("/deploy")
+@CrossOrigin
+public class DeployController {
+
+ @Autowired
+ private DeployService deployService;
+
+ /**
+ * 布控任务- 主列表查询
+ *
+ * @return
+ */
+ @ApiOperation("布控任务- 主列表查询")
+ @RequestMapping(value = "/monitorMainTableByPage", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
+ public CommonResult monitorMainTableByPage(@RequestBody MonitorMainTableQueryInfo info) {
+ PageResult pageResult = deployService.monitorMainTableByPage(info);
+ if (pageResult.getRow() == null || pageResult.getRow().size() == 0) {
+ return CommonResult.success(201, "无符合条件的数据", new PageResult<>());
+ }
+ return CommonResult.success(pageResult);
+ }
+
+ /**
+ * 返回全部列表
+ *
+ * @return
+ */
+ @ApiOperation("查看全部的布控任务")
+ @RequestMapping(value = "/findAll", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
+ public CommonResult findAll() {
+ List all = deployService.findAll();
+ if (all == null) {
+ return CommonResult.success(201, "暂无布控任务", new ArrayList<>());
+ }
+ return CommonResult.success(all);
+ }
+
+ /**
+ * 查看布控任务详细信息
+ *
+ * @return
+ */
+ @ApiOperation("查看布控任务详细信息")
+ @RequestMapping(value = "/findOne", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
+ public CommonResult findOne(@RequestBody Map param) {
+ SyDeploy syDeploy = deployService.findOne(param.get("id"));
+ if (syDeploy == null) {
+ return CommonResult.success(201, "没有找到对应任务", new ArrayList<>());
+ }
+ return CommonResult.success(syDeploy);
+ }
+
+ /**
+ * 分页返回列表
+ *
+ * @return
+ */
+ @ApiOperation("分页查看全部的布控任务")
+ @RequestMapping(value = "/findPage", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
+ public CommonResult findPage(@RequestParam Integer currentpage, @RequestParam Integer pagevolume, @RequestParam Integer deployType) {
+ SyDeploy syDeploy = new SyDeploy();
+ syDeploy.setDeployType(deployType);
+ PageResult page = deployService.findPage(syDeploy, currentpage, pagevolume);
+ if (page == null) {
+ return CommonResult.success(201, "无符合条件的数据", new PageResult<>());
+ }
+ return CommonResult.success(page);
+ }
+
+ /**
+ * 分页查看全部的布控任务内容
+ *
+ * @param pagevolume 页面容量
+ * @param currentpage 页码
+ * @param deployId 任务id
+ * @return 结果集
+ */
+ @ApiOperation("分页查看全部的布控任务内容")
+ @RequestMapping(value = "/findMonitorTaskDetail", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
+ public CommonResult findMonitorTaskDetail(@RequestParam Integer currentpage, @RequestParam Integer pagevolume, @RequestParam Integer deployId) {
+ PageResult page = deployService.findMonitorTaskDetail(deployId, currentpage, pagevolume);
+ if (page.getRow().size() == 0) {
+ return CommonResult.success(201, "无符合条件的数据", new PageResult<>());
+ }
+ return CommonResult.success(page);
+ }
+
+ /**
+ * 增加
+ *
+ * @param deploy
+ * @return
+ */
+ @ApiOperation("添加布控任务")
+ @RequestMapping(value = "/addDeployTask", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
+ public CommonResult addDeployTask(@RequestBody SyDeploy deploy) {
+ try {
+ deployService.add(deploy);
+ return CommonResult.success("操作成功");
+ } catch (Exception e) {
+ e.printStackTrace();
+ return CommonResult.failed();
+ }
+ }
+
+ /**
+ * 修改
+ *
+ * @param deploy
+ * @return
+ */
+ @ApiOperation("修改布控任务")
+ @RequestMapping(value = "/update", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
+ public CommonResult update(@RequestBody SyDeploy deploy) {
+ try {
+ deployService.update(deploy);
+ return CommonResult.success("操作成功");
+ } catch (Exception e) {
+ e.printStackTrace();
+ return CommonResult.failed();
+ }
+ }
+
+ /**
+ * 批量删除
+ *
+ * @param map
+ * @return
+ */
+ @ApiOperation("删除布控任务")
+ @RequestMapping(value = "/delete", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
+ public CommonResult delete(@RequestBody Map map) {
+ try {
+ int[] ids = map.get("ids");
+ deployService.delete(ids);
+ return CommonResult.success("操作成功");
+ } catch (Exception e) {
+ e.printStackTrace();
+ return CommonResult.failed();
+ }
+ }
+
+ /**
+ * 撤销- 布控任务撤销
+ *
+ * @param map 请求参数
+ * @return 操作状态
+ */
+ @ApiOperation("撤销- 布控任务撤销")
+ @RequestMapping(value = "/changeTaskStatus", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
+ public CommonResult changeTaskStatus(@RequestBody Map map) {
+ try {
+ Integer status = deployService.cancelOrReNewDeployTask(map.get("deployId"));
+ return CommonResult.success(status);
+ } catch (Exception e) {
+ e.printStackTrace();
+ return CommonResult.success(201, "布控时间已过期, 请更新布控时间后再操作", null);
+ }
+ }
+
+ /**
+ * 撤销- 车牌布控
+ *
+ * @param map 请求参数
+ * @return 操作状态
+ */
+ @ApiOperation("撤销- 车牌布控")
+ @RequestMapping(value = "/changeStatusPlateNum", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
+ public CommonResult changeStatusPlateNum(@RequestBody Map map) {
+ try {
+ Integer status = deployService.cancelOrReNewTaskByPlate(Integer.parseInt(map.get("deployId")), map.get("plateNumber"));
+ return CommonResult.success(status);
+ } catch (Exception e) {
+ e.printStackTrace();
+ return CommonResult.failed();
+ }
+ }
+
+ /**
+ * 撤销- 车辆布控
+ *
+ * @param map 请求参数
+ * @return 操作状态
+ */
+ @ApiOperation("撤销- 车辆布控")
+ @RequestMapping(value = "/changeStatusVehicle", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
+ public CommonResult changeStatusVehicle(@RequestBody Map map) {
+ try {
+ Integer status = deployService.cancelOrReNewTaskByVehicleId(Integer.parseInt(map.get("deployId")),
+ Integer.parseInt(map.get("featureId")), map.get("id"));
+ return CommonResult.success(status);
+ } catch (Exception e) {
+ e.printStackTrace();
+ return CommonResult.failed();
+ }
+ }
+
+ /**
+ * 撤销- 人像布控
+ *
+ * @param map 请求参数
+ * @return 操作状态
+ */
+ @ApiOperation("撤销- 人像布控")
+ @RequestMapping(value = "/changeStatusPerson", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
+ public CommonResult changeStatusPerson(@RequestBody Map map) {
+ try {
+ Integer status = deployService.cancelOrReNewTaskByPersonId(Integer.parseInt(map.get("deployId")),
+ Integer.parseInt(map.get("featureId")), Integer.parseInt(map.get("id")));
+ return CommonResult.success(status);
+ } catch (Exception e) {
+ e.printStackTrace();
+ return CommonResult.failed();
+ }
+ }
+
+ /**
+ * 获取底库的相关信息
+ *
+ * @param map 请求参数
+ * @return 操作状态
+ */
+ @ApiOperation("获取底库的相关信息")
+ @RequestMapping(value = "/getLibMsgById", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
+ public JSONObject getLibMsgById(@RequestBody Map map) {
+ return deployService.getLibMsgById(map.get("id"));
+ }
+}
diff --git b/src/main/java/com/objecteye/controller/EquipmentController.java a/src/main/java/com/objecteye/controller/EquipmentController.java
new file mode 100644
index 0000000..a7c4c4e
--- /dev/null
+++ a/src/main/java/com/objecteye/controller/EquipmentController.java
@@ -0,0 +1,173 @@
+package com.objecteye.controller;
+
+import com.objecteye.common.CommonResult;
+import com.objecteye.entity.PageResult;
+import com.objecteye.entity.SyEquipment;
+import com.objecteye.service.EquipmentService;
+import com.objecteye.utils.GlobalUtil;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * controller
+ *
+ * @author Administrator
+ */
+@RestController
+@RequestMapping("/equipment")
+@Api(tags = "EquipmentController", description = "设备管理")
+@CrossOrigin
+public class EquipmentController {
+
+ @Autowired
+ private EquipmentService equipmentService;
+ @Autowired
+ private RedisTemplate redisTemplate;
+
+ /**
+ * 返回全部列表
+ *
+ * @return
+ */
+ @ApiOperation("分页返回全部设备")
+ @RequestMapping(value = "/findPage", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
+ public CommonResult findPage(@RequestParam int currentpage, @RequestParam int pagevolume) { //@RequestBody PagePara pagePara
+ //PageResult page1 = equipmentService.findPage(pagePara.getPage(), pagePara.getLimit());
+ PageResult page1 = equipmentService.findPage(currentpage, pagevolume);
+ if (page1 != null) {
+ return CommonResult.success(page1);
+ }
+ return CommonResult.success("", "无可用设备");
+ }
+
+ /**
+ * 增加
+ *
+ * @param equipment
+ * @return
+ */
+ @ApiOperation("添加设备")
+ @RequestMapping(value = "/add", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
+ public CommonResult add(@RequestBody SyEquipment equipment) {
+ SyEquipment byIp = equipmentService.findByIp(equipment.getEquipmentIp());
+ SyEquipment byName = equipmentService.findByName(equipment.getEquipmentName());
+ SyEquipment byPort = equipmentService.findByPort(equipment.getEquipmentPort());
+ if ((byIp == null) & (byName == null) & (byPort == null)) {
+ int count = equipmentService.add(equipment);
+ if (count > 0) {
+ return CommonResult.success(count);
+ }
+ return CommonResult.failed();
+ }
+ return CommonResult.failed("设备名称、ip、端口不能重复");
+ }
+
+ /**
+ * 修改
+ *
+ * @param equipment
+ * @return
+ */
+ @ApiOperation("更新设备")
+ @RequestMapping(value = "/update", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
+ public CommonResult update(@RequestBody SyEquipment equipment) {
+ int update = equipmentService.update(equipment);
+ if (update > 0) {
+ return CommonResult.success(update);
+ }
+ if (update == 0) {
+ return CommonResult.failed("设备名称不能重复");
+ }
+ return CommonResult.failed();
+ }
+
+ /**
+ * 获取实体
+ *
+ * @return
+ */
+ @ApiOperation("根据id查找设备")
+ @RequestMapping(value = "/findOne", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
+ public CommonResult findOne(@RequestBody Map map) {
+ Integer id = map.get("id");
+ SyEquipment equipment = equipmentService.findOne(id);
+ if (equipment != null) {
+ return CommonResult.success(equipment);
+ }
+ return CommonResult.failed("设备id无效");
+ }
+
+ /**
+ * 批量删除
+ *
+ * @return
+ */
+ @ApiOperation("删除设备")
+ @Transactional
+ @RequestMapping(value = "/delete", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
+ public CommonResult delete(@RequestBody Map map) {
+ try {
+ int[] ids = map.get("ids");
+ equipmentService.delete(ids);
+ return CommonResult.success("删除成功", "操作成功");
+ } catch (Exception e) {
+ e.printStackTrace();
+ return CommonResult.failed(e.getMessage());
+ }
+ }
+
+ /**
+ * 设备开关
+ *
+ * @param map
+ * @return
+ */
+ @ApiOperation("设备开关")
+ @RequestMapping(value = "/updateStatusById", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
+ public CommonResult updateStatusById(@RequestBody Map map) {
+ Integer id = map.get("id");
+ int i = equipmentService.updateStatusById(id);
+ if (i == -1) {
+ return CommonResult.failed("设备id无效");
+ }
+ if (i != 0) {
+ return CommonResult.success("设备状态更新成功");
+ }
+ return CommonResult.failed();
+ }
+
+ /**
+ * 设备开关
+ *
+ * @param map id区域id
+ * @return 设备是否可以删除
+ */
+ @ApiOperation("设备是否可以删除")
+ @RequestMapping(value = "/checkDelete", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
+ public CommonResult checkDelete(@RequestBody Map map) {
+ Integer id = map.get("id");
+ boolean canDel = true;
+ List msgList = new ArrayList<>();
+ if (redisTemplate.opsForHash().hasKey(GlobalUtil.IPWITHDEPLOYLIST, id)) {
+ canDel = false;
+ msgList.add("布控预警任务");
+ }
+ if (redisTemplate.opsForHash().hasKey(GlobalUtil.FORBIDDEN_TASK, id)) {
+ canDel = false;
+ msgList.add("禁行任务");
+ }
+ if (canDel) {
+ return CommonResult.success(200, "不存在设备占用情况", "");
+ } else {
+ return CommonResult.success(201, "存在" + String.join(",", msgList) + "占用设备", "");
+ }
+ }
+}
diff --git b/src/main/java/com/objecteye/controller/FeatureController.java a/src/main/java/com/objecteye/controller/FeatureController.java
new file mode 100644
index 0000000..fd7a04a
--- /dev/null
+++ a/src/main/java/com/objecteye/controller/FeatureController.java
@@ -0,0 +1,130 @@
+package com.objecteye.controller;
+
+import com.objecteye.common.CommonResult;
+import com.objecteye.entity.PageResult;
+import com.objecteye.entity.SyFeature;
+import com.objecteye.service.DeployService;
+import com.objecteye.service.FeatureService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * controller
+ *
+ * @author YU MIU
+ */
+@RestController
+@Api(tags = "FeatureController", description = "人像库管理")
+@RequestMapping("/feature")
+@CrossOrigin
+public class FeatureController {
+
+ @Autowired
+ private FeatureService featureService;
+ @Autowired
+ private DeployService deployService;
+
+ /**
+ * 人像库下拉框
+ *
+ * @return
+ */
+ @ApiOperation("人像库下拉框")
+ @RequestMapping(value = "/findAllName", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
+ public CommonResult findAllName() {
+ List