Browse Source

bug修复

master
luogw 2 months ago
parent
commit
ac87abdcd3
  1. 5
      src/main/java/com/project/classicpaper/mapper/ClassicCategoryMapper.java
  2. 5
      src/main/java/com/project/classicpaper/mapper/ClassicPaperSetMapper.java
  3. 4
      src/main/java/com/project/information/mapper/ProductLineMapper.java
  4. 1
      src/main/java/com/project/task/domain/param/TaskParam.java
  5. 33
      src/main/java/com/project/task/domain/service/impl/CandidateSearchTaskDomainServiceImpl.java
  6. 41
      src/main/java/com/project/task/domain/service/impl/SearchTaskDomainServiceImpl.java

5
src/main/java/com/project/classicpaper/mapper/ClassicCategoryMapper.java

@ -3,7 +3,12 @@ package com.project.classicpaper.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.project.classicpaper.domain.entity.ClassicCategoryEntity; import com.project.classicpaper.domain.entity.ClassicCategoryEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
@Mapper @Mapper
public interface ClassicCategoryMapper extends BaseMapper<ClassicCategoryEntity> { public interface ClassicCategoryMapper extends BaseMapper<ClassicCategoryEntity> {
@Select("SELECT * FROM evaluator_classic_category WHERE id = #{id}")
ClassicCategoryEntity selectByIdIncludeDeleted(@Param("id") Long id);
} }

5
src/main/java/com/project/classicpaper/mapper/ClassicPaperSetMapper.java

@ -3,7 +3,12 @@ package com.project.classicpaper.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.project.classicpaper.domain.entity.ClassicPaperSetEntity; import com.project.classicpaper.domain.entity.ClassicPaperSetEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
@Mapper @Mapper
public interface ClassicPaperSetMapper extends BaseMapper<ClassicPaperSetEntity> { public interface ClassicPaperSetMapper extends BaseMapper<ClassicPaperSetEntity> {
@Select("SELECT * FROM evaluator_classic_paper_set WHERE id = #{id}")
ClassicPaperSetEntity selectByIdIncludeDeleted(@Param("id") Long id);
} }

4
src/main/java/com/project/information/mapper/ProductLineMapper.java

@ -12,6 +12,10 @@ import java.util.Set;
@Mapper @Mapper
public interface ProductLineMapper extends BaseMapper<ProductLineEntity> { public interface ProductLineMapper extends BaseMapper<ProductLineEntity> {
@Select("SELECT * FROM evaluator_product_line WHERE id = #{id}")
ProductLineEntity selectByIdIncludeDeleted(@Param("id") Long id);
@Select({ @Select({
"<script>", "<script>",
"select t.id, e.name as subLineName,t.short_answer_score ", "select t.id, e.name as subLineName,t.short_answer_score ",

1
src/main/java/com/project/task/domain/param/TaskParam.java

@ -27,4 +27,5 @@ public class TaskParam extends BaseParam {
private Long classicCategoryId; private Long classicCategoryId;
private Long classicPaperSetId;
} }

33
src/main/java/com/project/task/domain/service/impl/CandidateSearchTaskDomainServiceImpl.java

@ -15,11 +15,14 @@ import com.project.classicpaper.domain.entity.ClassicCategoryEntity;
import com.project.classicpaper.domain.entity.ClassicPaperSetEntity; import com.project.classicpaper.domain.entity.ClassicPaperSetEntity;
import com.project.classicpaper.domain.service.ClassicCategoryBaseService; import com.project.classicpaper.domain.service.ClassicCategoryBaseService;
import com.project.classicpaper.domain.service.ClassicPaperSetBaseService; import com.project.classicpaper.domain.service.ClassicPaperSetBaseService;
import com.project.classicpaper.mapper.ClassicCategoryMapper;
import com.project.classicpaper.mapper.ClassicPaperSetMapper;
import com.project.ding.utils.SecurityUtils; import com.project.ding.utils.SecurityUtils;
import com.project.exam.domain.entity.ExamRecordEntity; import com.project.exam.domain.entity.ExamRecordEntity;
import com.project.exam.mapper.ExamRecordMapper; import com.project.exam.mapper.ExamRecordMapper;
import com.project.information.domain.entity.ProductLineEntity; import com.project.information.domain.entity.ProductLineEntity;
import com.project.information.domain.service.ProductLineBaseService; import com.project.information.domain.service.ProductLineBaseService;
import com.project.information.mapper.ProductLineMapper;
import com.project.task.domain.dto.TaskDTO; import com.project.task.domain.dto.TaskDTO;
import com.project.task.domain.entity.TaskEntity; import com.project.task.domain.entity.TaskEntity;
import com.project.task.domain.entity.TaskUserEntity; import com.project.task.domain.entity.TaskUserEntity;
@ -55,13 +58,13 @@ public class CandidateSearchTaskDomainServiceImpl implements CandidateSearchTask
private ExamRecordMapper examRecordMapper; private ExamRecordMapper examRecordMapper;
@Autowired @Autowired
private ProductLineBaseService productLineBaseService; private ClassicPaperSetMapper classicPaperSetMapper;
@Autowired @Autowired
private ClassicPaperSetBaseService classicPaperSetBaseService; private ClassicCategoryMapper classicCategoryMapper;
@Autowired @Autowired
private ClassicCategoryBaseService classicCategoryBaseService; private ProductLineMapper productLineMapper;
@Override @Override
@ -215,16 +218,22 @@ public class CandidateSearchTaskDomainServiceImpl implements CandidateSearchTask
.getOrElse(ExamModeEnum.GENERATIVE) .getOrElse(ExamModeEnum.GENERATIVE)
.getDesc()); .getDesc());
if (ExamModeEnum.GENERATIVE.getValue().equals(dto.getExamMode())) { if (ExamModeEnum.GENERATIVE.getValue().equals(dto.getExamMode())) {
// 生成式 // 生成式 — 包含已删除数据
ProductLineEntity byId = productLineBaseService.getById(dto.getSubLineId()); ProductLineEntity productLine = productLineMapper.selectByIdIncludeDeleted(dto.getSubLineId());
dto.setClassificationTag(String.format("%s - %s" , byId.getParentName() , byId.getName())); if (ObjectUtil.isNotNull(productLine)) {
dto.setClassificationTag(String.format("%s - %s", productLine.getParentName(), productLine.getName()));
}
} else { } else {
// 经典 // 经典 — 包含已删除数据
ClassicPaperSetEntity byId = classicPaperSetBaseService.getById(dto.getClassicPaperSetId()); ClassicPaperSetEntity paperSet = classicPaperSetMapper.selectByIdIncludeDeleted(dto.getClassicPaperSetId());
ClassicCategoryEntity classicCategoryBaseServiceById = classicCategoryBaseService.getById(byId.getClassicCategoryId()); if (ObjectUtil.isNotNull(paperSet)) {
ClassicCategoryEntity classicCategoryBaseServiceByParentId = classicCategoryBaseService.getById(classicCategoryBaseServiceById.getParentId()); ClassicCategoryEntity category = classicCategoryMapper.selectByIdIncludeDeleted(paperSet.getClassicCategoryId());
dto.setClassificationTag(String.format("%s - %s" , classicCategoryBaseServiceByParentId.getName() , byId.getName())); if (ObjectUtil.isNotNull(category) && ObjectUtil.isNotNull(category.getParentId())) {
ClassicCategoryEntity parentCategory = classicCategoryMapper.selectByIdIncludeDeleted(category.getParentId());
String categoryName = ObjectUtil.isNotNull(parentCategory) ? parentCategory.getName() : category.getName();
dto.setClassificationTag(String.format("%s - %s", categoryName, paperSet.getName()));
}
}
} }
return dto; return dto;
} }

41
src/main/java/com/project/task/domain/service/impl/SearchTaskDomainServiceImpl.java

@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.BooleanUtil; import cn.hutool.core.util.BooleanUtil;
import cn.hutool.core.util.EnumUtil; import cn.hutool.core.util.EnumUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
@ -13,12 +14,13 @@ import com.project.base.domain.result.Result;
import com.project.base.domain.utils.PageConverter; import com.project.base.domain.utils.PageConverter;
import com.project.classicpaper.domain.entity.ClassicCategoryEntity; import com.project.classicpaper.domain.entity.ClassicCategoryEntity;
import com.project.classicpaper.domain.entity.ClassicPaperSetEntity; import com.project.classicpaper.domain.entity.ClassicPaperSetEntity;
import com.project.classicpaper.domain.service.ClassicCategoryBaseService; import com.project.classicpaper.mapper.ClassicCategoryMapper;
import com.project.classicpaper.domain.service.ClassicPaperSetBaseService; import com.project.classicpaper.mapper.ClassicPaperSetMapper;
import com.project.ding.domain.dto.UserDTO; import com.project.ding.domain.dto.UserDTO;
import com.project.information.application.ProductLineApplicationService; import com.project.information.application.ProductLineApplicationService;
import com.project.information.domain.entity.ProductLineEntity; import com.project.information.domain.entity.ProductLineEntity;
import com.project.information.domain.service.ProductLineBaseService; import com.project.information.domain.service.ProductLineBaseService;
import com.project.information.mapper.ProductLineMapper;
import com.project.task.domain.dto.TaskDTO; import com.project.task.domain.dto.TaskDTO;
import com.project.task.domain.entity.TaskEntity; import com.project.task.domain.entity.TaskEntity;
import com.project.task.domain.entity.TaskUserEntity; import com.project.task.domain.entity.TaskUserEntity;
@ -52,10 +54,13 @@ public class SearchTaskDomainServiceImpl implements SearchTaskDomainService {
private ProductLineBaseService productLineBaseService; private ProductLineBaseService productLineBaseService;
@Autowired @Autowired
private ClassicPaperSetBaseService classicPaperSetBaseService; private ClassicPaperSetMapper classicPaperSetMapper;
@Autowired @Autowired
private ClassicCategoryBaseService classicCategoryBaseService; private ClassicCategoryMapper classicCategoryMapper;
@Autowired
private ProductLineMapper productLineMapper;
@Override @Override
public Result<PageResult<TaskDTO>> search(TaskParam param) throws Exception { public Result<PageResult<TaskDTO>> search(TaskParam param) throws Exception {
@ -86,6 +91,10 @@ public class SearchTaskDomainServiceImpl implements SearchTaskDomainService {
if (Objects.nonNull(param.getClassicCategoryId())) { if (Objects.nonNull(param.getClassicCategoryId())) {
queryWrapper.eq(TaskEntity::getClassicCategoryId, param.getClassicCategoryId()); queryWrapper.eq(TaskEntity::getClassicCategoryId, param.getClassicCategoryId());
} }
if (Objects.nonNull(param.getClassicPaperSetId())) {
queryWrapper.eq(TaskEntity::getClassicPaperSetId, param.getClassicPaperSetId());
}
// 考试状态过滤 // 考试状态过滤
Date endOfToday = DateUtil.endOfDay(new Date()); Date endOfToday = DateUtil.endOfDay(new Date());
Date beginOfToday = DateUtil.beginOfDay(new Date()); Date beginOfToday = DateUtil.beginOfDay(new Date());
@ -159,16 +168,22 @@ public class SearchTaskDomainServiceImpl implements SearchTaskDomainService {
.getOrElse(ExamModeEnum.GENERATIVE) .getOrElse(ExamModeEnum.GENERATIVE)
.getDesc()); .getDesc());
if (ExamModeEnum.GENERATIVE.getValue().equals(dto.getExamMode())) { if (ExamModeEnum.GENERATIVE.getValue().equals(dto.getExamMode())) {
// 生成式 // 生成式 — 包含已删除数据
ProductLineEntity byId = productLineBaseService.getById(dto.getSubLineId()); ProductLineEntity productLine = productLineMapper.selectByIdIncludeDeleted(dto.getSubLineId());
dto.setClassificationTag(String.format("%s - %s" , byId.getParentName() , byId.getName())); if (ObjectUtil.isNotNull(productLine)) {
dto.setClassificationTag(String.format("%s - %s", productLine.getParentName(), productLine.getName()));
}
} else { } else {
// 经典 // 经典 — 包含已删除数据
ClassicPaperSetEntity byId = classicPaperSetBaseService.getById(dto.getClassicPaperSetId()); ClassicPaperSetEntity paperSet = classicPaperSetMapper.selectByIdIncludeDeleted(dto.getClassicPaperSetId());
ClassicCategoryEntity classicCategoryBaseServiceById = classicCategoryBaseService.getById(byId.getClassicCategoryId()); if (ObjectUtil.isNotNull(paperSet)) {
ClassicCategoryEntity classicCategoryBaseServiceByParentId = classicCategoryBaseService.getById(classicCategoryBaseServiceById.getParentId()); ClassicCategoryEntity category = classicCategoryMapper.selectByIdIncludeDeleted(paperSet.getClassicCategoryId());
dto.setClassificationTag(String.format("%s - %s" , classicCategoryBaseServiceByParentId.getName() , byId.getName())); if (ObjectUtil.isNotNull(category) && ObjectUtil.isNotNull(category.getParentId())) {
ClassicCategoryEntity parentCategory = classicCategoryMapper.selectByIdIncludeDeleted(category.getParentId());
String categoryName = ObjectUtil.isNotNull(parentCategory) ? parentCategory.getName() : category.getName();
dto.setClassificationTag(String.format("%s - %s", categoryName, paperSet.getName()));
}
}
} }
dto.setParticipantUserDTOList(participantUserDTOList); dto.setParticipantUserDTOList(participantUserDTOList);
dto.setParticipantUserIdList(participantUserDTOList.stream().map(UserDTO::getId).toList()); dto.setParticipantUserIdList(participantUserDTOList.stream().map(UserDTO::getId).toList());

Loading…
Cancel
Save