|
@@ -8,6 +8,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.qmth.distributed.print.business.bean.dto.*;
|
|
|
import com.qmth.distributed.print.business.entity.*;
|
|
|
import com.qmth.distributed.print.business.enums.ExamDetailStatusEnum;
|
|
|
+import com.qmth.distributed.print.business.enums.ExamStatusEnum;
|
|
|
+import com.qmth.distributed.print.business.enums.PrintPlanStatusEnum;
|
|
|
import com.qmth.distributed.print.business.service.*;
|
|
|
import com.qmth.distributed.print.business.util.ExcelUtil;
|
|
|
import com.qmth.distributed.print.business.util.ServletUtil;
|
|
@@ -19,6 +21,7 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -93,6 +96,12 @@ public class ClientServiceImpl implements ClientService {
|
|
|
public Map<String, Object> getReprintData(Long examDetailId, String ticketNumber, String type) {
|
|
|
Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
|
|
|
Map<String, Object> finalMap = new HashMap<>();
|
|
|
+ ExamDetail examDetail = examDetailService.getById(examDetailId);
|
|
|
+ // 撤回提示
|
|
|
+ if(ExamDetailStatusEnum.NEW.name().equals(examDetail.getStatus())
|
|
|
+ || ExamDetailStatusEnum.READY.name().equals(examDetail.getStatus())){
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("该任务已被撤回");
|
|
|
+ }
|
|
|
// 取试卷
|
|
|
List<Map<String, Object>> examDetailCourses = examDetailCourseService.listByExamDetailId(examDetailId);
|
|
|
Map<String, Map<String, String>> map = mapCourseUrl(examDetailCourses);
|
|
@@ -103,7 +112,6 @@ public class ClientServiceImpl implements ClientService {
|
|
|
// 生成题卡List
|
|
|
finalMap.put("card", spliceCardContent(studentList));
|
|
|
//
|
|
|
- ExamDetail examDetail = examDetailService.getById(examDetailId);
|
|
|
ExamPrintPlan examPrintPlan = examPrintPlanService.getById(examDetail.getPrintPlanId());
|
|
|
String variableContent = examPrintPlan.getVariableContent();
|
|
|
String ordinaryContent = examPrintPlan.getOrdinaryContent();
|
|
@@ -141,10 +149,15 @@ public class ClientServiceImpl implements ClientService {
|
|
|
@Transactional
|
|
|
@Override
|
|
|
public Map<String, Object> getPrintData(Long examDetailId, String machineCode, Boolean isPrint, String printUser) {
|
|
|
+ ExamDetail examDetail = examDetailService.getById(examDetailId);
|
|
|
+ // 撤回提示
|
|
|
+ if(ExamDetailStatusEnum.NEW.name().equals(examDetail.getStatus())
|
|
|
+ || ExamDetailStatusEnum.READY.name().equals(examDetail.getStatus())){
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("该任务已被撤回");
|
|
|
+ }
|
|
|
if (isPrint && StringUtils.isBlank(printUser)) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("打印员不能为空");
|
|
|
}
|
|
|
- ExamDetail examDetail = examDetailService.getById(examDetailId);
|
|
|
if (isPrint && StringUtils.isNotBlank(examDetail.getPrintUser()) && !examDetail.getPrintUser().equals(printUser)) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("该任务已被[" + printUser + "]占用");
|
|
|
}
|
|
@@ -304,6 +317,18 @@ public class ClientServiceImpl implements ClientService {
|
|
|
Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
|
|
|
Set<Long> orgIds = commonService.listSubOrgIds(null);
|
|
|
List<ClientPrintTaskDto> pirntTaskDtoList = examPrintPlanService.listClientPrintTask(schoolId, machineCode, printPlanId, status, courseCode, paperNumber, examPlace, examRoom, examStartTime, examEndTime, isDownload, validate, orgIds);
|
|
|
+ // 撤回
|
|
|
+ long count = pirntTaskDtoList.stream().map(m -> {
|
|
|
+ ExamDetail examDetail = examDetailService.getById(m.getExamDetailId());
|
|
|
+ if (ExamDetailStatusEnum.NEW.name().equals(examDetail.getStatus())
|
|
|
+ || ExamDetailStatusEnum.READY.name().equals(examDetail.getStatus())) {
|
|
|
+ return m.getExamDetailId();
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }).filter(m->StringUtils.isNotBlank(m)).count();
|
|
|
+ if(count > 0){
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("有任务被撤回,请刷新列表后再试");
|
|
|
+ }
|
|
|
List<Map<String, Object>> finalList = new ArrayList<>();
|
|
|
for (ClientPrintTaskDto clientPrintTaskDto : pirntTaskDtoList) {
|
|
|
Map<String, Object> map = getPrintData(Long.valueOf(clientPrintTaskDto.getExamDetailId()), null, false, null);
|
|
@@ -358,6 +383,13 @@ public class ClientServiceImpl implements ClientService {
|
|
|
if (examDetail == null) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("考场数据有误");
|
|
|
}
|
|
|
+
|
|
|
+ // 撤回提示
|
|
|
+ if(ExamDetailStatusEnum.NEW.name().equals(examDetail.getStatus())
|
|
|
+ || ExamDetailStatusEnum.READY.name().equals(examDetail.getStatus())){
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("该任务已被撤回");
|
|
|
+ }
|
|
|
+
|
|
|
if (StringUtils.isBlank(packageCode)) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("卷袋编号不能为空");
|
|
|
}
|
|
@@ -439,6 +471,29 @@ public class ClientServiceImpl implements ClientService {
|
|
|
Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
|
|
|
Set<Long> orgIds = commonService.listSubOrgIds(null);
|
|
|
List<ClientPrintTaskDto> printTaskDtoIList = examPrintPlanService.listClientPrintTask(schoolId, machineCode, printPlanId, status, courseCode, paperNumber, examPlace, examRoom, examStartTime, examEndTime, isDownload, validate, orgIds);
|
|
|
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ printTaskDtoIList = printTaskDtoIList.stream().map(m -> {
|
|
|
+ if (m.getExamStartTime() != null) {
|
|
|
+ String eStartTime = simpleDateFormat.format(new Date(m.getExamStartTime()));
|
|
|
+ m.setExamStartTimeStr(eStartTime);
|
|
|
+ }
|
|
|
+ if (m.getExamEndTime() != null) {
|
|
|
+ String eEndTime = simpleDateFormat.format(new Date(m.getExamEndTime()));
|
|
|
+ m.setExamEndTimeStr(eEndTime);
|
|
|
+ }
|
|
|
+ if (m.getPrintStartTime() != null) {
|
|
|
+ String pStartTime = simpleDateFormat.format(new Date(m.getPrintStartTime()));
|
|
|
+ m.setPrintStartTimeStr(pStartTime);
|
|
|
+ }
|
|
|
+ if (m.getPrintEndTime() != null) {
|
|
|
+ String pEndTime = simpleDateFormat.format(new Date(m.getPrintEndTime()));
|
|
|
+ m.setPrintEndTimeStr(pEndTime);
|
|
|
+ }
|
|
|
+ m.setStatusStr(ExamStatusEnum.valueOf(m.getStatus()).getDesc());
|
|
|
+ m.setValidateStr(m.getValidate() ? "是" : "否");
|
|
|
+ m.setDownloadStr(m.getDownload() ? "是" : "否");
|
|
|
+ return m;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
ExcelUtil.excelExport("印刷管理", ClientPrintTaskDto.class, printTaskDtoIList, response);
|
|
|
}
|
|
|
|
|
@@ -505,7 +560,7 @@ public class ClientServiceImpl implements ClientService {
|
|
|
vMap.put("pdfMd5", path.get("pdfMd5"));
|
|
|
}
|
|
|
}
|
|
|
- if(vMap.size() > 1) {
|
|
|
+ if (vMap.size() > 1) {
|
|
|
otherList.add(vMap);
|
|
|
}
|
|
|
}
|