lyhzzz 8 tháng trước cách đây
mục cha
commit
66d04d9342

+ 3 - 0
doc/update-1.6.0.sql

@@ -38,3 +38,6 @@ ALTER TABLE `4dkankan_v4`.`jy_scene_auth`
 
 ALTER TABLE `4dkankan_v4`.`jy_scene_user_auth`
     ADD COLUMN `case_id` int NULL AFTER `update_time`;
+
+
+UPDATE t_scene_plus_ext set thumb = '/oss/loading/thumb.jpg' WHERE thumb LIKE '%https://4dkk.4dage.com/loading/thumb.jpg%'

+ 27 - 2
src/main/java/com/fdkankan/manage/controller/CaseController.java

@@ -1,12 +1,15 @@
 package com.fdkankan.manage.controller;
 
 
+import cn.dev33.satoken.stp.StpUtil;
 import com.fdkankan.manage.common.ResultCode;
 import com.fdkankan.manage.common.ResultData;
 import com.fdkankan.manage.entity.Case;
+import com.fdkankan.manage.entity.JySceneAuth;
+import com.fdkankan.manage.entity.JySceneUserAuth;
+import com.fdkankan.manage.entity.JyUser;
 import com.fdkankan.manage.exception.BusinessException;
-import com.fdkankan.manage.service.ICaseNumService;
-import com.fdkankan.manage.service.ICaseService;
+import com.fdkankan.manage.service.*;
 import com.fdkankan.manage.vo.request.CaseNumType;
 import com.fdkankan.manage.vo.request.CaseParam;
 import com.sun.corba.se.spi.oa.OADestroyed;
@@ -16,6 +19,7 @@ import org.springframework.web.bind.annotation.*;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
+import java.util.stream.Collectors;
 
 /**
  * <p>
@@ -33,9 +37,30 @@ public class CaseController {
     ICaseService caseService;
     @Autowired
     ICaseNumService caseNumService;
+    @Autowired
+    IJySceneAuthService sceneAuthService;
+    @Autowired
+    IJySceneUserAuthService jySceneUserAuthService;
+    @Autowired
+    IJyUserService  jyUserService;
 
     @PostMapping("/list")
     public ResultData pageList(@RequestBody CaseParam param){
+        if(param.getIsShare() == 0){
+            return ResultData.ok(caseService.pageList(param));
+        }
+        List<JySceneAuth> sceneAuths = sceneAuthService.getAllCase();
+        List<Integer> caseIds = sceneAuths.stream().map(JySceneAuth::getCaseId).collect(Collectors.toList());
+
+        JyUser jyUser = jyUserService.getBySysId(StpUtil.getLoginId());
+
+        List<JySceneUserAuth> jySceneUserAuths = jySceneUserAuthService.getByJyUserId(jyUser.getId());
+        List<Integer> caseIds2 = jySceneUserAuths.stream().map(JySceneUserAuth::getCaseId).collect(Collectors.toList());
+
+        List<Integer> caseIdAll = new ArrayList<>();
+        caseIdAll.addAll(caseIds);
+        caseIdAll.addAll(caseIds2);
+        param.setCaseIds(caseIdAll);
         return ResultData.ok(caseService.pageList(param));
     }
 

+ 7 - 1
src/main/java/com/fdkankan/manage/entity/CommonUpload.java

@@ -38,11 +38,17 @@ public class CommonUpload implements Serializable {
     private String newFileName;
 
     @TableField("file_type")
-    private String fileType;
+    private Integer fileType;
+
+    @TableField("file_type_str")
+    private String fileTypeStr;
 
     @TableField("file_format")
     private String fileFormat;
 
+    @TableField("result_file_format")
+    private String resultFileFormat;
+
     @TableField("rec_status")
     @TableLogic(value = "A",delval = "I")
     private String recStatus;

+ 2 - 1
src/main/java/com/fdkankan/manage/service/ICommonUploadService.java

@@ -1,5 +1,6 @@
 package com.fdkankan.manage.service;
 
+import com.fdkankan.manage.constant.FileTypeEnum;
 import com.fdkankan.manage.entity.CommonUpload;
 import com.baomidou.mybatisplus.extension.service.IService;
 
@@ -13,5 +14,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface ICommonUploadService extends IService<CommonUpload> {
 
-    CommonUpload add(String replace, String url, String s, String uuid, String msg, String replace1,Integer status,String unzipPath,Integer dictId);
+    CommonUpload add(String replace, String url, String s, String uuid, FileTypeEnum fileTypeEnum,String resultFormat, String replace1, Integer status, String unzipPath, Integer dictId);
 }

+ 2 - 0
src/main/java/com/fdkankan/manage/service/IJySceneAuthService.java

@@ -27,4 +27,6 @@ public interface IJySceneAuthService extends IService<JySceneAuth> {
     JySceneAuth getByCaseId(Integer caseId);
 
     void updateAuthTypeByCaseId(Integer caseId, Integer authType);
+
+    List<JySceneAuth> getAllCase();
 }

+ 9 - 2
src/main/java/com/fdkankan/manage/service/impl/CaseServiceImpl.java

@@ -45,11 +45,18 @@ public class CaseServiceImpl extends ServiceImpl<ICaseMapper, Case> implements I
     @Override
     public Object pageList(CaseParam param) {
         LambdaQueryWrapper<Case> wrapper = new LambdaQueryWrapper<>();
-        wrapper.eq(Case::getSysUserId,StpUtil.getLoginId());
-
+        if(param.getIsShare() == 0){
+            wrapper.eq(Case::getSysUserId,StpUtil.getLoginId());
+        }
         if(StringUtils.isNotBlank(param.getCaseTitle())){
             wrapper.like(Case::getCaseTitle,param.getCaseTitle());
         }
+        if(param.getIsShare() == 1){
+            if(param.getCaseIds().isEmpty()){
+                return PageInfo.PageInfo(new Page<>(param.getPageNum(),param.getPageSize()));
+            }
+            wrapper.in(Case::getCaseId,param.getCaseIds());
+        }
         Page<Case> page = this.page(new Page<>(param.getPageNum(), param.getPageSize()), wrapper);
         return PageInfo.PageInfo(page);
     }

+ 8 - 4
src/main/java/com/fdkankan/manage/service/impl/CommonServiceImpl.java

@@ -114,7 +114,8 @@ public class CommonServiceImpl implements ICommonService {
             if(fileTypeEnum == null){
                 throw new BusinessException(ResultCode.FILE_TYPE_ERROR2);
             }
-            CommonUpload commonUpload = commonUploadService.add(originalFilename.replace(extName, ""), url, String.valueOf(file.getSize()), uuid, fileTypeEnum.getMsg(), extName.replace(".", ""),1,null,dictId);
+            String format = extName.replace(".", "");
+            CommonUpload commonUpload = commonUploadService.add(originalFilename.replace(extName, ""), url, String.valueOf(file.getSize()), uuid, fileTypeEnum, format,format,1,null,dictId);
             tempFile.delete();
             return ResultData.ok(commonUpload);
         }catch (Exception e){
@@ -143,14 +144,17 @@ public class CommonServiceImpl implements ICommonService {
         }
         String modelFileFormat = modelFile.getName().split("\\.")[1].toLowerCase();
         String url = null;
+        String resultFormat = modelFileFormat;
         switch (modelFileFormat){
-            case "obj" :  url = uploadObjOss(unzipPath,modelFile);break;
+            case "obj" :  resultFormat = "glb";
+                          url = uploadObjOss(unzipPath,modelFile);break;
             case "laz" :
             case "shp" :   url = uploadOss(unzipPath,modelFile); break;
             case "b3dm" :  url = uploadB3dm(unzipPath,modelFile); break;
             case "las" :
             case "ply" :  url = uploadLasOrPly(unzipPath,modelFile);break;
-            case "osgb":  uploadOsgb(unzipPath,modelFile) ;break;
+            case "osgb":  resultFormat = "b3dm";
+                           uploadOsgb(unzipPath,modelFile) ;break;
             default: break;
         }
         FileTypeEnum fileTypeEnum = FileTypeEnum.getByType(modelFileFormat);
@@ -159,7 +163,7 @@ public class CommonServiceImpl implements ICommonService {
         }
         Integer status = StringUtils.isNotBlank(url) ?1:0;
         CommonUpload commonUpload = commonUploadService.add(oldName,url, String.valueOf(tempFile.length()),
-                null, fileTypeEnum.getMsg(), modelFileFormat,status,unzipPath,dictId);
+                null, fileTypeEnum, modelFileFormat,resultFormat,status,unzipPath,dictId);
         tempFile.delete();
         return ResultData.ok(commonUpload);
     }

+ 5 - 2
src/main/java/com/fdkankan/manage/service/impl/CommonUploadServiceImpl.java

@@ -1,6 +1,7 @@
 package com.fdkankan.manage.service.impl;
 
 import cn.dev33.satoken.stp.StpUtil;
+import com.fdkankan.manage.constant.FileTypeEnum;
 import com.fdkankan.manage.entity.CommonUpload;
 import com.fdkankan.manage.entity.DictFile;
 import com.fdkankan.manage.mapper.ICommonUploadMapper;
@@ -24,14 +25,16 @@ public class CommonUploadServiceImpl extends ServiceImpl<ICommonUploadMapper, Co
     @Autowired
     IDictFileService dictFileService;
     @Override
-    public CommonUpload add(String fileName, String url, String fileSize, String uuid, String msg, String replace1,Integer status,String unzipPath,Integer dictId) {
+    public CommonUpload add(String fileName, String url, String fileSize, String uuid, FileTypeEnum fileTypeEnum, String resultFormat,String replace1, Integer status, String unzipPath, Integer dictId) {
         CommonUpload upload = new CommonUpload();
         upload.setFileName(fileName);
         upload.setFileUrl(url);
         upload.setFileSize(fileSize);
         upload.setNewFileName(uuid);
-        upload.setFileType(msg);
+        upload.setFileType(fileTypeEnum.getCode());
+        upload.setFileTypeStr(fileTypeEnum.getMsg());
         upload.setFileFormat(replace1);
+        upload.setResultFileFormat(resultFormat);
         upload.setStatus(status);
         upload.setUnzipPath(unzipPath);
         this.save(upload);

+ 2 - 48
src/main/java/com/fdkankan/manage/service/impl/DictFileServiceImpl.java

@@ -49,55 +49,9 @@ public class DictFileServiceImpl extends ServiceImpl<IDictFileMapper, DictFile>
         if(StringUtils.isBlank(param.getTypeKey())){
             throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
         }
-
+        param.setSysUserId( Long.valueOf( StpUtil.getLoginId().toString()));
         Page<DictFileVo> pageVo = this.getBaseMapper().pageList(new Page<>(param.getPageNum(),param.getPageSize()),param);
-
-
-        LambdaQueryWrapper<DictFile> wrapper = new LambdaQueryWrapper<>();
-        if(StringUtils.isNotBlank(param.getName())){
-            wrapper.like(DictFile::getName,param.getName());
-        }
-        if(param.getDictId() != null){
-            wrapper.eq(DictFile::getDictId,param.getDictId());
-        }
-        if(param.getFileFormats() != null && !param.getFileFormats().isEmpty()){
-        }
-        wrapper.eq(DictFile::getSysUserId, StpUtil.getLoginId());
-        wrapper.orderByDesc(DictFile::getId);
-
-        Page<DictFile> page = this.page(new Page<>(param.getPageNum(), param.getPageSize()), wrapper);
-        List<Integer> uploadIds = page.getRecords().stream().map(DictFile::getUploadId).collect(Collectors.toList());
-        HashMap<Integer,CommonUpload> map = new HashMap<>();
-        if(!uploadIds.isEmpty()){
-            List<CommonUpload> commonUploads = commonUploadService.listByIds(uploadIds);
-            commonUploads.forEach(e -> map.put(e.getId(),e));
-        }
-        List<Integer> dictIds = page.getRecords().stream().map(DictFile::getDictId).collect(Collectors.toList());
-
-        HashMap<Integer, Dict> dictHashMap = new HashMap<>();
-        if(!dictIds.isEmpty()){
-            List<Dict> dictList = dictService.listByIds(uploadIds);
-            dictList.forEach(e -> dictHashMap.put(e.getId(),e));
-        }
-
-        List<DictFileVo> voList = new ArrayList<>();
-        for (DictFile record : page.getRecords()) {
-            DictFileVo vo = new DictFileVo();
-            CommonUpload upload = map.get(record.getUploadId());
-            if(upload != null){
-                BeanUtils.copyProperties(upload,vo);
-            }
-            BeanUtils.copyProperties(record,vo);
-            Dict dict = dictHashMap.get(record.getDictId());
-            if(dict != null){
-                vo.setDictName(dict.getDictName());
-            }
-            voList.add(vo);
-        }
-        Page<DictFileVo> voPage = new Page<>(param.getPageNum(),param.getPageSize());
-        voPage.setTotal(page.getTotal());
-        voPage.setRecords(voList);
-        return PageInfo.PageInfo(voPage);
+        return PageInfo.PageInfo(pageVo);
     }
 
     @Override

+ 7 - 0
src/main/java/com/fdkankan/manage/service/impl/JySceneAuthServiceImpl.java

@@ -92,4 +92,11 @@ public class JySceneAuthServiceImpl extends ServiceImpl<IJySceneAuthMapper, JySc
         wrapper.eq(JySceneAuth::getCaseId,caseId);
         return this.getOne(wrapper);
     }
+
+    @Override
+    public List<JySceneAuth> getAllCase() {
+        LambdaQueryWrapper<JySceneAuth> wrapper = new LambdaQueryWrapper<>();
+        wrapper.isNotNull(JySceneAuth::getCaseId);
+        return this.list(wrapper);
+    }
 }

+ 35 - 11
src/main/java/com/fdkankan/manage/service/impl/JySceneUserAuthServiceImpl.java

@@ -63,7 +63,7 @@ public class JySceneUserAuthServiceImpl extends ServiceImpl<IJySceneUserAuthMapp
 
     @Override
     public Object getAuthType(SceneParam param) {
-        if(StringUtils.isBlank(param.getNum()) || param.getCaseId() == null){
+        if(StringUtils.isBlank(param.getNum()) && param.getCaseId() == null){
             throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
         }
         if(StringUtils.isNotBlank(param.getNum()) && param.getCaseId() !=null){
@@ -97,7 +97,7 @@ public class JySceneUserAuthServiceImpl extends ServiceImpl<IJySceneUserAuthMapp
 
     @Override
     public Object getAuthList(SceneParam param) {
-        if(StringUtils.isBlank(param.getNum()) || param.getCaseId() == null){
+        if(StringUtils.isBlank(param.getNum()) && param.getCaseId() == null){
             throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
         }
         if(StringUtils.isNotBlank(param.getNum()) && param.getCaseId() !=null){
@@ -205,7 +205,7 @@ public class JySceneUserAuthServiceImpl extends ServiceImpl<IJySceneUserAuthMapp
     @Override
     public void setAuthType(JySceneUserAuth param) {
 
-        if(StringUtils.isBlank(param.getNum()) || param.getCaseId() == null || param.getAuthType() == null){
+        if((StringUtils.isBlank(param.getNum()) && param.getCaseId() == null )|| param.getAuthType() == null){
             throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
         }
         if(StringUtils.isNotBlank(param.getNum()) && param.getCaseId() !=null){
@@ -231,7 +231,7 @@ public class JySceneUserAuthServiceImpl extends ServiceImpl<IJySceneUserAuthMapp
 
     @Override
     public synchronized void addAuth(JySceneUserAuth param) {
-        if(StringUtils.isBlank(param.getNum()) || param.getCaseId() == null ){
+        if(StringUtils.isBlank(param.getNum()) && param.getCaseId() == null ){
             throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
         }
 
@@ -408,15 +408,33 @@ public class JySceneUserAuthServiceImpl extends ServiceImpl<IJySceneUserAuthMapp
 
     @Override
     public Object checkAuthOther(JySceneUserAuth param) {
-        if(StringUtils.isBlank(param.getNum())){
+        if(StringUtils.isBlank(param.getNum()) && param.getCaseId() == null){
             throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
         }
-        ScenePro pro = sceneProService.getByNum(param.getNum());
-        ScenePlus plus = scenePlusService.getByNum(param.getNum());
-        if(pro == null && plus == null){
-            throw new BusinessException(ResultCode.SCENE_NOT_EXITS);
+        if(StringUtils.isNotBlank(param.getNum()) && param.getCaseId() !=null){
+            param.setCaseId(null);
         }
-        Long sceneUserId = pro == null ? plus.getUserId() :pro.getUserId();
+        Long sceneUserId = null;
+        if(StringUtils.isNotBlank(param.getNum())){
+            ScenePlus plus = scenePlusService.getByNum(param.getNum());
+            if(plus == null){
+                throw new BusinessException(ResultCode.SCENE_NOT_EXIST);
+            }
+            caseService.checkNumInCase(param.getNum());
+            sceneUserId = plus.getUserId();
+        }
+        if(param.getCaseId() != null){
+            Case caseEntity = caseService.getById(param.getCaseId());
+            if(caseEntity == null){
+                throw new BusinessException(ResultCode.CASE_NOT_EXIST);
+            }
+            JyUser jyUser2 = jyUserService.getBySysId(caseEntity.getSysUserId());
+            if(jyUser2 == null){
+                throw new BusinessException(ResultCode.USER_NOT_EXIST);
+            }
+            sceneUserId = jyUser2.getUserId();
+        }
+
         CheckOtherVo vo = new CheckOtherVo();
         SysUser byId = sysUserService.getById(Long.valueOf(StpUtil.getLoginId().toString()));
         JyUser jyUser = jyUserService.getBySysId(byId.getId());
@@ -425,7 +443,13 @@ public class JySceneUserAuthServiceImpl extends ServiceImpl<IJySceneUserAuthMapp
             vo.setEditAuth(1);
             vo.setLookAuth(1);
         }else {
-            JySceneUserAuth auth = jySceneUserAuthService.getByNumAndJyUserId(jyUser.getId(), param.getNum(),param.getAuthType());
+            JySceneUserAuth auth = null;
+            if(StringUtils.isNotBlank(param.getNum())){
+                auth = jySceneUserAuthService.getByNumAndJyUserId(jyUser.getId(), param.getNum(),param.getAuthType());
+            }
+            if(param.getCaseId() != null){
+                auth = jySceneUserAuthService.getByCaseIdAndJyUserId(jyUser.getId(), param.getCaseId(),param.getAuthType());
+            }
             if(auth !=null){
                 if(auth.getCanAuthLook() == 1 ){
                     vo.setLookAuth(auth.getLookAuth());

+ 1 - 1
src/main/java/com/fdkankan/manage/service/impl/UserServiceImpl.java

@@ -175,7 +175,7 @@ public class UserServiceImpl extends ServiceImpl<IUserMapper, User> implements I
     @Override
     @Transactional(rollbackFor = Exception.class)
     public synchronized void addUcenterUser(UserParam param) {
-        if( StringUtils.isBlank(param.getNickName()) || StringUtils.isBlank(param.getPassword())
+        if(  StringUtils.isBlank(param.getPassword())
             || StringUtils.isBlank(param.getRyId()) || StringUtils.isBlank(param.getRyNo())){
             throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
         }

+ 6 - 4
src/main/java/com/fdkankan/manage/vo/request/CaseParam.java

@@ -12,12 +12,10 @@ public class CaseParam extends RequestBase{
      {
      "caseTitle": "测试1",
      "sceneNumParam": [
-     {"type":0,"numList":["SS-jm-jFr8nolaJtb","SG-jm-hktbn3JPEl6"]},
-     {"type":1,"numList":["SS-jm-jFr8nolaJtb","SG-jm-hktbn3JPEl6"]}
+         {"type":0,"numList":["SS-jm-jFr8nolaJtb","SG-jm-hktbn3JPEl6"]},
+         {"type":1,"numList":["SS-jm-jFr8nolaJtb","SG-jm-hktbn3JPEl6"]}
      ]
      }
-
-
      */
 
     private Integer caseId;
@@ -25,4 +23,8 @@ public class CaseParam extends RequestBase{
 
     private List<CaseNumType> sceneNumParam = new ArrayList<>();
 
+    private Integer isShare =0;
+
+    private List<Integer> caseIds;
+
 }

+ 2 - 0
src/main/java/com/fdkankan/manage/vo/request/DictFileParam.java

@@ -11,4 +11,6 @@ public class DictFileParam extends RequestBase{
     private String typeKey;
     private Integer fileType;
     private List<String> fileFormats;
+    private List<Integer> dictIds;
+    private Long sysUserId;
 }

+ 1 - 1
src/main/java/com/fdkankan/manage/vo/request/SceneParam.java

@@ -12,7 +12,7 @@ public class SceneParam extends RequestBase {
     private String sceneName;   //场景标题
     private String snCode;      //sn码
     private String userName;    //绑定账号
-    private Integer type = 0;   //0 看看,1看见,2深时
+    private Integer type;   //0 看看,1看见,2深时
     private Integer companyId;
     private Long userId;
     private Integer isObj;

+ 2 - 1
src/main/java/com/fdkankan/manage/vo/response/DictFileVo.java

@@ -18,7 +18,8 @@ public class DictFileVo extends DictFile {
 
     private String newFileName;
 
-    private String fileType;
+    private Integer fileType;
+    private String fileTypeStr;
 
     private String fileFormat;
 

+ 15 - 1
src/main/resources/mapper/manage/DictFileMapper.xml

@@ -13,8 +13,11 @@
                           LEFT JOIN t_dict d on df.dict_id = d.id
                           LEFT JOIN t_common_upload cu on df.upload_id = cu.id
         where df.rec_status = 'A'
+        <if test="param.sysUserId != null">
+            and df.sys_user_id = #{param.sysUserId}
+        </if>
         <if test="param.name != null and param.name !=''">
-            and df.name = #{param.name}
+            and df.name like concat('%',#{param.name}, '%')
         </if>
         <if test="param.typeKey != null and param.typeKey !=''">
             and df.type_key = #{param.typeKey}
@@ -22,12 +25,23 @@
         <if test="param.fileType != null">
             and cu.file_type = #{param.fileType}
         </if>
+        <if test="param.dictId != null">
+            and df.dict_id = #{param.dictId}
+        </if>
         <if test="param.fileFormats != null and param.fileFormats.size>0">
             and cu.file_format in
             <foreach collection="param.fileFormats" item="fileFormat" open="(" separator="," close=")">
                 #{fileFormat}
             </foreach>
         </if>
+        <if test="param.dictIds != null and param.dictIds.size>0">
+            and df.dict_id in
+            <foreach collection="param.dictIds" item="dict" open="(" separator="," close=")">
+                #{dict}
+            </foreach>
+        </if>
+
+        order by df.id desc
 
         </select>
 </mapper>

+ 4 - 0
src/main/resources/mapper/manage/SceneProMapper.xml

@@ -84,6 +84,10 @@
             and e.is_obj = 1
         </if>
 
+        <if test="param.isObj != null and param.isObj == 1">
+            and e.is_obj = 1
+        </if>
+
         <if test="param.snCode != null and param.snCode !='' ">
             and c.sn_code like concat ('%',#{param.snCode},'%')
         </if>