From 1bf1367bd633b73611bb17b2e3339ffa1a871709 Mon Sep 17 00:00:00 2001 From: "DESKTOP-932OMT8\\REN" Date: Wed, 14 May 2025 17:23:03 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E6=96=B0=E5=A2=9E=E3=80=91=201?= =?UTF-8?q?=E3=80=81xlsx=EF=BC=8Cpptx=E5=AF=B9=E5=BA=94=E5=85=B3=E7=B3=BB?= =?UTF-8?q?=E6=96=B9=E6=B3=95=202=E3=80=81=E7=AE=80=E5=8D=95=E5=A4=84?= =?UTF-8?q?=E7=90=86xlsx=E4=B8=8Epptx=20=E5=8E=9F=E5=A7=8Bxml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/admin/Wps/PptxController.java | 75 ++++++ .../controller/admin/Wps/WordController.java | 2 +- .../controller/admin/Wps/WpsController.java | 36 +-- .../controller/admin/Wps/XlsxController.java | 75 ++++++ .../admin/Wps/vo/PptxListReqVO.java | 21 ++ .../controller/admin/Wps/vo/PptxRespVO.java | 40 +++ .../admin/Wps/vo/PptxSaveReqVO.java | 46 ++++ .../admin/Wps/vo/PptxSimpleRespVO.java | 27 +++ .../admin/Wps/vo/XlsxListReqVO.java | 21 ++ .../controller/admin/Wps/vo/XlsxRespVO.java | 40 +++ .../admin/Wps/vo/XlsxSaveReqVO.java | 46 ++++ .../admin/Wps/vo/XlsxSimpleRespVO.java | 27 +++ .../dal/dataobject/wpspptx/WpsPptxLinkDO.java | 67 +++++ .../dal/dataobject/wpsxlsx/WpsXlsxLinkDO.java | 67 +++++ .../dal/mysql/wpspptx/WpsPptxLinkMapper.java | 37 +++ .../dal/mysql/wpsxlsx/WpsXlsxLinkMapper.java | 37 +++ .../wps_excel/JudgementWpsExcelService.java | 3 +- .../JudgementWpsExcelServiceImpl.java | 36 +-- .../service/wps_excel/WpsXlsxLinkService.java | 115 +++++++++ .../wps_excel/WpsXlsxLinkServiceImpl.java | 228 ++++++++++++++++++ .../wps_pptx/JudgementWpsPptxService.java | 13 + .../wps_pptx/JudgementWpsPptxServiceImpl.java | 52 ++++ .../service/wps_pptx/WpsPptxLinkService.java | 112 +++++++++ .../wps_pptx/WpsPptxLinkServiceImpl.java | 227 +++++++++++++++++ .../wps_word/JudgementWpsWordService.java | 6 +- .../wps_word/JudgementWpsWordServiceImpl.java | 3 +- .../wps_word/WpsWordLinkServiceImpl.java | 2 +- .../judgement/utils/tree/TreeUtils.java | 47 ++++ .../utils/wps_excel/WpsExcelUtils.java | 59 +++-- .../judgement/utils/wps_excel/vo/XlsxVO.java | 26 ++ .../utils/wps_pptx/WpsPptxUtils.java | 182 ++++++++++++++ .../judgement/utils/wps_pptx/vo/PptxVO.java | 26 ++ .../utils/wps_word/WpsWordUtils.java | 5 + .../mapper/wpspptx/WpsPptxLinkMapper.xml | 28 +++ .../mapper/wpsword/WpsWordLinkMapper.xml | 28 +++ .../mapper/wpsxlsx/WpsXlsxLinkMapper.xml | 28 +++ .../system/enums/ErrorCodeConstants.java | 18 ++ .../system/dal/redis/RedisKeyConstants.java | 14 ++ 38 files changed, 1863 insertions(+), 59 deletions(-) create mode 100644 exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/admin/Wps/PptxController.java create mode 100644 exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/admin/Wps/XlsxController.java create mode 100644 exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/admin/Wps/vo/PptxListReqVO.java create mode 100644 exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/admin/Wps/vo/PptxRespVO.java create mode 100644 exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/admin/Wps/vo/PptxSaveReqVO.java create mode 100644 exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/admin/Wps/vo/PptxSimpleRespVO.java create mode 100644 exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/admin/Wps/vo/XlsxListReqVO.java create mode 100644 exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/admin/Wps/vo/XlsxRespVO.java create mode 100644 exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/admin/Wps/vo/XlsxSaveReqVO.java create mode 100644 exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/admin/Wps/vo/XlsxSimpleRespVO.java create mode 100644 exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/dal/dataobject/wpspptx/WpsPptxLinkDO.java create mode 100644 exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/dal/dataobject/wpsxlsx/WpsXlsxLinkDO.java create mode 100644 exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/dal/mysql/wpspptx/WpsPptxLinkMapper.java create mode 100644 exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/dal/mysql/wpsxlsx/WpsXlsxLinkMapper.java create mode 100644 exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/wps_excel/WpsXlsxLinkService.java create mode 100644 exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/wps_excel/WpsXlsxLinkServiceImpl.java create mode 100644 exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/wps_pptx/JudgementWpsPptxService.java create mode 100644 exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/wps_pptx/JudgementWpsPptxServiceImpl.java create mode 100644 exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/wps_pptx/WpsPptxLinkService.java create mode 100644 exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/wps_pptx/WpsPptxLinkServiceImpl.java create mode 100644 exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/utils/wps_excel/vo/XlsxVO.java create mode 100644 exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/utils/wps_pptx/WpsPptxUtils.java create mode 100644 exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/utils/wps_pptx/vo/PptxVO.java create mode 100644 exam-module-judgement/exam-module-judgement-biz/src/main/resources/mapper/wpspptx/WpsPptxLinkMapper.xml create mode 100644 exam-module-judgement/exam-module-judgement-biz/src/main/resources/mapper/wpsword/WpsWordLinkMapper.xml create mode 100644 exam-module-judgement/exam-module-judgement-biz/src/main/resources/mapper/wpsxlsx/WpsXlsxLinkMapper.xml diff --git a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/admin/Wps/PptxController.java b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/admin/Wps/PptxController.java new file mode 100644 index 00000000..e9f8a398 --- /dev/null +++ b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/admin/Wps/PptxController.java @@ -0,0 +1,75 @@ +package pc.exam.pp.module.judgement.controller.admin.Wps; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.annotation.Resource; +import jakarta.validation.Valid; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import pc.exam.pp.framework.common.enums.CommonStatusEnum; +import pc.exam.pp.framework.common.pojo.CommonResult; +import pc.exam.pp.framework.common.util.object.BeanUtils; +import pc.exam.pp.module.judgement.controller.admin.Wps.vo.*; +import pc.exam.pp.module.judgement.dal.dataobject.wpspptx.WpsPptxLinkDO; +import pc.exam.pp.module.judgement.service.wps_pptx.WpsPptxLinkService; + +import java.util.List; + +import static pc.exam.pp.framework.common.pojo.CommonResult.success; + +@Tag(name = "管理后台 - wps_pptx") +@RestController +@RequestMapping("/wps/pptx") +@Validated +public class PptxController { + + @Resource + private WpsPptxLinkService wpsPptxLinkService; + + @PostMapping("create") + @Operation(summary = "创建wps_pptx") + public CommonResult createPptx(@Valid @RequestBody PptxSaveReqVO createReqVO) { + Long pptxId = wpsPptxLinkService.createPptx(createReqVO); + return success(pptxId); + } + + @PutMapping("update") + @Operation(summary = "更新wps_pptx") + public CommonResult updatePptx(@Valid @RequestBody PptxSaveReqVO updateReqVO) { + wpsPptxLinkService.updatePptx(updateReqVO); + return success(true); + } + + @DeleteMapping("delete") + @Operation(summary = "删除wps_pptx") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + public CommonResult deletePptx(@RequestParam("id") Long id) { + wpsPptxLinkService.deletePptx(id); + return success(true); + } + + @GetMapping("/list") + @Operation(summary = "获取wps_pptx列表") + public CommonResult> getPptxList(PptxListReqVO reqVO) { + List list = wpsPptxLinkService.getPptxList(reqVO); + return success(BeanUtils.toBean(list, PptxRespVO.class)); + } + + @GetMapping(value = {"/list-all-simple", "/simple-list"}) + @Operation(summary = "获取wps_pptx精简信息列表", description = "只包含被开启的wps_pptx,主要用于前端的下拉选项") + public CommonResult> getSimplePptxList() { + List list = wpsPptxLinkService.getPptxList( + new PptxListReqVO().setStatus(CommonStatusEnum.ENABLE.getStatus())); + return success(BeanUtils.toBean(list, PptxSimpleRespVO.class)); + } + + @GetMapping("/get") + @Operation(summary = "获得wps_pptx信息") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + public CommonResult getPptx(@RequestParam("id") Long id) { + WpsPptxLinkDO pptx = wpsPptxLinkService.getPptx(id); + return success(BeanUtils.toBean(pptx, PptxRespVO.class)); + } + +} diff --git a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/admin/Wps/WordController.java b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/admin/Wps/WordController.java index 267fbc29..956e9d0b 100644 --- a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/admin/Wps/WordController.java +++ b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/admin/Wps/WordController.java @@ -70,7 +70,7 @@ public class WordController { @GetMapping("/get") @Operation(summary = "获得wps_word信息") @Parameter(name = "id", description = "编号", required = true, example = "1024") - public CommonResult getDept(@RequestParam("id") Long id) { + public CommonResult getWord(@RequestParam("id") Long id) { WpsWordLinkDO word = wpsWordLinkService.getWord(id); return success(BeanUtils.toBean(word, WordRespVO.class)); } diff --git a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/admin/Wps/WpsController.java b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/admin/Wps/WpsController.java index b40d3d36..5103d572 100644 --- a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/admin/Wps/WpsController.java +++ b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/admin/Wps/WpsController.java @@ -1,13 +1,18 @@ package pc.exam.pp.module.judgement.controller.admin.Wps; import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.annotation.Resource; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import pc.exam.pp.framework.common.pojo.CommonResult; +import pc.exam.pp.module.judgement.service.wps_excel.JudgementWpsExcelService; +import pc.exam.pp.module.judgement.service.wps_pptx.JudgementWpsPptxService; import pc.exam.pp.module.judgement.service.wps_word.JudgementWpsWordService; +import pc.exam.pp.module.judgement.utils.wps_excel.vo.XlsxVO; +import pc.exam.pp.module.judgement.utils.wps_pptx.vo.PptxVO; import pc.exam.pp.module.judgement.utils.wps_word.vo.WordVO; import java.util.List; @@ -15,41 +20,44 @@ import java.util.List; /** * wps word * rwb + * @author REN */ @RestController @RequestMapping("/tool/wps") @Tag( name = "wps相关操作") @Validated -public class WpsWordController { +public class WpsController { - @Autowired - private JudgementWpsWordService judgementWpsWordService; -// @Resource -// JudgementWpsExcelService judgementWpsExcelService; + @Resource + JudgementWpsWordService judgementWpsWordService; + @Resource + JudgementWpsPptxService judgementWpsPptxService; + @Resource + JudgementWpsExcelService judgementWpsExcelService; /** * wps word * @return 判分 */ @GetMapping("/run_wps_word") public CommonResult> run_wps_word(String path) throws Exception { - return CommonResult.success(judgementWpsWordService.ProgrammingWpsWord(path)); + return CommonResult.success(judgementWpsWordService.programmingWpsWord(path)); } /** * wps pptx * @return 判分 */ - @GetMapping("/run_wps_word") - public CommonResult run_wps_pptx(String path) throws Exception { - return CommonResult.success(judgementWpsWordService.ProgrammingWpsPptx(path)); + @GetMapping("/run_wps_pptx") + public CommonResult> run_wps_pptx(String path) throws Exception { + return CommonResult.success(judgementWpsPptxService.programmingWpsPptx(path)); } /** - * wps word + * wps xlsx * @return 判分 */ -// @GetMapping("/run_wps_excel") -// public CommonResult run_wps_excel(String path) throws Exception { -// return CommonResult.success(judgementWpsExcelService.ProgrammingWpsExcel(path)); -// } + @GetMapping("/run_wps_xlsx") + public CommonResult> run_wps_xlsx(String path) { + return CommonResult.success(judgementWpsExcelService.programmingWpsExcel(path)); + } } diff --git a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/admin/Wps/XlsxController.java b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/admin/Wps/XlsxController.java new file mode 100644 index 00000000..432c51e4 --- /dev/null +++ b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/admin/Wps/XlsxController.java @@ -0,0 +1,75 @@ +package pc.exam.pp.module.judgement.controller.admin.Wps; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.annotation.Resource; +import jakarta.validation.Valid; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import pc.exam.pp.framework.common.enums.CommonStatusEnum; +import pc.exam.pp.framework.common.pojo.CommonResult; +import pc.exam.pp.framework.common.util.object.BeanUtils; +import pc.exam.pp.module.judgement.controller.admin.Wps.vo.*; +import pc.exam.pp.module.judgement.dal.dataobject.wpsxlsx.WpsXlsxLinkDO; +import pc.exam.pp.module.judgement.service.wps_excel.WpsXlsxLinkService; + +import java.util.List; + +import static pc.exam.pp.framework.common.pojo.CommonResult.success; + +@Tag(name = "管理后台 - wps_xlsx") +@RestController +@RequestMapping("/wps/xlsx") +@Validated +public class XlsxController { + + @Resource + private WpsXlsxLinkService wpsXlsxLinkService; + + @PostMapping("create") + @Operation(summary = "创建wps_xlsx") + public CommonResult createXlsx(@Valid @RequestBody XlsxSaveReqVO createReqVO) { + Long xlsxId = wpsXlsxLinkService.createXlsx(createReqVO); + return success(xlsxId); + } + + @PutMapping("update") + @Operation(summary = "更新wps_xlsx") + public CommonResult updateXlsx(@Valid @RequestBody XlsxSaveReqVO updateReqVO) { + wpsXlsxLinkService.updateXlsx(updateReqVO); + return success(true); + } + + @DeleteMapping("delete") + @Operation(summary = "删除wps_xlsx") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + public CommonResult deleteXlsx(@RequestParam("id") Long id) { + wpsXlsxLinkService.deleteXlsx(id); + return success(true); + } + + @GetMapping("/list") + @Operation(summary = "获取wps_xlsx列表") + public CommonResult> getXlsxList(XlsxListReqVO reqVO) { + List list = wpsXlsxLinkService.getXlsxList(reqVO); + return success(BeanUtils.toBean(list, XlsxRespVO.class)); + } + + @GetMapping(value = {"/list-all-simple", "/simple-list"}) + @Operation(summary = "获取wps_xlsx精简信息列表", description = "只包含被开启的wps_xlsx,主要用于前端的下拉选项") + public CommonResult> getSimpleXlsxList() { + List list = wpsXlsxLinkService.getXlsxList( + new XlsxListReqVO().setStatus(CommonStatusEnum.ENABLE.getStatus())); + return success(BeanUtils.toBean(list, XlsxSimpleRespVO.class)); + } + + @GetMapping("/get") + @Operation(summary = "获得wps_xlsx信息") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + public CommonResult getPptx(@RequestParam("id") Long id) { + WpsXlsxLinkDO xlsx = wpsXlsxLinkService.getXlsx(id); + return success(BeanUtils.toBean(xlsx, XlsxRespVO.class)); + } + +} diff --git a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/admin/Wps/vo/PptxListReqVO.java b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/admin/Wps/vo/PptxListReqVO.java new file mode 100644 index 00000000..030ff281 --- /dev/null +++ b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/admin/Wps/vo/PptxListReqVO.java @@ -0,0 +1,21 @@ +package pc.exam.pp.module.judgement.controller.admin.Wps.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Schema(description = "管理后台 - WpsWord对应关系 Request VO") +@Data +public class PptxListReqVO { + + @Schema(description = "节点名称模糊匹配", example = "芋道") + private String name; + + @Schema(description = "展示状态,参见 CommonStatusEnum 枚举类", example = "1") + private Integer status; + /** + * 类型 + */ + private Integer type; + + private Integer belongTo; +} diff --git a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/admin/Wps/vo/PptxRespVO.java b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/admin/Wps/vo/PptxRespVO.java new file mode 100644 index 00000000..ca1ae599 --- /dev/null +++ b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/admin/Wps/vo/PptxRespVO.java @@ -0,0 +1,40 @@ +package pc.exam.pp.module.judgement.controller.admin.Wps.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Schema(description = "管理后台 - 节点信息 Response VO") +@Data +public class PptxRespVO { + + @Schema(description = "节点编号", example = "1024") + private Long id; + + @Schema(description = "节点名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道") + private String name; + + @Schema(description = "父节点 ID", example = "1024") + private Long parentId; + + @Schema(description = "显示顺序", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") + private Integer sort; + + @Schema(description = "节点方法") + private String nodeFunction; + + @Schema(description = "转中文") + private String toChinese; + + @Schema(description = "状态,见 CommonStatusEnum 枚举", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + private Integer status; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "时间戳格式") + private LocalDateTime createTime; + /** + * 类型 + */ + private Integer type; + private Integer belongTo; +} diff --git a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/admin/Wps/vo/PptxSaveReqVO.java b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/admin/Wps/vo/PptxSaveReqVO.java new file mode 100644 index 00000000..1ea85332 --- /dev/null +++ b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/admin/Wps/vo/PptxSaveReqVO.java @@ -0,0 +1,46 @@ +package pc.exam.pp.module.judgement.controller.admin.Wps.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; +import lombok.Data; +import pc.exam.pp.framework.common.enums.CommonStatusEnum; +import pc.exam.pp.framework.common.validation.InEnum; + +@Schema(description = "管理后台 - 节点创建/修改 Request VO") +@Data +public class PptxSaveReqVO { + + @Schema(description = "节点编号", example = "1024") + private Long id; + + @Schema(description = "节点名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道") + @NotBlank(message = "节点名称不能为空") + @Size(max = 30, message = "节点名称长度不能超过 30 个字符") + private String name; + /** + * 类型 + */ + private Integer type; + private Integer belongTo; + + @Schema(description = "父节点 ID", example = "1024") + private Long parentId; + + @Schema(description = "显示顺序", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") + @NotNull(message = "显示顺序不能为空") + private Integer sort; + + @Schema(description = "节点方法") + private String nodeFunction; + + @Schema(description = "转中文") + private String toChinese; + + @Schema(description = "状态,见 CommonStatusEnum 枚举", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @NotNull(message = "状态不能为空") + @InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}") + private Integer status; + +} diff --git a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/admin/Wps/vo/PptxSimpleRespVO.java b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/admin/Wps/vo/PptxSimpleRespVO.java new file mode 100644 index 00000000..a7432e28 --- /dev/null +++ b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/admin/Wps/vo/PptxSimpleRespVO.java @@ -0,0 +1,27 @@ +package pc.exam.pp.module.judgement.controller.admin.Wps.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Schema(description = "管理后台 - 节点精简信息 Response VO") +@Data +@NoArgsConstructor +@AllArgsConstructor +public class PptxSimpleRespVO { + + @Schema(description = "节点编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") + private Long id; + + @Schema(description = "节点名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道") + private String name; + + @Schema(description = "父节点 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") + private Long parentId; + /** + * 类型 + */ + private Integer type; + private Integer belongTo; +} diff --git a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/admin/Wps/vo/XlsxListReqVO.java b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/admin/Wps/vo/XlsxListReqVO.java new file mode 100644 index 00000000..18502ffe --- /dev/null +++ b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/admin/Wps/vo/XlsxListReqVO.java @@ -0,0 +1,21 @@ +package pc.exam.pp.module.judgement.controller.admin.Wps.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Schema(description = "管理后台 - WpsWord对应关系 Request VO") +@Data +public class XlsxListReqVO { + + @Schema(description = "节点名称模糊匹配", example = "芋道") + private String name; + + @Schema(description = "展示状态,参见 CommonStatusEnum 枚举类", example = "1") + private Integer status; + /** + * 类型 + */ + private Integer type; + + private Integer belongTo; +} diff --git a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/admin/Wps/vo/XlsxRespVO.java b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/admin/Wps/vo/XlsxRespVO.java new file mode 100644 index 00000000..cf7e1262 --- /dev/null +++ b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/admin/Wps/vo/XlsxRespVO.java @@ -0,0 +1,40 @@ +package pc.exam.pp.module.judgement.controller.admin.Wps.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Schema(description = "管理后台 - 节点信息 Response VO") +@Data +public class XlsxRespVO { + + @Schema(description = "节点编号", example = "1024") + private Long id; + + @Schema(description = "节点名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道") + private String name; + + @Schema(description = "父节点 ID", example = "1024") + private Long parentId; + + @Schema(description = "显示顺序", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") + private Integer sort; + + @Schema(description = "节点方法") + private String nodeFunction; + + @Schema(description = "转中文") + private String toChinese; + + @Schema(description = "状态,见 CommonStatusEnum 枚举", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + private Integer status; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "时间戳格式") + private LocalDateTime createTime; + /** + * 类型 + */ + private Integer type; + private Integer belongTo; +} diff --git a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/admin/Wps/vo/XlsxSaveReqVO.java b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/admin/Wps/vo/XlsxSaveReqVO.java new file mode 100644 index 00000000..9157c9ee --- /dev/null +++ b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/admin/Wps/vo/XlsxSaveReqVO.java @@ -0,0 +1,46 @@ +package pc.exam.pp.module.judgement.controller.admin.Wps.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; +import lombok.Data; +import pc.exam.pp.framework.common.enums.CommonStatusEnum; +import pc.exam.pp.framework.common.validation.InEnum; + +@Schema(description = "管理后台 - 节点创建/修改 Request VO") +@Data +public class XlsxSaveReqVO { + + @Schema(description = "节点编号", example = "1024") + private Long id; + + @Schema(description = "节点名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道") + @NotBlank(message = "节点名称不能为空") + @Size(max = 30, message = "节点名称长度不能超过 30 个字符") + private String name; + /** + * 类型 + */ + private Integer type; + private Integer belongTo; + + @Schema(description = "父节点 ID", example = "1024") + private Long parentId; + + @Schema(description = "显示顺序", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") + @NotNull(message = "显示顺序不能为空") + private Integer sort; + + @Schema(description = "节点方法") + private String nodeFunction; + + @Schema(description = "转中文") + private String toChinese; + + @Schema(description = "状态,见 CommonStatusEnum 枚举", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @NotNull(message = "状态不能为空") + @InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}") + private Integer status; + +} diff --git a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/admin/Wps/vo/XlsxSimpleRespVO.java b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/admin/Wps/vo/XlsxSimpleRespVO.java new file mode 100644 index 00000000..ce72483d --- /dev/null +++ b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/admin/Wps/vo/XlsxSimpleRespVO.java @@ -0,0 +1,27 @@ +package pc.exam.pp.module.judgement.controller.admin.Wps.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Schema(description = "管理后台 - 节点精简信息 Response VO") +@Data +@NoArgsConstructor +@AllArgsConstructor +public class XlsxSimpleRespVO { + + @Schema(description = "节点编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") + private Long id; + + @Schema(description = "节点名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道") + private String name; + + @Schema(description = "父节点 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") + private Long parentId; + /** + * 类型 + */ + private Integer type; + private Integer belongTo; +} diff --git a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/dal/dataobject/wpspptx/WpsPptxLinkDO.java b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/dal/dataobject/wpspptx/WpsPptxLinkDO.java new file mode 100644 index 00000000..5ab774fe --- /dev/null +++ b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/dal/dataobject/wpspptx/WpsPptxLinkDO.java @@ -0,0 +1,67 @@ +package pc.exam.pp.module.judgement.dal.dataobject.wpspptx; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; +import pc.exam.pp.framework.common.enums.CommonStatusEnum; +import pc.exam.pp.framework.tenant.core.db.TenantBaseDO; + +import java.util.ArrayList; +import java.util.List; + +/** + * wps pptx关系对应表 + * + * @author REN + */ +@TableName("wps_pptx_link") +@Data +@EqualsAndHashCode(callSuper = true) +public class WpsPptxLinkDO extends TenantBaseDO { + + public static final Long PARENT_ID_ROOT = 0L; + + /** + * 部门ID + */ + @TableId + private Long id; + /** + * 部门名称 + */ + private String name; + /** + * 父部门ID + * + * 关联 {@link #id} + */ + private Long parentId; + /** + * 显示顺序 + */ + private Integer sort; + /** + * 节点功能 + */ + private String nodeFunction; + /** + * 中文描述 + */ + private String toChinese; + /** + * 状态 + * + * 枚举 {@link CommonStatusEnum} + */ + private Integer status; + /** + * 类型 + */ + private Integer type; + private String belongTo; + + @TableField(exist = false) + private List children = new ArrayList<>(); +} diff --git a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/dal/dataobject/wpsxlsx/WpsXlsxLinkDO.java b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/dal/dataobject/wpsxlsx/WpsXlsxLinkDO.java new file mode 100644 index 00000000..8dec3f21 --- /dev/null +++ b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/dal/dataobject/wpsxlsx/WpsXlsxLinkDO.java @@ -0,0 +1,67 @@ +package pc.exam.pp.module.judgement.dal.dataobject.wpsxlsx; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; +import pc.exam.pp.framework.common.enums.CommonStatusEnum; +import pc.exam.pp.framework.tenant.core.db.TenantBaseDO; + +import java.util.ArrayList; +import java.util.List; + +/** + * wps xlsx关系对应表 + * + * @author REN + */ +@TableName("wps_xlsx_link") +@Data +@EqualsAndHashCode(callSuper = true) +public class WpsXlsxLinkDO extends TenantBaseDO { + + public static final Long PARENT_ID_ROOT = 0L; + + /** + * 部门ID + */ + @TableId + private Long id; + /** + * 部门名称 + */ + private String name; + /** + * 父部门ID + * + * 关联 {@link #id} + */ + private Long parentId; + /** + * 显示顺序 + */ + private Integer sort; + /** + * 节点功能 + */ + private String nodeFunction; + /** + * 中文描述 + */ + private String toChinese; + /** + * 状态 + * + * 枚举 {@link CommonStatusEnum} + */ + private Integer status; + /** + * 类型 + */ + private Integer type; + private String belongTo; + + @TableField(exist = false) + private List children = new ArrayList<>(); +} diff --git a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/dal/mysql/wpspptx/WpsPptxLinkMapper.java b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/dal/mysql/wpspptx/WpsPptxLinkMapper.java new file mode 100644 index 00000000..709806ba --- /dev/null +++ b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/dal/mysql/wpspptx/WpsPptxLinkMapper.java @@ -0,0 +1,37 @@ +package pc.exam.pp.module.judgement.dal.mysql.wpspptx; + +import org.apache.ibatis.annotations.Mapper; +import pc.exam.pp.framework.mybatis.core.mapper.BaseMapperX; +import pc.exam.pp.framework.mybatis.core.query.LambdaQueryWrapperX; +import pc.exam.pp.module.judgement.controller.admin.Wps.vo.PptxListReqVO; +import pc.exam.pp.module.judgement.dal.dataobject.wpspptx.WpsPptxLinkDO; +import pc.exam.pp.module.judgement.utils.tree.vo.TreeVO; + +import java.util.Collection; +import java.util.List; + +@Mapper +public interface WpsPptxLinkMapper extends BaseMapperX { + + default List selectList(PptxListReqVO reqVO) { + return selectList(new LambdaQueryWrapperX() + .likeIfPresent(WpsPptxLinkDO::getName, reqVO.getName()) + .eq(reqVO.getBelongTo() != null, WpsPptxLinkDO::getBelongTo, reqVO.getBelongTo()) + .eqIfPresent(WpsPptxLinkDO::getStatus, reqVO.getStatus())); + } + + default WpsPptxLinkDO selectByParentIdAndName(Long parentId, String name) { + return selectOne(WpsPptxLinkDO::getParentId, parentId, WpsPptxLinkDO::getName, name); + } + + default Long selectCountByParentId(Long parentId) { + return selectCount(WpsPptxLinkDO::getParentId, parentId); + } + + default List selectListByParentId(Collection parentIds) { + return selectList(WpsPptxLinkDO::getParentId, parentIds); + } + + List selectTreeListByNodeFunction(); + +} diff --git a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/dal/mysql/wpsxlsx/WpsXlsxLinkMapper.java b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/dal/mysql/wpsxlsx/WpsXlsxLinkMapper.java new file mode 100644 index 00000000..b7850020 --- /dev/null +++ b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/dal/mysql/wpsxlsx/WpsXlsxLinkMapper.java @@ -0,0 +1,37 @@ +package pc.exam.pp.module.judgement.dal.mysql.wpsxlsx; + +import org.apache.ibatis.annotations.Mapper; +import pc.exam.pp.framework.mybatis.core.mapper.BaseMapperX; +import pc.exam.pp.framework.mybatis.core.query.LambdaQueryWrapperX; +import pc.exam.pp.module.judgement.controller.admin.Wps.vo.XlsxListReqVO; +import pc.exam.pp.module.judgement.dal.dataobject.wpsxlsx.WpsXlsxLinkDO; +import pc.exam.pp.module.judgement.utils.tree.vo.TreeVO; + +import java.util.Collection; +import java.util.List; + +@Mapper +public interface WpsXlsxLinkMapper extends BaseMapperX { + + default List selectList(XlsxListReqVO reqVO) { + return selectList(new LambdaQueryWrapperX() + .likeIfPresent(WpsXlsxLinkDO::getName, reqVO.getName()) + .eq(reqVO.getBelongTo() != null, WpsXlsxLinkDO::getBelongTo, reqVO.getBelongTo()) + .eqIfPresent(WpsXlsxLinkDO::getStatus, reqVO.getStatus())); + } + + default WpsXlsxLinkDO selectByParentIdAndName(Long parentId, String name) { + return selectOne(WpsXlsxLinkDO::getParentId, parentId, WpsXlsxLinkDO::getName, name); + } + + default Long selectCountByParentId(Long parentId) { + return selectCount(WpsXlsxLinkDO::getParentId, parentId); + } + + default List selectListByParentId(Collection parentIds) { + return selectList(WpsXlsxLinkDO::getParentId, parentIds); + } + + List selectTreeListByNodeFunction(); + +} diff --git a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/wps_excel/JudgementWpsExcelService.java b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/wps_excel/JudgementWpsExcelService.java index 19091d90..96453c4a 100644 --- a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/wps_excel/JudgementWpsExcelService.java +++ b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/wps_excel/JudgementWpsExcelService.java @@ -3,6 +3,7 @@ package pc.exam.pp.module.judgement.service.wps_excel; import pc.exam.pp.module.exam.dal.dataobject.ExamQuestion; +import pc.exam.pp.module.judgement.utils.wps_excel.vo.XlsxVO; import pc.exam.pp.module.judgement.utils.wps_word.vo.WordVO; import java.io.FileNotFoundException; @@ -21,5 +22,5 @@ public interface JudgementWpsExcelService { * @return 文件内得考点及描述 * @throws Exception 异常 */ - public String ProgrammingWpsExcel(String path) throws FileNotFoundException; + List programmingWpsExcel(String path); } diff --git a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/wps_excel/JudgementWpsExcelServiceImpl.java b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/wps_excel/JudgementWpsExcelServiceImpl.java index b45465f8..28892807 100644 --- a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/wps_excel/JudgementWpsExcelServiceImpl.java +++ b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/wps_excel/JudgementWpsExcelServiceImpl.java @@ -4,18 +4,26 @@ package pc.exam.pp.module.judgement.service.wps_excel; import jakarta.annotation.Resource; import org.springframework.stereotype.Service; +import pc.exam.pp.module.infra.dal.dataobject.config.ConfigDO; import pc.exam.pp.module.infra.service.config.ConfigService; +import pc.exam.pp.module.judgement.controller.admin.Wps.vo.WordListReqVO; +import pc.exam.pp.module.judgement.controller.admin.Wps.vo.XlsxListReqVO; +import pc.exam.pp.module.judgement.dal.dataobject.wpsxlsx.WpsXlsxLinkDO; import pc.exam.pp.module.judgement.dal.mysql.wpsword.WpsWordLinkMapper; +import pc.exam.pp.module.judgement.dal.mysql.wpsxlsx.WpsXlsxLinkMapper; import pc.exam.pp.module.judgement.service.auto_tools.AutoToolsService; import pc.exam.pp.module.judgement.utils.wps_excel.WpsExcelUtils; +import pc.exam.pp.module.judgement.utils.wps_excel.vo.XlsxVO; +import java.io.File; import java.io.FileNotFoundException; +import java.util.List; @Service public class JudgementWpsExcelServiceImpl implements JudgementWpsExcelService { @Resource - WpsWordLinkMapper wpsWordLinkMapper; + WpsXlsxLinkMapper wpsXlsxLinkMapper; @Resource AutoToolsService autoToolsService; @@ -24,21 +32,19 @@ public class JudgementWpsExcelServiceImpl implements JudgementWpsExcelService { ConfigService configService; @Override - public String ProgrammingWpsExcel(String path) throws FileNotFoundException { -// // 1、获取文件临时下载路径 -// ConfigDO config = configService.getConfigByKey("file_down_path"); -// // 2、下载文件并返回文件完整路径 -// String pathName = autoToolsService.downloadStudentFile(path, config.getValue()); -// // 3、创建word考点tree -// WordListReqVO wordListReqVO = new WordListReqVO(); -// wordListReqVO.setBelongTo(0); -// List list = wpsWordLinkMapper.selectList(wordListReqVO); -// // 4、docx文件读取并返回考点及说明信息 - path = "D:\\Code\\exam\\word\\202504171100_wps表格处理\\202504171100_wps表格处理\\885\\ET_001_319\\结果素材\\文档.xlsx"; - String margins1 = WpsExcelUtils.wps_excel(path); + public List programmingWpsExcel(String path) { + // 1、获取文件临时下载路径 + ConfigDO config = configService.getConfigByKey("file_down_path"); + // 2、下载文件并返回文件完整路径 + String pathName = autoToolsService.downloadStudentFile(path, config.getValue()); + // 3、创建xlsx考点tree + XlsxListReqVO xlsxListReqVO = new XlsxListReqVO(); + xlsxListReqVO.setBelongTo(0); + List xlsxList = wpsXlsxLinkMapper.selectList(xlsxListReqVO); + List margins1 = WpsExcelUtils.wpsExcel(pathName, xlsxList); // // 5、已经读取完得考点删除源文件 -// File file = new File(pathName); -// file.delete(); + File file = new File(pathName); + file.delete(); return margins1; } } diff --git a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/wps_excel/WpsXlsxLinkService.java b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/wps_excel/WpsXlsxLinkService.java new file mode 100644 index 00000000..7138846d --- /dev/null +++ b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/wps_excel/WpsXlsxLinkService.java @@ -0,0 +1,115 @@ +package pc.exam.pp.module.judgement.service.wps_excel; + +import pc.exam.pp.framework.common.util.collection.CollectionUtils; +import pc.exam.pp.module.judgement.controller.admin.Wps.vo.PptxListReqVO; +import pc.exam.pp.module.judgement.controller.admin.Wps.vo.PptxSaveReqVO; +import pc.exam.pp.module.judgement.controller.admin.Wps.vo.XlsxListReqVO; +import pc.exam.pp.module.judgement.controller.admin.Wps.vo.XlsxSaveReqVO; +import pc.exam.pp.module.judgement.dal.dataobject.wpspptx.WpsPptxLinkDO; +import pc.exam.pp.module.judgement.dal.dataobject.wpsxlsx.WpsXlsxLinkDO; +import pc.exam.pp.module.judgement.utils.tree.vo.TreeVO; + +import java.util.*; + +/** + * 节点 Service 接口 + * + * @author 芋道源码 + */ +public interface WpsXlsxLinkService { + + /** + * 创建节点 + * + * @param createReqVO 节点信息 + * @return 节点编号 + */ + Long createXlsx(XlsxSaveReqVO createReqVO); + + /** + * 更新节点 + * + * @param updateReqVO 节点信息 + */ + void updateXlsx(XlsxSaveReqVO updateReqVO); + + /** + * 删除节点 + * + * @param id 节点编号 + */ + void deleteXlsx(Long id); + + /** + * 获得节点信息 + * + * @param id 节点编号 + * @return 节点信息 + */ + WpsXlsxLinkDO getXlsx(Long id); + + /** + * 获得节点信息数组 + * + * @param ids 节点编号数组 + * @return 节点信息数组 + */ + List getXlsxList(Collection ids); + + /** + * 筛选节点列表 + * + * @param reqVO 筛选条件请求 VO + * @return 节点列表 + */ + List getXlsxList(XlsxListReqVO reqVO); + + /** + * 获得指定编号的节点 Map + * + * @param ids 节点编号数组 + * @return 节点 Map + */ + default Map getXlsxMap(Collection ids) { + List list = getXlsxList(ids); + return CollectionUtils.convertMap(list, WpsXlsxLinkDO::getId); + } + + /** + * 获得指定节点的所有子节点 + * + * @param id 节点编号 + * @return 子节点列表 + */ + default List getChildXlsxList(Long id) { + return getChildXlsxList(Collections.singleton(id)); + } + + /** + * 获得指定节点的所有子节点 + * + * @param ids 节点编号数组 + * @return 子节点列表 + */ + List getChildXlsxList(Collection ids); + + /** + * 获得所有子节点,从缓存中 + * + * @param id 父节点编号 + * @return 子节点列表 + */ + Set getChildXlsxIdListFromCache(Long id); + + /** + * 校验节点们是否有效。如下情况,视为无效: + * 1. 节点编号不存在 + * 2. 节点被禁用 + * + * @param ids 角色编号数组 + */ + void validateXlsxList(Collection ids); + + List getXlsxTreeList(); + +} diff --git a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/wps_excel/WpsXlsxLinkServiceImpl.java b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/wps_excel/WpsXlsxLinkServiceImpl.java new file mode 100644 index 00000000..be87ae10 --- /dev/null +++ b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/wps_excel/WpsXlsxLinkServiceImpl.java @@ -0,0 +1,228 @@ +package pc.exam.pp.module.judgement.service.wps_excel; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.ObjectUtil; +import com.google.common.annotations.VisibleForTesting; +import jakarta.annotation.Resource; +import lombok.extern.slf4j.Slf4j; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; +import pc.exam.pp.framework.common.enums.CommonStatusEnum; +import pc.exam.pp.framework.common.util.object.BeanUtils; +import pc.exam.pp.framework.datapermission.core.annotation.DataPermission; +import pc.exam.pp.framework.tenant.core.aop.TenantIgnore; +import pc.exam.pp.module.judgement.controller.admin.Wps.vo.XlsxListReqVO; +import pc.exam.pp.module.judgement.controller.admin.Wps.vo.XlsxSaveReqVO; +import pc.exam.pp.module.judgement.dal.dataobject.wpspptx.WpsPptxLinkDO; +import pc.exam.pp.module.judgement.dal.dataobject.wpsxlsx.WpsXlsxLinkDO; +import pc.exam.pp.module.judgement.dal.mysql.wpsxlsx.WpsXlsxLinkMapper; +import pc.exam.pp.module.judgement.utils.tree.vo.TreeVO; +import pc.exam.pp.module.system.dal.redis.RedisKeyConstants; + +import java.util.*; + +import static pc.exam.pp.framework.common.exception.util.ServiceExceptionUtil.exception; +import static pc.exam.pp.framework.common.util.collection.CollectionUtils.convertSet; +import static pc.exam.pp.module.system.enums.ErrorCodeConstants.*; + +/** + * 节点 Service 实现类 + * + */ +@Service +@Validated +@Slf4j +public class WpsXlsxLinkServiceImpl implements WpsXlsxLinkService { + + @Resource + private WpsXlsxLinkMapper wpsXlsxLinkMapper; + + @Override + @CacheEvict(cacheNames = RedisKeyConstants.WPS_XLSX_CHILDREN_ID_LIST, + allEntries = true) // allEntries 清空所有缓存,因为操作一个节点,涉及到多个缓存 + public Long createXlsx(XlsxSaveReqVO createReqVO) { + if (createReqVO.getParentId() == null) { + createReqVO.setParentId(WpsPptxLinkDO.PARENT_ID_ROOT); + } + // 校验父节点的有效性 + validateParentXlsx(null, createReqVO.getParentId()); + // 校验节点名的唯一性 + validateXlsxNameUnique(null, createReqVO.getParentId(), createReqVO.getName()); + + // 插入节点 + WpsXlsxLinkDO wpsXlsxLinkDO = BeanUtils.toBean(createReqVO, WpsXlsxLinkDO.class); + wpsXlsxLinkMapper.insert(wpsXlsxLinkDO); + return wpsXlsxLinkDO.getId(); + } + + @Override + @CacheEvict(cacheNames = RedisKeyConstants.WPS_XLSX_CHILDREN_ID_LIST, + allEntries = true) // allEntries 清空所有缓存,因为操作一个节点,涉及到多个缓存 + public void updateXlsx(XlsxSaveReqVO updateReqVO) { + if (updateReqVO.getParentId() == null) { + updateReqVO.setParentId(WpsPptxLinkDO.PARENT_ID_ROOT); + } + // 校验自己存在 + validateXlsxExists(updateReqVO.getId()); + // 校验父节点的有效性 + validateParentXlsx(updateReqVO.getId(), updateReqVO.getParentId()); + // 校验节点名的唯一性 + validateXlsxNameUnique(updateReqVO.getId(), updateReqVO.getParentId(), updateReqVO.getName()); + + // 更新节点 + WpsXlsxLinkDO updateObj = BeanUtils.toBean(updateReqVO, WpsXlsxLinkDO.class); + wpsXlsxLinkMapper.updateById(updateObj); + } + + @Override + @CacheEvict(cacheNames = RedisKeyConstants.WPS_XLSX_CHILDREN_ID_LIST, + allEntries = true) // allEntries 清空所有缓存,因为操作一个节点,涉及到多个缓存 + public void deleteXlsx(Long id) { + // 校验是否存在 + validateXlsxExists(id); + // 校验是否有子节点 + if (wpsXlsxLinkMapper.selectCountByParentId(id) > 0) { + throw exception(XLSX_NOT_FOUND); + } + // 删除节点 + wpsXlsxLinkMapper.deleteById(id); + } + + @VisibleForTesting + void validateXlsxExists(Long id) { + if (id == null) { + return; + } + WpsXlsxLinkDO wpsXlsxLinkDO = wpsXlsxLinkMapper.selectById(id); + if (wpsXlsxLinkDO == null) { + throw exception(XLSX_NOT_FOUND); + } + } + + @VisibleForTesting + void validateParentXlsx(Long id, Long parentId) { + if (parentId == null || WpsXlsxLinkDO.PARENT_ID_ROOT.equals(parentId)) { + return; + } + // 1. 不能设置自己为父节点 + if (Objects.equals(id, parentId)) { + throw exception(DEPT_PARENT_ERROR); + } + // 2. 父节点不存在 + WpsXlsxLinkDO parentXlsx = wpsXlsxLinkMapper.selectById(parentId); + if (parentXlsx == null) { + throw exception(XLSX_PARENT_NOT_EXITS); + } + // 3. 递归校验父节点,如果父节点是自己的子节点,则报错,避免形成环路 + // id 为空,说明新增,不需要考虑环路 + if (id == null) { + return; + } + for (int i = 0; i < Short.MAX_VALUE; i++) { + // 3.1 校验环路 + parentId = parentXlsx.getParentId(); + if (Objects.equals(id, parentId)) { + throw exception(XLSX_PARENT_IS_CHILD); + } + // 3.2 继续递归下一级父节点 + if (parentId == null || WpsPptxLinkDO.PARENT_ID_ROOT.equals(parentId)) { + break; + } + parentXlsx = wpsXlsxLinkMapper.selectById(parentId); + if (parentXlsx == null) { + break; + } + } + } + + @VisibleForTesting + void validateXlsxNameUnique(Long id, Long parentId, String name) { + WpsXlsxLinkDO wpsXlsxLinkDO = wpsXlsxLinkMapper.selectByParentIdAndName(parentId, name); + if (wpsXlsxLinkDO == null) { + return; + } + // 如果 id 为空,说明不用比较是否为相同 id 的节点 + if (id == null) { + throw exception(XLSX_NAME_DUPLICATE); + } + if (ObjectUtil.notEqual(wpsXlsxLinkDO.getId(), id)) { + throw exception(XLSX_NAME_DUPLICATE); + } + } + + @Override + public WpsXlsxLinkDO getXlsx(Long id) { + return wpsXlsxLinkMapper.selectById(id); + } + + @Override + public List getXlsxList(Collection ids) { + if (CollUtil.isEmpty(ids)) { + return Collections.emptyList(); + } + return wpsXlsxLinkMapper.selectBatchIds(ids); + } + + @Override + public List getXlsxList(XlsxListReqVO reqVO) { + List list = wpsXlsxLinkMapper.selectList(reqVO); + list.sort(Comparator.comparing(WpsXlsxLinkDO::getSort)); + return list; + } + + @Override + public List getChildXlsxList(Collection ids) { + List children = new LinkedList<>(); + // 遍历每一层 + Collection parentIds = ids; + // 使用 Short.MAX_VALUE 避免 bug 场景下,存在死循环 + for (int i = 0; i < Short.MAX_VALUE; i++) { + // 查询当前层,所有的子节点 + List xlsxs = wpsXlsxLinkMapper.selectListByParentId(parentIds); + // 1. 如果没有子节点,则结束遍历 + if (CollUtil.isEmpty(xlsxs)) { + break; + } + // 2. 如果有子节点,继续遍历 + children.addAll(xlsxs); + parentIds = convertSet(xlsxs, WpsXlsxLinkDO::getId); + } + return children; + } + + @Override + @DataPermission(enable = false) // 禁用数据权限,避免建立不正确的缓存 + @Cacheable(cacheNames = RedisKeyConstants.WPS_XLSX_CHILDREN_ID_LIST, key = "#id") + public Set getChildXlsxIdListFromCache(Long id) { + List children = getChildXlsxList(id); + return convertSet(children, WpsXlsxLinkDO::getId); + } + + @Override + public void validateXlsxList(Collection ids) { + if (CollUtil.isEmpty(ids)) { + return; + } + // 获得科室信息 + Map xlsxMap = getXlsxMap(ids); + // 校验 + ids.forEach(id -> { + WpsXlsxLinkDO xlsx = xlsxMap.get(id); + if (xlsx == null) { + throw exception(XLSX_NOT_FOUND); + } + if (!CommonStatusEnum.ENABLE.getStatus().equals(xlsx.getStatus())) { + throw exception(XLSX_NOT_ENABLE, xlsx.getName()); + } + }); + } + + @Override + @TenantIgnore + public List getXlsxTreeList() { + return wpsXlsxLinkMapper.selectTreeListByNodeFunction(); + } + +} diff --git a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/wps_pptx/JudgementWpsPptxService.java b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/wps_pptx/JudgementWpsPptxService.java new file mode 100644 index 00000000..8b3581b2 --- /dev/null +++ b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/wps_pptx/JudgementWpsPptxService.java @@ -0,0 +1,13 @@ +package pc.exam.pp.module.judgement.service.wps_pptx; + +import pc.exam.pp.module.judgement.utils.wps_pptx.vo.PptxVO; + +import java.util.List; + +/** + * @author REN + */ +public interface JudgementWpsPptxService { + + List programmingWpsPptx(String path) throws Exception; +} diff --git a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/wps_pptx/JudgementWpsPptxServiceImpl.java b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/wps_pptx/JudgementWpsPptxServiceImpl.java new file mode 100644 index 00000000..18ab85db --- /dev/null +++ b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/wps_pptx/JudgementWpsPptxServiceImpl.java @@ -0,0 +1,52 @@ +package pc.exam.pp.module.judgement.service.wps_pptx; + +import jakarta.annotation.Resource; +import org.springframework.stereotype.Service; +import pc.exam.pp.module.infra.dal.dataobject.config.ConfigDO; +import pc.exam.pp.module.infra.service.config.ConfigService; +import pc.exam.pp.module.judgement.controller.admin.Wps.vo.PptxListReqVO; +import pc.exam.pp.module.judgement.dal.dataobject.wpspptx.WpsPptxLinkDO; +import pc.exam.pp.module.judgement.dal.mysql.wpspptx.WpsPptxLinkMapper; +import pc.exam.pp.module.judgement.service.auto_tools.AutoToolsService; +import pc.exam.pp.module.judgement.utils.wps_pptx.WpsPptxUtils; +import pc.exam.pp.module.judgement.utils.wps_pptx.vo.PptxVO; + +import java.io.File; +import java.util.List; + +/** + * @author REN + */ +@Service +public class JudgementWpsPptxServiceImpl implements JudgementWpsPptxService { + + @Resource + AutoToolsService autoToolsService; + + @Resource + ConfigService configService; + + @Resource + WpsPptxLinkMapper wpsPptxLinkMapper; + + @Override + public List programmingWpsPptx(String path) throws Exception { + + // 1、获取文件临时下载路径 + ConfigDO config = configService.getConfigByKey("file_down_path"); + // 2、下载文件并返回文件完整路径 + String pathName = autoToolsService.downloadStudentFile(path, config.getValue()); + // 3、创建pptx考点tree + PptxListReqVO pptxListReqVO = new PptxListReqVO(); + pptxListReqVO.setBelongTo(0); + // 3-1、查询段落的标签 + List paragraphList = wpsPptxLinkMapper.selectList(pptxListReqVO); + // 4、docx文件读取并返回考点及说明信息 + List margins1 = WpsPptxUtils.wpsPptx(pathName, paragraphList); + // 5、已经读取完得考点删除源文件 + File file = new File(pathName); + file.delete(); + return margins1; + } + +} diff --git a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/wps_pptx/WpsPptxLinkService.java b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/wps_pptx/WpsPptxLinkService.java new file mode 100644 index 00000000..f394b156 --- /dev/null +++ b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/wps_pptx/WpsPptxLinkService.java @@ -0,0 +1,112 @@ +package pc.exam.pp.module.judgement.service.wps_pptx; + +import pc.exam.pp.framework.common.util.collection.CollectionUtils; +import pc.exam.pp.module.judgement.controller.admin.Wps.vo.PptxListReqVO; +import pc.exam.pp.module.judgement.controller.admin.Wps.vo.PptxSaveReqVO; +import pc.exam.pp.module.judgement.dal.dataobject.wpspptx.WpsPptxLinkDO; +import pc.exam.pp.module.judgement.utils.tree.vo.TreeVO; + +import java.util.*; + +/** + * 节点 Service 接口 + * + * @author 芋道源码 + */ +public interface WpsPptxLinkService { + + /** + * 创建节点 + * + * @param createReqVO 节点信息 + * @return 节点编号 + */ + Long createPptx(PptxSaveReqVO createReqVO); + + /** + * 更新节点 + * + * @param updateReqVO 节点信息 + */ + void updatePptx(PptxSaveReqVO updateReqVO); + + /** + * 删除节点 + * + * @param id 节点编号 + */ + void deletePptx(Long id); + + /** + * 获得节点信息 + * + * @param id 节点编号 + * @return 节点信息 + */ + WpsPptxLinkDO getPptx(Long id); + + /** + * 获得节点信息数组 + * + * @param ids 节点编号数组 + * @return 节点信息数组 + */ + List getPptxList(Collection ids); + + /** + * 筛选节点列表 + * + * @param reqVO 筛选条件请求 VO + * @return 节点列表 + */ + List getPptxList(PptxListReqVO reqVO); + + /** + * 获得指定编号的节点 Map + * + * @param ids 节点编号数组 + * @return 节点 Map + */ + default Map getPptxMap(Collection ids) { + List list = getPptxList(ids); + return CollectionUtils.convertMap(list, WpsPptxLinkDO::getId); + } + + /** + * 获得指定节点的所有子节点 + * + * @param id 节点编号 + * @return 子节点列表 + */ + default List getChildPptxList(Long id) { + return getChildPptxList(Collections.singleton(id)); + } + + /** + * 获得指定节点的所有子节点 + * + * @param ids 节点编号数组 + * @return 子节点列表 + */ + List getChildPptxList(Collection ids); + + /** + * 获得所有子节点,从缓存中 + * + * @param id 父节点编号 + * @return 子节点列表 + */ + Set getChildPptxIdListFromCache(Long id); + + /** + * 校验节点们是否有效。如下情况,视为无效: + * 1. 节点编号不存在 + * 2. 节点被禁用 + * + * @param ids 角色编号数组 + */ + void validatePptxList(Collection ids); + + List getPptxTreeList(); + +} diff --git a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/wps_pptx/WpsPptxLinkServiceImpl.java b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/wps_pptx/WpsPptxLinkServiceImpl.java new file mode 100644 index 00000000..ea2ef30e --- /dev/null +++ b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/wps_pptx/WpsPptxLinkServiceImpl.java @@ -0,0 +1,227 @@ +package pc.exam.pp.module.judgement.service.wps_pptx; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.ObjectUtil; +import com.google.common.annotations.VisibleForTesting; +import jakarta.annotation.Resource; +import lombok.extern.slf4j.Slf4j; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; +import pc.exam.pp.framework.common.enums.CommonStatusEnum; +import pc.exam.pp.framework.common.util.object.BeanUtils; +import pc.exam.pp.framework.datapermission.core.annotation.DataPermission; +import pc.exam.pp.framework.tenant.core.aop.TenantIgnore; +import pc.exam.pp.module.judgement.controller.admin.Wps.vo.PptxListReqVO; +import pc.exam.pp.module.judgement.controller.admin.Wps.vo.PptxSaveReqVO; +import pc.exam.pp.module.judgement.dal.dataobject.wpspptx.WpsPptxLinkDO; +import pc.exam.pp.module.judgement.dal.mysql.wpspptx.WpsPptxLinkMapper; +import pc.exam.pp.module.judgement.utils.tree.vo.TreeVO; +import pc.exam.pp.module.system.dal.redis.RedisKeyConstants; + +import java.util.*; + +import static pc.exam.pp.framework.common.exception.util.ServiceExceptionUtil.exception; +import static pc.exam.pp.framework.common.util.collection.CollectionUtils.convertSet; +import static pc.exam.pp.module.system.enums.ErrorCodeConstants.*; + +/** + * 节点 Service 实现类 + * + */ +@Service +@Validated +@Slf4j +public class WpsPptxLinkServiceImpl implements WpsPptxLinkService { + + @Resource + private WpsPptxLinkMapper wpsPptxLinkMapper; + + @Override + @CacheEvict(cacheNames = RedisKeyConstants.WPS_PPTX_CHILDREN_ID_LIST, + allEntries = true) // allEntries 清空所有缓存,因为操作一个节点,涉及到多个缓存 + public Long createPptx(PptxSaveReqVO createReqVO) { + if (createReqVO.getParentId() == null) { + createReqVO.setParentId(WpsPptxLinkDO.PARENT_ID_ROOT); + } + // 校验父节点的有效性 + validateParentPptx(null, createReqVO.getParentId()); + // 校验节点名的唯一性 + validatePptxNameUnique(null, createReqVO.getParentId(), createReqVO.getName()); + + // 插入节点 + WpsPptxLinkDO wpsPptxLinkDO = BeanUtils.toBean(createReqVO, WpsPptxLinkDO.class); + wpsPptxLinkMapper.insert(wpsPptxLinkDO); + return wpsPptxLinkDO.getId(); + } + + @Override + @CacheEvict(cacheNames = RedisKeyConstants.WPS_PPTX_CHILDREN_ID_LIST, + allEntries = true) // allEntries 清空所有缓存,因为操作一个节点,涉及到多个缓存 + public void updatePptx(PptxSaveReqVO updateReqVO) { + if (updateReqVO.getParentId() == null) { + updateReqVO.setParentId(WpsPptxLinkDO.PARENT_ID_ROOT); + } + // 校验自己存在 + validatePptxExists(updateReqVO.getId()); + // 校验父节点的有效性 + validateParentPptx(updateReqVO.getId(), updateReqVO.getParentId()); + // 校验节点名的唯一性 + validatePptxNameUnique(updateReqVO.getId(), updateReqVO.getParentId(), updateReqVO.getName()); + + // 更新节点 + WpsPptxLinkDO updateObj = BeanUtils.toBean(updateReqVO, WpsPptxLinkDO.class); + wpsPptxLinkMapper.updateById(updateObj); + } + + @Override + @CacheEvict(cacheNames = RedisKeyConstants.WPS_PPTX_CHILDREN_ID_LIST, + allEntries = true) // allEntries 清空所有缓存,因为操作一个节点,涉及到多个缓存 + public void deletePptx(Long id) { + // 校验是否存在 + validatePptxExists(id); + // 校验是否有子节点 + if (wpsPptxLinkMapper.selectCountByParentId(id) > 0) { + throw exception(WORD_NOT_FOUND); + } + // 删除节点 + wpsPptxLinkMapper.deleteById(id); + } + + @VisibleForTesting + void validatePptxExists(Long id) { + if (id == null) { + return; + } + WpsPptxLinkDO wpsPptxLinkDO = wpsPptxLinkMapper.selectById(id); + if (wpsPptxLinkDO == null) { + throw exception(PPTX_NOT_FOUND); + } + } + + @VisibleForTesting + void validateParentPptx(Long id, Long parentId) { + if (parentId == null || WpsPptxLinkDO.PARENT_ID_ROOT.equals(parentId)) { + return; + } + // 1. 不能设置自己为父节点 + if (Objects.equals(id, parentId)) { + throw exception(PPTX_PARENT_ERROR); + } + // 2. 父节点不存在 + WpsPptxLinkDO parentPptx = wpsPptxLinkMapper.selectById(parentId); + if (parentPptx == null) { + throw exception(PPTX_PARENT_NOT_EXITS); + } + // 3. 递归校验父节点,如果父节点是自己的子节点,则报错,避免形成环路 + // id 为空,说明新增,不需要考虑环路 + if (id == null) { + return; + } + for (int i = 0; i < Short.MAX_VALUE; i++) { + // 3.1 校验环路 + parentId = parentPptx.getParentId(); + if (Objects.equals(id, parentId)) { + throw exception(PPTX_PARENT_IS_CHILD); + } + // 3.2 继续递归下一级父节点 + if (parentId == null || WpsPptxLinkDO.PARENT_ID_ROOT.equals(parentId)) { + break; + } + parentPptx = wpsPptxLinkMapper.selectById(parentId); + if (parentPptx == null) { + break; + } + } + } + + @VisibleForTesting + void validatePptxNameUnique(Long id, Long parentId, String name) { + WpsPptxLinkDO wpsPptxLinkDO = wpsPptxLinkMapper.selectByParentIdAndName(parentId, name); + if (wpsPptxLinkDO == null) { + return; + } + // 如果 id 为空,说明不用比较是否为相同 id 的节点 + if (id == null) { + throw exception(PPTX_NAME_DUPLICATE); + } + if (ObjectUtil.notEqual(wpsPptxLinkDO.getId(), id)) { + throw exception(PPTX_NAME_DUPLICATE); + } + } + + @Override + public WpsPptxLinkDO getPptx(Long id) { + return wpsPptxLinkMapper.selectById(id); + } + + @Override + public List getPptxList(Collection ids) { + if (CollUtil.isEmpty(ids)) { + return Collections.emptyList(); + } + return wpsPptxLinkMapper.selectBatchIds(ids); + } + + @Override + public List getPptxList(PptxListReqVO reqVO) { + List list = wpsPptxLinkMapper.selectList(reqVO); + list.sort(Comparator.comparing(WpsPptxLinkDO::getSort)); + return list; + } + + @Override + public List getChildPptxList(Collection ids) { + List children = new LinkedList<>(); + // 遍历每一层 + Collection parentIds = ids; + // 使用 Short.MAX_VALUE 避免 bug 场景下,存在死循环 + for (int i = 0; i < Short.MAX_VALUE; i++) { + // 查询当前层,所有的子节点 + List pptxs = wpsPptxLinkMapper.selectListByParentId(parentIds); + // 1. 如果没有子节点,则结束遍历 + if (CollUtil.isEmpty(pptxs)) { + break; + } + // 2. 如果有子节点,继续遍历 + children.addAll(pptxs); + parentIds = convertSet(pptxs, WpsPptxLinkDO::getId); + } + return children; + } + + @Override + @DataPermission(enable = false) // 禁用数据权限,避免建立不正确的缓存 + @Cacheable(cacheNames = RedisKeyConstants.WPS_PPTX_CHILDREN_ID_LIST, key = "#id") + public Set getChildPptxIdListFromCache(Long id) { + List children = getChildPptxList(id); + return convertSet(children, WpsPptxLinkDO::getId); + } + + @Override + public void validatePptxList(Collection ids) { + if (CollUtil.isEmpty(ids)) { + return; + } + // 获得科室信息 + Map PptxMap = getPptxMap(ids); + // 校验 + ids.forEach(id -> { + WpsPptxLinkDO Pptx = PptxMap.get(id); + if (Pptx == null) { + throw exception(PPTX_NOT_FOUND); + } + if (!CommonStatusEnum.ENABLE.getStatus().equals(Pptx.getStatus())) { + throw exception(PPTX_NOT_ENABLE, Pptx.getName()); + } + }); + } + + @Override + @TenantIgnore + public List getPptxTreeList() { + return wpsPptxLinkMapper.selectTreeListByNodeFunction(); + } + +} diff --git a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/wps_word/JudgementWpsWordService.java b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/wps_word/JudgementWpsWordService.java index f32be99d..ba9072d6 100644 --- a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/wps_word/JudgementWpsWordService.java +++ b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/wps_word/JudgementWpsWordService.java @@ -21,7 +21,9 @@ public interface JudgementWpsWordService { * @return 文件内得考点及描述 * @throws Exception 异常 */ - public List ProgrammingWpsWord(String path) throws Exception; + List programmingWpsWord(String path) throws Exception; + + /** * 读取考生文件,与题型中要求进行判断 @@ -31,5 +33,5 @@ public interface JudgementWpsWordService { * @return 得分 * @throws Exception 异常 */ - public double judgementWpsWord(double sorce, String pathC, String path, ExamQuestion examQuestion) throws Exception; + double judgementWpsWord(double sorce, String pathC, String path, ExamQuestion examQuestion) throws Exception; } diff --git a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/wps_word/JudgementWpsWordServiceImpl.java b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/wps_word/JudgementWpsWordServiceImpl.java index 0ed929c1..17d034fd 100644 --- a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/wps_word/JudgementWpsWordServiceImpl.java +++ b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/wps_word/JudgementWpsWordServiceImpl.java @@ -32,7 +32,7 @@ public class JudgementWpsWordServiceImpl implements JudgementWpsWordService { ConfigService configService; @Override - public List ProgrammingWpsWord(String path) throws Exception { + public List programmingWpsWord(String path) throws Exception { // 1、获取文件临时下载路径 ConfigDO config = configService.getConfigByKey("file_down_path"); @@ -99,5 +99,4 @@ public class JudgementWpsWordServiceImpl implements JudgementWpsWordService { return wps_word_sorce; } - } diff --git a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/wps_word/WpsWordLinkServiceImpl.java b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/wps_word/WpsWordLinkServiceImpl.java index 9a477afa..0980469a 100644 --- a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/wps_word/WpsWordLinkServiceImpl.java +++ b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/wps_word/WpsWordLinkServiceImpl.java @@ -107,7 +107,7 @@ public class WpsWordLinkServiceImpl implements WpsWordLinkService { } // 1. 不能设置自己为父节点 if (Objects.equals(id, parentId)) { - throw exception(DEPT_PARENT_ERROR); + throw exception(WORD_PARENT_ERROR); } // 2. 父节点不存在 WpsWordLinkDO parentWord = wpsWordLinkMapper.selectById(parentId); diff --git a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/utils/tree/TreeUtils.java b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/utils/tree/TreeUtils.java index 016e1bb0..0352a69f 100644 --- a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/utils/tree/TreeUtils.java +++ b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/utils/tree/TreeUtils.java @@ -1,6 +1,8 @@ package pc.exam.pp.module.judgement.utils.tree; +import pc.exam.pp.module.judgement.dal.dataobject.wpspptx.WpsPptxLinkDO; import pc.exam.pp.module.judgement.dal.dataobject.wpsword.WpsWordLinkDO; +import pc.exam.pp.module.judgement.dal.dataobject.wpsxlsx.WpsXlsxLinkDO; import java.util.ArrayList; import java.util.HashMap; @@ -32,4 +34,49 @@ public class TreeUtils { return roots; } + public static List buildTreePptx(List flatList) { + Map nodeMap = new HashMap<>(); + List roots = new ArrayList<>(); + + // 先放入 map + for (WpsPptxLinkDO node : flatList) { + nodeMap.put(Math.toIntExact(node.getId()), node); + } + + // 构建树关系 + for (WpsPptxLinkDO node : flatList) { + if (node.getParentId() == 0) { + roots.add(node); + } else { + WpsPptxLinkDO parent = nodeMap.get(node.getParentId().intValue()); + if (parent != null) { + parent.getChildren().add(node); + } + } + } + return roots; + } + public static List buildTreeXlsx(List flatList) { + Map nodeMap = new HashMap<>(); + List roots = new ArrayList<>(); + + // 先放入 map + for (WpsXlsxLinkDO node : flatList) { + nodeMap.put(Math.toIntExact(node.getId()), node); + } + + // 构建树关系 + for (WpsXlsxLinkDO node : flatList) { + if (node.getParentId() == 0) { + roots.add(node); + } else { + WpsXlsxLinkDO parent = nodeMap.get(node.getParentId().intValue()); + if (parent != null) { + parent.getChildren().add(node); + } + } + } + return roots; + } + } diff --git a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/utils/wps_excel/WpsExcelUtils.java b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/utils/wps_excel/WpsExcelUtils.java index acd49776..6a6f561b 100644 --- a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/utils/wps_excel/WpsExcelUtils.java +++ b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/utils/wps_excel/WpsExcelUtils.java @@ -1,44 +1,57 @@ package pc.exam.pp.module.judgement.utils.wps_excel; +import org.apache.poi.openxml4j.exceptions.InvalidFormatException; +import org.apache.poi.openxml4j.opc.OPCPackage; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; +import org.apache.poi.xssf.usermodel.XSSFSheet; import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.apache.xmlbeans.XmlCursor; +import org.apache.xmlbeans.XmlObject; +import pc.exam.pp.module.judgement.dal.dataobject.wpspptx.WpsPptxLinkDO; +import pc.exam.pp.module.judgement.dal.dataobject.wpsxlsx.WpsXlsxLinkDO; +import pc.exam.pp.module.judgement.utils.tree.TreeUtils; +import pc.exam.pp.module.judgement.utils.wps_excel.vo.XlsxVO; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +/** + * @author REN + */ public class WpsExcelUtils { - public static String wps_excel(String filePath) throws FileNotFoundException { + public static List wpsExcel(String filePath, List xlsxList) { + // 创建结果对象 + List xlsxVos = new ArrayList<>(); + // 转换数据 + List xlsxTree = TreeUtils.buildTreeXlsx(xlsxList); try (FileInputStream fis = new FileInputStream(filePath); - XSSFWorkbook workbook = new XSSFWorkbook(fis)) { - - Sheet sheet = workbook.getSheetAt(0); // 读取第一个工作表 - - for (Row row : sheet) { - for (Cell cell : row) { - switch (cell.getCellType()) { - case STRING: - System.out.print(cell.getStringCellValue() + "\t"); - break; - case NUMERIC: - System.out.print(cell.getNumericCellValue() + "\t"); - break; - case BOOLEAN: - System.out.print(cell.getBooleanCellValue() + "\t"); - break; - default: - System.out.print("?\t"); - } + OPCPackage pkg = OPCPackage.open(fis); + XSSFWorkbook workbook = new XSSFWorkbook(pkg)) { + // 获取有多少个工作表 + int sheetNumber = workbook.getNumberOfSheets(); + for (int i = 0; i < sheetNumber; i++) { + System.out.println("第 " + (i + 1) + " 个工作表"); + // 获取工作表内容 + XSSFSheet sheetXss = workbook.getSheetAt(i); + // 获取工作表的XML对象 + XmlObject worksheetXml = sheetXss.getCTWorksheet(); + try (XmlCursor cursor = worksheetXml.newCursor()) { + System.out.println(cursor.xmlText()); + } catch (Exception e) { + e.printStackTrace(); } - System.out.println(); } - } catch (IOException e) { e.printStackTrace(); + } catch (InvalidFormatException e) { + throw new RuntimeException(e); } - return filePath; + return xlsxVos; } } diff --git a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/utils/wps_excel/vo/XlsxVO.java b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/utils/wps_excel/vo/XlsxVO.java new file mode 100644 index 00000000..4539ad23 --- /dev/null +++ b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/utils/wps_excel/vo/XlsxVO.java @@ -0,0 +1,26 @@ +package pc.exam.pp.module.judgement.utils.wps_excel.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.util.List; + +@Data +public class XlsxVO { + + @Schema(description = "相关文本") + private String wordText; + + @Schema(description = "考试考点") + private List examKeynote; + + @Schema(description = "考点汉化") + private List keynoteChinese; + + @Schema(description = "是否有样式修饰") + private Boolean isTrue; + + @Schema(description = "类型") + private String type; + +} diff --git a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/utils/wps_pptx/WpsPptxUtils.java b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/utils/wps_pptx/WpsPptxUtils.java new file mode 100644 index 00000000..170894a0 --- /dev/null +++ b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/utils/wps_pptx/WpsPptxUtils.java @@ -0,0 +1,182 @@ +package pc.exam.pp.module.judgement.utils.wps_pptx; + +import org.apache.poi.xslf.usermodel.XMLSlideShow; +import org.apache.poi.xslf.usermodel.XSLFSlide; +import org.apache.xmlbeans.XmlCursor; +import org.apache.xmlbeans.XmlObject; +import pc.exam.pp.module.judgement.dal.dataobject.wpspptx.WpsPptxLinkDO; +import pc.exam.pp.module.judgement.dal.dataobject.wpsword.WpsWordLinkDO; +import pc.exam.pp.module.judgement.utils.tree.TreeUtils; +import pc.exam.pp.module.judgement.utils.wps_pptx.vo.PptxVO; +import pc.exam.pp.module.judgement.utils.wps_word.vo.WordVO; + +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.*; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.stream.IntStream; + +/** + * @author REN + */ +public class WpsPptxUtils { + public static List wpsPptx(String filePath, List cSldList) { + List pptxVOS = new ArrayList<>(); + // 转换数据 + List cSldTree = TreeUtils.buildTreePptx(cSldList); + // 1、读取文件内容 + try (FileInputStream fis = new FileInputStream(filePath); + XMLSlideShow pptxXml = new XMLSlideShow(fis)) { + // 索引 + int index = 0; + // 获取了所有的幻灯片 + for (XSLFSlide slides : pptxXml.getSlides()){ + String xmlText = slides.getXmlObject().xmlText(); + // 1-1、创建最全的命名空间 + Pattern pattern = Pattern.compile("xmlns:(\\w+)=\"([^\"]+)\""); + Matcher matcher = pattern.matcher(xmlText); + Map namespaces = new HashMap<>(); + while (matcher.find()) { + String prefix = matcher.group(1); + String uri = matcher.group(2); + namespaces.put(prefix, uri); + } + StringBuilder xpathBuilder = new StringBuilder(); + namespaces.forEach((prefix, uri) -> + xpathBuilder.append("declare namespace ") + .append(prefix) + .append("='") + .append(uri) + .append("' ") + ); + // 2-1、获取出来最全的命名空间 + String allPathx = xpathBuilder.toString(); + // 3、获取CTDocument对象 + XmlObject docXml = slides.getXmlObject(); + for (WpsPptxLinkDO node : cSldTree) { + traverseTreeAndQueryXml("111", pptxVOS, node.getName(), "123", allPathx, node, docXml, new ArrayList<>(), new ArrayList<>(), index, 1); + } + index += 1; + // 2、解析文件内容 + XmlObject xml = slides.getXmlObject(); + System.out.println(index + "解析pptx文件内容: " + xml.xmlText()); + } + + } catch (IOException e) { + throw new RuntimeException(e); + } + return pptxVOS; + } + + /** + * @param type String 用来存放类型 + * @param pptxVOS List 用来存放结果 + * @param firstTitle String 用来存放一级标题 + * @param text String 用来存放文本 + * @param xpath String 用来存放xpath + * @param node WpsWordLinkDO 用来存放节点 + * @param currentXml XmlObject 用来存放当前xml + * @param pathSoFar List 用来存放路径 + * @param pathChinese List 用来存放中文路径 + * @param index int 用来存放索引 + * @param beginIndex int 用来存放开始索引 + */ + public static void traverseTreeAndQueryXml(String type, List pptxVOS, String firstTitle, String text, String xpath, WpsPptxLinkDO node, XmlObject currentXml, List pathSoFar, List pathChinese, int index, int beginIndex) { + // 到达参数节点,构造 XPath 路径查询它的值 + if (beginIndex == 1) { + xpath += "./"; + } + pathSoFar.add(node.getName()); + pathChinese.add(node.getToChinese() + index); + + if (node.getType() == 1) { + xpath += String.join("/", pathSoFar); + try (XmlCursor cursors = currentXml.newCursor()) { + cursors.selectPath(xpath); + if (cursors.toNextSelection()) { + String textValue = cursors.getTextValue(); + if (!Objects.equals(textValue, "")) { + // 查找List里面是否已经存在相应文本的数据 + String finalText = text; + int listIndex = IntStream.range(0, pptxVOS.size()) + .filter(i -> finalText.equals(pptxVOS.get(i).getWordText())) + .findFirst() + .orElse(-1); + // 判断在段落内的样式,如果出现样式,向上兼容,直接再出现样式标签 +// System.out.println(xpath); + if (xpath.indexOf("w:sectPr") > 0 && xpath.indexOf("w:p[") > 0) { + // 说明出现了文本页面设置,需要进行向上绑定 + // 在获取当前的数组长度,获取上面的属性 遍历已经存在的数据 + int tindex = 0; + for (PptxVO woVo : pptxVOS) { + // 判断标识是否为false,,代表没有进行赋值 + if (!woVo.getIsTrue()) { + PptxVO pptxVO = pptxVOS.get(tindex); + pptxVO.setWordText(pptxVO.getWordText()); + woVo.setIsTrue(true); + List kchinese = woVo.getKeynoteChinese(); + List examKeynote = woVo.getExamKeynote(); + examKeynote.add(String.join(" → ", pathSoFar) + ",value:" + textValue); + kchinese.add(String.join(" → ", pathChinese) + ",值:" + textValue); + pptxVO.setKeynoteChinese(kchinese); + pptxVO.setExamKeynote(examKeynote); + pptxVO.setType(type); + pptxVOS.set(tindex, woVo); + } + tindex += 1; + } + } else if (listIndex < 0) { + // 如果没有查询到了 + if (xpath.indexOf("w:sectPr[") > 0) { + // 页面属性 + // 文本 + text = "页面属性"; + } + if (!Objects.equals(text, "")) { + if (!text.contains("MERGEFIELD")) { + // 给标志符 + PptxVO pptxVO = new PptxVO(); + pptxVO.setWordText(text); + // 创建list进行存放数据 + List kchinese = new ArrayList<>(); + List examKeynote = new ArrayList<>(); + examKeynote.add(String.join(" → ", pathSoFar) + ",value:" + textValue); + kchinese.add(String.join(" → ", pathChinese) + ",值:" + textValue); + // 组合完数据后进行存放数据 + pptxVO.setKeynoteChinese(kchinese); + pptxVO.setExamKeynote(examKeynote); + pptxVO.setIsTrue(false); + pptxVO.setType(type); + pptxVOS.add(pptxVO); + } + } + } else { // 如果找到了 + PptxVO pptxVO = pptxVOS.get(listIndex); + List kchinese = pptxVO.getKeynoteChinese(); + List examKeynote = pptxVO.getExamKeynote(); + examKeynote.add(String.join(" → ", pathSoFar) + ",value:" + textValue); + kchinese.add(String.join(" → ", pathChinese) + ",值:" + textValue); + pptxVO.setKeynoteChinese(kchinese); + pptxVO.setExamKeynote(examKeynote); + pptxVO.setIsTrue(false); + pptxVO.setType(type); + pptxVOS.remove(listIndex); + pptxVOS.add(pptxVO); + } +// System.out.println("文本:" + text + " 参数路径:" + String.join(" → ", pathChinese) + ",值:" + text_value); + } + cursors.dispose(); + } + } + } else { + for (WpsPptxLinkDO child : node.getChildren()) { + traverseTreeAndQueryXml(type, pptxVOS, firstTitle, text, xpath, child, currentXml, new ArrayList<>(pathSoFar), new ArrayList<>(pathChinese), index,2); + } + } + pathSoFar.remove(pathSoFar.size() - 1); + pathChinese.remove(pathChinese.size() - 1); + } + +} diff --git a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/utils/wps_pptx/vo/PptxVO.java b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/utils/wps_pptx/vo/PptxVO.java new file mode 100644 index 00000000..4e62e3e5 --- /dev/null +++ b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/utils/wps_pptx/vo/PptxVO.java @@ -0,0 +1,26 @@ +package pc.exam.pp.module.judgement.utils.wps_pptx.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.util.List; + +@Data +public class PptxVO { + + @Schema(description = "相关文本") + private String wordText; + + @Schema(description = "考试考点") + private List examKeynote; + + @Schema(description = "考点汉化") + private List keynoteChinese; + + @Schema(description = "是否有样式修饰") + private Boolean isTrue; + + @Schema(description = "类型") + private String type; + +} diff --git a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/utils/wps_word/WpsWordUtils.java b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/utils/wps_word/WpsWordUtils.java index afd2ec51..e7ce901d 100644 --- a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/utils/wps_word/WpsWordUtils.java +++ b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/utils/wps_word/WpsWordUtils.java @@ -17,6 +17,11 @@ import java.util.stream.IntStream; public class WpsWordUtils { /** * 获取文档段落W:P标签得数量,判断出一个有多少段 + * @param filePath 文件路径 + * @param paragraphList 段落列表 + * @param anchorList 锚点列表 + * @return List + * @throws Exception Exception */ public static List wps_word(String filePath, List paragraphList, List anchorList) throws Exception { List wordVO = new ArrayList<>(); diff --git a/exam-module-judgement/exam-module-judgement-biz/src/main/resources/mapper/wpspptx/WpsPptxLinkMapper.xml b/exam-module-judgement/exam-module-judgement-biz/src/main/resources/mapper/wpspptx/WpsPptxLinkMapper.xml new file mode 100644 index 00000000..1f10261c --- /dev/null +++ b/exam-module-judgement/exam-module-judgement-biz/src/main/resources/mapper/wpspptx/WpsPptxLinkMapper.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/exam-module-judgement/exam-module-judgement-biz/src/main/resources/mapper/wpsword/WpsWordLinkMapper.xml b/exam-module-judgement/exam-module-judgement-biz/src/main/resources/mapper/wpsword/WpsWordLinkMapper.xml new file mode 100644 index 00000000..409a9c72 --- /dev/null +++ b/exam-module-judgement/exam-module-judgement-biz/src/main/resources/mapper/wpsword/WpsWordLinkMapper.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/exam-module-judgement/exam-module-judgement-biz/src/main/resources/mapper/wpsxlsx/WpsXlsxLinkMapper.xml b/exam-module-judgement/exam-module-judgement-biz/src/main/resources/mapper/wpsxlsx/WpsXlsxLinkMapper.xml new file mode 100644 index 00000000..f213a2da --- /dev/null +++ b/exam-module-judgement/exam-module-judgement-biz/src/main/resources/mapper/wpsxlsx/WpsXlsxLinkMapper.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/exam-module-system/exam-module-system-api/src/main/java/pc/exam/pp/module/system/enums/ErrorCodeConstants.java b/exam-module-system/exam-module-system-api/src/main/java/pc/exam/pp/module/system/enums/ErrorCodeConstants.java index 39d47021..fe3dfa43 100644 --- a/exam-module-system/exam-module-system-api/src/main/java/pc/exam/pp/module/system/enums/ErrorCodeConstants.java +++ b/exam-module-system/exam-module-system-api/src/main/java/pc/exam/pp/module/system/enums/ErrorCodeConstants.java @@ -184,6 +184,24 @@ public interface ErrorCodeConstants { ErrorCode WORD_NOT_ENABLE = new ErrorCode(1_002_030_006, "WORD节点({})不处于开启状态,不允许选择"); ErrorCode WORD_PARENT_IS_CHILD = new ErrorCode(1_002_030_007, "不能设置自己的子WORD节点为父WORD节点"); + // ========== WpsPptx 1-002-031-000 ========== + ErrorCode PPTX_NAME_DUPLICATE = new ErrorCode(1_002_031_000, "已经存在该名字的PPTX节点"); + ErrorCode PPTX_PARENT_NOT_EXITS = new ErrorCode(1_002_031_001,"父级PPTX节点不存在"); + ErrorCode PPTX_NOT_FOUND = new ErrorCode(1_002_031_002, "当前PPTX节点不存在"); + ErrorCode PPTX_EXITS_CHILDREN = new ErrorCode(1_002_031_003, "存在子PPTX节点,无法删除"); + ErrorCode PPTX_PARENT_ERROR = new ErrorCode(1_002_031_004, "不能设置自己为父PPTX节点"); + ErrorCode PPTX_NOT_ENABLE = new ErrorCode(1_002_031_006, "PPTX节点({})不处于开启状态,不允许选择"); + ErrorCode PPTX_PARENT_IS_CHILD = new ErrorCode(1_002_031_007, "不能设置自己的子PPTX节点为父PPTX节点"); + + // ========== WpsXlsx 1-002-032-000 ========== + ErrorCode XLSX_NAME_DUPLICATE = new ErrorCode(1_002_032_000, "已经存在该名字的XLSX节点"); + ErrorCode XLSX_PARENT_NOT_EXITS = new ErrorCode(1_002_032_001,"父级XLSX节点不存在"); + ErrorCode XLSX_NOT_FOUND = new ErrorCode(1_002_032_002, "当前XLSX节点不存在"); + ErrorCode XLSX_EXITS_CHILDREN = new ErrorCode(1_002_032_003, "存在子XLSX节点,无法删除"); + ErrorCode XLSX_PARENT_ERROR = new ErrorCode(1_002_032_004, "不能设置自己为父XLSX节点"); + ErrorCode XLSX_NOT_ENABLE = new ErrorCode(1_002_032_006, "XLSX节点({})不处于开启状态,不允许选择"); + ErrorCode XLSX_PARENT_IS_CHILD = new ErrorCode(1_002_032_007, "不能设置自己的子XLSX节点为父XLSX节点"); + ErrorCode MONITOR_NOT_EXISTS = new ErrorCode(1_003_301_001, "找不到值!"); } diff --git a/exam-module-system/exam-module-system-biz/src/main/java/pc/exam/pp/module/system/dal/redis/RedisKeyConstants.java b/exam-module-system/exam-module-system-biz/src/main/java/pc/exam/pp/module/system/dal/redis/RedisKeyConstants.java index acd0a3c8..fef38528 100644 --- a/exam-module-system/exam-module-system-biz/src/main/java/pc/exam/pp/module/system/dal/redis/RedisKeyConstants.java +++ b/exam-module-system/exam-module-system-biz/src/main/java/pc/exam/pp/module/system/dal/redis/RedisKeyConstants.java @@ -24,6 +24,20 @@ public interface RedisKeyConstants { * VALUE 数据类型:String 子WPS_WORD编号集合 */ String WPS_WORD_CHILDREN_ID_LIST = "wps_word_children_ids"; + /** + * 指定WPS_PPTX的所有子WPS_PPTX编号数组的缓存 + *

+ * KEY 格式:wps_pptx_children_ids:{id} + * VALUE 数据类型:String 子WPS_PPTX编号集合 + */ + String WPS_PPTX_CHILDREN_ID_LIST = "wps_pptx_children_ids"; + /** + * 指定WPS_XLSX的所有子WPS_XLSX编号数组的缓存 + *

+ * KEY 格式:wps_xlsx_children_ids:{id} + * VALUE 数据类型:String 子WPS_XLSX编号集合 + */ + String WPS_XLSX_CHILDREN_ID_LIST = "wps_xlsx_children_ids"; /** * 角色的缓存