liurunyu
2024-10-19 8456b4e16a9fe4284c45b6d56d7dabeea1cb18e9
增加了分布式web文件系统
6个文件已修改
41个文件已添加
3966 ■■■■■ 已修改文件
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_83_Up.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/MurmurHash.java 302 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoFi/WebFileMapper.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/dyFile/FileConstant.java 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/dyFile/FileOperate.java 301 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/dyFile/FileRestVo.java 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/dyFile/FileVo.java 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/dyFile/NameValue.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoFi/WebFile.java 73 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/webCtrls/WebFileCtrl.java 250 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/webCtrls/WebFileSv.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/webCtrls/说明.txt 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/application-global(test测试系统).yml 158 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/application-global(ym元谋系统).yml 158 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/application-global(开发测试---166PC机).yml 158 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml 158 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/mapper/WebFileMapper.xml 126 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-file/.gitattributes 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-file/.gitignore 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-file/.mvn/wrapper/maven-wrapper.properties 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-file/mvnw 259 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-file/mvnw.cmd 149 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-file/pom.xml 142 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-file/src/main/java/com/dy/pipIrrWebFile/PipIrrWebFileApplication.java 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-file/src/main/java/com/dy/pipIrrWebFile/download/DownloadFileCtrl.java 109 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-file/src/main/java/com/dy/pipIrrWebFile/download/DownloadFileSv.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-file/src/main/java/com/dy/pipIrrWebFile/files/FileCtrl.java 202 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-file/src/main/java/com/dy/pipIrrWebFile/fm/DyFileSvConf.java 155 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-file/src/main/java/com/dy/pipIrrWebFile/fm/DyFmListener.java 67 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-file/src/main/java/com/dy/pipIrrWebFile/fm/FileName.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-file/src/main/java/com/dy/pipIrrWebFile/fm/FileNameIdUtil.java 112 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-file/src/main/java/com/dy/pipIrrWebFile/fm/FileRestVo.java 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-file/src/main/java/com/dy/pipIrrWebFile/fm/FmCtrl.java 133 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-file/src/main/java/com/dy/pipIrrWebFile/fm/RestHashDeal.java 95 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-file/src/main/java/com/dy/pipIrrWebFile/fm/说明.txt 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-file/src/main/java/com/dy/pipIrrWebFile/util/FileConstant.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-file/src/main/java/com/dy/pipIrrWebFile/util/FileDocumentUtil.java 46 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-file/src/main/java/com/dy/pipIrrWebFile/util/FileIconUtil.java 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-file/src/main/java/com/dy/pipIrrWebFile/util/FilePhoneUtil.java 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-file/src/main/java/com/dy/pipIrrWebFile/util/FilePhotoUtil.java 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-file/src/main/java/com/dy/pipIrrWebFile/util/FileUtil.java 122 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-file/src/main/java/com/dy/pipIrrWebFile/util/FileVideoUtil.java 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-file/src/main/java/com/dy/pipIrrWebFile/util/ZipImg.java 63 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-file/src/main/resources/application.yml 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-file/src/main/resources/log4j2.yml 71 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-file/src/test/java/com/dy/pipIrrWebFile/PipIrrWebFileApplicationTests.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pom.xml 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_83_Up.java
@@ -196,7 +196,9 @@
    public static void main(String[] args) throws Exception {
        Cd_83_Up obj = new Cd_83_Up() ;
        String hex = "683C68B08485353448830200000000001000282353FE739444000001000313000101211615000101210000000000000000000200019000011518000101210A7B16";
        //下面两条上报数据,IC卡编码都是非BCD编码而异常
        //String hex = "683C68B08485353448830200000000001000282353FE739444000001000313000101211615000101210000000000000000000200019000011518000101210A7B16";
        String hex = "683C68B05301154CEA8306001000000004343638483BBBB9E0001000001603000101215907000101210000000000000000000500019000015308000101210AF716";
        byte[] bs = ByteUtil.hex2Bytes(hex) ;
        Data data = new Data() ;
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/MurmurHash.java
New file
@@ -0,0 +1,302 @@
package com.dy.common.util;
/**
 * MurmurHash算法:高运算性能,低碰撞率,由Austin Appleby创建于2008年,
 * çŽ°å·²åº”ç”¨åˆ°Hadoop、libstdc++、nginx、libmemcached等开源系统。2011å¹´
 * Appleby被Google雇佣,随后Google推出其变种的CityHash算法。
 *
 * å®˜æ–¹ç½‘站:https://sites.google.com/site/murmurhash/
 *
 * MurmurHash算法,自称超级快的hash算法,是FNV的4-5倍。官方数据如下:
 *
 * OneAtATime â€“ 354.163715 mb/sec
 * FNV â€“ 443.668038 mb/sec
 * SuperFastHash â€“ 985.335173 mb/sec
 * lookup3 â€“ 988.080652 mb/sec
 * MurmurHash 1.0 â€“ 1363.293480 mb/sec
 * MurmurHash 2.0 â€“ 2056.885653 mb/sec
 *
 * ä½†ä¹Ÿæœ‰æ–‡ç« å£°ç§°ï¼Œåªæœ‰å½“key的长度大于10字节的时候,MurmurHash的运算速
 * åº¦æ‰å¿«äºŽDJB。从计算速度上来看,MurmurHash只适用于已知长度的、长度比
 * è¾ƒé•¿çš„字符。
 *
 * å“ˆå¸Œå€¼åˆ†å¸ƒéžå¸¸å‡åŒ€ï¼Œå³ä½Žç¢°æ’žçއ
 * æ¯”Crc16更为均匀
 */
public final class MurmurHash {
    private byte[] toBytesWithoutEncoding(String str) {
        int len = str.length();
        int pos = 0;
        byte[] buf = new byte[len << 1];
        for (int i = 0; i < len; i++) {
            char c = str.charAt(i);
            buf[pos++] = (byte) (c & 0xFF);
            buf[pos++] = (byte) (c >> 8);
        }
        return buf;
    }
    /**
     * åˆ˜æ¶¦çŽ‰å¢žåŠ æ–¹æ³•äºŽ2016-12-02
     * @param data
     * @param length
     * @return
     */
    public int hash16_plus(final byte[] data, int length) {
        int hash = hash32(data, length, 0x9747b28c);
        hash = hash % 65535 ;
        if(hash < 0){
            hash = - hash ;
        }
        return hash ;
    }
    /**
     * åˆ˜æ¶¦çŽ‰å¢žåŠ æ–¹æ³•äºŽ2016-12-02
     * @param data
     * @return
     */
    public int hash16_plus(final String data) {
        byte[] bytes = toBytesWithoutEncoding(data);
        int hash = hash32(bytes, bytes.length, 0x9747b28c);
        hash = hash % 65535 ;
        if(hash < 0){
            hash = - hash ;
        }
        return hash ;
    }
    /**
     * Generates 32 bit hash from byte array with default seed value.
     * @param  data byte array to hash
     * @param length length of the array to hash
     * @return 32 bit hash of the given array
     */
    public int hash32(final byte[] data, int length) {
        return hash32(data, length, 0x9747b28c);
    }
    public int hash32(final String data) {
        byte[] bytes = toBytesWithoutEncoding(data);
        return hash32(bytes, bytes.length, 0x9747b28c);
    }
    /**
     * Generates 64 bit hash from byte array with default seed value.
     * @param  data byte array to hash
     * @param length length of the array to hash
     * @return  64 bit hash of the given string
     */
    public long hash64(final byte[] data, int length) {
        return hash64(data, length, 0xe17a1465);
    }
    public long hash64(final String data) {
        byte[] bytes = toBytesWithoutEncoding(data);
        return hash64(bytes, bytes.length);
    }
    /**
     * Generates 32 bit hash from byte array of the given length and seed.
     * @param data byte array to hash
     * @param length length of the array
     * @param seed initial seed value
     * @return 32 bit hash of the given array
     */
    public int hash32(final byte[] data, int length, int seed) {
        // 'm' and 'r' are mixing constants generated offline.
        // They're not really 'magic', they just happen to work well.
        final int m = 0x5bd1e995;
        final int r = 24;
        // Initialize the hash to a random value
        int h = seed ^ length;
        int length4 = length / 4;
        for (int i = 0; i < length4; i++) {
            final int i4 = i * 4;
            int k = (data[i4 + 0] & 0xff) + ((data[i4 + 1] & 0xff) << 8)
                    + ((data[i4 + 2] & 0xff) << 16)
                    + ((data[i4 + 3] & 0xff) << 24);
            k *= m;
            k ^= k >>> r;
            k *= m;
            h *= m;
            h ^= k;
        }
        // Handle the last few bytes of the input array
        switch (length % 4) {
        case 3:
            h ^= (data[(length & ~3) + 2] & 0xff) << 16;
        case 2:
            h ^= (data[(length & ~3) + 1] & 0xff) << 8;
        case 1:
            h ^= (data[length & ~3] & 0xff);
            h *= m;
        }
        h ^= h >>> 13;
        h *= m;
        h ^= h >>> 15;
        return h;
    }
    /**
     * Generates 64 bit hash from byte array of the given length and seed.
     * @param data byte array to hash
     * @param length length of the array to hash
     * @param seed initial seed value
     * @return 64 bit hash of the given array
     */
    public long hash64(final byte[] data, int length, int seed) {
        final long m = 0xc6a4a7935bd1e995L;
        final int r = 47;
        long h = (seed & 0xffffffffl) ^ (length * m);
        int length8 = length / 8;
        for (int i = 0; i < length8; i++) {
            final int i8 = i * 8;
            long k = ((long) data[i8 + 0] & 0xff)
                    + (((long) data[i8 + 1] & 0xff) << 8)
                    + (((long) data[i8 + 2] & 0xff) << 16)
                    + (((long) data[i8 + 3] & 0xff) << 24)
                    + (((long) data[i8 + 4] & 0xff) << 32)
                    + (((long) data[i8 + 5] & 0xff) << 40)
                    + (((long) data[i8 + 6] & 0xff) << 48)
                    + (((long) data[i8 + 7] & 0xff) << 56);
            k *= m;
            k ^= k >>> r;
            k *= m;
            h ^= k;
            h *= m;
        }
        switch (length % 8) {
        case 7:
            h ^= (long) (data[(length & ~7) + 6] & 0xff) << 48;
        case 6:
            h ^= (long) (data[(length & ~7) + 5] & 0xff) << 40;
        case 5:
            h ^= (long) (data[(length & ~7) + 4] & 0xff) << 32;
        case 4:
            h ^= (long) (data[(length & ~7) + 3] & 0xff) << 24;
        case 3:
            h ^= (long) (data[(length & ~7) + 2] & 0xff) << 16;
        case 2:
            h ^= (long) (data[(length & ~7) + 1] & 0xff) << 8;
        case 1:
            h ^= (long) (data[length & ~7] & 0xff);
            h *= m;
        }
        ;
        h ^= h >>> r;
        h *= m;
        h ^= h >>> r;
        return h;
    }
    public static void main(String[] args) {
        test1() ;
        test2() ;
    }
    public static void test1() {
        String regionNum = "110000" ;
        String temp = "" ;
        String rtuAddr = "" ;
        int total0 = 0 ;
        int total1 = 0 ;
        int total2 = 0 ;
        int total3 = 0 ;
        int total4 = 0 ;
        int total5 = 0 ;
        int totalx = 0 ;
        int totaly = 0 ;
        MurmurHash mhash = new MurmurHash() ;
        Long start = System.currentTimeMillis() ;
        for(int i = 0 ; i < 10000; i++){
            temp = "" + i ;
            while(temp.length() < 5){
                temp = "0" + temp ;
            }
            rtuAddr = regionNum + temp ;
            int hash = mhash.hash16_plus(rtuAddr) ;
            if(hash < 0){
                total0++ ;
            }
            if(hash >= 0 && hash < 1000){
                total1++ ;
            }
            if(hash >= 1000 && hash < 2000){
                total2++ ;
            }
            if(hash >= 2000 && hash < 3000){
                total3++ ;
            }
            if(hash >= 3000 && hash < 4000){
                total4++ ;
            }
            if(hash >= 4000 && hash < 5000){
                total5++ ;
            }
            if(hash >= 64535 && hash < 65535){
                totalx++ ;
            }
            if(hash > 65535){
                totaly++ ;
            }
            //System.out.println(rtuAddr + "-" + crc);
        }
        Long end = System.currentTimeMillis() ;
        System.out.println("用时" + ":" + (end - start));
        System.out.println("0以下" + ":" + total0);
        System.out.println("0-1000" + ":" + total1);
        System.out.println("1000-2000" + ":" + total2);
        System.out.println("2000-3000" + ":" + total3);
        System.out.println("3000-4000" + ":" + total4);
        System.out.println("5000-6000" + ":" + total5);
        System.out.println("64535-65535" + ":" + totalx);
        System.out.println("65535以上" + ":" + totaly);
        System.out.println("=================");
    }
    public static void test2() {
        String regionNum = "110000" ;
        String temp = "" ;
        String rtuAddr = "" ;
        int total1 = 0 ;
        int total2 = 0 ;
        int total3 = 0 ;
        int total4 = 0 ;
        int total5 = 0 ;
        MurmurHash mhash = new MurmurHash() ;
        Long start = System.currentTimeMillis() ;
        for(int i = 0 ; i < 10000; i++){
            temp = "" ;
            temp = "" + i ;
            while(temp.length() < 5){
                temp = "0" + temp ;
            }
            rtuAddr = regionNum + temp ;
            int hash = mhash.hash32(rtuAddr) ;
            if(hash > 0 && hash < 10000000){
                total1++ ;
            }
            if(hash >= 10000000 && hash < 20000000){
                total2++ ;
            }
            if(hash >= 20000000 && hash < 30000000){
                total3++ ;
            }
            if(hash >= 30000000 && hash < 40000000){
                total4++ ;
            }
            if(hash >= 40000000 && hash < 50000000){
                total5++ ;
            }
            //System.out.println(rtuAddr + "-" + crc);
        }
        Long end = System.currentTimeMillis() ;
        System.out.println("用时" + ":" + (end - start));
        System.out.println("0-10000000" + ":" + total1);
        System.out.println("10000000-20000000" + ":" + total2);
        System.out.println("20000000-30000000" + ":" + total3);
        System.out.println("30000000-40000000" + ":" + total4);
        System.out.println("50000000-60000000" + ":" + total5);
        System.out.println("=================");
    }
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoFi/WebFileMapper.java
New file
@@ -0,0 +1,22 @@
package com.dy.pipIrrGlobal.daoFi;
import com.dy.pipIrrGlobal.pojoFi.WebFile;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface WebFileMapper {
    int deleteByPrimaryKey(Long id);
    int insert(WebFile record);
    int insertSelective(WebFile record);
    WebFile selectByPrimaryKey(Long id);
    int updateByPrimaryKeySelective(WebFile record);
    int updateByPrimaryKey(WebFile record);
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/dyFile/FileConstant.java
New file
@@ -0,0 +1,28 @@
package com.dy.pipIrrGlobal.dyFile;
public class FileConstant {
    public static final String NotRegionNum = "-1"; //在web文件系统dyFile中,如果行政区划是"-1",则认为不存在行政区划属性
    public static final String fmRequestMapping = "fm" ;//controller è·¯å¾„
    public static final String fmPostMapping_create = "create" ;//方法路径
    public static final String fmPostMapping_create_paramName = "fileExtName" ;//参数名称
    public static final String fmPostMapping_parsePath = "parsePath" ;//方法路径
    public static final String fmPostMapping_parsePath_paramName = "filePath" ;//参数名称
    public static final String fmPostMapping_parsePathList = "parsePathList" ;//方法路径
    public static final String fmPostMapping_parsePathList_paramName = "filePaths" ;//参数名称
    public static final String fmPostMapping_parseHashcode = "parseHashcode" ;//方法路径
    public static final String fmPostMapping_parseHashcode_paramName = "hashCode" ;//参数名称
    public static final String fileRequestMapping = "file" ;//controller è·¯å¾„
    public static final String filePostMapping_photo = "savePhoto" ;//方法路径
    public static final String filePostMapping_phone = "savePhone" ;//上传语音接口路径
    public static final String filePostMapping_video = "saveVideo" ;//上传录像接口路径
    public static final String filePostMapping_document = "saveDocument" ;//上传文档接口路径
    public static final String filePostMapping_paramName_file = "file" ;//参数名称
    public static final String filePostMapping_paramName_regionNum = "regionNum" ;//参数名称
    public static final String filePostMapping_paramName_json = "json" ;//参数名称
    public static final String filePostMapping_paramName_absolutePath = "absolutePath" ;//参数名称
    public static final String filePostMapping_paramName_relativePath = "relativePath" ;//参数名称
    public static final String filePostMapping_paramName_fileName = "fileName" ;//参数名称
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/dyFile/FileOperate.java
New file
@@ -0,0 +1,301 @@
package com.dy.pipIrrGlobal.dyFile;
import com.dy.common.util.NumUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Component;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.multipart.MultipartFile;
import java.util.Arrays;
import java.util.List;
@Component
public class FileOperate {
    @Autowired
    private RestTemplate restTemplate ;
    /**
     * æ‹†åˆ†ä¸Šè½½æ–‡ä»¶çš„名称
     * @param file
     * @return
     */
    public String[] splitFileName(MultipartFile file){
        String[] grp = new String[2] ;
        if(file != null) {
            String fileName = file.getOriginalFilename();
            int lastDotIndex = fileName.lastIndexOf('.');
            if (lastDotIndex >= 0) {
                grp[0] = fileName.substring(0, lastDotIndex);
                grp[1] = fileName.substring(lastDotIndex + 1);
                if(grp[0].trim().equals("")){
                    grp[0] = "匿名" ;
                }
            }
        }
        return grp ;
    }
    /**
     * å¾—到上载的文件扩展名
     * @param file
     * @return
     */
    public String getFileExtName(MultipartFile file){
        String fileExtName = null ;
        if(file != null) {
            String filename = file.getOriginalFilename();
            int lastDotIndex = filename.lastIndexOf('.');
            if (lastDotIndex >= 0) {
                fileExtName = filename.substring(lastDotIndex + 1);
            }
        }
        return fileExtName ;
    }
    /**
     * å¾—到上载的文件主名
     * @param fileName
     * @return
     */
    public String getFileMainName(String fileName){
        String fileMainName = null ;
        if(fileName != null) {
            int lastDotIndex = fileName.lastIndexOf('.');
            if (lastDotIndex >= 0) {
                fileMainName =  fileName.substring(0, lastDotIndex);
            }
        }
        if(fileMainName == null){
            fileMainName = "noName" ;
        }
        return fileMainName ;
    }
    /**
     * é€šè¿‡ç…§ç‰‡è·¯å¾„,得到对应缩略图的路径
     * @param imgPath
     * @return
     */
    public String getImgFileZipPath(String imgPath){
        String path_ = null ;
        String prePath = null ;
        String tailPath = null ;
        if(imgPath != null && !imgPath.trim().equals("")) {
            int lastDotIndex = imgPath.lastIndexOf('.');
            if (lastDotIndex >= 0) {
                prePath = imgPath.substring(0, lastDotIndex);
                tailPath = imgPath.substring(lastDotIndex);
                path_ = prePath + "_" + tailPath ;
            }
        }
        if(path_ == null){
            path_ = imgPath ;
        }
        return path_ ;
    }
    /**
     * web分布式文件系统保存文件
     * @param file
     * @param fmUrl
     * @param fileCtrlRqMp
     * @param fileMethodMp
     * @param regionNum
     * @param fileExtName
     * @param json
     * @return
     * @throws Exception
     */
    public FileRestVo saveFile(MultipartFile file,
                               String fmUrl,
                               String fileCtrlRqMp,
                               String fileMethodMp,
                               String regionNum,
                               String fileExtName,
                               String json) throws Exception{
        FileRestVo rvo  = null ;
        if(file != null && file.getBytes() != null && file.getBytes().length > 0){
            rvo = this.restCreateFileName(fmUrl, fileExtName) ;
            if(rvo != null){
                String relativeFilePath = this.restSaveFile(fileCtrlRqMp, fileMethodMp, file, regionNum, json, rvo);
                rvo.fileWebPath = relativeFilePath ;
                //if(relativeFilePath != null){
                //    rvo.createFilePath(relativeFilePath, rvo.fileNameHash);
                //}
            }
        }
        return rvo ;
    }
    /**
     * ç”Ÿæˆæ–‡ä»¶åç§°
     * @return
     */
    private FileRestVo restCreateFileName(String fmUrl, String fileExtName) throws Exception{
        // å‡†å¤‡è¯·æ±‚数据
        MultiValueMap<String, Object> multipartRequestData = new LinkedMultiValueMap<>();
        multipartRequestData.add(FileConstant.fmPostMapping_create_paramName, fileExtName);
        // è®¾ç½®è¯·æ±‚头部,这里假设服务器接收multipart/form-data类型的数据
        HttpHeaders headers = new HttpHeaders();
        headers.setContentType(MediaType.MULTIPART_FORM_DATA);
        // å°è£…请求体
        HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(multipartRequestData, headers);
        String webUrl = fmUrl + "/" + FileConstant.fmRequestMapping + "/" + FileConstant.fmPostMapping_create;
        // å‘送POST请求
        FileRestVo rvo = restTemplate.postForObject(webUrl, requestEntity, FileRestVo.class);
        return rvo ;
    }
    /**
     * æŠŠæ–‡ä»¶å­˜å‚¨åˆ°æ–‡ä»¶ç³»ç»Ÿä¸­
     * @param file
     * @param regionNum
     * @param json json数据
     * @param rvo
     * @return
     * @throws Exception
     */
    private String restSaveFile(String fileCtrlRqMp,
                                String fileMethodMp,
                                MultipartFile file,
                                String regionNum,
                                String json,
                                FileRestVo rvo) throws Exception{
        // å‡†å¤‡è¯·æ±‚数据
        MultiValueMap<String, Object> multipartRequestData = new LinkedMultiValueMap<>();
        multipartRequestData.add(FileConstant.filePostMapping_paramName_file, file.getResource());
        multipartRequestData.add(FileConstant.filePostMapping_paramName_regionNum, regionNum);
        multipartRequestData.add(FileConstant.filePostMapping_paramName_json, (json==null?"":json));
        multipartRequestData.add(FileConstant.filePostMapping_paramName_absolutePath, rvo.fileSysAbsolutePath);
        multipartRequestData.add(FileConstant.filePostMapping_paramName_relativePath, rvo.fileSysRelativePath);
        multipartRequestData.add(FileConstant.filePostMapping_paramName_fileName, rvo.fileName);
        // è®¾ç½®è¯·æ±‚头部,这里假设服务器接收multipart/form-data类型的数据
        HttpHeaders headers = new HttpHeaders();
        headers.setContentType(MediaType.MULTIPART_FORM_DATA);
        //headers.setContentLength(file.getSize());
        // å°è£…请求体
        HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(multipartRequestData, headers);
        String fileRestUrl = rvo.fileSysRestUrl ;
        if(!fileRestUrl.endsWith("/") && !fileRestUrl.endsWith("\\\\")){
            fileRestUrl += "/" ;
        }
        fileRestUrl += (fileCtrlRqMp + "/" + fileMethodMp) ;
        // å‘送POST请求
        return restTemplate.postForObject(fileRestUrl, requestEntity, Object.class).toString();
    }
    /**
     * è§£æžæ–‡ä»¶åç§°
     * @param fmUrl
     * @param filePath
     * @return
     */
    public FileRestVo parse(String fmUrl, String filePath){
        // å‡†å¤‡è¯·æ±‚数据
        MultiValueMap<String, Object> multipartRequestData = new LinkedMultiValueMap<>();
        multipartRequestData.add(FileConstant.fmPostMapping_parsePath_paramName, filePath);
        // è®¾ç½®è¯·æ±‚头部,这里假设服务器接收multipart/form-data类型的数据
        HttpHeaders headers = new HttpHeaders();
        headers.setContentType(MediaType.MULTIPART_FORM_DATA);
        // å°è£…请求体
        HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(multipartRequestData, headers);
        String webUrl = fmUrl + "/" + FileConstant.fmRequestMapping + "/" + FileConstant.fmPostMapping_parsePath;
        // å‘送POST请求
        FileRestVo rvo = restTemplate.postForObject(webUrl, requestEntity, FileRestVo.class);
        return rvo ;
    }
    /**
     * è§£æžæ–‡ä»¶åç§°
     * @param fmUrl
     * @param filePaths
     * @return
     */
    public List<FileRestVo> parse(String fmUrl, List<String> filePaths) throws Exception{
        List<FileRestVo> rList = null ;
        if(filePaths != null && filePaths.size() > 0) {
            MultiValueMap<String, Object> multipartRequestData = new LinkedMultiValueMap<>();
            multipartRequestData.add(FileConstant.fmPostMapping_parsePathList_paramName, filePaths);
            // è®¾ç½®è¯·æ±‚头部,这里假设服务器接收multipart/form-data类型的数据
            HttpHeaders headers = new HttpHeaders();
            headers.setContentType(MediaType.MULTIPART_FORM_DATA);
            // å°è£…请求体
            HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(multipartRequestData, headers);
            String webUrl = fmUrl + "/" + FileConstant.fmRequestMapping + "/" + FileConstant.fmPostMapping_parsePathList;
            // å‘送POST请求
            FileRestVo[] rvos = restTemplate.postForObject(webUrl, requestEntity, FileRestVo[].class);
            rList = Arrays.asList(rvos) ;
        }
        return rList ;
    }
    /**
     * è§£æžæ–‡ä»¶å“ˆå¸Œå€¼
     * @param fmUrl
     * @param hashcode
     * @return
     */
    public FileRestVo parseHashcode(String fmUrl, Integer hashcode){
        // å‡†å¤‡è¯·æ±‚数据
        MultiValueMap<String, Object> multipartRequestData = new LinkedMultiValueMap<>();
        multipartRequestData.add(FileConstant.fmPostMapping_parseHashcode_paramName, hashcode);
        // è®¾ç½®è¯·æ±‚头部,这里假设服务器接收multipart/form-data类型的数据
        HttpHeaders headers = new HttpHeaders();
        headers.setContentType(MediaType.MULTIPART_FORM_DATA);
        // å°è£…请求体
        HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(multipartRequestData, headers);
        String webUrl = fmUrl + "/" + FileConstant.fmRequestMapping + "/" + FileConstant.fmPostMapping_parseHashcode;
        // å‘送POST请求
        FileRestVo rvo = restTemplate.postForObject(webUrl, requestEntity, FileRestVo.class);
        return rvo ;
    }
    /**
     * è§£æžæ–‡ä»¶æ–‡ä»¶è·¯å¾„中的哈希值并返回图片完整路径
     * @param fmUrl
     * @param filePath
     * @return
     */
    public String getFilePath(String fmUrl, String filePath){
        FileRestVo rvo = null ;
        if(filePath != null && !filePath.trim().equals("")){
            String[] strs = filePath.split("\\?") ;
            String hashValStr = strs[strs.length - 1] ;
            if(hashValStr != null && !hashValStr.trim().equals("") && NumUtil.isPlusIntNumber(hashValStr)){
                int hashVal = Integer.valueOf(hashValStr) ;
                rvo = parseHashcode(fmUrl, hashVal) ;
            }
        }
        if(rvo != null){
            return rvo.getFileWebUrl() + filePath ;
        }
        return null ;
    }
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/dyFile/FileRestVo.java
New file
@@ -0,0 +1,44 @@
package com.dy.pipIrrGlobal.dyFile;
import lombok.Data;
@Data
public class FileRestVo {
    public String fileName ; //生成的文件名称,例如20170818153254_100000007.jpg
    public Integer fileNameHash ; //文件名称的哈希值
    public String fileSysId; //文件名称的哈希值对应的文件系统的id,在配置文件中配置
    public String fileSysAbsolutePath; //文件名称的哈希值对应的文件最终存储绝对路径中的根目录,在配置文件中配置
    public String fileSysRelativePath; //文件名称的哈希值对应的文件最终存储相对路径的目录,在配置文件中配置
    public String fileSysRestUrl; //文件名称的哈希值对应的文件系统的restful URL,在配置文件中配置
    public String fileWebPath; //文件名称的哈希值对应的文件系统的显示及下载文件的web path,动态生成
    public String fileWebUrl; //文件名称的哈希值对应的文件系统的显示文件的web URL,在配置文件中配置
    public String fileWebDownloadPath; //下载文档的Controller的相对路径
    public String toString(){
        return "fileName=" + fileName + "\n"
                + "fileNameHash=" + fileNameHash + "\n"
                + "fileSysId=" + fileSysId + "\n"
                + "fileSysAbsolutePath=" + fileSysAbsolutePath + "\n"
                + "fileSysRelativePath=" + fileSysRelativePath + "\n"
                + "fileSysRestUrl=" + fileSysRestUrl + "\n"
                + "fileWebPath=" + fileWebPath + "\n"
                + "fileWebUrl=" + fileWebUrl + "\n"
                + "fileWebDownloadPath=" + fileWebDownloadPath;
    }
    /**
     * æ­¤æ–¹æ³•不用了,因为文件名称后面加上 ï¼Ÿhashcode后,下载文件类中将找到不文件
     * é‡æ–°åˆ›å»ºfileSysWebUrl
     * @param relativeFilePath
     * @param hashcode
    public void createFilePath(String relativeFilePath, Integer hashcode){
        if(relativeFilePath != null){
            if(relativeFilePath.indexOf("?") < 0){
                this.fileWebPath = relativeFilePath + "?" + hashcode;
            }
        }
    }
    */
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/dyFile/FileVo.java
New file
@@ -0,0 +1,35 @@
package com.dy.pipIrrGlobal.dyFile;
import com.alibaba.fastjson2.annotation.JSONField;
import com.alibaba.fastjson2.writer.ObjectWriterImplToString;
import lombok.Data;
@Data
public class FileVo {
    @JSONField(serializeUsing= ObjectWriterImplToString.class)
    public Long id ; //数据库实体主键
    public Integer hash ;//文件名hash
    public String orgName ;//文件原名
    public String extName ;//文件扩展名
    public String webPath ;//web文件访问路径
    public String webPathZip;//照片文件缩略图访问路径,其他类型文件此属性为null
    public String downloadPath;//web文件下载路径,应用时路径后面加上 ?id=[id]
    public FileVo(){}
    public FileVo(Long id,
                  Integer hash,
                  String orgName,
                  String extName,
                  String webPath,
                  String webPathZip,
                  String downloadPath){
        this.id = id ;
        this.hash = hash ;
        this.orgName = orgName ;
        this.extName = extName ;
        this.webPath = webPath ;
        this.webPathZip = webPathZip ;
        this.downloadPath = downloadPath ;
    }
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/dyFile/NameValue.java
New file
@@ -0,0 +1,26 @@
package com.dy.pipIrrGlobal.dyFile;
public class NameValue {
    public String name ;
    public String value ;
    public NameValue(){
    }
    public NameValue(String name, String value){
        this.name = name ;
        this.value = value ;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getValue() {
        return value;
    }
    public void setValue(String value) {
        this.value = value;
    }
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoFi/WebFile.java
New file
@@ -0,0 +1,73 @@
package com.dy.pipIrrGlobal.pojoFi;
import com.alibaba.fastjson2.annotation.JSONField;
import com.alibaba.fastjson2.writer.ObjectWriterImplToString;
import com.baomidou.mybatisplus.annotation.*;
import com.dy.common.po.BaseEntity;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.*;
import java.util.Date;
/**
 * ä¸Šè½½çš„æ–‡ä»¶ä¿¡æ¯
 */
@TableName(value="web_file", autoResultMap = true)
@Data
@Builder
@ToString
@NoArgsConstructor
@AllArgsConstructor
public class WebFile implements BaseEntity {
    public static final long serialVersionUID = 202410190947001L;
    /**
     * ä¸»é”®
     */
    /* å¦‚果不明确 type类型,MP将自动为其赋值(雪花ID)
    IdType:
    AUTO(0),  //自增
    NONE(1), //未设置主键
    INPUT(2), //手动输入
    ASSIGN_ID(3),  //默认全局唯一ID
    ASSIGN_UUID(4), //全局唯一的 uuid
    */
    @JSONField(serializeUsing= ObjectWriterImplToString.class)
    @TableId(value = "id", type = IdType.INPUT)
    public Long id;
    /**
     * æ–‡ä»¶åŽŸåç§°
     */
    public String orgName;
    /**
     * æ‰©å±•名
     */
    public String extName;
    /**
     * ä¸Šä¼ æ–‡ä»¶åŽç³»ç»Ÿè‡ªåŠ¨ç»™æ–‡ä»¶èµ‹çš„æ–°åç§°
     */
    public String newName;
    /**
     * æ–‡ä»¶hash值
     */
    public Integer hash;
    /**
     * æ–‡ä»¶åœ¨æœåŠ¡ç«¯å­˜å‚¨çš„ç›¸å¯¹è·¯å¾„
     */
    public String filePath;
    /**
     * æ–‡ä»¶ä¸Šè½½æ—¥æœŸ
     */
    @TableField(value = "dt", fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    public Date dt;
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/webCtrls/WebFileCtrl.java
New file
@@ -0,0 +1,250 @@
package com.dy.pipIrrGlobal.webCtrls;
import com.dy.common.aop.SsoAop;
import com.dy.common.webUtil.BaseResponse;
import com.dy.common.webUtil.BaseResponseUtils;
import com.dy.pipIrrGlobal.dyFile.FileConstant;
import com.dy.pipIrrGlobal.dyFile.FileOperate;
import com.dy.pipIrrGlobal.dyFile.FileRestVo;
import com.dy.pipIrrGlobal.dyFile.FileVo;
import com.dy.pipIrrGlobal.pojoFi.WebFile;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import java.util.Date;
/**
 * web文件上传
 */
@Slf4j
@RestController
@RequestMapping(path="webFile")
public class WebFileCtrl {
    @Autowired
    private FileOperate fileOp ;
    @Autowired
    private WebFileSv sv ;
    @Value("${dy.webFile.fmUrl}")
    private String fmUrl ;
    //支持的文件类型
    @Value("${dy.webFile.supportedFileTypes}")
    private String supportedFileTypes ;
    /**
     * ä¸Šä¼ ç…§ç‰‡å›¾ç‰‡æ–‡ä»¶ ï¼ˆå½“前只对png jpg格式图片支持缩略图)
     * @param file web端上传文件的post对象
     * @return è¿”回结果
     */
    @PostMapping("/upPhoto")
    @SsoAop()
    //参考:https://blog.zhengru.top/posts/33486.html#%E5%8D%95%E6%96%87%E4%BB%B6%E4%B8%8A%E4%BC%A0
    public BaseResponse<?> upPhoto(MultipartFile file) {
        try {
            if (file != null) {
                String[] fileNameGrp = fileOp.splitFileName(file) ;
                if(fileNameGrp != null && fileNameGrp[0] != null && fileNameGrp[1] != null){
                    if(!fileNameGrp[1].trim().equals("")){
                        FileRestVo frVo = fileOp.saveFile(file,
                                fmUrl,
                                FileConstant.fileRequestMapping,
                                FileConstant.filePostMapping_photo,
                                FileConstant.NotRegionNum,
                                fileNameGrp[1],
                                null);
                        String fileMainName = fileOp.getFileMainName(frVo.fileName) ;
                        Long id = this.saveFileInfo(fileNameGrp[0], fileNameGrp[1], fileMainName, frVo.fileNameHash, frVo.fileWebPath);
                        FileVo fvo = new FileVo(id,
                                frVo.fileNameHash,
                                fileNameGrp[0],
                                fileNameGrp[1],
                                (frVo.getFileWebUrl() + frVo.getFileWebPath()),
                                fileOp.getImgFileZipPath(frVo.getFileWebUrl() + frVo.getFileWebPath()),
                                frVo.fileWebDownloadPath + id) ;
                        return  BaseResponseUtils.buildSuccess(fvo) ;
                    }else {
                        return BaseResponseUtils.buildError("未得到上传文件的扩展名");
                    }
                }else {
                    return BaseResponseUtils.buildError("未能拆分上传文件名称");
                }
            } else {
                return BaseResponseUtils.buildError("未上传文件");
            }
        } catch (Exception e) {
            log.error("上传照片文件异常", e);
            return BaseResponseUtils.buildException(e.getMessage());
        }
    }
    /**
     * ä¸Šä¼ å½•音音频文件
     * @param file web端上传文件的post对象
     * @return è¿”回结果
     */
    @PostMapping("/upPhone")
    @SsoAop()
    public BaseResponse<?> upPhone(MultipartFile file) {
        try {
            if (file != null) {
                String[] fileNameGrp = fileOp.splitFileName(file) ;
                if(fileNameGrp != null && fileNameGrp[0] != null && fileNameGrp[1] != null){
                    if(!fileNameGrp[1].trim().equals("")){
                        FileRestVo frVo = fileOp.saveFile(file,
                                fmUrl,
                                FileConstant.fileRequestMapping,
                                FileConstant.filePostMapping_phone,
                                FileConstant.NotRegionNum,
                                fileNameGrp[1],
                                null);
                        String fileMainName = fileOp.getFileMainName(frVo.fileName) ;
                        Long id = this.saveFileInfo(fileNameGrp[0], fileNameGrp[1], fileMainName, frVo.fileNameHash, frVo.fileWebPath);
                        FileVo fvo = new FileVo(id,
                                frVo.fileNameHash,
                                fileNameGrp[0],
                                fileNameGrp[1],
                                frVo.getFileWebUrl() + frVo.getFileWebPath(),
                                null,
                                frVo.fileWebDownloadPath + id) ;
                        return  BaseResponseUtils.buildSuccess(fvo) ;
                    }else {
                        return BaseResponseUtils.buildError("未得到上传文件的扩展名");
                    }
                }else {
                    return BaseResponseUtils.buildError("未能拆分上传文件名称");
                }
            } else {
                return BaseResponseUtils.buildError("未上传文件");
            }
        } catch (Exception e) {
            log.error("上传照片文件异常", e);
            return BaseResponseUtils.buildException(e.getMessage());
        }
    }
    /**
     * ä¸Šä¼ å½•像视频文件
     * @param file web端上传文件的post对象
     * @return è¿”回结果
     */
    @PostMapping("/upVideo")
    @SsoAop()
    public BaseResponse<?> upVideo(MultipartFile file) {
        try {
            if (file != null) {
                String[] fileNameGrp = fileOp.splitFileName(file) ;
                if(fileNameGrp != null && fileNameGrp[0] != null && fileNameGrp[1] != null){
                    if(!fileNameGrp[1].trim().equals("")){
                        FileRestVo frVo = fileOp.saveFile(file,
                                fmUrl,
                                FileConstant.fileRequestMapping,
                                FileConstant.filePostMapping_video,
                                FileConstant.NotRegionNum,
                                fileNameGrp[1],
                                null);
                        String fileMainName = fileOp.getFileMainName(frVo.fileName) ;
                        Long id = this.saveFileInfo(fileNameGrp[0], fileNameGrp[1], fileMainName, frVo.fileNameHash, frVo.fileWebPath);
                        FileVo fvo = new FileVo(id,
                                frVo.fileNameHash,
                                fileNameGrp[0],
                                fileNameGrp[1],
                                frVo.getFileWebUrl() + frVo.getFileWebPath(),
                                null,
                                frVo.fileWebDownloadPath + id) ;
                        return  BaseResponseUtils.buildSuccess(fvo) ;
                    }else {
                        return BaseResponseUtils.buildError("未得到上传文件的扩展名");
                    }
                }else {
                    return BaseResponseUtils.buildError("未能拆分上传文件名称");
                }
            } else {
                return BaseResponseUtils.buildError("未上传文件");
            }
        } catch (Exception e) {
            log.error("上传照片文件异常", e);
            return BaseResponseUtils.buildException(e.getMessage());
        }
    }
    /**
     * ä¸Šä¼ æ–‡æ¡£æ–‡ä»¶
     * @param file web端上传文件的post对象
     * @return è¿”回结果
     */
    @PostMapping("/upDocument")
    @SsoAop()
    public BaseResponse<?> upDocument(MultipartFile file) {
        try {
            if (file != null) {
                String[] fileNameGrp = fileOp.splitFileName(file) ;
                if(fileNameGrp != null && fileNameGrp[0] != null && fileNameGrp[1] != null){
                    if(!fileNameGrp[1].trim().equals("")){
                       String fileExtName = fileNameGrp[1];
                       if(!supportedFileTypes.contains(fileExtName)){
                           return BaseResponseUtils.buildError("请上传Word,Excel,PDF类型文档");
                       }
                        FileRestVo frVo = fileOp.saveFile(file,
                                fmUrl,
                                FileConstant.fileRequestMapping,
                                FileConstant.filePostMapping_document,
                                FileConstant.NotRegionNum,
                                fileNameGrp[1],
                                null);
                        String fileMainName = fileOp.getFileMainName(frVo.fileName) ;
                        Long id = this.saveFileInfo(fileNameGrp[0], fileNameGrp[1], fileMainName, frVo.fileNameHash, frVo.fileWebPath);
                        FileVo fvo = new FileVo(id,
                                frVo.fileNameHash,
                                fileNameGrp[0], fileNameGrp[1],
                                frVo.getFileWebUrl() + frVo.getFileWebPath(),
                                null,
                                frVo.fileWebDownloadPath + id) ;
                        return  BaseResponseUtils.buildSuccess(fvo) ;
                    }else {
                        return BaseResponseUtils.buildError("未得到上传文件的扩展名");
                    }
                }else {
                    return BaseResponseUtils.buildError("未能拆分上传文件名称");
                }
            } else {
                return BaseResponseUtils.buildError("未上传文件");
            }
        } catch (Exception e) {
            log.error("上传照片文件异常", e);
            return BaseResponseUtils.buildException(e.getMessage());
        }
    }
    /**
     * æ•°æ®åº“存储
     * @param orgName æ–‡ä»¶åŽŸåç§°
     * @param extName æ–‡ä»¶æ‰©å±•名
     * @param newName æ–‡ä»¶æ–°åç§°
     * @param hash  æ–‡ä»¶æ–°åç§°çš„哈希值
     * @param filePath æ–‡ä»¶æœåŠ¡ç«¯å­˜å‚¨ç›¸å¯¹è·¯å¾„
     * @return æ•°æ®è®°å½•主键
     */
    private Long saveFileInfo(String orgName, String extName, String newName, Integer hash, String filePath){
        WebFile po = new WebFile() ;
        po.orgName = orgName ;
        po.extName = extName ;
        po.newName = newName ;
        po.hash = hash ;
        po.filePath = filePath ;
        po.dt = new Date() ;
        return this.sv.save(po) ;
    }
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/webCtrls/WebFileSv.java
New file
@@ -0,0 +1,26 @@
package com.dy.pipIrrGlobal.webCtrls;
import com.dy.pipIrrGlobal.daoFi.WebFileMapper;
import com.dy.pipIrrGlobal.pojoFi.WebFile;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Slf4j
@Service
public class WebFileSv {
    private WebFileMapper dao;
    @Autowired
    public void setDao(WebFileMapper dao){
        this.dao = dao ;
    }
    @Transactional
    public Long save(WebFile po){
        this.dao.insertSelective(po) ;
        return po.id ;
    }
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/webCtrls/˵Ã÷.txt
New file
@@ -0,0 +1 @@
项目级全局Controller,所有依赖pipIrr-global的模块都有这些全局的Controller
pipIrr-platform/pipIrr-global/src/main/resources/application-global(test²âÊÔϵͳ).yml
@@ -128,6 +128,164 @@
        webPort: 8089
        actutorPort: 9089
        idSuffix: 11
    file:
        idSuffix: 99
    file1:
        webPort: 8180
        actutorPort: 9180
    file2:
        webPort: 8181
        actutorPort: 9181
    file3:
        webPort: 8182
        actutorPort: 9182
    file4:
        webPort: 8183
        actutorPort: 9183
    file5:
        webPort: 8184
        actutorPort: 9184
    file6:
        webPort: 8185
        actutorPort: 9185
    file7:
        webPort: 8186
        actutorPort: 9186
    file8:
        webPort: 8187
        actutorPort: 9187
    file9:
        webPort: 8188
        actutorPort: 9188
    file10:
        webPort: 8189
        actutorPort: 9189
    file11:
        webPort: 8190
        actutorPort: 9190
    file12:
        webPort: 8191
        actutorPort: 9191
#web分布式文件系统
dy:
    photoZipWidth: 400 #缩略图尺寸
    webFile:
        fmUrl: http://127.0.0.1:${pipIrr.file1.webPort}/file # fm的web上下文 URL
        supportedFileTypes: docx,xlsx,doc,xls,pdf #支持的文档(非照片、录音、录像)文件类型
        sv1:
            id: dyFile1
            absolutePath: E:/java/nginx-1.24.0/html/webfiles/
            relativePath: webFile1
            hashStart: 0
            hashEnd: 5461
            restUrl: http://127.0.0.1:${pipIrr.file1.webPort}/file #file是上下文,ip为局域网ip或本地IP
            webUrl: http://127.0.0.1:${pipIrr.nginx.webPort}/webfiles/ #nginx服务路径,安装部署时IP改成外网IP或域名
            webDownloadPath: http://127.0.0.1:${pipIrr.file1.webPort}/file/download/down?id=  #安装部署时IP改成外网IP或域名
        sv2:
            id: dyFile2
            absolutePath: E:/java/nginx-1.24.0/html/webfiles/
            relativePath: webFile2
            hashStart: 5462
            hashEnd: 10923
            restUrl: http://127.0.0.1:${pipIrr.file2.webPort}/file
            webUrl: http://127.0.0.1:${pipIrr.nginx.webPort}/webfiles/
            webDownloadPath: http://127.0.0.1:${pipIrr.file2.webPort}/file/download/down?id=
        sv3:
            id: dyFile3
            absolutePath: E:/java/nginx-1.24.0/html/webfiles/
            relativePath: webFile3
            hashStart: 10924
            hashEnd: 16385
            restUrl: http://127.0.0.1:${pipIrr.file3.webPort}/file
            webUrl: http://127.0.0.1:${pipIrr.nginx.webPort}/webfiles/
            webDownloadPath: http://127.0.0.1:${pipIrr.file3.webPort}/file/download/down?id=
        sv4:
            id: dyFile4
            absolutePath: E:/java/nginx-1.24.0/html/webfiles/
            relativePath: webFile4
            hashStart: 16386
            hashEnd: 21847
            restUrl: http://127.0.0.1:${pipIrr.file4.webPort}/file
            webUrl: http://127.0.0.1:${pipIrr.nginx.webPort}/webfiles/
            webDownloadPath: http://127.0.0.1:${pipIrr.file4.webPort}/file/download/down?id=
        sv5:
            id: dyFile5
            absolutePath: E:/java/nginx-1.24.0/html/webfiles/
            relativePath: webFile5
            hashStart: 21848
            hashEnd: 27309
            restUrl: http://127.0.0.1:${pipIrr.file5.webPort}/file
            webUrl: http://127.0.0.1:${pipIrr.nginx.webPort}/webfiles/
            webDownloadPath: http://127.0.0.1:${pipIrr.file5.webPort}/file/download/down?id=
        sv6:
            id: dyFile6
            absolutePath: E:/java/nginx-1.24.0/html/webfiles/
            relativePath: webFile6
            hashStart: 27310
            hashEnd: 32767
            restUrl: http://127.0.0.1:${pipIrr.file6.webPort}/file
            webUrl: http://127.0.0.1:${pipIrr.nginx.webPort}/webfiles/
            webDownloadPath: http://127.0.0.1:${pipIrr.file6.webPort}/file/download/down?id=
        sv7:
            id: dyFile7
            absolutePath: E:/java/nginx-1.24.0/html/webfiles/
            relativePath: webFile7
            hashStart: 32768
            hashEnd: 38229
            restUrl: http://127.0.0.1:${pipIrr.file7.webPort}/file
            webUrl: http://127.0.0.1:${pipIrr.nginx.webPort}/webfiles/
            webDownloadPath: http://127.0.0.1:${pipIrr.file7.webPort}/file/download/down?id=
        sv8:
            id: dyFile8
            absolutePath: E:/java/nginx-1.24.0/html/webfiles/
            relativePath: webFile8
            hashStart: 38230
            hashEnd: 43691
            restUrl: http://127.0.0.1:${pipIrr.file8.webPort}/file
            webUrl: http://127.0.0.1:${pipIrr.nginx.webPort}/webfiles/
            webDownloadPath: http://127.0.0.1:${pipIrr.file8.webPort}/file/download/down?id=
        sv9:
            id: dyFile9
            absolutePath: E:/java/nginx-1.24.0/html/webfiles/
            relativePath: webFile9
            hashStart: 43692
            hashEnd: 49153
            restUrl: http://127.0.0.1:${pipIrr.file9.webPort}/file
            webUrl: http://127.0.0.1:${pipIrr.nginx.webPort}/webfiles/
            webDownloadPath: http://127.0.0.1:${pipIrr.file9.webPort}/file/download/down?id=
        sv10:
            id: dyFile10
            absolutePath: E:/java/nginx-1.24.0/html/webfiles/
            relativePath: webFile10
            hashStart: 49154
            hashEnd: 54615
            restUrl: http://127.0.0.1:${pipIrr.file10.webPort}/file
            webUrl: http://127.0.0.1:${pipIrr.nginx.webPort}/webfiles/
            webDownloadPath: http://127.0.0.1:${pipIrr.file10.webPort}/file/download/down?id=
        sv11:
            id: dyFile11
            absolutePath: E:/java/nginx-1.24.0/html/webfiles/
            relativePath: webFile11
            hashStart: 54616
            hashEnd: 60077
            restUrl: http://127.0.0.1:${pipIrr.file11.webPort}/file
            webUrl: http://127.0.0.1:${pipIrr.nginx.webPort}/webfiles/
            webDownloadPath: http://127.0.0.1:${pipIrr.file11.webPort}/file/download/down?id=
        sv12:
            id: dyFile12
            absolutePath: E:/java/nginx-1.24.0/html/webfiles/
            relativePath: webFile12
            hashStart: 60078
            hashEnd: 65535
            restUrl: http://127.0.0.1:${pipIrr.file12.webPort}/file
            webUrl: http://127.0.0.1:${pipIrr.nginx.webPort}/webfiles/
            webDownloadPath: http://127.0.0.1:${pipIrr.file12.webPort}/file/download/down?id=
#项目编号
#projectCode:
#    ym: 100
pipIrr-platform/pipIrr-global/src/main/resources/application-global(ymԪıϵͳ).yml
@@ -128,6 +128,164 @@
        webPort: 8089
        actutorPort: 9089
        idSuffix: 11
    file:
        idSuffix: 99
    file1:
        webPort: 8180
        actutorPort: 9180
    file2:
        webPort: 8181
        actutorPort: 9181
    file3:
        webPort: 8182
        actutorPort: 9182
    file4:
        webPort: 8183
        actutorPort: 9183
    file5:
        webPort: 8184
        actutorPort: 9184
    file6:
        webPort: 8185
        actutorPort: 9185
    file7:
        webPort: 8186
        actutorPort: 9186
    file8:
        webPort: 8187
        actutorPort: 9187
    file9:
        webPort: 8188
        actutorPort: 9188
    file10:
        webPort: 8189
        actutorPort: 9189
    file11:
        webPort: 8190
        actutorPort: 9190
    file12:
        webPort: 8191
        actutorPort: 9191
#web分布式文件系统
dy:
    photoZipWidth: 400 #缩略图尺寸
    webFile:
        fmUrl: http://127.0.0.1:${pipIrr.file1.webPort}/file # fm的web上下文 URL
        supportedFileTypes: docx,xlsx,doc,xls,pdf #支持的文档(非照片、录音、录像)文件类型
        sv1:
            id: dyFile1
            absolutePath: E:/java/nginx-1.24.0/html/webfiles/
            relativePath: webFile1
            hashStart: 0
            hashEnd: 5461
            restUrl: http://127.0.0.1:${pipIrr.file1.webPort}/file #file是上下文,ip为局域网ip或本地IP
            webUrl: http://127.0.0.1:${pipIrr.nginx.webPort}/webfiles/ #nginx服务路径,安装部署时IP改成外网IP或域名
            webDownloadPath: http://127.0.0.1:${pipIrr.file1.webPort}/file/download/down?id=  #安装部署时IP改成外网IP或域名
        sv2:
            id: dyFile2
            absolutePath: E:/java/nginx-1.24.0/html/webfiles/
            relativePath: webFile2
            hashStart: 5462
            hashEnd: 10923
            restUrl: http://127.0.0.1:${pipIrr.file2.webPort}/file
            webUrl: http://127.0.0.1:${pipIrr.nginx.webPort}/webfiles/
            webDownloadPath: http://127.0.0.1:${pipIrr.file2.webPort}/file/download/down?id=
        sv3:
            id: dyFile3
            absolutePath: E:/java/nginx-1.24.0/html/webfiles/
            relativePath: webFile3
            hashStart: 10924
            hashEnd: 16385
            restUrl: http://127.0.0.1:${pipIrr.file3.webPort}/file
            webUrl: http://127.0.0.1:${pipIrr.nginx.webPort}/webfiles/
            webDownloadPath: http://127.0.0.1:${pipIrr.file3.webPort}/file/download/down?id=
        sv4:
            id: dyFile4
            absolutePath: E:/java/nginx-1.24.0/html/webfiles/
            relativePath: webFile4
            hashStart: 16386
            hashEnd: 21847
            restUrl: http://127.0.0.1:${pipIrr.file4.webPort}/file
            webUrl: http://127.0.0.1:${pipIrr.nginx.webPort}/webfiles/
            webDownloadPath: http://127.0.0.1:${pipIrr.file4.webPort}/file/download/down?id=
        sv5:
            id: dyFile5
            absolutePath: E:/java/nginx-1.24.0/html/webfiles/
            relativePath: webFile5
            hashStart: 21848
            hashEnd: 27309
            restUrl: http://127.0.0.1:${pipIrr.file5.webPort}/file
            webUrl: http://127.0.0.1:${pipIrr.nginx.webPort}/webfiles/
            webDownloadPath: http://127.0.0.1:${pipIrr.file5.webPort}/file/download/down?id=
        sv6:
            id: dyFile6
            absolutePath: E:/java/nginx-1.24.0/html/webfiles/
            relativePath: webFile6
            hashStart: 27310
            hashEnd: 32767
            restUrl: http://127.0.0.1:${pipIrr.file6.webPort}/file
            webUrl: http://127.0.0.1:${pipIrr.nginx.webPort}/webfiles/
            webDownloadPath: http://127.0.0.1:${pipIrr.file6.webPort}/file/download/down?id=
        sv7:
            id: dyFile7
            absolutePath: E:/java/nginx-1.24.0/html/webfiles/
            relativePath: webFile7
            hashStart: 32768
            hashEnd: 38229
            restUrl: http://127.0.0.1:${pipIrr.file7.webPort}/file
            webUrl: http://127.0.0.1:${pipIrr.nginx.webPort}/webfiles/
            webDownloadPath: http://127.0.0.1:${pipIrr.file7.webPort}/file/download/down?id=
        sv8:
            id: dyFile8
            absolutePath: E:/java/nginx-1.24.0/html/webfiles/
            relativePath: webFile8
            hashStart: 38230
            hashEnd: 43691
            restUrl: http://127.0.0.1:${pipIrr.file8.webPort}/file
            webUrl: http://127.0.0.1:${pipIrr.nginx.webPort}/webfiles/
            webDownloadPath: http://127.0.0.1:${pipIrr.file8.webPort}/file/download/down?id=
        sv9:
            id: dyFile9
            absolutePath: E:/java/nginx-1.24.0/html/webfiles/
            relativePath: webFile9
            hashStart: 43692
            hashEnd: 49153
            restUrl: http://127.0.0.1:${pipIrr.file9.webPort}/file
            webUrl: http://127.0.0.1:${pipIrr.nginx.webPort}/webfiles/
            webDownloadPath: http://127.0.0.1:${pipIrr.file9.webPort}/file/download/down?id=
        sv10:
            id: dyFile10
            absolutePath: E:/java/nginx-1.24.0/html/webfiles/
            relativePath: webFile10
            hashStart: 49154
            hashEnd: 54615
            restUrl: http://127.0.0.1:${pipIrr.file10.webPort}/file
            webUrl: http://127.0.0.1:${pipIrr.nginx.webPort}/webfiles/
            webDownloadPath: http://127.0.0.1:${pipIrr.file10.webPort}/file/download/down?id=
        sv11:
            id: dyFile11
            absolutePath: E:/java/nginx-1.24.0/html/webfiles/
            relativePath: webFile11
            hashStart: 54616
            hashEnd: 60077
            restUrl: http://127.0.0.1:${pipIrr.file11.webPort}/file
            webUrl: http://127.0.0.1:${pipIrr.nginx.webPort}/webfiles/
            webDownloadPath: http://127.0.0.1:${pipIrr.file11.webPort}/file/download/down?id=
        sv12:
            id: dyFile12
            absolutePath: E:/java/nginx-1.24.0/html/webfiles/
            relativePath: webFile12
            hashStart: 60078
            hashEnd: 65535
            restUrl: http://127.0.0.1:${pipIrr.file12.webPort}/file
            webUrl: http://127.0.0.1:${pipIrr.nginx.webPort}/webfiles/
            webDownloadPath: http://127.0.0.1:${pipIrr.file12.webPort}/file/download/down?id=
#项目编号
#projectCode:
#    ym: 100
pipIrr-platform/pipIrr-global/src/main/resources/application-global(¿ª·¢²âÊÔ---166PC»ú).yml
@@ -128,6 +128,164 @@
        webPort: 8089
        actutorPort: 9089
        idSuffix: 11
    file:
        idSuffix: 99
    file1:
        webPort: 8180
        actutorPort: 9180
    file2:
        webPort: 8181
        actutorPort: 9181
    file3:
        webPort: 8182
        actutorPort: 9182
    file4:
        webPort: 8183
        actutorPort: 9183
    file5:
        webPort: 8184
        actutorPort: 9184
    file6:
        webPort: 8185
        actutorPort: 9185
    file7:
        webPort: 8186
        actutorPort: 9186
    file8:
        webPort: 8187
        actutorPort: 9187
    file9:
        webPort: 8188
        actutorPort: 9188
    file10:
        webPort: 8189
        actutorPort: 9189
    file11:
        webPort: 8190
        actutorPort: 9190
    file12:
        webPort: 8191
        actutorPort: 9191
#web分布式文件系统
dy:
    photoZipWidth: 400 #缩略图尺寸
    webFile:
        fmUrl: http://127.0.0.1:${pipIrr.file1.webPort}/file # fm的web上下文 URL
        supportedFileTypes: docx,xlsx,doc,xls,pdf #支持的文档(非照片、录音、录像)文件类型
        sv1:
            id: dyFile1
            absolutePath: E:/java/nginx-1.24.0/html/webfiles/
            relativePath: webFile1
            hashStart: 0
            hashEnd: 5461
            restUrl: http://127.0.0.1:${pipIrr.file1.webPort}/file #file是上下文,ip为局域网ip或本地IP
            webUrl: http://127.0.0.1:${pipIrr.nginx.webPort}/webfiles/ #nginx服务路径,安装部署时IP改成外网IP或域名
            webDownloadPath: http://127.0.0.1:${pipIrr.file1.webPort}/file/download/down?id=  #安装部署时IP改成外网IP或域名
        sv2:
            id: dyFile2
            absolutePath: E:/java/nginx-1.24.0/html/webfiles/
            relativePath: webFile2
            hashStart: 5462
            hashEnd: 10923
            restUrl: http://127.0.0.1:${pipIrr.file2.webPort}/file
            webUrl: http://127.0.0.1:${pipIrr.nginx.webPort}/webfiles/
            webDownloadPath: http://127.0.0.1:${pipIrr.file2.webPort}/file/download/down?id=
        sv3:
            id: dyFile3
            absolutePath: E:/java/nginx-1.24.0/html/webfiles/
            relativePath: webFile3
            hashStart: 10924
            hashEnd: 16385
            restUrl: http://127.0.0.1:${pipIrr.file3.webPort}/file
            webUrl: http://127.0.0.1:${pipIrr.nginx.webPort}/webfiles/
            webDownloadPath: http://127.0.0.1:${pipIrr.file3.webPort}/file/download/down?id=
        sv4:
            id: dyFile4
            absolutePath: E:/java/nginx-1.24.0/html/webfiles/
            relativePath: webFile4
            hashStart: 16386
            hashEnd: 21847
            restUrl: http://127.0.0.1:${pipIrr.file4.webPort}/file
            webUrl: http://127.0.0.1:${pipIrr.nginx.webPort}/webfiles/
            webDownloadPath: http://127.0.0.1:${pipIrr.file4.webPort}/file/download/down?id=
        sv5:
            id: dyFile5
            absolutePath: E:/java/nginx-1.24.0/html/webfiles/
            relativePath: webFile5
            hashStart: 21848
            hashEnd: 27309
            restUrl: http://127.0.0.1:${pipIrr.file5.webPort}/file
            webUrl: http://127.0.0.1:${pipIrr.nginx.webPort}/webfiles/
            webDownloadPath: http://127.0.0.1:${pipIrr.file5.webPort}/file/download/down?id=
        sv6:
            id: dyFile6
            absolutePath: E:/java/nginx-1.24.0/html/webfiles/
            relativePath: webFile6
            hashStart: 27310
            hashEnd: 32767
            restUrl: http://127.0.0.1:${pipIrr.file6.webPort}/file
            webUrl: http://127.0.0.1:${pipIrr.nginx.webPort}/webfiles/
            webDownloadPath: http://127.0.0.1:${pipIrr.file6.webPort}/file/download/down?id=
        sv7:
            id: dyFile7
            absolutePath: E:/java/nginx-1.24.0/html/webfiles/
            relativePath: webFile7
            hashStart: 32768
            hashEnd: 38229
            restUrl: http://127.0.0.1:${pipIrr.file7.webPort}/file
            webUrl: http://127.0.0.1:${pipIrr.nginx.webPort}/webfiles/
            webDownloadPath: http://127.0.0.1:${pipIrr.file7.webPort}/file/download/down?id=
        sv8:
            id: dyFile8
            absolutePath: E:/java/nginx-1.24.0/html/webfiles/
            relativePath: webFile8
            hashStart: 38230
            hashEnd: 43691
            restUrl: http://127.0.0.1:${pipIrr.file8.webPort}/file
            webUrl: http://127.0.0.1:${pipIrr.nginx.webPort}/webfiles/
            webDownloadPath: http://127.0.0.1:${pipIrr.file8.webPort}/file/download/down?id=
        sv9:
            id: dyFile9
            absolutePath: E:/java/nginx-1.24.0/html/webfiles/
            relativePath: webFile9
            hashStart: 43692
            hashEnd: 49153
            restUrl: http://127.0.0.1:${pipIrr.file9.webPort}/file
            webUrl: http://127.0.0.1:${pipIrr.nginx.webPort}/webfiles/
            webDownloadPath: http://127.0.0.1:${pipIrr.file9.webPort}/file/download/down?id=
        sv10:
            id: dyFile10
            absolutePath: E:/java/nginx-1.24.0/html/webfiles/
            relativePath: webFile10
            hashStart: 49154
            hashEnd: 54615
            restUrl: http://127.0.0.1:${pipIrr.file10.webPort}/file
            webUrl: http://127.0.0.1:${pipIrr.nginx.webPort}/webfiles/
            webDownloadPath: http://127.0.0.1:${pipIrr.file10.webPort}/file/download/down?id=
        sv11:
            id: dyFile11
            absolutePath: E:/java/nginx-1.24.0/html/webfiles/
            relativePath: webFile11
            hashStart: 54616
            hashEnd: 60077
            restUrl: http://127.0.0.1:${pipIrr.file11.webPort}/file
            webUrl: http://127.0.0.1:${pipIrr.nginx.webPort}/webfiles/
            webDownloadPath: http://127.0.0.1:${pipIrr.file11.webPort}/file/download/down?id=
        sv12:
            id: dyFile12
            absolutePath: E:/java/nginx-1.24.0/html/webfiles/
            relativePath: webFile12
            hashStart: 60078
            hashEnd: 65535
            restUrl: http://127.0.0.1:${pipIrr.file12.webPort}/file
            webUrl: http://127.0.0.1:${pipIrr.nginx.webPort}/webfiles/
            webDownloadPath: http://127.0.0.1:${pipIrr.file12.webPort}/file/download/down?id=
#项目编号
#projectCode:
#    ym: 100
pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml
@@ -73,6 +73,8 @@
    global:
        dev: false  #是否开发阶段,true或false
        dsName: ym  #开发阶段,设置临时的数据库名称
    nginx:
        webPort: 54321
    mw:
        webPort: 8070
        actutorPort: 9070
@@ -128,6 +130,162 @@
        webPort: 8089
        actutorPort: 9089
        idSuffix: 11
    file:
        idSuffix: 99
    file1:
        webPort: 8180
        actutorPort: 9180
    file2:
        webPort: 8180
        actutorPort: 9180
    file3:
        webPort: 8180
        actutorPort: 9180
    file4:
        webPort: 8180
        actutorPort: 9180
    file5:
        webPort: 8180
        actutorPort: 9180
    file6:
        webPort: 8180
        actutorPort: 9180
    file7:
        webPort: 8180
        actutorPort: 9180
    file8:
        webPort: 8180
        actutorPort: 9180
    file9:
        webPort: 8180
        actutorPort: 9180
    file10:
        webPort: 8180
        actutorPort: 9180
    file11:
        webPort: 8180
        actutorPort: 9180
    file12:
        webPort: 8180
        actutorPort: 9180
#web分布式文件系统
dy:
    photoZipWidth: 400 #缩略图尺寸
    webFile:
        fmUrl: http://127.0.0.1:${pipIrr.file1.webPort}/file # fm的web上下文 URL
        supportedFileTypes: docx,xlsx,doc,xls,pdf #支持的文档(非媒体文件,如照片、录音、录像)文件类型
        sv1:
            id: dyFile1
            absolutePath: E:/java/nginx-1.24.0/html/webfiles/
            relativePath: webFile1
            hashStart: 0
            hashEnd: 5461
            restUrl: http://127.0.0.1:${pipIrr.file1.webPort}/file #file是上下文,ip为局域网ip或本地IP
            webUrl: http://127.0.0.1:${pipIrr.nginx.webPort}/webfiles/ #nginx服务路径,安装部署时IP改成外网IP或域名
            webDownloadPath: http://127.0.0.1:${pipIrr.file1.webPort}/file/download/down?id=  #安装部署时IP改成外网IP或域名
        sv2:
            id: dyFile2
            absolutePath: E:/java/nginx-1.24.0/html/webfiles/
            relativePath: webFile2
            hashStart: 5462
            hashEnd: 10923
            restUrl: http://127.0.0.1:${pipIrr.file2.webPort}/file
            webUrl: http://127.0.0.1:${pipIrr.nginx.webPort}/webfiles/
            webDownloadPath: http://127.0.0.1:${pipIrr.file2.webPort}/file/download/down?id=
        sv3:
            id: dyFile3
            absolutePath: E:/java/nginx-1.24.0/html/webfiles/
            relativePath: webFile3
            hashStart: 10924
            hashEnd: 16385
            restUrl: http://127.0.0.1:${pipIrr.file3.webPort}/file
            webUrl: http://127.0.0.1:${pipIrr.nginx.webPort}/webfiles/
            webDownloadPath: http://127.0.0.1:${pipIrr.file3.webPort}/file/download/down?id=
        sv4:
            id: dyFile4
            absolutePath: E:/java/nginx-1.24.0/html/webfiles/
            relativePath: webFile4
            hashStart: 16386
            hashEnd: 21847
            restUrl: http://127.0.0.1:${pipIrr.file4.webPort}/file
            webUrl: http://127.0.0.1:${pipIrr.nginx.webPort}/webfiles/
            webDownloadPath: http://127.0.0.1:${pipIrr.file4.webPort}/file/download/down?id=
        sv5:
            id: dyFile5
            absolutePath: E:/java/nginx-1.24.0/html/webfiles/
            relativePath: webFile5
            hashStart: 21848
            hashEnd: 27309
            restUrl: http://127.0.0.1:${pipIrr.file5.webPort}/file
            webUrl: http://127.0.0.1:${pipIrr.nginx.webPort}/webfiles/
            webDownloadPath: http://127.0.0.1:${pipIrr.file5.webPort}/file/download/down?id=
        sv6:
            id: dyFile6
            absolutePath: E:/java/nginx-1.24.0/html/webfiles/
            relativePath: webFile6
            hashStart: 27310
            hashEnd: 32767
            restUrl: http://127.0.0.1:${pipIrr.file6.webPort}/file
            webUrl: http://127.0.0.1:${pipIrr.nginx.webPort}/webfiles/
            webDownloadPath: http://127.0.0.1:${pipIrr.file6.webPort}/file/download/down?id=
        sv7:
            id: dyFile7
            absolutePath: E:/java/nginx-1.24.0/html/webfiles/
            relativePath: webFile7
            hashStart: 32768
            hashEnd: 38229
            restUrl: http://127.0.0.1:${pipIrr.file7.webPort}/file
            webUrl: http://127.0.0.1:${pipIrr.nginx.webPort}/webfiles/
            webDownloadPath: http://127.0.0.1:${pipIrr.file7.webPort}/file/download/down?id=
        sv8:
            id: dyFile8
            absolutePath: E:/java/nginx-1.24.0/html/webfiles/
            relativePath: webFile8
            hashStart: 38230
            hashEnd: 43691
            restUrl: http://127.0.0.1:${pipIrr.file8.webPort}/file
            webUrl: http://127.0.0.1:${pipIrr.nginx.webPort}/webfiles/
            webDownloadPath: http://127.0.0.1:${pipIrr.file8.webPort}/file/download/down?id=
        sv9:
            id: dyFile9
            absolutePath: E:/java/nginx-1.24.0/html/webfiles/
            relativePath: webFile9
            hashStart: 43692
            hashEnd: 49153
            restUrl: http://127.0.0.1:${pipIrr.file9.webPort}/file
            webUrl: http://127.0.0.1:${pipIrr.nginx.webPort}/webfiles/
            webDownloadPath: http://127.0.0.1:${pipIrr.file9.webPort}/file/download/down?id=
        sv10:
            id: dyFile10
            absolutePath: E:/java/nginx-1.24.0/html/webfiles/
            relativePath: webFile10
            hashStart: 49154
            hashEnd: 54615
            restUrl: http://127.0.0.1:${pipIrr.file10.webPort}/file
            webUrl: http://127.0.0.1:${pipIrr.nginx.webPort}/webfiles/
            webDownloadPath: http://127.0.0.1:${pipIrr.file10.webPort}/file/download/down?id=
        sv11:
            id: dyFile11
            absolutePath: E:/java/nginx-1.24.0/html/webfiles/
            relativePath: webFile11
            hashStart: 54616
            hashEnd: 60077
            restUrl: http://127.0.0.1:${pipIrr.file11.webPort}/file
            webUrl: http://127.0.0.1:${pipIrr.nginx.webPort}/webfiles/
            webDownloadPath: http://127.0.0.1:${pipIrr.file11.webPort}/file/download/down?id=
        sv12:
            id: dyFile12
            absolutePath: E:/java/nginx-1.24.0/html/webfiles/
            relativePath: webFile12
            hashStart: 60078
            hashEnd: 65535
            restUrl: http://127.0.0.1:${pipIrr.file12.webPort}/file
            webUrl: http://127.0.0.1:${pipIrr.nginx.webPort}/webfiles/
            webDownloadPath: http://127.0.0.1:${pipIrr.file12.webPort}/file/download/down?id=
#项目编号
#projectCode:
#    ym: 100
pipIrr-platform/pipIrr-global/src/main/resources/mapper/WebFileMapper.xml
New file
@@ -0,0 +1,126 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.dy.pipIrrGlobal.daoFi.WebFileMapper">
  <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoFi.WebFile">
    <!--@mbg.generated-->
    <!--@Table web_file-->
    <id column="id" property="id" />
    <result column="org_name" property="orgName" />
    <result column="ext_name" property="extName" />
    <result column="new_name" property="newName" />
    <result column="hash" property="hash" />
    <result column="file_path" property="filePath" />
    <result column="dt" property="dt" />
  </resultMap>
  <sql id="Base_Column_List">
    <!--@mbg.generated-->
    id, org_name, ext_name, new_name, hash, file_path, dt
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
    <!--@mbg.generated-->
    select
    <include refid="Base_Column_List" />
    from web_file
    where id = #{id}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    <!--@mbg.generated-->
    delete from web_file
    where id = #{id}
  </delete>
  <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoFi.WebFile">
    <!--@mbg.generated-->
    insert into web_file (id, org_name, ext_name, new_name, hash, file_path,
      dt)
    values (#{id}, #{orgName}, #{extName}, #{newName}, #{hash}, #{filePath},
      #{dt})
  </insert>
  <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoFi.WebFile">
    <!--@mbg.generated-->
    insert into web_file
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="orgName!= null and orgName !=''">
        org_name,
      </if>
      <if test="extName!= null and extName !=''">
        ext_name,
      </if>
      <if test="newName!= null and newName !=''">
        new_name,
      </if>
      <if test="hash!= null">
        hash,
      </if>
      <if test="filePath!= null and filePath !=''">
        file_path,
      </if>
      <if test="dt != null">
        dt,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id},
      </if>
      <if test="orgName!= null and orgName !=''">
        #{orgName},
      </if>
      <if test="extName!= null and extName !=''">
        #{extName},
      </if>
      <if test="newName!= null and newName !=''">
        #{newName},
      </if>
      <if test="hash!= null">
        #{hash},
      </if>
      <if test="filePath!= null and filePath !=''">
        #{filePath},
      </if>
      <if test="dt != null">
        #{dt},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoFi.WebFile">
    <!--@mbg.generated-->
    update web_file
    <set>
      <if test="orgName!= null and orgName !=''">
        org_name = #{orgName},
      </if>
      <if test="extName!= null and extName !=''">
        ext_name = #{extName},
      </if>
      <if test="newName!= null and newName !=''">
        new_name = #{newName},
      </if>
      <if test="hash!= null">
        hash = #{hash},
      </if>
      <if test="filePath!= null and filePath !=''">
        file_path = #{filePath},
      </if>
      <if test="dt != null">
        dt = #{dt},
      </if>
    </set>
    where id = #{id}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoFi.WebFile">
    <!--@mbg.generated-->
    update web_file
    set org_name = #{orgName},
      ext_name = #{extName},
      new_name = #{newName},
      hash = #{hash},
      file_path = #{filePath},
      dt = #{dt}
    where id = #{id}
  </update>
</mapper>
pipIrr-platform/pipIrr-web/pipIrr-web-file/.gitattributes
New file
@@ -0,0 +1,2 @@
/mvnw text eol=lf
*.cmd text eol=crlf
pipIrr-platform/pipIrr-web/pipIrr-web-file/.gitignore
New file
@@ -0,0 +1,34 @@
HELP.md
target/
/pipIrr-web-file.iml
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/
### VS Code ###
.vscode/
pipIrr-platform/pipIrr-web/pipIrr-web-file/.mvn/wrapper/maven-wrapper.properties
New file
@@ -0,0 +1,20 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you 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.
wrapperVersion=3.3.2
distributionType=only-script
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip
distributionSha256Sum=4ec3f26fb1a692473aea0235c300bd20f0f9fe741947c82c1234cefd76ac3a3c
pipIrr-platform/pipIrr-web/pipIrr-web-file/mvnw
New file
@@ -0,0 +1,259 @@
#!/bin/sh
# ----------------------------------------------------------------------------
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you 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.
# ----------------------------------------------------------------------------
# ----------------------------------------------------------------------------
# Apache Maven Wrapper startup batch script, version 3.3.2
#
# Optional ENV vars
# -----------------
#   JAVA_HOME - location of a JDK home dir, required when download maven via java source
#   MVNW_REPOURL - repo url base for downloading maven distribution
#   MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven
#   MVNW_VERBOSE - true: enable verbose log; debug: trace the mvnw script; others: silence the output
# ----------------------------------------------------------------------------
set -euf
[ "${MVNW_VERBOSE-}" != debug ] || set -x
# OS specific support.
native_path() { printf %s\\n "$1"; }
case "$(uname)" in
CYGWIN* | MINGW*)
  [ -z "${JAVA_HOME-}" ] || JAVA_HOME="$(cygpath --unix "$JAVA_HOME")"
  native_path() { cygpath --path --windows "$1"; }
  ;;
esac
# set JAVACMD and JAVACCMD
set_java_home() {
  # For Cygwin and MinGW, ensure paths are in Unix format before anything is touched
  if [ -n "${JAVA_HOME-}" ]; then
    if [ -x "$JAVA_HOME/jre/sh/java" ]; then
      # IBM's JDK on AIX uses strange locations for the executables
      JAVACMD="$JAVA_HOME/jre/sh/java"
      JAVACCMD="$JAVA_HOME/jre/sh/javac"
    else
      JAVACMD="$JAVA_HOME/bin/java"
      JAVACCMD="$JAVA_HOME/bin/javac"
      if [ ! -x "$JAVACMD" ] || [ ! -x "$JAVACCMD" ]; then
        echo "The JAVA_HOME environment variable is not defined correctly, so mvnw cannot run." >&2
        echo "JAVA_HOME is set to \"$JAVA_HOME\", but \"\$JAVA_HOME/bin/java\" or \"\$JAVA_HOME/bin/javac\" does not exist." >&2
        return 1
      fi
    fi
  else
    JAVACMD="$(
      'set' +e
      'unset' -f command 2>/dev/null
      'command' -v java
    )" || :
    JAVACCMD="$(
      'set' +e
      'unset' -f command 2>/dev/null
      'command' -v javac
    )" || :
    if [ ! -x "${JAVACMD-}" ] || [ ! -x "${JAVACCMD-}" ]; then
      echo "The java/javac command does not exist in PATH nor is JAVA_HOME set, so mvnw cannot run." >&2
      return 1
    fi
  fi
}
# hash string like Java String::hashCode
hash_string() {
  str="${1:-}" h=0
  while [ -n "$str" ]; do
    char="${str%"${str#?}"}"
    h=$(((h * 31 + $(LC_CTYPE=C printf %d "'$char")) % 4294967296))
    str="${str#?}"
  done
  printf %x\\n $h
}
verbose() { :; }
[ "${MVNW_VERBOSE-}" != true ] || verbose() { printf %s\\n "${1-}"; }
die() {
  printf %s\\n "$1" >&2
  exit 1
}
trim() {
  # MWRAPPER-139:
  #   Trims trailing and leading whitespace, carriage returns, tabs, and linefeeds.
  #   Needed for removing poorly interpreted newline sequences when running in more
  #   exotic environments such as mingw bash on Windows.
  printf "%s" "${1}" | tr -d '[:space:]'
}
# parse distributionUrl and optional distributionSha256Sum, requires .mvn/wrapper/maven-wrapper.properties
while IFS="=" read -r key value; do
  case "${key-}" in
  distributionUrl) distributionUrl=$(trim "${value-}") ;;
  distributionSha256Sum) distributionSha256Sum=$(trim "${value-}") ;;
  esac
done <"${0%/*}/.mvn/wrapper/maven-wrapper.properties"
[ -n "${distributionUrl-}" ] || die "cannot read distributionUrl property in ${0%/*}/.mvn/wrapper/maven-wrapper.properties"
case "${distributionUrl##*/}" in
maven-mvnd-*bin.*)
  MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/
  case "${PROCESSOR_ARCHITECTURE-}${PROCESSOR_ARCHITEW6432-}:$(uname -a)" in
  *AMD64:CYGWIN* | *AMD64:MINGW*) distributionPlatform=windows-amd64 ;;
  :Darwin*x86_64) distributionPlatform=darwin-amd64 ;;
  :Darwin*arm64) distributionPlatform=darwin-aarch64 ;;
  :Linux*x86_64*) distributionPlatform=linux-amd64 ;;
  *)
    echo "Cannot detect native platform for mvnd on $(uname)-$(uname -m), use pure java version" >&2
    distributionPlatform=linux-amd64
    ;;
  esac
  distributionUrl="${distributionUrl%-bin.*}-$distributionPlatform.zip"
  ;;
maven-mvnd-*) MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ ;;
*) MVN_CMD="mvn${0##*/mvnw}" _MVNW_REPO_PATTERN=/org/apache/maven/ ;;
esac
# apply MVNW_REPOURL and calculate MAVEN_HOME
# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-<version>,maven-mvnd-<version>-<platform>}/<hash>
[ -z "${MVNW_REPOURL-}" ] || distributionUrl="$MVNW_REPOURL$_MVNW_REPO_PATTERN${distributionUrl#*"$_MVNW_REPO_PATTERN"}"
distributionUrlName="${distributionUrl##*/}"
distributionUrlNameMain="${distributionUrlName%.*}"
distributionUrlNameMain="${distributionUrlNameMain%-bin}"
MAVEN_USER_HOME="${MAVEN_USER_HOME:-${HOME}/.m2}"
MAVEN_HOME="${MAVEN_USER_HOME}/wrapper/dists/${distributionUrlNameMain-}/$(hash_string "$distributionUrl")"
exec_maven() {
  unset MVNW_VERBOSE MVNW_USERNAME MVNW_PASSWORD MVNW_REPOURL || :
  exec "$MAVEN_HOME/bin/$MVN_CMD" "$@" || die "cannot exec $MAVEN_HOME/bin/$MVN_CMD"
}
if [ -d "$MAVEN_HOME" ]; then
  verbose "found existing MAVEN_HOME at $MAVEN_HOME"
  exec_maven "$@"
fi
case "${distributionUrl-}" in
*?-bin.zip | *?maven-mvnd-?*-?*.zip) ;;
*) die "distributionUrl is not valid, must match *-bin.zip or maven-mvnd-*.zip, but found '${distributionUrl-}'" ;;
esac
# prepare tmp dir
if TMP_DOWNLOAD_DIR="$(mktemp -d)" && [ -d "$TMP_DOWNLOAD_DIR" ]; then
  clean() { rm -rf -- "$TMP_DOWNLOAD_DIR"; }
  trap clean HUP INT TERM EXIT
else
  die "cannot create temp dir"
fi
mkdir -p -- "${MAVEN_HOME%/*}"
# Download and Install Apache Maven
verbose "Couldn't find MAVEN_HOME, downloading and installing it ..."
verbose "Downloading from: $distributionUrl"
verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName"
# select .zip or .tar.gz
if ! command -v unzip >/dev/null; then
  distributionUrl="${distributionUrl%.zip}.tar.gz"
  distributionUrlName="${distributionUrl##*/}"
fi
# verbose opt
__MVNW_QUIET_WGET=--quiet __MVNW_QUIET_CURL=--silent __MVNW_QUIET_UNZIP=-q __MVNW_QUIET_TAR=''
[ "${MVNW_VERBOSE-}" != true ] || __MVNW_QUIET_WGET='' __MVNW_QUIET_CURL='' __MVNW_QUIET_UNZIP='' __MVNW_QUIET_TAR=v
# normalize http auth
case "${MVNW_PASSWORD:+has-password}" in
'') MVNW_USERNAME='' MVNW_PASSWORD='' ;;
has-password) [ -n "${MVNW_USERNAME-}" ] || MVNW_USERNAME='' MVNW_PASSWORD='' ;;
esac
if [ -z "${MVNW_USERNAME-}" ] && command -v wget >/dev/null; then
  verbose "Found wget ... using wget"
  wget ${__MVNW_QUIET_WGET:+"$__MVNW_QUIET_WGET"} "$distributionUrl" -O "$TMP_DOWNLOAD_DIR/$distributionUrlName" || die "wget: Failed to fetch $distributionUrl"
elif [ -z "${MVNW_USERNAME-}" ] && command -v curl >/dev/null; then
  verbose "Found curl ... using curl"
  curl ${__MVNW_QUIET_CURL:+"$__MVNW_QUIET_CURL"} -f -L -o "$TMP_DOWNLOAD_DIR/$distributionUrlName" "$distributionUrl" || die "curl: Failed to fetch $distributionUrl"
elif set_java_home; then
  verbose "Falling back to use Java to download"
  javaSource="$TMP_DOWNLOAD_DIR/Downloader.java"
  targetZip="$TMP_DOWNLOAD_DIR/$distributionUrlName"
  cat >"$javaSource" <<-END
    public class Downloader extends java.net.Authenticator
    {
      protected java.net.PasswordAuthentication getPasswordAuthentication()
      {
        return new java.net.PasswordAuthentication( System.getenv( "MVNW_USERNAME" ), System.getenv( "MVNW_PASSWORD" ).toCharArray() );
      }
      public static void main( String[] args ) throws Exception
      {
        setDefault( new Downloader() );
        java.nio.file.Files.copy( java.net.URI.create( args[0] ).toURL().openStream(), java.nio.file.Paths.get( args[1] ).toAbsolutePath().normalize() );
      }
    }
    END
  # For Cygwin/MinGW, switch paths to Windows format before running javac and java
  verbose " - Compiling Downloader.java ..."
  "$(native_path "$JAVACCMD")" "$(native_path "$javaSource")" || die "Failed to compile Downloader.java"
  verbose " - Running Downloader.java ..."
  "$(native_path "$JAVACMD")" -cp "$(native_path "$TMP_DOWNLOAD_DIR")" Downloader "$distributionUrl" "$(native_path "$targetZip")"
fi
# If specified, validate the SHA-256 sum of the Maven distribution zip file
if [ -n "${distributionSha256Sum-}" ]; then
  distributionSha256Result=false
  if [ "$MVN_CMD" = mvnd.sh ]; then
    echo "Checksum validation is not supported for maven-mvnd." >&2
    echo "Please disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2
    exit 1
  elif command -v sha256sum >/dev/null; then
    if echo "$distributionSha256Sum  $TMP_DOWNLOAD_DIR/$distributionUrlName" | sha256sum -c >/dev/null 2>&1; then
      distributionSha256Result=true
    fi
  elif command -v shasum >/dev/null; then
    if echo "$distributionSha256Sum  $TMP_DOWNLOAD_DIR/$distributionUrlName" | shasum -a 256 -c >/dev/null 2>&1; then
      distributionSha256Result=true
    fi
  else
    echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2
    echo "Please install either command, or disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2
    exit 1
  fi
  if [ $distributionSha256Result = false ]; then
    echo "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised." >&2
    echo "If you updated your Maven version, you need to update the specified distributionSha256Sum property." >&2
    exit 1
  fi
fi
# unzip and move
if command -v unzip >/dev/null; then
  unzip ${__MVNW_QUIET_UNZIP:+"$__MVNW_QUIET_UNZIP"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -d "$TMP_DOWNLOAD_DIR" || die "failed to unzip"
else
  tar xzf${__MVNW_QUIET_TAR:+"$__MVNW_QUIET_TAR"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -C "$TMP_DOWNLOAD_DIR" || die "failed to untar"
fi
printf %s\\n "$distributionUrl" >"$TMP_DOWNLOAD_DIR/$distributionUrlNameMain/mvnw.url"
mv -- "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" "$MAVEN_HOME" || [ -d "$MAVEN_HOME" ] || die "fail to move MAVEN_HOME"
clean || :
exec_maven "$@"
pipIrr-platform/pipIrr-web/pipIrr-web-file/mvnw.cmd
New file
@@ -0,0 +1,149 @@
<# : batch portion
@REM ----------------------------------------------------------------------------
@REM Licensed to the Apache Software Foundation (ASF) under one
@REM or more contributor license agreements.  See the NOTICE file
@REM distributed with this work for additional information
@REM regarding copyright ownership.  The ASF licenses this file
@REM to you under the Apache License, Version 2.0 (the
@REM "License"); you may not use this file except in compliance
@REM with the License.  You may obtain a copy of the License at
@REM
@REM    http://www.apache.org/licenses/LICENSE-2.0
@REM
@REM Unless required by applicable law or agreed to in writing,
@REM software distributed under the License is distributed on an
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@REM KIND, either express or implied.  See the License for the
@REM specific language governing permissions and limitations
@REM under the License.
@REM ----------------------------------------------------------------------------
@REM ----------------------------------------------------------------------------
@REM Apache Maven Wrapper startup batch script, version 3.3.2
@REM
@REM Optional ENV vars
@REM   MVNW_REPOURL - repo url base for downloading maven distribution
@REM   MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven
@REM   MVNW_VERBOSE - true: enable verbose log; others: silence the output
@REM ----------------------------------------------------------------------------
@IF "%__MVNW_ARG0_NAME__%"=="" (SET __MVNW_ARG0_NAME__=%~nx0)
@SET __MVNW_CMD__=
@SET __MVNW_ERROR__=
@SET __MVNW_PSMODULEP_SAVE=%PSModulePath%
@SET PSModulePath=
@FOR /F "usebackq tokens=1* delims==" %%A IN (`powershell -noprofile "& {$scriptDir='%~dp0'; $script='%__MVNW_ARG0_NAME__%'; icm -ScriptBlock ([Scriptblock]::Create((Get-Content -Raw '%~f0'))) -NoNewScope}"`) DO @(
  IF "%%A"=="MVN_CMD" (set __MVNW_CMD__=%%B) ELSE IF "%%B"=="" (echo %%A) ELSE (echo %%A=%%B)
)
@SET PSModulePath=%__MVNW_PSMODULEP_SAVE%
@SET __MVNW_PSMODULEP_SAVE=
@SET __MVNW_ARG0_NAME__=
@SET MVNW_USERNAME=
@SET MVNW_PASSWORD=
@IF NOT "%__MVNW_CMD__%"=="" (%__MVNW_CMD__% %*)
@echo Cannot start maven from wrapper >&2 && exit /b 1
@GOTO :EOF
: end batch / begin powershell #>
$ErrorActionPreference = "Stop"
if ($env:MVNW_VERBOSE -eq "true") {
  $VerbosePreference = "Continue"
}
# calculate distributionUrl, requires .mvn/wrapper/maven-wrapper.properties
$distributionUrl = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionUrl
if (!$distributionUrl) {
  Write-Error "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties"
}
switch -wildcard -casesensitive ( $($distributionUrl -replace '^.*/','') ) {
  "maven-mvnd-*" {
    $USE_MVND = $true
    $distributionUrl = $distributionUrl -replace '-bin\.[^.]*$',"-windows-amd64.zip"
    $MVN_CMD = "mvnd.cmd"
    break
  }
  default {
    $USE_MVND = $false
    $MVN_CMD = $script -replace '^mvnw','mvn'
    break
  }
}
# apply MVNW_REPOURL and calculate MAVEN_HOME
# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-<version>,maven-mvnd-<version>-<platform>}/<hash>
if ($env:MVNW_REPOURL) {
  $MVNW_REPO_PATTERN = if ($USE_MVND) { "/org/apache/maven/" } else { "/maven/mvnd/" }
  $distributionUrl = "$env:MVNW_REPOURL$MVNW_REPO_PATTERN$($distributionUrl -replace '^.*'+$MVNW_REPO_PATTERN,'')"
}
$distributionUrlName = $distributionUrl -replace '^.*/',''
$distributionUrlNameMain = $distributionUrlName -replace '\.[^.]*$','' -replace '-bin$',''
$MAVEN_HOME_PARENT = "$HOME/.m2/wrapper/dists/$distributionUrlNameMain"
if ($env:MAVEN_USER_HOME) {
  $MAVEN_HOME_PARENT = "$env:MAVEN_USER_HOME/wrapper/dists/$distributionUrlNameMain"
}
$MAVEN_HOME_NAME = ([System.Security.Cryptography.MD5]::Create().ComputeHash([byte[]][char[]]$distributionUrl) | ForEach-Object {$_.ToString("x2")}) -join ''
$MAVEN_HOME = "$MAVEN_HOME_PARENT/$MAVEN_HOME_NAME"
if (Test-Path -Path "$MAVEN_HOME" -PathType Container) {
  Write-Verbose "found existing MAVEN_HOME at $MAVEN_HOME"
  Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD"
  exit $?
}
if (! $distributionUrlNameMain -or ($distributionUrlName -eq $distributionUrlNameMain)) {
  Write-Error "distributionUrl is not valid, must end with *-bin.zip, but found $distributionUrl"
}
# prepare tmp dir
$TMP_DOWNLOAD_DIR_HOLDER = New-TemporaryFile
$TMP_DOWNLOAD_DIR = New-Item -Itemtype Directory -Path "$TMP_DOWNLOAD_DIR_HOLDER.dir"
$TMP_DOWNLOAD_DIR_HOLDER.Delete() | Out-Null
trap {
  if ($TMP_DOWNLOAD_DIR.Exists) {
    try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null }
    catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" }
  }
}
New-Item -Itemtype Directory -Path "$MAVEN_HOME_PARENT" -Force | Out-Null
# Download and Install Apache Maven
Write-Verbose "Couldn't find MAVEN_HOME, downloading and installing it ..."
Write-Verbose "Downloading from: $distributionUrl"
Write-Verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName"
$webclient = New-Object System.Net.WebClient
if ($env:MVNW_USERNAME -and $env:MVNW_PASSWORD) {
  $webclient.Credentials = New-Object System.Net.NetworkCredential($env:MVNW_USERNAME, $env:MVNW_PASSWORD)
}
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$webclient.DownloadFile($distributionUrl, "$TMP_DOWNLOAD_DIR/$distributionUrlName") | Out-Null
# If specified, validate the SHA-256 sum of the Maven distribution zip file
$distributionSha256Sum = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionSha256Sum
if ($distributionSha256Sum) {
  if ($USE_MVND) {
    Write-Error "Checksum validation is not supported for maven-mvnd. `nPlease disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties."
  }
  Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash
  if ((Get-FileHash "$TMP_DOWNLOAD_DIR/$distributionUrlName" -Algorithm SHA256).Hash.ToLower() -ne $distributionSha256Sum) {
    Write-Error "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised. If you updated your Maven version, you need to update the specified distributionSha256Sum property."
  }
}
# unzip and move
Expand-Archive "$TMP_DOWNLOAD_DIR/$distributionUrlName" -DestinationPath "$TMP_DOWNLOAD_DIR" | Out-Null
Rename-Item -Path "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" -NewName $MAVEN_HOME_NAME | Out-Null
try {
  Move-Item -Path "$TMP_DOWNLOAD_DIR/$MAVEN_HOME_NAME" -Destination $MAVEN_HOME_PARENT | Out-Null
} catch {
  if (! (Test-Path -Path "$MAVEN_HOME" -PathType Container)) {
    Write-Error "fail to move MAVEN_HOME"
  }
} finally {
  try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null }
  catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" }
}
Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD"
pipIrr-platform/pipIrr-web/pipIrr-web-file/pom.xml
New file
@@ -0,0 +1,142 @@
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <artifactId>pipIrr-web</artifactId>
        <groupId>com.dy</groupId>
        <version>1.0.0</version>
        <relativePath>../pom.xml</relativePath>
    </parent>
    <packaging>jar</packaging>
    <artifactId>pipIrr-web-file</artifactId>
    <name>pipIrr-web-file</name>
    <description>web网络文件系统</description>
    <dependencies>
    </dependencies>
    <build>
        <plugins>
            <!-- ç”Ÿæˆä¸åŒ…含依赖jar的可执行jar包
            <plugin>
                !- spring boot提供的maven打包插件 -
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <executions>
                    <execution>
                        !-
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                        -
                        <configuration>
                            !- ä¸åŠ çš„è¯æœ€ç»ˆåŒ…åä¸º: ${artifactId}-${version}.jar, åŠ äº†çš„è¯æœ€ç»ˆåŒ…å: ${artifactId}-${version}-${classifier}.jar  -
                            <classifier>execute</classifier>
                            !- ä¸æŒ‡å®šç”Ÿæˆè·¯å¾„的话, é»˜è®¤ä¿å­˜åœ¨ ${build.directory} ä¸‹ -
                            <outputDirectory>${project.build.directory}/execute</outputDirectory>
                            <finalName>${artifactId}-${version}</finalName>
                            <layout>ZIP</layout>
                            <mainClass>com.dy.pipIrrBase.PipIrrBaseApplication</mainClass>
                            <includes>
                                <include>
                                    <groupId>com.dy</groupId>
                                    <artifactId>pipIrr-common</artifactId>
                                </include>
                                <include>
                                    <groupId>com.dy</groupId>
                                    <artifactId>pipIrr-global</artifactId>
                                </include>
                            </includes>
                            <excludes>
                                <exclude>
                                    <groupId>org.projectlombok</groupId>
                                    <artifactId>lombok</artifactId>
                                </exclude>
                            </excludes>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            -->
            <!-- æ‹·è´ä¾èµ–çš„jar包到lib目录-->
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <configuration>
                            <!-- ä¸åŠ çš„è¯æœ€ç»ˆåŒ…åä¸º: ${artifactId}-${version}.jar, åŠ äº†çš„è¯æœ€ç»ˆåŒ…å: ${artifactId}-${version}-${classifier}.jar
                            <classifier>execute</classifier>
                            -->
                            <!-- ${project.build.directory}是maven变量,内置的,表示target目录,如果不写,将在根目录下创建/lib -->
                            <outputDirectory>${project.build.directory}/lib</outputDirectory>
                            <!-- excludeTransitive:是否不包含间接依赖包,比如我们依赖A,但是A又依赖了B,我们是否也要把B打进去 é»˜è®¤ä¸æ‰“-->
                            <excludeTransitive>false</excludeTransitive>
                            <!-- å¤åˆ¶çš„jar文件去掉版本信息 -->
                            <stripVersion>false</stripVersion>
                            <finalName>${project.artifactId}-${project.version}</finalName>
                            <layout>ZIP</layout>
                            <mainClass>com.dy.pipIrrBase.PipIrrBaseApplication</mainClass>
                            <includes>
                                <include>
                                    <groupId>com.dy</groupId>
                                    <artifactId>pipIrr-common</artifactId>
                                </include>
                                <include>
                                    <groupId>com.dy</groupId>
                                    <artifactId>pipIrr-global</artifactId>
                                </include>
                            </includes>
                            <excludes>
                                <exclude>
                                    <groupId>org.projectlombok</groupId>
                                    <artifactId>lombok</artifactId>
                                </exclude>
                            </excludes>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <!-- è®¾ç½®java编译版本,运行环境版本 -->
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <!-- source: æºä»£ç ç¼–译版本;target: ç›®æ ‡å¹³å°ç¼–译版本;encoding: å­—符集编码。 -->
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                    <encoding>${encoding}</encoding>
                </configuration>
            </plugin>
            <plugin>
                <!-- è§£å†³èµ„源文件的编码问题 -->
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <configuration>
                    <encoding>${encoding}</encoding>
                </configuration>
            </plugin>
            <plugin>
                <!-- maven里执行测试用例的插件 -->
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <skipTests>true</skipTests>
                </configuration>
            </plugin>
            <plugin>
                <!-- ä¸‹é¢è§£å†³ï¼šå½“进行Maven Lifecycle package时报错:Could not find artifact org.apache.mina:mina-core:bundle:2.2.1 in maven (https://repo1.maven.org/maven2/)-->
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <extensions>true</extensions>
            </plugin>
        </plugins>
    </build>
</project>
pipIrr-platform/pipIrr-web/pipIrr-web-file/src/main/java/com/dy/pipIrrWebFile/PipIrrWebFileApplication.java
New file
@@ -0,0 +1,29 @@
package com.dy.pipIrrWebFile;
import com.dy.common.multiDataSource.EnableMultiDataSource;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.context.annotation.FilterType;
@SpringBootApplication
@EnableAspectJAutoProxy
@EnableMultiDataSource
@ComponentScan(basePackages = {"com.dy.common", "com.dy.pipIrrGlobal", "com.dy.pipIrrWebFile"},
        excludeFilters = {
                @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, classes = {
                        com.dy.common.singleDataSource.DruidDataSourceConfig.class //排除单数据源
                })
        }
)
@MapperScan(basePackages={"com.dy.pipIrrGlobal.daoFi"})
public class PipIrrWebFileApplication {
    public static void main(String[] args) {
        SpringApplication.run(PipIrrWebFileApplication.class, args);
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-file/src/main/java/com/dy/pipIrrWebFile/download/DownloadFileCtrl.java
New file
@@ -0,0 +1,109 @@
package com.dy.pipIrrWebFile.download;
import com.dy.pipIrrGlobal.dyFile.FileOperate;
import com.dy.pipIrrGlobal.dyFile.FileRestVo;
import com.dy.pipIrrGlobal.pojoFi.WebFile;
import jakarta.servlet.ServletOutputStream;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.io.File;
import java.io.FileInputStream;
import java.net.URLEncoder;
/**
 * web文件下载
 */
@Slf4j
@RestController
@RequestMapping(path="download")
@SuppressWarnings("unchecked")//java版本越高,对泛型约束越严,所以配置SuppressWarnings("unchecked")
public class DownloadFileCtrl {
    @Autowired
    private DownloadFileSv sv ;
    @Autowired
    private FileOperate fileOp ;
    @Value("${dy.webFile.fmUrl}")
    private String fmUrl ;
    /**
     * é€šè¿‡web文件数据库实体id下载该文件
     * @param id
     * @return
     */
    @GetMapping("/down")
    public void down(String id, HttpServletRequest req, HttpServletResponse rep){
        try{
            WebFile fPo = sv.selectById(id) ;
            if(fPo != null){
                FileRestVo frVo = fileOp.parseHashcode(fmUrl, fPo.hash) ;
                if(frVo.fileSysAbsolutePath != null){
                    if(!frVo.fileSysAbsolutePath.endsWith("\\\\") && !frVo.fileSysAbsolutePath.endsWith("/") ){
                        frVo.fileSysAbsolutePath = frVo.fileSysAbsolutePath + "/" ;
                    }
                }
                String filePath = frVo.fileSysAbsolutePath + fPo.filePath ;
                File f = new File(filePath) ;
                if(f.exists()){
                    String fileReName = fPo.orgName + "." + fPo.extName ;
                    //URLEncoder.encode可以防止中文乱码
                    fileReName = URLEncoder.encode(fileReName, "UTF-8").replaceAll("\\+", "%20");
                    rep.addHeader("content-type", "application/octet-stream");
                    rep.addHeader("Content-Disposition", "attachment;fileName=" + fileReName);
                    ServletOutputStream out = null;
                    FileInputStream in = null ;
                    try {
                        out = rep.getOutputStream() ;
                    } catch (Exception ee) {
                        out = null ;
                    }finally{
                        if(out != null){
                            byte[] bs = new byte[1024] ;
                            int len = -1 ;
                            try {
                                in = new FileInputStream(f);
                                len = in.read(bs) ;
                                while(len != -1){
                                    out.write(bs, 0, len);
                                    len = in.read(bs) ;
                                }
                            } catch (Exception eee) {
                            } finally {
                                if(out != null){
                                    try{
                                        out.flush();
                                        out.close();
                                    }catch(Exception e){
                                    }finally{
                                        if(in != null){
                                            try{
                                                in.close();
                                            }catch(Exception e){
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }else{
                }
            }else{
            }
        }catch (Exception e){
            log.error("下载文件时异常", e);
        }
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-file/src/main/java/com/dy/pipIrrWebFile/download/DownloadFileSv.java
New file
@@ -0,0 +1,30 @@
package com.dy.pipIrrWebFile.download;
import com.dy.common.util.NumUtil;
import com.dy.pipIrrGlobal.daoFi.WebFileMapper;
import com.dy.pipIrrGlobal.pojoFi.WebFile;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Slf4j
@Service
public class DownloadFileSv {
    @Autowired
    private WebFileMapper dao;
    /**
     * ç”¨ID查询
     * @param id
     * @return
     */
    public WebFile selectById(String id){
        if(NumUtil.isPlusIntNumber(id)){
            return dao.selectByPrimaryKey(Long.parseLong(id)) ;
        }else{
            return null ;
        }
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-file/src/main/java/com/dy/pipIrrWebFile/files/FileCtrl.java
New file
@@ -0,0 +1,202 @@
package com.dy.pipIrrWebFile.files;
import com.dy.common.util.NumUtil;
import com.dy.pipIrrWebFile.util.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.InputStream;
/**
 * web文件上传, å†…部调用,即由其他子模块调用,
 * ä¸€èˆ¬ä¸ç”±å‰ç«¯ç³»ç»Ÿè°ƒç”¨
 */
@Slf4j
@RestController
@RequestMapping(path="file")
@SuppressWarnings("unchecked")//java版本越高,对泛型约束越严,所以配置SuppressWarnings("unchecked")
public class FileCtrl {
    @Value("${dy.photoZipWidth}")
    private String photoZipWidthStr ;
    /**
     * web分布式文件系统保存照片文件
     * @param file
     * @param regionNum
     * @param json æ°´å°ä¿¡æ¯
     * @param absolutePath
     * @param relativePath
     * @param fileName
     * @return
     */
    @PostMapping("/savePhoto")
    public String savePhoto(MultipartFile file,
                          String regionNum,
                          String json,
                          String absolutePath,
                          String relativePath,
                          String fileName) {
        Integer photoZipWidth = 400 ;
        if(photoZipWidthStr != null && NumUtil.isPlusIntNumber(photoZipWidthStr)){
            photoZipWidth = Integer.parseInt(photoZipWidthStr) ;
        }
        String fileRelativePath = null ;
        try {
            if (file != null) {
                if(absolutePath != null && relativePath != null && fileName != null){
                    InputStream input = file.getInputStream() ;
                    //生成新文件相对路径
                    FilePhotoUtil fUtil = new FilePhotoUtil() ;
                    fileRelativePath = fUtil.newFileRelativityPath(absolutePath, relativePath, regionNum) + fileName ;
                    String filePath = absolutePath + fileRelativePath ;
                    if(!fUtil.saveFile(filePath, input)){
                        fileRelativePath = null ;
                    }else {
                        //存储成功
                        File fPic = new File(filePath) ;
                        //生成缩略图
                        int index = filePath.lastIndexOf(".") ;
                        String zipFilePath1 = filePath.substring(0, index) ;
                        String zipFilePath2 = filePath.substring(index) ;
                        String zipFilePath = zipFilePath1 + "_" + zipFilePath2 ;
                        InputStream zipFileInput = null ;
                        if(zipFilePath2.equalsIgnoreCase(".png")){
                            zipFileInput = ZipImg.zipToPng(fPic, photoZipWidth, photoZipWidth) ;
                        }else{
                            zipFileInput = ZipImg.zipToJpg(fPic, photoZipWidth, photoZipWidth) ;
                        }
                        if(zipFileInput.available() > 0){
                            new FileUtil().saveFile(zipFilePath, zipFileInput) ;
                        }else{
                            //如果压缩文件不存在或生成失败,则复制源文件
                            new FileUtil().saveFile(zipFilePath, file.getInputStream()) ;
                        }
                    }
                }
            }
        } catch (Exception e) {
            log.error("保存照片文件异常", e);
        }
        return fileRelativePath ;
    }
    /**
     * web分布式文件系统保存录音音频文件
     * @param file
     * @param regionNum
     * @param json æ°´å°ä¿¡æ¯
     * @param absolutePath
     * @param relativePath
     * @param fileName
     * @return
     */
    @PostMapping("/savePhone")
    public String savePhone(MultipartFile file,
                            String regionNum,
                            String json,
                            String absolutePath,
                            String relativePath,
                            String fileName) {
        String fileRelativePath = null ;
        try {
            if (file != null) {
                if(absolutePath != null && relativePath != null && fileName != null){
                    InputStream input = file.getInputStream() ;
                    //生成新文件相对路径
                    FilePhoneUtil fUtil = new FilePhoneUtil() ;
                    fileRelativePath = fUtil.newFileRelativityPath(absolutePath, relativePath, regionNum) + fileName ;
                    String filePath = absolutePath + fileRelativePath ;
                    if(!fUtil.saveFile(filePath, input)){
                        fileRelativePath = null ;
                    }
                }
            }
        } catch (Exception e) {
            log.error("保存录音音频文件异常", e);
        }
        return fileRelativePath ;
    }
    /**
     * web分布式文件系统保存录像视频文件
     * @param file
     * @param regionNum
     * @param json æ°´å°ä¿¡æ¯
     * @param absolutePath
     * @param relativePath
     * @param fileName
     * @return
     */
    @PostMapping("/saveVideo")
    public String saveVideo(MultipartFile file,
                            String regionNum,
                            String json,
                            String absolutePath,
                            String relativePath,
                            String fileName) {
        String fileRelativePath = null ;
        try {
            if (file != null) {
                if(absolutePath != null && relativePath != null && fileName != null){
                    InputStream input = file.getInputStream() ;
                    //生成新文件相对路径
                    FileVideoUtil fUtil = new FileVideoUtil() ;
                    fileRelativePath = fUtil.newFileRelativityPath(absolutePath, relativePath, regionNum) + fileName ;
                    String filePath = absolutePath + fileRelativePath ;
                    if(!fUtil.saveFile(filePath, input)){
                        fileRelativePath = null ;
                    }
                }
            }
        } catch (Exception e) {
            log.error("保存录像视频文件异常", e);
        }
        return fileRelativePath ;
    }
    /**
     * web分布式文件系统保存文档文件
     * @param file
     * @param regionNum
     * @param json æ°´å°ä¿¡æ¯
     * @param absolutePath
     * @param relativePath
     * @param fileName
     * @return
     */
    @PostMapping("/saveDocument")
    public String saveDocument(MultipartFile file,
                            String regionNum,
                            String json,
                            String absolutePath,
                            String relativePath,
                            String fileName) {
        String fileRelativePath = null ;
        try {
            if (file != null) {
                if(absolutePath != null && relativePath != null && fileName != null){
                    InputStream input = file.getInputStream() ;
                    //生成新文件相对路径
                    FileDocumentUtil fUtil = new FileDocumentUtil() ;
                    fileRelativePath = fUtil.newFileRelativityPath(absolutePath, relativePath, regionNum) + fileName ;
                    String filePath = absolutePath + fileRelativePath ;
                    if(!fUtil.saveFile(filePath, input)){
                        fileRelativePath = null ;
                    }
                }
            }
        } catch (Exception e) {
            log.error("保存文档文件异常", e);
        }
        return fileRelativePath ;
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-file/src/main/java/com/dy/pipIrrWebFile/fm/DyFileSvConf.java
New file
@@ -0,0 +1,155 @@
package com.dy.pipIrrWebFile.fm;
import java.util.ArrayList;
import java.util.List;
public class DyFileSvConf {
    public static class Group{
        public List<Vo> list ;
        public Group(){
            this.list = new ArrayList<Vo>() ;
        }
        public void add(Vo vo)throws Exception{
            if(vo == null){
                throw new Exception("出错,预加入集合Vo为空了!") ;
            }
            if(list.size() > 0){
                for(Vo lvo : list){
                    lvo.checkEqual(vo) ;
                }
                this.list.add(vo) ;
            }else{
                this.list.add(vo) ;
            }
        }
        public void check() throws Exception{
            Integer startV = 0 ;
            doCheck(startV) ;
        }
        private void doCheck(Integer startV) throws Exception{
            boolean find = false ;
            for(Vo vo : list){
                if(vo.hashStart.intValue() == startV.intValue()){
                    startV = vo.hashEnd + 1;
                    find = true ;
                    break ;
                }
            }
            if(!find){
                throw new Exception("严重错误,未发现哈希值为" + startV + "文件服务器!") ;
            }
            if(startV.intValue() <= 65535){
                doCheck(startV) ;
            }
        }
    }
    public static class Vo{
        public String id ;//id或名称
        public String fileSysAbsolutePath; //文件名称的哈希值对应的文件最终存储绝对路径中的根目录,在配置文件中配置
        public String fileSysRelativePath; //文件名称的哈希值对应的文件最终存储相对路径的目录,在配置文件中配置
        public String restUrl;//文件系统路径
        public String webUrl ;//下载文档的web路径
        public String webDownloadPath ;//下载文档的Controller的相对路径
        public Integer hashStart ;//哈希值启始值(包含)
        public Integer hashEnd ;//哈希值截止值(包含)
        public Vo(){}
        public Vo(String id,
                String fileSysAbsolutePath,
                String fileSysBasePath,
                String restUrl,
                String webUrl,
                String webDownloadPath,
                Integer hashStart,
                Integer hashEnd)throws Exception{
            this.id = id ;
            this.fileSysAbsolutePath = fileSysAbsolutePath ;
            this.fileSysRelativePath = fileSysBasePath ;
            this.restUrl = restUrl ;
            this.webUrl = webUrl ;
            this.webDownloadPath = webDownloadPath ;
            this.hashStart = hashStart ;
            this.hashEnd = hashEnd ;
            if(this.id == null || this.id.trim().equals("")){
                throw new Exception("出错,id为空了!") ;
            }else{
                this.id = this.id.trim() ;
            }
            if(this.fileSysAbsolutePath == null || this.fileSysAbsolutePath.trim().equals("")){
                throw new Exception("出错,fileSysAbsolutePath为空了!") ;
            }else{
                this.fileSysAbsolutePath = this.fileSysAbsolutePath.trim() ;
                this.fileSysAbsolutePath = this.fileSysAbsolutePath.replaceAll("\\\\", "/") ;
                if(!this.fileSysAbsolutePath.endsWith("/")){
                    this.fileSysAbsolutePath = this.fileSysAbsolutePath + "/" ;
                }
            }
            if(this.fileSysRelativePath == null || this.fileSysRelativePath.trim().equals("")){
                throw new Exception("出错,fileSysBasePath为空了!") ;
            }else{
                this.fileSysRelativePath = this.fileSysRelativePath.trim() ;
            }
            if(this.webUrl == null || this.webUrl.trim().equals("")){
                throw new Exception("出错,webUrl为空了!") ;
            }else{
                this.webUrl = this.webUrl.trim() ;
                if(!this.webUrl.endsWith("/") && !this.webUrl.endsWith("\\")){
                    this.webUrl += "/" ;
                }
            }
            if(this.webDownloadPath == null || this.webDownloadPath.trim().equals("")){
                throw new Exception("出错,webDownloadPath!") ;
            }
            if(this.hashStart == null){
                throw new Exception("出错,hashStart为空了!") ;
            }else if(this.hashStart.intValue() < 0){
                throw new Exception("出错,hashStart小于0了!") ;
            }else if(this.hashStart.intValue() > 65535){
                throw new Exception("出错,hashStart大于65535了!") ;
            }
            if(this.hashEnd == null){
                throw new Exception("出错,hashEnd为空了!") ;
            }else if(this.hashEnd.intValue() < 0){
                throw new Exception("出错,hashEnd小于0了!") ;
            }else if(this.hashEnd.intValue() > 65535){
                throw new Exception("出错,hashEnd大于65535了!") ;
            }
            if(this.hashEnd < this.hashStart){
                throw new Exception("出错,hashEnd小于hashStart了!") ;
            }
        }
        public String toString(){
            return "id=" + id + "\n"
                    + "fileSysAbsolutePath=" + fileSysAbsolutePath + "\n"
                    + "fileSysBasePath=" + fileSysRelativePath + "\n"
                    + "restUrl=" + restUrl + "\n"
                    + "webUrl=" + webUrl + "\n"
                    + "webDownloadPath=" + webDownloadPath + "\n"
                    + "hashStart=" + hashStart + "\n"
                    + "hashEnd=" + hashEnd ;
        }
        private boolean checkEqual(Vo vo)throws Exception{
            if(this.id.equalsIgnoreCase(vo.id)){
                throw new Exception("出错,id有重复!") ;
            }
            if(this.hashStart.intValue() == vo.hashStart.intValue()){
                throw new Exception("出错,hashStart有重复!") ;
            }
            if(this.hashEnd.intValue() == vo.hashEnd.intValue()){
                throw new Exception("出错,hashEnd有重复!") ;
            }
            if(this.hashStart.intValue() == vo.hashEnd.intValue()){
                throw new Exception("出错,hashStart与hashEnd有重复!") ;
            }
            if(this.hashEnd.intValue() == vo.hashStart.intValue()){
                throw new Exception("出错,hashEnd与hashStart有重复!") ;
            }
            return true ;
        }
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-file/src/main/java/com/dy/pipIrrWebFile/fm/DyFmListener.java
New file
@@ -0,0 +1,67 @@
package com.dy.pipIrrWebFile.fm;
import com.dy.common.util.NumUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.core.env.Environment;
import org.springframework.lang.NonNull;
import org.springframework.stereotype.Component;
@Component
public class DyFmListener implements ApplicationListener<ApplicationReadyEvent> {
    @Autowired
    private Environment env;
    public static DyFileSvConf.Group dyFileGroup = new DyFileSvConf.Group() ;
    /**
     * SpringBoot容器已经准备好了
     * @param event äº‹ä»¶
     */
    @Override
    public void onApplicationEvent(@NonNull ApplicationReadyEvent event) {
        try {
            //等1秒,等待com.alibaba.druid.pool.DruidDataSource实始化完成
            Thread.sleep(1000L);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }finally {
            try{
                parseConfig() ;
            }catch(Exception e){
                e.printStackTrace();
                dyFileGroup = null ;
            }
        }
    }
    private void parseConfig() throws Exception{
        String fmUrl = env.getProperty("dy.webFile.fmUrl");
        for(int i = 1 ; i <= 12 ; i++){
            String id = env.getProperty("dy.webFile.sv" + i + ".id");
            String absolutePath = env.getProperty("dy.webFile.sv" + i + ".absolutePath");
            String relativePath = env.getProperty("dy.webFile.sv" + i + ".relativePath");
            String hashStart = env.getProperty("dy.webFile.sv" + i + ".hashStart");
            String hashEnd = env.getProperty("dy.webFile.sv" + i + ".hashEnd");
            String restUrl = env.getProperty("dy.webFile.sv" + i + ".restUrl");
            String webUrl = env.getProperty("dy.webFile.sv" + i + ".webUrl");
            String webDownloadPath = env.getProperty("dy.webFile.sv" + i + ".webDownloadPath");
            if(!NumUtil.isPlusIntNumber(hashStart)){
                throw new Exception("配置dy.webFile.sv" + i + ".hashStart ä¸æ˜¯æ•´æ•°") ;
            }
            if(!NumUtil.isPlusIntNumber(hashEnd)){
                throw new Exception("配置dy.webFile.sv" + i + ".hashEnd ä¸æ˜¯æ•´æ•°") ;
            }
            dyFileGroup.add(new DyFileSvConf.Vo(id,
                    absolutePath,
                    relativePath,
                    restUrl,
                    webUrl,
                    webDownloadPath,
                    Integer.parseInt(hashStart),
                    Integer.parseInt(hashEnd))) ;
        }
        dyFileGroup.check();
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-file/src/main/java/com/dy/pipIrrWebFile/fm/FileName.java
New file
@@ -0,0 +1,20 @@
package com.dy.pipIrrWebFile.fm;
import com.dy.common.util.DateTime;
public class FileName {
    public static String createFileName(boolean useYmdhms, String id, String fileExtName){
        if(useYmdhms){
            return DateTime.yyyyMMddHHmmss() + "_" + id + "." + fileExtName ;
        }else{
            return id + "." + fileExtName ;
        }
    }
    public static String createIconName(String clientId, String fileExtName){
        return clientId + "_" + DateTime.yyyyMMddHHmmss() + "." + fileExtName ;
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-file/src/main/java/com/dy/pipIrrWebFile/fm/FileNameIdUtil.java
New file
@@ -0,0 +1,112 @@
package com.dy.pipIrrWebFile.fm;
import java.util.Calendar;
public class FileNameIdUtil {
    private static int add = 0 ;
    private static int chengShu = 1000 ;
    private static int maxAdd = 999 ;
    private static long last = 0 ;
    //后缀
    //在分布式系统中,例如多个业务中间件dataMw,多个系统都会向数据库中插入数据,用的都是此ID生成器,
    //æ­¤ID生成器在各个子系统中难免为同一类数据生成相同的ID,造成数据库插入因主键相同而报错,
    //所以设计此后缀,每个子系统后缀不同
    private static String suffix = "0" ;
    static {
        last = current() ;
    }
    /**
     * ä¸ºè‡ªå®žçŽ°ç¨‹åºæä¾›çš„ID生成器
     * 15长度ID,年度取两位,如果是17位长度ID,年度取四位,那17位数字超出了javascript的表数范围
     */
    public  String generate(){
        return doGenerate() ;
    }
    /**
     * è®¾ç½®åŽç¼€ï¼Œä¸åŒå­ç³»ç»Ÿè®¾ç½®ä¸åŒçš„后缀
     * @param suffix
     */
    public static void setSuffix(String suffix)throws Exception{
        if(suffix == null || suffix.trim().equals("")){
            throw new Exception("后缀不能为空") ;
        }
        FileNameIdUtil.suffix = suffix.trim() ;
    }
    /**
     * æ‰§è¡Œç”Ÿæˆ
     * @return
     */
    private synchronized String doGenerate(){
        Long id = null ;
        long now = current() ;
        if(now != last){
            //上次生成ID ä¸Žæœ¬æ¬¡ç”ŸæˆID ä¸åœ¨åŒä¸€ç§’内
            last = now ;
            add = 0 ;
            id = last * chengShu + add ++;
        }else{
            //上次生成ID ä¸Žæœ¬æ¬¡ç”ŸæˆID åœ¨åŒä¸€ç§’内
            if(add == maxAdd){
                //附加量已经用尽
                waitNextSecond(last) ;//等到下一秒
                id = last * chengShu + add ++ ;//返回上一秒生成的ID
                add = 0 ;//附加量归零,为下一秒准备
            }else{
                //附加量未用尽
                id = last * chengShu + add ++ ;
            }
        }
        return id + suffix ;
    }
    /**
     * ç­‰å¾…下一秒到来
     * @param last
     */
    private void waitNextSecond(Long last){
        try {
            Thread.sleep(10);
        } catch (InterruptedException e) {
        }finally{
            long now = current() ;
            if(now == last){
                waitNextSecond(last) ;
            }
        }
    }
    /**
     * æ ¼å¼ä¸º 150516010203
     * @return
     */
    private static long current(){
        Calendar cal = Calendar.getInstance();
        long d = (cal.get(Calendar.YEAR) % 100) * 10000000000L
        + (cal.get(Calendar.MONTH) + 1) * 100000000L
        + cal.get(Calendar.DAY_OF_MONTH) * 1000000L
        + cal.get(Calendar.HOUR_OF_DAY) * 10000L
        + cal.get(Calendar.MINUTE) * 100L
        + cal.get(Calendar.SECOND)  ;
        return d ;
    }
    public static void main(String args[]){
        FileNameIdUtil o = new FileNameIdUtil() ;
        int total = 800 ;
        long start = System.currentTimeMillis() ;
        for(int i = 0 ; i < total ; i++){
            System.out.println((String)(o.generate())) ;
        }
        long end = System.currentTimeMillis() ;
        System.out.println("产生" + total + "ID用时" + (end - start) + "毫秒");
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-file/src/main/java/com/dy/pipIrrWebFile/fm/FileRestVo.java
New file
@@ -0,0 +1,28 @@
package com.dy.pipIrrWebFile.fm;
import lombok.Data;
@Data
public class FileRestVo {
    public String fileName ; //生成的文件名称,例如20170818153254_100000007.jpg
    public Integer fileNameHash ; //文件名称的哈希值
    public String fileSysId; //文件名称的哈希值对应的文件系统的id,在配置文件中配置
    public String fileSysAbsolutePath; //文件名称的哈希值对应的文件最终存储绝对路径中的根目录,在配置文件中配置
    public String fileSysRelativePath; //文件名称的哈希值对应的文件最终存储相对路径的目录,在配置文件中配置
    public String fileSysRestUrl; //文件名称的哈希值对应的文件系统的restful URL,在配置文件中配置
    public String fileWebUrl; //文件名称的哈希值对应的文件系统的下载文件的web URL,在配置文件中配置
    public String fileWebDownloadPath; //下载文档的Controller的相对路径
    public String toString(){
        return "fileName=" + fileName + "\n"
                + "fileNameHash=" + fileNameHash + "\n"
                + "sysId=" + fileSysId + "\n"
                + "fileSysAbsolutePath=" + fileSysAbsolutePath + "\n"
                + "fileSysRelativePath=" + fileSysRelativePath + "\n"
                + "restUrl=" + fileSysRestUrl + "\n"
                + "fileWebUrl=" + fileWebUrl + "\n"
                + "fileWebDownloadPath=" + fileWebDownloadPath ;
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-file/src/main/java/com/dy/pipIrrWebFile/fm/FmCtrl.java
New file
@@ -0,0 +1,133 @@
package com.dy.pipIrrWebFile.fm;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
/**
 * å•点登录,
 */
@Slf4j
@RestController
@RequestMapping(path="fm")
@SuppressWarnings("unchecked")//java版本越高,对泛型约束越严,所以配置SuppressWarnings("unchecked")
public class FmCtrl {
    /**
     * ç”Ÿæˆæ–‡ä»¶åï¼Œå¹¶ä¸”计算出该文件名对应的文件服务器属性
     * æ–‡ä»¶åç§°æ˜¯ä¸å¸¦è·¯å¾„的名称,例如:20170818153254_100000007.jpg,文件名中不能有“/”或“\”字符
     * @param fileExtName æ–‡ä»¶æ‰©å±•名
     * @return
     */
    @PostMapping(path = "create")
    public FileRestVo create(String fileExtName){
        FileRestVo rvo = new FileRestVo() ;
        if(fileExtName != null && !fileExtName.trim().equals("")){
            try {
                String id = new FileNameIdUtil().generate();
                if(id != null){
                    rvo.fileName = FileName.createFileName(false, id, fileExtName) ;
                    rvo = new RestHashDeal().fileTransRest(rvo.fileName, rvo) ;
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        return rvo ;
    }
    /**
     * è§£æžæ–‡ä»¶åï¼ˆå¸¦æˆ–不带相对路径),计算出该文件名对应的文件服务器属性
     * æ–‡ä»¶åç§°å¯ä»¥æ˜¯ä¸å¸¦è·¯å¾„的名称,例如:20170818153254_100000007.jpg
     * æ–‡ä»¶åç§°å¯ä»¥æ˜¯å¸¦è·¯å¾„的名称,例如:webFile/photo/20170818153254_100000007.jpg
     * @param filePath
     * @return
     */
    @PostMapping(path = "parsePath")
    public FileRestVo parsePath(String filePath){
        FileRestVo rvo = new FileRestVo() ;
        if(filePath != null && !filePath.trim().equals("")){
            try {
                int index = filePath.lastIndexOf("\\") ;
                if(index > 0){
                    filePath = filePath.substring(index + 1);
                }
                index = filePath.lastIndexOf("/") ;
                if(index > 0){
                    filePath = filePath.substring(index + 1);
                }
                index = filePath.lastIndexOf("?") ;
                if(index > 0){
                    filePath = filePath.substring(0, index);
                }
                rvo.fileName = filePath ;
                rvo = new RestHashDeal().fileTransRest(filePath, rvo) ;
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        return rvo ;
    }
    /**
     * è§£æžæ–‡ä»¶åï¼Œå¹¶ä¸”计算出该文件名对应的文件服务器属性
     * æ–‡ä»¶åç§°å¯ä»¥æ˜¯ä¸å¸¦è·¯å¾„的名称,例如:20170818153254_100000007.jpg
     * æ–‡ä»¶åç§°å¯ä»¥æ˜¯å¸¦è·¯å¾„的名称,例如:webFile/photo/20170818153254_100000007.jpg
     * @param filePaths
     * @return
     */
    @PostMapping(path = "parsePathList", consumes = MediaType.APPLICATION_JSON_VALUE)//前端提交json数据
    public FileRestVo[] parsePathList(List<String> filePaths){
        List<FileRestVo> rList = new ArrayList<FileRestVo>() ;
        if(filePaths != null && filePaths.size() > 0){
            try {
                for(String filePath : filePaths){
                    FileRestVo rvo = new FileRestVo() ;
                    int index = filePath.lastIndexOf("\\") ;
                    if(index > 0){
                        filePath = filePath.substring(index + 1);
                    }
                    index = filePath.lastIndexOf("/") ;
                    if(index > 0){
                        filePath = filePath.substring(index + 1);
                    }
                    index = filePath.lastIndexOf("?") ;
                    if(index > 0){
                        filePath = filePath.substring(0, index);
                    }
                    rvo.fileName = filePath ;
                    rvo = new RestHashDeal().fileTransRest(filePath, rvo) ;
                    rList.add(rvo) ;
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        return rList.toArray(new FileRestVo[0]) ;
    }
    /**
     * è§£æžå“ˆå¸Œå€¼ï¼Œè®¡ç®—出该哈希值对应的文件服务器属性
     * @param hashCode
     * @return
     */
    @PostMapping(path = "parseHashcode")
    public FileRestVo parseHashcode(Integer hashCode){
        FileRestVo rvo = new FileRestVo() ;
        if(hashCode != null){
            try {
                rvo.fileName = null ;
                rvo = new RestHashDeal().fileTransRest(hashCode, rvo) ;
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        return rvo ;
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-file/src/main/java/com/dy/pipIrrWebFile/fm/RestHashDeal.java
New file
@@ -0,0 +1,95 @@
package com.dy.pipIrrWebFile.fm;
import com.dy.common.util.MurmurHash;
public class RestHashDeal {
    /**
     * æ–‡ä»¶åç§°è®¡ç®—转换
     * @param fileName
     * @param rvo
     * @return
     * @throws Exception
     */
    public FileRestVo fileTransRest(String fileName, FileRestVo rvo) throws Exception{
        if(fileName != null
                && !fileName.trim().equals("")
                && rvo != null){
            if(DyFmListener.dyFileGroup == null
                    || DyFmListener.dyFileGroup.list == null
                    || DyFmListener.dyFileGroup.list.size() == 0){
                throw new Exception("严重错误,文件服务器restful未配置!") ;
            }else{
                DyFileSvConf.Vo confVo = null ;
                Integer hash = null ;
                if(DyFmListener.dyFileGroup.list.size() == 1){
                    confVo = DyFmListener.dyFileGroup.list.get(0) ;
                }else{
                    hash = new MurmurHash().hash16_plus(fileName) ;
                    for(DyFileSvConf.Vo lvo : DyFmListener.dyFileGroup.list){
                        if(hash >= lvo.hashStart.intValue()
                                && hash <= lvo.hashEnd.intValue()){
                            confVo = lvo ;
                            break ;
                        }
                    }
                }
                if(confVo != null){
                    rvo.fileSysId = confVo.id;
                    rvo.fileNameHash = hash;
                    rvo.fileSysAbsolutePath = confVo.fileSysAbsolutePath;
                    rvo.fileSysRelativePath = confVo.fileSysRelativePath;
                    rvo.fileSysRestUrl = confVo.restUrl;
                    rvo.fileWebUrl = confVo.webUrl ;
                    rvo.fileWebDownloadPath = confVo.webDownloadPath ;
                }
            }
        }
        return rvo ;
    }
    /**
     * å“ˆå¸Œå€¼è®¡ç®—转换
     * @param hashcode
     * @param rvo
     * @return
     * @throws Exception
     */
    public FileRestVo fileTransRest(Integer hashcode, FileRestVo rvo) throws Exception{
        if(hashcode != null
                && rvo != null){
            if(DyFmListener.dyFileGroup == null
                    || DyFmListener.dyFileGroup.list == null
                    || DyFmListener.dyFileGroup.list.size() == 0){
                throw new Exception("严重错误,文件服务器restful未配置!") ;
            }else{
                DyFileSvConf.Vo confVo = null ;
                Integer hash = hashcode ;
                if(DyFmListener.dyFileGroup.list.size() == 1){
                    confVo = DyFmListener.dyFileGroup.list.get(0) ;
                }else{
                    for(DyFileSvConf.Vo lvo : DyFmListener.dyFileGroup.list){
                        if(hash >= lvo.hashStart.intValue()
                                && hash <= lvo.hashEnd.intValue()){
                            confVo = lvo ;
                            break ;
                        }
                    }
                }
                if(confVo != null){
                    rvo.fileSysId = confVo.id;
                    rvo.fileNameHash = hash;
                    rvo.fileSysAbsolutePath = confVo.fileSysAbsolutePath;
                    rvo.fileSysRelativePath = confVo.fileSysRelativePath;
                    rvo.fileSysRestUrl = confVo.restUrl;
                    rvo.fileWebUrl = confVo.webUrl ;
                    rvo.fileWebDownloadPath = confVo.webDownloadPath ;
                }
            }
        }
        return rvo ;
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-file/src/main/java/com/dy/pipIrrWebFile/fm/˵Ã÷.txt
New file
@@ -0,0 +1 @@
web分布式文件管理子系统
pipIrr-platform/pipIrr-web/pipIrr-web-file/src/main/java/com/dy/pipIrrWebFile/util/FileConstant.java
New file
@@ -0,0 +1,13 @@
package com.dy.pipIrrWebFile.util;
public class FileConstant {
    public static final String YES = "1" ;
    public static final String NO = "0" ;
    public static final String phoneFileBasePath = "/phone/" ;//录音文件
    public static final String photoFileBasePath = "/photo/" ;//照片文件
    public static final String videoFileBasePath = "/video/" ;//视频文件
    public static final String iconFileBasePath = "/icon/" ;//头像文件
    public static final String documentFileBasePath = "/document/" ;//文档文件
}
pipIrr-platform/pipIrr-web/pipIrr-web-file/src/main/java/com/dy/pipIrrWebFile/util/FileDocumentUtil.java
New file
@@ -0,0 +1,46 @@
package com.dy.pipIrrWebFile.util;
import com.dy.common.util.DateTime;
import com.dy.pipIrrGlobal.dyFile.FileConstant;
import java.io.File;
/**
 * æ–‡æ¡£ç±»
 * @author Administrator
 *
 */
public class FileDocumentUtil extends FileUtil {
    /**
     * ç”Ÿæˆæ–‡ä»¶ç›¸å¯¹è·¯å¾„名称
     *
     * @param absolutePath
     * @param relativePath
     * @param regionNum
     * @return
     */
    public String newFileRelativityPath(String absolutePath, String relativePath, String regionNum) {
        String relativityPath = relativePath ;
        if(regionNum != null && !regionNum.trim().equals("") && !regionNum.trim().equals(FileConstant.NotRegionNum)){
            relativityPath += regionNum ;
        }else{
            if(com.dy.pipIrrWebFile.util.FileConstant.documentFileBasePath.startsWith("/")){
                if(relativityPath.endsWith("/")){
                    relativityPath = relativityPath.substring(0, relativityPath.length() - 1) ;
                }
            }
        }
        relativityPath += com.dy.pipIrrWebFile.util.FileConstant.documentFileBasePath + DateTime.yyyyMMdd() + "/";
        String basePath = absolutePath + relativityPath;
        File dir = new File(basePath);
        if (!dir.exists()) {
            dir.mkdirs();
        }
        return relativityPath;
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-file/src/main/java/com/dy/pipIrrWebFile/util/FileIconUtil.java
New file
@@ -0,0 +1,38 @@
package com.dy.pipIrrWebFile.util;
import com.dy.pipIrrGlobal.dyFile.FileConstant;
import java.io.File;
public class FileIconUtil extends FileUtil {
    /**
     * ç”Ÿæˆæ–‡ä»¶ç›¸å¯¹è·¯å¾„名称
     *
     * @param absolutePath
     * @param relativePath
     * @param regionNum
     * @return
     */
    public String newFileRelativityPath(String absolutePath, String relativePath, String regionNum) {
        String relativityPath = relativePath ;
        if(regionNum != null && !regionNum.trim().equals("") && !regionNum.trim().equals(FileConstant.NotRegionNum)){
            relativityPath += regionNum ;
        }else{
            if(com.dy.pipIrrWebFile.util.FileConstant.iconFileBasePath.startsWith("/")){
                if(relativityPath.endsWith("/")){
                    relativityPath = relativityPath.substring(0, relativityPath.length() - 1) ;
                }
            }
        }
        relativityPath += com.dy.pipIrrWebFile.util.FileConstant.iconFileBasePath;
        String basePath = absolutePath + relativityPath;
        File dir = new File(basePath);
        if (!dir.exists()) {
            dir.mkdirs();
        }
        return relativityPath;
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-file/src/main/java/com/dy/pipIrrWebFile/util/FilePhoneUtil.java
New file
@@ -0,0 +1,41 @@
package com.dy.pipIrrWebFile.util;
import com.dy.common.util.DateTime;
import com.dy.pipIrrGlobal.dyFile.FileConstant;
import java.io.File;
public class FilePhoneUtil extends FileUtil {
    /**
     * ç”Ÿæˆæ–‡ä»¶ç›¸å¯¹è·¯å¾„名称
     *
     * @param absolutePath
     * @param relativePath
     * @param regionNum
     * @return
     */
    public String newFileRelativityPath(String absolutePath, String relativePath, String regionNum) {
        String relativityPath = relativePath ;
        if(regionNum != null && !regionNum.trim().equals("") && !regionNum.trim().equals(FileConstant.NotRegionNum)){
            relativityPath += regionNum ;
        }else{
            if(com.dy.pipIrrWebFile.util.FileConstant.phoneFileBasePath.startsWith("/")){
                if(relativityPath.endsWith("/")){
                    relativityPath = relativityPath.substring(0, relativityPath.length() - 1) ;
                }
            }
        }
        relativityPath += com.dy.pipIrrWebFile.util.FileConstant.phoneFileBasePath + DateTime.yyyyMMdd() + "/";
        String basePath = absolutePath + relativityPath;
        File dir = new File(basePath);
        if (!dir.exists()) {
            dir.mkdirs();
        }
        return relativityPath;
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-file/src/main/java/com/dy/pipIrrWebFile/util/FilePhotoUtil.java
New file
@@ -0,0 +1,39 @@
package com.dy.pipIrrWebFile.util;
import com.dy.common.util.DateTime;
import com.dy.pipIrrGlobal.dyFile.FileConstant;
import java.io.File;
public class FilePhotoUtil extends FileUtil {
    /**
     * ç”Ÿæˆæ–‡ä»¶ç›¸å¯¹è·¯å¾„名称
     *
     * @param absolutePath
     * @param relativePath
     * @param regionNum
     * @return
     */
    public String newFileRelativityPath(String absolutePath, String relativePath, String regionNum) {
        String relativityPath = relativePath ;
        if(regionNum != null && !regionNum.trim().equals("") && !regionNum.trim().equals(FileConstant.NotRegionNum)){
            relativityPath += ("-"  + regionNum) ;
        }else{
            if(com.dy.pipIrrWebFile.util.FileConstant.photoFileBasePath.startsWith("/")){
                if(relativityPath.endsWith("/")){
                    relativityPath = relativityPath.substring(0, relativityPath.length() - 1) ;
                }
            }
        }
        relativityPath += com.dy.pipIrrWebFile.util.FileConstant.photoFileBasePath + DateTime.yyyyMMdd() + "/";
        String filePath = absolutePath + relativityPath;
        File dir = new File(filePath);
        if (!dir.exists()) {
            dir.mkdirs();
        }
        return relativityPath;
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-file/src/main/java/com/dy/pipIrrWebFile/util/FileUtil.java
New file
@@ -0,0 +1,122 @@
package com.dy.pipIrrWebFile.util;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.RandomAccessFile;
import java.nio.channels.FileChannel;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
public class FileUtil {
    protected static final Logger log = LogManager.getLogger(FileUtil.class.getName()) ;
    /**
     * ä¿å­˜æ–‡ä»¶
     * @param fileAbsolutelyPath æ–‡ä»¶ç»å¯¹è·¯å¾„
     * @param input
     * @return ä¿å­˜æ–‡ä»¶çš„æ˜¯å¦æˆåŠŸçš„ç»“æžœ
     */
    public boolean saveFile(String fileAbsolutelyPath , InputStream input){
        boolean success = true ;
        if(fileAbsolutelyPath == null || input == null){
            success = false ;
        }else{
            OutputStream os = null;
            try {
                os = new FileOutputStream(fileAbsolutelyPath);
                byte[] b = new byte[1024] ;
                int len = input.read(b) ;
                while(len > 0){
                    os.write(b, 0, len);
                    len = input.read(b) ;
                    os.flush();
                }
            } catch (Exception e) {
                e.printStackTrace();
                success = false ;
            } finally {
                try {
                    if(os != null){
                        os.close();
                    }
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
        return success ;
    }
    /**
     * å¤åˆ¶æ–‡ä»¶
     * @param fromFile
     * @param realPath ç»å¯¹è·¯å¾„
     * @param newFileRelativityPath ç›¸å¯¹è·¯å¾„
     * @return
     */
    public boolean copyFile(File fromFile, String realPath, String newFileRelativityPath){
        boolean flag = true ;
        FileChannel fromChannel = null ;
        FileChannel toChannel = null ;
        try {
            fromChannel = new RandomAccessFile(fromFile, "r").getChannel();
            toChannel = new RandomAccessFile(new File(realPath + newFileRelativityPath), "rw").getChannel();
            fromChannel.transferTo(0, fromChannel.size(), toChannel);
        } catch (FileNotFoundException e) {
            flag = false ;
            log.error("复制文件出错:" + e.getMessage()) ;
        } catch (IOException e) {
            flag = false ;
            log.error("复制文件出错:" + e.getMessage()) ;
        }finally{
            try{
                if(fromChannel != null){
                    fromChannel.close() ;
                }
                if(toChannel != null){
                    toChannel.close() ;
                }
            }catch(Exception e){}finally{}
        }
        return flag ;
    }
    /**
     * åˆ é™¤æ–‡ä»¶
     * @param f
     */
    public boolean deleteFile(File f){
        boolean flag = false ;
        try{
            if(f != null){
                flag = f.delete() ;
            }
        }catch(Exception e){
        }finally{}
        return flag ;
    }
    /**
     * åˆ é™¤æ–‡ä»¶
     * @param path
     */
    public boolean deleteFile(String path){
        boolean flag = false ;
        try{
            if(path != null && !path.equals("")){
                File f = new File(path) ;
                if(f != null && f.exists()){
                    flag = f.delete() ;
                }
            }
        }catch(Exception e){
        }finally{}
        return flag ;
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-file/src/main/java/com/dy/pipIrrWebFile/util/FileVideoUtil.java
New file
@@ -0,0 +1,39 @@
package com.dy.pipIrrWebFile.util;
import com.dy.common.util.DateTime;
import com.dy.pipIrrGlobal.dyFile.FileConstant;
import java.io.File;
public class FileVideoUtil extends FileUtil {
    /**
     * ç”Ÿæˆæ–‡ä»¶ç›¸å¯¹è·¯å¾„名称
     *
     * @param absolutePath
     * @param relativePath
     * @param regionNum
     * @return
     */
    public String newFileRelativityPath(String absolutePath, String relativePath, String regionNum) {
        String relativityPath = relativePath ;
        if(regionNum != null && !regionNum.trim().equals("") && !regionNum.trim().equals(FileConstant.NotRegionNum)){
            relativityPath += regionNum ;
        }else{
            if(com.dy.pipIrrWebFile.util.FileConstant.videoFileBasePath.startsWith("/")){
                if(relativityPath.endsWith("/")){
                    relativityPath = relativityPath.substring(0, relativityPath.length() - 1) ;
                }
            }
        }
        relativityPath += com.dy.pipIrrWebFile.util.FileConstant.videoFileBasePath + DateTime.yyyyMMdd() + "/";
        String basePath = absolutePath + relativityPath;
        File dir = new File(basePath);
        if (!dir.exists()) {
            dir.mkdirs();
        }
        return relativityPath;
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-file/src/main/java/com/dy/pipIrrWebFile/util/ZipImg.java
New file
@@ -0,0 +1,63 @@
package com.dy.pipIrrWebFile.util;
import net.coobird.thumbnailator.Thumbnails;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.InputStream;
/**
 * ç”Ÿæˆå›¾ç‰‡çš„缩略图
 */
public class ZipImg {
    public static InputStream zipToJpg(File file, int xSize, int ySize) throws Exception{
        return zip(file, "jpg", xSize, ySize) ;
    }
    public static InputStream zipToPng(File file, int xSize, int ySize) throws Exception{
        return zip(file, "png", xSize, ySize) ;
    }
    public static void zipToFile(File file, File toFile, int xSize, int ySize) throws Exception{
        Thumbnails.of(file).size(xSize, ySize).outputQuality(0.5f).toFile(toFile);//0f-1f è´¨é‡è¶Šé«˜
    }
    private static InputStream zip(File file, String type, int xSize, int ySize) throws Exception{
        BufferedImage bi = Thumbnails.of(file).size(xSize, ySize).outputQuality(1f).asBufferedImage();
        ByteArrayOutputStream os = new ByteArrayOutputStream();
        ImageIO.write(bi, type, os);
        InputStream in = new ByteArrayInputStream(os.toByteArray());
        bi = null ;
        os = null ;
        return in ;
    }
    public static void main(String[] args){
        File f = new File("D:/test.jpg") ;
        String name = f.getName() ;
        String path = f.getPath() ;
        System.out.println(name);
        System.out.println(path);
        int index = path.lastIndexOf(".") ;
        String s1 = path.substring(0, index) ;
        String s2 = path.substring(index) ;
        System.out.println(s1);
        System.out.println(s2);
        String newFilePath = s1 + "_" + s2 ;
        try {
            InputStream input = zipToJpg(f, 400, 400) ;
            new FileUtil().saveFile(newFilePath, input) ;
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-file/src/main/resources/application.yml
New file
@@ -0,0 +1,16 @@
spring:
    profiles:
        include: global, database, database-ym, database-pj, database-test
#actutor的web端口
management:
    server:
        port: ${pipIrr.file1.actutorPort}
#web服务端口,tomcat默认是8088
server:
    port: ${pipIrr.file1.webPort}
    servlet:
        context-path: /file #web访问上下文路径
        context-parameters:
            #GenerateIdSetSuffixListener中应用,取值范围是0-99
            idSuffix: ${pipIrr.file.idSuffix}
pipIrr-platform/pipIrr-web/pipIrr-web-file/src/main/resources/log4j2.yml
New file
@@ -0,0 +1,71 @@
Configuration:
    #status,这个用于设置log4j2自身内部的信息输出,可以不设置,当设置成trace时,你会看到log4j2内部各种详细输出;可以设置成Off(关闭)或Error(只输出错误信息)
    status: Error
    Properties: # å®šä¹‰å…¨å±€å˜é‡
        Property:
            #日志文件存储的目录
            - name: log.path
              value: ./logs
            #日志文件存储名称
            - name: project.name
              value: pipIrrFile
    #定义输出器,可以输出到控制台和文件.
    Appenders:
        #输出到控制台
        Console:
            #Appender命名
            name: CONSOLE
            target: SYSTEM_OUT
            ThresholdFilter:
                level: debug #输出日志级别,输出日志时,首先由Loggers.Root.level或Loggers.Logger.level判断是否输出,然后再由本level判断是否输出
                onMatch: ACCEPT #onMatch=ACCEPT å¤§äºŽç­‰äºŽ "level" é…ç½®çš„等级地日志输出
                onMismatch: DENY #onMismatch=DENY å°äºŽ "level" é…ç½®çš„等级地日志不输出
            #日志内容样式
            PatternLayout:
                #%n-换行
                #%m-日志内容,输出代码中指定的日志信息
                #%p-输出优先级,即DEBUG,INFO,WARN,ERROR,FATAL
                #%r-程序启动到现在的毫秒数
                #%%- è¾“出一个"%" å­—符
                #%t-当前线程名
                #%d-日期和时间, å¸¸ç”¨çš„æ ¼å¼æœ‰%d{DATE},%d{ABSOLUTE},%d{HH:mm:ss,SSS},%d{ddMMyyyyHH:mm:ss,SSS}
                #%l-同%F%L%C%M
                #%F-java源文件名
                #%L-java源码行数
                #%C-java类名,%C{1}输出最后一个元素
                #%M-java方法名
                pattern: "%d{yyyy-MM-dd HH:mm:ss,SSS}:%4p %t (%C.%M:%L) - %m%n"
        # è¾“出到文件,超过10MB归档
        RollingFile:
          - name: ROLLING_FILE
            ignoreExceptions: false
            fileName: ${log.path}/${project.name}.log
            filePattern: "${log.path}/${project.name}-%d{yyyy-MM-dd}-%i.log.gz"
            ThresholdFilter:
              level: error #输出日志级别,输出日志时,首先由Loggers.Root.level或Loggers.Logger.level判断是否输出,然后再由本level判断是否输出
              onMatch: ACCEPT #onMatch=ACCEPT å¤§äºŽç­‰äºŽ "level" é…ç½®çš„等级地日志输出
              onMismatch: DENY #onMismatch=DENY å°äºŽ "level" é…ç½®çš„等级地日志不输出
            #日志内容样式
            PatternLayout:
              pattern: "%d{yyyy-MM-dd HH:mm:ss,SSS}:%4p %t (%C.%M:%L) - %m%n"
            Policies:
              # æ¯å¤©æ—¥å¿—文件按大小分子文件
              SizeBasedTriggeringPolicy:
                size: "1 MB"
            DefaultRolloverStrategy:
              max: 10  #一天内日志文件最大个数
              Delete:
                basePath: "${log.path}"
                maxDepth: 2 #删除日志文件的最大深度
                IfFileName:
                  glob: "${project.name}-%d{yyyy-MM-dd}-%i.log.gz"
                IfLastModified:
                  age: "30d" #日志文件保留的最大天数
    Loggers:
        Root:
            level: info #日志输出级别,共有8个级别,按照从低到高为:all < trace < debug < info < warn < error < fatal < off
            AppenderRef: #Root的子节点,用来指定该日志输出到哪个Appender.
                - ref: CONSOLE #输出日志时,首先由本level判断是否输出,然后再由上面的Appenders.Console.ThresholdFilter.level判断是否输出
                - ref: ROLLING_FILE  #输出日志时,首先由本level判断是否输出,然后再由上面的Appenders.RollingFile.ThresholdFilter.level判断是否输出
pipIrr-platform/pipIrr-web/pipIrr-web-file/src/test/java/com/dy/pipIrrWebFile/PipIrrWebFileApplicationTests.java
New file
@@ -0,0 +1,13 @@
package com.dy.pipIrrWebFile;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class PipIrrWebFileApplicationTests {
    @Test
    void contextLoads() {
    }
}
pipIrr-platform/pipIrr-web/pom.xml
@@ -31,6 +31,7 @@
        <module>pipIrr-web-wechat</module>
        <module>pipIrr-web-app</module>
        <module>pipIrr-web-operation</module>
        <module>pipIrr-web-file</module>
    </modules>
    <dependencies>
@@ -180,6 +181,13 @@
            <artifactId>jdom2</artifactId>
        </dependency>
        <!-- thumbnailator ç”Ÿæˆå›¾ç‰‡ç¼©ç•¥å›¾ -->
        <dependency>
            <groupId>net.coobird</groupId>
            <artifactId>thumbnailator</artifactId>
            <version>0.4.20</version>
        </dependency>
        <!-- bean和map互转换 -->
        <dependency>
            <groupId>org.apache.dubbo</groupId>