|
|
|
@ -2,11 +2,11 @@ package com.keyware.shandan.system.controller; |
|
|
|
|
|
|
|
|
|
import cn.hutool.core.io.FileUtil; |
|
|
|
|
import cn.hutool.core.util.ZipUtil; |
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
|
import com.keyware.shandan.bianmu.service.DataLabelsService; |
|
|
|
|
import com.keyware.shandan.common.controller.BaseController; |
|
|
|
|
import com.keyware.shandan.common.entity.Result; |
|
|
|
|
import com.keyware.shandan.common.util.FileDownload; |
|
|
|
|
import com.keyware.shandan.common.util.PoiFileReadUtil; |
|
|
|
|
import com.keyware.shandan.frame.properties.CustomProperties; |
|
|
|
|
import com.keyware.shandan.system.constants.FormTypeEnum; |
|
|
|
|
import com.keyware.shandan.system.entity.SysFile; |
|
|
|
@ -16,23 +16,18 @@ import com.keyware.shandan.system.service.SysFileService; |
|
|
|
|
import com.keyware.shandan.system.service.SysFormConfigService; |
|
|
|
|
import com.keyware.shandan.system.service.SysSettingService; |
|
|
|
|
import com.keyware.shandan.system.utils.FileChunkUploadUtil; |
|
|
|
|
import org.apache.tomcat.util.http.ResponseUtil; |
|
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
|
import org.springframework.util.Assert; |
|
|
|
|
import org.springframework.util.StopWatch; |
|
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
import org.springframework.web.multipart.MultipartFile; |
|
|
|
|
import org.springframework.web.servlet.ModelAndView; |
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
|
import java.io.*; |
|
|
|
|
import java.nio.charset.StandardCharsets; |
|
|
|
|
import java.nio.file.Files; |
|
|
|
|
import java.io.File; |
|
|
|
|
import java.io.IOException; |
|
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
|
import java.util.Arrays; |
|
|
|
|
import java.util.HashSet; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.Set; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -62,7 +57,6 @@ public class SysFileController extends BaseController<SysFileService, SysFile, S |
|
|
|
|
@Autowired |
|
|
|
|
private SysFormConfigService formConfigService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("/layer") |
|
|
|
|
public ModelAndView fileUploadLayer(ModelAndView mav) { |
|
|
|
|
mav.setViewName("sys/file/fileUploadLayer"); |
|
|
|
@ -114,10 +108,6 @@ public class SysFileController extends BaseController<SysFileService, SysFile, S |
|
|
|
|
} |
|
|
|
|
String downloadUrl = bianmuSetting.getSysAddress() + "/sys/file/download/" + fileId; |
|
|
|
|
|
|
|
|
|
// TODO 临时调试用
|
|
|
|
|
//fileViewUrl = "http://192.168.102.192:8080/bianmu" + file.getWebUri();
|
|
|
|
|
//downloadUrl = "http://192.168.102.192:8080/bianmu/sys/file/download/" + fileId;
|
|
|
|
|
|
|
|
|
|
mav.addObject("fileViewUrl", fileViewUrl.replace("\\", "/")); |
|
|
|
|
mav.addObject("downloadUrl", downloadUrl); |
|
|
|
|
mav.addObject("fileData", file); |
|
|
|
@ -128,6 +118,22 @@ public class SysFileController extends BaseController<SysFileService, SysFile, S |
|
|
|
|
} |
|
|
|
|
mav.addObject("readableFileSize", fileSize); |
|
|
|
|
mav.addObject("LabelConfigSet", labelsService.formConfigList()); |
|
|
|
|
File ff = new File(customProperties.getFileStorage().getPath() + File.separator + file.getPath()); |
|
|
|
|
if (!ff.exists()) { |
|
|
|
|
mav.addObject("fileNotExists", true); |
|
|
|
|
} else { |
|
|
|
|
if (PoiFileReadUtil.isReadilyFile(ff)) { |
|
|
|
|
try { |
|
|
|
|
String text = PoiFileReadUtil.parseTextByFile(ff); |
|
|
|
|
if (text == null) { |
|
|
|
|
mav.addObject("fileReadError", true); |
|
|
|
|
} |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
mav.addObject("fileReadError", true); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return mav; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|