|
|
@@ -20,8 +20,11 @@ import org.springframework.web.multipart.MultipartFile;
|
|
|
@RestController
|
|
|
@RequestMapping("/api/file")
|
|
|
public class FileController {
|
|
|
- @Autowired private FileService fileService;
|
|
|
+
|
|
|
+ @Autowired private FileService fileService;
|
|
|
+
|
|
|
@Autowired private CsvAdapter csvAdapter;
|
|
|
+
|
|
|
/**
|
|
|
*
|
|
|
* @param file
|
|
|
@@ -39,6 +42,14 @@ public class FileController {
|
|
|
return new ErrorRes();
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * @param userId
|
|
|
+ * @param fileLoc
|
|
|
+ * @param fileName
|
|
|
+ * @return
|
|
|
+ */
|
|
|
@GetMapping(value = "/upload/bigfile")
|
|
|
public Response bigFileUploader(@RequestParam(value="userId", required = false) String userId,
|
|
|
@RequestParam(value="fileLoc", required = false) String fileLoc,
|
|
|
@@ -53,16 +64,26 @@ public class FileController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * @param userId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
@GetMapping(value = "/get/all")
|
|
|
public Response getAll(@RequestParam(value="userId", required = false) String userId) {
|
|
|
try {
|
|
|
- System.out.println(userId);
|
|
|
return new NormalRes(fileService.getAllFiles(Integer.parseInt(userId)));
|
|
|
} catch (Exception e) {
|
|
|
log.info("error getAll");
|
|
|
return new ErrorRes();
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * @param userId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
@GetMapping(value = "/get/allfileandfunc")
|
|
|
public Response getAllFileAndFunc(@RequestParam(value="userId", required = false)String userId){
|
|
|
try {
|
|
|
@@ -74,7 +95,11 @@ public class FileController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * @param fileId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
@GetMapping(value = "/get/detail")
|
|
|
public Response getDetail(@RequestParam(value="fileId", required = false) String fileId){
|
|
|
try{
|
|
|
@@ -84,6 +109,12 @@ public class FileController {
|
|
|
return new ErrorRes();
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * @param fileId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
@GetMapping(value = "/analysis")
|
|
|
public Response analysis(@RequestParam(value="fileId", required = false) String fileId){
|
|
|
try{
|
|
|
@@ -127,23 +158,6 @@ public class FileController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- ///**
|
|
|
- // *
|
|
|
- // * @param nums
|
|
|
- // * @return
|
|
|
- // */
|
|
|
- //@GetMapping(value = "/analysis/test")
|
|
|
- //public Response analysis2(@RequestParam(value="nums", required = false) int nums){
|
|
|
- // try{
|
|
|
- // fileService.analysisTest(nums);
|
|
|
- // return new NormalRes();
|
|
|
- // } catch (Exception e){
|
|
|
- // log.info("error analysis2");
|
|
|
- // return new ErrorRes();
|
|
|
- // }
|
|
|
- //}
|
|
|
-
|
|
|
/**
|
|
|
*
|
|
|
* @param fileId
|
|
|
@@ -165,9 +179,7 @@ public class FileController {
|
|
|
* @return
|
|
|
*/
|
|
|
@PostMapping(value = "update")
|
|
|
- public Response updateFileInfo(
|
|
|
- @RequestBody HeaderInfoUpdatedPojo headerInfoUpdatedPojo
|
|
|
- ) {
|
|
|
+ public Response updateFileInfo(@RequestBody HeaderInfoUpdatedPojo headerInfoUpdatedPojo){
|
|
|
try {
|
|
|
boolean rsl = fileService.updateAllHeaders(headerInfoUpdatedPojo.getHeaderInfo(),headerInfoUpdatedPojo.getHeaderNeedUpdate());
|
|
|
return rsl? new NormalRes() : new ErrorRes(40002, "Server error.");
|
|
|
@@ -175,6 +187,5 @@ public class FileController {
|
|
|
log.info("error updateFileInfo");
|
|
|
return new ErrorRes();
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
}
|