|
@@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.aliyun.oss.common.utils.BinaryUtil;
|
|
import com.aliyun.oss.common.utils.BinaryUtil;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
import com.qmth.boot.api.exception.ApiException;
|
|
import com.qmth.boot.api.exception.ApiException;
|
|
import com.qmth.distributed.print.business.annotation.ExcelDBFieldDesc;
|
|
import com.qmth.distributed.print.business.annotation.ExcelDBFieldDesc;
|
|
import com.qmth.distributed.print.business.bean.dto.*;
|
|
import com.qmth.distributed.print.business.bean.dto.*;
|
|
@@ -115,6 +116,53 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
@Resource
|
|
@Resource
|
|
TBTaskService tbTaskService;
|
|
TBTaskService tbTaskService;
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 创建pdf前置条件
|
|
|
|
+ *
|
|
|
|
+ * @param map
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ @Transactional
|
|
|
|
+ public Map<String, Object> createPdfPrepose(Map<String, Object> map) {
|
|
|
|
+ TBTask tbTask = (TBTask) map.get(SystemConstant.TASK);
|
|
|
|
+ SysUser sysUser = (SysUser) map.get(SystemConstant.USER);
|
|
|
|
+ Long examDetailId = tbTask.getEntityId();
|
|
|
|
+ List<Long> examDetailIds = Objects.nonNull(map.get("examDetailIds")) ? (List<Long>) map.get("examDetailIds") : null;
|
|
|
|
+ //查询printPlan
|
|
|
|
+ ExamPrintPlan examPrintPlan = examPrintPlanService.getById(tbTask.getPrintPlanId());
|
|
|
|
+ if (Objects.isNull(examPrintPlan)) {
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("印刷计划为空");
|
|
|
|
+ }
|
|
|
|
+ UpdateWrapper<ExamDetail> examDetailQueryWrapper = new UpdateWrapper<>();
|
|
|
|
+ examDetailQueryWrapper.lambda().eq(ExamDetail::getSchoolId, sysUser.getSchoolId())
|
|
|
|
+ .eq(ExamDetail::getPrintPlanId, tbTask.getPrintPlanId());
|
|
|
|
+ if (Objects.nonNull(examDetailId)) {
|
|
|
|
+ examDetailQueryWrapper.lambda().eq(ExamDetail::getId, examDetailId);
|
|
|
|
+ } else if (Objects.nonNull(examDetailIds)) {
|
|
|
|
+ examDetailQueryWrapper.lambda().in(ExamDetail::getId, examDetailIds);
|
|
|
|
+ }
|
|
|
|
+ examDetailQueryWrapper.lambda().set(ExamDetail::getStatus, ExamDetailStatusEnum.NEW);
|
|
|
|
+ detailService.update(examDetailQueryWrapper);
|
|
|
|
+
|
|
|
|
+ //所有考场都撤回,印刷任务状态改为就绪
|
|
|
|
+ QueryWrapper<ExamDetail> queryWrapper = new QueryWrapper<>();
|
|
|
|
+ queryWrapper.lambda().eq(ExamDetail::getPrintPlanId, tbTask.getPrintPlanId());
|
|
|
|
+ if (Objects.nonNull(examDetailId)) {
|
|
|
|
+ queryWrapper.lambda().eq(ExamDetail::getId, examDetailId);
|
|
|
|
+ } else if (Objects.nonNull(examDetailIds)) {
|
|
|
|
+ queryWrapper.lambda().in(ExamDetail::getId, examDetailIds);
|
|
|
|
+ }
|
|
|
|
+ queryWrapper.lambda().notIn(ExamDetail::getStatus, ExamDetailStatusEnum.NEW, ExamDetailStatusEnum.READY);
|
|
|
|
+ List<ExamDetail> examDetails = detailService.list(queryWrapper);
|
|
|
|
+ if (examDetails.isEmpty()) {
|
|
|
|
+ UpdateWrapper<ExamPrintPlan> printPlanUpdateWrapper = new UpdateWrapper<>();
|
|
|
|
+ printPlanUpdateWrapper.lambda().set(ExamPrintPlan::getStatus, PrintPlanStatusEnum.READY).eq(ExamPrintPlan::getId, tbTask.getPrintPlanId());
|
|
|
|
+ examPrintPlanService.update(printPlanUpdateWrapper);
|
|
|
|
+ }
|
|
|
|
+ return map;
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 创建pdf逻辑
|
|
* 创建pdf逻辑
|
|
*
|
|
*
|
|
@@ -384,7 +432,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
InputStream inputStream = (InputStream) map.get("inputStream");
|
|
InputStream inputStream = (InputStream) map.get("inputStream");
|
|
Long printPlanId = tbTask.getPrintPlanId();
|
|
Long printPlanId = tbTask.getPrintPlanId();
|
|
Long schoolId = tbTask.getSchoolId();
|
|
Long schoolId = tbTask.getSchoolId();
|
|
- if (!tbTaskService.countByPrintPlanIdAndEntityId(schoolId,printPlanId,null)){
|
|
|
|
|
|
+ if (!tbTaskService.countByPrintPlanIdAndEntityId(schoolId, printPlanId, null)) {
|
|
throw ExceptionResultEnum.ERROR.exception("当前印刷计划正在生成pdf,无法导入考务数据");
|
|
throw ExceptionResultEnum.ERROR.exception("当前印刷计划正在生成pdf,无法导入考务数据");
|
|
}
|
|
}
|
|
Long userId = tbTask.getCreateId();
|
|
Long userId = tbTask.getCreateId();
|