import org.apache.poi.ss.usermodel.*;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
@RestController
public class FileImportController {
@PostMapping("/import")
public ResponseEntity<?> importFile(@RequestParam("file") MultipartFile file) {
// 进行文件校验
boolean isValid = validateFile(file);
if (isValid) {
// 文件校验通过,返回JSON报文
String jsonResponse = generateJsonResponse();
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
return new ResponseEntity<>(jsonRe