diff --git a/src/main/java/com/sof_eng/Controller/ExperimentController.java b/src/main/java/com/sof_eng/Controller/ExperimentController.java index 732531cb95724cc247da6f6101fda326abdb227d..a0c51b25e69290a39019213be823e0e90f2b3082 100644 --- a/src/main/java/com/sof_eng/Controller/ExperimentController.java +++ b/src/main/java/com/sof_eng/Controller/ExperimentController.java @@ -218,7 +218,7 @@ public class ExperimentController { */ @CrossOrigin @PostMapping("/uploadParticipant") - public CommonResult uploadParticipant(@RequestPart("expId") Long expId, @RequestPart("file") MultipartFile file,@RequestHeader("Authorization") String authHeader){ + public CommonResult uploadParticipant(@RequestParam("expId") Long expId, @RequestPart("file") MultipartFile file,@RequestHeader("Authorization") String authHeader){ //验证expId Experiment experiment = experimentService.getExperimentById(expId); if(experiment == null){ @@ -245,7 +245,13 @@ public class ExperimentController { for (Row row : sheet) { // 获取参与者信息,假设参与者信息在第一列(索引为0) Cell participantCell = row.getCell(0); - String participant = participantCell.getStringCellValue(); + + String participant; + try { + participant = participantCell.getStringCellValue(); + }catch(Exception e) { + participant = String.valueOf(participantCell.getNumericCellValue()); + } User user = userService.getUserByName(participant); if(user == null){