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.project.classicpaper.domain.entity.ClassicCategoryEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
@Mapper
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.project.classicpaper.domain.entity.ClassicPaperSetEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
@Mapper
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
public interface ProductLineMapper extends BaseMapper<ProductLineEntity> {
@Select("SELECT * FROM evaluator_product_line WHERE id = #{id}")
ProductLineEntity selectByIdIncludeDeleted(@Param("id") Long id);
@Select({
"<script>",
"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 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.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.utils.SecurityUtils;
import com.project.exam.domain.entity.ExamRecordEntity;
import com.project.exam.mapper.ExamRecordMapper;
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;
@ -55,13 +58,13 @@ public class CandidateSearchTaskDomainServiceImpl implements CandidateSearchTask
private ExamRecordMapper examRecordMapper;
@Autowired
private ProductLineBaseService productLineBaseService;
private ClassicPaperSetMapper classicPaperSetMapper;
@Autowired
private ClassicPaperSetBaseService classicPaperSetBaseService;
private ClassicCategoryMapper classicCategoryMapper;
@Autowired
private ClassicCategoryBaseService classicCategoryBaseService;
private ProductLineMapper productLineMapper;
@Override
@ -215,16 +218,22 @@ public class CandidateSearchTaskDomainServiceImpl implements CandidateSearchTask
.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()));
}
}
}
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.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());

Loading…
Cancel
Save