Browse Source

Merge remote-tracking branch 'origin/master'

hym 4 years ago
parent
commit
2bb7d89292

+ 1 - 0
gateway/src/main/java/com/huaxu/gateway/config/SwaggerProvider.java

@@ -30,6 +30,7 @@ public class SwaggerProvider implements SwaggerResourcesProvider {
         List resources = new ArrayList<>();
         resources.add(swaggerResource("用户服务接口", "/user-auth/v2/api-docs?group=api"));
         resources.add(swaggerResource("用户管理接口", "/user-center/v2/api-docs?group=api"));
+        resources.add(swaggerResource("调度中心接口", "/sms-water/v2/api-docs?group=api"));
         return resources;
     }
 

+ 4 - 0
gateway/src/main/resources/application-dev.properties

@@ -22,6 +22,10 @@ spring.cloud.gateway.routes[1].uri=lb://user-center
 spring.cloud.gateway.routes[1].predicates[0]=Path=/user-center/**
 spring.cloud.gateway.routes[1].filters[0]=StripPrefix=1
 
+spring.cloud.gateway.routes[2].id=sms-water
+spring.cloud.gateway.routes[2].uri=lb://sms-water
+spring.cloud.gateway.routes[2].predicates[0]=Path=/sms-water/**
+spring.cloud.gateway.routes[2].filters[0]=StripPrefix=1
 
 spring.servlet.multipart.max-file-size=100MB
 spring.servlet.multipart.max-request-size=100MB

+ 1 - 0
pom.xml

@@ -8,6 +8,7 @@
     <artifactId>platform</artifactId>
     <version>1.0-SNAPSHOT</version>
     <modules>
+        <module>sms_water</module>
         <module>user_auth</module>
         <module>user_center</module>
         <module>gateway</module>

+ 66 - 0
sms_water/pom.xml

@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>platform</artifactId>
+        <groupId>com.huaxu</groupId>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>sms_water</artifactId>
+   <dependencies>
+       <dependency>
+           <groupId>cn.hutool</groupId>
+           <artifactId>hutool-all</artifactId>
+           <version>5.4.5</version>
+       </dependency>
+       <dependency>
+           <groupId>com.huaxu</groupId>
+           <artifactId>common</artifactId>
+           <version>1.0-SNAPSHOT</version>
+           <exclusions>
+               <exclusion>
+                   <groupId>org.springframework.security.oauth.boot</groupId>
+                   <artifactId>spring-security-oauth2-autoconfigure</artifactId>
+               </exclusion>
+           </exclusions>
+       </dependency>
+       <dependency>
+           <groupId>com.alibaba</groupId>
+           <artifactId>easyexcel</artifactId>
+           <version>2.2.6</version>
+           <exclusions>
+               <exclusion>
+                   <groupId>com.alibaba</groupId>
+                   <artifactId>fastjson</artifactId>
+               </exclusion>
+               <exclusion>
+                   <groupId>org.projectlombok</groupId>
+                   <artifactId>lombok</artifactId>
+               </exclusion>
+               <exclusion>
+                   <groupId>org.springframework.boot</groupId>
+                   <artifactId>spring-boot</artifactId>
+               </exclusion>
+               <exclusion>
+                   <groupId>org.springframework.boot</groupId>
+                   <artifactId>spring-boot-starter-web</artifactId>
+               </exclusion>
+           </exclusions>
+       </dependency>
+       <dependency>
+           <groupId>org.apache.poi</groupId>
+           <artifactId>poi-scratchpad</artifactId>
+           <version>4.0.1</version>
+       </dependency>
+   </dependencies>
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <maven.build.timestamp.format>yyyy-MM-dd_HH_mm</maven.build.timestamp.format>
+    </properties>
+    <build>
+        <finalName>${project.artifactId}-${maven.build.timestamp}</finalName>
+    </build>
+</project>

+ 25 - 0
sms_water/src/main/java/com/huaxu/SmsWaterApplication.java

@@ -0,0 +1,25 @@
+package com.huaxu;
+
+
+import org.mybatis.spring.annotation.MapperScan;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
+
+import org.springframework.context.ApplicationContext;
+
+import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
+import springfox.documentation.swagger2.annotations.EnableSwagger2;
+
+@EnableDiscoveryClient
+@SpringBootApplication
+@EnableSwagger2
+public class SmsWaterApplication {
+
+    public static void main(String[] args) {
+        ApplicationContext context = SpringApplication.run(SmsWaterApplication.class, args);
+        context.getApplicationName();
+
+    }
+
+}

+ 80 - 0
sms_water/src/main/java/com/huaxu/common/CustemhandlerUtils.java

@@ -0,0 +1,80 @@
+package com.huaxu.common;
+
+import com.alibaba.excel.enums.CellDataTypeEnum;
+import com.alibaba.excel.metadata.CellData;
+import com.alibaba.excel.metadata.Head;
+import com.alibaba.excel.util.CollectionUtils;
+import com.alibaba.excel.write.metadata.holder.WriteSheetHolder;
+import com.alibaba.excel.write.style.column.AbstractColumnWidthStyleStrategy;
+import org.apache.poi.ss.usermodel.Cell;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author xjh
+ * @version 1.0
+ * @date 2020/10/19 19 19:21
+ */
+public class CustemhandlerUtils extends AbstractColumnWidthStyleStrategy {
+    private static final int MAX_COLUMN_WIDTH = 255;
+    //因为在自动列宽的过程中,有些设置地方让列宽显得紧凑,所以做出了个判断
+    private static final int COLUMN_WIDTH = 20;
+    private  Map<Integer, Map<Integer, Integer>> CACHE = new HashMap(8);
+
+    public CustemhandlerUtils() {
+    }
+
+    @Override
+    protected void setColumnWidth(WriteSheetHolder writeSheetHolder, List<CellData> cellDataList, Cell cell, Head head, Integer relativeRowIndex, Boolean isHead) {
+        boolean needSetWidth = isHead || !CollectionUtils.isEmpty(cellDataList);
+        if (needSetWidth) {
+            Map<Integer, Integer> maxColumnWidthMap = (Map)CACHE.get(writeSheetHolder.getSheetNo());
+            if (maxColumnWidthMap == null) {
+                maxColumnWidthMap = new HashMap(16);
+                CACHE.put(writeSheetHolder.getSheetNo(), maxColumnWidthMap);
+            }
+
+            Integer columnWidth = this.dataLength(cellDataList, cell, isHead);
+            if (columnWidth >= 0) {
+                if (columnWidth > MAX_COLUMN_WIDTH) {
+                    columnWidth = MAX_COLUMN_WIDTH;
+                }else {
+                    if(columnWidth<COLUMN_WIDTH){
+                        columnWidth =columnWidth;
+                    }
+                }
+
+                Integer maxColumnWidth = (Integer)((Map)maxColumnWidthMap).get(cell.getColumnIndex());
+                if (maxColumnWidth == null || columnWidth > maxColumnWidth) {
+                    ((Map)maxColumnWidthMap).put(cell.getColumnIndex(), columnWidth);
+                    writeSheetHolder.getSheet().setColumnWidth(cell.getColumnIndex(),  columnWidth* 256);
+                }
+            }
+        }
+    }
+
+    private  Integer dataLength(List<CellData> cellDataList, Cell cell, Boolean isHead) {
+        if (isHead) {
+            return cell.getStringCellValue().getBytes().length;
+        } else {
+            CellData cellData = (CellData)cellDataList.get(0);
+            CellDataTypeEnum type = cellData.getType();
+            if (type == null) {
+                return -1;
+            } else {
+                switch(type) {
+                    case STRING:
+                        return cellData.getStringValue().getBytes().length;
+                    case BOOLEAN:
+                        return cellData.getBooleanValue().toString().getBytes().length;
+                    case NUMBER:
+                        return cellData.getNumberValue().toString().getBytes().length;
+                    default:
+                        return -1;
+                }
+            }
+        }
+    }
+}

+ 121 - 0
sms_water/src/main/java/com/huaxu/common/EasyExcelUtil.java

@@ -0,0 +1,121 @@
+package com.huaxu.common;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import com.alibaba.excel.metadata.Font;
+import com.alibaba.excel.metadata.Sheet;
+import com.alibaba.excel.metadata.TableStyle;
+import com.alibaba.excel.support.ExcelTypeEnum;
+import org.apache.commons.lang.time.DateFormatUtils;
+import org.apache.poi.ss.formula.functions.T;
+import org.apache.poi.ss.usermodel.FillPatternType;
+import org.apache.poi.ss.usermodel.HorizontalAlignment;
+import org.apache.poi.ss.usermodel.IndexedColors;
+import org.apache.poi.ss.usermodel.VerticalAlignment;
+import org.apache.poi.xssf.streaming.SXSSFSheet;
+
+import com.alibaba.excel.EasyExcel;
+import com.alibaba.excel.ExcelWriter;
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.alibaba.excel.annotation.format.DateTimeFormat;
+import com.alibaba.excel.annotation.format.NumberFormat;
+import com.alibaba.excel.annotation.write.style.ColumnWidth;
+import com.alibaba.excel.annotation.write.style.ContentRowHeight;
+import com.alibaba.excel.annotation.write.style.HeadRowHeight;
+import com.alibaba.excel.util.FileUtils;
+import com.alibaba.excel.write.merge.LoopMergeStrategy;
+import com.alibaba.excel.write.metadata.WriteSheet;
+import com.alibaba.excel.write.metadata.WriteTable;
+import com.alibaba.excel.write.metadata.style.WriteCellStyle;
+import com.alibaba.excel.write.metadata.style.WriteFont;
+import com.alibaba.excel.write.style.HorizontalCellStyleStrategy;
+import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy;
+/**
+ * @ClassName EasyExcelUtil
+ * @Description: Excel导出通用工具类
+ * @Author :WYY
+ * @Date 2020/10/27
+ * @Version V1.0
+ **/
+public  class EasyExcelUtil {
+    /**
+     * @MethodName:Excel导出
+     * @Description: TODO
+     * @Param: path 导出基础路径 t实体名 excelName 文件名 data数据
+     * @Return:
+     * @Author: WYY
+     * @Date: 2020/10/28
+    **/
+    public static String excelWrite(String path,Class t, String excelName,List data) {
+        String filePath = "";
+        String fileName = DateFormatUtils.format(new Date(), "yyyy/MM/dd") + File.separator;
+        fileName = fileName + excelName + System.currentTimeMillis() + ".xlsx";
+        try {
+            getAbsoluteFile(path, fileName);
+            EasyExcel.write(path + fileName, t)
+                    .excelType(ExcelTypeEnum.XLSX)
+                    .registerWriteHandler(new CustemhandlerUtils())
+                    .registerWriteHandler(EasyExcelUtil.getStyleStrategy())
+                    .sheet("Export")
+                    .doWrite(data);
+            filePath = getPathFileName(path, fileName);
+        } catch (IOException e) {
+            e.printStackTrace();
+        } finally {
+
+        }
+        return filePath;
+    }
+    private static final String getPathFileName(String uploadDir, String fileName) throws IOException {
+        String pathFileName = uploadDir  + "/" + fileName;
+        return ToolUtil.path(pathFileName);
+    }
+    private static final File getAbsoluteFile(String uploadDir, String fileName) throws IOException {
+        File desc = new File(uploadDir + File.separator + fileName);
+
+        if (!desc.getParentFile().exists()) {
+            desc.getParentFile().mkdirs();
+        }
+
+        return desc;
+    }
+    public static HorizontalCellStyleStrategy getStyleStrategy(){
+        // 头的策略
+        WriteCellStyle headWriteCellStyle = new WriteCellStyle();
+        // 背景设置为灰色
+        headWriteCellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
+        WriteFont headWriteFont = new WriteFont();
+        headWriteFont.setFontHeightInPoints((short)12);
+        // 字体样式
+        headWriteFont.setFontName("Frozen");
+        headWriteCellStyle.setWriteFont(headWriteFont);
+        //自动换行
+        headWriteCellStyle.setWrapped(false);
+        // 水平对齐方式
+        headWriteCellStyle.setHorizontalAlignment(HorizontalAlignment.CENTER);
+        // 垂直对齐方式
+        headWriteCellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
+
+        // 内容的策略
+        WriteCellStyle contentWriteCellStyle = new WriteCellStyle();
+        // 这里需要指定 FillPatternType 为FillPatternType.SOLID_FOREGROUND 不然无法显示背景颜色.头默认了 FillPatternType所以可以不指定
+//        contentWriteCellStyle.setFillPatternType(FillPatternType.SQUARES);
+        // 背景白色
+        contentWriteCellStyle.setFillForegroundColor(IndexedColors.WHITE.getIndex());
+        WriteFont contentWriteFont = new WriteFont();
+        // 字体大小
+        contentWriteFont.setFontHeightInPoints((short)12);
+        // 字体样式
+        contentWriteFont.setFontName("Calibri");
+        contentWriteCellStyle.setWriteFont(contentWriteFont);
+        // 这个策略是 头是头的样式 内容是内容的样式 其他的策略可以自己实现
+        return new HorizontalCellStyleStrategy(headWriteCellStyle, contentWriteCellStyle);
+    }
+}

+ 162 - 0
sms_water/src/main/java/com/huaxu/common/FileUploadUtil.java

@@ -0,0 +1,162 @@
+package com.huaxu.common;
+
+import org.apache.commons.io.FilenameUtils;
+import org.apache.commons.lang.time.DateFormatUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Date;
+
+/**
+ * @author wyy
+ * @date 2020-10-23 09:54
+ */
+public class FileUploadUtil {
+
+    /**
+     * 默认大小 50M
+     */
+    public static final long DEFAULT_MAX_SIZE = 50 * 1024 * 1024;
+    /**
+     * 默认的文件名最大长度 100
+     */
+    public static final int DEFAULT_FILE_NAME_LENGTH = 100;
+    /**
+     * 默认上传的地址
+     */
+    private static String defaultBaseDir = "/";
+    private static int counter = 0;
+
+    /**
+     * 根据文件路径上传
+     *
+     * @param baseDir 相对应用的基目录
+     * @param file    上传的文件
+     * @return 文件名称
+     * @throws IOException
+     */
+    public static final String uploadWeb(String baseDir, MultipartFile file) throws IOException {
+        try {
+            return upload(baseDir, file, MimeType.DEFAULT_ALLOWED_EXTENSION);
+        } catch (Exception e) {
+            throw new IOException(e.getMessage(), e);
+        }
+    }
+
+    /**
+     * 获取文件名的后缀
+     *
+     * @param file 表单文件
+     * @return 后缀名
+     */
+    public static final String getExtension(MultipartFile file) {
+        String extension = FilenameUtils.getExtension(file.getOriginalFilename());
+        if (ToolUtil.isEmpty(extension)) {
+            extension = MimeType.getExtension(file.getContentType());
+        }
+        return extension;
+    }
+
+    /**
+     * 判断MIME类型是否是允许的MIME类型
+     *
+     * @param extension
+     * @param allowedExtension
+     * @return
+     */
+    public static final boolean isAllowedExtension(String extension, String[] allowedExtension) {
+        for (String str : allowedExtension) {
+            if (str.equalsIgnoreCase(extension)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * 文件大小校验
+     *
+     * @param file 上传的文件
+     * @return
+     * @throws InvalidExtensionException
+     */
+    public static final void assertAllowed(MultipartFile file, String[] allowedExtension)
+            throws InvalidExtensionException {
+        long size = file.getSize();
+        if (DEFAULT_MAX_SIZE != -1 && size > DEFAULT_MAX_SIZE) {
+            throw new RxcException("10004", "文件太大");
+        }
+
+        String fileName = file.getOriginalFilename();
+        String extension = getExtension(file);
+        if (allowedExtension != null && !isAllowedExtension(extension, allowedExtension)) {
+            if (allowedExtension == MimeType.IMAGE_EXTENSION) {
+                throw new InvalidExtensionException.InvalidImageExtensionException(allowedExtension, extension,
+                        fileName);
+            } else if (allowedExtension == MimeType.FLASH_EXTENSION) {
+                throw new InvalidExtensionException.InvalidFlashExtensionException(allowedExtension, extension,
+                        fileName);
+            } else if (allowedExtension == MimeType.MEDIA_EXTENSION) {
+                throw new InvalidExtensionException.InvalidMediaExtensionException(allowedExtension, extension,
+                        fileName);
+            } else {
+                throw new InvalidExtensionException(allowedExtension, extension, fileName);
+            }
+        }
+    }
+
+    /**
+     * 编码文件名
+     */
+    public static final String extractFilename(MultipartFile file) {
+        String fileName = file.getOriginalFilename();
+        String extension = getExtension(file);
+        fileName = DateFormatUtils.format(new Date(), "yyyy/MM/dd") + File.separator + ToolUtil.encodingFilename(fileName) + "." + extension;
+        return fileName;
+    }
+
+    private static final File getAbsoluteFile(String uploadDir, String fileName) throws IOException {
+        File desc = new File(uploadDir + File.separator + fileName);
+
+        if (!desc.getParentFile().exists()) {
+            desc.getParentFile().mkdirs();
+        }
+        if (!desc.exists()) {
+            desc.createNewFile();
+        }
+        return desc;
+    }
+
+    private static final String getPathFileName(String uploadDir, String fileName) throws IOException {
+       // int dirLastIndex = uploadDir.lastIndexOf("/") + 1;
+        //String currentDir = StringUtils.substring(uploadDir, dirLastIndex);
+        String pathFileName = uploadDir  + "/" + fileName;
+        return ToolUtil.path(pathFileName);
+    }
+
+    /**
+     * 文件上传
+     *
+     * @param baseDir 相对应用的基目录
+     * @param file    上传的文件
+     * @return 返回上传成功的文件名
+     * @throws IOException 比如读写文件出错时
+     */
+    public static final String upload(String baseDir, MultipartFile file, String[] allowedExtension) throws RxcException, IOException, InvalidExtensionException {
+        int fileNamelength = file.getOriginalFilename().length();
+        if (fileNamelength > FileUploadUtil.DEFAULT_FILE_NAME_LENGTH) {
+            throw new RxcException("10004", "文件太大");
+        }
+
+        assertAllowed(file, allowedExtension);
+
+        String fileName = extractFilename(file);
+
+        File desc = getAbsoluteFile(baseDir, fileName);
+        file.transferTo(desc);
+        String pathFileName = getPathFileName(baseDir, fileName);
+        return pathFileName;
+    }
+}

+ 63 - 0
sms_water/src/main/java/com/huaxu/common/InvalidExtensionException.java

@@ -0,0 +1,63 @@
+package com.huaxu.common;
+
+
+
+import org.apache.tomcat.util.http.fileupload.FileUploadException;
+
+import java.util.Arrays;
+
+/**
+ * 文件上传 误异常类
+ * 
+ * @author WYY
+ */
+public class InvalidExtensionException extends FileUploadException {
+    private static final long serialVersionUID = 1L;
+
+    private String[] allowedExtension;
+    private String extension;
+    private String filename;
+
+    public InvalidExtensionException(String[] allowedExtension, String extension, String filename) {
+        super("filename : [" + filename + "], extension : [" + extension + "], allowed extension : [" + Arrays.toString(allowedExtension) + "]");
+        this.allowedExtension = allowedExtension;
+        this.extension = extension;
+        this.filename = filename;
+    }
+
+    public String[] getAllowedExtension() {
+        return allowedExtension;
+    }
+
+    public String getExtension() {
+        return extension;
+    }
+
+    public String getFilename() {
+        return filename;
+    }
+
+    public static class InvalidImageExtensionException extends InvalidExtensionException {
+        private static final long serialVersionUID = 1L;
+
+        public InvalidImageExtensionException(String[] allowedExtension, String extension, String filename) {
+            super(allowedExtension, extension, filename);
+        }
+    }
+
+    public static class InvalidFlashExtensionException extends InvalidExtensionException {
+        private static final long serialVersionUID = 1L;
+
+        public InvalidFlashExtensionException(String[] allowedExtension, String extension, String filename) {
+            super(allowedExtension, extension, filename);
+        }
+    }
+
+    public static class InvalidMediaExtensionException extends InvalidExtensionException {
+        private static final long serialVersionUID = 1L;
+
+        public InvalidMediaExtensionException(String[] allowedExtension, String extension, String filename) {
+            super(allowedExtension, extension, filename);
+        }
+    }
+}

+ 45 - 0
sms_water/src/main/java/com/huaxu/common/Md5Util.java

@@ -0,0 +1,45 @@
+package com.huaxu.common;
+
+import java.security.MessageDigest;
+
+
+public class Md5Util {
+    private static byte[] md5(String s){
+        MessageDigest algorithm;
+        try{
+            algorithm = MessageDigest.getInstance("MD5");
+            algorithm.reset();
+            algorithm.update(s.getBytes("UTF-8"));
+            byte[] messageDigest = algorithm.digest();
+            return messageDigest;
+        }
+        catch (Exception e){
+        }
+        return null;
+    }
+
+    private static final String toHex(byte hash[]){
+        if (hash == null){
+            return null;
+        }
+        StringBuffer buf = new StringBuffer(hash.length * 2);
+        int i;
+
+        for (i = 0; i < hash.length; i++){
+            if ((hash[i] & 0xff) < 0x10){
+                buf.append("0");
+            }
+            buf.append(Long.toString(hash[i] & 0xff, 16));
+        }
+        return buf.toString();
+    }
+
+    public static String hash(String s){
+        try{
+            return new String(toHex(md5(s)).getBytes("UTF-8"), "UTF-8");
+        }
+        catch (Exception e){
+            return s;
+        }
+    }
+}

+ 42 - 0
sms_water/src/main/java/com/huaxu/common/MimeType.java

@@ -0,0 +1,42 @@
+package com.huaxu.common;
+
+public class MimeType {
+    public static final String IMAGE_PNG = "image/png";
+    public static final String IMAGE_JPG = "image/jpg";
+    public static final String IMAGE_JPEG = "image/jpeg";
+    public static final String IMAGE_BMP = "image/bmp";
+    public static final String IMAGE_GIF = "image/gif";
+    public static final String[] IMAGE_EXTENSION = {"bmp", "gif", "jpg", "jpeg", "png"};
+    public static final String[] FLASH_EXTENSION = {"swf", "flv"};
+    public static final String[] MEDIA_EXTENSION = {"swf", "flv", "mp3", "wav", "wma", "wmv",
+            "mid", "avi", "mpg", "asf", "rm", "rmvb"};
+
+    public static final String[] DEFAULT_ALLOWED_EXTENSION = {
+            // 图片
+            "bmp", "gif", "jpg", "jpeg", "png",
+            // word excel powerpoint
+            "doc", "docx", "xls", "xlsx", "ppt", "pptx", "html", "htm", "txt",
+            // 压缩文件
+            "rar", "zip", "gz", "bz2",
+            //许可证书
+            "lic",
+            // pdf
+            "pdf"};
+
+    public static String getExtension(String urlPrefix) {
+        switch (urlPrefix) {
+            case IMAGE_PNG:
+                return "png";
+            case IMAGE_JPG:
+                return "jpg";
+            case IMAGE_JPEG:
+                return "jpeg";
+            case IMAGE_BMP:
+                return "bmp";
+            case IMAGE_GIF:
+                return "gif";
+            default:
+                return "";
+        }
+    }
+}

+ 95 - 0
sms_water/src/main/java/com/huaxu/common/ResourceUtil.java

@@ -0,0 +1,95 @@
+package com.huaxu.common;
+
+import org.apache.commons.io.IOUtils;
+import org.springframework.core.io.DefaultResourceLoader;
+import org.springframework.core.io.Resource;
+import org.springframework.core.io.ResourceLoader;
+import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
+import org.springframework.core.io.support.ResourcePatternResolver;
+import org.springframework.util.ResourceUtils;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * <p>资源供给</p>
+ *
+ * @author: WYY
+ * @date: 2019-03-26 17:57
+ * @version: 1.0.1
+ */
+public class ResourceUtil extends ResourceUtils {
+
+    private static ResourceLoader resourceLoader;
+    private static ResourcePatternResolver resourceResolver;
+
+    static {
+        resourceLoader = new DefaultResourceLoader();
+        resourceResolver = new PathMatchingResourcePatternResolver(resourceLoader);
+    }
+
+    /**
+     * 获取资源加载器(可读取jar内的文件)
+     *
+     * @author WYY
+     */
+    public static ResourceLoader getResourceLoader() {
+        return resourceLoader;
+    }
+
+    /**
+     * 获取ClassLoader
+     */
+    public static ClassLoader getClassLoader() {
+        return resourceLoader.getClassLoader();
+    }
+
+    /**
+     * 获取资源加载器(可读取jar内的文件)
+     */
+    public static Resource getResource(String location) {
+        return resourceLoader.getResource(location);
+    }
+
+    /**
+     * 获取资源文件流(用后记得关闭)
+     *
+     * @param location
+     * @throws IOException
+     * @author WYY
+     */
+    public static InputStream getResourceFileStream(String location) throws IOException {
+        Resource resource = resourceLoader.getResource(location);
+        return resource.getInputStream();
+    }
+
+    /**
+     * 获取资源文件内容
+     *
+     * @param location
+     * @author WYY
+     */
+    public static String getResourceFileContent(String location) {
+        try (InputStream is = getResourceFileStream(location)) {
+            return IOUtils.toString(is, "UTF-8");
+        } catch (IOException e) {
+            return "";
+        }
+    }
+
+    /**
+     * Spring 搜索资源文件
+     *
+     * @param locationPattern
+     * @author WYY
+     */
+    public static Resource[] getResources(String locationPattern) {
+        try {
+            Resource[] resources = resourceResolver.getResources(locationPattern);
+            return resources;
+        } catch (IOException e) {
+            return null;
+        }
+    }
+
+}

+ 48 - 0
sms_water/src/main/java/com/huaxu/common/RxcException.java

@@ -0,0 +1,48 @@
+package com.huaxu.common;
+
+import lombok.Data;
+
+/**
+ * 自定义异常处理
+ * @author wyy
+ * @date 2020-03-12 15:42
+ */
+@Data
+public class RxcException extends RuntimeException {
+
+	private static final long serialVersionUID = 1L;
+	private String msg;
+	private String code = "50000";
+	private String subCode;
+	private String subMsg;
+
+	public RxcException(String msg) {
+		super(msg);
+		this.msg = msg;
+	}
+
+	public RxcException(String code, String msg, String subCode, String subMsg) {
+		super(msg);
+		this.msg = msg;
+		this.code = code;
+		this.subCode = subCode;
+		this.subMsg = subMsg;
+	}
+
+	public RxcException(String msg, Throwable e) {
+		super(msg, e);
+		this.msg = msg;
+	}
+
+	public RxcException(String msg, String code) {
+		super(msg);
+		this.msg = msg;
+		this.code = code;
+	}
+
+	public RxcException(String msg, String code, Throwable e) {
+		super(msg, e);
+		this.msg = msg;
+		this.code = code;
+	}
+}

+ 356 - 0
sms_water/src/main/java/com/huaxu/common/ToolUtil.java

@@ -0,0 +1,356 @@
+package com.huaxu.common;
+
+import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.io.FileUtil;
+import cn.hutool.core.util.NumberUtil;
+import cn.hutool.core.util.StrUtil;
+import cn.hutool.extra.spring.SpringUtil;
+import cn.hutool.system.SystemUtil;
+import cn.hutool.system.oshi.OshiUtil;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.context.MessageSource;
+import org.springframework.context.i18n.LocaleContextHolder;
+
+import java.io.*;
+import java.util.*;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * 高频使用工具类
+ * @author wyy
+ * @date 2020-03-11 15:02
+ */
+public class ToolUtil {
+
+	private static int 							counter 							= 0;
+
+	
+	/**
+     * 获取随机字符,自定义长度
+     *
+     * @author wyy
+     * 2020-03-11 15:07
+     */
+    public static String getRandomString(int length) {
+        String base = "abcdefghijklmnopqrstuvwxyz0123456789";
+        Random random = new Random();
+        StringBuffer sb = new StringBuffer();
+        for (int i = 0; i < length; i++) {
+            int number = random.nextInt(base.length());
+            sb.append(base.charAt(number));
+        }
+        return sb.toString();
+    }
+	
+	/**
+	 * 判断对象是否为空  true 不为空
+	 * @author wyy
+	 * @date 2020-03-11 15:07
+	 */
+    public static boolean isNotEmpty(Object o) {
+        return !isEmpty(o);
+    }
+
+    /**
+     * 
+     * 对象是否为空 true 为空
+     * @author wyy
+     * @date 2020-03-11 15:09
+     */
+    public static boolean isEmpty(Object o) {
+        if (o == null) {
+            return true;
+        }
+        if (o instanceof String) {
+            if ("".equals(o.toString().trim())) {
+                return true;
+            }
+        } else if (o instanceof List) {
+            if (((List<?>) o).size() == 0) {
+                return true;
+            }
+        } else if (o instanceof Map) {
+            if (((Map<?, ?>) o).size() == 0) {
+                return true;
+            }
+        } else if (o instanceof Set) {
+            if (((Set<?>) o).size() == 0) {
+                return true;
+            }
+        } else if (o instanceof Object[]) {
+            if (((Object[]) o).length == 0) {
+                return true;
+            }
+        } else if (o instanceof int[]) {
+            if (((int[]) o).length == 0) {
+                return true;
+            }
+        } else if (o instanceof long[]) {
+            if (((long[]) o).length == 0) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * 对象组中是否存在空对象
+     *
+     * @author wyy
+     * @Date 2020-03-11 15:09
+     */
+    public static boolean isOneEmpty(Object... os) {
+        for (Object o : os) {
+            if (isEmpty(o)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * 对象组中是否全是空对象
+     *
+     * @author wyy
+     * @date 2020-03-11 15:09
+     */
+    public static boolean isAllEmpty(Object... os) {
+        for (Object o : os) {
+            if (!isEmpty(o)) {
+                return false;
+            }
+        }
+        return true;
+    }
+    
+    /**
+     * 根据消息键和参数 获取消息 委托给Spring messageSource
+     * 
+     * @param code 消息键
+     * @param args 参数
+     * @return 获取国际化翻译值
+     */
+    public static String message(String code, Object... args){
+        MessageSource messageSource = SpringUtil.getBean(MessageSource.class);
+        try{
+			return messageSource.getMessage(code, args, LocaleContextHolder.getLocale());
+		}catch (Exception e){
+        	return code;
+		}
+    }
+    
+    /**
+	 * 
+	 * 字节计算转换
+	 * 
+	 * <pre>
+	 * StrUtil.convertFileSize(1024)   			= 1kB
+	 * </pre>
+	 * @author wyy
+	 * @time 2019-04-03 12:29
+	 * @param size 字节大小
+	 * @return 转换后大小字符串
+	 *
+	 */
+	public static String convertFileSize(long size) {
+		long kb = 1024;
+        long mb = kb * 1024;
+        long gb = mb * 1024;
+        if (size >= gb)
+        {
+            return StrUtil.format("{} GB", NumberUtil.round((float) size / gb,2));
+        }
+        else if (size >= mb)
+        {
+            float f = NumberUtil.round((float) size / mb,2).floatValue();
+            return StrUtil.format(f > 100 ? "{} MB" : "{} MB", f);
+        }
+        else if (size >= kb)
+        {
+            float f = NumberUtil.round((float) size / kb,2).floatValue();
+            return StrUtil.format(f > 100 ? "{}  KB" : "{}  KB", f);
+        }
+        else
+        {
+            return StrUtil.format("{} B", size);
+        }
+	}
+	
+	public static String getMessage(Exception e){
+		StringWriter sw = null;
+		PrintWriter pw = null;
+		try {
+			sw = new StringWriter();
+			pw = new PrintWriter(sw);
+			e.printStackTrace(pw);
+			pw.flush();
+			sw.flush();
+		} finally {
+			if (sw != null) {
+				try {
+					sw.close();
+				} catch (IOException e1) {
+					e1.printStackTrace();
+				}
+			}
+			if (pw != null) {
+				pw.close();
+			}
+		}
+		return sw.toString();
+	}
+
+	public static boolean isBoolIp(String ipAddress) {
+		String ip = "([1-9]|[1-9]\\d|1\\d{2}|2[0-4]\\d|25[0-5])(\\.(\\d|[1-9]\\d|1\\d{2}|2[0-4]\\d|25[0-5])){3}";
+		Pattern pattern = Pattern.compile(ip);
+		Matcher matcher = pattern.matcher(ipAddress);
+		return matcher.matches();
+	}
+
+
+	public static String createFolder(String folder){
+		folder += File.separator + DateUtil.format(new Date(),"yyyy") + File.separator + DateUtil.format(new Date(),"MM") +
+				File.separator + DateUtil.format(new Date(),"dd")+ File.separator;
+		FileUtil.mkdir(folder);
+		return folder;
+	}
+
+
+	/**
+	 * 编码文件名
+	 */
+	public static String encodingFilename(String fileName) {
+		fileName = fileName.replace("_", " ");
+		fileName = Md5Util.hash(fileName + System.nanoTime() + counter++);
+		return fileName;
+	}
+
+	public static String encodingExcelFilename(String filename){
+		filename = UUID.randomUUID().toString() + "_" + filename + ".xlsx";
+		return filename;
+	}
+
+    /**
+     * 修正路径,将 \\ 或 / 等替换为 File.separator
+     * @param path 待修正的路径
+     * @return 修正后的路径
+     */
+    public static String path(String path) {
+        String p = StringUtils.replace(path, "\\", "/");
+        p = StringUtils.join(StringUtils.split(p, "/"), "/");
+        if (!StringUtils.startsWithAny(p, "/") && StringUtils.startsWithAny(path, "\\", "/")) {
+            p += "/";
+        }
+        if (!StringUtils.endsWithAny(p, "/") && StringUtils.endsWithAny(path, "\\", "/")) {
+            p = p + "/";
+        }
+        if (path != null && path.startsWith("/")) {
+            p = "/" + p; // linux下路径
+        }
+        if (StringUtils.endsWithAny(p, "/")) {
+            p = p.substring(0, p.length() - 1);
+        }
+        return p;
+    }
+
+    /**
+     * 获取工程源文件所在路径
+     * @return
+     */
+    public static String getProjectPath(){
+        String projectPath = "";
+        try {
+            File file = ResourceUtil.getResource("").getFile();
+            if (file != null){
+                while(true){
+                    File f = new File(path(file.getPath() + "/src/main"));
+                    if (f.exists()){
+                        break;
+                    }
+                    f = new File(path(file.getPath() + "/target/classes"));
+                    if (f.exists()){
+                        break;
+                    }
+                    if (file.getParentFile() != null){
+                        file = file.getParentFile();
+                    }else{
+                        break;
+                    }
+                }
+                projectPath = file.toString();
+            }
+        } catch (FileNotFoundException e) {
+            // 忽略异常
+        } catch (IOException e) {
+            // 忽略异常
+        }
+        // 取不到,取当前工作路径
+        if (StringUtils.isBlank(projectPath)){
+            projectPath = System.getProperty("user.dir");
+        }
+        return projectPath;
+    }
+
+    /**
+     * 获取工程源文件所在路径
+     * @return
+     */
+    public static String getWebappPath(){
+        String webappPath = "";
+        try {
+            File file = ResourceUtil.getResource("").getFile();
+            if (file != null){
+                while(true){
+                    File f = new File(path(file.getPath() + "/WEB-INF/classes"));
+                    if (f.exists()){
+                        break;
+                    }
+                    f = new File(path(file.getPath() + "/src/main/webapp"));
+                    if (f.exists()){
+                        return f.getPath();
+                    }
+                    if (file.getParentFile() != null){
+                        file = file.getParentFile();
+                    }else{
+                        break;
+                    }
+                }
+                webappPath = file.toString();
+            }
+        } catch (FileNotFoundException e) {
+            // 忽略异常
+        } catch (IOException e) {
+            // 忽略异常
+        }
+        // 取不到,取当前工作路径
+        if (StringUtils.isBlank(webappPath)){
+            webappPath = System.getProperty("user.dir");
+        }
+        return webappPath;
+    }
+
+	/**
+	 * 数组以某种分隔符拼装
+	 * @param value Long数值
+	 * @param s 分隔符
+	 * @return 拼装之后的字符串
+	 */
+    public static String conversion(Object value, String s){
+    	String src = "";
+    	if(value instanceof  Long[]){
+    	    Long[] a = (Long[]) value;
+            for(Long l: a){
+                src += l+s;
+            }
+        }
+    	if(value instanceof List){
+            List<String> a = (List) value;
+            for(int i=0; i< a.size(); i++){
+                src += a.get(i)+s;
+            }
+        }
+		return  src.substring(0,src.length()-s.length());
+	}
+
+}

+ 26 - 0
sms_water/src/main/java/com/huaxu/config/ResourceServerConfig.java

@@ -0,0 +1,26 @@
+package com.huaxu.config;
+
+import org.springframework.context.annotation.Configuration;
+import org.springframework.security.config.annotation.web.builders.HttpSecurity;
+import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer;
+import org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter;
+
+@Configuration
+@EnableResourceServer
+public class ResourceServerConfig extends ResourceServerConfigurerAdapter {
+
+    @Override
+    public void configure(HttpSecurity http) throws Exception {
+        http
+                .csrf().disable()
+                .requestMatchers().antMatchers("/**")
+                .and()
+                .authorizeRequests()
+                .antMatchers("/swagger-ui.html","/webjars/**", "/webjars/**", "/swagger-resources/**",
+                       "/v2/**")
+                .permitAll() //配置不需要身份认证的请求路径
+                .anyRequest().authenticated() //其他所有访问路径都需要身份认证
+                .and()
+                .httpBasic();
+    }
+}

+ 73 - 0
sms_water/src/main/resources/application-dev.properties

@@ -0,0 +1,73 @@
+server.port=8323
+spring.application.name=sms-water
+logging.level.root=info
+logging.path=./logs/sms-water
+#\u6570\u636E\u5E93\u914D\u7F6E
+spring.datasource.url=jdbc:mysql://114.135.61.188:33306/sms?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=convertToNull
+spring.datasource.username=root
+spring.datasource.password=100Zone@123
+spring.datasource.driver-class-name=com.mysql.jdbc.Driver
+spring.datasource.hikari.max-lifetime=30000
+mybatis-plus.mapper-locations=classpath:mapper/*.xml
+mybatis-plus.type-aliases-package=com.huaxu.entity
+mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
+mybatis-plus.global-config.db-config.logic-delete-value=0 
+mybatis-plus.global-config.db-config.logic-not-delete-value=1
+spring.jackson.time-zone=GMT+8
+#spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
+#spring.jackson.joda-date-time-format: yyyy-MM-dd HH:mm:ss
+
+# redis
+spring.redis.host=114.135.61.188
+spring.redis.port=26379
+spring.redis.password=zoniot
+spring.redis.database=2
+spring.redis.timeout=36000
+
+# Lettuce
+# \u8FDE\u63A5\u6C60\u6700\u5927\u8FDE\u63A5\u6570\uFF08\u4F7F\u7528\u8D1F\u503C\u8868\u793A\u6CA1\u6709\u9650\u5236\uFF09
+spring.redis.lettuce.pool.max-active=8
+# \u8FDE\u63A5\u6C60\u6700\u5927\u963B\u585E\u7B49\u5F85\u65F6\u95F4\uFF08\u4F7F\u7528\u8D1F\u503C\u8868\u793A\u6CA1\u6709\u9650\u5236\uFF09
+spring.redis.lettuce.pool.max-wait=100
+# \u8FDE\u63A5\u6C60\u4E2D\u7684\u6700\u5927\u7A7A\u95F2\u8FDE\u63A5
+spring.redis.lettuce.pool.max-idle=8
+# \u8FDE\u63A5\u6C60\u4E2D\u7684\u6700\u5C0F\u7A7A\u95F2\u8FDE\u63A5
+spring.redis.lettuce.pool.min-idle=0
+# \u5173\u95ED\u8D85\u65F6\u65F6\u95F4
+spring.redis.lettuce.shutdown-timeout=100
+
+
+security.oauth2.client.client-id=smart-city-v2
+security.oauth2.client.client-secret=smart-city-v2-123
+security.oauth2.resource.id=smartcity-deivice-service
+security.oauth2.resource.user-info-uri=http://localhost:8321/user/principal
+security.oauth2.resource.prefer-token-info=false
+
+
+spring.servlet.multipart.max-file-size=100MB
+spring.servlet.multipart.max-request-size=100MB
+spring.servlet.multipart.location=${logging.path}/data
+
+#kafka server
+spring.kafka.bootstrap-servers=114.135.61.188:36377
+#kafka consumer config
+spring.kafka.consumer.group-id=user-group-dev
+spring.kafka.consumer.auto-offset-reset=latest
+spring.kafka.consumer.enable-auto-commit=true
+#kafka producer config
+spring.kafka.producer.retries=0
+spring.kafka.producer.batch-size=4096
+spring.kafka.producer.buffer-memory=40960
+
+spring.kafka.producer.value-serializer=org.springframework.kafka.support.serializer.JsonSerializer
+spring.kafka.consumer.value-deserializer=org.springframework.kafka.support.serializer.JsonDeserializer
+spring.kafka.consumer.properties.spring.json.trusted.packages=*
+
+#nacos
+spring.cloud.nacos.discovery.server-addr=127.0.0.1:8848
+UMIS.sys_config_path=/UMIS_USER_IMAGES/
+UMIS.sys_excel_path=/UMIS_USER_EXCEL/
+
+
+
+

+ 69 - 0
sms_water/src/main/resources/application-prd.properties

@@ -0,0 +1,69 @@
+server.port=8322
+spring.application.name=sms-water
+logging.level.root=info
+logging.path=./logs/sms-water
+#\u6570\u636E\u5E93\u914D\u7F6E
+spring.datasource.url=jdbc:mysql://114.135.61.188:33306/sms?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=convertToNull
+spring.datasource.username=root
+spring.datasource.password=100Zone@123
+spring.datasource.driver-class-name=com.mysql.jdbc.Driver
+spring.datasource.hikari.max-lifetime=30000
+mybatis-plus.mapper-locations=classpath:mapper/*.xml
+mybatis-plus.type-aliases-package=com.huaxu.entity
+mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
+mybatis-plus.global-config.db-config.logic-delete-value=0 
+mybatis-plus.global-config.db-config.logic-not-delete-value=1
+spring.jackson.time-zone=GMT+8
+#spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
+#spring.jackson.joda-date-time-format: yyyy-MM-dd HH:mm:ss
+
+# redis
+spring.redis.host=114.135.61.188
+spring.redis.port=26379
+spring.redis.password=zoniot
+spring.redis.database=2
+spring.redis.timeout=36000
+
+# Lettuce
+# \u8FDE\u63A5\u6C60\u6700\u5927\u8FDE\u63A5\u6570\uFF08\u4F7F\u7528\u8D1F\u503C\u8868\u793A\u6CA1\u6709\u9650\u5236\uFF09
+spring.redis.lettuce.pool.max-active=8
+# \u8FDE\u63A5\u6C60\u6700\u5927\u963B\u585E\u7B49\u5F85\u65F6\u95F4\uFF08\u4F7F\u7528\u8D1F\u503C\u8868\u793A\u6CA1\u6709\u9650\u5236\uFF09
+spring.redis.lettuce.pool.max-wait=100
+# \u8FDE\u63A5\u6C60\u4E2D\u7684\u6700\u5927\u7A7A\u95F2\u8FDE\u63A5
+spring.redis.lettuce.pool.max-idle=8
+# \u8FDE\u63A5\u6C60\u4E2D\u7684\u6700\u5C0F\u7A7A\u95F2\u8FDE\u63A5
+spring.redis.lettuce.pool.min-idle=0
+# \u5173\u95ED\u8D85\u65F6\u65F6\u95F4
+spring.redis.lettuce.shutdown-timeout=100
+
+
+security.oauth2.client.client-id=smart-city-v2
+security.oauth2.client.client-secret=smart-city-v2-123
+security.oauth2.resource.id=smartcity-deivice-service
+security.oauth2.resource.user-info-uri=http://localhost:8321/user/principal
+security.oauth2.resource.prefer-token-info=false
+
+
+spring.servlet.multipart.max-file-size=100MB
+spring.servlet.multipart.max-request-size=100MB
+spring.servlet.multipart.location=${logging.path}/data
+
+#kafka server
+spring.kafka.bootstrap-servers=114.135.61.188:36377
+#kafka consumer config
+spring.kafka.consumer.group-id=user-group-dev
+spring.kafka.consumer.auto-offset-reset=latest
+spring.kafka.consumer.enable-auto-commit=true
+#kafka producer config
+spring.kafka.producer.retries=0
+spring.kafka.producer.batch-size=4096
+spring.kafka.producer.buffer-memory=40960
+
+spring.kafka.producer.value-serializer=org.springframework.kafka.support.serializer.JsonSerializer
+spring.kafka.consumer.value-deserializer=org.springframework.kafka.support.serializer.JsonDeserializer
+spring.kafka.consumer.properties.spring.json.trusted.packages=*
+
+#nacos
+spring.cloud.nacos.discovery.server-addr=127.0.0.1:8848
+UMIS.sys_config_path=/UMIS_USER_IMAGES/
+UMIS.sys_excel_path=/UMIS_USER_EXCEL/

+ 73 - 0
sms_water/src/main/resources/application-sit.properties

@@ -0,0 +1,73 @@
+server.port=8322
+spring.application.name=sms-water
+logging.level.root=info
+logging.path=./logs/sms-water
+#\u6570\u636E\u5E93\u914D\u7F6E
+spring.datasource.url=jdbc:mysql://114.135.61.188:33306/sms?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=convertToNull
+spring.datasource.username=root
+spring.datasource.password=100Zone@123
+spring.datasource.driver-class-name=com.mysql.jdbc.Driver
+spring.datasource.hikari.max-lifetime=30000
+mybatis-plus.mapper-locations=classpath:mapper/*.xml
+mybatis-plus.type-aliases-package=com.huaxu.entity
+mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
+mybatis-plus.global-config.db-config.logic-delete-value=0 
+mybatis-plus.global-config.db-config.logic-not-delete-value=1
+spring.jackson.time-zone=GMT+8
+#spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
+#spring.jackson.joda-date-time-format: yyyy-MM-dd HH:mm:ss
+
+# redis
+spring.redis.host=114.135.61.188
+spring.redis.port=26379
+spring.redis.password=zoniot
+spring.redis.database=2
+spring.redis.timeout=36000
+
+# Lettuce
+# \u8FDE\u63A5\u6C60\u6700\u5927\u8FDE\u63A5\u6570\uFF08\u4F7F\u7528\u8D1F\u503C\u8868\u793A\u6CA1\u6709\u9650\u5236\uFF09
+spring.redis.lettuce.pool.max-active=8
+# \u8FDE\u63A5\u6C60\u6700\u5927\u963B\u585E\u7B49\u5F85\u65F6\u95F4\uFF08\u4F7F\u7528\u8D1F\u503C\u8868\u793A\u6CA1\u6709\u9650\u5236\uFF09
+spring.redis.lettuce.pool.max-wait=100
+# \u8FDE\u63A5\u6C60\u4E2D\u7684\u6700\u5927\u7A7A\u95F2\u8FDE\u63A5
+spring.redis.lettuce.pool.max-idle=8
+# \u8FDE\u63A5\u6C60\u4E2D\u7684\u6700\u5C0F\u7A7A\u95F2\u8FDE\u63A5
+spring.redis.lettuce.pool.min-idle=0
+# \u5173\u95ED\u8D85\u65F6\u65F6\u95F4
+spring.redis.lettuce.shutdown-timeout=100
+
+
+security.oauth2.client.client-id=smart-city-v2
+security.oauth2.client.client-secret=smart-city-v2-123
+security.oauth2.resource.id=smartcity-deivice-service
+security.oauth2.resource.user-info-uri=http://localhost:8321/user/principal
+security.oauth2.resource.prefer-token-info=false
+
+
+spring.servlet.multipart.max-file-size=100MB
+spring.servlet.multipart.max-request-size=100MB
+spring.servlet.multipart.location=${logging.path}/data
+
+#kafka server
+spring.kafka.bootstrap-servers=114.135.61.188:36377
+#kafka consumer config
+spring.kafka.consumer.group-id=user-group-dev
+spring.kafka.consumer.auto-offset-reset=latest
+spring.kafka.consumer.enable-auto-commit=true
+#kafka producer config
+spring.kafka.producer.retries=0
+spring.kafka.producer.batch-size=4096
+spring.kafka.producer.buffer-memory=40960
+
+spring.kafka.producer.value-serializer=org.springframework.kafka.support.serializer.JsonSerializer
+spring.kafka.consumer.value-deserializer=org.springframework.kafka.support.serializer.JsonDeserializer
+spring.kafka.consumer.properties.spring.json.trusted.packages=*
+
+#nacos
+spring.cloud.nacos.discovery.server-addr=127.0.0.1:8848
+UMIS.sys_config_path=/UMIS_USER_IMAGES/
+UMIS.sys_excel_path=/UMIS_USER_EXCEL/
+
+
+
+

+ 2 - 0
sms_water/src/main/resources/application.properties

@@ -0,0 +1,2 @@
+#开发环境:dev  测试环境:sit  线上环境:prd
+spring.profiles.active=dev

+ 23 - 0
sms_water/src/main/resources/logback-spring.xml

@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configuration>
+    <springProperty scope="context" name="LOG_PATH" source="logging.path" defaultValue="/tmp" />
+    <include resource="org/springframework/boot/logging/logback/defaults.xml" />
+    <include resource="org/springframework/boot/logging/logback/console-appender.xml" />
+    <appender name="TIME_FILE"
+              class="ch.qos.logback.core.rolling.RollingFileAppender">
+        <encoder>
+            <pattern>${FILE_LOG_PATTERN}</pattern>
+        </encoder>
+        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+            <fileNamePattern>${LOG_PATH}/smartcity-user.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+            <maxHistory>365</maxHistory>
+            <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
+                <maxFileSize>100MB</maxFileSize>
+            </timeBasedFileNamingAndTriggeringPolicy>
+        </rollingPolicy>
+    </appender>
+    <root level="INFO">
+        <appender-ref ref="CONSOLE" />
+        <appender-ref ref="TIME_FILE" />
+    </root>
+</configuration>