Merge remote-tracking branch 'origin/master'

master
ArgonarioD 2022-07-08 13:56:19 +08:00
commit d6bf813e8b
2 changed files with 8 additions and 2 deletions

View File

@ -8,6 +8,7 @@ import cn.edu.hfut.rmdjzz.projectmanagement.utils.http.ResponseMap;
import io.swagger.v3.oas.annotations.Parameter;
import lombok.SneakyThrows;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.DigestUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
@ -43,14 +44,17 @@ public class StaffController {
@SneakyThrows
@PostMapping(value = "/staff/import")
public ResponseMap upload(@RequestHeader("Token") String token, @RequestParam("uploadFile") MultipartFile uploadFile) {
public ResponseMap upload(@RequestHeader("Token") String token, @RequestParam("uploadFile") MultipartFile uploadFile,@RequestParam("digest") String digest) {
if (null == uploadFile) {
throw new BadRequestException("空的文件参数");
throw new BadRequestException("文件传输错误");
}
String fileName = Objects.requireNonNull(uploadFile.getOriginalFilename()).toLowerCase();
if (!fileName.endsWith(".xlsx")) {
throw new BadRequestException("文件类型错误");
}
if(!Objects.equals(DigestUtils.md5DigestAsHex(uploadFile.getBytes()).toLowerCase(),digest.toLowerCase())){
throw new BadRequestException("文件传输错误");
}
Integer successCount = staffService.multiImport(token, uploadFile);
return ResponseMap.ofSuccess("成功导入" + successCount + "条数据");
}

View File

@ -100,6 +100,8 @@ public class Task {
return false;
if (father.getTaskId() == 0)
return true;
if(!father.getTaskStatus().equals(STATUS_WAITING)&&!father.getTaskStatus().equals(STATUS_PROCESSING))
return false;
if (this.getTaskType().equals(TYPE_DEFECT)) {
return father.getTaskType().equals(TYPE_DEMAND);
} else if (this.getTaskType().equals(TYPE_DEMAND)) {