diff --git a/.gitignore b/.gitignore index d792cc7..dd5290d 100644 --- a/.gitignore +++ b/.gitignore @@ -24,6 +24,7 @@ gen # Mobile Tools for Java (J2ME) .mtj.tmp/ + # Package Files # *.jar *.war diff --git a/eladmin-common/src/main/java/me/zhengjie/utils/SecurityUtils.java b/eladmin-common/src/main/java/me/zhengjie/utils/SecurityUtils.java index b4fae87..96672cc 100644 --- a/eladmin-common/src/main/java/me/zhengjie/utils/SecurityUtils.java +++ b/eladmin-common/src/main/java/me/zhengjie/utils/SecurityUtils.java @@ -86,6 +86,15 @@ public class SecurityUtils { return JSONUtil.toList(array,Long.class); } + + /** + * 获取当前用户的数据权限 + * @return / + */ + public static JSONObject getUser(){ + UserDetails userDetails = getCurrentUser(); + return new JSONObject(new JSONObject(userDetails).get("user")); + } /** * 获取数据权限级别 * @return 级别 diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/dmp/rest/DMPController.java b/eladmin-system/src/main/java/me/zhengjie/modules/dmp/rest/DMPController.java new file mode 100644 index 0000000..559c097 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/dmp/rest/DMPController.java @@ -0,0 +1,18 @@ +package me.zhengjie.modules.dmp.rest; + +import io.swagger.annotations.Api; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * @author Enzo + * @date : 2022/3/1 + */ +@RestController +@RequiredArgsConstructor +@Api(tags = "数据解析与图表展示") +@RequestMapping("/api/dmp") +public class DMPController { + +} diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/DeptController.java b/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/DeptController.java index 26ada08..1fd6cd2 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/DeptController.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/DeptController.java @@ -118,4 +118,4 @@ public class DeptController { deptService.delete(deptDtos); return new ResponseEntity<>(HttpStatus.OK); } -} \ No newline at end of file +} diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/uploadnew/util/CheckPhone.java b/eladmin-system/src/main/java/me/zhengjie/modules/uploadnew/util/CheckPhone.java new file mode 100644 index 0000000..6c9224a --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/uploadnew/util/CheckPhone.java @@ -0,0 +1,191 @@ +package me.zhengjie.modules.uploadnew.util; + +import cn.hutool.core.io.FileUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.poi.excel.ExcelReader; +import cn.hutool.poi.excel.ExcelUtil; +import org.springframework.util.CollectionUtils; + +import java.util.ArrayList; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * @author Enzo + * @date : 2021/10/28 + */ +public class CheckPhone { + + /** + * 电话格式验证 + **/ + private static final String PHONE_CALL_PATTERN = "^(\\(\\d{3,4}\\)|\\d{3,4}-)?\\d{7,8}(-\\d{1,4})?$"; + + /** + * 中国电信号码格式验证 手机段: 133,153,180,181,189,177,1700 + **/ + private static final String CHINA_TELECOM_PATTERN = "(^1(33|53|77|8[019])\\d{8}$)|(^1700\\d{7}$)"; + + /** + * 中国联通号码格式验证 手机段:130,131,132,155,156,185,186,145,176,1709 + **/ + private static final String CHINA_UNICOM_PATTERN = "(^1(3[0-2]|4[5]|5[56]|7[6]|8[56])\\d{8}$)|(^1709\\d{7}$)"; + + /** + * 中国移动号码格式验证 + * 手机段:134,135,136,137,138,139,150,151,152,157,158,159,182,183,184 + * ,187,188,147,178,1705 + **/ + private static final String CHINA_MOBILE_PATTERN = "(^1(3[4-9]|4[7]|5[0-27-9]|7[8]|8[2-478])\\d{8}$)|(^1705\\d{7}$)"; + + /** + * 验证电话号码的格式 + * + * @param str 校验电话字符串 + * @return 返回true, 否则为false + * @author LinBilin + */ + public static boolean isPhoneCallNum(String str) { + + return str == null || str.trim().equals("") ? false : match( + PHONE_CALL_PATTERN, str); + } + + /** + * 验证【电信】手机号码的格式 + * + * @param str 校验手机字符串 + * @return 返回true, 否则为false + * @author LinBilin + */ + public static boolean isChinaTelecomPhoneNum(String str) { + + return str == null || str.trim().equals("") ? false : match( + CHINA_TELECOM_PATTERN, str); + } + + /** + * 验证【联通】手机号码的格式 + * + * @param str 校验手机字符串 + * @return 返回true, 否则为false + * @author LinBilin + */ + public static boolean isChinaUnicomPhoneNum(String str) { + + return str == null || str.trim().equals("") ? false : match( + CHINA_UNICOM_PATTERN, str); + } + + /** + * 验证【移动】手机号码的格式 + * + * @param str 校验手机字符串 + * @return 返回true, 否则为false + * @author LinBilin + */ + public static boolean isChinaMobilePhoneNum(String str) { + + return str == null || str.trim().equals("") ? false : match( + CHINA_MOBILE_PATTERN, str); + } + + + /** + * 验证手机和电话号码的格式 + * + * @param str 校验手机字符串 + * @return 返回true, 否则为false + * @author LinBilin + */ + public static boolean isPhoneNum(String str) { + // 如果字符串为空,直接返回false + if (str == null || str.trim().equals("")) { + return false; + } else { + int comma = str.indexOf(",");// 是否含有逗号 + int caesuraSign = str.indexOf("、");// 是否含有顿号 + int space = str.trim().indexOf(" ");// 是否含有空格 + if (comma == -1 && caesuraSign == -1 && space == -1) { + // 如果号码不含分隔符,直接验证 + str = str.trim(); + return (isPhoneCallNum(str) || isChinaTelecomPhoneNum(str) + || isChinaUnicomPhoneNum(str) || isChinaMobilePhoneNum(str)) ? true + : false; + } else { + // 号码含分隔符,先把分隔符统一处理为英文状态下的逗号 + if (caesuraSign != -1) { + str = str.replaceAll("、", ","); + } + if (space != -1) { + str = str.replaceAll(" ", ","); + } + + String[] phoneNumArr = str.split(","); + //遍历验证 + for (String temp : phoneNumArr) { + temp = temp.trim(); + if (isPhoneCallNum(temp) || isChinaTelecomPhoneNum(temp) + || isChinaUnicomPhoneNum(temp) + || isChinaMobilePhoneNum(temp)) { + continue; + } else { + return false; + } + } + return true; + } + + } + + } + + /** + * 执行正则表达式 + * + * @param pat 表达式 + * @param str 待验证字符串 + * @return 返回true, 否则为false + */ + private static boolean match(String pat, String str) { + Pattern pattern = Pattern.compile(pat); + Matcher match = pattern.matcher(str); + return match.find(); + } + + public static void main(String[] args) { + + List list = new ArrayList<>(); + list.add("C:\\Users\\a\\Desktop\\7月.txt"); + list.add("C:\\Users\\a\\Desktop\\8月.txt"); + list.add("C:\\Users\\a\\Desktop\\9月份.txt"); + + List resultList = new ArrayList<>(); + List duplicationList = new ArrayList<>(); + for (int i = 0; i < list.size(); i++) { + ExcelReader reader = ExcelUtil.getReader(FileUtil.file(list.get(i))); + if (!CollectionUtils.isEmpty(reader.read())) { + for (List objects : reader.read()) { + String phone = objects.toString(); + if (phone.startsWith(StrUtil.BRACKET_START) && phone.endsWith(StrUtil.BRACKET_END) && phone.length() > 11) { + if (phone.length() == 13) { + resultList.add(phone.substring(1, 12)); + } + } + } + } + } + ExcelReader reader = ExcelUtil.getReader(FileUtil.file("C:\\Users\\a\\Desktop\\无标题.txt")); + for (List objects : reader.read()) { + String phone = objects.toString(); + if (phone.startsWith(StrUtil.BRACKET_START) && phone.endsWith(StrUtil.BRACKET_END) && phone.length() > 11) { + if (phone.length() == 13) { + duplicationList.add(phone.substring(1, 12)); + } + } + } + + + } +} diff --git a/eladmin-system/src/main/resources/config/application-dev.yml b/eladmin-system/src/main/resources/config/application-dev.yml index cefeb38..1a241f5 100644 --- a/eladmin-system/src/main/resources/config/application-dev.yml +++ b/eladmin-system/src/main/resources/config/application-dev.yml @@ -46,9 +46,9 @@ spring: redis: #数据库索引 database: 0 - host: 127.0.0.1 + host: 118.178.137.129 port: 6379 - password: '012099' + password: #连接超时时间 timeout: 5000 @@ -137,8 +137,8 @@ sys: debug: true redisson: - address: redis://127.0.0.1:6379 - password: '012099' + address: redis://118.178.137.129:6379 + password: diff --git a/eladmin-system/src/main/resources/config/application.yml b/eladmin-system/src/main/resources/config/application.yml index ba202b3..3fc0457 100644 --- a/eladmin-system/src/main/resources/config/application.yml +++ b/eladmin-system/src/main/resources/config/application.yml @@ -1,5 +1,5 @@ server: - port: 8000 + port: 8888 # 解决 最大缓冲区不够的问题 max-http-header-size: 8999 spring: