|
@@ -272,7 +272,7 @@ public class ExamCardServiceImpl extends ServiceImpl<ExamCardMapper, ExamCard> i
|
|
|
}
|
|
|
// 专卡
|
|
|
if (SystemConstant.ALL_CARD != cardRuleId) {
|
|
|
- // 只查自己创建的专卡
|
|
|
+ // 只查自己创建的专卡(20230405已改为查询课程下所有题卡,允许复制,不能选择)
|
|
|
List<ExamCard> customCards = this.baseMapper.listCustom(schoolId, sysUser.getOrgId(), courseCode, CardTypeEnum.CUSTOM.name(), sysUser.getId());
|
|
|
if (!customCards.isEmpty()) {
|
|
|
list.addAll(customCards);
|
|
@@ -506,28 +506,29 @@ public class ExamCardServiceImpl extends ServiceImpl<ExamCardMapper, ExamCard> i
|
|
|
@Override
|
|
|
public Long copyCard(Long id, String courseCode) {
|
|
|
SysUser requestUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
- List<BasicCourse> basicCourseList = basicCourseService.list(new QueryWrapper<BasicCourse>().lambda().eq(BasicCourse::getSchoolId, requestUser.getSchoolId()).eq(BasicCourse::getCode, courseCode));
|
|
|
- if (basicCourseList.size() != 1) {
|
|
|
- throw ExceptionResultEnum.ERROR.exception("复制后题卡要绑定的课程异常");
|
|
|
- }
|
|
|
- BasicCourse basicCourse = basicCourseList.get(0);
|
|
|
+// List<BasicCourse> basicCourseList = basicCourseService.list(new QueryWrapper<BasicCourse>().lambda().eq(BasicCourse::getSchoolId, requestUser.getSchoolId()).eq(BasicCourse::getCode, courseCode));
|
|
|
+// if (basicCourseList.size() != 1) {
|
|
|
+// throw ExceptionResultEnum.ERROR.exception("复制后题卡要绑定的课程异常");
|
|
|
+// }
|
|
|
+// BasicCourse basicCourse = basicCourseList.get(0);
|
|
|
|
|
|
ExamCard examCard = this.getById(id);
|
|
|
if (examCard == null) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("题卡不存在");
|
|
|
}
|
|
|
+ if (courseCode.equals(examCard.getCourseCode())) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("复制的题卡不属于当前课程,无法复制");
|
|
|
+ }
|
|
|
+
|
|
|
// 复制题卡
|
|
|
ExamCard copyExamCard = new ExamCard();
|
|
|
BeanUtils.copyProperties(examCard, copyExamCard);
|
|
|
String title = checkTitle(examCard, courseCode);
|
|
|
copyExamCard.setTitle(title);
|
|
|
- copyExamCard.setCourseCode(basicCourse.getCode());
|
|
|
- copyExamCard.setCourseName(basicCourse.getName());
|
|
|
- copyExamCard.setMakeMethod(MakeMethodEnum.SELF);
|
|
|
- copyExamCard.setCreateMethod(null);
|
|
|
- copyExamCard.setType(CardTypeEnum.CUSTOM);
|
|
|
- copyExamCard.setCardRuleId(null);
|
|
|
copyExamCard.insertInfo(requestUser.getId());
|
|
|
+ copyExamCard.setSyncStatus(null);
|
|
|
+ copyExamCard.setRemark("复制于题卡:" + id);
|
|
|
+ copyExamCard.setUsed(false);
|
|
|
this.save(copyExamCard);
|
|
|
Long copyExamCardId = copyExamCard.getId();
|
|
|
|
|
@@ -540,6 +541,13 @@ public class ExamCardServiceImpl extends ServiceImpl<ExamCardMapper, ExamCard> i
|
|
|
BeanUtils.copyProperties(examCardDetail, copyExamCardDetail);
|
|
|
copyExamCardDetail.setId(SystemConstant.getDbUuid());
|
|
|
copyExamCardDetail.setCardId(copyExamCardId);
|
|
|
+ // 生成图片
|
|
|
+ List<ConvertJpgStorage> convertJpgStorageList = htmlToJpgUtil.convertHtmlToJpgByCard(examCard.getTitle(), copyExamCardDetail.getHtmlContent(), PageSizeEnum.A3);
|
|
|
+ if (!convertJpgStorageList.isEmpty()) {
|
|
|
+ copyExamCardDetail.setJpgAttachmentInfo(JSON.toJSONString(convertJpgStorageList));
|
|
|
+ } else {
|
|
|
+ copyExamCardDetail.setJpgAttachmentInfo(null);
|
|
|
+ }
|
|
|
examCardDetailService.save(copyExamCardDetail);
|
|
|
|
|
|
return copyExamCardId;
|