修改文件上传接口

segment2.0
linrf 2 years ago
parent c90295bcf2
commit 5ecc401b1f

@ -1,4 +1,4 @@
package com.docus.server.vo.segmentation; package com.docus.server.dto.segmentation;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@ -9,7 +9,7 @@ import lombok.Data;
*/ */
@ApiModel("上传文件附带的文件信息") @ApiModel("上传文件附带的文件信息")
@Data @Data
public class FileDto { public class FileDTO {
@ApiModelProperty("文件分类ID") @ApiModelProperty("文件分类ID")
private String assortId; private String assortId;
@ApiModelProperty("文件展示标题") @ApiModelProperty("文件展示标题")

@ -1,4 +1,4 @@
package com.docus.server.vo.segmentation; package com.docus.server.dto.segmentation;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@ -8,7 +8,8 @@ import javax.validation.constraints.NotNull;
@Data @Data
@ApiModel("文件上传参数") @ApiModel("文件上传参数")
public class UploadBatchFileParam { public class UploadBatchFileRequest {
@ApiModelProperty(value = "业务系统病案主键") @ApiModelProperty(value = "业务系统病案主键")
@NotNull(message = "业务系统病案主键不能为空") @NotNull(message = "业务系统病案主键不能为空")
private String patientId; private String patientId;
@ -16,7 +17,6 @@ public class UploadBatchFileParam {
@ApiModelProperty(value = "采集器id来源") @ApiModelProperty(value = "采集器id来源")
private String collectorId; private String collectorId;
@ApiModelProperty(value = "扫描用户代码 默认admin") @ApiModelProperty(value = "扫描用户代码 默认admin")
private String scanUserCode = "admin"; private String scanUserCode = "admin";
@ -29,7 +29,8 @@ public class UploadBatchFileParam {
@ApiModelProperty(value = "任务id如果有 ") @ApiModelProperty(value = "任务id如果有 ")
private Long taskId = -1L; private Long taskId = -1L;
@ApiModelProperty(value = "文件信息Json FileDto Model") @ApiModelProperty(value = "文件信息Json FileDTO Model")
@NotNull(message = "文件信息Json不能为空") @NotNull(message = "文件信息Json不能为空")
private String fileInfo; private String fileInfo;
} }

@ -1,10 +1,13 @@
package com.docus.server.controller; package com.docus.server.controller;
import com.docus.server.common.service.IFileUploadService; import com.docus.server.common.service.IFileUploadService;
import com.docus.server.dto.segmentation.UploadBatchFileRequest;
import com.docus.server.vo.scheduling.management.schcollectorversionfile.UploadFileVO;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
@ -14,6 +17,7 @@ import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.List;
/** /**
* API * API
@ -39,8 +43,9 @@ public class FileController {
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "files", value = "文件", required = true, dataTypeClass = MultipartFile.class) @ApiImplicitParam(name = "files", value = "文件", required = true, dataTypeClass = MultipartFile.class)
}) })
public void uploadFile(@RequestPart("files") MultipartFile[] files, String pathKey) throws Exception { public void uploadFile(@RequestPart("files") MultipartFile[] files, @Validated UploadBatchFileRequest request) throws Exception {
iFileUploadService.uploadFile(files, pathKey); List<UploadFileVO> segmentation = iFileUploadService.uploadFile(files, "segmentation");
//将基础信息存到库表里面,后面自动分段后,需要上传到归档系统
} }
} }

@ -76,7 +76,7 @@ public class OcrServiceImpl implements OcrApi {
@Override @Override
public OcrResponse uploadFile(Map<String, Object> params) { public OcrResponse uploadFile(Map<String, Object> params) {
HTTP_POST_LOCK.lock(); HTTP_POST_LOCK.lock();
try { try {

@ -3,8 +3,8 @@ package com.docus.server;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpRequest; import cn.hutool.http.HttpRequest;
import com.docus.core.util.json.JSON; import com.docus.core.util.json.JSON;
import com.docus.server.vo.segmentation.FileDto; import com.docus.server.dto.segmentation.FileDTO;
import com.docus.server.vo.segmentation.UploadBatchFileParam; import com.docus.server.dto.segmentation.UploadBatchFileRequest;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
@ -16,13 +16,13 @@ public class ImageProcessingExample {
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
UploadBatchFileParam uploadBatchFileParam = new UploadBatchFileParam(); UploadBatchFileRequest uploadBatchFileParam = new UploadBatchFileRequest();
System.out.println(JSON.toJSON(uploadBatchFileParam)); System.out.println(JSON.toJSON(uploadBatchFileParam));
FileDto fileDto = new FileDto(); FileDTO fileDto = new FileDTO();
System.out.println(JSON.toJSON(fileDto)); System.out.println(JSON.toJSON(fileDto));
List<FileDto> fileDtoList = new ArrayList<>(); List<FileDTO> fileDtoList = new ArrayList<>();
System.out.println(JSON.toJSON(fileDtoList)); System.out.println(JSON.toJSON(fileDtoList));

Loading…
Cancel
Save