|
@@ -5,7 +5,12 @@ import com.jiayue.ipfcst.common.data.constant.enums.FileStatusEnum;
|
|
|
import com.jiayue.ipfcst.common.data.constant.enums.FileTypeEnum;
|
|
|
import com.jiayue.ipfcst.common.data.constant.enums.UploadProtocolEnum;
|
|
|
import com.jiayue.ipfcst.common.data.entity.UploadFileLog;
|
|
|
+import com.jiayue.ipfcst.common.data.strategy.ApiMyResponse;
|
|
|
import com.jiayue.ipfcst.fileupload.service.UploadFileLogService;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiImplicitParam;
|
|
|
+import io.swagger.annotations.ApiImplicitParams;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
@@ -19,6 +24,7 @@ import java.util.Map;
|
|
|
@RestController
|
|
|
@RequestMapping("uploadFileLog")
|
|
|
@Slf4j
|
|
|
+@Api(value = "UploadFileLogController", tags = "上报文件日志controller")
|
|
|
public class UploadFileLogController {
|
|
|
|
|
|
private final UploadFileLogService uploadFileLogService;
|
|
@@ -29,7 +35,7 @@ public class UploadFileLogController {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 根据上报对象,时间,文件类型,文件状态
|
|
|
+ * 根据上报对象、时间、文件类型、文件状态查询文件日志
|
|
|
*
|
|
|
* @param uploadObjectId 上报对象
|
|
|
* @param createTime 时间
|
|
@@ -38,6 +44,16 @@ public class UploadFileLogController {
|
|
|
* @return
|
|
|
*/
|
|
|
@GetMapping("getFileLog/{uploadObjectId}/{createTime}/{fileType}/{fileStatus}")
|
|
|
+ @ApiOperation(value = "根据上报对象、时间、文件类型、文件状态查询文件日志", httpMethod = "GET",
|
|
|
+ notes = "<p>返回ResponseVO对象,data属性存入Page<UploadFileLog></p>"
|
|
|
+ )
|
|
|
+ @ApiImplicitParams(value={
|
|
|
+ @ApiImplicitParam(name= "uploadObjectId",value = "对象ID",dataType="Integer"),
|
|
|
+ @ApiImplicitParam(name= "createTime",value = "生成时间",dataType="String"),
|
|
|
+ @ApiImplicitParam(name= "fileType",value = "文件类型",dataType="String"),
|
|
|
+ @ApiImplicitParam(name= "fileStatus",value = "文件状态",dataType="String"),
|
|
|
+ })
|
|
|
+ @ApiMyResponse
|
|
|
public ResponseVO get(@PathVariable("uploadObjectId") Integer uploadObjectId, @PathVariable("createTime") String createTime,
|
|
|
@PathVariable("fileType") String fileType, @PathVariable("fileStatus") String fileStatus) {
|
|
|
List<UploadFileLog> list = uploadFileLogService.queryFileLog(uploadObjectId, createTime, fileType, fileStatus);
|
|
@@ -45,6 +61,10 @@ public class UploadFileLogController {
|
|
|
}
|
|
|
|
|
|
@GetMapping("/getFileStatusEnum")
|
|
|
+ @ApiOperation(value = "获取文件状态类型", httpMethod = "GET",
|
|
|
+ notes = "<p>返回ResponseVO对象,data属性存入FileStatusEnum枚举</p>"
|
|
|
+ )
|
|
|
+ @ApiMyResponse
|
|
|
public ResponseVO getFileStatusEnum() {
|
|
|
List list = new ArrayList<>();
|
|
|
for (FileStatusEnum fileStatusEnum : FileStatusEnum.values()) {
|
|
@@ -57,6 +77,10 @@ public class UploadFileLogController {
|
|
|
}
|
|
|
|
|
|
@GetMapping("/getUploadProtocolEnum")
|
|
|
+ @ApiOperation(value = "获取上报协议", httpMethod = "GET",
|
|
|
+ notes = "<p>返回ResponseVO对象,data属性存入UploadProtocolEnum枚举</p>"
|
|
|
+ )
|
|
|
+ @ApiMyResponse
|
|
|
public ResponseVO getUploadProtocolEnum() {
|
|
|
List list = new ArrayList<>();
|
|
|
for (UploadProtocolEnum uploadProtocolEnum : UploadProtocolEnum.values()) {
|
|
@@ -69,6 +93,10 @@ public class UploadFileLogController {
|
|
|
}
|
|
|
|
|
|
@GetMapping("/getFileTypeEnum")
|
|
|
+ @ApiOperation(value = "获取文件类型", httpMethod = "GET",
|
|
|
+ notes = "<p>返回ResponseVO对象,data属性存入FileTypeEnum枚举</p>"
|
|
|
+ )
|
|
|
+ @ApiMyResponse
|
|
|
public ResponseVO getFileTypeEnum() {
|
|
|
List list = new ArrayList<>();
|
|
|
for (FileTypeEnum fileTypeEnum : FileTypeEnum.values()) {
|
|
@@ -81,6 +109,15 @@ public class UploadFileLogController {
|
|
|
}
|
|
|
|
|
|
@PostMapping("/uploadFile")
|
|
|
+ @ApiOperation(value = "上传文件", httpMethod = "POST",
|
|
|
+ notes = "<p>返回ResponseVO对象</p>"
|
|
|
+ )
|
|
|
+ @ApiImplicitParams(value={
|
|
|
+ @ApiImplicitParam(name= "file",value = "文件",dataType="MultipartFile"),
|
|
|
+ @ApiImplicitParam(name= "uploadObject",value = "对象ID",dataType="String"),
|
|
|
+ @ApiImplicitParam(name= "FileTypeEnum",value = "文件类型",dataType="String"),
|
|
|
+ })
|
|
|
+ @ApiMyResponse
|
|
|
public ResponseVO uploadFile(@RequestParam("file") MultipartFile file, @RequestParam("uploadObject") String id, @RequestParam("FileTypeEnum") String fileType) {
|
|
|
Integer objectId = Integer.parseInt(id);
|
|
|
|
|
@@ -90,17 +127,29 @@ public class UploadFileLogController {
|
|
|
}else {
|
|
|
return ResponseVO.fail("上传失败!");
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
|
|
|
@DeleteMapping("/{id}")
|
|
|
+ @ApiOperation(value = "根据主键ID删除文件", httpMethod = "DELETE",
|
|
|
+ notes = "<p>返回ResponseVO对象</p>"
|
|
|
+ )
|
|
|
+ @ApiImplicitParams(value={
|
|
|
+ @ApiImplicitParam(name= "id",value = "主键ID",dataType="Integer")
|
|
|
+ })
|
|
|
+ @ApiMyResponse
|
|
|
public ResponseVO deleteById(@PathVariable("id") Integer id){
|
|
|
uploadFileLogService.deleteById(id);
|
|
|
return ResponseVO.success(1);
|
|
|
}
|
|
|
|
|
|
@PostMapping("/cleanCache")
|
|
|
+ @ApiOperation(value = "清楚文件缓存", httpMethod = "POST",
|
|
|
+ notes = "<p>返回ResponseVO对象</p>"
|
|
|
+ )
|
|
|
+ @ApiImplicitParams(value={
|
|
|
+ @ApiImplicitParam(name= "uploadFileLog",value = "UploadFileLog实体",dataType="UploadFileLog")
|
|
|
+ })
|
|
|
+ @ApiMyResponse
|
|
|
public ResponseVO cleanCache(@RequestBody UploadFileLog uploadFileLog){
|
|
|
uploadFileLogService.cleanCache(uploadFileLog);
|
|
|
return ResponseVO.success(1);
|
|
@@ -113,6 +162,13 @@ public class UploadFileLogController {
|
|
|
* @return
|
|
|
*/
|
|
|
@PostMapping("/report")
|
|
|
+ @ApiOperation(value = "文件补报", httpMethod = "POST",
|
|
|
+ notes = "<p>返回ResponseVO对象</p>"
|
|
|
+ )
|
|
|
+ @ApiImplicitParams(value={
|
|
|
+ @ApiImplicitParam(name= "uploadFileLog",value = "UploadFileLog实体",dataType="UploadFileLog")
|
|
|
+ })
|
|
|
+ @ApiMyResponse
|
|
|
public ResponseVO report(@RequestBody UploadFileLog uploadFileLog){
|
|
|
uploadFileLogService.report(uploadFileLog);
|
|
|
return ResponseVO.success(1);
|
|
@@ -124,6 +180,13 @@ public class UploadFileLogController {
|
|
|
* @return
|
|
|
*/
|
|
|
@PostMapping("/quickReport")
|
|
|
+ @ApiOperation(value = "一键文件补报", httpMethod = "POST",
|
|
|
+ notes = "<p>返回ResponseVO对象</p>"
|
|
|
+ )
|
|
|
+ @ApiImplicitParams(value={
|
|
|
+ @ApiImplicitParam(name= "uploadFileLogList",value = "UploadFileLog实体",dataType="List")
|
|
|
+ })
|
|
|
+ @ApiMyResponse
|
|
|
public ResponseVO quickReport(@RequestBody List<UploadFileLog> uploadFileLogList){
|
|
|
uploadFileLogService.quickReport(uploadFileLogList);
|
|
|
return ResponseVO.success(1);
|