【修改】判分时下载的文件带上文件的属性
This commit is contained in:
@@ -66,10 +66,10 @@ public class GetPointsController {
|
||||
return CommonResult.success(examGetPointsService.getPointById(quId));
|
||||
}
|
||||
/**
|
||||
* 新增/修改浏览器操作考点
|
||||
* 新增/修改浏览器/文件操作考点
|
||||
* @return 得分
|
||||
*/
|
||||
@Operation(summary = "新增/修改浏览器操作考点")
|
||||
@Operation(summary = "新增/修改浏览器/文件操作考点")
|
||||
@PostMapping("/set_browser_point")
|
||||
@TenantIgnore
|
||||
//老师自己设置,不读文件
|
||||
|
@@ -11,4 +11,5 @@ public class FileNode {
|
||||
private Long id;
|
||||
private String name;
|
||||
private Long parentId;
|
||||
private String attribute;
|
||||
}
|
||||
|
@@ -92,7 +92,7 @@ public class FileServericeImpl implements IFileServerice {
|
||||
// 如果学生提交中存在该文件,且属性匹配,则得分
|
||||
if (stuFiles.containsKey(filePath)) {
|
||||
String studentAttrs = stuFiles.get(filePath); // 学生提交的属性
|
||||
String expectedAttrs = answer.getScoreRate(); // 试题中期望的属性
|
||||
String expectedAttrs = answer.getAttribute(); // 试题中期望的属性
|
||||
isCorrect = studentAttrs.equals(expectedAttrs);
|
||||
}
|
||||
}
|
||||
|
@@ -89,6 +89,7 @@ public class ExamGetPointsServiceImpl implements ExamGetPointsService{
|
||||
answer.setContentIn("考察名称");
|
||||
} else if (value.startsWith("属性不同")) {
|
||||
answer.setContentIn("考察属性");
|
||||
answer.setAttribute(value.split(" vs ")[1]);
|
||||
// answer.setContent(key + " -> " + value.split(" vs ")[1]); // 设置属性信息
|
||||
}
|
||||
return answer;
|
||||
@@ -131,6 +132,7 @@ public class ExamGetPointsServiceImpl implements ExamGetPointsService{
|
||||
node.setId(currentId);
|
||||
node.setName(file.getName());
|
||||
node.setParentId(parentId);
|
||||
node.setAttribute(getFileAttributes(file)); // 设置属性
|
||||
list.add(node);
|
||||
|
||||
if (file.isDirectory()) {
|
||||
@@ -144,6 +146,24 @@ public class ExamGetPointsServiceImpl implements ExamGetPointsService{
|
||||
}
|
||||
|
||||
|
||||
private static String getFileAttributes(File file) {
|
||||
try {
|
||||
boolean isDirectory = file.isDirectory();
|
||||
boolean isHidden = file.isHidden();
|
||||
boolean isReadable = file.canRead();
|
||||
|
||||
if (isDirectory) {
|
||||
return String.format("隐藏: %b, 可读: %b", isHidden, isReadable);
|
||||
} else {
|
||||
boolean isWritable = file.canWrite();
|
||||
return String.format(" 隐藏: %b, 可读: %b, 可写: %b",
|
||||
isHidden, isReadable, isWritable);
|
||||
}
|
||||
} catch (SecurityException e) {
|
||||
return "无法获取属性";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -30,6 +30,7 @@ import pc.exam.pp.module.infra.service.file.FileService;
|
||||
import pc.exam.pp.module.judgement.controller.service.browser.IBrowserServerice;
|
||||
import pc.exam.pp.module.judgement.controller.service.file.IFileServerice;
|
||||
import pc.exam.pp.module.judgement.controller.service.mysql.IMysqlServerice;
|
||||
import pc.exam.pp.module.judgement.controller.utils.zip.ZipUtil;
|
||||
import pc.exam.pp.module.judgement.service.c_programming.JudgementService;
|
||||
import pc.exam.pp.module.judgement.service.choice.JudgementChoiceService;
|
||||
import pc.exam.pp.module.judgement.service.wps_excel.JudgementWpsExcelService;
|
||||
@@ -271,7 +272,7 @@ public class AutoToolsServiceImpl implements AutoToolsService{
|
||||
String patn = downloadStudentFile(stuPaperFileDO.getUrl(), config.getValue());
|
||||
File zip_file = new File(patn);
|
||||
// 4、获取到得是zip文件,需要解压
|
||||
String stuFilePath = unzipToNamedFolder(patn);
|
||||
String stuFilePath = ZipUtil.unzipToNamedFolder(patn);
|
||||
// 5、解压之后得文件获取文件夹和文件
|
||||
File folder = new File(stuFilePath);
|
||||
File[] files = folder.listFiles();
|
||||
|
Reference in New Issue
Block a user