Explorar o código

更新错误码
删除无用代码

wuweihao %!s(int64=3) %!d(string=hai) anos
pai
achega
d63032a488

+ 85 - 0
720yun_fd_manage/gis_common/src/main/java/com/gis/common/constant/ErrorEnum.java

@@ -0,0 +1,85 @@
+package com.gis.common.constant;
+
+/**
+ * Created by owen on 2022/3/10 0010 14:47
+ *
+ *
+ * #1000~1999 区间表示参数错误
+ * #2000~2999 区间表示用户错误
+ * #3000~3999 区间表示接口异常
+ */
+public enum ErrorEnum {
+
+    // 200X -> 系统类
+//    FAILURE_SYS_2001(2001, "对象不存在"),
+
+    // 201X -> 权限问题类
+//    FAILURE_SYS_2011(2011, "没有操作权限"),
+
+    // 300X -> 系统类
+    FAILURE_SYS_3001(3001, "对象不存在"),
+
+    // 301X -> 权限问题类
+    FAILURE_SYS_3010(3010, "Token为空"),
+    FAILURE_SYS_3011(3011, "没有操作权限"),
+//    FAILURE_CODE_3001(3001, "缺少必要参数"),
+//    FAILURE_CODE_3002(3002, "访问异常!"),
+//    FAILURE_CODE_3003(3003, "非法访问!"),
+//    FAILURE_CODE_3004(3004, "用户未登录"),
+//    FAILURE_CODE_3005(3005, "验证码已过期"),
+//    FAILURE_CODE_3006(3006, "验证码错误"),
+//    FAILURE_CODE_3007(3007, "昵称已存在"),
+//    FAILURE_CODE_3008(3008, "该手机已被注册"),
+//    FAILURE_CODE_3009(3009, "两次输入的密码不一致"),
+//    FAILURE_CODE_3010(3010, "昵称长度错误"),
+//    FAILURE_CODE_3011(3011, "密码需要包含英文大小写、数字,长度8-16字符"),
+//    FAILURE_CODE_3012(3012, "昵称包含敏感词"),
+//    FAILURE_CODE_3013(3013, "手机号码格式错误"),
+//    FAILURE_CODE_3014(3014, "账号或密码不正确"),
+//    FAILURE_CODE_3015(3015, "用户不存在"),
+//    FAILURE_CODE_3016(3016, "登录失败,账号无权访问"),
+//    FAILURE_CODE_3017(3017, "空文件"),
+//    FAILURE_CODE_3018(3018, "需要上传或使用的文件不存在"),
+
+    // 302X -> 文件类
+    FAILURE_CODE_3020(3020, "空文件"),
+    FAILURE_CODE_3021(3021, "非法文件"),
+    FAILURE_CODE_3022(3022, "上传文件超过最大值"),
+    FAILURE_CODE_3023(3023, "非法格式"),
+    FAILURE_CODE_3024(3024, "存储空间已满"),
+    FAILURE_CODE_3025(3025, "上传失败"),
+
+
+    // 31XX -> 自定义异常
+    FAILURE_CODE_3101(3101, "素材已经被引用, 不能删除"),
+    FAILURE_CODE_3102(3102, "计算中的场景不能删除"),
+    FAILURE_CODE_3103(3103, "服务器someData.json文件不存在"),
+
+    // 32XX -> 请求第三方API错误
+    FAILURE_API_3200(3200, "请求第三方API失败"),
+    FAILURE_API_3201(3201, "请求第三方API返回失败"),
+
+
+
+    ;
+
+    private Integer code;
+    private String message;
+
+    private ErrorEnum(Integer code, String message) {
+        this.code = code;
+        this.message = message;
+    }
+
+    public Integer code() {
+        return code;
+    }
+
+    public String message() {
+        return message;
+    }
+
+    public String formatMessage(Object... args){
+        return String.format(message, args);
+    }
+}

+ 0 - 18
720yun_fd_manage/gis_service/src/main/java/com/gis/service/IconService.java

@@ -1,18 +0,0 @@
-package com.gis.service;
-
-
-import com.gis.common.util.Result;
-import com.gis.domain.dto.FodderPageDto;
-import com.gis.domain.dto.PageDto;
-import com.gis.domain.entity.FodderEntity;
-import com.gis.domain.entity.IconEntity;
-import org.springframework.web.multipart.MultipartFile;
-
-
-/**
- * Created by owen on 2020/3/11 0011 16:14
- */
-public interface IconService extends IBaseService<IconEntity, Long> {
-    Result upload(MultipartFile file);
-
-}

+ 15 - 9
720yun_fd_manage/gis_service/src/main/java/com/gis/service/impl/FodderServiceImpl.java

@@ -4,9 +4,11 @@ import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.img.ImgUtil;
 import cn.hutool.core.io.FileTypeUtil;
 import cn.hutool.core.io.FileUtil;
+import cn.hutool.core.util.StrUtil;
 import com.gis.common.config.RabbitConfig;
 import com.gis.common.constant.CmdConstant;
 import com.gis.common.constant.ConfigConstant;
+import com.gis.common.constant.ErrorEnum;
 import com.gis.common.constant.MsgCode;
 import com.gis.common.exception.BaseRuntimeException;
 import com.gis.common.util.*;
@@ -90,7 +92,7 @@ public class FodderServiceImpl extends IBaseServiceImpl<FodderEntity, Long> impl
         // 检查非法文件上传
         boolean checkFile = FileUtils.checkFile(file);
         if (!checkFile) {
-            return Result.failure("上传文件格式有误, 请重新上传");
+            return Result.failure(ErrorEnum.FAILURE_CODE_3021.code(),"上传文件格式有误, 请重新上传");
         }
 
         String time = DateUtil.format(new Date(), "yyyyMMdd_HHmmssSSS");
@@ -98,7 +100,10 @@ public class FodderServiceImpl extends IBaseServiceImpl<FodderEntity, Long> impl
         // 文件名校验长度
         String prefix = StringUtils.substringBeforeLast(fileName, ".");
         if (prefix.length() > 50) {
-            return Result.failure(3003, "文件名称不允许超过50个字节");
+
+            // return Result.failure(3003, "文件名称不允许超过50个字节");
+            prefix = StrUtil.sub(prefix, 0, 50);
+
         }
         String suffix = StringUtils.substringAfterLast(fileName, ".");
         String newName = time + "." + suffix;
@@ -119,7 +124,8 @@ public class FodderServiceImpl extends IBaseServiceImpl<FodderEntity, Long> impl
             if (type.equals("pano")) {
 
                 if ((size / 1024) >= 120) {
-                    return Result.failure(MsgCode.e3004, "全景图文件不能超过120MB");
+//                    return Result.failure(MsgCode.e3004, "全景图文件不能超过120MB");
+                    return Result.failure(ErrorEnum.FAILURE_CODE_3022.code(),"全景图文件不能超过120MB");
                 }
 
                 // 此方法可以读取到图片内部结构, 可以检验非全景图
@@ -127,7 +133,7 @@ public class FodderServiceImpl extends IBaseServiceImpl<FodderEntity, Long> impl
                 // 全景图只支持jpg图片格式
                 if (!imgType.equalsIgnoreCase("jpg")) {
                     log.error("图片格式错误,只支持jpg图片类型, type: " + imgType);
-                    return Result.failure(MsgCode.e5003, "只支持jpg图片类型, 真实格式是:" + imgType);
+                    return Result.failure(ErrorEnum.FAILURE_CODE_3023.code(), "只支持jpg图片类型, 真实格式是:" + imgType);
                 }
 
                 String sceneCode = RandomUtils.getSceneCode("fd720_");
@@ -200,7 +206,7 @@ public class FodderServiceImpl extends IBaseServiceImpl<FodderEntity, Long> impl
         } catch (Exception e) {
             e.printStackTrace();
             log.error(e.getMessage());
-            throw new BaseRuntimeException(MsgCode.e5003, e.getMessage());
+            throw new BaseRuntimeException(ErrorEnum.FAILURE_CODE_3025.code(), e.getMessage());
         }
 
 
@@ -297,19 +303,19 @@ public class FodderServiceImpl extends IBaseServiceImpl<FodderEntity, Long> impl
     public Result remove(Long id) {
         FodderEntity entity = this.findById(id);
         if (entity == null) {
-            return Result.failure("对象不存在, id: " + id);
+            return Result.failure(ErrorEnum.FAILURE_SYS_3001.code(), "对象不存在, id: " + id);
         }
 
         // 检查全景图是否被引用
         if ("pano".equals(entity.getType())) {
 
             if (entity.getStatus() == 1) {
-                return Result.failure("计算中的场景不能删除");
+                return Result.failure(ErrorEnum.FAILURE_CODE_3102.code(),"计算中的场景不能删除");
             }
 
             List<WorkEntity> list = workService.likeSceneCode(entity.getSceneCode());
             if (list.size() > 0) {
-                return Result.failure(MsgCode.e3007, "素材已经被引用, 不能删除");
+                return Result.failure(ErrorEnum.FAILURE_CODE_3101.code(), "素材已经被引用, 不能删除");
             }
         }
 
@@ -331,7 +337,7 @@ public class FodderServiceImpl extends IBaseServiceImpl<FodderEntity, Long> impl
     private void checkUserSize(String phone) {
         Integer size = entityMapper.countSize(phone);
         log.info("当前用户空间: {} M", (size / 1024));
-        BaseRuntimeException.isTrue(size >= MAX_SIZE, null, "该用户空间已满");
+        BaseRuntimeException.isTrue(size >= MAX_SIZE, ErrorEnum.FAILURE_CODE_3024.code(), "该用户空间已满");
     }
 
 

+ 0 - 57
720yun_fd_manage/gis_service/src/main/java/com/gis/service/impl/IconServiceImpl.java

@@ -1,57 +0,0 @@
-package com.gis.service.impl;
-
-import com.gis.common.constant.ConfigConstant;
-import com.gis.common.util.*;
-import com.gis.domain.entity.IconEntity;
-import com.gis.mapper.IBaseMapper;
-import com.gis.mapper.IconMapper;
-import com.gis.service.IconService;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.web.multipart.MultipartFile;
-
-import java.util.Map;
-
-
-/**
- * Created by owen on 2021/11/08 0011 16:16
- */
-@Slf4j
-@Service
-public class IconServiceImpl extends IBaseServiceImpl<IconEntity, Long> implements IconService {
-
-    @Autowired
-    private IconMapper entityMapper;
-
-
-
-    @Autowired
-    ConfigConstant configConstant;
-
-    @Autowired
-    FileUtils fileUtils;
-
-    @Autowired
-    AliyunOssUtil aliyunOssUtil;
-
-
-    @Override
-    public IBaseMapper<IconEntity, Long> getBaseMapper() {
-        return this.entityMapper;
-    }
-
-
-    @Override
-    public Result upload(MultipartFile file) {
-        Map<String, Object>  map = fileUtils.renameUploadOssBye(file, configConstant.ossBasePath, configConstant.ossDomain, "icon/");
-        IconEntity entity = new IconEntity();
-        entity.setFileName((String) map.get("fileName"));
-        Object ossUrl = map.get("ossUrl");
-        entity.setOssPath(ossUrl.toString());
-
-        this.save(entity);
-
-        return Result.success(ossUrl);
-    }
-}

+ 6 - 86
720yun_fd_manage/gis_service/src/main/java/com/gis/service/impl/SceneServiceImpl.java

@@ -3,18 +3,15 @@ package com.gis.service.impl;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.gis.common.constant.ConfigConstant;
+import com.gis.common.constant.ErrorEnum;
 import com.gis.common.util.*;
 import com.gis.domain.dto.*;
-import com.gis.domain.entity.CatalogEntity;
 import com.gis.domain.entity.SceneEntity;
-import com.gis.domain.tree.CatalogTree;
 import com.gis.domain.vo.ProSceneVo;
 import com.gis.mapper.IBaseMapper;
 import com.gis.mapper.SceneMapper;
-//import com.gis.service.CatalogService;
 import com.gis.service.SceneService;
 import com.gis.service.WorkService;
-import com.gis.tree.CatalogTreeUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.http.HttpResponse;
@@ -33,7 +30,6 @@ import java.util.*;
  */
 @Slf4j
 @Service
-//@Transactional
 public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, Long> implements SceneService {
 
     @Autowired
@@ -42,8 +38,7 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, Long> implem
     @Autowired
     WorkService workService;
 
-//    @Autowired
-//    CatalogService catalogService;
+
 
     @Autowired
     ConfigConstant configConstant;
@@ -65,7 +60,7 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, Long> implem
     public Result select4dkk(PageDto param, String workId) {
         startPage(param);
 
-//        String url = "https://test.4dkankan.com/api/user/scene/list";
+        // String url = "https://test.4dkankan.com/api/user/scene/list";
         String url = configConstant.domain4dKK + "/api/user/scene/list";
         JSONObject reqParam = new JSONObject();
         reqParam.put("pageNum", param.getPageNum().toString());
@@ -95,13 +90,14 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, Long> implem
             if (code == 3004) {
                 String msg = reJson.getString("msg");
                 log.info("获取四维看看列表失败,{}", msg);
-                return Result.failure(5001, msg);
+//                return Result.failure(5001, msg);
+                return Result.failure(ErrorEnum.FAILURE_API_3201.code(), msg);
             }
 
             if (code != 0) {
                 String msg = reJson.getString("msg");
                 log.info("获取四维看看列表失败,{}", msg);
-                return Result.failure(msg);
+                return Result.failure(ErrorEnum.FAILURE_API_3201.code(),msg);
             }
 
             JSONObject dataJson = reJson.getJSONObject("data");
@@ -142,72 +138,6 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, Long> implem
 
 
 
-    /***
-     * 根据父节点查询子节点
-     */
-//    private List<CatalogTree> getTreeByParentId(CatalogEntity catalogEntity){
-//        Long parentId = catalogEntity.getParentId();
-//
-//        List<CatalogTree> resultTree = new ArrayList<>();
-//        // 根据父节点查询子节点
-//        if (parentId != null) {
-//            // 查找子节点
-//            List<CatalogEntity> parents = catalogService.findByParentId(parentId);
-//            // 查找父节点
-//            CatalogEntity parentCatalog = catalogService.findById(parentId);
-//
-//            parents.add(parentCatalog);
-//            CatalogTreeUtil tree = new CatalogTreeUtil(parents);
-//            resultTree = tree.buildTree();
-//        } else {
-//            // 只有父节点
-//            CatalogTree catalogTree = new CatalogTree();
-//            catalogTree.setId(catalogEntity.getId());
-//            catalogTree.setName(catalogEntity.getName());
-//            resultTree.add(catalogTree);
-//        }
-//        return resultTree;
-//    }
-
-
-
-
-    /**
-     * 创建分组
-     *
-     * @return
-     */
-
-//    private CatalogEntity createCatalog(CatalogSceneDto params) {
-//        Long parentId = params.getParentId();
-//        String parentName = params.getParentName();
-//        Long workId = params.getWorkId();
-//
-//        CatalogEntity entity = new CatalogEntity();
-//        entity.setName(params.getCatalogName());
-//        entity.setWorkId(workId);
-//        // 当父id不为空时
-//        if (parentId != null) {
-//            entity.setParentId(parentId);
-//        }
-//
-//        // 创建父目录
-//        if (parentId == null && parentName != null) {
-//            CatalogEntity parentEntity = new CatalogEntity();
-//            parentEntity.setWorkId(workId);
-//            parentEntity.setName(parentName);
-//            catalogService.save(parentEntity);
-//            entity.setParentId(parentEntity.getId());
-//
-//        }
-//        // 创建目录
-//        catalogService.save(entity);
-//        return entity;
-//    }
-
-
-
-
     @Override
     public List<String> strFindByWorkId(String workId, String type) {
         return entityMapper.strFindByWorkId(workId, type);
@@ -244,16 +174,6 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, Long> implem
     }
 
 
-    public Result checkToken() {
-        String userNameForToken = getUserNameForToken();
-        if (StringUtils.isNotBlank(userNameForToken)) {
-            log.warn("token: " + userNameForToken);
-        } else {
-            log.warn("token 为空");
-        }
-        return Result.success();
-    }
-
 
     @Override
     public Result upload(MultipartFile file) {

+ 0 - 10
720yun_fd_manage/gis_service/src/main/java/com/gis/service/impl/SysUserServiceImpl.java

@@ -24,11 +24,6 @@ public class SysUserServiceImpl extends IBaseServiceImpl<SysUserEntity, Long> im
         return this.entityMapper;
     }
 
-//    @Override
-//    public List<UserResponse> findAllBySearchKey(PageDto param) {
-//        PageHelper.startPage(param.getPageNum(), param.getPageSize());
-//        return entityMapper.findAllBySearchKey(param.getSearchKey());
-//    }
 
     @Override
     public SysUserEntity findByUserName(String userName) {
@@ -39,11 +34,6 @@ public class SysUserServiceImpl extends IBaseServiceImpl<SysUserEntity, Long> im
     public SysUserEntity findByPhone(String phone) {
         return entityMapper.findByPhone(phone);
     }
-//
-//    @Override
-//    public List<UserEntity> findBySearchKey(PageRequest param) {
-//        return entityMapper.findBySearchKey(param.getSearchKey());
-//    }
 
 
 }

+ 0 - 3
720yun_fd_manage/gis_service/src/main/java/com/gis/service/impl/TestServiceImpl.java

@@ -11,9 +11,6 @@ import com.gis.common.util.FileUtils;
 import com.gis.common.util.Result;
 import com.gis.domain.entity.IconEntity;
 import com.gis.domain.entity.WorkEntity;
-import com.gis.mapper.IBaseMapper;
-import com.gis.mapper.IconMapper;
-import com.gis.service.IconService;
 import com.gis.service.TestService;
 import com.gis.service.WorkService;
 import com.gis.util.ReplaceVo;

+ 13 - 9
720yun_fd_manage/gis_service/src/main/java/com/gis/service/impl/WorkServiceImpl.java

@@ -4,7 +4,7 @@ import cn.hutool.core.io.FileUtil;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.gis.common.constant.ConfigConstant;
-import com.gis.common.constant.MsgCode;
+import com.gis.common.constant.ErrorEnum;
 import com.gis.common.constant.RedisConstant;
 import com.gis.common.exception.BaseRuntimeException;
 import com.gis.common.util.*;
@@ -98,7 +98,7 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
         WorkEntity entity = entityMapper.selectByPrimaryKey(id);
 
         if (entity == null) {
-            return Result.failure("对象不存在");
+            return Result.failure(ErrorEnum.FAILURE_SYS_3001.code(),"对象不存在");
         }
         BeanUtils.copyProperties(param, entity);
 
@@ -252,7 +252,8 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
         WorkEntity entity = findByIdForUpdate(id);
         if (entity == null) {
             log.error("作品已被删除,无法编辑, id: " + id);
-            throw new BaseRuntimeException(MsgCode.e3006, "作品已被删除,无法编辑, id: " + id);
+//            throw new BaseRuntimeException(MsgCode.e3006, "作品已被删除,无法编辑, id: " + id);
+            throw new BaseRuntimeException(ErrorEnum.FAILURE_SYS_3001.code(), "作品已被删除,无法编辑, id: " + id);
         }
         try {
             // 休眠0.5秒
@@ -262,13 +263,14 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
         }
         String userNameForToken = getUserNameForToken();
         if (!userNameForToken.equals(entity.getUserId())) {
-            return Result.failure(MsgCode.e3005, "当前无操作权限");
+//            return Result.failure(MsgCode.e3005, "当前无操作权限");
+            return Result.failure(ErrorEnum.FAILURE_SYS_3011.code(), "当前无操作权限");
         }
 
         // 更新作品信息
         boolean isEdit = editEntity(param, entity);
         if (!isEdit) {
-            return Result.failure("对象不存在");
+            return Result.failure(ErrorEnum.FAILURE_SYS_3001.code(), "对象不存在");
         }
 
         log.info("更新作品完成");
@@ -368,7 +370,8 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
 
         // 保存oss
         if (!FileUtil.isFile(saveSomeDataPath)) {
-            Result.failure("服务器someData.json文件不存在");
+//            Result.failure("服务器someData.json文件不存在");
+            Result.failure(ErrorEnum.FAILURE_CODE_3103.code(), "服务器someData.json文件不存在");
         }
 
         String ossKeyPath = configConstant.ossBasePath + baseSomeDathPath;
@@ -396,7 +399,7 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
         HashMap<String, String> headers = new HashMap<>();
         String token = getToken();
         if (StringUtils.isBlank(token)) {
-            return Result.failure("token无空");
+            return Result.failure(ErrorEnum.FAILURE_SYS_3010.code(), "token无空");
         }
         headers.put("token", token);
         String restResult = null;
@@ -415,13 +418,14 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
             if (code == 3004) {
                 String msg = reJson.getString("msg");
                 log.info("获取四维看看列表失败,{}", msg);
-                return Result.failure(5001, msg);
+//                return Result.failure(5001, msg);
+                return Result.failure(ErrorEnum.FAILURE_API_3201.code(), msg);
             }
 
             if (code != 0) {
                 String msg = reJson.getString("msg");
                 log.info("获取四维看看列表失败,{}", msg);
-                return Result.failure(msg);
+                return Result.failure(ErrorEnum.FAILURE_API_3201.code(), msg);
             }
 
         } catch (Exception e) {

+ 8 - 7
720yun_fd_manage/gis_web/src/main/java/com/gis/web/controller/FodderController.java

@@ -1,6 +1,7 @@
 package com.gis.web.controller;
 
 
+import com.gis.common.constant.ErrorEnum;
 import com.gis.common.constant.MsgCode;
 import com.gis.common.util.Result;
 import com.gis.domain.dto.*;
@@ -51,7 +52,7 @@ public class FodderController extends BaseController {
 
         if (file == null) {
             log.error("文件不能为空");
-            return Result.failure("文件不能为空");
+            return Result.failure(ErrorEnum.FAILURE_CODE_3020.code(),"文件不能为空");
         }
         return fodderService.upload(file, type, tempId);
     }
@@ -91,7 +92,7 @@ public class FodderController extends BaseController {
     public Result<FodderEntity> detail(@PathVariable Long id) {
         FodderEntity entity = fodderService.findById(id);
         if (entity == null) {
-            return Result.failure("对象不存在");
+            return Result.failure(ErrorEnum.FAILURE_SYS_3001.code(), "对象不存在");
         }
         return Result.success(entity);
     }
@@ -100,11 +101,11 @@ public class FodderController extends BaseController {
     /**
      * 2021-04-13 可能不使用
      * */
-    @ApiOperation(value = "选择全景图", position = 1)
-    @PostMapping("select/pano/{workId}")
-    public Result selectFodderPano(@RequestBody PageDto param, @PathVariable String workId) {
-        return fodderService.selectFodderPano(param, workId);
-    }
+//    @ApiOperation(value = "选择全景图", position = 1)
+//    @PostMapping("select/pano/{workId}")
+//    public Result selectFodderPano(@RequestBody PageDto param, @PathVariable String workId) {
+//        return fodderService.selectFodderPano(param, workId);
+//    }
 
     @ApiOperation(value = "检查状态", notes = "ids , 多个id用',' 隔开")
     @GetMapping("checkStatus/{ids}")

+ 0 - 69
720yun_fd_manage/gis_web/src/main/java/com/gis/web/controller/IconController.java

@@ -1,69 +0,0 @@
-package com.gis.web.controller;
-
-
-import com.gis.common.constant.MsgCode;
-import com.gis.common.util.Result;
-import com.gis.domain.dto.FodderDto;
-import com.gis.domain.dto.FodderPageDto;
-import com.gis.domain.dto.PageDto;
-import com.gis.domain.entity.FodderEntity;
-import com.gis.domain.entity.IconEntity;
-import com.gis.domain.entity.WorkEntity;
-import com.gis.service.FodderService;
-import com.gis.service.IconService;
-import com.gis.service.WorkService;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import lombok.extern.log4j.Log4j2;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.BeanUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-import springfox.documentation.annotations.ApiIgnore;
-
-import java.util.Date;
-import java.util.List;
-
-
-/**
- * Created by owen on 2021/11/08 0018 12:17
- */
-@ApiIgnore
-@Slf4j
-@Api(tags = "图标管理")
-@RestController
-@RequestMapping("/manage/icon")
-public class IconController extends BaseController {
-
-    @Autowired
-    private IconService entityService;
-
-
-    @ApiOperation(value = "上传图标")
-    @PostMapping("upload")
-    public Result upload(MultipartFile file) {
-        return entityService.upload(file);
-    }
-
-
-    @ApiOperation(value = "列表")
-    @GetMapping("list")
-    public Result<IconEntity> list() {
-        return Result.success(entityService.findAll());
-    }
-
-
-        @ApiOperation(value = "详情")
-    @GetMapping("detail/{id}")
-    public Result<IconEntity> detail(@PathVariable Long id) {
-            IconEntity entity = entityService.findById(id);
-        if (entity == null) {
-            return Result.failure("对象不存在");
-        }
-        return Result.success(entity);
-    }
-
-
-
-}

+ 4 - 3
720yun_fd_manage/gis_web/src/main/java/com/gis/web/controller/WebController.java

@@ -2,6 +2,7 @@ package com.gis.web.controller;
 
 
 import com.gis.common.constant.ConfigConstant;
+import com.gis.common.constant.ErrorEnum;
 import com.gis.common.constant.MsgCode;
 import com.gis.common.constant.RedisConstant;
 import com.gis.common.util.RedisUtil;
@@ -41,8 +42,8 @@ public class WebController extends BaseController {
     @Autowired
     WorkService workService;
 
-    @Autowired
-    SceneService sceneService;
+//    @Autowired
+//    SceneService sceneService;
 
     @Autowired
     FodderService fodderService;
@@ -96,7 +97,7 @@ public class WebController extends BaseController {
         WorkEntity entity = workService.findById(workId);
         if (entity == null) {
             log.error("对象不存在, 场景码:{}", workId);
-            return Result.failure("对象不存在");
+            return Result.failure(ErrorEnum.FAILURE_SYS_3001.code(), "对象不存在");
         }
 
         String dbPassword = entity.getPassword();

+ 2 - 1
720yun_fd_manage/gis_web/src/main/java/com/gis/web/controller/WorkController.java

@@ -1,6 +1,7 @@
 package com.gis.web.controller;
 
 
+import com.gis.common.constant.ErrorEnum;
 import com.gis.common.constant.MsgCode;
 import com.gis.common.constant.RedisConstant;
 import com.gis.common.util.RedisUtil;
@@ -123,7 +124,7 @@ public class WorkController extends BaseController {
         PageHelper.clearPage();
         WorkEntity entity = workService.findById(workId);
         if (entity == null) {
-            return Result.failure("对象不存在: " + workId);
+            return Result.failure(ErrorEnum.FAILURE_SYS_3001.code(), "对象不存在: " + workId);
         }
 
         String userId = getUserNameForToken();

+ 14 - 0
720yun_fd_manage/remark-m.md

@@ -86,4 +86,18 @@
     
 # deploy 注意
  2022-3-22  修改workId 使用雪花id, 需要更新数据库字段, sit已更新
+ 
+ 
+ # 错误码汇总:
+ 0: 请求成功
+ -1: 请求失败
+ 500: 服务器异常
+ 2001: 对象不存在
+ 3005: 当前无操作权限
+ 3020: 文件不能为空
+ 3021: 非常文件
+ 3022:上传文件超过最大值
+ 5001: token为空
+ 5004: 密码有误
+