ChenJiaHe
2020-12-14 c7c033c5e9252546e3482b6ad71abafa61ceeee0
Merge branch 'master' of https://gitee.com/huoxiong/hx_common
3个文件已添加
3个文件已修改
129 ■■■■■ 已修改文件
.idea/inspectionProfiles/Project_Default.xml 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.idea/libraries/Maven__com_qcloud_cos_api_5_6_24.xml 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.idea/libraries/Maven__joda_time_joda_time_2_9_9.xml 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hx-common.iml 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/hx/util/FileUtils.java 46 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/hx/util/StringUtils.java 45 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.idea/inspectionProfiles/Project_Default.xml
New file
@@ -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>
.idea/libraries/Maven__com_qcloud_cos_api_5_6_24.xml
New file
@@ -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>
.idea/libraries/Maven__joda_time_joda_time_2_9_9.xml
New file
@@ -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>
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" />
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        //上传路径
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;
    }
}