【修改】 pptx、word出题BUG修改

This commit is contained in:
DESKTOP-932OMT8\REN
2025-06-04 14:49:04 +08:00
parent 0ab28b6d88
commit a5dd5b58c4
3 changed files with 41 additions and 14 deletions

View File

@@ -5,12 +5,13 @@ import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import pc.exam.pp.framework.mybatis.core.dataobject.BaseDO;
import pc.exam.pp.framework.tenant.core.db.TenantBaseDO;
@TableName("exam_specialty")
@Data
@EqualsAndHashCode(callSuper = true)
public class ExamSpecialty extends TenantBaseDO {
public class ExamSpecialty extends BaseDO {
private static final long serialVersionUID = 1L;
/** id */

View File

@@ -20,12 +20,19 @@ import pc.exam.pp.module.judgement.utils.wps_pptx.vo.PptxInfoReqVo;
import pc.exam.pp.module.judgement.utils.wps_pptx.vo.PptxVO;
import pc.exam.pp.module.judgement.utils.wps_word.WpsWordUtils;
import pc.exam.pp.module.judgement.utils.wps_word.vo.WordVO;
import pc.exam.pp.module.system.dal.dataobject.user.AdminUserDO;
import pc.exam.pp.module.system.service.user.AdminUserService;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import static pc.exam.pp.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
/**
* @author REN
*/
@@ -41,6 +48,9 @@ public class JudgementWpsPptxServiceImpl implements JudgementWpsPptxService {
@Resource
WpsPptxLinkMapper wpsPptxLinkMapper;
@Resource
private AdminUserService userService;
@Override
public List<WpsPptxJudgementDto> getWpsPptxInfo(List<PptxInfoPointsVo> pptxInfoPointsVos) throws IOException {
List<WpsPptxJudgementDto> judgementDtos = WpsPptxUtils.getWpsPptxInfos(pptxInfoPointsVos);
@@ -49,10 +59,18 @@ public class JudgementWpsPptxServiceImpl implements JudgementWpsPptxService {
@Override
public List<PptxInfoReqVo> programmingWpsPptx(String path) throws Exception {
String pathName = "";
String[] strPaht = path.split("/");
// 1、获取文件临时下载路径
ConfigDO config = configService.getConfigByKey("file_down_wps_pptx_path");
// 2、下载文件并返回文件完整路径
String pathName = autoToolsService.downloadStudentFile(path, config.getValue() + "\\" + WpsWordUtils.getStringRandom());
AdminUserDO user = userService.getUser(getLoginUserId());
Path paths = Paths.get(config.getValue() + "\\" + user.getId());
if (Files.exists(paths)) {
pathName = config.getValue() + "\\" + user.getId() + "\\" + strPaht[strPaht.length - 1];
} else {
// 2、下载文件并返回文件完整路径
pathName = autoToolsService.downloadStudentFile(path, config.getValue() + "\\" + user.getId());
}
// 4、pptx文件读取并返回考点及说明信息
// List<PptxVO> margins = WpsPptxUtils.wpsPptx(pathName, paragraphList);
List<PptxInfoReqVo> pptxInfoList = WpsPptxUtils.wpsPptxInfo(pathName);

View File

@@ -19,11 +19,18 @@ import pc.exam.pp.module.judgement.service.auto_tools.AutoToolsService;
import pc.exam.pp.module.judgement.utils.wps_word.WpsWordUtils;
import pc.exam.pp.module.judgement.utils.wps_word.vo.WordInfoReqVo;
import pc.exam.pp.module.judgement.utils.wps_word.vo.WordVO;
import pc.exam.pp.module.system.dal.dataobject.user.AdminUserDO;
import pc.exam.pp.module.system.service.user.AdminUserService;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import static pc.exam.pp.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
@Service
public class JudgementWpsWordServiceImpl implements JudgementWpsWordService {
@@ -35,22 +42,23 @@ public class JudgementWpsWordServiceImpl implements JudgementWpsWordService {
@Resource
ConfigService configService;
@Resource
private AdminUserService userService;
@Override
public List<WordInfoReqVo> programmingWpsWord(String path) throws Exception {
String pathName = "";
String[] strPaht = path.split("/");
// 1、获取文件临时下载路径
ConfigDO config = configService.getConfigByKey("file_down_wps_word_path");
// 2、下载文件并返回文件完整路径
String pathName = autoToolsService.downloadStudentFile(path, config.getValue() + "\\" + WpsWordUtils.getStringRandom());
// 3、创建word考点tree
// WordListReqVO wordListReqVO = new WordListReqVO();
// wordListReqVO.setBelongTo(0);
// // 3-1、查询段落的标签
// List<WpsWordLinkDO> paragraphList = wpsWordLinkMapper.selectList(wordListReqVO);
// // 3-2、查询锚点的标签
// wordListReqVO.setBelongTo(3);
// List<WpsWordLinkDO> anchorList = wpsWordLinkMapper.selectList(wordListReqVO);
AdminUserDO user = userService.getUser(getLoginUserId());
Path paths = Paths.get(config.getValue() + "\\" + user.getId());
if (Files.exists(paths)) {
pathName = config.getValue() + "\\" + user.getId() + "\\" + strPaht[strPaht.length - 1];
} else {
// 2、下载文件并返回文件完整路径
pathName = autoToolsService.downloadStudentFile(path, config.getValue() + "\\" + user.getId());
}
// 4、docx文件读取并返回考点及说明信息
List<WordInfoReqVo> margins = WpsWordUtils.wpWord(pathName);
// 5、已经读取完得考点删除源文件