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