diff --git a/opsli-api/src/main/java/org/opsli/api/ApiFlag.java b/opsli-api/src/main/java/org/opsli/api/ApiFlag.java
new file mode 100644
index 00000000..c025f123
--- /dev/null
+++ b/opsli-api/src/main/java/org/opsli/api/ApiFlag.java
@@ -0,0 +1,10 @@
+package org.opsli.api;
+
+/**
+ * @BelongsProject: opsli-boot
+ * @BelongsPackage: org.opsli.api
+ * @Author: Parker
+ * @CreateTime: 2020-11-21 15:15
+ * @Description: 标示文件 请勿删除
+ */
+public interface ApiFlag { }
diff --git a/opsli-api/src/main/java/org/opsli/api/web/gentest/user/TestUserRestApi.java b/opsli-api/src/main/java/org/opsli/api/web/gentest/user/TestUserRestApi.java
new file mode 100755
index 00000000..95615991
--- /dev/null
+++ b/opsli-api/src/main/java/org/opsli/api/web/gentest/user/TestUserRestApi.java
@@ -0,0 +1,128 @@
+/**
+ * Copyright 2020 OPSLI 快速开发平台 https://www.opsli.com
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.opsli.api.web.gentest.user;
+
+import org.opsli.api.base.result.ResultVo;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.opsli.api.wrapper.gentest.user.TestUserModel;
+
+
+/**
+ * @BelongsProject: opsli-boot
+ * @BelongsPackage: org.opsli.api.web.gentest.user
+ * @Author: 周鹏程
+ * @CreateTime: 2020-11-22 12:12:05
+ * @Description: 某系统用户
+ *
+ * 对外 API 直接 暴露 @GetMapping 或者 @PostMapping
+ * 对内也推荐 单机版 不需要设置 Mapping 但是调用方法得从Controller写起
+ *
+ * 这样写法虽然比较绕,但是当单体项目想要改造微服务架构时 时非常容易的
+ *
+ *
+ */
+public interface TestUserRestApi {
+
+ /** 标题 */
+ String TITLE = "用户";
+
+ /**
+ * 某系统用户 查一条
+ * @param model 模型
+ * @return ResultVo
+ */
+ @GetMapping("/get")
+ ResultVo get(TestUserModel model);
+
+ /**
+ * 某系统用户 查询分页
+ * @param pageNo 当前页
+ * @param pageSize 每页条数
+ * @param request request
+ * @return ResultVo
+ */
+ @GetMapping("/findPage")
+ ResultVo> findPage(
+ @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+ @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+ HttpServletRequest request
+ );
+
+ /**
+ * 某系统用户 新增
+ * @param model 模型
+ * @return ResultVo
+ */
+ @PostMapping("/insert")
+ ResultVo> insert(@RequestBody TestUserModel model);
+
+ /**
+ * 某系统用户 修改
+ * @param model 模型
+ * @return ResultVo
+ */
+ @PostMapping("/update")
+ ResultVo> update(@RequestBody TestUserModel model);
+
+ /**
+ * 某系统用户 删除
+ * @param id ID
+ * @return ResultVo
+ */
+ @PostMapping("/del")
+ ResultVo> del(String id);
+
+ /**
+ * 某系统用户 批量删除
+ * @param ids ID 数组
+ * @return ResultVo
+ */
+ @PostMapping("/delAll")
+ ResultVo> delAll(String[] ids);
+
+ /**
+ * 某系统用户 Excel 导出
+ * @param request request
+ * @param response response
+ * @return ResultVo
+ */
+ @GetMapping("/exportExcel")
+ ResultVo> exportExcel(HttpServletRequest request, HttpServletResponse response);
+
+ /**
+ * 某系统用户 Excel 导入
+ * @param request 文件流 request
+ * @return ResultVo
+ */
+ @GetMapping("/exportImport")
+ ResultVo> excelImport(MultipartHttpServletRequest request);
+
+ /**
+ * 某系统用户 Excel 下载导入模版
+ * @param response response
+ * @return ResultVo
+ */
+ @GetMapping("/exportImport/template")
+ ResultVo> importTemplate(HttpServletResponse response);
+
+}
diff --git a/opsli-api/src/main/java/org/opsli/api/wrapper/gentest/user/TestUserModel.java b/opsli-api/src/main/java/org/opsli/api/wrapper/gentest/user/TestUserModel.java
new file mode 100755
index 00000000..55be235e
--- /dev/null
+++ b/opsli-api/src/main/java/org/opsli/api/wrapper/gentest/user/TestUserModel.java
@@ -0,0 +1,91 @@
+/**
+ * Copyright 2020 OPSLI 快速开发平台 https://www.opsli.com
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.opsli.api.wrapper.gentest.user;
+
+import java.util.Date;
+import com.alibaba.excel.annotation.ExcelProperty;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.opsli.api.base.warpper.ApiWrapper;
+import org.opsli.common.annotation.validation.ValidationArgs;
+import org.opsli.common.annotation.validation.ValidationArgsLenMax;
+import org.opsli.common.enums.ValiArgsType;
+import org.opsli.plugins.excel.annotation.ExcelInfo;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.springframework.format.annotation.DateTimeFormat;
+
+/**
+ * @BelongsProject: opsli-boot
+ * @BelongsPackage: org.opsli.api.wrapper.gentest.user
+ * @Author: 周鹏程
+ * @CreateTime: 2020-11-22 12:12:05
+ * @Description: 某系统用户
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+public class TestUserModel extends ApiWrapper {
+
+ /** 名称 */
+ @ApiModelProperty(value = "名称")
+ @ExcelProperty(value = "名称", order = 1)
+ @ExcelInfo
+ // 验证器
+ @ValidationArgs({ValiArgsType.IS_GENERAL_WITH_CHINESE})
+ @ValidationArgsLenMax(50)
+ private String name;
+
+ /** 金钱 */
+ @ApiModelProperty(value = "金钱")
+ @ExcelProperty(value = "金钱", order = 2)
+ @ExcelInfo
+ // 验证器
+ @ValidationArgs({ValiArgsType.IS_NOT_NULL, ValiArgsType.IS_MONEY})
+ @ValidationArgsLenMax(8)
+ private Double money;
+
+ /** 年龄 */
+ @ApiModelProperty(value = "年龄")
+ @ExcelProperty(value = "年龄", order = 3)
+ @ExcelInfo
+ // 验证器
+ @ValidationArgs({ValiArgsType.IS_NOT_NULL, ValiArgsType.IS_NUMBER})
+ @ValidationArgsLenMax(5)
+ private Integer age;
+
+ /** 生日 */
+ @ApiModelProperty(value = "生日")
+ @ExcelProperty(value = "生日", order = 4)
+ @ExcelInfo
+ // 验证器
+ @ValidationArgs({ValiArgsType.IS_NOT_NULL, })
+ @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+ @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private Date birth;
+
+ /** 是否启用 */
+ @ApiModelProperty(value = "是否启用")
+ @ExcelProperty(value = "是否启用", order = 5)
+ @ExcelInfo( dictType = "no_yes" )
+ // 验证器
+ @ValidationArgs({ValiArgsType.IS_NOT_NULL, })
+ @ValidationArgsLenMax(1)
+ private Character izUsable;
+
+
+
+}
diff --git a/opsli-base-support/opsli-common/src/main/java/org/opsli/common/utils/HumpUtil.java b/opsli-base-support/opsli-common/src/main/java/org/opsli/common/utils/HumpUtil.java
index fc70e444..64fc1afd 100644
--- a/opsli-base-support/opsli-common/src/main/java/org/opsli/common/utils/HumpUtil.java
+++ b/opsli-base-support/opsli-common/src/main/java/org/opsli/common/utils/HumpUtil.java
@@ -76,6 +76,17 @@ public final class HumpUtil {
return sb.toString().toLowerCase();
}
+ /**
+ * 首字母大写
+ * @param str
+ * @return
+ */
+ public static String captureName(String str) {
+ char[] cs = str.toCharArray();
+ cs[0] -= 32;
+ return String.valueOf(cs);
+ }
+
public static void main(String[] args) {
String aa = HumpUtil.humpToUnderline("tenantId");
String bb = HumpUtil.underlineToHump(aa);
diff --git a/opsli-base-support/opsli-common/src/main/java/org/opsli/common/utils/Props.java b/opsli-base-support/opsli-common/src/main/java/org/opsli/common/utils/Props.java
index 946e071e..4111da47 100644
--- a/opsli-base-support/opsli-common/src/main/java/org/opsli/common/utils/Props.java
+++ b/opsli-base-support/opsli-common/src/main/java/org/opsli/common/utils/Props.java
@@ -16,10 +16,13 @@
package org.opsli.common.utils;
import cn.hutool.core.convert.Convert;
+import cn.hutool.core.io.IoUtil;
import lombok.extern.slf4j.Slf4j;
+import org.springframework.core.io.ClassPathResource;
import org.yaml.snakeyaml.Yaml;
import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@@ -94,7 +97,8 @@ public class Props {
return;
}
- try (InputStream inputStream = Props.class.getResourceAsStream("/" + this.fileName)) {
+ ClassPathResource resource = new ClassPathResource("/" + this.fileName);
+ try (InputStream inputStream = resource.getInputStream()) {
Yaml yaml = new Yaml();
temp = yaml.load(inputStream);
diff --git a/opsli-base-support/opsli-common/src/main/java/org/opsli/common/utils/ZipUtils.java b/opsli-base-support/opsli-common/src/main/java/org/opsli/common/utils/ZipUtils.java
new file mode 100644
index 00000000..1aa7e847
--- /dev/null
+++ b/opsli-base-support/opsli-common/src/main/java/org/opsli/common/utils/ZipUtils.java
@@ -0,0 +1,91 @@
+package org.opsli.common.utils;
+
+import java.io.*;
+import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipOutputStream;
+
+/**
+ * @author Parker
+ * @date 2020-01-07
+ *
+ * 文件流转压缩包工具类
+ */
+public class ZipUtils {
+ /**
+ * 缓存区大小
+ */
+ private static final int BUFFER_SIZE = 2 * 1024;
+
+ public static final String FILE_PATH = "path";
+ public static final String FILE_NAME = "name";
+ public static final String FILE_DATA = "data";
+
+
+
+ /**
+ * 压缩核心方法
+ */
+ private static void compress(ZipOutputStream zos, String path, String name, String data) throws Exception {
+ byte[] buf = new byte[BUFFER_SIZE];
+ zos.putNextEntry(new ZipEntry(path + name));
+ int len;
+ ByteArrayInputStream in = new ByteArrayInputStream(data.getBytes(StandardCharsets.UTF_8));
+ while ((len = in.read(buf)) != -1) {
+ zos.write(buf, 0, len);
+ }
+ zos.closeEntry();
+ in.close();
+ }
+
+
+ /**
+ * 文本直接转zip压缩成文件
+ *
+ * @param list -> map -> path 路径; name 文件名; data 具体文本内容;
+ * @param out 传入输出流
+ * @throws RuntimeException 抛出异常
+ */
+ public static void toZip(List