|
@@ -8,6 +8,7 @@ import com.qmth.themis.business.constant.SystemConstant;
|
|
|
import com.qmth.themis.business.entity.*;
|
|
|
import com.qmth.themis.business.enums.DownloadFileEnum;
|
|
|
import com.qmth.themis.business.enums.RoleEnum;
|
|
|
+import com.qmth.themis.business.enums.UploadFileEnum;
|
|
|
import com.qmth.themis.business.service.*;
|
|
|
import com.qmth.themis.business.util.EhcacheUtil;
|
|
|
import com.qmth.themis.business.util.ServletUtil;
|
|
@@ -97,11 +98,11 @@ public class SysController {
|
|
|
@RequestMapping(value = "/file/upload", method = RequestMethod.POST)
|
|
|
@Transactional
|
|
|
@ApiResponses({@ApiResponse(code = 200, message = "{\"id\":0}", response = Result.class)})
|
|
|
- public Result fileUpload(@ApiParam(value = "上传文件", required = true) @RequestParam MultipartFile file, @ApiParam(value = "上传文件类型", required = true) @RequestParam Integer type) throws IOException {
|
|
|
+ public Result fileUpload(@ApiParam(value = "上传文件", required = true) @RequestParam MultipartFile file, @ApiParam(value = "上传文件类型", required = true) @RequestParam UploadFileEnum type) throws IOException {
|
|
|
if (Objects.isNull(file) || Objects.equals(file, "")) {
|
|
|
throw new BusinessException(ExceptionResultEnum.ATTACHMENT_IS_NULL);
|
|
|
}
|
|
|
- Map<String, Object> mapParameter = systemConfig.getOssEnv(type);
|
|
|
+ Map<String, Object> mapParameter = systemConfig.getOssEnv(type.getId());
|
|
|
TBUser tbUser = (TBUser) ServletUtil.getRequestAccount();
|
|
|
TBAttachment tbAttachment = tbAttachmentService.saveAttachment(file, ServletUtil.getRequestMd5(), ServletUtil.getRequestPath(), mapParameter, tbUser.getOrgId(), tbUser.getId());
|
|
|
if (Objects.isNull(tbAttachment)) {
|
|
@@ -117,14 +118,14 @@ public class SysController {
|
|
|
@ApiOperation(value = "文件下载接口")
|
|
|
@RequestMapping(value = "/file/download", method = RequestMethod.POST)
|
|
|
@ApiResponses({@ApiResponse(code = 200, message = "{\"url\":string}", response = Result.class)})
|
|
|
- public Result fileDownload(@ApiParam(value = "任务id", required = true) @RequestParam Long id, @ApiParam(value = "下载文件类型", required = true) @RequestParam Integer type) {
|
|
|
+ public Result fileDownload(@ApiParam(value = "任务id", required = true) @RequestParam Long id, @ApiParam(value = "下载文件类型", required = true) @RequestParam DownloadFileEnum type) {
|
|
|
if (Objects.isNull(id) || Objects.equals(id, "")) {
|
|
|
throw new BusinessException(ExceptionResultEnum.TASK_ID_IS_NULL);
|
|
|
}
|
|
|
if (Objects.isNull(type) || Objects.equals(type, "")) {
|
|
|
throw new BusinessException(ExceptionResultEnum.DOWNLOAD_FILE_TYPE_IS_NULL);
|
|
|
}
|
|
|
- if (Objects.isNull(DownloadFileEnum.convertToName(type))) {
|
|
|
+ if (Objects.isNull(DownloadFileEnum.convertToName(type.getId()))) {
|
|
|
throw new BusinessException(ExceptionResultEnum.DOWNLOAD_FILE_TYPE_ERROR);
|
|
|
}
|
|
|
TBTaskHistory tbTaskHistory = tbTaskHistoryService.getById(id);
|
|
@@ -133,7 +134,7 @@ public class SysController {
|
|
|
}
|
|
|
boolean oss = dictionaryConfig.sysDomain().isOss();
|
|
|
JSONObject jsonObject = null;
|
|
|
- switch (type) {
|
|
|
+ switch (type.getId()) {
|
|
|
case 0:
|
|
|
jsonObject = JSONObject.parseObject(tbTaskHistory.getImportFilePath());
|
|
|
break;
|