lyhzzz hai 8 meses
pai
achega
a9c57d47ae

+ 5 - 3
src/main/java/com/fdkankan/fusion/common/util/MinIoChunkUtils.java

@@ -36,6 +36,7 @@ public class MinIoChunkUtils implements InitializingBean {
 
 
     public static String chunkBucKet;
+    public static Long chunkSize;
 
     private static MinioClient minioClient;
 
@@ -75,6 +76,7 @@ public class MinIoChunkUtils implements InitializingBean {
         accessKey =minIOConfig.getAccessKey();
         secretKey = minIOConfig.getSecretKey();
         chunkBucKet = minIOConfig.getBucketChunk();
+        chunkSize = minIOConfig.getChunkSize();
     }
 
     /**
@@ -155,7 +157,7 @@ public class MinIoChunkUtils implements InitializingBean {
      * @param chunkCount 分片数量
      * @return uploadChunkUrls
      */
-    public static List<String> createUploadChunkUrlList(String bucketName,String objectMD5,Integer chunkCount){
+    public static List<String> createUploadChunkUrlList(String bucketName,String objectMD5,Long chunkCount){
         if (null == bucketName){
             bucketName = chunkBucKet;
         }
@@ -166,7 +168,7 @@ public class MinIoChunkUtils implements InitializingBean {
         if(null == chunkCount || 0 == chunkCount){
             return null;
         }
-        List<String> urlList = new ArrayList<>(chunkCount);
+        List<String> urlList = new ArrayList<>();
         for (int i = 1; i <= chunkCount; i++){
             String objectName = objectMD5 + i + ".chunk";
             urlList.add(createUploadUrl(bucketName,objectName,DEFAULT_EXPIRY));
@@ -331,7 +333,7 @@ public class MinIoChunkUtils implements InitializingBean {
         }
         return expiry;
     }
-    public static String buZero(Integer size,Integer index){
+    public static String buZero(Long size,Integer index){
         String numStr = String.valueOf(size);
         return StringUtils.leftPad(String.valueOf(index),numStr.length()+1,'0');
     }

+ 2 - 0
src/main/java/com/fdkankan/fusion/config/MinIOConfig.java

@@ -20,5 +20,7 @@ public class MinIOConfig {
     private String secretKey;
     @Value("${minio.bucketChunk}")
     private String bucketChunk;
+    @Value("${minio.chunkSize}")
+    private Long chunkSize;
 
 }

+ 60 - 40
src/main/java/com/fdkankan/fusion/controller/UploadController.java

@@ -6,6 +6,7 @@ import com.fdkankan.fusion.common.util.MinIoChunkUtils;
 import com.fdkankan.fusion.entity.UploadChunk;
 import com.fdkankan.fusion.common.ResultData;
 import com.fdkankan.fusion.exception.BusinessException;
+import com.fdkankan.fusion.response.ChunkVo;
 import com.fdkankan.fusion.response.UploadChunkVo;
 import com.fdkankan.fusion.service.IUploadChunkService;
 import com.fdkankan.fusion.service.IUploadSceneService;
@@ -18,6 +19,7 @@ import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -36,43 +38,50 @@ public class UploadController {
         return ResultData.ok( uploadService.uploadFile(file,true,String.format(FilePath.File_OSS_PATH,environment,"")));
     }
 
-    @PostMapping("/getByFileMd5")
-    public ResultData getByFileMd5(@RequestBody UploadChunk uploadDto){
-        if(StringUtils.isBlank(uploadDto.getFileMd5()) ){
-            throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
-        }
-        return ResultData.ok(uploadChunkService.getByFileMd5(uploadDto.getFileMd5()));
-    }
-
 
     @Autowired
     IUploadChunkService uploadChunkService;
     @Autowired
     IUploadSceneService uploadSceneService;
+
     @PostMapping("/init-chunk-upload")
     public ResultData initChunkUpload(@RequestBody UploadChunk uploadDto){
-        if(StringUtils.isBlank(uploadDto.getFileMd5()) || StringUtils.isBlank(uploadDto.getFileName())
-                || uploadDto.getChunkCount() == null || uploadDto.getFileSize() ==null){
+        if(StringUtils.isBlank(uploadDto.getFileMd5()) || StringUtils.isBlank(uploadDto.getFileName()) || uploadDto.getFileSize() ==null){
             throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
         }
+
+        String suffix = uploadDto.getFileName().substring(uploadDto.getFileName().lastIndexOf("."));
+
+        Long chunkCount = uploadDto.getFileSize() / MinIoChunkUtils.chunkSize < 0 ? 1:uploadDto.getFileSize() / MinIoChunkUtils.chunkSize ;
+        uploadDto.setChunkCount(chunkCount);
+
         //校验文件md5,该文件是否上传过
         UploadChunk uploadChunk = uploadChunkService.getByFileMd5(uploadDto.getFileMd5());
+
         if(uploadChunk != null){
-            if(uploadChunk.getUploadStatus() == 1){
-                throw new BusinessException(ResultCode.FILE_EXITS);
+            if(uploadChunk.getUploadStatus() == 1 ){
+                return ResultData.ok(uploadChunk);
             }
             //续传
             //获取到该文件已上传分片
-            Map<Integer,String> okChunkMap = MinIoChunkUtils.mapChunkObjectNames(MinIoChunkUtils.chunkBucKet,uploadDto.getFileMd5());
-
-            List<UploadChunkVo> uploadChunkVos  = new ArrayList<>();
+            List<ChunkVo> uploadChunkVos  = new ArrayList<>();
+            Map<Integer,String> okChunkMap = new HashMap<>();
+            if(uploadDto.getChunkCount() >1){
+                  okChunkMap = MinIoChunkUtils.mapChunkObjectNames(MinIoChunkUtils.chunkBucKet,uploadDto.getFileMd5());
+            }
             for (int i = 1; i <= uploadDto.getChunkCount(); i++) {
                 //判断当前分片是否已经上传过了
                 if(!okChunkMap.containsKey(i)){
                     //生成分片上传url
-                    UploadChunkVo url = new UploadChunkVo();
+                    ChunkVo url = new ChunkVo();
                     url.setPartNumber(MinIoChunkUtils.buZero(uploadDto.getChunkCount(),i));
-                    url.setUploadUrl(MinIoChunkUtils.createUploadChunkUrl(MinIoChunkUtils.chunkBucKet,uploadDto.getFileMd5(),url.getPartNumber()));
+                    String uploadUrl = null;
+                    if(uploadDto.getChunkCount() >1){
+                         uploadUrl = MinIoChunkUtils.createUploadChunkUrl(MinIoChunkUtils.chunkBucKet,uploadDto.getFileMd5(),url.getPartNumber());
+                    }else {
+                         uploadUrl = MinIoChunkUtils.createUploadUrl(MinIoChunkUtils.chunkBucKet,uploadDto.getFileMd5() +"_result"+suffix);
+                    }
+                    url.setUploadUrl(uploadUrl);
                     uploadChunkVos.add(url);
                 }
             }
@@ -82,15 +91,25 @@ public class UploadController {
             return ResultData.ok(vo);
         }
         //初次上传和已有文件信息但未上传任何分片的情况下则直接生成所有上传url
-        List<String> uploadUrls = MinIoChunkUtils.createUploadChunkUrlList(MinIoChunkUtils.chunkBucKet,uploadDto.getFileMd5(),uploadDto.getChunkCount());
-        List<UploadChunkVo> uploadChunkVos  = new ArrayList<>();
+        List<ChunkVo> uploadChunkVos  = new ArrayList<>();
+        List<String> uploadUrls = new ArrayList<>();
+        if(uploadDto.getChunkCount() >1){
+            uploadUrls = MinIoChunkUtils.createUploadChunkUrlList(MinIoChunkUtils.chunkBucKet,uploadDto.getFileMd5(),uploadDto.getChunkCount());
+        }else {
+            uploadUrls.add("1");
+        }
         for (int i = 1; i <= uploadUrls.size(); i++) {
-            UploadChunkVo url = new UploadChunkVo();
-            url.setPartNumber(MinIoChunkUtils.buZero(uploadUrls.size(),i));
-            url.setUploadUrl(MinIoChunkUtils.createUploadChunkUrl(MinIoChunkUtils.chunkBucKet,uploadDto.getFileMd5(),url.getPartNumber()));
+            ChunkVo url = new ChunkVo();
+            url.setPartNumber(MinIoChunkUtils.buZero(Long.valueOf(uploadUrls.size()),i));
+            String uploadUrl = null;
+            if(uploadDto.getChunkCount() >1){
+                uploadUrl = MinIoChunkUtils.createUploadChunkUrl(MinIoChunkUtils.chunkBucKet,uploadDto.getFileMd5(),url.getPartNumber());
+            }else {
+                uploadUrl = MinIoChunkUtils.createUploadUrl(MinIoChunkUtils.chunkBucKet,uploadDto.getFileMd5() +"_result"+suffix);
+            }
+            url.setUploadUrl(uploadUrl);
             uploadChunkVos.add(url);
         }
-        String suffix = uploadDto.getFileName().substring(uploadDto.getFileName().lastIndexOf("."));
 
         //向数据库中记录该文件的上传信息
         UploadChunk uploadChunk2 = new UploadChunk();
@@ -113,28 +132,29 @@ public class UploadController {
         if(StringUtils.isBlank(uploadDto.getFileMd5()) ){
             throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
         }
-        //根据md5获取所有分片文件名称(minio的文件名称 = 文件path)
-        List<String> chunks = MinIoChunkUtils.listChunkObjectNames(MinIoChunkUtils.chunkBucKet,uploadDto.getFileMd5());
-
+        UploadChunk uploadChunk = uploadChunkService.getByFileMd5(uploadDto.getFileMd5());
+        if(uploadChunk == null){
+            throw new BusinessException(ResultCode.FILE_NOT_EXIST);
+        }
         //自定义文件名称
         String fileName = uploadDto.getFileName();
         String suffix = fileName.substring(fileName.lastIndexOf("."));
         fileName = uploadDto.getFileMd5()+"_result" + suffix;
         //合并文件
-        UploadChunk uploadChunk = uploadChunkService.getByFileMd5(uploadDto.getFileMd5());
-        if(uploadChunk == null){
-            throw new BusinessException(ResultCode.FILE_NOT_EXIST);
-        }
-        if(MinIoChunkUtils.composeObject(MinIoChunkUtils.chunkBucKet,chunks,fileName)){
-            //获取文件访问外链(1小时过期)
-            //String url = MinIoChunkUtils.getObjectUrl(MinIoChunkUtils.chunkBucKet,fileName,60);
-            String url = "/"+fileName;
-            //获取数据库里记录的文件信息,修改数据并返回文件信息
-            uploadChunkService.updateUrlByMd5(uploadDto.getFileMd5(),url);
-            uploadSceneService.updateStatusByUploadId(uploadChunk.getId(),1);
-            return ResultData.ok(uploadChunk);
+        String url = "/"+fileName;
+
+        //根据md5获取所有分片文件名称(minio的文件名称 = 文件path)
+        if(uploadChunk.getChunkCount() >1){
+            List<String> chunks = MinIoChunkUtils.listChunkObjectNames(MinIoChunkUtils.chunkBucKet,uploadDto.getFileMd5());
+            if(!MinIoChunkUtils.composeObject(MinIoChunkUtils.chunkBucKet,chunks,fileName)){
+                //String url = MinIoChunkUtils.getObjectUrl(MinIoChunkUtils.chunkBucKet,fileName,60);
+                uploadSceneService.updateStatusByUploadId(uploadChunk.getId(),-1);
+                throw new BusinessException(ResultCode.COMPOSE_FILE_ERROR);
+            }
         }
-        uploadSceneService.updateStatusByUploadId(uploadChunk.getId(),-1);
-        throw new BusinessException(ResultCode.COMPOSE_FILE_ERROR);
+        uploadChunkService.updateUrlByMd5(uploadDto.getFileMd5(),url);
+        uploadSceneService.updateStatusByUploadId(uploadChunk.getId(),1);
+        return ResultData.ok(uploadChunk);
+
     }
 }

+ 5 - 3
src/main/java/com/fdkankan/fusion/entity/UploadChunk.java

@@ -7,6 +7,9 @@ import com.baomidou.mybatisplus.annotation.TableLogic;
 import com.baomidou.mybatisplus.annotation.TableName;
 import java.io.Serializable;
 import java.util.Date;
+import java.util.List;
+
+import com.fdkankan.fusion.response.UploadChunkVo;
 import lombok.Getter;
 import lombok.Setter;
 
@@ -43,7 +46,7 @@ public class UploadChunk implements Serializable {
      * 分片数量
      */
     @TableField("chunk_count")
-    private Integer chunkCount;
+    private Long chunkCount;
 
     /**
      * 文件md5
@@ -61,7 +64,7 @@ public class UploadChunk implements Serializable {
      * 文件大小
      */
     @TableField("file_size")
-    private String fileSize;
+    private Long fileSize;
 
     /**
      * 后缀
@@ -93,5 +96,4 @@ public class UploadChunk implements Serializable {
 
 
 
-
 }

+ 4 - 0
src/main/java/com/fdkankan/fusion/mapper/IScenePlusMapper.java

@@ -1,9 +1,12 @@
 package com.fdkankan.fusion.mapper;
 
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.fdkankan.fusion.entity.ScenePlus;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.fdkankan.fusion.request.DataParam;
+import com.fdkankan.fusion.request.ScenePram;
 import com.fdkankan.fusion.response.DataGroupVo;
+import com.fdkankan.fusion.response.SceneVo;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
@@ -24,4 +27,5 @@ public interface IScenePlusMapper extends BaseMapper<ScenePlus> {
 
     List<DataGroupVo> groupByType(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("cameraIds") List<Long> cameraIds);
 
+    Page<SceneVo> pageList(Page<Object> objectPage, ScenePram param);
 }

+ 26 - 0
src/main/java/com/fdkankan/fusion/request/ScenePram.java

@@ -3,6 +3,7 @@ package com.fdkankan.fusion.request;
 import com.fdkankan.fusion.common.RequestBase;
 import lombok.Data;
 
+import java.util.Arrays;
 import java.util.List;
 
 @Data
@@ -23,8 +24,33 @@ public class ScenePram extends RequestBase {
 
     private String num;
 
+    private List<String> userNames;
+    private List<Integer> sceneSources;
+    private Integer isObj;
+
     public String getSceneName() {
         return sceneName== null ?null :sceneName.trim();
     }
 
+    public List<Integer> getSceneSources() {
+        if(type == null){
+            return Arrays.asList(1,2,12,13,14);
+        }
+        switch (type){
+            case 0 : return Arrays.asList(1,2,12,13,14);
+            case 1 : return Arrays.asList(3);
+            case 2 : return Arrays.asList(4);
+            case 4 : return Arrays.asList(4);
+            case 5 : return Arrays.asList(5);
+            case 6 : return Arrays.asList(5);
+            default: return Arrays.asList(type);
+        }
+    }
+
+    public Integer getIsObj() {
+        if(type == 4 || type == 6){
+            return 1;
+        }
+        return isObj;
+    }
 }

+ 17 - 0
src/main/java/com/fdkankan/fusion/response/ChunkVo.java

@@ -0,0 +1,17 @@
+package com.fdkankan.fusion.response;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import lombok.Data;
+
+@Data
+public class ChunkVo {
+    /**
+     * 分片序号
+     */
+    private String partNumber;
+
+    /**
+     * 上传地址
+     */
+    private String uploadUrl;
+}

+ 1 - 12
src/main/java/com/fdkankan/fusion/response/UploadChunkVo.java

@@ -9,17 +9,6 @@ import java.util.List;
 @Data
 public class UploadChunkVo extends UploadChunk {
 
-    /**
-     * 分片序号
-     */
-    @TableField(exist = false)
-    private String partNumber;
 
-    /**
-     * 上传地址
-     */
-    @TableField(exist = false)
-    private String uploadUrl;
-
-    private List<UploadChunkVo> uploadChunkVos;
+    private List<ChunkVo> uploadChunkVos;
 }

+ 5 - 0
src/main/java/com/fdkankan/fusion/service/IScenePlusService.java

@@ -1,9 +1,12 @@
 package com.fdkankan.fusion.service;
 
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.fdkankan.fusion.entity.ScenePlus;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.fdkankan.fusion.request.DataParam;
+import com.fdkankan.fusion.request.ScenePram;
 import com.fdkankan.fusion.response.DataGroupVo;
+import com.fdkankan.fusion.response.SceneVo;
 
 import java.util.List;
 
@@ -22,4 +25,6 @@ public interface IScenePlusService extends IService<ScenePlus> {
     List<DataGroupVo> groupByCameraId(DataParam param, List<Long> cameraIds);
 
     List<DataGroupVo> groupByType(DataParam param, List<Long> cameraIds);
+
+    Page<SceneVo> pageList(Page<Object> objectPage, ScenePram param);
 }

+ 3 - 0
src/main/java/com/fdkankan/fusion/service/ITmUserService.java

@@ -2,6 +2,7 @@ package com.fdkankan.fusion.service;
 
 import com.fdkankan.fusion.common.PageInfo;
 import com.fdkankan.fusion.entity.TmCamera;
+import com.fdkankan.fusion.entity.TmDepartment;
 import com.fdkankan.fusion.entity.TmUser;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.fdkankan.fusion.httpClient.response.FdkkResponse;
@@ -52,4 +53,6 @@ public interface ITmUserService extends IService<TmUser> {
     HashMap<String, TmUser> getByCamera(List<TmCamera> records);
 
     List<TmUser> getByDeptIds(List<String> deptIds);
+
+    HashMap<String, TmDepartment> getMapByUserNames(List<String> userNameList);
 }

+ 8 - 0
src/main/java/com/fdkankan/fusion/service/impl/ScenePlusServiceImpl.java

@@ -2,10 +2,13 @@ package com.fdkankan.fusion.service.impl;
 
 import com.baomidou.dynamic.datasource.annotation.DS;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.fdkankan.fusion.entity.ScenePlus;
 import com.fdkankan.fusion.mapper.IScenePlusMapper;
 import com.fdkankan.fusion.request.DataParam;
+import com.fdkankan.fusion.request.ScenePram;
 import com.fdkankan.fusion.response.DataGroupVo;
+import com.fdkankan.fusion.response.SceneVo;
 import com.fdkankan.fusion.service.IScenePlusService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.stereotype.Service;
@@ -41,4 +44,9 @@ public class ScenePlusServiceImpl extends ServiceImpl<IScenePlusMapper, ScenePlu
     public List<DataGroupVo> groupByType(DataParam param, List<Long> cameraIds) {
         return getBaseMapper().groupByType(param.getStartTime(),param.getEndTime(),cameraIds);
     }
+
+    @Override
+    public Page<SceneVo> pageList(Page<Object> objectPage, ScenePram param) {
+        return getBaseMapper().pageList(objectPage,param);
+    }
 }

+ 94 - 114
src/main/java/com/fdkankan/fusion/service/impl/SceneService.java

@@ -60,6 +60,10 @@ public class SceneService implements ISceneService {
     ICaseNumService caseNumService;
     @Autowired
     IMqSendLogService mqSendLogService;
+    @Autowired
+    IScenePlusService scenePlusService;
+    @Autowired
+    ITmUserService tmUserService;
 
     @Override
     public List<SceneVo> getSceneListAndModel(ScenePram param) {
@@ -84,137 +88,113 @@ public class SceneService implements ISceneService {
 
     @Override
     public PageInfo pageList(ScenePram param) {
-        if(param.getType() == null){
-           throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
+        if (param.getType() == null) {
+            throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
         }
-        List<TmCamera> tmCameraList = null;
-
-        if(StringUtils.isBlank(param.getShare() ) && StringUtils.isNotBlank(StpUtil.getTokenValue()) ){
-            tmCameraList = tmCameraService.getByDeptIds();
-            List<String> snCodes = tmCameraList.stream().map(TmCamera::getCameraSn).collect(Collectors.toList());
-            if(CollectionUtil.isNotEmpty(snCodes)){
-                param.setSnCodes(snCodes);
-            }
+        if (StringUtils.isBlank(param.getShare()) && StringUtils.isNotBlank(StpUtil.getTokenValue())) {
+            param.setDeptId(tmUserService.getLoginUser().getDeptId());
+        }
+        if (param.getCaseId() != null) {
+            String deptId = caseService.getDeptId(param.getCaseId());
+            param.setDeptId(deptId);
         }
-        if(StringUtils.isNotBlank(param.getDeptId())){
+        if (StringUtils.isNotBlank(param.getDeptId())) {
             List<TmDepartment> sonByDeptId = tmDepartmentService.getSonByDeptId(param.getDeptId());
             List<String> deptIds = sonByDeptId.stream().map(TmDepartment::getId).collect(Collectors.toList());
             deptIds.add(param.getDeptId());
-            List<TmCamera> tmCameras = tmCameraService.getByDeptIds(deptIds);
-            Set<String> snCodeSet = tmCameras.parallelStream().map(TmCamera::getCameraSn).collect(Collectors.toSet());
-            List<String> snCodes = param.getSnCodes();
-            if(snCodes == null){
-                snCodes = new ArrayList<>(snCodeSet);
-            }else {
-                snCodes = snCodes.stream().filter(snCodeSet::contains).collect(Collectors.toList());
-            }
-            param.setSnCodes(snCodes);
-        }
-        if(StringUtils.isNotBlank(param.getSnCode())){
-            List<String> snCodes = param.getSnCodes();
-            List<String> snCodes1 = new ArrayList<>();
-            snCodes1.add(param.getSnCode());
-            if(snCodes == null){
-                snCodes = snCodes1;
-            }else {
-                snCodes = snCodes.stream().filter(snCodes1::contains).collect(Collectors.toList());
-            }
-            param.setSnCodes(snCodes);
-        }
-        if(param.getCaseId() !=null){
-            String deptId =  caseService.getDeptId(param.getCaseId());
-            List<TmCamera> tmCameras = tmCameraService.getByDeptIds(Arrays.asList(deptId));
-            List<String> snCodes = param.getSnCodes();
-            List<String> snCodes1 = tmCameras.stream().map(TmCamera::getCameraSn).collect(Collectors.toList());
-            snCodes1.add(param.getSnCode());
-            if(snCodes == null){
-                snCodes = snCodes1;
-            }else {
-                snCodes = snCodes.stream().filter(snCodes1::contains).collect(Collectors.toList());
-            }
-            param.setSnCodes(snCodes);
+            List<TmUser> byDeptIds = tmUserService.getByDeptIds(deptIds);
+            List<String> userNames = byDeptIds.stream().map(TmUser::getUserName).collect(Collectors.toList());
+            param.setUserNames(userNames);
         }
 
-        if(CollectionUtil.isEmpty(param.getSnCodes()) && CollectionUtil.isEmpty(param.getNumList())){
-            if(StpUtil.hasRole("admin-super") && StringUtils.isBlank(param.getSnCode()) && StringUtils.isBlank(param.getDeptId())){
-                List<TmCamera> tmCameras = tmCameraService.list();
-                Set<String> snCodeSet = tmCameras.parallelStream().map(TmCamera::getCameraSn).collect(Collectors.toSet());
-                param.setSnCodes(new ArrayList<>(snCodeSet));
-            }else {
-                return PageInfo.PageInfoEmpty();
-            }
-        }
-        List<SceneVo> sceneVoList = new ArrayList<>();
-        long total = 0;
-        if(param.getType() == 0 || param.getType() == 1 || param.getType() == 4 || param.getType() == 6){      //看看,看见 ,深时obj
-            //获取四维(看看,看见)场景数据
-            FdkkResponse fdkkResponse = fdKKClient.sceneList(param);
-            if(fdkkResponse.getCode() !=0){
-                throw new BusinessException(fdkkResponse.getCode(),fdkkResponse.getMsg());
-            }
-            PageInfo pageInfo = JSONObject.parseObject(JSONObject.toJSONString(fdkkResponse.getData()), PageInfo.class);
-            total =  pageInfo.getTotal();
-            JSONArray list = JSONArray.parseArray(JSONObject.toJSONString( pageInfo.getList()));
-            sceneVoList = overSceneVo(list,param.getType());
+        Page<SceneVo> sceneVoPage = scenePlusService.pageList(new Page<>(param.getPageNum(), param.getPageSize()), param);
 
-        }
-        if(param.getType() == 2 || param.getType() == 5){       //深时
-            //获取激光(深时)场景数据
-            LaserSceneParam laserSceneParam = new LaserSceneParam();
-            laserSceneParam.setPageNum(param.getPageNum());
-            laserSceneParam.setPageSize(param.getPageSize());
-            laserSceneParam.setStatus(param.getStatus());
-            laserSceneParam.setSnCodes(param.getSnCodes());
-            if(param.getType() == 5){
-                laserSceneParam.setSceneSource(5);
-            }
-            if(StringUtils.isNotBlank(param.getSceneName())){
-                laserSceneParam.setTitle(param.getSceneName());
-            }
-            if(param.getNumList() != null && param.getNumList().size() >0){
-                laserSceneParam.setSceneCodes(param.getNumList());
-            }
-            FdkkResponse fdkkResponse = laserClient.sceneList(laserSceneParam);
-            if(fdkkResponse.getCode() !=200){
-                throw new BusinessException(fdkkResponse.getCode(),fdkkResponse.getMsg());
-            }
-            JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(fdkkResponse.getData()));
-            JSONArray list = jsonObject.getJSONArray("list");
-            total =jsonObject.getLong("total");
-            for (Object o : list) {
-                String res = JSONObject.toJSONString(o);
-                SceneVo vo = JSONObject.parseObject(res,SceneVo.class);
-                if( StringUtils.isEmpty(vo.getPhone())){
-                    vo.setBind(false);
-                }
-                if(vo.getStatus() == 4){    //4生成OBJ中设置为计算中
-                    vo.setStatus(0);
-                }
-                vo.setType(param.getType());
-                sceneVoList.add(vo);
-            }
-        }
-        Set<String> snCodes = sceneVoList.stream().map(SceneVo::getSnCode).collect(Collectors.toSet());
-        List<SceneVo> modelingScene = sceneVoList.stream().filter(e -> e.getStatus() == 0).collect(Collectors.toList());
-        List<String> numList = modelingScene.stream().map(SceneVo::getNum).collect(Collectors.toList());
-        HashMap<String,Boolean> modelingMap =  mqSendLogService.getMapByNumList(numList);
+//        List<String> laserNumList = sceneVoPage.getRecords().stream().filter(e-> e.getType() == 2 || e.getType() == 4)
+//                .map(SceneVo::getNum).collect(Collectors.toList());
+
+        List<String> modelingScene = sceneVoPage.getRecords().stream().filter(e -> e.getStatus() == 0).map(SceneVo::getNum).collect(Collectors.toList());
+        HashMap<String,Boolean> modelingMap =  mqSendLogService.getMapByNumList(modelingScene);
 
-        HashMap<String, TmDepartment> map = tmCameraService.getMapBySnCodes(snCodes);
-        for (SceneVo sceneVo : sceneVoList) {
-            TmDepartment tmDepartment = map.get(sceneVo.getSnCode().toUpperCase());
-            if(tmDepartment != null){
+        List<String> userNameList = sceneVoPage.getRecords().stream().map(Model::getUserName).collect(Collectors.toList());
+        HashMap<String, TmDepartment> map = tmUserService.getMapByUserNames(userNameList);
+        for (SceneVo sceneVo : sceneVoPage.getRecords()) {
+            TmDepartment tmDepartment = map.get(sceneVo.getUserName());
+            if (tmDepartment != null) {
                 sceneVo.setDeptId(tmDepartment.getId());
                 sceneVo.setDeptName(tmDepartment.getName());
             }
             if(modelingMap.get(sceneVo.getNum()) != null && !modelingMap.get(sceneVo.getNum())){
                 sceneVo.setStatus(5);
             }
+            sceneVo.setPayStatus(1);
+            sceneVo.setSceneName(sceneVo.getTitle());
+            sceneVo.setName(sceneVo.getTitle());
+            sceneVo.setStatus(setLaserStatus(sceneVo.getStatus(),sceneVo.getPayStatus()));
+
         }
-        Page<SceneVo> voPage = new Page<>(param.getPageNum(),param.getPageSize());
-        voPage.setRecords(sceneVoList);
-        voPage.setTotal(total);
-        return PageInfo.PageInfo(voPage);
+
+        return PageInfo.PageInfo(sceneVoPage);
     }
+//        List<SceneVo> sceneVoList = new ArrayList<>();
+//        long total = 0;
+//        if(param.getType() == 0 || param.getType() == 1 || param.getType() == 4 || param.getType() == 6){      //看看,看见 ,深时obj
+//            //获取四维(看看,看见)场景数据
+//            FdkkResponse fdkkResponse = fdKKClient.sceneList(param);
+//            if(fdkkResponse.getCode() !=0){
+//                throw new BusinessException(fdkkResponse.getCode(),fdkkResponse.getMsg());
+//            }
+//            PageInfo pageInfo = JSONObject.parseObject(JSONObject.toJSONString(fdkkResponse.getData()), PageInfo.class);
+//            total =  pageInfo.getTotal();
+//            JSONArray list = JSONArray.parseArray(JSONObject.toJSONString( pageInfo.getList()));
+//            sceneVoList = overSceneVo(list,param.getType());
+//
+//        }
+//        if(param.getType() == 2 || param.getType() == 5){       //深时
+//            //获取激光(深时)场景数据
+//            LaserSceneParam laserSceneParam = new LaserSceneParam();
+//            laserSceneParam.setPageNum(param.getPageNum());
+//            laserSceneParam.setPageSize(param.getPageSize());
+//            laserSceneParam.setStatus(param.getStatus());
+//            laserSceneParam.setSnCodes(param.getSnCodes());
+//            if(param.getType() == 5){
+//                laserSceneParam.setSceneSource(5);
+//            }
+//            if(StringUtils.isNotBlank(param.getSceneName())){
+//                laserSceneParam.setTitle(param.getSceneName());
+//            }
+//            if(param.getNumList() != null && param.getNumList().size() >0){
+//                laserSceneParam.setSceneCodes(param.getNumList());
+//            }
+//            FdkkResponse fdkkResponse = laserClient.sceneList(laserSceneParam);
+//            if(fdkkResponse.getCode() !=200){
+//                throw new BusinessException(fdkkResponse.getCode(),fdkkResponse.getMsg());
+//            }
+//            JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(fdkkResponse.getData()));
+//            JSONArray list = jsonObject.getJSONArray("list");
+//            total =jsonObject.getLong("total");
+//            for (Object o : list) {
+//                String res = JSONObject.toJSONString(o);
+//                SceneVo vo = JSONObject.parseObject(res,SceneVo.class);
+//                if( StringUtils.isEmpty(vo.getPhone())){
+//                    vo.setBind(false);
+//                }
+//                if(vo.getStatus() == 4){    //4生成OBJ中设置为计算中
+//                    vo.setStatus(0);
+//                }
+//                vo.setType(param.getType());
+//                sceneVoList.add(vo);
+//            }
+//        }
+//        Set<String> snCodes = sceneVoList.stream().map(SceneVo::getSnCode).collect(Collectors.toSet());
+
+//
+
+//        }
+//        Page<SceneVo> voPage = new Page<>(param.getPageNum(),param.getPageSize());
+//        voPage.setRecords(sceneVoList);
+//        voPage.setTotal(total);
+//        return PageInfo.PageInfo(voPage);
+   // }
 
     /**
      * 四维看看返回数据格式转换

+ 27 - 0
src/main/java/com/fdkankan/fusion/service/impl/TmUserServiceImpl.java

@@ -385,4 +385,31 @@ public class TmUserServiceImpl extends ServiceImpl<ITmUserMapper, TmUser> implem
         wrapper.in(TmUser::getDeptId,deptIds);
         return this.list(wrapper);
     }
+
+
+    @Override
+    public HashMap<String, TmDepartment> getMapByUserNames(List<String> userNameList) {
+        HashMap<String, TmDepartment> map = new HashMap<>();
+        if(userNameList.isEmpty()){
+            return map;
+        }
+        LambdaQueryWrapper<TmUser> wrapper = new LambdaQueryWrapper<>();
+        wrapper.in(TmUser::getUserName,userNameList);
+        List<TmUser> list = this.list(wrapper);
+        if(list.isEmpty()){
+            return map;
+        }
+        List<String> deptIds = list.stream().map(TmUser::getDeptId).collect(Collectors.toList());
+        List<TmDepartment> tmDepartments = tmDepartmentService.listByIds(deptIds);
+        if(tmDepartments.isEmpty()){
+            return map;
+        }
+        HashMap<String,TmDepartment> departmentHashMap = new HashMap<>();
+        tmDepartments.forEach( e -> departmentHashMap.put(e.getId(),e));
+
+        for (TmUser tmUser : list) {
+            map.put(tmUser.getUserName(),departmentHashMap.get(tmUser.getDeptId()));
+        }
+        return map;
+    }
 }

+ 11 - 10
src/main/resources/application.yaml

@@ -24,19 +24,19 @@ spring:
           driver-class-name: com.mysql.jdbc.Driver
           #url: jdbc:mysql://120.25.146.52:13306/fd_fusion?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai&allowMultiQueries=true
           #url: jdbc:mysql://192.168.0.25:3306/fd_fusion_xj?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai&allowMultiQueries=true
-          url: jdbc:mysql://127.0.0.1:3306/fd_fusion_xj?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai&allowMultiQueries=true
+          url: jdbc:mysql://192.168.9.27:3306/fd_fusion_xj?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai&allowMultiQueries=true
           username: root
           password: mysql123!ROOT.
         db2:
           driver-class-name: com.mysql.jdbc.Driver
           #url: jdbc:mysql://192.168.0.25:3306/4dkankan_v4?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai&allowMultiQueries=true
-          url: jdbc:mysql://127.0.0.1:3306/4dkankan_v4?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai&allowMultiQueries=true
+          url: jdbc:mysql://192.168.9.27:3306/4dkankan_v4?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai&allowMultiQueries=true
           username: root
           password: mysql123!ROOT.
 
 
   redis:
-    host: 127.0.0.1
+    host: 192.168.9.27
     port: 6379
     timeout: 6000ms
     password: redis123!ROOT.
@@ -51,11 +51,11 @@ spring:
 
 4dkk:
   laserService:
-    basePath: http://127.0.0.1:9795
+    basePath: http://192.168.9.27:9795
   fdService:
-    basePath: http://127.0.0.1:8081
+    basePath: http://192.168.9.27:8081
   takeLookService:
-    basePath: http://127.0.0.1:8081
+    basePath: http://192.168.9.27:8081
 
 
 
@@ -119,11 +119,12 @@ fdkk:
 
 # MinIO 配置
 minio:
-  endpoint: http://127.0.0.1:9000      # MinIO服务地址
-  fileHost: http://127.0.0.1:9000      # 文件地址host
+  endpoint: http://192.168.9.27:9000      # MinIO服务地址
+  fileHost: http://192.168.9.27:9000      # 文件地址host
   bucketName: laser-data                      # 存储桶bucket名称
-  accessKey: Ux8mKEBFj4j2N63Kdj5g                         # 用户名
-  secretKey: cPA5XSYcDzTCIHbeBxaSqzt9ZQjLZFbgQe38EiRW      # 密码
+  accessKey: 2dn1SibXOo1VrKWERTrE                         # 用户名
+  secretKey: RrKrSifN6BwFpqMKp8g1xg4xoN0u8wUSuDEWkpMK      # 密码
   bucketChunk: fusion-chunk
+  chunkSize: 5253125
 
 

+ 30 - 0
src/main/resources/mapper/fusion/ScenePlusMapper.xml

@@ -33,4 +33,34 @@
         </if>
         group by scene_source
     </select>
+
+    <select id="pageList" resultType="com.fdkankan.fusion.response.SceneVo">
+        select s.id,s.title,a.sn_code,s.create_time, s.scene_status as status,e.thumb,e.web_site ,u.user_name from t_scene_plus s
+            left join t_scene_plus_ext e on s.id = e.plus_id
+            left join t_camera a on s.camera_id = a.id
+            left join t_user u on s.user_id = u.id
+        where s.rec_status = 'A'
+        <if test="param.snCode != null and param.snCode != ''">
+            and a.sn_code like concat ('%',#{param.snCode},'%')
+        </if>
+        <if test="param.sceneName != null and param.sceneName != ''">
+            and s.title like concat ('%',#{param.sceneName},'%')
+        </if>
+        <if test="param.userNames != null and param.userNames.size >0">
+            and u.user_name in
+            <foreach collection="param.userNames" item="userName" open="(" separator="," close=")">
+                #{userName}
+            </foreach>
+        </if>
+        <if test="param.isObj != null and param.isObj == 1">
+            and e.is_obj = 1
+        </if>
+        <if test="param.sceneSources != null and param.sceneSources.size >0">
+            and s.scene_source in
+            <foreach collection="param.sceneSources" item="sceneSource" open="(" separator="," close=")">
+                #{sceneSource}
+            </foreach>
+        </if>
+        order by s.id desc
+    </select>
 </mapper>