Jelajahi Sumber

修改错误提示

tianboguang 2 tahun lalu
induk
melakukan
0e29fcb10f

+ 4 - 7
src/main/java/com/fdkankan/contro/controller/SceneFileController.java

@@ -70,11 +70,8 @@ public class SceneFileController{
         log.info("sendCallAlgorithm 参数为:{}",JSONObject.toJSONString(params));
         String filePath = params.get("filePath");
         String userName = params.get("userName");
-        if(ObjectUtils.isEmpty(filePath)){
-            throw new BusinessException(ErrorCode.PARAM_ERROR,"filePath为空。");
-        }
-        if(ObjectUtils.isEmpty(userName)){
-            throw new BusinessException(ErrorCode.PARAM_ERROR,"userName为空。");
+        if(ObjectUtils.isEmpty(filePath) || ObjectUtils.isEmpty(userName)){
+            throw new BusinessException(ErrorCode.FAILURE_CODE_3001);
         }
         if(!filePath.endsWith(File.separator)){
             filePath = filePath.concat(File.separator);
@@ -85,13 +82,13 @@ public class SceneFileController{
         // 读取本地文件并校验文件
         // 读取config.json
         if(!new File(filePath+"config.json").exists()){
-            throw new BusinessException(ErrorCode.PARAM_ERROR,"缺少 config.json 文件");
+            throw new BusinessException(ErrorCode.FAILURE_CODE_4001,filePath+"config.json");
         }
 
         // 手机号校验
         User user = userService.getUserByUserName(userName);
         if (ObjectUtils.isEmpty(user)) {
-            throw new BusinessException(ErrorCode.PARAM_ERROR, "userName 未注册!");
+            throw new BusinessException(ErrorCode.USER_NOT_EXIST);
         }
 
         JSONObject configJson = JSONObject.parseObject(FileUtils.readFile(filePath + "config.json"));