优化
This commit is contained in:
@ -13,6 +13,7 @@ import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import static com.ruoyi.common.constant.Constants.WGZ;
|
||||
@ -109,8 +110,9 @@ public class AnnexController extends BaseController {
|
||||
.eq(Annex::getRecruitId, recruitId)
|
||||
.eq(Annex::getUserId, userId)
|
||||
.eq(Annex::getUserType, WGZ)
|
||||
.eq(Annex::getAnnexType, annexType)
|
||||
);
|
||||
.eq(!"3".equals(annexType),Annex::getAnnexType, annexType)
|
||||
.in("3".equals(annexType),Annex::getAnnexType, Arrays.asList("1","2")
|
||||
));
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
}
|
||||
|
@ -5,9 +5,11 @@ import com.ruoyi.bgt.domain.BgtProjectRecruit;
|
||||
import com.ruoyi.bgt.service.IBgtProjectRecruitService;
|
||||
import com.ruoyi.bgt.service.IBgtUserService;
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.entity.BgtUser;
|
||||
import com.ruoyi.common.domain.Annex;
|
||||
import com.ruoyi.common.domain.AnnexRecord;
|
||||
import com.ruoyi.common.exception.BaseException;
|
||||
import com.ruoyi.common.service.IAnnexRecordService;
|
||||
import com.ruoyi.common.service.IAnnexService;
|
||||
import com.ruoyi.wgz.domain.WgzUser;
|
||||
@ -16,7 +18,6 @@ import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
@ -57,18 +58,23 @@ public class UploadZipController {
|
||||
|
||||
@ApiOperation("上传压缩文件")
|
||||
@PostMapping("/upload-zip")
|
||||
public ResponseEntity<String> uploadZipFile(@RequestParam("file") MultipartFile file, @RequestParam("recruitId") Long recruitId, @RequestParam("userId") Long userId) {
|
||||
public AjaxResult<Void> uploadZipFile(@RequestParam("file") MultipartFile file, @RequestParam("recruitId") Long recruitId, @RequestParam("userId") Long userId) {
|
||||
if (file.isEmpty()) {
|
||||
return ResponseEntity.badRequest().body("上传的文件为空");
|
||||
throw new BaseException("上传的文件为空!");
|
||||
}
|
||||
|
||||
String originalFilename = file.getOriginalFilename();
|
||||
if (originalFilename == null || !originalFilename.toLowerCase().endsWith(".zip")) {
|
||||
throw new BaseException("上传的文件不是有效的 ZIP 文件!");
|
||||
}
|
||||
|
||||
if(recruitService.queryById(recruitId) == null){
|
||||
return ResponseEntity.badRequest().body("招工信息不存在");
|
||||
throw new BaseException("招工信息不存在!");
|
||||
}
|
||||
|
||||
BgtUser bgtUser = bgtUserService.selectUserByUserId(userId);
|
||||
if (bgtUser == null){
|
||||
return ResponseEntity.badRequest().body("当前用户不存在!");
|
||||
throw new BaseException("当前用户不存在!");
|
||||
}
|
||||
|
||||
String username = bgtUser.getUsername();
|
||||
@ -97,10 +103,10 @@ public class UploadZipController {
|
||||
// 异步执行 RECORD_DIR 操作和删除临时文件操作
|
||||
asyncProcessRecordAndDeleteTemp(extractDir, zipFile, recruitId,username,userId);
|
||||
|
||||
return ResponseEntity.ok("文件上传并处理成功");
|
||||
return AjaxResult.success("文件上传并处理成功");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return ResponseEntity.status(500).body("文件处理过程中出现错误: " + e.getMessage());
|
||||
return AjaxResult.error("文件处理过程中出现错误");
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user