【新增】新版本使用docx4j验证word
This commit is contained in:
@@ -0,0 +1,83 @@
|
||||
package pc.exam.pp.module.exam.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.exam.controller.admin.wps.vo.docx.DocxListReqVO;
|
||||
import pc.exam.pp.module.exam.controller.admin.wps.vo.docx.DocxRespVO;
|
||||
import pc.exam.pp.module.exam.controller.admin.wps.vo.docx.DocxSaveReqVO;
|
||||
import pc.exam.pp.module.exam.controller.admin.wps.vo.docx.DocxSimpleRespVO;
|
||||
import pc.exam.pp.module.exam.dal.dataobject.wps.ExamWpsDocx;
|
||||
import pc.exam.pp.module.exam.service.wps.docx.ExamWpsDocxService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static pc.exam.pp.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Tag(name = "考试系统 - DOCX考点")
|
||||
@RestController
|
||||
@RequestMapping("/exam/docx")
|
||||
@Validated
|
||||
public class ExamWpsDocxController {
|
||||
|
||||
@Resource
|
||||
private ExamWpsDocxService examWpsDocxService;
|
||||
|
||||
@PostMapping("create")
|
||||
@Operation(summary = "创建Docx考点")
|
||||
public CommonResult<Long> createDocx(@Valid @RequestBody DocxSaveReqVO createReqVO) {
|
||||
Long DocxId = examWpsDocxService.createDocx(createReqVO);
|
||||
return success(DocxId);
|
||||
}
|
||||
|
||||
@PutMapping("update")
|
||||
@Operation(summary = "更新Docx考点")
|
||||
public CommonResult<Boolean> updateDocx(@Valid @RequestBody DocxSaveReqVO updateReqVO) {
|
||||
examWpsDocxService.updateDocx(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("delete")
|
||||
@Operation(summary = "删除Docx考点")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
public CommonResult<Boolean> deleteDocx(@RequestParam("id") Long id) {
|
||||
examWpsDocxService.deleteDocx(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "获取Docx考点列表")
|
||||
public CommonResult<List<DocxRespVO>> getDocxList(DocxListReqVO reqVO) {
|
||||
List<ExamWpsDocx> list = examWpsDocxService.getDocxList(reqVO);
|
||||
return success(BeanUtils.toBean(list, DocxRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping(value = {"/list-all-simple", "/simple-list"})
|
||||
@Operation(summary = "获取Docx考点精简信息列表", description = "只包含被开启的Docx考点,主要用于前端的下拉选项")
|
||||
public CommonResult<List<DocxSimpleRespVO>> getSimpleDocxList() {
|
||||
List<ExamWpsDocx> list = examWpsDocxService.getDocxList(
|
||||
new DocxListReqVO().setStatus(CommonStatusEnum.ENABLE.getStatus()));
|
||||
return success(BeanUtils.toBean(list, DocxSimpleRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得Docx考点信息")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
public CommonResult<DocxRespVO> getDocx(@RequestParam("id") Long id) {
|
||||
ExamWpsDocx Docx = examWpsDocxService.getDocx(id);
|
||||
return success(BeanUtils.toBean(Docx, DocxRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/getByNameList")
|
||||
public CommonResult<List<DocxRespVO>> getDocxByNameList(@RequestParam("title") String title) {
|
||||
ExamWpsDocx Docx = examWpsDocxService.getDocxByTitle(title);
|
||||
return success(BeanUtils.toBean(examWpsDocxService.getChildDocxList(Docx.getId()), DocxRespVO.class));
|
||||
}
|
||||
}
|
@@ -0,0 +1,14 @@
|
||||
package pc.exam.pp.module.exam.controller.admin.wps.vo.docx;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "考试模块 - PPT考点列表 Request VO")
|
||||
@Data
|
||||
public class DocxListReqVO {
|
||||
|
||||
private String name;
|
||||
|
||||
private Integer status;
|
||||
|
||||
}
|
@@ -0,0 +1,40 @@
|
||||
package pc.exam.pp.module.exam.controller.admin.wps.vo.docx;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "考试模块 - PPT考点信息 Response VO")
|
||||
@Data
|
||||
public class DocxRespVO {
|
||||
|
||||
private Long id;
|
||||
|
||||
private String name;
|
||||
|
||||
private Long parentId;
|
||||
|
||||
private Integer sort;
|
||||
|
||||
private Integer status;
|
||||
|
||||
private String title;
|
||||
|
||||
private String chineseName;
|
||||
|
||||
private String dataType;
|
||||
|
||||
private Integer isText;
|
||||
|
||||
private String valueList;
|
||||
|
||||
private Integer isTrue;
|
||||
|
||||
private Integer titleType;
|
||||
|
||||
private Integer isParameter;
|
||||
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
@@ -0,0 +1,36 @@
|
||||
package pc.exam.pp.module.exam.controller.admin.wps.vo.docx;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "考试模块 - PPT考点创建/修改 Request VO")
|
||||
@Data
|
||||
public class DocxSaveReqVO {
|
||||
|
||||
private Long id;
|
||||
|
||||
private String name;
|
||||
|
||||
private Long parentId;
|
||||
|
||||
private Integer sort;
|
||||
|
||||
private Integer status;
|
||||
|
||||
private String title;
|
||||
|
||||
private String chineseName;
|
||||
|
||||
private String dataType;
|
||||
|
||||
private Integer isText;
|
||||
|
||||
private String valueList;
|
||||
|
||||
private Integer isTrue;
|
||||
|
||||
private Integer titleType;
|
||||
|
||||
private Integer isParameter;
|
||||
|
||||
}
|
@@ -0,0 +1,20 @@
|
||||
package pc.exam.pp.module.exam.controller.admin.wps.vo.docx;
|
||||
|
||||
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 DocxSimpleRespVO {
|
||||
|
||||
private Long id;
|
||||
|
||||
private String name;
|
||||
|
||||
private Long parentId;
|
||||
|
||||
}
|
@@ -0,0 +1,41 @@
|
||||
package pc.exam.pp.module.exam.dal.dataobject.wps;
|
||||
|
||||
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.tenant.core.db.TenantBaseDO;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* wps docx关系对应表
|
||||
*
|
||||
* @author REN
|
||||
*/
|
||||
@TableName("exam_wps_docx")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class ExamWpsDocx extends TenantBaseDO {
|
||||
|
||||
public static final Long PARENT_ID_ROOT = 0L;
|
||||
|
||||
@TableId
|
||||
private Long id;
|
||||
private String name;
|
||||
private Long parentId;
|
||||
private String title;
|
||||
private Integer sort;
|
||||
private String chineseName;
|
||||
private String dataType;
|
||||
private Integer status;
|
||||
private String valueList;
|
||||
private Integer isTrue;
|
||||
private Integer isText;
|
||||
private Integer titleType;
|
||||
private Integer isParameter;
|
||||
@TableField(exist = false)
|
||||
private List<ExamWpsDocx> children = new ArrayList<>();
|
||||
}
|
@@ -0,0 +1,36 @@
|
||||
package pc.exam.pp.module.exam.dal.mysql.wps;
|
||||
|
||||
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.exam.controller.admin.wps.vo.docx.DocxListReqVO;
|
||||
import pc.exam.pp.module.exam.dal.dataobject.wps.ExamWpsDocx;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface ExamWpsDocxMapper extends BaseMapperX<ExamWpsDocx> {
|
||||
|
||||
default List<ExamWpsDocx> selectList(DocxListReqVO reqVO) {
|
||||
return selectList(new LambdaQueryWrapperX<ExamWpsDocx>()
|
||||
.likeIfPresent(ExamWpsDocx::getName, reqVO.getName())
|
||||
.eqIfPresent(ExamWpsDocx::getStatus, reqVO.getStatus()));
|
||||
}
|
||||
|
||||
default ExamWpsDocx selectByParentIdAndName(Long parentId, String name) {
|
||||
return selectOne(ExamWpsDocx::getParentId, parentId, ExamWpsDocx::getName, name);
|
||||
}
|
||||
|
||||
default ExamWpsDocx selectByTitle(String title) {
|
||||
return selectOne(ExamWpsDocx::getTitle, title);
|
||||
}
|
||||
|
||||
default Long selectCountByParentId(Long parentId) {
|
||||
return selectCount(ExamWpsDocx::getParentId, parentId);
|
||||
}
|
||||
|
||||
default List<ExamWpsDocx> selectListByParentId(Collection<Long> parentIds) {
|
||||
return selectList(ExamWpsDocx::getParentId, parentIds);
|
||||
}
|
||||
}
|
@@ -0,0 +1,221 @@
|
||||
package pc.exam.pp.module.exam.service.wps.docx;
|
||||
|
||||
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.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.module.exam.controller.admin.wps.vo.docx.DocxListReqVO;
|
||||
import pc.exam.pp.module.exam.controller.admin.wps.vo.docx.DocxSaveReqVO;
|
||||
import pc.exam.pp.module.exam.dal.dataobject.wps.ExamWpsDocx;
|
||||
import pc.exam.pp.module.exam.dal.mysql.wps.ExamWpsDocxMapper;
|
||||
|
||||
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.*;
|
||||
|
||||
/**
|
||||
* Docx考点 Service 实现类
|
||||
*
|
||||
* @author 朋辰
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
@Slf4j
|
||||
public class ExamWpsDcxoServiceImpl implements ExamWpsDocxService {
|
||||
|
||||
@Resource
|
||||
private ExamWpsDocxMapper DocxMapper;
|
||||
|
||||
@Override
|
||||
public Long createDocx(DocxSaveReqVO createReqVO) {
|
||||
if (createReqVO.getParentId() == null) {
|
||||
createReqVO.setParentId(ExamWpsDocx.PARENT_ID_ROOT);
|
||||
}
|
||||
// 校验父Docx考点的有效性
|
||||
validateParentDocx(null, createReqVO.getParentId());
|
||||
// 校验Docx考点名的唯一性
|
||||
validateDocxNameUnique(null, createReqVO.getParentId(), createReqVO.getName());
|
||||
|
||||
// 插入Docx考点
|
||||
ExamWpsDocx Docx = BeanUtils.toBean(createReqVO, ExamWpsDocx.class);
|
||||
DocxMapper.insert(Docx);
|
||||
return Docx.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateDocx(DocxSaveReqVO updateReqVO) {
|
||||
if (updateReqVO.getParentId() == null) {
|
||||
updateReqVO.setParentId(ExamWpsDocx.PARENT_ID_ROOT);
|
||||
}
|
||||
// 校验自己存在
|
||||
validateDocxExists(updateReqVO.getId());
|
||||
// 校验父Docx考点的有效性
|
||||
validateParentDocx(updateReqVO.getId(), updateReqVO.getParentId());
|
||||
// 校验Docx考点名的唯一性
|
||||
validateDocxNameUnique(updateReqVO.getId(), updateReqVO.getParentId(), updateReqVO.getName());
|
||||
|
||||
// 更新Docx考点
|
||||
ExamWpsDocx updateObj = BeanUtils.toBean(updateReqVO, ExamWpsDocx.class);
|
||||
DocxMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteDocx(Long id) {
|
||||
// 校验是否存在
|
||||
validateDocxExists(id);
|
||||
// 校验是否有子Docx考点
|
||||
if (DocxMapper.selectCountByParentId(id) > 0) {
|
||||
throw exception(DOCX_EXITS_CHILDREN);
|
||||
}
|
||||
// 删除Docx考点
|
||||
DocxMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
void validateDocxExists(Long id) {
|
||||
if (id == null) {
|
||||
return;
|
||||
}
|
||||
ExamWpsDocx Docx = DocxMapper.selectById(id);
|
||||
if (Docx == null) {
|
||||
throw exception(DOCX_NOT_FOUND);
|
||||
}
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
void validateParentDocx(Long id, Long parentId) {
|
||||
if (parentId == null || ExamWpsDocx.PARENT_ID_ROOT.equals(parentId)) {
|
||||
return;
|
||||
}
|
||||
// 1. 不能设置自己为父Docx考点
|
||||
if (Objects.equals(id, parentId)) {
|
||||
throw exception(DOCX_PARENT_ERROR);
|
||||
}
|
||||
// 2. 父Docx考点不存在
|
||||
ExamWpsDocx parent = DocxMapper.selectById(parentId);
|
||||
if (parent == null) {
|
||||
throw exception(DOCX_PARENT_NOT_EXITS);
|
||||
}
|
||||
// 3. 递归校验父Docx考点,如果父Docx考点是自己的子Docx考点,则报错,避免形成环路
|
||||
if (id == null) { // id 为空,说明新增,不需要考虑环路
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < Short.MAX_VALUE; i++) {
|
||||
// 3.1 校验环路
|
||||
parentId = parent.getParentId();
|
||||
if (Objects.equals(id, parentId)) {
|
||||
throw exception(DOCX_PARENT_IS_CHILD);
|
||||
}
|
||||
// 3.2 继续递归下一级父Docx考点
|
||||
if (parentId == null || ExamWpsDocx.PARENT_ID_ROOT.equals(parentId)) {
|
||||
break;
|
||||
}
|
||||
parent = DocxMapper.selectById(parentId);
|
||||
if (parent == null) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
void validateDocxNameUnique(Long id, Long parentId, String name) {
|
||||
ExamWpsDocx dept = DocxMapper.selectByParentIdAndName(parentId, name);
|
||||
if (dept == null) {
|
||||
return;
|
||||
}
|
||||
// 如果 id 为空,说明不用比较是否为相同 id 的Docx考点
|
||||
if (id == null) {
|
||||
throw exception(DOCX_NAME_DUPLICATE);
|
||||
}
|
||||
if (ObjectUtil.notEqual(dept.getId(), id)) {
|
||||
throw exception(DOCX_NAME_DUPLICATE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExamWpsDocx getDocx(Long id) {
|
||||
return DocxMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExamWpsDocx getDocxByTitle(String title) {
|
||||
return DocxMapper.selectByTitle(title);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ExamWpsDocx> getDocxList(Collection<Long> ids) {
|
||||
if (CollUtil.isEmpty(ids)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return DocxMapper.selectBatchIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ExamWpsDocx> getDocxList(DocxListReqVO reqVO) {
|
||||
List<ExamWpsDocx> list = DocxMapper.selectList(reqVO);
|
||||
list.sort(Comparator.comparing(ExamWpsDocx::getSort));
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<Long, ExamWpsDocx> getDocxMap(Collection<Long> ids) {
|
||||
return ExamWpsDocxService.super.getDocxMap(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ExamWpsDocx> getChildDocxList(Long id) {
|
||||
return ExamWpsDocxService.super.getChildDocxList(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ExamWpsDocx> getChildDocxList(Collection<Long> ids) {
|
||||
List<ExamWpsDocx> children = new LinkedList<>();
|
||||
// 遍历每一层
|
||||
Collection<Long> parentIds = ids;
|
||||
for (int i = 0; i < Short.MAX_VALUE; i++) { // 使用 Short.MAX_VALUE 避免 bug 场景下,存在死循环
|
||||
// 查询当前层,所有的子Docx考点
|
||||
List<ExamWpsDocx> Docxs = DocxMapper.selectListByParentId(parentIds);
|
||||
// 1. 如果没有子Docx考点,则结束遍历
|
||||
if (CollUtil.isEmpty(Docxs)) {
|
||||
break;
|
||||
}
|
||||
// 2. 如果有子Docx考点,继续遍历
|
||||
children.addAll(Docxs);
|
||||
parentIds = convertSet(Docxs, ExamWpsDocx::getId);
|
||||
}
|
||||
return children;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Long> getChildDocxIdListFromCache(Long id) {
|
||||
List<ExamWpsDocx> children = getChildDocxList(id);
|
||||
return convertSet(children, ExamWpsDocx::getId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validateDocxList(Collection<Long> ids) {
|
||||
if (CollUtil.isEmpty(ids)) {
|
||||
return;
|
||||
}
|
||||
// 获得信息
|
||||
Map<Long, ExamWpsDocx> DocxMap = getDocxMap(ids);
|
||||
// 校验
|
||||
ids.forEach(id -> {
|
||||
ExamWpsDocx Docx = DocxMap.get(id);
|
||||
if (Docx == null) {
|
||||
throw exception(DOCX_NOT_FOUND);
|
||||
}
|
||||
if (!CommonStatusEnum.ENABLE.getStatus().equals(Docx.getStatus())) {
|
||||
throw exception(DOCX_NOT_ENABLE, Docx.getName());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,117 @@
|
||||
package pc.exam.pp.module.exam.service.wps.docx;
|
||||
|
||||
import pc.exam.pp.framework.common.util.collection.CollectionUtils;
|
||||
import pc.exam.pp.module.exam.controller.admin.wps.vo.docx.DocxListReqVO;
|
||||
import pc.exam.pp.module.exam.controller.admin.wps.vo.docx.DocxSaveReqVO;
|
||||
import pc.exam.pp.module.exam.dal.dataobject.wps.ExamWpsDocx;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Docx考点 Service 接口
|
||||
*
|
||||
* @author 朋辰
|
||||
*/
|
||||
public interface ExamWpsDocxService {
|
||||
|
||||
/**
|
||||
* 创建Docx考点
|
||||
*
|
||||
* @param createReqVO Docx考点信息
|
||||
* @return Docx考点编号
|
||||
*/
|
||||
Long createDocx(DocxSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新Docx考点
|
||||
*
|
||||
* @param updateReqVO Docx考点信息
|
||||
*/
|
||||
void updateDocx(DocxSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除Docx考点
|
||||
*
|
||||
* @param id Docx考点编号
|
||||
*/
|
||||
void deleteDocx(Long id);
|
||||
|
||||
/**
|
||||
* 获得Docx考点信息
|
||||
*
|
||||
* @param id Docx考点编号
|
||||
* @return Docx考点信息
|
||||
*/
|
||||
ExamWpsDocx getDocx(Long id);
|
||||
|
||||
/**
|
||||
* 获得Docx考点信息
|
||||
*
|
||||
* @param title Docx考点标签
|
||||
* @return Docx考点信息
|
||||
*/
|
||||
ExamWpsDocx getDocxByTitle(String title);
|
||||
|
||||
/**
|
||||
* 获得Docx考点信息数组
|
||||
*
|
||||
* @param ids Docx考点编号数组
|
||||
* @return Docx考点信息数组
|
||||
*/
|
||||
List<ExamWpsDocx> getDocxList(Collection<Long> ids);
|
||||
|
||||
/**
|
||||
* 筛选Docx考点列表
|
||||
*
|
||||
* @param reqVO 筛选条件请求 VO
|
||||
* @return Docx考点列表
|
||||
*/
|
||||
List<ExamWpsDocx> getDocxList(DocxListReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 获得指定编号的Docx考点 Map
|
||||
*
|
||||
* @param ids Docx考点编号数组
|
||||
* @return Docx考点 Map
|
||||
*/
|
||||
default Map<Long, ExamWpsDocx> getDocxMap(Collection<Long> ids) {
|
||||
List<ExamWpsDocx> list = getDocxList(ids);
|
||||
return CollectionUtils.convertMap(list, ExamWpsDocx::getId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得指定Docx考点的所有子Docx考点
|
||||
*
|
||||
* @param id Docx考点编号
|
||||
* @return 子Docx考点列表
|
||||
*/
|
||||
default List<ExamWpsDocx> getChildDocxList(Long id) {
|
||||
return getChildDocxList(Collections.singleton(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得指定Docx考点的所有子Docx考点
|
||||
*
|
||||
* @param ids Docx考点编号数组
|
||||
* @return 子Docx考点列表
|
||||
*/
|
||||
List<ExamWpsDocx> getChildDocxList(Collection<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得所有子Docx考点,从缓存中
|
||||
*
|
||||
* @param id 父Docx考点编号
|
||||
* @return 子Docx考点列表
|
||||
*/
|
||||
Set<Long> getChildDocxIdListFromCache(Long id);
|
||||
|
||||
/**
|
||||
* 校验Docx考点们是否有效。如下情况,视为无效:
|
||||
* 1. Docx考点编号不存在
|
||||
* 2. Docx考点被禁用
|
||||
*
|
||||
* @param ids 角色编号数组
|
||||
*/
|
||||
void validateDocxList(Collection<Long> ids);
|
||||
|
||||
}
|
Reference in New Issue
Block a user