From c7c033c5e9252546e3482b6ad71abafa61ceeee0 Mon Sep 17 00:00:00 2001 From: ChenJiaHe <763432473@qq.com> Date: 星期一, 14 十二月 2020 17:39:28 +0800 Subject: [PATCH] Merge branch 'master' of https://gitee.com/huoxiong/hx_common --- .idea/inspectionProfiles/Project_Default.xml | 10 +++ src/main/java/com/hx/util/FileUtils.java | 46 +++++++++++++++ src/main/java/com/hx/util/StringUtils.java | 45 +++++++++++++++ .idea/libraries/Maven__joda_time_joda_time_2_9_9.xml | 13 ++++ .idea/libraries/Maven__com_qcloud_cos_api_5_6_24.xml | 13 ++++ hx-common.iml | 2 6 files changed, 129 insertions(+), 0 deletions(-) diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..4c64f60 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,10 @@ +<component name="InspectionProjectProfileManager"> + <profile version="1.0"> + <option name="myName" value="Project Default" /> + <inspection_tool class="DuplicatedCode" enabled="true" level="WEAK WARNING" enabled_by_default="true"> + <Languages> + <language minSize="109" name="Java" /> + </Languages> + </inspection_tool> + </profile> +</component> \ No newline at end of file diff --git a/.idea/libraries/Maven__com_qcloud_cos_api_5_6_24.xml b/.idea/libraries/Maven__com_qcloud_cos_api_5_6_24.xml new file mode 100644 index 0000000..dc754ef --- /dev/null +++ b/.idea/libraries/Maven__com_qcloud_cos_api_5_6_24.xml @@ -0,0 +1,13 @@ +<component name="libraryTable"> + <library name="Maven: com.qcloud:cos_api:5.6.24"> + <CLASSES> + <root url="jar://$MAVEN_REPOSITORY$/com/qcloud/cos_api/5.6.24/cos_api-5.6.24.jar!/" /> + </CLASSES> + <JAVADOC> + <root url="jar://$MAVEN_REPOSITORY$/com/qcloud/cos_api/5.6.24/cos_api-5.6.24-javadoc.jar!/" /> + </JAVADOC> + <SOURCES> + <root url="jar://$MAVEN_REPOSITORY$/com/qcloud/cos_api/5.6.24/cos_api-5.6.24-sources.jar!/" /> + </SOURCES> + </library> +</component> \ No newline at end of file diff --git a/.idea/libraries/Maven__joda_time_joda_time_2_9_9.xml b/.idea/libraries/Maven__joda_time_joda_time_2_9_9.xml new file mode 100644 index 0000000..a468f58 --- /dev/null +++ b/.idea/libraries/Maven__joda_time_joda_time_2_9_9.xml @@ -0,0 +1,13 @@ +<component name="libraryTable"> + <library name="Maven: joda-time:joda-time:2.9.9"> + <CLASSES> + <root url="jar://$MAVEN_REPOSITORY$/joda-time/joda-time/2.9.9/joda-time-2.9.9.jar!/" /> + </CLASSES> + <JAVADOC> + <root url="jar://$MAVEN_REPOSITORY$/joda-time/joda-time/2.9.9/joda-time-2.9.9-javadoc.jar!/" /> + </JAVADOC> + <SOURCES> + <root url="jar://$MAVEN_REPOSITORY$/joda-time/joda-time/2.9.9/joda-time-2.9.9-sources.jar!/" /> + </SOURCES> + </library> +</component> \ No newline at end of file diff --git a/hx-common.iml b/hx-common.iml index 1348670..77d6974 100644 --- a/hx-common.iml +++ b/hx-common.iml @@ -20,6 +20,8 @@ <orderEntry type="inheritedJdk" /> <orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="library" name="Maven: com.qcloud:cos_api:5.6.32" level="project" /> + <orderEntry type="library" name="Maven: joda-time:joda-time:2.9.9" level="project" /> + <orderEntry type="library" name="Maven: com.qcloud:cos_api:5.6.24" level="project" /> <orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" /> <orderEntry type="library" name="Maven: commons-codec:commons-codec:1.11" level="project" /> <orderEntry type="library" name="Maven: joda-time:joda-time:2.9.9" level="project" /> diff --git a/src/main/java/com/hx/util/FileUtils.java b/src/main/java/com/hx/util/FileUtils.java index 5089158..074f4d1 100644 --- a/src/main/java/com/hx/util/FileUtils.java +++ b/src/main/java/com/hx/util/FileUtils.java @@ -323,6 +323,52 @@ } /** + * 闊抽涓婁紶 + * @param platformIconFile + * @param unifiedFolder + * @param saveFolder + * @param autoDateFolder + * @return + */ + public static String handleAudioUpload(MultipartFile platformIconFile,String unifiedFolder,String saveFolder + ,boolean autoDateFolder) { + String fileName = ""; + try { + if(platformIconFile == null) { + throw new TipsException("璇蜂笂浼犻煶棰戯紒"); + } + + if(autoDateFolder){ + if(saveFolder.endsWith("/")){ + saveFolder = saveFolder+dateFormat(new Date(),"yyyyMM")+"/"; + }else{ + saveFolder = saveFolder+"/"+dateFormat(new Date(),"yyyyMM")+"/"; + } + } + + fileName = dateFormat(new Date(),"yyyyMMddHHmmssSSS"); + if(unifiedFolder.endsWith("/")){ + if(saveFolder.startsWith("/")){ + saveFolder = saveFolder.replaceFirst("/",""); + unifiedFolder = unifiedFolder + saveFolder; + }else{ + unifiedFolder = unifiedFolder+saveFolder; + } + }else{ + if(saveFolder.startsWith("/")){ + unifiedFolder = unifiedFolder + saveFolder; + }else{ + unifiedFolder = unifiedFolder+"/"+saveFolder; + } + } + fileName = saveFolder+fileUp(platformIconFile,unifiedFolder,fileName); + } catch (RuntimeException e) { + e.printStackTrace(); + } + return fileName; + } + + /** * 2020-06-29 ChenJiaHe 聽聽 聽 * @param file 聽聽 聽聽聽 聽聽聽 聽//鏂囦欢瀵硅薄 聽聽 聽 * @param filePath聽聽 聽聽聽 聽//涓婁紶璺緞 diff --git a/src/main/java/com/hx/util/StringUtils.java b/src/main/java/com/hx/util/StringUtils.java index a25bd93..78d4e36 100644 --- a/src/main/java/com/hx/util/StringUtils.java +++ b/src/main/java/com/hx/util/StringUtils.java @@ -313,4 +313,49 @@ return 0; } + /** + * 瀵瑰瓧绗︿覆锛堟墜鏈猴紝鍚嶇О锛変綔闅愯棌澶勭悊 + * @param oriStr 鍘熷瀛楃涓� + * @param type 绫诲瀷0锛氬彧淇濈暀绗竴涓強鏈�鍚庝竴涓瓧绗︼紝鍏跺畠鐢�*鏇夸唬锛�1鍓�4鍚�3淇濈暀锛屼腑闂寸敤*鏇夸唬 + * @return + */ + public static String hideKeyWord(String oriStr, int type) + { + if(!isEmpty(oriStr)) + { + String temp = null; + + if(type == 0) + { + if(oriStr.length() == 1) + { + temp = oriStr; + }else if(oriStr.length() == 2) { + temp = oriStr.substring(0, 1) + "*"; + }else if(oriStr.length() > 2) { + temp = oriStr.substring(0, 1); + for (int i = 1; i < oriStr.length() - 1; i++) { + temp += "*"; + } + temp += oriStr.substring(oriStr.length() - 1, oriStr.length()); + } + }else{ + if(oriStr.length() < 8) + { + temp = oriStr; + }else{ + temp = oriStr.substring(0,3); + for (int i = 3; i < oriStr.length() - 4; i++) { + temp += "*"; + } + temp += oriStr.substring(oriStr.length() - 4, oriStr.length()); + } + } + + return temp; + } + + return oriStr; + } + } -- Gitblit v1.8.0