fix: 教培调整
parent
3da8c36455
commit
b85d7284f8
|
|
@ -111,7 +111,7 @@ public class ClassCourseServiceImpl extends ServiceImpl<ClassCourseMapper, Class
|
||||||
*/
|
*/
|
||||||
private ClassCourseDO buildEntity(ClassCourseDTO dto) {
|
private ClassCourseDO buildEntity(ClassCourseDTO dto) {
|
||||||
ClassCourseDO entity = classCourseConvertor.convertDtoToE(dto);
|
ClassCourseDO entity = classCourseConvertor.convertDtoToE(dto);
|
||||||
InsertFieldDefaults.applyIgnoreOrgId(entity);
|
InsertFieldDefaults.apply(entity);
|
||||||
entity.setUpdateTime(LocalDateTime.now());
|
entity.setUpdateTime(LocalDateTime.now());
|
||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
|
|
@ -119,7 +119,7 @@ public class ClassCourseServiceImpl extends ServiceImpl<ClassCourseMapper, Class
|
||||||
@Override
|
@Override
|
||||||
public boolean updateCourse(ClassCourseDTO dto) {
|
public boolean updateCourse(ClassCourseDTO dto) {
|
||||||
ClassCourseDO entity = classCourseConvertor.convertDtoToE(dto);
|
ClassCourseDO entity = classCourseConvertor.convertDtoToE(dto);
|
||||||
InsertFieldDefaults.applyForUpdateIgnoreOrgId(entity);
|
InsertFieldDefaults.applyForUpdate(entity);
|
||||||
return this.updateById(entity);
|
return this.updateById(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@ public class ClassManagementServiceImpl extends ServiceImpl<ClassManagementMappe
|
||||||
@Override
|
@Override
|
||||||
public Long saveClass(ClassManagementDTO dto) {
|
public Long saveClass(ClassManagementDTO dto) {
|
||||||
ClassManagementDO entity = classManagementConvertor.convertDtoToE(dto);
|
ClassManagementDO entity = classManagementConvertor.convertDtoToE(dto);
|
||||||
InsertFieldDefaults.applyIgnoreOrgId(entity);
|
InsertFieldDefaults.apply(entity);
|
||||||
entity.setUpdateTime(LocalDateTime.now());
|
entity.setUpdateTime(LocalDateTime.now());
|
||||||
if (entity.getStatus() == null) {
|
if (entity.getStatus() == null) {
|
||||||
entity.setStatus(0);
|
entity.setStatus(0);
|
||||||
|
|
@ -119,7 +119,7 @@ public class ClassManagementServiceImpl extends ServiceImpl<ClassManagementMappe
|
||||||
@Override
|
@Override
|
||||||
public boolean updateClass(ClassManagementDTO dto) {
|
public boolean updateClass(ClassManagementDTO dto) {
|
||||||
ClassManagementDO entity = classManagementConvertor.convertDtoToE(dto);
|
ClassManagementDO entity = classManagementConvertor.convertDtoToE(dto);
|
||||||
InsertFieldDefaults.applyForUpdateIgnoreOrgId(entity);
|
InsertFieldDefaults.applyForUpdate(entity);
|
||||||
return this.updateById(entity);
|
return this.updateById(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ public class ClassStudentExamRecordServiceImpl extends ServiceImpl<ClassStudentE
|
||||||
@Override
|
@Override
|
||||||
public boolean saveRecord(ClassStudentExamRecordDTO dto) {
|
public boolean saveRecord(ClassStudentExamRecordDTO dto) {
|
||||||
ClassStudentExamRecordDO entity = classStudentExamRecordConvertor.convertDtoToE(dto);
|
ClassStudentExamRecordDO entity = classStudentExamRecordConvertor.convertDtoToE(dto);
|
||||||
InsertFieldDefaults.applyIgnoreOrgId(entity);
|
InsertFieldDefaults.apply(entity);
|
||||||
entity.setUpdateTime(LocalDateTime.now());
|
entity.setUpdateTime(LocalDateTime.now());
|
||||||
if (entity.getPassed() == null) {
|
if (entity.getPassed() == null) {
|
||||||
entity.setPassed(0);
|
entity.setPassed(0);
|
||||||
|
|
@ -66,7 +66,7 @@ public class ClassStudentExamRecordServiceImpl extends ServiceImpl<ClassStudentE
|
||||||
@Override
|
@Override
|
||||||
public boolean updateRecord(ClassStudentExamRecordDTO dto) {
|
public boolean updateRecord(ClassStudentExamRecordDTO dto) {
|
||||||
ClassStudentExamRecordDO entity = classStudentExamRecordConvertor.convertDtoToE(dto);
|
ClassStudentExamRecordDO entity = classStudentExamRecordConvertor.convertDtoToE(dto);
|
||||||
InsertFieldDefaults.applyForUpdateIgnoreOrgId(entity);
|
InsertFieldDefaults.applyForUpdate(entity);
|
||||||
return this.updateById(entity);
|
return this.updateById(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ public class ClassStudentLearningRecordServiceImpl extends ServiceImpl<ClassStud
|
||||||
@Override
|
@Override
|
||||||
public boolean saveRecord(ClassStudentLearningRecordDTO dto) {
|
public boolean saveRecord(ClassStudentLearningRecordDTO dto) {
|
||||||
ClassStudentLearningRecordDO entity = classStudentLearningRecordConvertor.convertDtoToE(dto);
|
ClassStudentLearningRecordDO entity = classStudentLearningRecordConvertor.convertDtoToE(dto);
|
||||||
InsertFieldDefaults.applyIgnoreOrgId(entity);
|
InsertFieldDefaults.apply(entity);
|
||||||
entity.setUpdateTime(LocalDateTime.now());
|
entity.setUpdateTime(LocalDateTime.now());
|
||||||
if (entity.getStudyStatus() == null) {
|
if (entity.getStudyStatus() == null) {
|
||||||
entity.setStudyStatus(0);
|
entity.setStudyStatus(0);
|
||||||
|
|
@ -63,7 +63,7 @@ public class ClassStudentLearningRecordServiceImpl extends ServiceImpl<ClassStud
|
||||||
@Override
|
@Override
|
||||||
public boolean updateRecord(ClassStudentLearningRecordDTO dto) {
|
public boolean updateRecord(ClassStudentLearningRecordDTO dto) {
|
||||||
ClassStudentLearningRecordDO entity = classStudentLearningRecordConvertor.convertDtoToE(dto);
|
ClassStudentLearningRecordDO entity = classStudentLearningRecordConvertor.convertDtoToE(dto);
|
||||||
InsertFieldDefaults.applyForUpdateIgnoreOrgId(entity);
|
InsertFieldDefaults.applyForUpdate(entity);
|
||||||
return this.updateById(entity);
|
return this.updateById(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@ public class ClassStudentServiceImpl extends ServiceImpl<ClassStudentMapper, Cla
|
||||||
*/
|
*/
|
||||||
private ClassStudentDO buildEntity(ClassStudentDTO dto) {
|
private ClassStudentDO buildEntity(ClassStudentDTO dto) {
|
||||||
ClassStudentDO entity = classStudentConvertor.convertDtoToE(dto);
|
ClassStudentDO entity = classStudentConvertor.convertDtoToE(dto);
|
||||||
InsertFieldDefaults.applyIgnoreOrgId(entity);
|
InsertFieldDefaults.apply(entity);
|
||||||
entity.setUpdateTime(LocalDateTime.now());
|
entity.setUpdateTime(LocalDateTime.now());
|
||||||
if (entity.getFaceAuth() == null) {
|
if (entity.getFaceAuth() == null) {
|
||||||
entity.setFaceAuth(0);
|
entity.setFaceAuth(0);
|
||||||
|
|
@ -102,7 +102,7 @@ public class ClassStudentServiceImpl extends ServiceImpl<ClassStudentMapper, Cla
|
||||||
@Override
|
@Override
|
||||||
public boolean updateStudent(ClassStudentDTO dto) {
|
public boolean updateStudent(ClassStudentDTO dto) {
|
||||||
ClassStudentDO entity = classStudentConvertor.convertDtoToE(dto);
|
ClassStudentDO entity = classStudentConvertor.convertDtoToE(dto);
|
||||||
InsertFieldDefaults.applyForUpdateIgnoreOrgId(entity);
|
InsertFieldDefaults.applyForUpdate(entity);
|
||||||
return this.updateById(entity);
|
return this.updateById(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,13 +7,16 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import org.qinan.cedu.convertor.CourseManagementConvertor;
|
import org.qinan.cedu.convertor.CourseManagementConvertor;
|
||||||
import org.qinan.cedu.convertor.CourseRelCoursewareConvertor;
|
import org.qinan.cedu.convertor.CourseRelCoursewareConvertor;
|
||||||
import org.qinan.cedu.enums.DeleteEnum;
|
import org.qinan.cedu.enums.DeleteEnum;
|
||||||
|
import org.qinan.cedu.mapper.ClassCourseMapper;
|
||||||
|
import org.qinan.cedu.mapper.ClassManagementMapper;
|
||||||
import org.qinan.cedu.mapper.CourseManagementMapper;
|
import org.qinan.cedu.mapper.CourseManagementMapper;
|
||||||
import org.qinan.cedu.mapper.CourseRelCoursewareMapper;
|
import org.qinan.cedu.mapper.CourseRelCoursewareMapper;
|
||||||
import org.qinan.cedu.model.dto.CourseManagementDTO;
|
import org.qinan.cedu.model.dto.CourseManagementDTO;
|
||||||
import org.qinan.cedu.model.vo.CourseManagementVO;
|
import org.qinan.cedu.model.entity.ClassCourseDO;
|
||||||
import org.qinan.cedu.model.entity.CourseManagementDO;
|
import org.qinan.cedu.model.entity.CourseManagementDO;
|
||||||
import org.qinan.cedu.model.entity.CourseRelCoursewareDO;
|
import org.qinan.cedu.model.entity.CourseRelCoursewareDO;
|
||||||
import org.qinan.cedu.model.query.CourseManagementPageQuery;
|
import org.qinan.cedu.model.query.CourseManagementPageQuery;
|
||||||
|
import org.qinan.cedu.model.vo.CourseManagementVO;
|
||||||
import org.qinan.cedu.service.CourseManagementService;
|
import org.qinan.cedu.service.CourseManagementService;
|
||||||
import org.qinan.safetyeval.infrastructure.support.InsertFieldDefaults;
|
import org.qinan.safetyeval.infrastructure.support.InsertFieldDefaults;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
@ -24,7 +27,9 @@ import org.springframework.util.StringUtils;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 课程管理服务实现
|
* 课程管理服务实现
|
||||||
|
|
@ -39,6 +44,10 @@ public class CourseManagementServiceImpl extends ServiceImpl<CourseManagementMap
|
||||||
private CourseRelCoursewareConvertor courseRelCoursewareConvertor;
|
private CourseRelCoursewareConvertor courseRelCoursewareConvertor;
|
||||||
@Autowired
|
@Autowired
|
||||||
private CourseRelCoursewareMapper courseRelCoursewareMapper;
|
private CourseRelCoursewareMapper courseRelCoursewareMapper;
|
||||||
|
@Autowired
|
||||||
|
private ClassManagementMapper classManagementMapper;
|
||||||
|
@Autowired
|
||||||
|
private ClassCourseMapper classCourseMapper;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -51,12 +60,16 @@ public class CourseManagementServiceImpl extends ServiceImpl<CourseManagementMap
|
||||||
.orderByDesc(CourseManagementDO::getCreateTime)
|
.orderByDesc(CourseManagementDO::getCreateTime)
|
||||||
.page(new Page<>(query.getCurrent(), query.getSize()));
|
.page(new Page<>(query.getCurrent(), query.getSize()));
|
||||||
IPage<CourseManagementVO> convert = page.convert(courseManagementConvertor::convertEToVo);
|
IPage<CourseManagementVO> convert = page.convert(courseManagementConvertor::convertEToVo);
|
||||||
|
Map<Long, Integer> collectMap = classCourseMapper.selectList(new LambdaQueryWrapper<ClassCourseDO>()
|
||||||
|
.in(ClassCourseDO::getCourseId, convert.getRecords().stream().map(CourseManagementVO::getId)))
|
||||||
|
.stream().collect(Collectors.toMap(ClassCourseDO::getCourseId, v -> 1));
|
||||||
convert.getRecords().forEach(vo -> {
|
convert.getRecords().forEach(vo -> {
|
||||||
vo.setCourseRelCoursewareVOList(courseRelCoursewareConvertor.convertEListToVoList(
|
vo.setCourseRelCoursewareVOList(courseRelCoursewareConvertor.convertEListToVoList(
|
||||||
courseRelCoursewareMapper.selectList(new LambdaQueryWrapper<CourseRelCoursewareDO>()
|
courseRelCoursewareMapper.selectList(new LambdaQueryWrapper<CourseRelCoursewareDO>()
|
||||||
.eq(CourseRelCoursewareDO::getCourseId, vo.getId())
|
.eq(CourseRelCoursewareDO::getCourseId, vo.getId())
|
||||||
.orderByAsc(CourseRelCoursewareDO::getSort))
|
.orderByAsc(CourseRelCoursewareDO::getSort))
|
||||||
));
|
));
|
||||||
|
vo.setUsed(Math.toIntExact(collectMap.getOrDefault(Long.valueOf(vo.getId()), 0)));
|
||||||
});
|
});
|
||||||
return convert;
|
return convert;
|
||||||
}
|
}
|
||||||
|
|
@ -80,7 +93,7 @@ public class CourseManagementServiceImpl extends ServiceImpl<CourseManagementMap
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public boolean saveCourse(CourseManagementDTO dto) {
|
public boolean saveCourse(CourseManagementDTO dto) {
|
||||||
CourseManagementDO entity = courseManagementConvertor.convertDtoToE(dto);
|
CourseManagementDO entity = courseManagementConvertor.convertDtoToE(dto);
|
||||||
InsertFieldDefaults.applyIgnoreOrgId(entity);
|
InsertFieldDefaults.apply(entity);
|
||||||
LocalDateTime now = LocalDateTime.now();
|
LocalDateTime now = LocalDateTime.now();
|
||||||
entity.setUpdateTime(now);
|
entity.setUpdateTime(now);
|
||||||
if (entity.getUsed() == null) {
|
if (entity.getUsed() == null) {
|
||||||
|
|
@ -103,7 +116,7 @@ public class CourseManagementServiceImpl extends ServiceImpl<CourseManagementMap
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public boolean updateCourse(CourseManagementDTO dto) {
|
public boolean updateCourse(CourseManagementDTO dto) {
|
||||||
CourseManagementDO entity = courseManagementConvertor.convertDtoToE(dto);
|
CourseManagementDO entity = courseManagementConvertor.convertDtoToE(dto);
|
||||||
InsertFieldDefaults.applyForUpdateIgnoreOrgId(entity);
|
InsertFieldDefaults.applyForUpdate(entity);
|
||||||
courseRelCoursewareMapper.delete(new LambdaQueryWrapper<CourseRelCoursewareDO>()
|
courseRelCoursewareMapper.delete(new LambdaQueryWrapper<CourseRelCoursewareDO>()
|
||||||
.eq(CourseRelCoursewareDO::getCourseId, entity.getId()));
|
.eq(CourseRelCoursewareDO::getCourseId, entity.getId()));
|
||||||
List<CourseRelCoursewareDO> courseRelCoursewareDOS = courseRelCoursewareConvertor.convertDtoListToEList(dto.getCourseRelCoursewareDTOList());
|
List<CourseRelCoursewareDO> courseRelCoursewareDOS = courseRelCoursewareConvertor.convertDtoListToEList(dto.getCourseRelCoursewareDTOList());
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ public class CoursewareManagementServiceImpl extends ServiceImpl<CoursewareManag
|
||||||
@Override
|
@Override
|
||||||
public boolean saveCourseware(CoursewareManagementDTO dto) {
|
public boolean saveCourseware(CoursewareManagementDTO dto) {
|
||||||
CoursewareManagementDO entity = coursewareManagementConvertor.convertDtoToE(dto);
|
CoursewareManagementDO entity = coursewareManagementConvertor.convertDtoToE(dto);
|
||||||
InsertFieldDefaults.applyIgnoreOrgId(entity);
|
InsertFieldDefaults.apply(entity);
|
||||||
if (dto.getClassHourDuration() != null) {
|
if (dto.getClassHourDuration() != null) {
|
||||||
entity.setClassHourDuration(dto.getClassHourDuration());
|
entity.setClassHourDuration(dto.getClassHourDuration());
|
||||||
entity.setCreditHours(dto.getClassHourDuration().divide(new BigDecimal("45"), 1, RoundingMode.HALF_UP));
|
entity.setCreditHours(dto.getClassHourDuration().divide(new BigDecimal("45"), 1, RoundingMode.HALF_UP));
|
||||||
|
|
@ -79,7 +79,7 @@ public class CoursewareManagementServiceImpl extends ServiceImpl<CoursewareManag
|
||||||
@Override
|
@Override
|
||||||
public boolean updateCourseware(CoursewareManagementDTO dto) {
|
public boolean updateCourseware(CoursewareManagementDTO dto) {
|
||||||
CoursewareManagementDO entity = coursewareManagementConvertor.convertDtoToE(dto);
|
CoursewareManagementDO entity = coursewareManagementConvertor.convertDtoToE(dto);
|
||||||
InsertFieldDefaults.applyForUpdateIgnoreOrgId(entity);
|
InsertFieldDefaults.applyForUpdate(entity);
|
||||||
if (dto.getClassHourDuration() != null) {
|
if (dto.getClassHourDuration() != null) {
|
||||||
entity.setClassHourDuration(dto.getClassHourDuration());
|
entity.setClassHourDuration(dto.getClassHourDuration());
|
||||||
entity.setCreditHours(dto.getClassHourDuration().divide(new BigDecimal("45"), 1, RoundingMode.HALF_UP));
|
entity.setCreditHours(dto.getClassHourDuration().divide(new BigDecimal("45"), 1, RoundingMode.HALF_UP));
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@ public class PaperQuestionRelServiceImpl extends ServiceImpl<PaperQuestionRelMap
|
||||||
.map(option -> String.valueOf(option.getId()))
|
.map(option -> String.valueOf(option.getId()))
|
||||||
.collect(Collectors.joining(",")));
|
.collect(Collectors.joining(",")));
|
||||||
|
|
||||||
InsertFieldDefaults.applyIgnoreOrgId(question);
|
InsertFieldDefaults.apply(question);
|
||||||
questionMapper.insert(question);
|
questionMapper.insert(question);
|
||||||
Db.saveBatch(options);
|
Db.saveBatch(options);
|
||||||
|
|
||||||
|
|
@ -96,7 +96,7 @@ public class PaperQuestionRelServiceImpl extends ServiceImpl<PaperQuestionRelMap
|
||||||
rel.setPaperId(dto.getPaperId());
|
rel.setPaperId(dto.getPaperId());
|
||||||
rel.setQuestionId(question.getId());
|
rel.setQuestionId(question.getId());
|
||||||
rel.setScore(dto.getScore());
|
rel.setScore(dto.getScore());
|
||||||
InsertFieldDefaults.applyIgnoreOrgId(rel);
|
InsertFieldDefaults.apply(rel);
|
||||||
this.save(rel);
|
this.save(rel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -118,7 +118,7 @@ public class PaperQuestionRelServiceImpl extends ServiceImpl<PaperQuestionRelMap
|
||||||
option.setOptionKey(key);
|
option.setOptionKey(key);
|
||||||
option.setOptionName(key);
|
option.setOptionName(key);
|
||||||
option.setSortOrder(sortOrder++);
|
option.setSortOrder(sortOrder++);
|
||||||
InsertFieldDefaults.applyIgnoreOrgId(option);
|
InsertFieldDefaults.apply(option);
|
||||||
}
|
}
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
|
|
@ -225,7 +225,7 @@ public class PaperQuestionRelServiceImpl extends ServiceImpl<PaperQuestionRelMap
|
||||||
InsertFieldDefaults.applyForUpdate(option);
|
InsertFieldDefaults.applyForUpdate(option);
|
||||||
} else {
|
} else {
|
||||||
option.setId(IdUtil.getSnowflakeNextId());
|
option.setId(IdUtil.getSnowflakeNextId());
|
||||||
InsertFieldDefaults.applyIgnoreOrgId(option);
|
InsertFieldDefaults.apply(option);
|
||||||
toInsert.add(option);
|
toInsert.add(option);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -154,7 +154,7 @@ public class PaperServiceImpl extends ServiceImpl<PaperMapper, PaperDO> implemen
|
||||||
|
|
||||||
// 新增试卷(名称/总分/合格分数取请求,其余属性沿用源试卷)
|
// 新增试卷(名称/总分/合格分数取请求,其余属性沿用源试卷)
|
||||||
PaperDO target = paperConvertor.convertCopyDtoToE(copyDTO, source);
|
PaperDO target = paperConvertor.convertCopyDtoToE(copyDTO, source);
|
||||||
InsertFieldDefaults.applyIgnoreOrgId(target);
|
InsertFieldDefaults.apply(target);
|
||||||
this.savePaper(target);
|
this.savePaper(target);
|
||||||
|
|
||||||
// 复制试题+选项+试卷试题关系(id全部换新雪花id)
|
// 复制试题+选项+试卷试题关系(id全部换新雪花id)
|
||||||
|
|
@ -170,7 +170,7 @@ public class PaperServiceImpl extends ServiceImpl<PaperMapper, PaperDO> implemen
|
||||||
Long oldQuestionId = question.getId();
|
Long oldQuestionId = question.getId();
|
||||||
Long newQuestionId = IdUtil.getSnowflakeNextId();
|
Long newQuestionId = IdUtil.getSnowflakeNextId();
|
||||||
question.setId(newQuestionId);
|
question.setId(newQuestionId);
|
||||||
InsertFieldDefaults.applyIgnoreOrgId(question);
|
InsertFieldDefaults.apply(question);
|
||||||
|
|
||||||
List<QuestionOptionDO> options = allOptions.stream()
|
List<QuestionOptionDO> options = allOptions.stream()
|
||||||
.filter(option -> oldQuestionId.equals(option.getQuestionId()))
|
.filter(option -> oldQuestionId.equals(option.getQuestionId()))
|
||||||
|
|
@ -180,7 +180,7 @@ public class PaperServiceImpl extends ServiceImpl<PaperMapper, PaperDO> implemen
|
||||||
for (QuestionOptionDO option : options) {
|
for (QuestionOptionDO option : options) {
|
||||||
option.setId(IdUtil.getSnowflakeNextId());
|
option.setId(IdUtil.getSnowflakeNextId());
|
||||||
option.setQuestionId(newQuestionId);
|
option.setQuestionId(newQuestionId);
|
||||||
InsertFieldDefaults.applyIgnoreOrgId(option);
|
InsertFieldDefaults.apply(option);
|
||||||
newQueOptions.add(option);
|
newQueOptions.add(option);
|
||||||
newOptions.add(option);
|
newOptions.add(option);
|
||||||
}
|
}
|
||||||
|
|
@ -196,7 +196,7 @@ public class PaperServiceImpl extends ServiceImpl<PaperMapper, PaperDO> implemen
|
||||||
rel.setQuestionId(newQuestionId);
|
rel.setQuestionId(newQuestionId);
|
||||||
rel.setQuestionNum(oldRel.getQuestionNum());
|
rel.setQuestionNum(oldRel.getQuestionNum());
|
||||||
newRels.add(rel);
|
newRels.add(rel);
|
||||||
InsertFieldDefaults.applyIgnoreOrgId(rel);
|
InsertFieldDefaults.apply(rel);
|
||||||
}
|
}
|
||||||
Db.saveBatch(questions);
|
Db.saveBatch(questions);
|
||||||
Db.saveBatch(newOptions);
|
Db.saveBatch(newOptions);
|
||||||
|
|
@ -268,7 +268,7 @@ public class PaperServiceImpl extends ServiceImpl<PaperMapper, PaperDO> implemen
|
||||||
paper.setPaperTotalScore(importDTO.getPaperTotalScore());
|
paper.setPaperTotalScore(importDTO.getPaperTotalScore());
|
||||||
paper.setPaperPassScore(importDTO.getPaperPassScore());
|
paper.setPaperPassScore(importDTO.getPaperPassScore());
|
||||||
paper.setExamTime(importDTO.getExamTime());
|
paper.setExamTime(importDTO.getExamTime());
|
||||||
InsertFieldDefaults.applyIgnoreOrgId(paper);
|
InsertFieldDefaults.apply(paper);
|
||||||
this.savePaper(paper);
|
this.savePaper(paper);
|
||||||
|
|
||||||
// 保存试题和选项(id已预置雪花id)
|
// 保存试题和选项(id已预置雪花id)
|
||||||
|
|
@ -284,7 +284,7 @@ public class PaperServiceImpl extends ServiceImpl<PaperMapper, PaperDO> implemen
|
||||||
rel.setQuestionId(questions.get(i).getId());
|
rel.setQuestionId(questions.get(i).getId());
|
||||||
rel.setScore(questions.get(i).getScore());
|
rel.setScore(questions.get(i).getScore());
|
||||||
rel.setQuestionNum(i + 1);
|
rel.setQuestionNum(i + 1);
|
||||||
InsertFieldDefaults.applyIgnoreOrgId(rel);
|
InsertFieldDefaults.apply(rel);
|
||||||
rels.add(rel);
|
rels.add(rel);
|
||||||
}
|
}
|
||||||
Db.saveBatch(rels);
|
Db.saveBatch(rels);
|
||||||
|
|
@ -316,7 +316,7 @@ public class PaperServiceImpl extends ServiceImpl<PaperMapper, PaperDO> implemen
|
||||||
rel.setQuestionId(questionId);
|
rel.setQuestionId(questionId);
|
||||||
rel.setQuestionNum(questionNum++);
|
rel.setQuestionNum(questionNum++);
|
||||||
rel.setScore(rule.getScore());
|
rel.setScore(rule.getScore());
|
||||||
InsertFieldDefaults.applyIgnoreOrgId(rel);
|
InsertFieldDefaults.apply(rel);
|
||||||
rels.add(rel);
|
rels.add(rel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -329,7 +329,7 @@ public class PaperServiceImpl extends ServiceImpl<PaperMapper, PaperDO> implemen
|
||||||
paper.setExamTime(dto.getExamTime());
|
paper.setExamTime(dto.getExamTime());
|
||||||
paper.setPaperType(PaperTypeEnum.CONFIG_RULE.getValue());
|
paper.setPaperType(PaperTypeEnum.CONFIG_RULE.getValue());
|
||||||
paper.setConfigRule(JSONUtil.toJsonStr(dto.getQuestionTypeRuleList()));
|
paper.setConfigRule(JSONUtil.toJsonStr(dto.getQuestionTypeRuleList()));
|
||||||
InsertFieldDefaults.applyIgnoreOrgId(paper);
|
InsertFieldDefaults.apply(paper);
|
||||||
this.savePaper(paper);
|
this.savePaper(paper);
|
||||||
|
|
||||||
// 3. 绑定试卷试题关系(回填试卷id后批量保存)
|
// 3. 绑定试卷试题关系(回填试卷id后批量保存)
|
||||||
|
|
|
||||||
|
|
@ -144,7 +144,7 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, QuestionDO>
|
||||||
InsertFieldDefaults.applyForUpdate(option);
|
InsertFieldDefaults.applyForUpdate(option);
|
||||||
} else {
|
} else {
|
||||||
option.setId(IdUtil.getSnowflakeNextId());
|
option.setId(IdUtil.getSnowflakeNextId());
|
||||||
InsertFieldDefaults.applyIgnoreOrgId(option);
|
InsertFieldDefaults.apply(option);
|
||||||
toInsert.add(option);
|
toInsert.add(option);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue