|
@@ -22,7 +22,6 @@ import com.qmth.distributed.print.business.util.HtmlToJpgUtil;
|
|
|
import com.qmth.teachcloud.common.bean.params.ArraysParams;
|
|
|
import com.qmth.teachcloud.common.contant.SystemConstant;
|
|
|
import com.qmth.teachcloud.common.entity.BasicAttachment;
|
|
|
-import com.qmth.teachcloud.common.entity.BasicExam;
|
|
|
import com.qmth.teachcloud.common.entity.SysOrg;
|
|
|
import com.qmth.teachcloud.common.entity.SysUser;
|
|
|
import com.qmth.teachcloud.common.enums.CardCreateMethodEnum;
|
|
@@ -33,7 +32,6 @@ import com.qmth.teachcloud.common.service.BasicCourseService;
|
|
|
import com.qmth.teachcloud.common.service.TeachcloudCommonService;
|
|
|
import com.qmth.teachcloud.common.util.ServletUtil;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
@@ -54,25 +52,25 @@ import java.util.stream.Collectors;
|
|
|
@Service
|
|
|
public class ExamCardServiceImpl extends ServiceImpl<ExamCardMapper, ExamCard> implements ExamCardService {
|
|
|
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private BasicExamRuleService basicExamRuleService;
|
|
|
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private ExamCardDetailService examCardDetailService;
|
|
|
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private ExamTaskDetailService examTaskDetailService;
|
|
|
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private ExamTaskService examTaskService;
|
|
|
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private BasicAttachmentService basicAttachmentService;
|
|
|
|
|
|
@Resource
|
|
|
TeachcloudCommonService teachcloudCommonService;
|
|
|
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
BasicCourseService basicCourseService;
|
|
|
|
|
|
@Resource
|
|
@@ -81,9 +79,16 @@ public class ExamCardServiceImpl extends ServiceImpl<ExamCardMapper, ExamCard> i
|
|
|
@Resource
|
|
|
HtmlToJpgUtil htmlToJpgUtil;
|
|
|
|
|
|
+ @Resource
|
|
|
+ BasicPrintConfigService basicPrintConfigService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ BasicCardRuleService basicCardRuleService;
|
|
|
+
|
|
|
@Transactional
|
|
|
@Override
|
|
|
public String saveExamCard(ExamCardParams examCardParams) throws Exception {
|
|
|
+ // ↓专卡
|
|
|
Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
|
|
|
SysUser user = (SysUser) ServletUtil.getRequestUser();
|
|
|
|
|
@@ -118,8 +123,12 @@ public class ExamCardServiceImpl extends ServiceImpl<ExamCardMapper, ExamCard> i
|
|
|
examCardDetail = new ExamCardDetail();
|
|
|
examCardDetail.setCardId(examCard.getId());
|
|
|
examCardDetail.setContent(examCardParams.getContent());
|
|
|
- examCardDetail.setHtmlContent(examCardParams.getHtmlContent());
|
|
|
- examCardDetail.setJpgAttachmentInfo(JSON.toJSONString(htmlToJpgUtil.convertHtmlToJpgByCard(examCard.getTitle(),examCardParams.getHtmlContent(),PageSizeEnum.A3)));
|
|
|
+ String htmlContent = examCardParams.getHtmlContent();
|
|
|
+ List<ConvertJpgStorage> convertJpgStorageList = htmlToJpgUtil.convertHtmlToJpgByCard(examCard.getTitle(),htmlContent,PageSizeEnum.A3);
|
|
|
+ if (convertJpgStorageList.size() > 0){
|
|
|
+ examCardDetail.setJpgAttachmentInfo(JSON.toJSONString(convertJpgStorageList));
|
|
|
+ }
|
|
|
+ examCardDetail.setHtmlContent(htmlContent);
|
|
|
examCardDetail.setAttachmentId(examCardParams.getAttachmentId());
|
|
|
examCardDetail.insertInfo(user.getId());
|
|
|
examCardDetailService.save(examCardDetail);
|
|
@@ -144,16 +153,20 @@ public class ExamCardServiceImpl extends ServiceImpl<ExamCardMapper, ExamCard> i
|
|
|
throw ExceptionResultEnum.ERROR.exception("题卡数据有误");
|
|
|
}
|
|
|
examCardDetail.setContent(examCardParams.getContent());
|
|
|
- examCardDetail.setHtmlContent(examCardParams.getHtmlContent());
|
|
|
- examCardDetail.setJpgAttachmentInfo(JSON.toJSONString(htmlToJpgUtil.convertHtmlToJpgByCard(examCard.getTitle(),examCardParams.getHtmlContent(),PageSizeEnum.A3)));
|
|
|
+ String htmlContent = examCardParams.getHtmlContent();
|
|
|
+ List<ConvertJpgStorage> convertJpgStorageList = htmlToJpgUtil.convertHtmlToJpgByCard(examCard.getTitle(),htmlContent,PageSizeEnum.A3);
|
|
|
+ if (convertJpgStorageList.size() > 0){
|
|
|
+ examCardDetail.setJpgAttachmentInfo(JSON.toJSONString(convertJpgStorageList));
|
|
|
+ }
|
|
|
+ examCardDetail.setHtmlContent(htmlContent);
|
|
|
examCardDetail.setAttachmentId(examCardParams.getAttachmentId());
|
|
|
examCardDetail.updateInfo(user.getId());
|
|
|
examCardDetailService.updateById(examCardDetail);
|
|
|
-
|
|
|
}
|
|
|
|
|
|
// 绑定命题任务
|
|
|
examTaskDetailService.bindCardId(examCardParams.getExamTaskId(), examCard);
|
|
|
+
|
|
|
return String.valueOf(examCard.getId());
|
|
|
}
|
|
|
|
|
@@ -245,7 +258,7 @@ public class ExamCardServiceImpl extends ServiceImpl<ExamCardMapper, ExamCard> i
|
|
|
List<ExamCard> customCards = this.baseMapper.listCustom(schoolId, sysUser.getOrgId(), courseCode, CardTypeEnum.CUSTOM.name());
|
|
|
if (!customCards.isEmpty()) {
|
|
|
// 只查自己创建的专卡
|
|
|
- customCards = customCards.stream().filter(m-> Objects.equals(m.getCreateId(), sysUser.getId())).collect(Collectors.toList());
|
|
|
+ customCards = customCards.stream().filter(m -> Objects.equals(m.getCreateId(), sysUser.getId())).collect(Collectors.toList());
|
|
|
if (!customCards.isEmpty()) {
|
|
|
list.addAll(customCards);
|
|
|
}
|
|
@@ -369,8 +382,10 @@ public class ExamCardServiceImpl extends ServiceImpl<ExamCardMapper, ExamCard> i
|
|
|
} else {
|
|
|
throw ExceptionResultEnum.ERROR.exception("题卡创建方式异常");
|
|
|
}
|
|
|
- List<ConvertJpgStorage> convertJpgStorageList = htmlToJpgUtil.convertHtmlToJpgByCard(examCard.getTitle(),htmlContent, PageSizeEnum.A3);
|
|
|
- examCardDetail.setJpgAttachmentInfo(JSON.toJSONString(convertJpgStorageList));
|
|
|
+ List<ConvertJpgStorage> convertJpgStorageList = htmlToJpgUtil.convertHtmlToJpgByCard(examCard.getTitle(),htmlContent,PageSizeEnum.A3);
|
|
|
+ if (convertJpgStorageList.size() > 0){
|
|
|
+ examCardDetail.setJpgAttachmentInfo(JSON.toJSONString(convertJpgStorageList));
|
|
|
+ }
|
|
|
examCardDetailService.save(examCardDetail);
|
|
|
}
|
|
|
// 修改
|
|
@@ -418,8 +433,10 @@ public class ExamCardServiceImpl extends ServiceImpl<ExamCardMapper, ExamCard> i
|
|
|
} else {
|
|
|
throw ExceptionResultEnum.ERROR.exception("题卡创建方式异常");
|
|
|
}
|
|
|
- List<ConvertJpgStorage> convertJpgStorageList = htmlToJpgUtil.convertHtmlToJpgByCard(examCard.getTitle(),htmlContent, PageSizeEnum.A3);
|
|
|
- examCardDetail.setJpgAttachmentInfo(JSON.toJSONString(convertJpgStorageList));
|
|
|
+ List<ConvertJpgStorage> convertJpgStorageList = htmlToJpgUtil.convertHtmlToJpgByCard(examCard.getTitle(),htmlContent,PageSizeEnum.A3);
|
|
|
+ if (convertJpgStorageList.size() > 0){
|
|
|
+ examCardDetail.setJpgAttachmentInfo(JSON.toJSONString(convertJpgStorageList));
|
|
|
+ }
|
|
|
examCardDetailService.updateById(examCardDetail);
|
|
|
|
|
|
//删除权限
|