Sfoglia il codice sorgente

Merge remote-tracking branch 'origin/dev' into dev

# Conflicts:
#	zd-modules/zd-modules-system/src/main/java/com/zd/system/service/impl/SysStudentServiceImpl.java
chaiyunlong 2 anni fa
parent
commit
8595cdd3c4
37 ha cambiato i file con 291 aggiunte e 281 eliminazioni
  1. 4 4
      zd-auth/src/main/java/com/zd/auth/controller/TokenController.java
  2. 2 2
      zd-common/common-core/src/main/java/com/zd/common/core/aspect/InnerAuthAspect.java
  3. 2 4
      zd-common/common-core/src/main/java/com/zd/common/core/aspect/ResponseAdvice.java
  4. 8 5
      zd-common/common-core/src/main/java/com/zd/common/core/exception/GlobalExceptionHandler.java
  5. 2 5
      zd-gateway/src/main/java/com/zd/gateway/filter/AuthFilter.java
  6. 0 2
      zd-gateway/src/main/java/com/zd/gateway/filter/ValidateCodeFilter.java
  7. 1 1
      zd-gateway/src/main/java/com/zd/gateway/handler/GatewayExceptionHandler.java
  8. 1 1
      zd-gateway/src/main/java/com/zd/gateway/handler/SentinelFallbackHandler.java
  9. 8 1
      zd-model/src/main/java/com/zd/model/entity/SubQueryConfig.java
  10. 0 4
      zd-modules/zd-algorithm/src/main/java/com/zd/alg/iot/vmp/vmanager/gb28181/alarm/AlarmInfoController.java
  11. 5 2
      zd-modules/zd-base/src/main/java/com/zd/base/app/controller/LaboratoryApi.java
  12. 15 4
      zd-modules/zd-base/src/main/java/com/zd/base/files/bigupload/service/impl/UploadServiceImpl.java
  13. 5 4
      zd-modules/zd-base/src/main/java/com/zd/base/files/file/controller/SysFileController.java
  14. 1 1
      zd-modules/zd-base/src/main/java/com/zd/base/files/file/service/FastDfsSysFileServiceImpl.java
  15. 1 1
      zd-modules/zd-base/src/main/java/com/zd/base/files/file/service/ISysFileService.java
  16. 2 2
      zd-modules/zd-base/src/main/java/com/zd/base/files/file/service/LocalSysFileServiceImpl.java
  17. 1 1
      zd-modules/zd-base/src/main/java/com/zd/base/files/file/service/MinioSysFileServiceImpl.java
  18. 30 11
      zd-modules/zd-base/src/main/java/com/zd/base/files/file/utils/FileUploadUtils.java
  19. 0 1
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/controller/LabHardwareController.java
  20. 3 2
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/controller/LabSubMangerController.java
  21. 15 0
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/domain/LabHardware.java
  22. 6 0
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/mapper/LabHardwareMapper.java
  23. 2 5
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabSensorServiceImpl.java
  24. 15 7
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabSubjectManagerService.java
  25. 1 1
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/SubQueryManager.java
  26. 20 0
      zd-modules/zd-modules-laboratory/src/main/resources/mapper/laboratory/LabHardwareMapper.xml
  27. 1 9
      zd-modules/zd-modules-system/src/main/java/com/zd/system/service/impl/SysDeptManager.java
  28. 0 7
      zd-modules/zd-modules-system/src/main/java/com/zd/system/service/impl/SysDeptServiceImpl.java
  29. 3 5
      zd-modules/zd-modules-system/src/main/java/com/zd/system/service/impl/SysPermissionServiceImpl.java
  30. 25 36
      zd-modules/zd-modules-system/src/main/java/com/zd/system/service/impl/SysPermitMenuServiceImpl.java
  31. 1 5
      zd-modules/zd-modules-system/src/main/java/com/zd/system/service/impl/SysPermitServiceImpl.java
  32. 9 11
      zd-modules/zd-modules-system/src/main/java/com/zd/system/service/impl/SysRoleServiceImpl.java
  33. 21 25
      zd-modules/zd-modules-system/src/main/java/com/zd/system/service/impl/SysStudentServiceImpl.java
  34. 4 8
      zd-modules/zd-modules-system/src/main/java/com/zd/system/service/impl/SysTeacherServiceImpl.java
  35. 2 4
      zd-modules/zd-modules-system/src/main/java/com/zd/system/service/impl/SysUrlConfigServiceImpl.java
  36. 74 87
      zd-modules/zd-modules-system/src/main/java/com/zd/system/service/impl/SysUserServiceImpl.java
  37. 1 13
      zd-modules/zd-modules-system/src/main/java/com/zd/system/service/impl/TeacherServiceImpl.java

+ 4 - 4
zd-auth/src/main/java/com/zd/auth/controller/TokenController.java

@@ -72,7 +72,7 @@ public class TokenController {
                 if (userR.getCode() == HttpStatus.SUCCESS && userR.getData() != null) {
                     userInfo = userR.getData();
                 } else {
-                    throw new ServiceException("系统异常");
+                    throw new ServiceException("服务未知异常,请稍后重试");
                 }
             } else {
                 throw new ServiceException("验证码不正确", 503);
@@ -235,7 +235,7 @@ public class TokenController {
             throw new ServiceException(user.getMsg());
         }
         if (StringUtils.isNull(user.getData())) {
-            return R.fail("登录用户不存在!");
+            return R.fail("账号信息不存在");
         }
         R<LoginUser> userResult = remoteUserService.getUserInfo(user.getData().getUserName(), aioType, SecurityConstants.INNER);
         if (R.FAIL == userResult.getCode() || 503 == userResult.getCode()) {
@@ -246,7 +246,7 @@ public class TokenController {
             userInfo.setLoginType(aioType);
             userInfo.setMachineCode(machineCode);
             if (userInfo.getSysUser() == null) {
-                return R.fail("登录用户不存在!");
+                return R.fail("账号信息不存在");
             }
             Map<String, Object> map = null;
             if (type == 1) {
@@ -277,7 +277,7 @@ public class TokenController {
             }
             return R.ok(map);
         } else {
-            return R.fail("登录用户不存在!");
+            return R.fail("账号信息不存在");
         }
     }
 

+ 2 - 2
zd-common/common-core/src/main/java/com/zd/common/core/aspect/InnerAuthAspect.java

@@ -24,14 +24,14 @@ public class InnerAuthAspect implements Ordered {
         String source = ServletUtils.getRequest().getHeader(SecurityConstants.FROM_SOURCE);
         // 内部请求验证
         if (!StringUtils.equals(SecurityConstants.INNER, source)) {
-            throw new InnerAuthException("没有内部访问权限,不允许访问");
+            throw new InnerAuthException("无权限访问");
         }
 
         String userid = ServletUtils.getRequest().getHeader(SecurityConstants.DETAILS_USER_ID);
         String username = ServletUtils.getRequest().getHeader(SecurityConstants.DETAILS_USERNAME);
         // 用户信息验证
         if (innerAuth.isUser() && (StringUtils.isEmpty(userid) || StringUtils.isEmpty(username))) {
-            throw new InnerAuthException("没有设置用户信息,不允许访问 ");
+            throw new InnerAuthException("未知用户,不允许访问");
         }
         return point.proceed();
     }

+ 2 - 4
zd-common/common-core/src/main/java/com/zd/common/core/aspect/ResponseAdvice.java

@@ -42,10 +42,8 @@ public class ResponseAdvice implements ResponseBodyAdvice<Object> {
                                   Class<? extends HttpMessageConverter<?>> aClass,
                                   ServerHttpRequest serverHttpRequest,
                                   ServerHttpResponse serverHttpResponse) {
-
-
-        if(o instanceof TableDataInfo || o instanceof AjaxResult || o instanceof ResultData
-                || o instanceof R || o instanceof String || o instanceof Map || o instanceof WVPResult){
+        if (o instanceof TableDataInfo || o instanceof AjaxResult || o instanceof ResultData
+                || o instanceof R || o instanceof String || o instanceof Map || o instanceof WVPResult) {
             return o;
         }
 

+ 8 - 5
zd-common/common-core/src/main/java/com/zd/common/core/exception/GlobalExceptionHandler.java

@@ -32,7 +32,7 @@ public class GlobalExceptionHandler {
     public AjaxResult handlePreAuthorizeException(PreAuthorizeException e, HttpServletRequest request) {
         String requestURI = request.getRequestURI();
         log.error("请求地址'{}',权限校验失败'{}'", requestURI, e.getMessage());
-        return AjaxResult.error(HttpStatus.FORBIDDEN, "没有权限,请联系管理员");
+        return AjaxResult.error(HttpStatus.FORBIDDEN, "无操作权限,请联系管理员");
     }
 
     /**
@@ -63,7 +63,7 @@ public class GlobalExceptionHandler {
     public AjaxResult handleDuplicateKeyException(DuplicateKeyException e, HttpServletRequest request) {
         String requestURI = request.getRequestURI();
         log.error("请求地址'{}',发生主键重复异常.", requestURI, e);
-        return AjaxResult.error("存在重复数据,操作失败!");
+        return AjaxResult.error("数据重复,请修改后再操作!");
     }
 
     /**
@@ -73,7 +73,10 @@ public class GlobalExceptionHandler {
     public AjaxResult handleRuntimeException(RuntimeException e, HttpServletRequest request) {
         String requestURI = request.getRequestURI();
         log.error("请求地址'{}',发生未知异常.", requestURI, e);
-        return AjaxResult.error(e.getMessage());
+        if (e.getCause() != null) {
+            return AjaxResult.error(e.getCause().toString());
+        }
+        return AjaxResult.error(e.toString());
     }
 
     /**
@@ -112,7 +115,7 @@ public class GlobalExceptionHandler {
     @ExceptionHandler(RedisSystemException.class)
     public Object handleRedisSystemException(RedisSystemException e) {
         log.error(e.getMessage(), e);
-        return AjaxResult.error("正在重新连接...请重试!");
+        return AjaxResult.error("正在重新连接,请再次尝试!");
     }
 
     /**
@@ -122,7 +125,7 @@ public class GlobalExceptionHandler {
     public Object MaxUploadSizeExceededExceptionHandler(MaxUploadSizeExceededException e) {
         log.error("MaxUploadSizeExceededException: "+ e);
         e.printStackTrace();
-        return AjaxResult.error("上传文件太大!");
+        return AjaxResult.error("上传文件过大,请压缩后再试!");
     }
 
     /**

+ 2 - 5
zd-gateway/src/main/java/com/zd/gateway/filter/AuthFilter.java

@@ -58,17 +58,14 @@ public class AuthFilter implements GlobalFilter, Ordered {
         }
         String userStr = sops.get(getTokenKey(token));
         if (StringUtils.isEmpty(userStr)) {
-            return unauthorizedResponse(exchange, "登录状态已过期");
+            return unauthorizedResponse(exchange, "登录已过期");
         }
         JSONObject cacheObj = JSONObject.parseObject(userStr);
         String userid = cacheObj.getString("userid");
         String username = cacheObj.getString("username");
         if (StringUtils.isEmpty(userid) || StringUtils.isEmpty(username)) {
-            return unauthorizedResponse(exchange, "令牌验证失败");
+            return unauthorizedResponse(exchange, "账号认证失败");
         }
-
-        // 设置过期时间
-        //redisService.expire(getTokenKey(token), EXPIRE_TIME);
         // 设置用户信息到请求
         addHeader(mutate, SecurityConstants.DETAILS_USER_ID, userid);
         addHeader(mutate, SecurityConstants.DETAILS_USERNAME, username);

+ 0 - 2
zd-gateway/src/main/java/com/zd/gateway/filter/ValidateCodeFilter.java

@@ -44,12 +44,10 @@ public class ValidateCodeFilter extends AbstractGatewayFilterFactory<Object> {
     public GatewayFilter apply(Object config) {
         return (exchange, chain) -> {
             ServerHttpRequest request = exchange.getRequest();
-
             // 非登录/注册请求或验证码关闭,不处理
             if (!containsAnyIgnoreCase(request.getURI().getPath(), VALIDATE_URL) || Boolean.TRUE.equals(!captchaProperties.getEnabled())) {
                 return chain.filter(exchange);
             }
-
             try {
                 String rspStr = resolveBodyFromRequest(request);
                 JSONObject obj = JSON.parseObject(rspStr);

+ 1 - 1
zd-gateway/src/main/java/com/zd/gateway/handler/GatewayExceptionHandler.java

@@ -35,7 +35,7 @@ public class GatewayExceptionHandler implements ErrorWebExceptionHandler {
             ResponseStatusException responseStatusException = (ResponseStatusException) ex;
             msg = responseStatusException.getMessage();
         } else {
-            msg = "内部服务器错误";
+            msg = "服务异常,请稍后重试";
         }
         log.error("[网关异常处理]请求路径:{},异常信息:{}", exchange.getRequest().getPath(), ex.getMessage());
         return ServletUtils.webFluxResponseWriter(response, msg);

+ 1 - 1
zd-gateway/src/main/java/com/zd/gateway/handler/SentinelFallbackHandler.java

@@ -15,7 +15,7 @@ import reactor.core.publisher.Mono;
  */
 public class SentinelFallbackHandler implements WebExceptionHandler {
     private Mono<Void> writeResponse(ServerResponse response, ServerWebExchange exchange) {
-        return ServletUtils.webFluxResponseWriter(exchange.getResponse(), "请求超过最大数,请稍后再试");
+        return ServletUtils.webFluxResponseWriter(exchange.getResponse(), "当前请求量过大,请稍后再试");
     }
 
     @Override

+ 8 - 1
zd-model/src/main/java/com/zd/model/entity/SubQueryConfig.java

@@ -77,7 +77,10 @@ public class SubQueryConfig {
      */
     public static final SubQueryConfig subQueryConfigWran;
 
-
+    /**
+     * 硬件类型集合
+     */
+    public Long[] typeCollection;
 
     static {
 
@@ -202,6 +205,10 @@ public class SubQueryConfig {
         this.conversionDictSubName = conversionDictSubName;
     }
 
+    public Long[] getTypeCollection() {        return typeCollection;    }
+
+    public void setTypeCollection(Long[] typeCollection) {        this.typeCollection = typeCollection;    }
+
     public static enum mode{
         //无权限
         none,

+ 0 - 4
zd-modules/zd-algorithm/src/main/java/com/zd/alg/iot/vmp/vmanager/gb28181/alarm/AlarmInfoController.java

@@ -71,8 +71,6 @@ public class AlarmInfoController {
         if (StringUtils.isEmpty(alarmType)) alarmType = null;
         if (StringUtils.isEmpty(startTime)) startTime = null;
         if (StringUtils.isEmpty(endTime)) endTime = null;
-
-
         try {
             if (startTime != null)  format.parse(startTime);
             if (endTime != null)  format.parse(endTime);
@@ -129,6 +127,4 @@ public class AlarmInfoController {
         wvpResult.setData(count);
         return new ResponseEntity<WVPResult<String>>(wvpResult, HttpStatus.OK);
     }
-
-
 }

+ 5 - 2
zd-modules/zd-base/src/main/java/com/zd/base/app/controller/LaboratoryApi.java

@@ -36,13 +36,16 @@ public class LaboratoryApi {
 
     /**
      * 预警 :实验室详情
+     * typeCollection 硬件类型集合(非必填)
      * @return
      */
     @GetMapping("/{id}")
     @ApiOperation("实验室详情")
-    public R querySub(@PathVariable("id") Long id)
+    public R querySub(@PathVariable("id") Long id,Long[] typeCollection)
     {
-        return remoteSubQueryService.getSafeWarnCount(id, SubQueryConfig.subQueryConfigWran);
+        SubQueryConfig subQueryConfig = SubQueryConfig.subQueryConfigWran;
+        subQueryConfig.setTypeCollection(typeCollection);
+        return remoteSubQueryService.getSafeWarnCount(id, subQueryConfig);
     }
 
     /**

+ 15 - 4
zd-modules/zd-base/src/main/java/com/zd/base/files/bigupload/service/impl/UploadServiceImpl.java

@@ -18,6 +18,7 @@ import java.io.*;
 import java.net.UnknownHostException;
 import java.rmi.ServerException;
 import java.util.*;
+import java.util.concurrent.TimeUnit;
 
 
 /**
@@ -100,11 +101,19 @@ public class UploadServiceImpl implements IUploadService {
     @Override
     public String mergeChunk(String identifier, String fileName, Integer totalChunks) throws IOException {
         String suffix = fileName.substring(fileName.lastIndexOf("."));
+        String key = FILE_PREFIX + identifier;
         if(null==suffix){
+            redisTemplate.opsForHash().delete(key);
             throw new RuntimeException("文件格式有误");
         }
-        fileName= UUID.randomUUID().toString()+suffix;
-        return mergeChunks(identifier, fileName, totalChunks);
+        String fileUrl = (String) redisTemplate.opsForHash().get(key, "fileUrl");
+        if(fileUrl == null){
+            fileName= UUID.randomUUID().toString()+suffix;
+            fileUrl = mergeChunks(identifier, fileName, totalChunks);
+            redisTemplate.opsForHash().put(key, "fileUrl", fileUrl);
+        }
+
+        return fileUrl;
     }
 
     /**
@@ -202,6 +211,7 @@ public class UploadServiceImpl implements IUploadService {
      */
     private synchronized long saveToRedis(FileChunkDTO chunkDTO) {
         Set<Integer> uploaded = (Set<Integer>) redisTemplate.opsForHash().get(FILE_PREFIX + chunkDTO.getIdentifier(), "uploaded");
+        String key = FILE_PREFIX + chunkDTO.getIdentifier();
         if (uploaded == null) {
             uploaded = new HashSet<>(Arrays.asList(chunkDTO.getChunkNumber()));
             HashMap<String, Object> objectObjectHashMap = new HashMap<>();
@@ -209,10 +219,11 @@ public class UploadServiceImpl implements IUploadService {
             objectObjectHashMap.put("totalChunks", chunkDTO.getTotalChunks());
             objectObjectHashMap.put("totalSize", chunkDTO.getTotalSize());
             objectObjectHashMap.put("path", chunkDTO.getFilename());
-            redisTemplate.opsForHash().putAll(FILE_PREFIX + chunkDTO.getIdentifier(), objectObjectHashMap);
+            redisTemplate.opsForHash().putAll(key, objectObjectHashMap);
+            redisTemplate.expire(key, 5, TimeUnit.DAYS);
         } else {
             uploaded.add(chunkDTO.getChunkNumber());
-            redisTemplate.opsForHash().put(FILE_PREFIX + chunkDTO.getIdentifier(), "uploaded", uploaded);
+            redisTemplate.opsForHash().put(key, "uploaded", uploaded);
         }
         return uploaded.size();
     }

+ 5 - 4
zd-modules/zd-base/src/main/java/com/zd/base/files/file/controller/SysFileController.java

@@ -2,7 +2,7 @@ package com.zd.base.files.file.controller;
 
 import com.zd.base.files.file.enums.FileEnum;
 import com.zd.base.files.file.service.ISysFileService;
-import com.zd.base.files.file.utils.FileUploadUtils;
+import com.zd.common.core.utils.DateUtils;
 import com.zd.common.core.utils.file.FileUtils;
 import com.zd.model.domain.R;
 import com.zd.model.entity.SysFile;
@@ -11,10 +11,10 @@ import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.multipart.MultipartFile;
 
-import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
@@ -35,8 +35,9 @@ public class SysFileController {
      * 文件上传请求
      */
     @PostMapping("/upload")
-    public R<SysFile> upload(MultipartFile file) {
+    public R<SysFile> upload(MultipartFile file, @RequestParam(required = false, value = "ifAsy") Boolean ifAsy) {
         try {
+            log.info("文件开始上传时间:" + DateUtils.getTime());
             String fileSuffix = "";
             String originalFilename = file.getOriginalFilename();
             if (FileEnum.getPrefix(originalFilename) != null) {
@@ -47,7 +48,7 @@ public class SysFileController {
             List<String> list = Arrays.asList(".jpg", ".png", ".jpeg", ".gif", ".bmp", ".ico", ".pdf", ".doc", ".docx", ".ppt", ".pptx", ".mp3", ".mp4", ".avi", ".xls", ".xlsx", ".csv", ".txt", ".apk");
             if (list.contains(fileSuffix.toLowerCase())) {
                 // 上传并返回访问地址
-                String url = sysFileService.uploadFile(file);
+                String url = sysFileService.uploadFile(file, ifAsy);
                 SysFile sysFile = new SysFile();
                 sysFile.setName(FileUtils.getName(url));
                 sysFile.setUrl(url);

+ 1 - 1
zd-modules/zd-base/src/main/java/com/zd/base/files/file/service/FastDfsSysFileServiceImpl.java

@@ -32,7 +32,7 @@ public class FastDfsSysFileServiceImpl implements ISysFileService {
      * @throws Exception
      */
     @Override
-    public String uploadFile(MultipartFile file) throws Exception {
+    public String uploadFile(MultipartFile file, Boolean ifAsy) throws Exception {
         StorePath storePath = storageClient.uploadFile(file.getInputStream(), file.getSize(),
                 FilenameUtils.getExtension(file.getOriginalFilename()), null);
         return domain + "/" + storePath.getFullPath();

+ 1 - 1
zd-modules/zd-base/src/main/java/com/zd/base/files/file/service/ISysFileService.java

@@ -15,5 +15,5 @@ public interface ISysFileService {
      * @return 访问地址
      * @throws Exception
      */
-    public String uploadFile(MultipartFile file) throws Exception;
+    public String uploadFile(MultipartFile file, Boolean ifAsy) throws Exception;
 }

+ 2 - 2
zd-modules/zd-base/src/main/java/com/zd/base/files/file/service/LocalSysFileServiceImpl.java

@@ -24,8 +24,8 @@ public class LocalSysFileServiceImpl implements ISysFileService {
      * @throws Exception
      */
     @Override
-    public String uploadFile(MultipartFile file) throws Exception {
-        String name = FileUploadUtils.upload(ResourcesConfig.filePath, file);
+    public String uploadFile(MultipartFile file, Boolean ifAsy) throws Exception {
+        String name = FileUploadUtils.upload(ResourcesConfig.filePath, file, ifAsy);
         //TODO 去掉拼接前缀
 //        String urlPrefix = domain;
 //        String localIP = "127.0.0.1";

+ 1 - 1
zd-modules/zd-base/src/main/java/com/zd/base/files/file/service/MinioSysFileServiceImpl.java

@@ -30,7 +30,7 @@ public class MinioSysFileServiceImpl implements ISysFileService {
      * @throws Exception
      */
     @Override
-    public String uploadFile(MultipartFile file) throws Exception {
+    public String uploadFile(MultipartFile file, Boolean ifAsy) throws Exception {
         String fileName = FileUploadUtils.extractFilename(file);
         PutObjectArgs args = PutObjectArgs.builder()
                 .bucket(minioConfig.getBucketName())

+ 30 - 11
zd-modules/zd-base/src/main/java/com/zd/base/files/file/utils/FileUploadUtils.java

@@ -1,5 +1,6 @@
 package com.zd.base.files.file.utils;
 
+import cn.hutool.core.thread.ThreadUtil;
 import com.zd.common.core.exception.ServiceException;
 import com.zd.common.core.exception.file.FileNameLengthLimitExceededException;
 import com.zd.common.core.exception.file.FileSizeLimitExceededException;
@@ -8,6 +9,7 @@ import com.zd.common.core.utils.DateUtils;
 import com.zd.common.core.utils.IdUtils;
 import com.zd.common.core.utils.StringUtils;
 import com.zd.common.core.utils.file.MimeTypeUtils;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.io.FilenameUtils;
 import org.springframework.web.multipart.MultipartFile;
 
@@ -19,6 +21,7 @@ import java.io.IOException;
  *
  * @author zd
  */
+@Slf4j
 public class FileUploadUtils {
     /**
      * 默认大小 50M
@@ -38,9 +41,9 @@ public class FileUploadUtils {
      * @return 文件名称
      * @throws IOException
      */
-    public static final String upload(String baseDir, MultipartFile file) throws IOException {
+    public static final String upload(String baseDir, MultipartFile file, Boolean ifAsy) throws IOException {
         try {
-            return upload(baseDir, file, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION);
+            return upload(baseDir, file, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION, ifAsy);
         } catch (Exception e) {
             throw new IOException(e.getMessage(), e);
         }
@@ -58,7 +61,7 @@ public class FileUploadUtils {
      * @throws IOException                          比如读写文件出错时
      * @throws InvalidExtensionException            文件校验异常
      */
-    public static final String upload(String baseDir, MultipartFile file, String[] allowedExtension)
+    public static final String upload(String baseDir, MultipartFile file, String[] allowedExtension, Boolean ifAsy)
             throws FileSizeLimitExceededException, IOException, FileNameLengthLimitExceededException,
             InvalidExtensionException {
         int fileNamelength = file.getOriginalFilename().length();
@@ -71,9 +74,28 @@ public class FileUploadUtils {
 
         String fileName = extractFilename(file);
 
-        File desc = getAbsoluteFile(baseDir, fileName);
-        file.transferTo(desc);
+        if(ifAsy == null || !ifAsy){
+            File desc = getAbsoluteFile(baseDir, fileName);
+            file.transferTo(desc);
+        }else {
+            ThreadUtil.execute(new Runnable() {
+                @Override
+                public void run() {
+                    try {
+                        File desc = getAbsoluteFile(baseDir, fileName);
+                        file.transferTo(desc);
+                        log.info("文件异步上传成功:" + fileName);
+                        log.info("文件成功上传时间:" + DateUtils.getTime());
+                    } catch (IOException e) {
+                        e.printStackTrace();
+                        log.error("文件异步上传出现异常:" + e.getMessage());
+                    }
+                }
+            });
+        }
+
         String pathFileName = getPathFileName(fileName);
+        log.info("文件结束上传时间:" + DateUtils.getTime());
         return pathFileName;
     }
 //
@@ -112,13 +134,10 @@ public class FileUploadUtils {
      * 编码文件名
      */
     public static final String extractFilename(MultipartFile file) {
-        String fileName = file.getOriginalFilename();
-        String extension = getExtension(file);
-        fileName = DateUtils.datePath() + "/" + IdUtils.fastUUID() + "." + extension;
-        return fileName;
+        return DateUtils.datePath() + "/" + IdUtils.fastUUID() + "." + getExtension(file);
     }
 
-    private static final File getAbsoluteFile(String uploadDir, String fileName) throws IOException {
+    private static final File getAbsoluteFile(String uploadDir, String fileName){
         File desc = new File(uploadDir + File.separator + fileName);
 
         if (!desc.exists()) {
@@ -129,7 +148,7 @@ public class FileUploadUtils {
         return desc.isAbsolute() ? desc : desc.getAbsoluteFile();
     }
 
-    private static final String getPathFileName(String fileName) throws IOException {
+    private static final String getPathFileName(String fileName){
         String pathFileName = "/" + fileName;
         return pathFileName;
     }

+ 0 - 1
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/controller/LabHardwareController.java

@@ -271,7 +271,6 @@ public class LabHardwareController extends BaseController {
         List<Long> ids = new ArrayList<>();
         ids.add(1L);//电源开关
         ids.add(2L);//智能通风
-        ids.add(10L);//一键灭火
         ytjVo.setIds(ids);
         List<LabHardware> listkzsb=labHardwareService.selectNewLabHardwareByTypes(ytjVo);
 

+ 3 - 2
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/controller/LabSubMangerController.java

@@ -104,13 +104,14 @@ public class LabSubMangerController extends BaseController {
      * 查询实验室详情
      * @param id 实验室ID
      * @param type 1 只查硬件数据, 0 查全部详情
+     * @param typeCollection   设备类型集合(非必须)
      * @return
      */
     @ApiOperation("查询实验室详情")
     @GetMapping("/query/{id}/{type}")
     @PreAuthorize(hasPermi = PerPrefix.LABORATORY_SUBJECT + PerFun.QUERY)
-    public ResultData<LabSubjectControllerVO> querySubById(@PathVariable("id") Long id, @PathVariable("type") Integer type) {
-        return ResultData.success(subjectManagerService.querySubById(id, type));
+    public ResultData<LabSubjectControllerVO> querySubById(@PathVariable("id") Long id, @PathVariable("type") Integer type,Long[] typeCollection) {
+        return ResultData.success(subjectManagerService.querySubById(id, type,typeCollection));
     }
 
     /**

+ 15 - 0
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/domain/LabHardware.java

@@ -11,6 +11,7 @@ import io.swagger.annotations.ApiModelProperty;
 import org.hibernate.validator.constraints.Length;
 
 import java.util.Date;
+import java.util.List;
 
 /**
  * 硬件对象 lab_hardware
@@ -205,6 +206,12 @@ public class LabHardware extends BaseEntity {
     @ApiModelProperty(value = "是否灭火主机")
     private Integer isPcfire;
 
+    @ApiModelProperty(value = "设备类型集合")
+    private Long[] typeCollection;
+
+    @ApiModelProperty(value = "实验室id集合")
+    private Long[] subIds;
+
     public Integer getManufacturerType() {
         return manufacturerType;
     }
@@ -495,4 +502,12 @@ public class LabHardware extends BaseEntity {
     public void setControlScope(String controlScope) {
         this.controlScope = controlScope;
     }
+
+    public Long[] getTypeCollection() {        return typeCollection;    }
+
+    public void setTypeCollection(Long[] typeCollection) {        this.typeCollection = typeCollection;    }
+
+    public Long[] getSubIds() {        return subIds;    }
+
+    public void setSubIds(Long[] subIds) {        this.subIds = subIds;    }
 }

+ 6 - 0
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/mapper/LabHardwareMapper.java

@@ -28,6 +28,12 @@ public interface LabHardwareMapper {
      */
     List<LabHardware> selectLabHardwareBySubIds(Long... ids);
 
+    /***
+     * 硬件查询
+     * @param hardware
+     * @return
+     */
+    List<LabHardware> selectLabHardwareByParameter(LabHardware hardware);
 
     /**
      * 查询硬件列表-根据实验室IDS(排除一键灭火类型)

+ 2 - 5
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabSensorServiceImpl.java

@@ -147,7 +147,7 @@ public class LabSensorServiceImpl implements ILabSensorService {
         Object subjectStr=redisService.getCacheObject(getKey(GatewayNum));
         Long subId=null;
         if(null!=subjectStr && !"".equals(subjectStr) ){
-            logger.error("num:"+GatewayNum+"subjectStr:"+subjectStr);
+            //logger.error("num:"+GatewayNum+"subjectStr:"+subjectStr);
             subId=Long.parseLong(subjectStr.toString());
         }
 
@@ -204,7 +204,7 @@ public class LabSensorServiceImpl implements ILabSensorService {
             subId=aLong;
             redisService.setCacheObject(getKey(GatewayNum),aLong,5L, TimeUnit.MINUTES);
         }
-        logger.error("num:"+GatewayNum+"subId:"+subId);
+        //logger.error("num:"+GatewayNum+"subId:"+subId);
         return subId;
     }
 
@@ -218,9 +218,6 @@ public class LabSensorServiceImpl implements ILabSensorService {
     @Override
     public int updateLabSensor(LabSensor labSensor) {
         labSensor.setUpdateTime(DateUtils.getNowDate());
-
-
-
         LabSensor old = labSensorMapper.selectLabSensorById(labSensor.getId());
         int i = labSensorMapper.updateLabSensor(labSensor);
         if(i==1)

+ 15 - 7
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabSubjectManagerService.java

@@ -554,12 +554,12 @@ public class LabSubjectManagerService {
 //         return createSubControllerVO(labSubjects, true, true, true, true, true);
     }
 
-    public LabSubjectControllerVO querySubById(Long id, Integer type) {
+    public LabSubjectControllerVO querySubById(Long id, Integer type,Long[] typeCollection) {
         LabSubject subject = new LabSubject();
         subject.setId(id);
         List<LabSubjectVO> labSubjects = subjectService.selectLabSubjectListAuthByPc(subject);
-        List<LabSubjectControllerVO> list = createSubControllerVO2(labSubjects, true, true, true, true, true);
-        if(list.size() > 0){
+        List<LabSubjectControllerVO> list = createSubControllerVO2(labSubjects,typeCollection, true, true, true, true, true);
+        if(list !=null && list.size() > 0){
             LabSubjectControllerVO subjectControllerVO = list.get(0);
             subjectControllerVO.setSafeUserNameAdminPhone(labSubjectMapper.queryUserNameBySafeUserInfo(subjectControllerVO.getSafeUserId()));
             subjectControllerVO.setSafeUserName(labSubjectMapper.queryUserNameBySafeUserId(subjectControllerVO.getSafeUserId()));
@@ -1211,7 +1211,7 @@ public class LabSubjectManagerService {
      * @return
      */
     @Deprecated
-    private List<LabSubjectControllerVO> createSubControllerVO2(List<? extends LabSubject> labSubjects, boolean flag, boolean iflabSubClassVOS, boolean iflabHardwares, boolean iflabSensors, boolean ifFunction) {
+    private List<LabSubjectControllerVO> createSubControllerVO2(List<? extends LabSubject> labSubjects,Long[] typeCollection, boolean flag, boolean iflabSubClassVOS, boolean iflabHardwares, boolean iflabSensors, boolean ifFunction) {
         List<LabSubjectControllerVO> list = null;
         if (CollUtil.isNotEmpty(labSubjects)) {
             Long[] longs = labSubjects.stream().map(a -> a.getId()).toArray(Long[]::new);
@@ -1223,7 +1223,11 @@ public class LabSubjectManagerService {
             List<LabHardware> labHardwares = null;
             if (iflabHardwares) {
                 //1.可控设备
-                labHardwares = hardwareMapper.selectLabHardwareBySubIds(longs);
+                //labHardwares = hardwareMapper.selectLabHardwareBySubIds(longs);
+                LabHardware hardware = new LabHardware();
+                hardware.setSubIds(longs);
+                hardware.setTypeCollection(typeCollection);
+                labHardwares = hardwareMapper.selectLabHardwareByParameter(hardware);
             }
             List<LabSensor> labSensors = null;
             boolean flagUpdate = false;
@@ -1347,9 +1351,13 @@ public class LabSubjectManagerService {
      * @return
      */
     @Async("labExecutor")
-    public CompletableFuture<Integer> queryHardwares(Map<Long, SubDiyVO> subDiyVOMap, Long... longs) {
+    public CompletableFuture<Integer> queryHardwares(Long[] typeCollection,Map<Long, SubDiyVO> subDiyVOMap, Long... longs) {
         int re = 0;
-        List<LabHardware> labHardwares = hardwareMapper.selectLabHardwareBySubIds(longs);
+        //List<LabHardware> labHardwares = hardwareMapper.selectLabHardwareBySubIds(longs);
+        LabHardware lhd = new LabHardware();
+        lhd.setSubIds(longs);
+        lhd.setTypeCollection(typeCollection);
+        List<LabHardware> labHardwares = hardwareMapper.selectLabHardwareByParameter(lhd);
         //传感器和可控设备都转为vo数据,并映射为map表
         Map<Long, List<HardwareCVO>> mapHardwareCVO = Optional.ofNullable(labHardwares).orElse(new ArrayList<>(0)).stream().map(a -> {
             HardwareCVO hardware = getHardwareCVO(a);

+ 1 - 1
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/SubQueryManager.java

@@ -244,7 +244,7 @@ public class SubQueryManager {
         //===================硬件设备开始
         if(subQueryConfig.getHardware())
         {
-            CompletableFuture<Integer> integerCompletableFuture = subjectManagerService.queryHardwares(subDiyVOMap, longs);
+            CompletableFuture<Integer> integerCompletableFuture = subjectManagerService.queryHardwares(subQueryConfig.getTypeCollection(),subDiyVOMap, longs);
             completableFutures.add(integerCompletableFuture);
         }
         //===================硬件设备结束

+ 20 - 0
zd-modules/zd-modules-laboratory/src/main/resources/mapper/laboratory/LabHardwareMapper.xml

@@ -213,6 +213,26 @@
         </foreach>
     </select>
 
+    <!--   硬件设备查询 -->
+    <select id="selectLabHardwareByParameter" resultMap="LabHardwareResult">
+        <include refid="selectLabHardwareVo"/>
+        <where>
+            <if test="subIds != null and subIds.length > 0">
+                and xx.subject_id in
+                <foreach item="id" collection="subIds" open="(" separator="," close=")">
+                    #{id}
+                </foreach>
+            </if>
+
+            <if test="typeCollection != null and typeCollection.length > 0">
+                and xx.type in
+                <foreach item="item" collection="typeCollection" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+        </where>
+    </select>
+
     <!--   通过实验室ids查询设备 -->
     <select id="selLabHardwareBySubIds" resultMap="LabHardwareResult">
         <include refid="selectLabHardwareVo"/>

+ 1 - 9
zd-modules/zd-modules-system/src/main/java/com/zd/system/service/impl/SysDeptManager.java

@@ -36,14 +36,11 @@ public class SysDeptManager {
     @Autowired
     RemoteLaboratoryService remoteLaboratoryService;
 
-//    @DataScope(deptAlias = "d")
+    //@DataScope(deptAlias = "d")
     @Deprecated
     public List<SysDeptListVO> querySysDeptListVO(SysDept dept) {
-
         List<SysDept> depts = deptMapper.selectDeptList(dept);
-
         //组合人数、实验室数量信息
-
         return joinDetailCount(depts);
     }
 
@@ -64,15 +61,11 @@ public class SysDeptManager {
         //因为现在楼栋和组织机构没有分开,并且在实验室使用两个字段存储(组织机构中院系和楼栋关系的改变会导致,实验室中院系与楼栋关系的不一致)
         //所以获取也分两种
         //2.1 查楼栋下的实验是
-
         //2.2 查院系下的实验室
-
         //3 组合对应数量到楼栋和院系
         //4 计算根节点的数量 , 根节点的数量是院系数量之和
         //4.1 人员之和和实验室之和计算不一样 ,人员是下级加上自己的等于自己总的
         //4.2 实验室里院系不能加下级,因为下级是楼,院系的数量已经包括楼了,但是楼之上的节点需要求总
-
-
         //5 算球 ,直接交给前端计算 ,我只给出每个节点的数据(院系不找实验室数量,只要楼栋的实验室就可以解决这个问题) 这样最简单
         //存在的问题,如果数据权限不可见”楼栋“则没有实验室数量
         //5.1 查询本级人数
@@ -102,5 +95,4 @@ public class SysDeptManager {
         }).collect(Collectors.toList());
 
     }
-
 }

+ 0 - 7
zd-modules/zd-modules-system/src/main/java/com/zd/system/service/impl/SysDeptServiceImpl.java

@@ -67,7 +67,6 @@ public class SysDeptServiceImpl implements ISysDeptService {
         }else{
             dept.setParentId(sysDept.getParentId());
         }
-
         List<SysDept> depts = deptMapper.treeselectByUser(dept);
         return depts;
     }
@@ -412,9 +411,6 @@ public class SysDeptServiceImpl implements ISysDeptService {
                 lineCompletion = true;
             }
         }
-//        if(lineCompletion){
-//
-//        }
         return 1;
     }
 
@@ -437,7 +433,6 @@ public class SysDeptServiceImpl implements ISysDeptService {
 
     @Override
     public SysDept updateDeptSign(SysDept dept) {
-
         SysDept sysDept = new SysDept();
         sysDept.setDeptId(dept.getDeptId());
         sysDept.setDeptSign(dept.getDeptSign());
@@ -451,10 +446,8 @@ public class SysDeptServiceImpl implements ISysDeptService {
      */
     @Override
     public Map<String, Object> queryDeptSignByUserId(Long userId) {
-
         String deptSignUrl = deptMapper.queryDeptSignByUserId(userId);
         Map<String, Object> map = new HashMap<>();
-
         map.put("isUpload", StringUtils.isNotBlank(deptSignUrl) ? true : false);
         map.put("deptSignUrl", deptSignUrl);
         return map;

+ 3 - 5
zd-modules/zd-modules-system/src/main/java/com/zd/system/service/impl/SysPermissionServiceImpl.java

@@ -50,18 +50,16 @@ public class SysPermissionServiceImpl implements ISysPermissionService {
         if (SysUser.isAdmin(sysUser.getUserId())) {
             perms.add("*:*:*");
         } else {
-            if(UserConstants.USER_TYPE_STUDENT.equals(sysUser.getUserType())){
+            if (UserConstants.USER_TYPE_STUDENT.equals(sysUser.getUserType())) {
                 // TODO 学生权限暂处理,项目拆分之后需要删除
                 perms.addAll(menuService.selectMenuByStudent());
-            }else {
+            } else {
                 Set<String> data = menuService.selectNewMenuPermsByUserId(sysUser.getUserId());
 
-                if(data.size() == 0 && UserConstants.USER_TYPE_TEACHER.equals(sysUser.getUserType())){
+                if (data.size() == 0 && UserConstants.USER_TYPE_TEACHER.equals(sysUser.getUserType())) {
                     data = menuService.selectMenuByTeacher();
                 }
                 perms.addAll(data);
-                //perms.addAll(menuService.selectMenuPermsByUserId(userId));
-
             }
         }
         return perms;

+ 25 - 36
zd-modules/zd-modules-system/src/main/java/com/zd/system/service/impl/SysPermitMenuServiceImpl.java

@@ -99,25 +99,22 @@ public class SysPermitMenuServiceImpl implements ISysPermitMenuService {
     @Override
     public List<SysPermitInfo> selectPerMitByUserId(SysUser sysUser) {
         List<SysPermitInfo> list;
-        if(UserConstants.USER_TYPE_SUPPLIER.equals(sysUser.getUserType())){
+        if (UserConstants.USER_TYPE_SUPPLIER.equals(sysUser.getUserType())) {
             return null;
-        }else if(UserConstants.USER_TYPE_STUDENT.equals(sysUser.getUserType())){
+        } else if (UserConstants.USER_TYPE_STUDENT.equals(sysUser.getUserType())) {
             list = sysPermitMenuMapper.selectPerMitByStudent();
-        }else {
+        } else {
             list = sysPermitMenuMapper.selectPerMitByUserId(sysUser.getUserId());
 
-            if(list.size() == 0 && UserConstants.USER_TYPE_TEACHER.equals(sysUser.getUserType())){
+            if (list.size() == 0 && UserConstants.USER_TYPE_TEACHER.equals(sysUser.getUserType())) {
                 list = sysPermitMenuMapper.selectPerMitByTeacher();
             }
         }
-
-        if(CollectionUtils.isEmpty(list) && !sysUser.isAdmin()){
-//            throw new PreAuthorizeException();
-            throw new ServiceException("用户未配置菜单权限,请联系管理员!", 530);
+        if (CollectionUtils.isEmpty(list) && !sysUser.isAdmin()) {
+            throw new ServiceException("无操作权限,请联系管理员", 530);
         }
-
         for (SysPermitInfo sysPermitInfo : list) {
-            if(sysPermitInfo.getDataScope() == 3 && sysUser.getDept().getDeptId() != null){
+            if (sysPermitInfo.getDataScope() == 3 && sysUser.getDept().getDeptId() != null) {
                 sysPermitInfo.getDeptIds().add(sysUser.getDept().getDeptId());
             }
         }
@@ -134,57 +131,50 @@ public class SysPermitMenuServiceImpl implements ISysPermitMenuService {
     @Override
     public void insertSysPermitMenuList(Long permitId, Long userId, List<SysPermitMenu> permitMenus) {
         List<Long> permitMenuIds;
-        if(permitId != null){
+        if (permitId != null) {
             permitMenuIds = sysPermitMenuMapper.selectIdByRelation(permitId, null);
             sysPermitMenuMapper.deleteSysPermitMenuByMenuId(null, permitId, null);
-            if(CollectionUtils.isNotEmpty(permitMenus)){
+            if (CollectionUtils.isNotEmpty(permitMenus)) {
                 permitMenus.forEach(p -> {
-                    if(p.getMenuId() == null || p.getDataScope() == null){
-                        throw new ServiceException("数据异常,菜单ID或者权限类型错误!");
+                    if (p.getMenuId() == null || p.getDataScope() == null) {
+                        throw new ServiceException("数据异常,菜单权限有误");
                     }
-                    if(p.getDataScope() == 3 && CollectionUtils.isEmpty(p.getDeptIds())){
-                        throw new ServiceException("权限数据异常,未选择指定部门");
+                    if (p.getDataScope() == 3 && CollectionUtils.isEmpty(p.getDeptIds())) {
+                        throw new ServiceException("数据异常,未指定部门");
                     }
-
                     p.setType(1);
                     p.setPermitId(permitId);
-
                     p.setUserId(0L);
                 });
             }
-        }else if(userId != null){
+        } else if (userId != null) {
             permitMenuIds = sysPermitMenuMapper.selectIdByRelation(null, userId);
             sysPermitMenuMapper.deleteSysPermitMenuByMenuId(null, null, userId);
-            if(CollectionUtils.isNotEmpty(permitMenus)){
+            if (CollectionUtils.isNotEmpty(permitMenus)) {
                 permitMenus.forEach(p -> {
-                    if(p.getMenuId() == null || p.getDataScope() == null){
-                        throw new ServiceException("数据异常,菜单ID或者权限类型错误!");
+                    if (p.getMenuId() == null || p.getDataScope() == null) {
+                        throw new ServiceException("数据异常,菜单权限有误");
                     }
-
-                    if(p.getDataScope() == 3 && CollectionUtils.isEmpty(p.getDeptIds())){
-                        throw new ServiceException("权限数据异常,未选择指定部门!");
+                    if (p.getDataScope() == 3 && CollectionUtils.isEmpty(p.getDeptIds())) {
+                        throw new ServiceException("数据异常,未指定部门");
                     }
-
                     p.setType(2);
                     p.setUserId(userId);
-
                     p.setPermitId(0L);
-
                 });
             }
-        }else {
-            throw new ServiceException("参数异常:数据来源不明确!");
+        } else {
+            throw new ServiceException("未知的源数据");
         }
-
-        if(permitMenuIds.size() > 0){
+        if (permitMenuIds.size() > 0) {
             sysPermitMenuDeptMapper.deleteSysPermitMenuDeptByPermitMenuIds(permitMenuIds.toArray(new Long[permitMenuIds.size()]));
         }
-        if(CollectionUtils.isNotEmpty(permitMenus)){
+        if (CollectionUtils.isNotEmpty(permitMenus)) {
             sysPermitMenuMapper.insertBatch(permitMenus);
 
             List<SysPermitMenuDept> permitMenuDeptList = new ArrayList<>();
             for (SysPermitMenu permitMenu : permitMenus) {
-                if(permitMenu.getDataScope() == 3){
+                if (permitMenu.getDataScope() == 3) {
                     for (Long deptId : permitMenu.getDeptIds()) {
                         SysPermitMenuDept permitMenuDept = new SysPermitMenuDept();
                         permitMenuDept.setPermitMenuId(permitMenu.getId());
@@ -193,10 +183,9 @@ public class SysPermitMenuServiceImpl implements ISysPermitMenuService {
                     }
                 }
             }
-            if(permitMenuDeptList.size() > 0){
+            if (permitMenuDeptList.size() > 0) {
                 sysPermitMenuDeptMapper.insertBatch(permitMenuDeptList);
             }
         }
-
     }
 }

+ 1 - 5
zd-modules/zd-modules-system/src/main/java/com/zd/system/service/impl/SysPermitServiceImpl.java

@@ -38,9 +38,8 @@ public class SysPermitServiceImpl implements ISysPermitService {
     public SysPermit selectSysPermitById(Long id) {
         SysPermit permit = sysPermitMapper.selectSysPermitById(id);
         if(permit == null){
-            throw new ServiceException("数据不存在,或者参数无效,请刷新重试!");
+            throw new ServiceException("数据不存在");
         }
-
         SysPermitMenu sysPermitMenu = new SysPermitMenu();
         sysPermitMenu.setPermitId(permit.getId());
         sysPermitMenu.setType(1);
@@ -79,9 +78,7 @@ public class SysPermitServiceImpl implements ISysPermitService {
         //设置其他公共字段
         SaveUtil.setCommonAttr(sysPermit);
         sysPermitMapper.insertSysPermit(sysPermit);
-
         sysPermitMenuService.insertSysPermitMenuList(sysPermit.getId(), null, sysPermit.getPermitMenus());
-
         return sysPermit;
     }
 
@@ -96,7 +93,6 @@ public class SysPermitServiceImpl implements ISysPermitService {
     public SysPermit updateSysPermit(SysPermit sysPermit) {
         sysPermit.setUpdateTime(DateUtils.getNowDate());
         sysPermit.setUpdateBy(SecurityUtils.getUsername());
-
         sysPermitMapper.updateSysPermit(sysPermit);
         sysPermitMenuService.insertSysPermitMenuList(sysPermit.getId(), null, sysPermit.getPermitMenus());
         return sysPermit;

+ 9 - 11
zd-modules/zd-modules-system/src/main/java/com/zd/system/service/impl/SysRoleServiceImpl.java

@@ -169,13 +169,11 @@ public class SysRoleServiceImpl implements ISysRoleService {
      */
     @Override
     public void checkRoleAllowed(SysRole role) {
-        if (StringUtils.isNotNull(role.getRoleId())) {
-
-            if (SecurityUtils.getUserId() != 1 && role.getRoleId() == 2) {
-                throw new ServiceException("不允许操作管理员角色");
-            }
-            if (role.isAdmin()) {
-                throw new ServiceException("不允许操作超级管理员角色");
+        if (role.getRoleId() != null) {
+            if ((SecurityUtils.getUserId() != 1 && role.getRoleId() == 2)
+                    || role.isAdmin()) {
+                //不允许操作管理员角色  或  不允许操作超级管理员角色
+                throw new ServiceException("不允许操作");
             }
         }
     }
@@ -379,14 +377,14 @@ public class SysRoleServiceImpl implements ISysRoleService {
     @Override
     public Map<String, Object> selectAuthUserPower(Long userId) {
         // 1.0 需求
-//        userRoleMapper.selectAuthUserPower(SecurityUtils.getUserId());
-//        List<SysRole> role = roleMapper.selectRolePermissionByUserId(SecurityUtils.getUserId());
+        //userRoleMapper.selectAuthUserPower(SecurityUtils.getUserId());
+        //List<SysRole> role = roleMapper.selectRolePermissionByUserId(SecurityUtils.getUserId());
 
         // 2.0 需求
-//         List<Map<String, Object>> map = deptMapper.selectLayoutOrderByUserId(SecurityUtils.getUserId());
+        //List<Map<String, Object>> map = deptMapper.selectLayoutOrderByUserId(SecurityUtils.getUserId());
 
         // 2.4 需求 查询是校级1 还是院级 2
-//        Integer type = userId == 1 ? 1: userRoleMapper.selectLevelByUserId(userId);
+        //Integer type = userId == 1 ? 1: userRoleMapper.selectLevelByUserId(userId);
 
         // 2.6 权限变更 属于校级权限,其他则院级权限 必须是教职工
         Integer type = deptMapper.selectLevelByUserId(userId) > 0 ? 1 : 2;

+ 21 - 25
zd-modules/zd-modules-system/src/main/java/com/zd/system/service/impl/SysStudentServiceImpl.java

@@ -95,29 +95,29 @@ public class SysStudentServiceImpl implements ISysStudentService {
 
         List<SysMajor> sysMajorList = sysMajorMapper.selectSysMajorList(new SysMajor());
         Optional.ofNullable(sysUserList).orElseGet(Collections::emptyList)
-                .stream().forEach(a->{
+                .stream().forEach(a -> {
             Optional.ofNullable(proDictDatas).orElseGet(Collections::emptyList)
-                    .stream().forEach(b->{
-                    if(b.getDictValue().equals(a.getCategory())){
-                        a.setCategory(b.getDictLabel());
-                    }
+                    .stream().forEach(b -> {
+                if (b.getDictValue().equals(a.getCategory())) {
+                    a.setCategory(b.getDictLabel());
+                }
             });
             Optional.ofNullable(edDictDatas).orElseGet(Collections::emptyList)
-                    .stream().forEach(b->{
-                if(b.getDictValue().equals(a.getEducation())){
+                    .stream().forEach(b -> {
+                if (b.getDictValue().equals(a.getEducation())) {
                     a.setEducation(b.getDictLabel());
                 }
             });
             Optional.ofNullable(stDictDatas).orElseGet(Collections::emptyList)
-                    .stream().forEach(b->{
-                if(b.getDictValue().equals(a.getWorkStatus())){
+                    .stream().forEach(b -> {
+                if (b.getDictValue().equals(a.getWorkStatus())) {
                     a.setWorkStatus(b.getDictLabel());
                 }
             });
 
             Optional.ofNullable(sysMajorList).orElseGet(Collections::emptyList)
-                    .stream().forEach(b->{
-                if(b.getId()==a.getMajorId()){
+                    .stream().forEach(b -> {
+                if (b.getId() == a.getMajorId()) {
                     a.setMajor(b.getMajorName());
                 }
             });
@@ -286,14 +286,10 @@ public class SysStudentServiceImpl implements ISysStudentService {
      */
     @Override
     public void checkUserAllowed(SysUser user) {
-        if (StringUtils.isNotNull(user.getUserId())) {
-
-            if (SecurityUtils.getUserId() != 1 && user.getUserId() == 2) {
-                throw new ServiceException("不允许操作管理员用户");
-            }
-
-            if (user.isAdmin()) {
-                throw new ServiceException("不允许操作超级管理员用户");
+        if (user.getUserId() != null) {
+            if ((SecurityUtils.getUserId() != 1 && user.getUserId() == 2) || user.isAdmin()) {
+                //不允许操作管理员用户 或 不允许操作超级管理员用户
+                throw new ServiceException("不允许操作");
             }
         }
     }
@@ -326,15 +322,15 @@ public class SysStudentServiceImpl implements ISysStudentService {
         // 新增用户信息
         int rows = userMapper.insertUser(user);
         //处理Object 转换实体类
-        List <Object> permitMenus = user.getPermitMenus();
+        List<Object> permitMenus = user.getPermitMenus();
         List<SysPermitMenu> newPermitMenus = new ArrayList<>();
-        for(Object obj:permitMenus){
-            SysPermitMenu sysPermitMenu = JSONArray.parseObject(JSONArray.toJSONString(obj),SysPermitMenu.class);
+        for (Object obj : permitMenus) {
+            SysPermitMenu sysPermitMenu = JSONArray.parseObject(JSONArray.toJSONString(obj), SysPermitMenu.class);
             newPermitMenus.add(sysPermitMenu);
         }
-        if(newPermitMenus.size()>0){
+        if (newPermitMenus.size() > 0) {
             // 插入最新用户绑定的权限数据
-            sysPermitMenuService.insertSysPermitMenuList(null,user.getUserId(),newPermitMenus);
+            sysPermitMenuService.insertSysPermitMenuList(null, user.getUserId(), newPermitMenus);
         }
         // 新增用户岗位关联
         insertUserPost(user);
@@ -388,7 +384,7 @@ public class SysStudentServiceImpl implements ISysStudentService {
                 user.setCardNum(null);
             }
             return userMapper.updateUser(user);
-        }catch (DuplicateKeyException e){
+        } catch (DuplicateKeyException e) {
             throw new ServiceException("卡号已经存在,保存失败!");
         }
 

+ 4 - 8
zd-modules/zd-modules-system/src/main/java/com/zd/system/service/impl/SysTeacherServiceImpl.java

@@ -264,14 +264,10 @@ public class SysTeacherServiceImpl implements ISysTeacherService {
      */
     @Override
     public void checkUserAllowed(SysUser user) {
-        if (StringUtils.isNotNull(user.getUserId())) {
-
-            if (SecurityUtils.getUserId() != 1 && user.getUserId() == 2) {
-                throw new ServiceException("不允许操作管理员用户");
-            }
-
-            if (user.isAdmin()) {
-                throw new ServiceException("不允许操作超级管理员用户");
+        if (user.getUserId() != null) {
+            if ((SecurityUtils.getUserId() != 1 && user.getUserId() == 2) || user.isAdmin()) {
+                //不允许操作管理员用户 或 不允许操作超级管理员用户
+                throw new ServiceException("不允许操作");
             }
         }
     }

+ 2 - 4
zd-modules/zd-modules-system/src/main/java/com/zd/system/service/impl/SysUrlConfigServiceImpl.java

@@ -45,7 +45,6 @@ public class SysUrlConfigServiceImpl implements SysUrlConfigService {
         if(list.size() > 0){
             return list.get(0);
         }
-
         return new SysUrlConfig();
     }
 
@@ -69,11 +68,10 @@ public class SysUrlConfigServiceImpl implements SysUrlConfigService {
      */
     @Override
     public SysUrlConfig update(SysUrlConfig sysUrlConfig) {
-
-        if(sysUrlConfig.getId() == null){
+        if (sysUrlConfig.getId() == null) {
             SaveUtil.setCommonAttr(sysUrlConfig);
             this.sysUrlConfigDao.insert(sysUrlConfig);
-        }else {
+        } else {
             sysUrlConfig.setUpdateBy(SecurityUtils.getUsername());
             sysUrlConfig.setUpdateTime(DateUtils.getNowDate());
             this.sysUrlConfigDao.update(sysUrlConfig);

+ 74 - 87
zd-modules/zd-modules-system/src/main/java/com/zd/system/service/impl/SysUserServiceImpl.java

@@ -260,14 +260,10 @@ public class SysUserServiceImpl implements ISysUserService {
      */
     @Override
     public void checkUserAllowed(SysUser user) {
-        if (StringUtils.isNotNull(user.getUserId())) {
-
-            if (SecurityUtils.getUserId() != 1 && user.getUserId() == 2) {
-                throw new ServiceException("不允许操作管理员用户");
-            }
-
-            if (user.isAdmin()) {
-                throw new ServiceException("不允许操作超级管理员用户");
+        if (user.getUserId() != null) {
+            if ((SecurityUtils.getUserId() != 1 && user.getUserId() == 2) || user.isAdmin()) {
+                //不允许操作管理员用户 或 不允许操作超级管理员用户
+                throw new ServiceException("不允许操作");
             }
         }
     }
@@ -282,19 +278,17 @@ public class SysUserServiceImpl implements ISysUserService {
     @Transactional
     public int insertUser(SysUser user) {
         //将10进制卡号转换至16进制
-        if(StringUtils.isNotEmpty(user.getCardNum())){
-            if(StringUtils.isNumeric(user.getCardNum())){
+        if (StringUtils.isNotEmpty(user.getCardNum())) {
+            if (StringUtils.isNumeric(user.getCardNum())) {
                 Long carNum10 = Long.parseLong(user.getCardNum());
                 String carNum16 = carNum10.toHexString(carNum10).toUpperCase();
                 user.setCardNum(carNum16);
-            }else{
+            } else {
                 throw new ServiceException("卡号只能是数字,不能包含字母!");
             }
-
-        }else{
+        } else {
             user.setCardNum(null);
         }
-
         // 新增用户信息
         int rows = userMapper.insertUser(user);
         //处理Object 转换实体类
@@ -678,22 +672,21 @@ public class SysUserServiceImpl implements ISysUserService {
         return failSysUserList;
     }
 
-    private void flowLineCheck(SysUserTeaCherByExcel user, List<SysUserTeaCherByExcel> failSysUserList, String password, SysUserTeaCherByExcel sysUserTeaCherByExcel){
+    private void flowLineCheck(SysUserTeaCherByExcel user, List<SysUserTeaCherByExcel> failSysUserList, String password, SysUserTeaCherByExcel sysUserTeaCherByExcel) {
         // 校验是否装入错误数据
         boolean checkBox = true;
 
         //验证必填字段是否为空
-        if(StringUtils.isEmpty(user.getNickName())){
-            if(checkBox){
+        if (StringUtils.isEmpty(user.getNickName())) {
+            if (checkBox) {
                 user.getFailRemark().append("失败:");
                 failSysUserList.add(user);
                 checkBox = false;
             }
             user.getFailRemark().append("姓名不能为空,");
         }
-
-        if(StringUtils.isEmpty(user.getUserName())){
-            if(checkBox){
+        if (StringUtils.isEmpty(user.getUserName())) {
+            if (checkBox) {
                 user.getFailRemark().append("失败:");
                 failSysUserList.add(user);
                 checkBox = false;
@@ -701,8 +694,8 @@ public class SysUserServiceImpl implements ISysUserService {
             user.getFailRemark().append("工号不能为空,");
         }
 
-        if(StringUtils.isEmpty(user.getDeptName())){
-            if(checkBox){
+        if (StringUtils.isEmpty(user.getDeptName())) {
+            if (checkBox) {
                 user.getFailRemark().append("失败:");
                 failSysUserList.add(user);
                 checkBox = false;
@@ -710,8 +703,8 @@ public class SysUserServiceImpl implements ISysUserService {
             user.getFailRemark().append("所在部门不能为空,");
         }
 
-        if(StringUtils.isEmpty(user.getPistionName())){
-            if(checkBox){
+        if (StringUtils.isEmpty(user.getPistionName())) {
+            if (checkBox) {
                 user.getFailRemark().append("失败:");
                 failSysUserList.add(user);
                 checkBox = false;
@@ -719,21 +712,19 @@ public class SysUserServiceImpl implements ISysUserService {
             user.getFailRemark().append("身份不能为空,");
         }
 
-        if(StringUtils.isNotEmpty(user.getCardNum()) && !StringUtils.isNumeric(user.getCardNum())){
-            if(checkBox){
+        if (StringUtils.isNotEmpty(user.getCardNum()) && !StringUtils.isNumeric(user.getCardNum())) {
+            if (checkBox) {
                 user.getFailRemark().append("失败:");
                 failSysUserList.add(user);
                 checkBox = false;
             }
             user.getFailRemark().append("卡号只能为数字,");
         }
-
-
         // 验证是否存在这个用户
         SysUser checkUser = userMapper.selectUserByUserName(user.getUserName());
         if (StringUtils.isNotNull(user.getUserName()) && StringUtils.isNotNull(checkUser)) {
-            if(!sysUserTeaCherByExcel.getUpDate()){
-                if(checkBox){
+            if (!sysUserTeaCherByExcel.getUpDate()) {
+                if (checkBox) {
                     user.getFailRemark().append("失败:");
                     failSysUserList.add(user);
                     checkBox = false;
@@ -744,7 +735,7 @@ public class SysUserServiceImpl implements ISysUserService {
         // 验证部门是否存在
         SysDept checkDept = deptMapper.getDeptNameUnique(user.getDeptName());
         if (StringUtils.isNotEmpty(user.getDeptName()) && StringUtils.isNull(checkDept)) {
-            if(checkBox){
+            if (checkBox) {
                 user.getFailRemark().append("失败:");
                 failSysUserList.add(user);
                 checkBox = false;
@@ -753,20 +744,20 @@ public class SysUserServiceImpl implements ISysUserService {
         }
         //联系电话重复
         SysUser info = null;
-        if(StringUtils.isNotNull(checkUser) && sysUserTeaCherByExcel.getUpDate()){
-            if(StringUtils.isNotEmpty(user.getPhonenumber())){
+        if (StringUtils.isNotNull(checkUser) && sysUserTeaCherByExcel.getUpDate()) {
+            if (StringUtils.isNotEmpty(user.getPhonenumber())) {
                 SysUser userInfo = new SysUser();
                 userInfo.setUserName(checkUser.getUserName());
                 userInfo.setPhonenumber(user.getPhonenumber());
                 info = userMapper.checkPhoneUniqueNotOwn(userInfo);
             }
-        }else{
-            if(StringUtils.isNull(checkUser) && StringUtils.isNotEmpty(user.getPhonenumber())){
+        } else {
+            if (StringUtils.isNull(checkUser) && StringUtils.isNotEmpty(user.getPhonenumber())) {
                 info = userMapper.checkPhoneUnique(user.getPhonenumber());
             }
         }
-        if(StringUtils.isNotNull(info)){
-            if(checkBox){
+        if (StringUtils.isNotNull(info)) {
+            if (checkBox) {
                 user.getFailRemark().append("失败:");
                 failSysUserList.add(user);
                 checkBox = false;
@@ -777,7 +768,7 @@ public class SysUserServiceImpl implements ISysUserService {
         //身份是否存在
         SysPost sysPost = postMapper.checkPostNameUnique(user.getPistionName());
         if (StringUtils.isNotEmpty(user.getPistionName()) && StringUtils.isNull(sysPost)) {
-            if(checkBox){
+            if (checkBox) {
                 user.getFailRemark().append("失败:");
                 failSysUserList.add(user);
                 checkBox = false;
@@ -785,14 +776,14 @@ public class SysUserServiceImpl implements ISysUserService {
             user.getFailRemark().append("身份不存在,");
         }
         //日期格式转换
-        if(StringUtils.isNotNull(user.getDateBirth())){
+        if (StringUtils.isNotNull(user.getDateBirth())) {
             Date time = user.getDateBirth();
             SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
-            try{
+            try {
                 int year = time.getYear();
                 int month = time.getMonth();
                 int date = time.getDate();
-                if(year > new Date().getYear()-15) {
+                if (year > new Date().getYear() - 15) {
                     if (checkBox) {
                         user.getFailRemark().append("失败:");
                         failSysUserList.add(user);
@@ -800,7 +791,7 @@ public class SysUserServiceImpl implements ISysUserService {
                     }
                     user.getFailRemark().append("出生日期异常最少应大于15岁,");
                 }
-            }catch (Exception e){
+            } catch (Exception e) {
                 if (checkBox) {
                     user.getFailRemark().append("失败:");
                     failSysUserList.add(user);
@@ -810,29 +801,28 @@ public class SysUserServiceImpl implements ISysUserService {
                 log.error("日期格式错误");
             }
         }
-
         //插入正确数据
-        if(StringUtils.isEmpty(user.getFailRemark())){
+        if (StringUtils.isEmpty(user.getFailRemark())) {
             SysUser newSysUser = new SysUser();
             newSysUser.setNickName(user.getNickName());
             newSysUser.setUserName(user.getUserName());
             newSysUser.setDeptId(checkDept.getDeptId());
-            newSysUser.setPosition(sysPost.getPostId()+"");
+            newSysUser.setPosition(sysPost.getPostId() + "");
             newSysUser.setPhonenumber(user.getPhonenumber());
             newSysUser.setEmail(user.getEmail());
             newSysUser.setUserType("11");
             newSysUser.setSex(user.getSex());
             newSysUser.setDateBirth(user.getDateBirth());
             newSysUser.setCardNum(user.getCardNum());
-            if(!sysUserTeaCherByExcel.getSysUserEnable()){
-                newSysUser.setStatus(1+"");
+            if (!sysUserTeaCherByExcel.getSysUserEnable()) {
+                newSysUser.setStatus(1 + "");
             }
             newSysUser.setPassword(SecurityUtils.encryptPassword(password));
             newSysUser.setCreateBy(tokenService.getLoginUser().getNickName());
-            if(StringUtils.isNotNull(checkUser)){
+            if (StringUtils.isNotNull(checkUser)) {
                 newSysUser.setUserId(checkUser.getUserId());
                 this.updateUser(newSysUser);
-            }else{
+            } else {
                 this.insertUser(newSysUser);
             }
         }
@@ -855,19 +845,19 @@ public class SysUserServiceImpl implements ISysUserService {
         String password = configService.selectConfigByKey("sys.user.initPassword");
         for (SysUserStudentByExcel user : userList) {
             //流水线验证
-            flowLineCheckByStudent(user,failSysUserList,password, sysUserStudentByExcel);
+            flowLineCheckByStudent(user, failSysUserList, password, sysUserStudentByExcel);
         }
         return failSysUserList;
     }
 
 
-    private void flowLineCheckByStudent(SysUserStudentByExcel user, List<SysUserStudentByExcel> failSysUserList, String password, SysUserStudentByExcel sysUserStudentByExcel){
+    private void flowLineCheckByStudent(SysUserStudentByExcel user, List<SysUserStudentByExcel> failSysUserList, String password, SysUserStudentByExcel sysUserStudentByExcel) {
         // 校验是否装入错误数据
         Boolean checkBox = true;
 
         //验证必填字段是否为空
-        if(StringUtils.isEmpty(user.getNickName())){
-            if(checkBox){
+        if (StringUtils.isEmpty(user.getNickName())) {
+            if (checkBox) {
                 user.getFailRemark().append("失败:");
                 failSysUserList.add(user);
                 checkBox = false;
@@ -875,8 +865,8 @@ public class SysUserServiceImpl implements ISysUserService {
             user.getFailRemark().append("姓名不能为空,");
         }
 
-        if(StringUtils.isEmpty(user.getUserName())){
-            if(checkBox){
+        if (StringUtils.isEmpty(user.getUserName())) {
+            if (checkBox) {
                 user.getFailRemark().append("失败:");
                 failSysUserList.add(user);
                 checkBox = false;
@@ -884,8 +874,8 @@ public class SysUserServiceImpl implements ISysUserService {
             user.getFailRemark().append("学号不能为空,");
         }
 
-        if(StringUtils.isEmpty(user.getDeptName())){
-            if(checkBox){
+        if (StringUtils.isEmpty(user.getDeptName())) {
+            if (checkBox) {
                 user.getFailRemark().append("失败:");
                 failSysUserList.add(user);
                 checkBox = false;
@@ -893,8 +883,8 @@ public class SysUserServiceImpl implements ISysUserService {
             user.getFailRemark().append("所属学院不能为空,");
         }
 
-        if(StringUtils.isEmpty(user.getMajor())){
-            if(checkBox){
+        if (StringUtils.isEmpty(user.getMajor())) {
+            if (checkBox) {
                 user.getFailRemark().append("失败:");
                 failSysUserList.add(user);
                 checkBox = false;
@@ -902,8 +892,8 @@ public class SysUserServiceImpl implements ISysUserService {
             user.getFailRemark().append("专业不能为空,");
         }
 
-        if(StringUtils.isNotEmpty(user.getCardNum()) && !StringUtils.isNumeric(user.getCardNum())){
-            if(checkBox){
+        if (StringUtils.isNotEmpty(user.getCardNum()) && !StringUtils.isNumeric(user.getCardNum())) {
+            if (checkBox) {
                 user.getFailRemark().append("失败:");
                 failSysUserList.add(user);
                 checkBox = false;
@@ -914,8 +904,8 @@ public class SysUserServiceImpl implements ISysUserService {
         // 验证是否存在这个用户
         SysUser checkUser = userMapper.selectUserByUserName(user.getUserName());
         if (StringUtils.isNotEmpty(user.getUserName()) && StringUtils.isNotNull(checkUser)) {
-            if(!sysUserStudentByExcel.getUpDate()){
-                if(checkBox){
+            if (!sysUserStudentByExcel.getUpDate()) {
+                if (checkBox) {
                     user.getFailRemark().append("失败:");
                     failSysUserList.add(user);
                     checkBox = false;
@@ -926,7 +916,7 @@ public class SysUserServiceImpl implements ISysUserService {
         // 验证部门是否存在
         SysDept checkDept = deptMapper.getDeptNameUnique(user.getDeptName());
         if (StringUtils.isNotEmpty(user.getDeptName()) && StringUtils.isNull(checkDept)) {
-            if(checkBox){
+            if (checkBox) {
                 user.getFailRemark().append("失败:");
                 failSysUserList.add(user);
                 checkBox = false;
@@ -935,31 +925,30 @@ public class SysUserServiceImpl implements ISysUserService {
         }
         //联系电话重复
         SysUser info = null;
-        if(StringUtils.isNotNull(checkUser) && sysUserStudentByExcel.getUpDate()){
+        if (StringUtils.isNotNull(checkUser) && sysUserStudentByExcel.getUpDate()) {
             SysUser userInfo = new SysUser();
             userInfo.setUserName(checkUser.getUserName());
             userInfo.setPhonenumber(user.getPhonenumber());
             info = userMapper.checkPhoneUniqueNotOwn(userInfo);
-        }else{
-            if(StringUtils.isNull(checkUser) && StringUtils.isNotEmpty(user.getPhonenumber())){
+        } else {
+            if (StringUtils.isNull(checkUser) && StringUtils.isNotEmpty(user.getPhonenumber())) {
                 info = userMapper.checkPhoneUnique(user.getPhonenumber());
             }
         }
-        if(StringUtils.isNotNull(info)){
-            if(checkBox){
+        if (StringUtils.isNotNull(info)) {
+            if (checkBox) {
                 user.getFailRemark().append("失败:");
                 failSysUserList.add(user);
                 checkBox = false;
             }
             user.getFailRemark().append("联系电话重复,");
         }
-
         //专业是否存在
         SysMajor sysMajor = new SysMajor();
         sysMajor.setMajorName(user.getMajor());
         List<SysMajor> sysMajorList = sysMajorMapper.selectSysMajorList(sysMajor);
-        if (sysMajorList.size()==0) {
-            if(checkBox){
+        if (sysMajorList.size() == 0) {
+            if (checkBox) {
                 user.getFailRemark().append("失败:");
                 failSysUserList.add(user);
                 checkBox = false;
@@ -967,15 +956,15 @@ public class SysUserServiceImpl implements ISysUserService {
             user.getFailRemark().append("专业不存在,");
         }
         //日期格式转换
-        if(StringUtils.isNotNull(user.getDateBirth())){
+        if (StringUtils.isNotNull(user.getDateBirth())) {
             Date time = user.getDateBirth();
-            if(StringUtils.isNotNull(time)){
+            if (StringUtils.isNotNull(time)) {
                 SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
-                try{
+                try {
                     int year = time.getYear();
                     int month = time.getMonth();
                     int date = time.getDate();
-                    if(year > new Date().getYear()-15) {
+                    if (year > new Date().getYear() - 15) {
                         if (checkBox) {
                             user.getFailRemark().append("失败:");
                             failSysUserList.add(user);
@@ -983,7 +972,7 @@ public class SysUserServiceImpl implements ISysUserService {
                         }
                         user.getFailRemark().append("出生日期异常最少应大于15岁,");
                     }
-                }catch (Exception e){
+                } catch (Exception e) {
                     if (checkBox) {
                         user.getFailRemark().append("失败:");
                         failSysUserList.add(user);
@@ -994,15 +983,13 @@ public class SysUserServiceImpl implements ISysUserService {
                 }
             }
         }
-
         // 验证是否存在这个导师,如果通过名字查出两个或以上的,则不绑定老师
         List<SysUser> sysUserByTeacherList = userMapper.selectUserByNickName(user.getTutorUserName());
-        if(sysUserByTeacherList.size()==1){
+        if (sysUserByTeacherList.size() == 1) {
             user.setTutorUserId(sysUserByTeacherList.get(0).getUserId());
         }
-
         //插入正确数据
-        if(StringUtils.isEmpty(user.getFailRemark())){
+        if (StringUtils.isEmpty(user.getFailRemark())) {
             SysUser newSysUser = new SysUser();
             newSysUser.setNickName(user.getNickName());
             newSysUser.setUserName(user.getUserName());
@@ -1014,18 +1001,18 @@ public class SysUserServiceImpl implements ISysUserService {
             newSysUser.setSex(user.getSex());
             newSysUser.setDateBirth(user.getDateBirth());
             newSysUser.setCardNum(user.getCardNum());
-            if(!sysUserStudentByExcel.getSysUserEnable()){
-                newSysUser.setStatus(1+"");
+            if (!sysUserStudentByExcel.getSysUserEnable()) {
+                newSysUser.setStatus(1 + "");
             }
             newSysUser.setPassword(SecurityUtils.encryptPassword(password));
             newSysUser.setCreateBy(tokenService.getLoginUser().getNickName());
-            if(StringUtils.isNotNull(user.getTutorUserId())){
-                newSysUser.setTutorUserId(Integer.parseInt(user.getTutorUserId()+""));
+            if (StringUtils.isNotNull(user.getTutorUserId())) {
+                newSysUser.setTutorUserId(Integer.parseInt(user.getTutorUserId() + ""));
             }
-            if(StringUtils.isNotNull(checkUser)){
+            if (StringUtils.isNotNull(checkUser)) {
                 newSysUser.setUserId(checkUser.getUserId());
                 this.updateUser(newSysUser);
-            }else{
+            } else {
                 this.insertUser(newSysUser);
             }
         }

+ 1 - 13
zd-modules/zd-modules-system/src/main/java/com/zd/system/service/impl/TeacherServiceImpl.java

@@ -33,7 +33,7 @@ public class TeacherServiceImpl {
      * @return
      */
     public void queryTeacherSuBCount(List<SysUser> list) {
-        if (CollUtil.isEmpty(list)) return ;
+        if (CollUtil.isEmpty(list)) return;
         final Map<Long, List<LabSubjectEntityVO>> collect = new HashMap<>();
         if (CollUtil.isNotEmpty(list)) {
             //得到ids
@@ -44,17 +44,5 @@ public class TeacherServiceImpl {
                 collect.putAll(infoByUserIds.getData().stream().collect(Collectors.groupingBy(LabSubjectEntityVO::getAdminId)));
             }
         }
-        /*list.stream().forEach(a -> {
-            if (collect.containsKey(a.getUserId())) {
-                a.setManageSubCount(collect.get(a.getUserId()).size());
-            } else {
-                a.setManageSubCount(0);
-            }
-        });*/
-
-
-
     }
-
-
 }