Browse Source

修复错误

NorthLan 6 years ago
parent
commit
2c18bb62ba
1 changed files with 5 additions and 5 deletions
  1. 5 5
      zen-core/src/main/kotlin/com/gxzc/zen/common/util/FileUtil.kt

+ 5 - 5
zen-core/src/main/kotlin/com/gxzc/zen/common/util/FileUtil.kt

@@ -1,6 +1,6 @@
 package com.gxzc.zen.common.util
 
-import com.gxzc.zen.common.properties.UploadProperties
+import com.gxzc.zen.common.properties.FSProperties
 import com.gxzc.zen.common.util.io.BufferedRandomAccessFile
 import java.io.File
 import java.io.FileInputStream
@@ -16,13 +16,13 @@ import java.nio.ByteBuffer
  */
 object FileUtil {
 
-    private val uploadProperties: UploadProperties by lazy { SpringContextHolder.getBean(UploadProperties::class.java)!! }
+    private val fsProperties: FSProperties by lazy { SpringContextHolder.getBean(FSProperties::class.java)!! }
 
     /**
      * 获取 文件首+尾chunk
      * 拼接起来的md5
      */
-    fun md5HeadTail(path: String, chunkSize: Int? = uploadProperties.chunkSize?.toInt()): String {
+    fun md5HeadTail(path: String, chunkSize: Int? = fsProperties.chunkSize.toInt()): String {
         val file = File(path)
         return transientMd5HeadTail(file, chunkSize)
     }
@@ -31,14 +31,14 @@ object FileUtil {
      * 获取 文件首+尾chunk
      * 拼接起来的md5
      */
-    fun md5HeadTail(file: File, chunkSize: Int? = uploadProperties.chunkSize?.toInt()): String {
+    fun md5HeadTail(file: File, chunkSize: Int? = fsProperties.chunkSize.toInt()): String {
         return transientMd5HeadTail(file, chunkSize)
     }
 
     private fun transientMd5HeadTail(file: File, size: Int?): String {
         var chunkSize = size
         if (chunkSize == null) {
-            chunkSize = uploadProperties.chunkSize!!.toInt()
+            chunkSize = fsProperties.chunkSize.toInt()
         }
         val fc = FileInputStream(file).channel
         val fileSize = fc.size()