优化
This commit is contained in:
@ -0,0 +1,42 @@
|
||||
package com.ruoyi.web.controller.bgt;
|
||||
|
||||
import com.ruoyi.bgt.domain.vo.BgtQuestionResult;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.wgz.service.IWgzQuestionSaveService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 用户试卷存储Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-02-17
|
||||
*/
|
||||
@Api(value = "包工头岗前培训", tags = {"包工头岗前培训"})
|
||||
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
||||
@RestController
|
||||
@RequestMapping("/bgt/question/")
|
||||
public class AppBgtQuestionSaveController extends BaseController {
|
||||
|
||||
private final IWgzQuestionSaveService iWgzQuestionSaveService;
|
||||
|
||||
/**
|
||||
* 查询用户试卷存储列表
|
||||
*/
|
||||
@ApiOperation("查询用户答题结果")
|
||||
@GetMapping("/getResult")
|
||||
public AjaxResult<BgtQuestionResult> getResult(Long userId) {
|
||||
return AjaxResult.success(iWgzQuestionSaveService.getResult(userId));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -78,7 +78,7 @@ public class UploadZipController {
|
||||
}
|
||||
|
||||
String username = bgtUser.getUsername();
|
||||
|
||||
String firstLevelFolderName ="";
|
||||
try {
|
||||
// 保存上传的压缩文件
|
||||
File zipFile = new File(TEMP_DIR, file.getOriginalFilename());
|
||||
@ -89,7 +89,7 @@ public class UploadZipController {
|
||||
|
||||
// 解压压缩文件
|
||||
BgtProjectRecruit recruit = recruitService.queryById(recruitId);
|
||||
String firstLevelFolderName = recruit.getId() + "_" + recruit.getRecruitName();
|
||||
firstLevelFolderName = recruit.getId() + "_" + recruit.getRecruitName();
|
||||
File extractDir = new File(TEMP_DIR, firstLevelFolderName);
|
||||
ensureDirectoryExists(extractDir);
|
||||
extractZipFile(zipFile, extractDir);
|
||||
@ -105,6 +105,9 @@ public class UploadZipController {
|
||||
|
||||
return AjaxResult.success("文件上传并处理成功");
|
||||
} catch (IOException e) {
|
||||
// 删除临时文件和文件夹
|
||||
File extractDir = new File(TEMP_DIR, firstLevelFolderName);
|
||||
deleteFolder(extractDir);
|
||||
e.printStackTrace();
|
||||
return AjaxResult.error("文件处理过程中出现错误");
|
||||
}
|
||||
|
Reference in New Issue
Block a user