lyhzzz 8 月之前
父节点
当前提交
fd696616c5
共有 31 个文件被更改,包括 1301 次插入73 次删除
  1. 5 0
      src/main/java/com/fdkankan/manage/common/OssPath.java
  2. 6 0
      src/main/java/com/fdkankan/manage/common/ResultCode.java
  3. 49 0
      src/main/java/com/fdkankan/manage/constant/FileTypeEnum.java
  4. 0 56
      src/main/java/com/fdkankan/manage/constant/SceneButtonEnum.java
  5. 10 2
      src/main/java/com/fdkankan/manage/controller/CommonController.java
  6. 44 0
      src/main/java/com/fdkankan/manage/controller/DictController.java
  7. 48 0
      src/main/java/com/fdkankan/manage/controller/DictFileController.java
  8. 63 0
      src/main/java/com/fdkankan/manage/entity/CommonUpload.java
  9. 52 0
      src/main/java/com/fdkankan/manage/entity/Dict.java
  10. 57 0
      src/main/java/com/fdkankan/manage/entity/DictFile.java
  11. 1 1
      src/main/java/com/fdkankan/manage/generate/AutoGenerate.java
  12. 18 0
      src/main/java/com/fdkankan/manage/mapper/ICommonUploadMapper.java
  13. 18 0
      src/main/java/com/fdkankan/manage/mapper/IDictFileMapper.java
  14. 18 0
      src/main/java/com/fdkankan/manage/mapper/IDictMapper.java
  15. 1 0
      src/main/java/com/fdkankan/manage/service/ICommonService.java
  16. 17 0
      src/main/java/com/fdkankan/manage/service/ICommonUploadService.java
  17. 23 0
      src/main/java/com/fdkankan/manage/service/IDictFileService.java
  18. 23 0
      src/main/java/com/fdkankan/manage/service/IDictService.java
  19. 139 14
      src/main/java/com/fdkankan/manage/service/impl/CommonServiceImpl.java
  20. 34 0
      src/main/java/com/fdkankan/manage/service/impl/CommonUploadServiceImpl.java
  21. 97 0
      src/main/java/com/fdkankan/manage/service/impl/DictFileServiceImpl.java
  22. 55 0
      src/main/java/com/fdkankan/manage/service/impl/DictServiceImpl.java
  23. 110 0
      src/main/java/com/fdkankan/manage/util/FileWriterUtil.java
  24. 210 0
      src/main/java/com/fdkankan/manage/util/OBJToGLBUtil.java
  25. 15 0
      src/main/java/com/fdkankan/manage/util/ShellCmd.java
  26. 134 0
      src/main/java/com/fdkankan/manage/util/ShellUtil.java
  27. 11 0
      src/main/java/com/fdkankan/manage/vo/request/DictFileParam.java
  28. 28 0
      src/main/java/com/fdkankan/manage/vo/response/DictFileVo.java
  29. 5 0
      src/main/resources/mapper/manage/CommonUploadMapper.xml
  30. 5 0
      src/main/resources/mapper/manage/DictFileMapper.xml
  31. 5 0
      src/main/resources/mapper/manage/DictMapper.xml

+ 5 - 0
src/main/java/com/fdkankan/manage/common/OssPath.java

@@ -1,6 +1,8 @@
 package com.fdkankan.manage.common;
 
 public class OssPath {
+
+    public final static String localPath = "/mnt/";
     public final static String MANAGE_FILE_PATH = "manage/file/%s/%s";
     public final static String invoiceOssDir = "manage/invoice/";
     public final static String v3_statusPath = "data/data%s/status.json";
@@ -9,5 +11,8 @@ public class OssPath {
 
     public final static String default_head ="manage/user/newHead.png";
 
+    public final static String MANAGE_MODEL_FILE_PATH = "manage/model/%s/%s";
+
+
 
 }

+ 6 - 0
src/main/java/com/fdkankan/manage/common/ResultCode.java

@@ -94,6 +94,12 @@ public enum ResultCode  {
     ID_CARD_EXIT2(60022, "该用户已属其他平台,请更换用户后再试"),
     USER_BAN(60023, "该用户已被禁用,无法添加。"),
     LASER_VIEW_ERROR(60024, "激光系统访问失败"),
+
+    FILE_TYPE_ERROR2(60025, "文件类型不符合规则"),
+    UNZIP_ERROR(60026, "解压失败"),
+
+    UPLOAD_FILE_OBJ_ERROR(60027,"文件内容错误,缺少obj,或者mtl文件"),
+    UPLOAD_FILE_MSG_ERROR(60028,"文件内容错误"),
     ;
 
     private Integer code;

+ 49 - 0
src/main/java/com/fdkankan/manage/constant/FileTypeEnum.java

@@ -0,0 +1,49 @@
+package com.fdkankan.manage.constant;
+
+import lombok.Data;
+import org.apache.commons.lang3.StringUtils;
+
+import java.util.Arrays;
+import java.util.List;
+
+public enum FileTypeEnum {
+    IMAGE(0,"图片", Arrays.asList("jpg","png","jpeg")),
+    VIDEO(1,"视频",Arrays.asList("mp4")),
+    MUSIC(2,"音频",Arrays.asList("wav","mp3")),
+    MODEL(3,"模型",Arrays.asList("obj","osgb","b3dm","ply","las","laz","shp")),
+
+    ;
+    int code;
+    String msg;
+    List<String> typeList;
+
+    FileTypeEnum(int code, String msg, List<String> typeList) {
+        this.code = code;
+        this.msg = msg;
+        this.typeList = typeList;
+    }
+
+    public int getCode() {
+        return code;
+    }
+
+    public String getMsg() {
+        return msg;
+    }
+
+    public List<String> getTypeList() {
+        return typeList;
+    }
+
+    public static FileTypeEnum getByType(String fileType){
+        if(StringUtils.isNotBlank(fileType)){
+            FileTypeEnum[] values = FileTypeEnum.values();
+            for (FileTypeEnum value : values) {
+                if(value.typeList.contains(fileType)){
+                    return value;
+                }
+            }
+        }
+        return null;
+    }
+}

+ 0 - 56
src/main/java/com/fdkankan/manage/constant/SceneButtonEnum.java

@@ -1,56 +0,0 @@
-package com.fdkankan.manage.constant;
-
-import org.apache.commons.lang3.StringUtils;
-
-public enum SceneButtonEnum {
-    del(0,"正常销售"),
-    STAFF_USE(1,"员工自用"),
-    GIFT_GIVING(2,"礼品赠送"),
-    OTHER(3,"其他"),
-    AGENT(4,"经销商");
-
-
-    int code;
-    String msg;
-
-    SceneButtonEnum(int code, String msg) {
-        this.code = code;
-        this.msg = msg;
-    }
-
-    public int getCode() {
-        return code;
-    }
-
-    public void setCode(int code) {
-        this.code = code;
-    }
-
-    public String getMsg() {
-        return msg;
-    }
-
-    public void setMsg(String msg) {
-        this.msg = msg;
-    }
-    public static SceneButtonEnum getByCode(int code){
-        SceneButtonEnum[] values = SceneButtonEnum.values();
-        for (SceneButtonEnum value : values) {
-            if(value.code == code){
-                return value;
-            }
-        }
-        return null;
-    }
-    public static SceneButtonEnum getByMsg(String msg){
-        if(StringUtils.isNotBlank(msg)){
-            SceneButtonEnum[] values = SceneButtonEnum.values();
-            for (SceneButtonEnum value : values) {
-                if(value.msg.equalsIgnoreCase(msg)){
-                    return value;
-                }
-            }
-        }
-        return null;
-    }
-}

+ 10 - 2
src/main/java/com/fdkankan/manage/controller/CommonController.java

@@ -27,8 +27,6 @@ public class CommonController {
     /**
      * 文件上传
      * @param file 文件
-     * @return
-     * @throws Exception
      */
     @RequestMapping(value = "/upload/files", method = RequestMethod.POST)
     public ResultData uploads(
@@ -36,4 +34,14 @@ public class CommonController {
         return commonService.uploadFile(file);
     }
 
+
+    /**
+     * 文件上传
+     * @param file 文件
+     */
+    @RequestMapping(value = "/upload/fileNew", method = RequestMethod.POST)
+    public ResultData uploadNew(
+            @RequestParam(value = "file") MultipartFile file) throws Exception {
+        return commonService.uploadFileNew(file);
+    }
 }

+ 44 - 0
src/main/java/com/fdkankan/manage/controller/DictController.java

@@ -0,0 +1,44 @@
+package com.fdkankan.manage.controller;
+
+
+import com.fdkankan.manage.common.ResultData;
+import com.fdkankan.manage.entity.Dict;
+import com.fdkankan.manage.service.IDictService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author 
+ * @since 2024-12-02
+ */
+@RestController
+@RequestMapping("/service/manage/dict")
+public class DictController extends BaseController{
+
+    @Autowired
+    IDictService dictService;
+
+    @GetMapping("/getByKey/{dictKey}")
+    public ResultData getByKey(@PathVariable String dictKey){
+        return ResultData.ok(dictService.getByKey(dictKey));
+    }
+
+    @PostMapping("/addOrUpdate/{dictKey}")
+    public ResultData addOrUpdate(@RequestBody Dict dict,@PathVariable String dictKey){
+        dict.setSysUserId(getUserId());
+        dict.setDictKey(dictKey);
+        dictService.addOrUpdate(dict);
+        return ResultData.ok();
+    }
+
+    @PostMapping("/del/{dictKey}")
+    public ResultData del(@RequestBody Dict dict,@PathVariable String dictKey){
+        dictService.del(dict);
+        return ResultData.ok();
+    }
+}
+

+ 48 - 0
src/main/java/com/fdkankan/manage/controller/DictFileController.java

@@ -0,0 +1,48 @@
+package com.fdkankan.manage.controller;
+
+
+import com.fdkankan.manage.common.ResultData;
+import com.fdkankan.manage.entity.Dict;
+import com.fdkankan.manage.entity.DictFile;
+import com.fdkankan.manage.service.IDictFileService;
+import com.fdkankan.manage.service.IDictService;
+import com.fdkankan.manage.vo.request.DictFileParam;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author 
+ * @since 2024-12-02
+ */
+@RestController
+@RequestMapping("/service/manage/dictFile")
+public class DictFileController extends BaseController{
+
+    @Autowired
+    IDictFileService dictFileService;
+
+    @PostMapping("/pageList/{typeKey}")
+    public ResultData pageList(@RequestBody DictFileParam param,@PathVariable String typeKey){
+        param.setTypeKey(typeKey);
+        return ResultData.ok(dictFileService.pageList(param));
+    }
+
+    @PostMapping("/addOrUpdate/{typeKey}")
+    public ResultData addOrUpdate(@RequestBody DictFile dictFile,@PathVariable String typeKey){
+        dictFile.setTypeKey(typeKey);
+        dictFile.setSysUserId(getUserId());
+        dictFileService.addOrUpdate(dictFile);
+        return ResultData.ok();
+    }
+
+    @PostMapping("/del/{typeKey}")
+    public ResultData del(@RequestBody DictFile dictFile,@PathVariable String typeKey){
+        dictFileService.del(dictFile);
+        return ResultData.ok();
+    }
+}
+

+ 63 - 0
src/main/java/com/fdkankan/manage/entity/CommonUpload.java

@@ -0,0 +1,63 @@
+package com.fdkankan.manage.entity;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.io.Serializable;
+import java.util.Date;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author 
+ * @since 2024-12-02
+ */
+@Getter
+@Setter
+@TableName("t_common_upload")
+public class CommonUpload implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId("id")
+    private Integer id;
+
+    @TableField("file_name")
+    private String fileName;
+
+    @TableField("file_url")
+    private String fileUrl;
+
+    @TableField("file_size")
+    private String fileSize;
+
+    @TableField("new_file_name")
+    private String newFileName;
+
+    @TableField("file_type")
+    private String fileType;
+
+    @TableField("file_format")
+    private String fileFormat;
+
+    @TableField("rec_status")
+    @TableLogic(value = "A",delval = "I")
+    private String recStatus;
+
+    @TableField("create_time")
+    private Date createTime;
+
+    @TableField("update_time")
+    private Date updateTime;
+
+    @TableField("status")
+    private Integer status;
+    @TableField("unzip_path")
+    private String unzipPath;
+
+}

+ 52 - 0
src/main/java/com/fdkankan/manage/entity/Dict.java

@@ -0,0 +1,52 @@
+package com.fdkankan.manage.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.io.Serializable;
+import java.util.Date;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author 
+ * @since 2024-12-02
+ */
+@Getter
+@Setter
+@TableName("t_dict")
+public class Dict implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    @TableField("dict_name")
+    private String dictName;
+
+    @TableField("dict_key")
+    private String dictKey;
+
+    @TableField("sort")
+    private Integer sort;
+
+    @TableField("rec_status")
+    @TableLogic(value = "A",delval = "I")
+    private String recStatus;
+
+    @TableField("create_time")
+    private Date createTime;
+
+    @TableField("update_time")
+    private Date updateTime;
+
+    @TableField("sys_user_id")
+    private Long sysUserId;
+}

+ 57 - 0
src/main/java/com/fdkankan/manage/entity/DictFile.java

@@ -0,0 +1,57 @@
+package com.fdkankan.manage.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.io.Serializable;
+import java.util.Date;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author 
+ * @since 2024-12-02
+ */
+@Getter
+@Setter
+@TableName("t_dict_file")
+public class DictFile implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    @TableField("name")
+    private String name;
+
+    @TableField("type_key")
+    private String typeKey;
+
+    @TableField("upload_id")
+    private Integer uploadId;
+
+    @TableField("dict_id")
+    private Integer dictId;
+
+    @TableField("rec_status")
+    @TableLogic(value = "A",delval = "I")
+    private String recStatus;
+
+    @TableField("create_time")
+    private Date createTime;
+
+    @TableField("update_time")
+    private Date updateTime;
+
+    @TableField("sys_user_id")
+    private Long sysUserId;
+
+
+}

+ 1 - 1
src/main/java/com/fdkankan/manage/generate/AutoGenerate.java

@@ -18,7 +18,7 @@ public class AutoGenerate {
         String path =System.getProperty("user.dir");
 
         generate(path,"manage", getTables(new String[]{
-                "jy_platform_user_wait"
+                "t_common_upload"
         }));
 
 //        generate(path,"goods", getTables(new String[]{

+ 18 - 0
src/main/java/com/fdkankan/manage/mapper/ICommonUploadMapper.java

@@ -0,0 +1,18 @@
+package com.fdkankan.manage.mapper;
+
+import com.fdkankan.manage.entity.CommonUpload;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author 
+ * @since 2024-12-02
+ */
+@Mapper
+public interface ICommonUploadMapper extends BaseMapper<CommonUpload> {
+
+}

+ 18 - 0
src/main/java/com/fdkankan/manage/mapper/IDictFileMapper.java

@@ -0,0 +1,18 @@
+package com.fdkankan.manage.mapper;
+
+import com.fdkankan.manage.entity.DictFile;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author 
+ * @since 2024-12-02
+ */
+@Mapper
+public interface IDictFileMapper extends BaseMapper<DictFile> {
+
+}

+ 18 - 0
src/main/java/com/fdkankan/manage/mapper/IDictMapper.java

@@ -0,0 +1,18 @@
+package com.fdkankan.manage.mapper;
+
+import com.fdkankan.manage.entity.Dict;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author 
+ * @since 2024-12-02
+ */
+@Mapper
+public interface IDictMapper extends BaseMapper<Dict> {
+
+}

+ 1 - 0
src/main/java/com/fdkankan/manage/service/ICommonService.java

@@ -17,4 +17,5 @@ public interface ICommonService {
     ResultData uploadFile(MultipartFile file) throws IOException;
 
 
+    ResultData uploadFileNew(MultipartFile file);
 }

+ 17 - 0
src/main/java/com/fdkankan/manage/service/ICommonUploadService.java

@@ -0,0 +1,17 @@
+package com.fdkankan.manage.service;
+
+import com.fdkankan.manage.entity.CommonUpload;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author 
+ * @since 2024-12-02
+ */
+public interface ICommonUploadService extends IService<CommonUpload> {
+
+    CommonUpload add(String replace, String url, String s, String uuid, String msg, String replace1,Integer status,String unzipPath);
+}

+ 23 - 0
src/main/java/com/fdkankan/manage/service/IDictFileService.java

@@ -0,0 +1,23 @@
+package com.fdkankan.manage.service;
+
+import com.fdkankan.manage.entity.DictFile;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.fdkankan.manage.vo.request.DictFileParam;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author 
+ * @since 2024-12-02
+ */
+public interface IDictFileService extends IService<DictFile> {
+
+
+    Object pageList(DictFileParam param);
+
+    void addOrUpdate(DictFile dictFile);
+
+    void del(DictFile dictFile);
+}

+ 23 - 0
src/main/java/com/fdkankan/manage/service/IDictService.java

@@ -0,0 +1,23 @@
+package com.fdkankan.manage.service;
+
+import com.fdkankan.manage.entity.Dict;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.List;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author 
+ * @since 2024-12-02
+ */
+public interface IDictService extends IService<Dict> {
+
+    List<Dict> getByKey(String dictKey);
+
+    void addOrUpdate(Dict dict);
+
+    void del(Dict dict);
+}

+ 139 - 14
src/main/java/com/fdkankan/manage/service/impl/CommonServiceImpl.java

@@ -1,15 +1,25 @@
 package com.fdkankan.manage.service.impl;
 
 import cn.hutool.core.date.DateUtil;
+import com.alibaba.fastjson.JSONArray;
 import com.fdkankan.manage.common.OssPath;
+import com.fdkankan.manage.common.ResultCode;
 import com.fdkankan.manage.common.ResultData;
 import com.fdkankan.common.util.DateExtUtil;
 import com.fdkankan.fyun.face.FYunFileServiceInterface;
+import com.fdkankan.manage.constant.FileTypeEnum;
+import com.fdkankan.manage.entity.CommonUpload;
+import com.fdkankan.manage.exception.BusinessException;
 import com.fdkankan.manage.service.ICommonService;
 import java.io.File;
 import java.io.IOException;
-import java.util.Calendar;
-import java.util.UUID;
+import java.util.*;
+
+import com.fdkankan.manage.service.ICommonUploadService;
+import com.fdkankan.manage.util.FileWriterUtil;
+import com.fdkankan.manage.util.OBJToGLBUtil;
+import com.fdkankan.manage.util.ShellUtil;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
@@ -26,6 +36,7 @@ import javax.annotation.Resource;
  * @since 2022/6/7
  **/
 @Service
+@Slf4j
 public class CommonServiceImpl implements ICommonService {
 
     @Value("${fyun.host:https://4dkk.4dage.com/}")
@@ -34,18 +45,132 @@ public class CommonServiceImpl implements ICommonService {
     private FYunFileServiceInterface fYunFileServiceInterface;
 
     @Override
-    public ResultData uploadFile(MultipartFile file) throws IOException {
-        String uuid = UUID.randomUUID().toString();
-        String originalFilename = file.getOriginalFilename();
-        String  extName = originalFilename.substring(originalFilename.lastIndexOf("."));
-        String ossPath = String.format(OssPath.MANAGE_FILE_PATH, DateUtil.format(Calendar.getInstance()
-            .getTime(), DateExtUtil.dateStyle6), uuid + extName);
-        File tempFile = File.createTempFile(uuid ,extName);
-        file.transferTo(tempFile);
-        fYunFileServiceInterface.uploadFile(tempFile.getPath(), ossPath);
-        tempFile.deleteOnExit();
-        String url = this.ossUrlPrefix + ossPath;
-        return ResultData.ok(url);
+    public ResultData uploadFile(MultipartFile file) {
+        File  tempFile = null;
+        try {
+            String uuid = UUID.randomUUID().toString();
+            String originalFilename = file.getOriginalFilename();
+            String extName = originalFilename.substring(originalFilename.lastIndexOf("."));
+            String ossPath = String.format(OssPath.MANAGE_FILE_PATH, DateUtil.format(Calendar.getInstance()
+                    .getTime(), DateExtUtil.dateStyle6), uuid + extName);
+
+            tempFile = new File(OssPath.localPath + ossPath);
+            file.transferTo(tempFile);
+            fYunFileServiceInterface.uploadFile(tempFile.getPath(), ossPath);
+            String url = this.ossUrlPrefix + ossPath;
+            return ResultData.ok(url);
+        }catch (Exception e){
+            log.info("upload-file-error:{}",e);
+            throw new BusinessException(ResultCode.UPLOAD_ERROR);
+        }finally {
+            if(tempFile != null){
+                tempFile.delete();
+            }
+        }
+
+    }
+
+    @Autowired
+    ICommonUploadService commonUploadService;
+
+    @Override
+    public ResultData uploadFileNew(MultipartFile file) {
+        if(file.isEmpty() ){
+            throw new BusinessException(ResultCode.UPLOAD_ERROR);
+        }
+        File  tempFile = null;
+        try {
+            String uuid = UUID.randomUUID().toString();
+            String originalFilename = file.getOriginalFilename();
+            String extName = originalFilename.substring(originalFilename.lastIndexOf(".")).toLowerCase();
+            String ossPath = String.format(OssPath.MANAGE_MODEL_FILE_PATH, DateUtil.format(Calendar.getInstance()
+                    .getTime(), DateExtUtil.dateStyle6), uuid + extName);
+
+            tempFile = new File(OssPath.localPath + ossPath);
+            file.transferTo(tempFile);
+            if(extName.equals(".zip")){
+                return uploadModelZip(tempFile);
+            }
+
+            fYunFileServiceInterface.uploadFile(tempFile.getPath(), ossPath);
+            String url = this.ossUrlPrefix + ossPath;
+
+            FileTypeEnum fileTypeEnum = FileTypeEnum.getByType(extName.replace(".", ""));
+            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);
+            return ResultData.ok(commonUpload);
+        }catch (Exception e){
+            log.info("upload-file-error:{}",e);
+            throw new BusinessException(ResultCode.UPLOAD_ERROR);
+        }finally {
+            if(tempFile != null){
+                tempFile.delete();
+            }
+        }
+    }
+
+    private ResultData uploadModelZip(File tempFile) {
+        String unzipPath = tempFile.getParentFile().getPath() +"/result";
+        ShellUtil.unZip(tempFile.getPath(),unzipPath);
+
+        File unZipFile = new File(unzipPath);
+        if(!unZipFile.exists() || !unZipFile.isDirectory()){
+            throw new BusinessException(ResultCode.UNZIP_ERROR);
+        }
+        List<File> fileList = new ArrayList<>();
+        FileWriterUtil.getCanRunList(fileList,unZipFile);
+        if(fileList.size() <=0){
+            throw new BusinessException(ResultCode.UPLOAD_FILE_ERROR);
+        }
+        File modelFile = fileList.get(0);
+
+        if(FileWriterUtil.isChinese(modelFile.getName())){
+            throw new BusinessException(ResultCode.FILE_TYPE_ERROR2);
+        }
+        String modelFileFormat = modelFile.getName().split("\\.")[1].toLowerCase();
+        switch (modelFileFormat){
+            case "obj" :  OBJToGLBUtil.checkObj(modelFile.getPath());
+            case "laz" :
+            case "b3dm" :
+            case "shp" :  uploadOss(unzipPath,modelFile); break;
+            case "las" :
+            case "ply" :  uploadLasOrPly(modelFile);break;
+            case "osgb":  uploadOsgb(unzipPath,modelFile) ;break;
+            default: break;
+        }
+        String url = "";
+        String extName= ".zip";
+        FileTypeEnum fileTypeEnum = FileTypeEnum.getByType(modelFileFormat);
+        if(fileTypeEnum == null){
+            throw new BusinessException(ResultCode.FILE_TYPE_ERROR2);
+        }
+        CommonUpload commonUpload = commonUploadService.add(tempFile.getName().replace(extName, ""),url, String.valueOf(tempFile.getTotalSpace()),
+                null, fileTypeEnum.getMsg(), extName.replace(".", ""),0,unzipPath);
+
+        return ResultData.ok(commonUpload);
+    }
+
+    private void uploadOsgb(String unzipPath, File modelFile) {
+    }
+
+
+    private void uploadOss(String unzipPath,File modelFile) {
+        String ossPath = unzipPath.replace(OssPath.localPath,"");
+        String modelOssPath = modelFile.getPath().replace(OssPath.localPath, "");
+        ShellUtil.yunUpload(unzipPath,ossPath);
+        if(!fYunFileServiceInterface.fileExist(modelOssPath)){
+            throw new BusinessException(ResultCode.UPLOAD_FILE_ERROR);
+        }
+    }
 
+    private void uploadLasOrPly(File modelFile) {
+        File mntFile = OBJToGLBUtil.lasOrPlyToBin(modelFile);
+        String ossPath = mntFile.getPath().replace(OssPath.localPath,"");
+        ShellUtil.yunUpload(mntFile.getPath(),ossPath);
+        if(!fYunFileServiceInterface.fileExist(ossPath+"/webcloud/cloud.js")){
+            throw new BusinessException(-1,"缺少cloud.js文件");
+        }
     }
 }

+ 34 - 0
src/main/java/com/fdkankan/manage/service/impl/CommonUploadServiceImpl.java

@@ -0,0 +1,34 @@
+package com.fdkankan.manage.service.impl;
+
+import com.fdkankan.manage.entity.CommonUpload;
+import com.fdkankan.manage.mapper.ICommonUploadMapper;
+import com.fdkankan.manage.service.ICommonUploadService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author 
+ * @since 2024-12-02
+ */
+@Service
+public class CommonUploadServiceImpl extends ServiceImpl<ICommonUploadMapper, CommonUpload> implements ICommonUploadService {
+
+    @Override
+    public CommonUpload add(String fileName, String url, String fileSize, String uuid, String msg, String replace1,Integer status,String unzipPath) {
+        CommonUpload upload = new CommonUpload();
+        upload.setFileName(fileName);
+        upload.setFileUrl(url);
+        upload.setFileSize(fileSize);
+        upload.setNewFileName(uuid);
+        upload.setFileType(msg);
+        upload.setFileFormat(replace1);
+        upload.setStatus(status);
+        upload.setUnzipPath(unzipPath);
+        this.save(upload);
+        return upload;
+    }
+}

+ 97 - 0
src/main/java/com/fdkankan/manage/service/impl/DictFileServiceImpl.java

@@ -0,0 +1,97 @@
+package com.fdkankan.manage.service.impl;
+
+import cn.dev33.satoken.stp.StpUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fdkankan.manage.common.PageInfo;
+import com.fdkankan.manage.common.ResultCode;
+import com.fdkankan.manage.constant.FileTypeEnum;
+import com.fdkankan.manage.entity.CommonUpload;
+import com.fdkankan.manage.entity.DictFile;
+import com.fdkankan.manage.exception.BusinessException;
+import com.fdkankan.manage.mapper.IDictFileMapper;
+import com.fdkankan.manage.service.ICommonUploadService;
+import com.fdkankan.manage.service.IDictFileService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fdkankan.manage.vo.request.DictFileParam;
+import com.fdkankan.manage.vo.response.DictFileVo;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author 
+ * @since 2024-12-02
+ */
+@Service
+public class DictFileServiceImpl extends ServiceImpl<IDictFileMapper, DictFile> implements IDictFileService {
+
+    @Autowired
+    ICommonUploadService commonUploadService;
+
+
+    @Override
+    public Object pageList(DictFileParam param) {
+        if(StringUtils.isBlank(param.getTypeKey())){
+            throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
+        }
+        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());
+        }
+        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<DictFileVo> voList = new ArrayList<>();
+        for (DictFile record : page.getRecords()) {
+            DictFileVo vo = new DictFileVo();
+            BeanUtils.copyProperties(record,vo);
+            CommonUpload upload = map.get(record.getUploadId());
+            if(upload != null){
+                BeanUtils.copyProperties(upload,vo);
+            }
+            voList.add(vo);
+        }
+        Page<DictFileVo> voPage = new Page<>(param.getPageNum(),param.getPageSize());
+        voPage.setTotal(page.getTotal());
+        voPage.setRecords(voList);
+        return PageInfo.PageInfo(voPage);
+    }
+
+    @Override
+    public void addOrUpdate(DictFile dictFile) {
+        if(StringUtils.isBlank(dictFile.getName()) || StringUtils.isBlank(dictFile.getTypeKey())
+                || dictFile.getDictId() == null || dictFile.getUploadId() == null){
+            throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
+        }
+        this.saveOrUpdate(dictFile);
+    }
+
+    @Override
+    public void del(DictFile dictFile) {
+        if(dictFile.getId() == null){
+            throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
+        }
+        this.removeById(dictFile.getId());
+    }
+}

+ 55 - 0
src/main/java/com/fdkankan/manage/service/impl/DictServiceImpl.java

@@ -0,0 +1,55 @@
+package com.fdkankan.manage.service.impl;
+
+import cn.dev33.satoken.stp.StpUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.fdkankan.manage.common.ResultCode;
+import com.fdkankan.manage.entity.Dict;
+import com.fdkankan.manage.exception.BusinessException;
+import com.fdkankan.manage.mapper.IDictMapper;
+import com.fdkankan.manage.service.IDictService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author 
+ * @since 2024-12-02
+ */
+@Service
+public class DictServiceImpl extends ServiceImpl<IDictMapper, Dict> implements IDictService {
+
+    @Override
+    public List<Dict> getByKey(String dictKey) {
+        if(StringUtils.isBlank(dictKey)){
+            throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
+        }
+        LambdaQueryWrapper<Dict> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(Dict::getDictKey,dictKey);
+        wrapper.eq(Dict::getSysUserId, StpUtil.getLoginId());
+        wrapper.orderByAsc(Dict::getSort);
+        wrapper.orderByDesc(Dict::getId);
+        return list(wrapper);
+    }
+
+    @Override
+    public void addOrUpdate(Dict dict) {
+        if(StringUtils.isBlank(dict.getDictName()) || StringUtils.isBlank(dict.getDictKey())){
+            throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
+        }
+        this.saveOrUpdate(dict);
+    }
+
+    @Override
+    public void del(Dict dict) {
+        if(dict.getId() == null){
+            throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
+        }
+        this.removeById(dict.getId());
+    }
+}

+ 110 - 0
src/main/java/com/fdkankan/manage/util/FileWriterUtil.java

@@ -0,0 +1,110 @@
+package com.fdkankan.manage.util;
+
+import com.fdkankan.manage.constant.FileTypeEnum;
+
+import java.io.*;
+import java.math.BigDecimal;
+import java.nio.file.Paths;
+import java.nio.file.StandardCopyOption;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import static cn.hutool.core.util.ClassUtil.getClassLoader;
+
+public class FileWriterUtil {
+    public static void writerJson(String tagPath,String fileName,String msg){
+        try {
+            File file = new File(tagPath);
+            if(!file.exists()){
+                file.mkdirs();
+            }
+            FileWriter fw = new FileWriter(tagPath +File.separator +fileName);
+            fw.write(msg);
+            fw.flush();
+            fw.close();
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+    }
+
+    public static  String readFile(String file) throws Exception {
+        BufferedReader reader = new BufferedReader(new FileReader(file));
+        String line = null;
+        StringBuilder stringBuilder = new StringBuilder();
+        String ls = System.getProperty("line.separator");
+        try {
+            while((line = reader.readLine()) != null) {
+                stringBuilder.append(line);
+                stringBuilder.append(ls);
+            }
+            return stringBuilder.toString();
+        } finally {
+            reader.close();
+        }
+    }
+
+    public static void streamToFile(String fileName,String newFilePath){
+        InputStream stream = getClassLoader().getResourceAsStream(fileName);
+        try {
+            assert stream != null;
+            java.nio.file.Files.copy(
+                    stream,
+                    Paths.get(newFilePath),
+                    new StandardCopyOption[]{StandardCopyOption.REPLACE_EXISTING});
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+    }
+
+
+    public static String setFileSize(Long length) {
+        BigDecimal decimal = new BigDecimal(length);
+        BigDecimal size = new BigDecimal(1024);
+        if(length >= 1024 * 1024 ){
+            return decimal.divide(size.multiply(size)).setScale(2,BigDecimal.ROUND_HALF_UP).toString() + "MB";
+        }
+
+        return decimal.divide(size).setScale(2,BigDecimal.ROUND_HALF_UP).toString() +"KB";
+    }
+
+    public static void getCanRunList(List<File> fileList, File objPathFile) {
+        File[] files = objPathFile.listFiles();
+        if(files == null){
+            return;
+        }
+        for (File file1 : files) {
+            if(file1.isFile() && file1.getName().contains(".")){
+                String fileName = file1.getName().split("\\.")[1];
+                if(FileTypeEnum.MODEL.getTypeList().contains(fileName)){
+                    fileList.add(file1);
+                }
+            }else {
+                getCanRunList(fileList,file1);
+            }
+        }
+    }
+
+    public static String checkB3dmTileset(File objPathFile) {
+        File[] files = objPathFile.listFiles();
+        if(files == null || files.length<=0){
+            return null;
+        }
+        for (File file : files) {
+            if(file.isFile()){
+                if(file.getName().endsWith(".json")){
+                    return file.getPath();
+                }
+            }
+
+        }
+        return null;
+    }
+
+    public static boolean isChinese(String str) {
+        String regEx = "[\\u4e00-\\u9fa5]+";
+        Pattern p = Pattern.compile(regEx);
+        Matcher m = p.matcher(str);
+        return m.find();
+    }
+}

+ 210 - 0
src/main/java/com/fdkankan/manage/util/OBJToGLBUtil.java

@@ -0,0 +1,210 @@
+package com.fdkankan.manage.util;
+
+import cn.hutool.core.io.FileUtil;
+import cn.hutool.core.io.file.FileReader;
+import com.alibaba.fastjson.JSONObject;
+import com.fdkankan.manage.common.ResultCode;
+import com.fdkankan.manage.exception.BusinessException;
+import lombok.extern.slf4j.Slf4j;
+
+import java.io.*;
+import java.nio.charset.StandardCharsets;
+import java.util.Date;
+import java.util.LinkedHashSet;
+
+@Slf4j
+public class OBJToGLBUtil {
+
+    public static String objToGlb(String objPath, String glbPath)  {
+        log.info("obj转换glb开始,{}",objPath);
+        if(!checkObj(objPath)){
+            throw new BusinessException(-1,"obj文件错误");
+        }
+        log.info("obj转换glb开始");
+        String command = "obj2gltf -i " + objPath + " -o " + glbPath;
+        log.info("执行obj转换glb命令路径-{}", command);
+        ShellUtil.execCmd(command);
+        log.info("obj转换glb完毕:" + command);
+        return glbPath;
+    }
+    public static void objToGlb2(String objPath,String glbPath)  {
+        log.info("obj转换glb开始,{}",objPath);
+        log.info("obj转换glb开始");
+        String command = "obj2gltf -i " + objPath + " -o " + glbPath;
+        log.info("执行obj转换glb命令路径-{}", command);
+        ShellUtil.execCmd(command);
+        log.info("obj转换glb完毕:" + command);
+    }
+
+    public static String objToB3dm(String objPath, String glbPath)  {
+        Integer lodNum = getLodNum(objPath);
+        log.info("obj转换b3dm开始,{}",objPath);
+        log.info("obj转换b3dm开始");
+        //String command = "Obj2Tiles --lods "+lodNum+" --divisions 3 " + objPath + " " + glbPath;
+        String command = "Obj2Tiles " + objPath + " " + glbPath;
+        log.info("执行obj转换glb命令路径-{}", command);
+        ShellUtil.execCmd(command);
+        log.info("obj转换b3dm完毕:" + command);
+        return glbPath;
+    }
+
+    private static Integer getLodNum(String objPath) {
+
+//        long length = new File(objPath).length();
+//        long mb = length / 1024 /1024;
+//        if(mb >100){
+//            return  (mb /10) >10 ?10:Integer.parseInt(String.valueOf(mb /10));
+//        }
+
+        return 3;
+    }
+
+    public static boolean checkObj(String objPath) {
+        File file = new File(objPath);
+        File file1 = file.getParentFile();
+        File[] files = file1.listFiles();
+        if(files == null || files.length <=0){
+            throw new BusinessException(ResultCode.UPLOAD_FILE_ERROR);
+        }
+        File mtlFile = null;
+        File objFile = null;
+        for (File file2 : files) {
+            if(file2.isDirectory()){
+                return checkObj(file2.getPath());
+            }
+            if(file2.getName().contains(".obj") ){
+                objFile = file2;
+            }
+            if(file2.getName().contains(".mtl") ){
+                mtlFile = file2;
+            }
+        }
+        if(mtlFile == null || objFile == null ){
+            throw new BusinessException(ResultCode.UPLOAD_FILE_OBJ_ERROR);
+        }
+        return checkMtl(file1,mtlFile);
+    }
+
+    private static boolean checkMtl(File allFile,File file) {
+        if(!file.getName().contains("mtl")){
+            throw new BusinessException(ResultCode.UPLOAD_FILE_OBJ_ERROR);
+        }
+        LinkedHashSet<String> imgName = new LinkedHashSet<>();
+        if(allFile == null || allFile.length()<=0 ){
+            throw new BusinessException(ResultCode.UPLOAD_FILE_OBJ_ERROR);
+        }
+        File[] files = allFile.listFiles();
+        if(files == null || files.length<=0 ){
+            throw new BusinessException(ResultCode.UPLOAD_FILE_OBJ_ERROR);
+        }
+        for (File listFile : files) {
+            String modelName = listFile.getName();
+            imgName.add(modelName);
+        }
+        LinkedHashSet<String> imgMtl = readMtlFile(file.getPath());
+        for (String mtlName : imgMtl) {
+            if(!imgName.contains(mtlName)){
+                throw new BusinessException(ResultCode.UPLOAD_FILE_MSG_ERROR.code(),mtlName +".jpg 图片缺失!");
+            }
+        }
+        updateMtlFile(file);
+        return true;
+    }
+
+    private static void updateMtlFile(File file) {
+        String mtlStr = FileUtil.readUtf8String(file);
+        String[] split = mtlStr.split("\n");
+        StringBuilder newMtlStr = new StringBuilder();
+        for (String s : split) {
+            if(s.toLowerCase().contains("tr")){
+                String[] split1 = s.split(" ");
+                if(split1.length <=1){
+                    continue;
+                }
+                if(isNumeric2(split1[1])){
+                    String[] split2 = split1[1].split("\\.");
+                    int number = Integer.parseInt(split2[0]);
+                    if(number >=1){
+                        number = 1 - number;
+                    }
+                    String numStr = number + (split2.length <=1 ?"": "."+split2[1]);
+                    s = s.replace(split1[1],numStr);
+                }
+            }
+            newMtlStr.append(s).append("\n");
+        }
+        FileUtil.copyContent(file,new File(file.getPath()+new Date().getTime()+"back"),true);
+        FileUtil.writeString(newMtlStr.toString(),file, StandardCharsets.UTF_8);
+
+    }
+    public static boolean isNumeric2(String str) {
+        return str != null && str.matches("-?\\d+(\\.\\d+)?");
+    }
+
+
+    public static LinkedHashSet<String> readMtlFile(String mtlPath) {
+        LinkedHashSet<String> imgName = new LinkedHashSet<>();
+        FileInputStream fis = null;
+        BufferedReader br = null;
+        try {
+            fis = new FileInputStream(new File(mtlPath));
+            br = new BufferedReader(new InputStreamReader(fis));
+            String line = null;
+            while ((line = br.readLine()) != null) {
+                String[] tempsa = line.split("[ ]+");
+                if (tempsa[0].trim().equals("map_Ka")) {
+                    String mtlName = tempsa[1];
+                    if(mtlName.contains("/")){
+                        String[] split = mtlName.split("/");
+                        mtlName = split[split.length-1];
+                    }
+                    imgName.add(mtlName);
+                }
+                if (tempsa[0].trim().equals("map_Kd")) {
+                    String mtlName = tempsa[1];
+                    if(mtlName.contains("/")){
+                        String[] split = mtlName.split("/");
+                        mtlName = split[split.length-1];
+                    }
+                    imgName.add(mtlName);
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return imgName;
+    }
+
+    public final static String LAS_TO_BIN = "bash  /home/ubuntu/bin/PotreeConverter.sh @inPath @outPath ''";
+
+    public static File lasOrPlyToBin(File srcFile){
+        if(!srcFile.exists()){
+            srcFile.mkdirs();
+        }
+        String cmd = LAS_TO_BIN;
+        cmd =  cmd.replace("@inPath",srcFile.getPath());
+        cmd = cmd.replace("@outPath",srcFile.getParentFile().getPath());
+        ShellUtil.execCmd(cmd);
+        log.info("lasOrPlyToBin---------cmd-over");
+        String cloudJs = srcFile.getParentFile().getPath() +"/webcloud/"+ "cloud.js";
+        JSONObject jsonObject = fixCloud(cloudJs);
+        FileWriterUtil.writerJson(srcFile.getParentFile().getPath() +"/webcloud/","cloud.js",jsonObject.toJSONString());
+        return srcFile.getParentFile();
+    }
+
+    public static JSONObject fixCloud(String path)  {
+        cn.hutool.core.io.file.FileReader fileReader = new FileReader(path);
+        String str = fileReader.readString();
+        JSONObject json = JSONObject.parseObject(str);
+
+        String[] pointAttributes = {
+                "POSITION_CARTESIAN",
+                "COLOR_PACKED",
+                "NORMAL_OCT16"
+        };
+
+        json.put("pointAttributes", pointAttributes);
+        return json;
+    }
+
+}

+ 15 - 0
src/main/java/com/fdkankan/manage/util/ShellCmd.java

@@ -0,0 +1,15 @@
+package com.fdkankan.manage.util;
+
+public class ShellCmd {
+
+	/**
+	 * oss文件上传命令 bash /opt/ossutil/fyun-upload.sh {bucket} {srcPath} {destPath} {fyunType} {opType}
+	 * opType: file or folder
+	 * fyunType : oss ,aws
+	 */
+	public static final String FYUN_UPLOAD = "bash /opt/ossutil/fyun-upload.sh %s %s /%s %s %s";
+	public static final String FYUN_DOWN = "bash /opt/ossutil/fyun-download.sh %s /%s %s %s %s";
+
+	public static final String osgbTob3dmCmd = "sudo docker run --rm -v /mnt/fusion:/mnt/fusion 3dtile:v2 /mnt/fusion/3dtile.sh -f osgb -i " +
+			"@inputFile -o @outputFile";
+}

+ 134 - 0
src/main/java/com/fdkankan/manage/util/ShellUtil.java

@@ -0,0 +1,134 @@
+package com.fdkankan.manage.util;
+
+import com.fdkankan.manage.common.CacheUtil;
+import lombok.extern.slf4j.Slf4j;
+
+import java.io.BufferedReader;
+import java.io.Closeable;
+import java.io.IOException;
+import java.io.InputStreamReader;
+
+@Slf4j
+public class ShellUtil {
+
+
+    /**
+     * 执行系统命令, 返回执行结果
+     * @param cmd 需要执行的命令
+     */
+    public static void execCmd(String cmd) {
+        StringBuilder result = new StringBuilder();
+
+        Process process = null;
+        BufferedReader bufrIn = null;
+        BufferedReader bufrError = null;
+        long startTime = System.currentTimeMillis();
+
+        try {
+            // 执行命令, 返回一个子进程对象(命令在子进程中执行)
+            log.info("执行cmd:{}",cmd);
+            process = Runtime.getRuntime().exec(cmd);
+            // 获取命令执行结果, 有两个结果: 正常的输出 和 错误的输出(PS: 子进程的输出就是主进程的输入)
+            //处理InputStream的线程
+            threadRun(process);
+            // 方法阻塞, 等待命令执行完成(成功会返回0)
+            process.waitFor();
+        }catch (Exception e){
+            log.error("cmd:{},error:{}",cmd,e);
+        }finally {
+            closeStream(bufrIn);
+            closeStream(bufrError);
+            // 销毁子进程
+            if (process != null) {
+                process.destroy();
+            }
+        }
+        // 返回执行结果
+        log.info("执行cmd:{},结果:{},耗时:{}", cmd,result.toString(),System.currentTimeMillis() -startTime);
+    }
+
+    private static void threadRun(Process process) {
+        new Thread() {
+            @Override
+            public void run() {
+                BufferedReader in = new BufferedReader(new InputStreamReader(process.getInputStream()));
+                String line = null;
+                try {
+                    while((line = in.readLine()) != null) {
+                        log.debug("output: " + line);
+                    }
+                }
+                catch (IOException e) {
+                    e.printStackTrace();
+                }
+                finally {
+                    try {
+                        in.close();
+                    }
+                    catch (IOException e) {
+                        e.printStackTrace();
+                    }
+                }
+            }
+        }.start();
+        new Thread() {
+            @Override
+            public void run() {
+                BufferedReader err = new BufferedReader(new InputStreamReader(process.getErrorStream()));
+                String line = null;
+                try {
+                    while((line = err.readLine()) != null) {
+                        log.debug("err: " + line);
+                    }
+                }
+                catch (IOException e) {
+                    e.printStackTrace();
+                }
+                finally {
+                    try {
+                        err.close();
+                    }
+                    catch (IOException e) {
+                        e.printStackTrace();
+                    }
+                }
+            }
+        }.start();
+    }
+
+    private static void closeStream(Closeable stream) {
+        if (stream != null) {
+            try {
+                stream.close();
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+    }
+
+    public static void unZip(String zipPath, String dataPath) {
+        log.info("解压zip开始");
+        String command = "unzip -O GBK/GB18030CP936 " + zipPath + " -d " + dataPath;
+        execCmd(command);
+        log.info("解压zip完毕:" + command);
+    }
+
+    /**
+     * oss文件上传命令 bash /opt/ossutil/fyun-upload.sh {bucket} {srcPath} {destPath} {fyunType} {opType}
+     * opType: file or folder
+     *  //@param bucket     桶名
+     * @param srcPath    源文件路径
+     * @param destPath   目标文件路径
+     *  //@param fyunType   oss or aws
+     */
+    public static void yunUpload(String srcPath,String destPath){
+        String opType = srcPath.contains(".")? "file":"folder" ;
+        String cmd = String.format(ShellCmd.FYUN_UPLOAD, "4dkankan",srcPath,destPath, CacheUtil.uploadType,opType);
+        execCmd(cmd);
+    }
+    public static void yunDownload(String srcPath,String destPath){
+        String opType = srcPath.contains(".")? "file":"folder" ;
+        String cmd = String.format(ShellCmd.FYUN_DOWN,"4dkankan",srcPath,destPath, CacheUtil.uploadType,opType);
+        execCmd(cmd);
+    }
+}

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

@@ -0,0 +1,11 @@
+package com.fdkankan.manage.vo.request;
+
+import lombok.Data;
+
+@Data
+public class DictFileParam extends RequestBase{
+    private String name;
+    private Integer dictId;
+    private String typeKey;
+    private Integer fileType;
+}

+ 28 - 0
src/main/java/com/fdkankan/manage/vo/response/DictFileVo.java

@@ -0,0 +1,28 @@
+package com.fdkankan.manage.vo.response;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.fdkankan.manage.entity.DictFile;
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+public class DictFileVo extends DictFile {
+
+    private String fileName;
+
+    private String fileUrl;
+
+    private String fileSize;
+
+    private String newFileName;
+
+    private String fileType;
+
+    private String fileFormat;
+
+    private Integer status;
+
+    private String unzipPath;
+}

+ 5 - 0
src/main/resources/mapper/manage/CommonUploadMapper.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.fdkankan.manage.mapper.ICommonUploadMapper">
+
+</mapper>

+ 5 - 0
src/main/resources/mapper/manage/DictFileMapper.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.fdkankan.manage.mapper.IDictFileMapper">
+
+</mapper>

+ 5 - 0
src/main/resources/mapper/manage/DictMapper.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.fdkankan.manage.mapper.IDictMapper">
+
+</mapper>