|
@@ -22,6 +22,7 @@ import com.qmth.teachcloud.common.bean.params.ArraysParams;
|
|
import com.qmth.teachcloud.common.config.DictionaryConfig;
|
|
import com.qmth.teachcloud.common.config.DictionaryConfig;
|
|
import com.qmth.teachcloud.common.contant.SystemConstant;
|
|
import com.qmth.teachcloud.common.contant.SystemConstant;
|
|
import com.qmth.teachcloud.common.entity.BasicAttachment;
|
|
import com.qmth.teachcloud.common.entity.BasicAttachment;
|
|
|
|
+import com.qmth.teachcloud.common.entity.BasicCourse;
|
|
import com.qmth.teachcloud.common.entity.SysUser;
|
|
import com.qmth.teachcloud.common.entity.SysUser;
|
|
import com.qmth.teachcloud.common.enums.CardCreateMethodEnum;
|
|
import com.qmth.teachcloud.common.enums.CardCreateMethodEnum;
|
|
import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
|
|
import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
|
|
@@ -100,7 +101,7 @@ public class ExamCardServiceImpl extends ServiceImpl<ExamCardMapper, ExamCard> i
|
|
.eq(ExamCard::getCourseCode, examCardParams.getCourseCode())
|
|
.eq(ExamCard::getCourseCode, examCardParams.getCourseCode())
|
|
.eq(ExamCard::getTitle, examCardParams.getTitle());
|
|
.eq(ExamCard::getTitle, examCardParams.getTitle());
|
|
List<ExamCard> examCardList = this.list(queryWrapper);
|
|
List<ExamCard> examCardList = this.list(queryWrapper);
|
|
- if(!examCardList.isEmpty()){
|
|
|
|
|
|
+ if (!examCardList.isEmpty()) {
|
|
throw ExceptionResultEnum.ERROR.exception("题卡名称已存在");
|
|
throw ExceptionResultEnum.ERROR.exception("题卡名称已存在");
|
|
}
|
|
}
|
|
|
|
|
|
@@ -144,13 +145,13 @@ public class ExamCardServiceImpl extends ServiceImpl<ExamCardMapper, ExamCard> i
|
|
.eq(ExamCard::getTitle, examCardParams.getTitle())
|
|
.eq(ExamCard::getTitle, examCardParams.getTitle())
|
|
.ne(ExamCard::getId, examCardParams.getId());
|
|
.ne(ExamCard::getId, examCardParams.getId());
|
|
List<ExamCard> examCardList = this.list(queryWrapper);
|
|
List<ExamCard> examCardList = this.list(queryWrapper);
|
|
- if(!examCardList.isEmpty()){
|
|
|
|
|
|
+ if (!examCardList.isEmpty()) {
|
|
throw ExceptionResultEnum.ERROR.exception("题卡名称已存在");
|
|
throw ExceptionResultEnum.ERROR.exception("题卡名称已存在");
|
|
}
|
|
}
|
|
|
|
|
|
examCard = this.getById(examCardParams.getId());
|
|
examCard = this.getById(examCardParams.getId());
|
|
examCard.setTitle(examCardParams.getTitle());
|
|
examCard.setTitle(examCardParams.getTitle());
|
|
- if (!examCardParams.getCourseCode().equals(examCard.getCourseCode())) {
|
|
|
|
|
|
+ if (CardTypeEnum.CUSTOM.equals(examCard.getType()) && !examCardParams.getCourseCode().equals(examCard.getCourseCode())) {
|
|
throw ExceptionResultEnum.ERROR.exception("课程不能更改");
|
|
throw ExceptionResultEnum.ERROR.exception("课程不能更改");
|
|
}
|
|
}
|
|
if (!examCardParams.getMakeMethod().name().equals(examCard.getMakeMethod().name())) {
|
|
if (!examCardParams.getMakeMethod().name().equals(examCard.getMakeMethod().name())) {
|
|
@@ -457,7 +458,14 @@ public class ExamCardServiceImpl extends ServiceImpl<ExamCardMapper, ExamCard> i
|
|
|
|
|
|
@Transactional
|
|
@Transactional
|
|
@Override
|
|
@Override
|
|
- public Long copyCard(Long id) {
|
|
|
|
|
|
+ public Long copyCard(Long id, Long courseId) {
|
|
|
|
+ SysUser requestUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
|
+ BasicCourse basicCourse = basicCourseService.getById(courseId);
|
|
|
|
+ if (Objects.isNull(basicCourse)) {
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("未找复制后题卡要绑定的课程");
|
|
|
|
+ }
|
|
|
|
+ String courseCode = basicCourse.getCode();
|
|
|
|
+
|
|
ExamCard examCard = this.getById(id);
|
|
ExamCard examCard = this.getById(id);
|
|
if (examCard == null) {
|
|
if (examCard == null) {
|
|
throw ExceptionResultEnum.ERROR.exception("题卡不存在");
|
|
throw ExceptionResultEnum.ERROR.exception("题卡不存在");
|
|
@@ -465,11 +473,17 @@ public class ExamCardServiceImpl extends ServiceImpl<ExamCardMapper, ExamCard> i
|
|
// 复制题卡
|
|
// 复制题卡
|
|
ExamCard copyExamCard = new ExamCard();
|
|
ExamCard copyExamCard = new ExamCard();
|
|
BeanUtils.copyProperties(examCard, copyExamCard);
|
|
BeanUtils.copyProperties(examCard, copyExamCard);
|
|
- Long copyExamCardId = SystemConstant.getDbUuid();
|
|
|
|
- copyExamCard.setId(copyExamCardId);
|
|
|
|
- String title = checkTitle(examCard);
|
|
|
|
|
|
+ String title = checkTitle(examCard, courseCode);
|
|
copyExamCard.setTitle(title);
|
|
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());
|
|
this.save(copyExamCard);
|
|
this.save(copyExamCard);
|
|
|
|
+ Long copyExamCardId = copyExamCard.getId();
|
|
|
|
|
|
ExamCardDetail examCardDetail = examCardDetailService.getByCardId(id);
|
|
ExamCardDetail examCardDetail = examCardDetailService.getByCardId(id);
|
|
if (examCardDetail == null) {
|
|
if (examCardDetail == null) {
|
|
@@ -490,10 +504,10 @@ public class ExamCardServiceImpl extends ServiceImpl<ExamCardMapper, ExamCard> i
|
|
*
|
|
*
|
|
* @param examCard 题卡对象
|
|
* @param examCard 题卡对象
|
|
*/
|
|
*/
|
|
- private String checkTitle(ExamCard examCard) {
|
|
|
|
|
|
+ private String checkTitle(ExamCard examCard, String courseCode) {
|
|
QueryWrapper<ExamCard> queryWrapper = new QueryWrapper<>();
|
|
QueryWrapper<ExamCard> queryWrapper = new QueryWrapper<>();
|
|
queryWrapper.lambda().eq(ExamCard::getSchoolId, examCard.getSchoolId())
|
|
queryWrapper.lambda().eq(ExamCard::getSchoolId, examCard.getSchoolId())
|
|
- .eq(ExamCard::getCourseCode, examCard.getCourseCode());
|
|
|
|
|
|
+ .eq(ExamCard::getCourseCode, courseCode);
|
|
String title;
|
|
String title;
|
|
int i = 1;
|
|
int i = 1;
|
|
ExamCard newExamCard;
|
|
ExamCard newExamCard;
|