|
@@ -22,10 +22,7 @@ import com.qmth.sop.business.service.*;
|
|
import com.qmth.sop.business.util.ImportExportUtil;
|
|
import com.qmth.sop.business.util.ImportExportUtil;
|
|
import com.qmth.sop.common.contant.SystemConstant;
|
|
import com.qmth.sop.common.contant.SystemConstant;
|
|
import com.qmth.sop.common.enums.*;
|
|
import com.qmth.sop.common.enums.*;
|
|
-import com.qmth.sop.common.util.GsonUtil;
|
|
|
|
-import com.qmth.sop.common.util.Result;
|
|
|
|
-import com.qmth.sop.common.util.ResultUtil;
|
|
|
|
-import com.qmth.sop.common.util.ServletUtil;
|
|
|
|
|
|
+import com.qmth.sop.common.util.*;
|
|
import io.swagger.annotations.*;
|
|
import io.swagger.annotations.*;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
@@ -36,9 +33,11 @@ import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
import javax.validation.Valid;
|
|
import javax.validation.Valid;
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
import java.io.InputStream;
|
|
import java.io.InputStream;
|
|
|
|
+import java.nio.charset.StandardCharsets;
|
|
import java.security.NoSuchAlgorithmException;
|
|
import java.security.NoSuchAlgorithmException;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
@@ -91,6 +90,9 @@ public class SysController {
|
|
@Resource
|
|
@Resource
|
|
TBServiceService tbServiceService;
|
|
TBServiceService tbServiceService;
|
|
|
|
|
|
|
|
+ @Resource
|
|
|
|
+ FileStoreUtil fileStoreUtil;
|
|
|
|
+
|
|
@ApiOperation(value = "登录")
|
|
@ApiOperation(value = "登录")
|
|
@RequestMapping(value = "/login", method = RequestMethod.POST)
|
|
@RequestMapping(value = "/login", method = RequestMethod.POST)
|
|
@ApiResponses({@ApiResponse(code = 200, message = "用户信息", response = LoginResult.class)})
|
|
@ApiResponses({@ApiResponse(code = 200, message = "用户信息", response = LoginResult.class)})
|
|
@@ -200,13 +202,21 @@ public class SysController {
|
|
@ApiParam(value = "下载文件类型", required = true) @RequestParam DownloadFileEnum type) throws Exception {
|
|
@ApiParam(value = "下载文件类型", required = true) @RequestParam DownloadFileEnum type) throws Exception {
|
|
TBTask tbTask = tbTaskService.getById(taskId);
|
|
TBTask tbTask = tbTaskService.getById(taskId);
|
|
Optional.ofNullable(tbTask).orElseThrow(() -> ExceptionResultEnum.TASK_NO_DATA.exception());
|
|
Optional.ofNullable(tbTask).orElseThrow(() -> ExceptionResultEnum.TASK_NO_DATA.exception());
|
|
- String path = null;
|
|
|
|
|
|
+ String path = null, content = null;
|
|
switch (type) {
|
|
switch (type) {
|
|
case IMPORT_FILE:
|
|
case IMPORT_FILE:
|
|
path = tbTask.getImportFilePath();
|
|
path = tbTask.getImportFilePath();
|
|
break;
|
|
break;
|
|
case REPORT_FILE:
|
|
case REPORT_FILE:
|
|
path = tbTask.getReportFilePath();
|
|
path = tbTask.getReportFilePath();
|
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(path);
|
|
|
|
+ UploadFileEnum uploadFileEnum = Enum.valueOf(UploadFileEnum.class, (String) jsonObject.get(SystemConstant.UPLOAD_TYPE));
|
|
|
|
+ String filePath = (String) jsonObject.get(SystemConstant.PATH);
|
|
|
|
+ HttpServletResponse response = ServletUtil.getResponse();
|
|
|
|
+ byte[] bytes = fileStoreUtil.ossDownload(filePath, uploadFileEnum.getFssType());
|
|
|
|
+ content = new String(bytes, StandardCharsets.UTF_8);
|
|
|
|
+// response.setContentType("text/html; charset=utf-8");
|
|
|
|
+// response.getWriter().print(string);
|
|
break;
|
|
break;
|
|
case EXPORT_FILE:
|
|
case EXPORT_FILE:
|
|
path = tbTask.getResultFilePath();
|
|
path = tbTask.getResultFilePath();
|
|
@@ -215,7 +225,7 @@ public class SysController {
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
Optional.ofNullable(path).orElseThrow(() -> ExceptionResultEnum.PATH_NO_DATA.exception());
|
|
Optional.ofNullable(path).orElseThrow(() -> ExceptionResultEnum.PATH_NO_DATA.exception());
|
|
- return ResultUtil.ok(new EditResult(basicAttachmentService.filePreview(path)));
|
|
|
|
|
|
+ return ResultUtil.ok(new EditResult(basicAttachmentService.filePreview(path), content));
|
|
}
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "小程序签名预览接口")
|
|
@ApiOperation(value = "小程序签名预览接口")
|