Prechádzať zdrojové kódy

Merge remote-tracking branch 'origin/master'

wangzhiqiang 2 rokov pred
rodič
commit
6e34e6b36b
20 zmenil súbory, kde vykonal 100 pridanie a 162 odobranie
  1. 1 0
      api-common/src/main/java/api/common/pojo/constants/DictConstants.java
  2. 0 1
      api-common/src/main/java/api/common/pojo/po/log/LogLoginPO.java
  3. 0 31
      simulation-resource-common/src/main/java/com/css/simulation/resource/common/controller/MinioController.java
  4. 1 59
      simulation-resource-common/src/main/java/com/css/simulation/resource/common/util/MinioUtil.java
  5. 11 3
      simulation-resource-scene/src/main/java/com/css/simulation/resource/scene/SceneImportCtrl.java
  6. 3 5
      simulation-resource-scene/src/main/java/com/css/simulation/resource/scene/SceneImportService.java
  7. 0 2
      simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/consumer/ProjectConsumer.java
  8. 2 0
      simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/manager/TaskManager.java
  9. 11 1
      simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/service/ProjectService.java
  10. 3 2
      simulation-resource-server/src/main/java/com/css/simulation/resource/demo/service/TestService.java
  11. 0 5
      simulation-resource-server/src/main/java/com/css/simulation/resource/feign/RedisService.java
  12. 0 4
      simulation-resource-server/src/main/java/com/css/simulation/resource/feign/fallback/RedisServiceFallback.java
  13. 5 0
      simulation-resource-server/src/main/java/com/css/simulation/resource/home/ctrl/HomePageCtrl.java
  14. 20 46
      simulation-resource-server/src/main/java/com/css/simulation/resource/system/ctrl/FileController.java
  15. 2 0
      simulation-resource-server/src/main/java/com/css/simulation/resource/system/ctrl/SceneImportCtrl.java
  16. 4 1
      simulation-resource-server/src/main/java/com/css/simulation/resource/system/ctrl/UserCtrl.java
  17. 3 0
      simulation-resource-server/src/main/java/com/css/simulation/resource/system/mapper/UserMapper.java
  18. 14 0
      simulation-resource-server/src/main/java/com/css/simulation/resource/system/service/DictService.java
  19. 16 1
      simulation-resource-server/src/main/java/com/css/simulation/resource/system/service/UserService.java
  20. 4 1
      simulation-resource-server/src/main/resources/mapper/system/UserMapper.xml

+ 1 - 0
api-common/src/main/java/api/common/pojo/constants/DictConstants.java

@@ -34,6 +34,7 @@ public class DictConstants {
 
 
     public static final String ALGORITHM_FILE = "algorithmFile";    //算法文件上传type
+    public static final String VEHICLE_IMG_FILE = "vehicleImg";    //车辆图片上传type
 
     // 算法镜像上传类型
     public static final String ALGORITHM_UPLOAD_MODE_FILE = "1";    // 文件上传

+ 0 - 1
api-common/src/main/java/api/common/pojo/po/log/LogLoginPO.java

@@ -1,6 +1,5 @@
 package api.common.pojo.po.log;
 
-import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Data;
 
 import java.sql.Timestamp;

+ 0 - 31
simulation-resource-common/src/main/java/com/css/simulation/resource/common/controller/MinioController.java

@@ -63,41 +63,10 @@ public class MinioController {
                 objectName
         );
         String previewUrl = MinioUtil.getPreviewUrl(minioClientPrivate, Method.GET, bucketName, objectName);
-
         return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS, "请求成功!", previewUrl);
     }
 
 
-    @PostMapping(value = "/uploadProcessBar", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
-    public ResponseBodyVO<String> uploadProcessBar(
-            @RequestPart("file") MultipartFile file,
-            HttpServletRequest request
-    ) throws ServerException, InsufficientDataException, ErrorResponseException, IOException, NoSuchAlgorithmException, InvalidKeyException, InvalidResponseException, XmlParserException, InternalException {
-        String type = request.getParameter("type");
-        String objectPath = request.getParameter("objectPath");
-        if (file != null) {
-            String objectName = "";
-            Integer nowTime = TimeUtil.getRq(new Date(), 0);
-            if (type.equals(DictConstants.ALGORITHM_FILE)) {
-                objectName = "algorithm/" + nowTime + "/" + objectPath + "/" + file.getOriginalFilename();
-            }
-
-            MinioUtil.uploadProcessBar(
-                    minioClientPrivate,
-                    file,
-                    bucketName,
-                    objectName,
-                    objectPath,
-                    redisController
-            );
-            Map map = new HashMap();
-            map.put("fileName", objectName);
-
-            return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS, map);
-        }
-        return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE, "文件流file为空,请检查!");
-    }
-
     @PostMapping("/list")
     public ResponseBodyVO<List<String>> list(
             @RequestBody @Validated MinioParameter minioParameter

+ 1 - 59
simulation-resource-common/src/main/java/com/css/simulation/resource/common/util/MinioUtil.java

@@ -1,10 +1,5 @@
 package com.css.simulation.resource.common.util;
 
-import api.common.pojo.constants.DictConstants;
-import api.common.pojo.param.RedisParameter;
-import api.common.util.ObjectUtil;
-import com.css.simulation.resource.common.controller.RedisController;
-import com.css.simulation.resource.common.util.processbar.ProgressInputStream;
 import io.minio.*;
 import io.minio.errors.*;
 import io.minio.http.Method;
@@ -12,7 +7,6 @@ import io.minio.messages.Item;
 import jdk.nashorn.internal.runtime.regexp.joni.exception.InternalException;
 import org.springframework.web.multipart.MultipartFile;
 
-import java.io.BufferedInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.security.InvalidKeyException;
@@ -167,7 +161,7 @@ public class MinioUtil {
     ) throws IOException, InsufficientDataException, ErrorResponseException, NoSuchAlgorithmException, InvalidKeyException, InvalidResponseException, XmlParserException, InternalException, io.minio.errors.ServerException, io.minio.errors.InternalException {
         InputStream inputStream = multipartFile.getInputStream();
         long objectSize = multipartFile.getSize();
-//        long partSize = 5 * 1024 * 1024L; // 分片最小 5M
+        //long partSize = 5 * 1024 * 1024L; // 分片最小 5M
         long partSize = -1; // 不分片
         minioClient.putObject(PutObjectArgs.builder()
                 .stream(inputStream, objectSize, partSize)
@@ -176,41 +170,6 @@ public class MinioUtil {
                 .build());
     }
 
-    /**
-     * 文件上传,保存进度
-     */
-    public static void uploadProcessBar(
-            MinioClient minioClient,
-            MultipartFile multipartFile,
-            String bucketName,
-            String objectName,
-            String objectPath,
-            RedisController redisController
-    ) throws IOException, InsufficientDataException, ErrorResponseException, NoSuchAlgorithmException, InvalidKeyException, InvalidResponseException, XmlParserException, InternalException, io.minio.errors.ServerException, io.minio.errors.InternalException {
-        InputStream inputStream = multipartFile.getInputStream();
-        long fileSize = multipartFile.getSize();
-        //进度计算参数:传输量,进度标尺,文件大小,进度值
-        long[] longs = {0L, 0L, fileSize, 0L};
-        InputStream pis = new BufferedInputStream(
-                new ProgressInputStream(inputStream){
-                    @Override
-                    public void getStep(int readBytes){
-                        RedisParameter redisParameter = getProgress(readBytes,longs);
-                        if(ObjectUtil.isNotNull(redisParameter)){
-                            redisParameter.setKey(DictConstants.ALGORITHM_KEY + objectPath);//进度缓存的 key
-                            redisController.set(redisParameter);
-                        }
-                    }
-                });
-        minioClient.putObject(PutObjectArgs.builder()
-                .bucket(bucketName)
-                .object(objectName)
-                .stream(pis, fileSize, -1)
-                .build());
-        pis.close();
-
-    }
-
     /**
      * 下载文件
      */
@@ -241,23 +200,6 @@ public class MinioUtil {
                 .build());
     }
 
-    public static RedisParameter getProgress(int readBytes,long[] longs){
-        double progressStep = 0.05;//进度条的步长
-        longs[0] += readBytes;//累加
-        if(longs[0] >= longs[1]){
-            longs[3] += 1;
-            double progress = progressStep * longs[3];//进度
-            longs[1] = (long) (longs[2] * progress);//标尺增长
-            RedisParameter redisParameter = new RedisParameter();
-            redisParameter.setValue(String.format("%.2f",progress-progressStep));
-            redisParameter.setMinutes(1);
-            if(longs[0] == longs[2]){
-                redisParameter.setValue("1.00");
-            }
-            return redisParameter;
-        }
-        return null;
-    }
     /**
      * 删除文件
      *

+ 11 - 3
simulation-resource-scene/src/main/java/com/css/simulation/resource/scene/SceneImportCtrl.java

@@ -32,14 +32,22 @@ public class SceneImportCtrl {
     @ResponseBody
     public ResponseBodyVO startImport(@RequestBody SceneImportPO po, HttpServletRequest request) {
         try {
+            //路径校验
+            Boolean directory = sceneImportService.checkDirectory(po);
+            if(!directory){
+                po.setErrorMessage("路径错误: " + po.getDataDirectory());
+                po.setStatus(DictConstants.SCENE_IMPORT_STATUS_0);
+                sceneImportService.updateStatus(po);
+                return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE);
+            }
             //开始上传
             po.setStatus(DictConstants.SCENE_IMPORT_STATUS_1);
             sceneImportService.updateStatus(po);
             //上传
-            Boolean b = sceneImportService.startImport(po);
-            if(!b){
+            Boolean sceneType = sceneImportService.startImport(po);
+            if(!sceneType){
+                po.setErrorMessage("场景类型错误!");
                 po.setStatus(DictConstants.SCENE_IMPORT_STATUS_0);
-                po.setErrorMessage("路径错误");
                 sceneImportService.updateStatus(po);
                 return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE);
             }

+ 3 - 5
simulation-resource-scene/src/main/java/com/css/simulation/resource/scene/SceneImportService.java

@@ -36,10 +36,6 @@ public class SceneImportService {
     MinioClient minioClient;
 
     public Boolean startImport(SceneImportPO po) throws Exception {
-        //目录校验
-        if(!checkDirectory(po)){
-            return false;
-        }
         //minio路径生成
         String sceneType = po.getSceneType();
         Integer nowTime = TimeUtil.getRq(new Date(), 0);
@@ -51,6 +47,8 @@ public class SceneImportService {
             sceneName = "标准法规场景";
         } else if (DictConstants.SCENE_ACCIDENT.equals(sceneType)) {
             sceneName = "交通事故场景";
+        }else{
+            return false;
         }
         String objectPath = sceneName + "/" + nowTime + "/" + randomCode + "/";
         //数据上传
@@ -69,7 +67,7 @@ public class SceneImportService {
         return true;
     }
 
-    private Boolean checkDirectory(SceneImportPO po) {
+    public Boolean checkDirectory(SceneImportPO po) {
         try {
             String dataDirectory = po.getDataDirectory() + File.separator + subDirectory;
             List<String> ls = FileUtil.ls(dataDirectory);

+ 0 - 2
simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/consumer/ProjectConsumer.java

@@ -242,8 +242,6 @@ public class ProjectConsumer {
         String projectId = jsonNode.path("projectId").asText();
         String type = jsonNode.path("type").asText();
         projectService.stopProject(projectId, type);
-
-
     }
 
 

+ 2 - 0
simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/manager/TaskManager.java

@@ -241,6 +241,8 @@ public class TaskManager {
                             log.info("TaskService--state 项目" + projectId + "的任务" + task2Id + "打分结束,结果为:" + scoreResult);
                             String replace = StringUtil.replace(scoreResult, "'", "\"");
                             score = JsonUtil.jsonToBean(replace, ScoreTO.class);
+                            FileUtil.rm(runResultLinux);
+                            log.info("TaskService--state 已删除运行结果文件 Ego.csv:" + runResultLinux);
                         } catch (IOException e) {
                             throw new RuntimeException("------- TaskService--state 项目" + projectId + "的任务" + task2Id + " 打分出错,命令为:" + scoreCommand + " 修改状态为:" + DictConstants.TASK_ABORTED + "\n" + e.getMessage());
                         }

+ 11 - 1
simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/service/ProjectService.java

@@ -330,6 +330,8 @@ public class ProjectService {
                 // 本地执行 docker load 算法文件成镜像(可改成用 docker-java 操作仓库)
                 LinuxUtil.execute("docker import " + algorithmTarLinuxTempPath + " " + dockerImage);
                 algorithmMapper.updateDockerImportAndDockerImageById("1", dockerImage, algorithmId);
+                FileUtil.rm(algorithmTarLinuxTempPath);
+                log.info("ProjectService--handleAlgorithm 已删除算法临时文件:" + algorithmTarLinuxTempPath);
             } else {
                 throw new RuntimeException("算法 " + algorithmId + " 的 mysql 数据有误!");
             }
@@ -362,7 +364,15 @@ public class ProjectService {
         String replace5 = replace4.replace("completions-number", completions + "");
         String replace6 = replace5.replace("parallelism-number", parallelism + "");
         String replace7 = replace6.replace("apiVers1on", "apiVersion");
-        String finalYaml = replace7.replace("1atch/v1", "batch/v1");
+        String replace8 = replace7.replace("1atch/v1", "batch/v1");
+        // 根据 kubernetes 的 node 分配 job
+        //1 获取 node 列表
+        //2 获取 node 的 pod 列表
+        //3 获取 pod 数量最少的 node
+        //4 将 job 指定 node 执行
+
+
+        String finalYaml = replace8;
         log.info("ProjectConsumer--parseManualProject 开始执行 yaml 文件" + finalYaml);
         FileUtil.writeStringToLocalFile(finalYaml, jobTemplateYamlPathTarget);
         //  启动

+ 3 - 2
simulation-resource-server/src/main/java/com/css/simulation/resource/demo/service/TestService.java

@@ -25,10 +25,11 @@ public class TestService {
 
     public PageInfo<TestVO> getTestPageList(TestPageParam params) {
         PageUtil.setPageInfo(params);
-        params.setCreateUserId(AuthUtil.getCurrentUserId());
+        //params.setCreateUserId(AuthUtil.getCurrentUserId());
         List<TestVO> list = testMapper.getTestPageList(params);
         //字典翻译
-        Map<String, Map<String, String>> dictMapsByTypes = dictService.getDictMapsByTypes(DictConstants.LEVEL + "," + DictConstants.DRIVE_TYPE);
+        //Map<String, Map<String, String>> dictMapsByTypes = dictService.getDictMapsByTypes(DictConstants.LEVEL + "," + DictConstants.DRIVE_TYPE);
+        Map<String, Map<String, String>> dictMapsByTypes = dictService.getDictMapsByTypes(DictConstants.LEVEL,DictConstants.DRIVE_TYPE);
         list.forEach(testVO ->{
             testVO.setLevel_name(dictMapsByTypes.get(DictConstants.LEVEL).get(testVO.getLevel()));
         });

+ 0 - 5
simulation-resource-server/src/main/java/com/css/simulation/resource/feign/RedisService.java

@@ -5,9 +5,7 @@ import api.common.pojo.param.RedisParameter;
 import com.css.simulation.resource.common.config.FeignConfiguration;
 import com.css.simulation.resource.feign.fallback.RedisServiceFallback;
 import org.springframework.cloud.openfeign.FeignClient;
-import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
 
 import java.util.List;
 import java.util.Map;
@@ -33,7 +31,4 @@ public interface RedisService {
     @PostMapping("/redis/getDictMaps")
     ResponseBodyVO<Map<String,String>> getDictMaps(List<String> keyList);
 
-    @PostMapping(value = "/redis/get")
-    ResponseBodyVO<String> getProgress(RedisParameter redisParameter);
-
 }

+ 0 - 4
simulation-resource-server/src/main/java/com/css/simulation/resource/feign/fallback/RedisServiceFallback.java

@@ -32,8 +32,4 @@ public class RedisServiceFallback implements RedisService {
         return new ResponseBodyVO<>(ResponseBodyVO.Response.SERVER_FAILURE);
     }
 
-    @Override
-    public ResponseBodyVO<String> getProgress(RedisParameter redisParameter) {
-        return new ResponseBodyVO<>(ResponseBodyVO.Response.SERVER_FAILURE);
-    }
 }

+ 5 - 0
simulation-resource-server/src/main/java/com/css/simulation/resource/home/ctrl/HomePageCtrl.java

@@ -12,6 +12,7 @@ import com.css.simulation.resource.system.service.ClusterService;
 import com.github.pagehelper.PageInfo;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.ResponseBody;
@@ -104,6 +105,7 @@ public class HomePageCtrl {
      */
     @RequestMapping("selectHardware")
     @ResponseBody
+    @PreAuthorize("@AuthorityCheck.admin()")
     public ResponseBodyVO<HardwareVO> selectHardware() {
         return homePageService.selectHardware();
     }
@@ -113,6 +115,7 @@ public class HomePageCtrl {
      */
     @RequestMapping("selectService")
     @ResponseBody
+    @PreAuthorize("@AuthorityCheck.admin()")
     public ResponseBodyVO<ServiceVO> selectService() {
         return homePageService.selectService();
     }
@@ -122,6 +125,7 @@ public class HomePageCtrl {
      */
     @RequestMapping("selectAccess")
     @ResponseBody
+    @PreAuthorize("@AuthorityCheck.admin()")
     public ResponseBodyVO<List<LineChartVO>> selectAccess() {
         List<LineChartVO> list = homePageService.selectAccess();
         return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS,list);
@@ -133,6 +137,7 @@ public class HomePageCtrl {
      */
     @RequestMapping("selectServer")
     @ResponseBody
+    @PreAuthorize("@AuthorityCheck.admin()")
     public ResponseBodyVO<PageInfo<SystemServerVO>> selectServer(PageVO pageVO) {
         return homePageService.selectServer(pageVO);
     }

+ 20 - 46
simulation-resource-server/src/main/java/com/css/simulation/resource/scene/ctrl/FileController.java → simulation-resource-server/src/main/java/com/css/simulation/resource/system/ctrl/FileController.java

@@ -1,13 +1,11 @@
-package com.css.simulation.resource.scene.ctrl;
+package com.css.simulation.resource.system.ctrl;
 
 import api.common.pojo.common.ResponseBodyVO;
 import api.common.pojo.constants.DictConstants;
 import api.common.pojo.param.MinioParameter;
-import api.common.pojo.param.RedisParameter;
-import api.common.util.ObjectUtil;
+import api.common.util.StringUtil;
 import api.common.util.TimeUtil;
 import com.css.simulation.resource.feign.FileDownService;
-import com.css.simulation.resource.feign.RedisService;
 import feign.Response;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.http.MediaType;
@@ -35,10 +33,7 @@ public class FileController {
     @Resource
     private FileDownService fileDownService;
 
-    @Resource
-    private RedisService redisService;
-
-    @PostMapping(value = "/uploadWj", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
+    @PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
     public ResponseBodyVO<Map> uploadWj(@RequestParam("file") MultipartFile multipartFile, HttpServletRequest request) {
         //获取文件类型
         String type = request.getParameter("type");
@@ -46,52 +41,33 @@ public class FileController {
         if (multipartFile != null) {
             String fileName = "";
             Integer nowTime = TimeUtil.getRq(new Date(), 0);
-            if (type.equals(DictConstants.SCENE_NATURAL)) {
-                fileName = "自然驾驶场景/" + nowTime + "/" + objectPath + "/" + multipartFile.getOriginalFilename();
-            } else if (type.equals(DictConstants.SCENE_STANDARD)) {
-                fileName = "标准法规场景/" + nowTime + "/" + objectPath + "/" + multipartFile.getOriginalFilename();
-            } else if (type.equals(DictConstants.SCENE_ACCIDENT)) {
-                fileName = "交通事故场景/" + nowTime + "/" + objectPath + "/" + multipartFile.getOriginalFilename();
-            } else if (type.equals(DictConstants.SCENE_GENERAL)) {
-                fileName = "泛化场景/" + nowTime + "/" + objectPath + "/" + multipartFile.getOriginalFilename();
+            String randomCode = StringUtil.getRandomCode();
+            if (type.equals(DictConstants.VEHICLE_IMG_FILE)) {
+                fileName = DictConstants.VEHICLE_IMG_FILE + "/" + objectPath + "/" + nowTime + "/" + randomCode + "/" + multipartFile.getOriginalFilename();
             } else {
-                fileName = multipartFile.getOriginalFilename();
+                new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE, "文件类型错误!");
             }
-            ResponseBodyVO<String> respon;
-            respon = fileDownService.upload(multipartFile, fileName);
-            String videoPreview = respon.getMessage();
-            Map map = new HashMap();
-           // map.put("videoPreview", videoPreview);
-            map.put("fileName", fileName);
-
-            return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS, map);
+            ResponseBodyVO<String> respon = fileDownService.upload(multipartFile, fileName);
+            if(respon.isStatus()){
+                String previewUrl = respon.getInfo();
+                Map map = new HashMap();
+                map.put("previewUrl", previewUrl);
+                map.put("fileName", fileName);
+                return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS, map);
+            }
+            new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE, "上传失败!");
         }
         return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE, "文件流file为空,请检查!");
     }
 
     @PostMapping(value = "/download")
-    public void download(
-            HttpServletResponse response, @RequestBody @Validated MinioParameter parms
-    ) throws IOException {
+    public void download( HttpServletResponse response, @RequestBody @Validated MinioParameter parms ) throws IOException {
         Response download = fileDownService.download(parms);
         Response.Body body = download.body();
         InputStream inputStream = body.asInputStream();
         downloadForHttp(parms.getObjectName(), inputStream, response, 1024);
     }
 
-    @PostMapping(value = "/getProgress")
-    public ResponseBodyVO getProgress(@RequestBody Map<String,String> paramMap){
-        String objectPath = paramMap.get("objectPath");
-        RedisParameter redisParameter = new RedisParameter();
-        redisParameter.setKey(DictConstants.ALGORITHM_KEY + objectPath);
-        ResponseBodyVO resp = redisService.getProgress(redisParameter);
-        if(ObjectUtil.isNull(resp.getInfo())){
-            resp.setInfo("0.00");
-        }
-        return resp;
-    }
-
-
 
     public void downloadForHttp(String fileName, InputStream in, HttpServletResponse response, int bufferSize) throws IOException {
         int idx = fileName.lastIndexOf("/");
@@ -110,17 +86,15 @@ public class FileController {
         }
     }
 
-//从minio获取文件列表
+    //从minio获取文件列表
     @PostMapping(value = "/queryList")
-    public List<String> queryList(@RequestBody @Validated MinioParameter parms
-    ) throws IOException {
+    public List<String> queryList(@RequestBody @Validated MinioParameter parms ) throws IOException {
         List<String> list = fileDownService.list(parms).getInfo();
         return list;
     }
 
     @PostMapping(value = "/queryList1")
-    public List<String> queryList1(@RequestBody @Validated MinioParameter parms
-    ) throws IOException {
+    public List<String> queryList1(@RequestBody @Validated MinioParameter parms ) throws IOException {
         List<String> list = fileDownService.listDeepOne(parms).getInfo();
         return list;
     }

+ 2 - 0
simulation-resource-server/src/main/java/com/css/simulation/resource/system/ctrl/SceneImportCtrl.java

@@ -52,6 +52,8 @@ public class SceneImportCtrl {
         //异步-启动上传
         String authorization = request.getHeader("Authorization");
         AuthorizationHolder.setAuthorization(authorization);
+        po.setCreateTime(null);//防止类型转换异常
+        po.setModifyTime(null);//防止类型转换异常
         sceneService.startImport(po);
         return response;
     }

+ 4 - 1
simulation-resource-server/src/main/java/com/css/simulation/resource/system/ctrl/UserCtrl.java

@@ -48,9 +48,12 @@ public class UserCtrl {
         if(ObjectUtil.isNull(userPO)){
             return new ResponseBodyVO(false, 400, "没有创建账户的权限!",null);
         }
-        if(ObjectUtil.isNull(userPO.getId())){
+        if("checkUsername".equals(userPO.getId())){
             return new ResponseBodyVO(false, 400, "账户名重复!",null);
         }
+        if("subUserNum".equals(userPO.getId())){
+            return new ResponseBodyVO(false, 400, "超出可创建子账户数量!",null);
+        }
         response.setInfo(userPO);
         return response;
     }

+ 3 - 0
simulation-resource-server/src/main/java/com/css/simulation/resource/system/mapper/UserMapper.java

@@ -38,4 +38,7 @@ public interface UserMapper {
     List<UserVO> checkPassword(UserVO userVO);
 
     void savePassword(UserPO userPO);
+
+    int getSubUserNum(@Param("createUserId") String createUserId);
+
 }

+ 14 - 0
simulation-resource-server/src/main/java/com/css/simulation/resource/system/service/DictService.java

@@ -134,6 +134,20 @@ public class DictService {
         return getDictMapsByTypes(dictParam);
     }
 
+    public Map<String, Map<String,String>> getDictMapsByTypes(String param,String ...arg) {
+        StringBuffer sb = new StringBuffer(param);
+        if(arg != null){
+            for (String s: arg) {
+                if(s != null && s != ""){
+                    sb.append(",").append(s);
+                }
+            }
+        }
+        DictParam dictParam = new DictParam();
+        dictParam.setDictTypes(sb.toString());
+        return getDictMapsByTypes(dictParam);
+    }
+
     public Map<String,String> getDictMapByType(String param) {
         DictParam dictParam = new DictParam();
         dictParam.setDictTypes(param);

+ 16 - 1
simulation-resource-server/src/main/java/com/css/simulation/resource/system/service/UserService.java

@@ -4,6 +4,7 @@ import api.common.pojo.constants.DictConstants;
 import api.common.pojo.constants.LogConstants;
 import api.common.pojo.param.system.UserParam;
 import api.common.pojo.po.system.UserPO;
+import api.common.pojo.vo.system.ParameterVO;
 import api.common.pojo.vo.system.UserVO;
 import api.common.util.EncryptUtil;
 import api.common.util.ObjectUtil;
@@ -38,6 +39,9 @@ public class UserService {
     @Autowired
     DictService dictService;
 
+    @Autowired
+    ParameterService parameterService;
+
     public UserVO getCurrentUserInfo() {
         String userId = AuthUtil.getCurrentUserId();
         UserVO userVO = userMapper.getUserInfo(userId);
@@ -83,6 +87,17 @@ public class UserService {
         }else if(DictConstants.ROLE_CODE_ADMIN.equals(currentUserRoleCode)){//子管理员
             userPO.setRoleCode(DictConstants.ROLE_CODE_UESR);
         }else if(DictConstants.ROLE_CODE_UESR.equals(currentUserRoleCode)){//普通用户
+            //新增参数校验
+            if(ObjectUtil.isNull(userPO.getId())){
+                ParameterVO parameter = parameterService.getParameterByUserId();
+                int num = parameter.getNumCreateUser();//最大用户数
+                String userId = AuthUtil.getCurrentUserId();
+                int subUserNum = userMapper.getSubUserNum(userId);
+                if(subUserNum >= num ){
+                    userPO.setId("subUserNum");
+                    return userPO;
+                }
+            }
             userPO.setRoleCode(DictConstants.ROLE_CODE_SUBUESR);
             //普通用户创建子账户时,占用类型继承
             userPO.setUseType(AuthUtil.getCurrentUseType());
@@ -92,7 +107,7 @@ public class UserService {
         //重名校验
         List<UserPO> list = userMapper.checkUsername(userPO);
         if(ObjectUtil.isNotNull(list)){
-            userPO.setId(null);
+            userPO.setId("checkUsername");
             return userPO;
         }
         PoUtil.initAddPo(userPO);

+ 4 - 1
simulation-resource-server/src/main/resources/mapper/system/UserMapper.xml

@@ -190,5 +190,8 @@
         where id = #{id,jdbcType=VARCHAR}
     </update>
 
-
+    <select id="getSubUserNum" parameterType="java.lang.String" resultType="java.lang.Integer">
+        select count(1) from system_user
+        where is_deleted = '0' AND create_user_id = #{createUserId,jdbcType=VARCHAR};
+    </select>
 </mapper>