+ * 将multipartFile文件流存储到服务器本地 + * + * @param multipartFile 文件实体 + * @param pathName 文件存储路径 + * + * @return + */ + public static void fileUpload(MultipartFile multipartFile, String pathName) throws BusinessException { + FileOutputStream fileOutputStream = null; + try { + File file = new File(pathName); + fileOutputStream = new FileOutputStream(file); + IOUtils.copy(multipartFile.getInputStream(), fileOutputStream); + } catch (Exception e) { + e.printStackTrace(); + BusinessExceptionUtil.createBusinessException(e.getMessage()); + } finally { + try { + //关闭 + fileOutputStream.close(); + } catch (IOException e) { + e.printStackTrace(); + LOGGER.error("文件关闭错误", e); + } + } + } + +} \ No newline at end of file diff --git a/src/main/java/com/myjdbc/web/core/util/ResultUtil.java b/src/main/java/com/myjdbc/web/core/util/ResultUtil.java index 82abd86fad09303cf75e73a757da58d813e54b88..77edb7f44106fab2d10d004914ce3078ec6e0a67 100644 --- a/src/main/java/com/myjdbc/web/core/util/ResultUtil.java +++ b/src/main/java/com/myjdbc/web/core/util/ResultUtil.java @@ -1,7 +1,7 @@ package com.myjdbc.web.core.util; -import com.myjdbc.web.core.model.ResultBody; import com.myjdbc.web.core.constants.BaseServiceType; +import com.myjdbc.web.core.model.ResultBody; /** * 所有返回结果的基类 @@ -16,6 +16,7 @@ public class ResultUtil implements BaseServiceType { * 传入BaseServiceType的对应值 * * @param flag true成功,false失败 + * * @author 陈文 * @date 2020/8/16 2:10 */ @@ -32,7 +33,9 @@ public class ResultUtil implements BaseServiceType { * @param code 状态 * @param msg 信息 * @param detail 详情 + * * @return + * * @author Chen Wen * @date 0:31 2022/3/12 */ @@ -57,6 +60,7 @@ public class ResultUtil implements BaseServiceType { * 调用接口成功返回 * * @param code 操作代码 + * * @author 陈文 * @date 2020/8/16 2:10 */ @@ -78,6 +82,7 @@ public class ResultUtil implements BaseServiceType { * 调用接口成功返回 * * @param msg 提示给用户的信息 + * * @author 陈文 * @date 2020/8/16 2:10 */ @@ -89,6 +94,7 @@ public class ResultUtil implements BaseServiceType { * 调用接口成功返回 * * @param data 需要传输到客户端(浏览器)的数据 + * * @author 陈文 * @date 2020/8/16 2:10 */ @@ -101,6 +107,7 @@ public class ResultUtil implements BaseServiceType { * * @param code 操作代码 * @param msg 提示给用户的信息 + * * @author 陈文 * @date 2020/8/16 2:10 */ @@ -114,6 +121,7 @@ public class ResultUtil implements BaseServiceType { * @param code 操作代码 * @param msg 提示给用户的信息 * @param detail 提示给用户的详情 + * * @author 陈文 * @date 2020/8/16 2:10 */ @@ -126,6 +134,7 @@ public class ResultUtil implements BaseServiceType { * * @param msg 提示给用户的信息 * @param detail 提示给用户的详情 + * * @author 陈文 * @date 2020/8/16 2:10 */ @@ -139,6 +148,7 @@ public class ResultUtil implements BaseServiceType { * @param msg 提示给用户的信息 * @param data 需要传输到客户端(浏览器)的数据 * @param detail 提示给用户的详情 + * * @author 陈文 * @date 2020/8/16 2:10 */ @@ -160,6 +170,7 @@ public class ResultUtil implements BaseServiceType { * 调用接口失败返回 * * @param code 操作代码 + * * @author 陈文 * @date 2020/8/16 2:10 */ @@ -167,6 +178,18 @@ public class ResultUtil implements BaseServiceType { return createError(code, null); } + /** + * 调用接口失败返回 + * + * @param data 需要传输到客户端(浏览器)的数据 + * + * @author Chen Wen + * @date 17:05 2022/6/28 + */ + public static ResultBody createError(Object data) { + return createSuccess(ERROR, null, null, data); + } + /** * 调用接口失败返回 * @@ -181,6 +204,7 @@ public class ResultUtil implements BaseServiceType { * 调用接口失败返回 * * @param msg 提示给用户的信息 + * * @author 陈文 * @date 2020/8/16 2:10 */ @@ -193,6 +217,7 @@ public class ResultUtil implements BaseServiceType { * * @param code 操作代码 * @param msg 提示给用户的信息 + * * @author 陈文 * @date 2020/8/16 2:10 */ @@ -205,6 +230,7 @@ public class ResultUtil implements BaseServiceType { * * @param msg 提示给用户的信息 * @param detail 提示给用户的详情 + * * @author 陈文 * @date 2020/8/16 2:10 */ @@ -218,6 +244,7 @@ public class ResultUtil implements BaseServiceType { * @param code 操作代码 * @param msg 提示给用户的信息 * @param detail 提示给用户的详情 + * * @author 陈文 * @date 2020/8/16 2:10 */ @@ -231,6 +258,7 @@ public class ResultUtil implements BaseServiceType { * @param msg 提示给用户的信息 * @param data 需要传输到客户端(浏览器)的数据 * @param detail 提示给用户的详情 + * * @author 陈文 * @date 2020/8/16 2:10 */ @@ -245,6 +273,7 @@ public class ResultUtil implements BaseServiceType { * @param msg 提示给用户的信息 * @param detail 提示给用户的详情 * @param data 需要传输到客户端(浏览器)的数据 + * * @author 陈文 * @date 2020/8/16 2:10 */ @@ -260,6 +289,7 @@ public class ResultUtil implements BaseServiceType { * @param detail 提示给用户的详情 * @param data 需要传输到客户端(浏览器)的数据 * @param lang 国际化语言代码 + * * @author Chen Wen * @date 1:06 2022/1/5 */ @@ -281,6 +311,7 @@ public class ResultUtil implements BaseServiceType { * @param msg 提示给用户的信息 * @param detail 提示给用户的详情 * @param data 需要传输到客户端(浏览器)的数据 + * * @author 陈文 * @date 2020/8/16 2:10 */ diff --git a/src/main/resources/i18n/baseServiceType.properties b/src/main/resources/i18n/baseServiceType.properties new file mode 100644 index 0000000000000000000000000000000000000000..7c25861588c255341428e8c22475d2a11eca766b --- /dev/null +++ b/src/main/resources/i18n/baseServiceType.properties @@ -0,0 +1,21 @@ +#\u901A\u7528 +code_0=\u64CD\u4F5C\u5931\u8D25 +code_1=\u64CD\u4F5C\u6210\u529F +code_2=\u64CD\u4F5C\u6210\u529F(\u5E26\u6709\u4FE1\u606F) +code_3=\u64CD\u4F5C\u6210\u529F(\u5E26\u6709\u8B66\u544A) +code_100=\u975E\u6CD5\u64CD\u4F5C +#\u5B89\u5168\u6846\u67B6 +code_1001=\u672A\u53D6\u5F97\u6388\u6743 +code_1002=\u672A\u767B\u5F55\u7528\u6237 +code_1003=\u7528\u6237\u4E0D\u5B58\u5728\u6216\u8005\u5BC6\u7801\u9519\u8BEF +code_1004=\u7528\u6237\u8D26\u6237\u88AB\u9501\u5B9A +code_1005=\u7528\u6237\u8D26\u6237\u7981\u7528 +code_1006=\u7528\u6237\u8D26\u6237\u5DF2\u8FC7\u671F +code_1007=\u7528\u6237\u5BC6\u7801\u5DF2\u8FC7\u671F +code_1008=\u7528\u6237\u4E0D\u5B58\u5728\u6216\u8005\u5BC6\u7801\u9519\u8BEF +code_1099=\u5B89\u5168\u8BA4\u8BC1\u5931\u8D25 +code_1101=\u539F\u5BC6\u7801\u9519\u8BEF +code_1102=\u65B0\u5BC6\u7801\u4E0D\u80FD\u548C\u65E7\u5BC6\u7801\u76F8\u540C +code_1103=\u5BC6\u7801\u8FC7\u77ED\uFF0C\u81F3\u5C11\u9700\u8981{}\u4F4D +code_1104=\u5BC6\u7801\u8FC7\u957F\uFF0C\u6700\u591A\u53EA\u80FD{}\u4F4D +code_1105=\u5BC6\u7801\u590D\u6742\u5EA6\u8FC7\u4F4E \ No newline at end of file diff --git a/src/main/resources/i18n/baseServiceType_en_US.properties b/src/main/resources/i18n/baseServiceType_en_US.properties new file mode 100644 index 0000000000000000000000000000000000000000..a0e8c378cee61a19bbc89d7985b77e5a7b6fcc1a --- /dev/null +++ b/src/main/resources/i18n/baseServiceType_en_US.properties @@ -0,0 +1,21 @@ +#\u901A\u7528 +code_0=Failed operation +code_1=Successful operation +code_2=Operation is successful (with information) +code_3=Operation is successful (with warning) +code_100=Illegal operation +#\u5B89\u5168\u6846\u67B6 +code_1001=Not authorized +code_1002=Not logged in user +code_1003=The user does not exist or the password is wrong +code_1004=User account is locked +code_1005=User account disabled +code_1006=User account has expired +code_1007=User password has expired +code_1008=The user does not exist or the password is wrong +code_1099=Security authentication failed +code_1101=The original password is wrong +code_1102=The new password cannot be the same as the old password +code_1103=Password is too short\uFF0CAt least {} bits required +code_1104=Password is too long\uFF0CNo more than {} digits +code_1105=Password complexity is too low \ No newline at end of file diff --git a/src/main/resources/i18n/baseServiceType_ja_JP.properties b/src/main/resources/i18n/baseServiceType_ja_JP.properties new file mode 100644 index 0000000000000000000000000000000000000000..5a9482c3085551118837684925c4f3af173005c4 --- /dev/null +++ b/src/main/resources/i18n/baseServiceType_ja_JP.properties @@ -0,0 +1,21 @@ +#\u901A\u7528 +code_0=\u64CD\u4F5C\u306B\u5931\u6557\u3057\u307E\u3057\u305F +code_1=\u64CD\u4F5C\u304C\u6210\u529F\u3057\u307E\u3057\u305F +code_2=\u64CD\u4F5C\u6210\u529F\uFF08\u60C5\u5831\u4ED8\u304D\uFF09 +code_3=\u64CD\u4F5C\u304C\u6210\u529F\u3057\u307E\u3057\u305F\uFF08\u8B66\u544A\u4ED8\u304D\uFF09 +code_100=\u4E0D\u6B63\u306A\u64CD\u4F5C +#\u5B89\u5168\u6846\u67B6 +code_1001=\u6A29\u9650\u3092\u53D6\u5F97\u3057\u3066\u3044\u307E\u305B\u3093 +code_1002=\u30E6\u30FC\u30B6\u30FC\u304C\u30ED\u30B0\u30A4\u30F3\u3057\u3066\u3044\u307E\u305B\u3093 +code_1003=\u30E6\u30FC\u30B6\u30FC\u304C\u5B58\u5728\u3057\u306A\u3044\u304B\u30D1\u30B9\u30EF\u30FC\u30C9\u30A8\u30E9\u30FC +code_1004=\u30E6\u30FC\u30B6\u30FC\u30A2\u30AB\u30A6\u30F3\u30C8\u304C\u30ED\u30C3\u30AF\u3055\u308C\u307E\u3057\u305F +code_1005=\u30E6\u30FC\u30B6\u30FC\u30A2\u30AB\u30A6\u30F3\u30C8\u306E\u7121\u52B9\u5316 +code_1006=\u30E6\u30FC\u30B6\u30FC\u30A2\u30AB\u30A6\u30F3\u30C8\u304C\u671F\u9650\u5207\u308C\u306B\u306A\u308A\u307E\u3057\u305F +code_1007=\u30E6\u30FC\u30B6\u30FC\u30D1\u30B9\u30EF\u30FC\u30C9\u304C\u671F\u9650\u5207\u308C\u3067\u3059 +code_1008=\u30E6\u30FC\u30B6\u30FC\u304C\u5B58\u5728\u3057\u306A\u3044\u304B\u30D1\u30B9\u30EF\u30FC\u30C9\u30A8\u30E9\u30FC +code_1099=\u30BB\u30AD\u30E5\u30EA\u30C6\u30A3\u8A8D\u8A3C\u306B\u5931\u6557\u3057\u307E\u3057\u305F +code_1101=\u5143\u306E\u30D1\u30B9\u30EF\u30FC\u30C9\u304C\u9593\u9055\u3063\u3066\u3044\u307E\u3059 +code_1102=\u65B0\u3057\u3044\u30D1\u30B9\u30EF\u30FC\u30C9\u306F\u53E4\u3044\u30D1\u30B9\u30EF\u30FC\u30C9\u3068\u540C\u3058\u306B\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093 +code_1103=\u30D1\u30B9\u30EF\u30FC\u30C9\u304C\u77ED\u3059\u304E\u3066\u3001\u5C11\u306A\u304F\u3068\u3082{}\u30D3\u30C3\u30C8\u304C\u5FC5\u8981\u3067\u3059 +code_1104=\u30D1\u30B9\u30EF\u30FC\u30C9\u304C\u9577\u3059\u304E\u3066\u3001\u6700\u5927{}\u30D3\u30C3\u30C8\u3057\u304B\u3042\u308A\u307E\u305B\u3093 +code_1105=\u30D1\u30B9\u30EF\u30FC\u30C9\u306E\u8907\u96D1\u3055\u304C\u4F4E\u3059\u304E\u308B \ No newline at end of file diff --git a/src/main/resources/i18n/baseServiceType_zh_CN.properties b/src/main/resources/i18n/baseServiceType_zh_CN.properties new file mode 100644 index 0000000000000000000000000000000000000000..7c25861588c255341428e8c22475d2a11eca766b --- /dev/null +++ b/src/main/resources/i18n/baseServiceType_zh_CN.properties @@ -0,0 +1,21 @@ +#\u901A\u7528 +code_0=\u64CD\u4F5C\u5931\u8D25 +code_1=\u64CD\u4F5C\u6210\u529F +code_2=\u64CD\u4F5C\u6210\u529F(\u5E26\u6709\u4FE1\u606F) +code_3=\u64CD\u4F5C\u6210\u529F(\u5E26\u6709\u8B66\u544A) +code_100=\u975E\u6CD5\u64CD\u4F5C +#\u5B89\u5168\u6846\u67B6 +code_1001=\u672A\u53D6\u5F97\u6388\u6743 +code_1002=\u672A\u767B\u5F55\u7528\u6237 +code_1003=\u7528\u6237\u4E0D\u5B58\u5728\u6216\u8005\u5BC6\u7801\u9519\u8BEF +code_1004=\u7528\u6237\u8D26\u6237\u88AB\u9501\u5B9A +code_1005=\u7528\u6237\u8D26\u6237\u7981\u7528 +code_1006=\u7528\u6237\u8D26\u6237\u5DF2\u8FC7\u671F +code_1007=\u7528\u6237\u5BC6\u7801\u5DF2\u8FC7\u671F +code_1008=\u7528\u6237\u4E0D\u5B58\u5728\u6216\u8005\u5BC6\u7801\u9519\u8BEF +code_1099=\u5B89\u5168\u8BA4\u8BC1\u5931\u8D25 +code_1101=\u539F\u5BC6\u7801\u9519\u8BEF +code_1102=\u65B0\u5BC6\u7801\u4E0D\u80FD\u548C\u65E7\u5BC6\u7801\u76F8\u540C +code_1103=\u5BC6\u7801\u8FC7\u77ED\uFF0C\u81F3\u5C11\u9700\u8981{}\u4F4D +code_1104=\u5BC6\u7801\u8FC7\u957F\uFF0C\u6700\u591A\u53EA\u80FD{}\u4F4D +code_1105=\u5BC6\u7801\u590D\u6742\u5EA6\u8FC7\u4F4E \ No newline at end of file