|
@@ -8,21 +8,26 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.qmth.distributed.print.business.bean.dto.*;
|
|
import com.qmth.distributed.print.business.bean.dto.*;
|
|
import com.qmth.distributed.print.business.entity.*;
|
|
import com.qmth.distributed.print.business.entity.*;
|
|
import com.qmth.distributed.print.business.enums.ExamDetailStatusEnum;
|
|
import com.qmth.distributed.print.business.enums.ExamDetailStatusEnum;
|
|
|
|
+import com.qmth.distributed.print.business.enums.PrintPlanStatusEnum;
|
|
|
|
+import com.qmth.distributed.print.business.mapper.ClientMapper;
|
|
import com.qmth.distributed.print.business.service.*;
|
|
import com.qmth.distributed.print.business.service.*;
|
|
import com.qmth.teachcloud.common.bean.dto.SchoolDto;
|
|
import com.qmth.teachcloud.common.bean.dto.SchoolDto;
|
|
|
|
+import com.qmth.teachcloud.common.bean.vo.PaperInfoVo;
|
|
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.SysPrivilege;
|
|
import com.qmth.teachcloud.common.entity.SysPrivilege;
|
|
import com.qmth.teachcloud.common.entity.SysUser;
|
|
import com.qmth.teachcloud.common.entity.SysUser;
|
|
|
|
+import com.qmth.teachcloud.common.enums.ClassifyEnum;
|
|
import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
|
|
import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
|
|
import com.qmth.teachcloud.common.enums.RoleTypeEnum;
|
|
import com.qmth.teachcloud.common.enums.RoleTypeEnum;
|
|
import com.qmth.teachcloud.common.service.*;
|
|
import com.qmth.teachcloud.common.service.*;
|
|
|
|
+import com.qmth.teachcloud.common.util.ExamTaskUtil;
|
|
import com.qmth.teachcloud.common.util.ExcelUtil;
|
|
import com.qmth.teachcloud.common.util.ExcelUtil;
|
|
import com.qmth.teachcloud.common.util.ServletUtil;
|
|
import com.qmth.teachcloud.common.util.ServletUtil;
|
|
|
|
+import org.apache.commons.collections4.CollectionUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
-import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
@@ -37,45 +42,41 @@ import java.util.stream.Collectors;
|
|
public class ClientServiceImpl implements ClientService {
|
|
public class ClientServiceImpl implements ClientService {
|
|
|
|
|
|
@Resource
|
|
@Resource
|
|
- ExamTaskService examTaskService;
|
|
|
|
-
|
|
|
|
|
|
+ private ExamTaskService examTaskService;
|
|
@Resource
|
|
@Resource
|
|
- ExamTaskDetailService examTaskDetailService;
|
|
|
|
-
|
|
|
|
|
|
+ private ExamTaskDetailService examTaskDetailService;
|
|
@Resource
|
|
@Resource
|
|
- ClientStatusService clientStatusService;
|
|
|
|
-
|
|
|
|
|
|
+ private ClientStatusService clientStatusService;
|
|
@Resource
|
|
@Resource
|
|
- ExamDetailService examDetailService;
|
|
|
|
-
|
|
|
|
|
|
+ private ExamDetailService examDetailService;
|
|
@Resource
|
|
@Resource
|
|
- ExamDetailCourseService examDetailCourseService;
|
|
|
|
-
|
|
|
|
|
|
+ private ExamDetailCourseService examDetailCourseService;
|
|
@Resource
|
|
@Resource
|
|
- BasicAttachmentService basicAttachmentService;
|
|
|
|
-
|
|
|
|
|
|
+ private ClientPrintDataService clientPrintDataService;
|
|
@Resource
|
|
@Resource
|
|
- ExamPrintPlanService examPrintPlanService;
|
|
|
|
-
|
|
|
|
|
|
+ private BasicAttachmentService basicAttachmentService;
|
|
@Resource
|
|
@Resource
|
|
- ExamStudentService examStudentService;
|
|
|
|
-
|
|
|
|
|
|
+ private ExamPrintPlanService examPrintPlanService;
|
|
@Resource
|
|
@Resource
|
|
- TeachcloudCommonService teachcloudCommonService;
|
|
|
|
-
|
|
|
|
|
|
+ private ExamStudentService examStudentService;
|
|
@Resource
|
|
@Resource
|
|
- SysPrivilegeService sysPrivilegeService;
|
|
|
|
-
|
|
|
|
|
|
+ private TeachcloudCommonService teachcloudCommonService;
|
|
@Resource
|
|
@Resource
|
|
- SysUserService sysUserService;
|
|
|
|
-
|
|
|
|
|
|
+ private SysPrivilegeService sysPrivilegeService;
|
|
|
|
+ @Resource
|
|
|
|
+ private SysUserService sysUserService;
|
|
|
|
+ @Resource
|
|
|
|
+ private BasicSchoolService basicSchoolService;
|
|
@Resource
|
|
@Resource
|
|
- BasicSchoolService basicSchoolService;
|
|
|
|
|
|
+ private ClientMapper clientMapper;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public IPage<ClientExamTaskDto> listTryTask(String machineCode, Long orgId, Long semesterId, Long examId, Long printPlanId, String courseCode, String paperNumber, Boolean isTry, Boolean isPass, Integer pageNumber, Integer pageSize) {
|
|
public IPage<ClientExamTaskDto> listTryTask(String machineCode, Long orgId, Long semesterId, Long examId, Long printPlanId, String courseCode, String paperNumber, Boolean isTry, Boolean isPass, Integer pageNumber, Integer pageSize) {
|
|
Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
|
|
Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
|
|
- return examTaskService.listTryTask(schoolId, semesterId, examId, machineCode, orgId, printPlanId, courseCode, paperNumber, isTry, isPass, pageNumber, pageSize);
|
|
|
|
|
|
+ Page<ClientExamTaskDto> page = new Page<>(pageNumber, pageSize);
|
|
|
|
+ // 印刷任务状态为印刷中(PRINTING),考场状态为待打印(WAITING)
|
|
|
|
+ String[] examDetailStatus = {ExamDetailStatusEnum.NEW.name(), ExamDetailStatusEnum.READY.name(), ExamDetailStatusEnum.CANCEL.name()};
|
|
|
|
+ return clientMapper.pageTryTask(page, schoolId, semesterId, examId, machineCode, orgId, printPlanId, courseCode, paperNumber, isTry, isPass, PrintPlanStatusEnum.PRINTING.name(), examDetailStatus);
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -91,7 +92,7 @@ public class ClientServiceImpl implements ClientService {
|
|
map.put("courseCode", examTask.getCourseCode());
|
|
map.put("courseCode", examTask.getCourseCode());
|
|
map.put("courseName", examTask.getCourseName());
|
|
map.put("courseName", examTask.getCourseName());
|
|
map.put("paperNumber", examTask.getPaperNumber());
|
|
map.put("paperNumber", examTask.getPaperNumber());
|
|
- List<Map<String, String>> mapList = examTaskDetailService.getPaperUrl(schoolId, printPlanId, examTaskId);
|
|
|
|
|
|
+ List<Map<String, String>> mapList = this.getPaperUrl(schoolId, printPlanId, examTaskId);
|
|
map.put("list", mapList);
|
|
map.put("list", mapList);
|
|
finalList.add(map);
|
|
finalList.add(map);
|
|
}
|
|
}
|
|
@@ -107,13 +108,62 @@ public class ClientServiceImpl implements ClientService {
|
|
@Override
|
|
@Override
|
|
public Boolean updatePrintProgress(Long examDetailId, String machineCode, Integer printProgress, Boolean isPrint) {
|
|
public Boolean updatePrintProgress(Long examDetailId, String machineCode, Integer printProgress, Boolean isPrint) {
|
|
Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
|
|
Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
|
|
- return examDetailService.updatePrintProgress(schoolId, examDetailId, machineCode, printProgress, isPrint);
|
|
|
|
|
|
+ ExamDetail examDetail = examDetailService.getById(examDetailId);
|
|
|
|
+ // 撤回提示
|
|
|
|
+ if (ExamDetailStatusEnum.NEW.name().equals(examDetail.getStatus())
|
|
|
|
+ || ExamDetailStatusEnum.READY.name().equals(examDetail.getStatus())) {
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("该任务已被撤回");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (isPrint) {
|
|
|
|
+ // 更新考场进度、状态、打印结束时间
|
|
|
|
+ UpdateWrapper<ExamDetail> updateWrapper = new UpdateWrapper<>();
|
|
|
|
+ updateWrapper.lambda().set(ExamDetail::getPrintProgress, printProgress).set(ExamDetail::getPrintEndTime, System.currentTimeMillis()).set(ExamDetail::getStatus, ExamDetailStatusEnum.FINISH).eq(ExamDetail::getId, examDetailId);
|
|
|
|
+ examDetailService.update(updateWrapper);
|
|
|
|
+
|
|
|
|
+ // 所有考场打印完成,更新印刷计划状态
|
|
|
|
+ QueryWrapper<ExamDetail> examDetailQueryWrapper = new QueryWrapper<>();
|
|
|
|
+ examDetailQueryWrapper.lambda().eq(ExamDetail::getPrintPlanId, examDetail.getPrintPlanId()).ne(ExamDetail::getStatus, ExamDetailStatusEnum.FINISH);
|
|
|
|
+ int count = examDetailService.count(examDetailQueryWrapper);
|
|
|
|
+ if (count == 0) {
|
|
|
|
+ UpdateWrapper<ExamPrintPlan> examPrintPlanUpdateWrapper = new UpdateWrapper<>();
|
|
|
|
+ examPrintPlanUpdateWrapper.lambda().set(ExamPrintPlan::getStatus, PrintPlanStatusEnum.FINISH).eq(ExamPrintPlan::getId, examDetail.getPrintPlanId());
|
|
|
|
+ examPrintPlanService.update(examPrintPlanUpdateWrapper);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 记录机器打印数量
|
|
|
|
+ SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
|
+ ClientPrintData clientPrintData = new ClientPrintData();
|
|
|
|
+ clientPrintData.setId(SystemConstant.getDbUuid());
|
|
|
|
+ clientPrintData.setSchoolId(schoolId);
|
|
|
|
+ clientPrintData.setExamDetailId(examDetailId);
|
|
|
|
+ clientPrintData.setMachineCode(machineCode);
|
|
|
|
+ clientPrintData.setPaperPages(examDetail.getPaperPages());
|
|
|
|
+ clientPrintData.setCardPages(examDetail.getCardPages());
|
|
|
|
+ clientPrintData.setPagesA4(examDetail.getPagesA4());
|
|
|
|
+ clientPrintData.setCreateId(sysUser.getId());
|
|
|
|
+ clientPrintData.setCreateTime(System.currentTimeMillis());
|
|
|
|
+ clientPrintDataService.save(clientPrintData);
|
|
|
|
+ } else {
|
|
|
|
+ // 更新打印结束时间
|
|
|
|
+ UpdateWrapper<ExamDetail> updateWrapper = new UpdateWrapper<>();
|
|
|
|
+ updateWrapper.lambda().set(ExamDetail::getPrintEndTime, System.currentTimeMillis()).eq(ExamDetail::getId, examDetailId);
|
|
|
|
+ examDetailService.update(updateWrapper);
|
|
|
|
+ }
|
|
|
|
+ return true;
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public IPage<ClientExamStudentDto> listStudent(Long examDetailId, String studentCode, String studentName, String courseCode, Integer pageNumber, Integer pageSize) {
|
|
public IPage<ClientExamStudentDto> listStudent(Long examDetailId, String studentCode, String studentName, String courseCode, Integer pageNumber, Integer pageSize) {
|
|
Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
|
|
Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
|
|
- return examDetailService.listStudent(schoolId, examDetailId, studentCode, studentName, courseCode, pageNumber, pageSize);
|
|
|
|
|
|
+ // 撤回提示
|
|
|
|
+ ExamDetail examDetail = examDetailService.getById(examDetailId);
|
|
|
|
+ if (ExamDetailStatusEnum.NEW.name().equals(examDetail.getStatus())
|
|
|
|
+ || ExamDetailStatusEnum.READY.name().equals(examDetail.getStatus())) {
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("该任务已被撤回");
|
|
|
|
+ }
|
|
|
|
+ Page<ClientExamStudentDto> page = new Page<>(pageNumber, pageSize);
|
|
|
|
+ return clientMapper.listClientExamStudentPage(page, schoolId, examDetailId, SystemConstant.translateSpecificSign(studentCode), SystemConstant.translateSpecificSign(studentName), courseCode);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -170,7 +220,46 @@ public class ClientServiceImpl implements ClientService {
|
|
public IPage<ClientPrintTaskDto> listClientPrintTask(String machineCode, Long orgId, Long semesterId, Long examId, String printPlanId, String status, String courseCode, String paperNumber, String examPlace, String examRoom, Long examStartTime, Long examEndTime, Boolean isDownload, Boolean validate, Integer pageNumber, Integer pageSize) {
|
|
public IPage<ClientPrintTaskDto> listClientPrintTask(String machineCode, Long orgId, Long semesterId, Long examId, String printPlanId, String status, String courseCode, String paperNumber, String examPlace, String examRoom, Long examStartTime, Long examEndTime, Boolean isDownload, Boolean validate, Integer pageNumber, Integer pageSize) {
|
|
Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
|
|
Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
|
|
Page<ClientPrintTaskDto> page = new Page<>(pageNumber, pageSize);
|
|
Page<ClientPrintTaskDto> page = new Page<>(pageNumber, pageSize);
|
|
- return examPrintPlanService.listClientPrintTask(page, schoolId, semesterId, examId, machineCode, printPlanId, status, courseCode, paperNumber, examPlace, examRoom, examStartTime, examEndTime, isDownload, validate, orgId);
|
|
|
|
|
|
+ // 以下状态考场状态不可查询
|
|
|
|
+ String[] examDetailStatus = new String[]{ExamDetailStatusEnum.NEW.name(), ExamDetailStatusEnum.READY.name(), ExamDetailStatusEnum.CANCEL.name()};
|
|
|
|
+ IPage<ClientPrintTaskDto> clientPrintTaskDtoIPage = clientMapper.listClientPrintTask(page, schoolId, semesterId, examId, machineCode, printPlanId, status, courseCode, paperNumber, examPlace, examRoom, examStartTime, examEndTime, isDownload, validate, orgId, examDetailStatus);
|
|
|
|
+ for (ClientPrintTaskDto record : clientPrintTaskDtoIPage.getRecords()) {
|
|
|
|
+ // 试卷、题卡
|
|
|
|
+ String printContent = record.getPrintContent();
|
|
|
|
+ record.setIncluedPaper(!StringUtils.isBlank(printContent) && printContent.contains("PAPER"));
|
|
|
|
+ record.setIncluedCard(!StringUtils.isBlank(printContent) && printContent.contains("CARD"));
|
|
|
|
+
|
|
|
|
+ //印品
|
|
|
|
+ String variableContent = record.getVariableContent();
|
|
|
|
+ List<Map> variableList = JSONObject.parseArray(variableContent, Map.class);
|
|
|
|
+ record.setIncluedSign(false);
|
|
|
|
+ record.setIncluedPackage(false);
|
|
|
|
+ for (Map map : variableList) {
|
|
|
|
+ String type = map.get("type").toString();
|
|
|
|
+ String templateId = map.get("templateId").toString();
|
|
|
|
+ if (ClassifyEnum.SIGN.name().equals(type) && StringUtils.isNotBlank(templateId)) {
|
|
|
|
+ record.setIncluedSign(true);
|
|
|
|
+ }
|
|
|
|
+ if (ClassifyEnum.PACKAGE.name().equals(type) && StringUtils.isNotBlank(templateId)) {
|
|
|
|
+ record.setIncluedPackage(true);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ String ordinaryContent = record.getOrdinaryContent();
|
|
|
|
+ List<Map> ordinaryList = JSONObject.parseArray(ordinaryContent, Map.class);
|
|
|
|
+ record.setIncluedCheckin(false);
|
|
|
|
+ for (Map map : ordinaryList) {
|
|
|
|
+ String type = map.get("type").toString();
|
|
|
|
+ String templateId = map.get("templateId").toString();
|
|
|
|
+ if (ClassifyEnum.CHECK_IN.name().equals(type) && StringUtils.isNotBlank(templateId)) {
|
|
|
|
+ record.setIncluedCheckin(true);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (StringUtils.isNotBlank(record.getClassName())) {
|
|
|
|
+ record.setClassName(String.join(",", new HashSet<>(Arrays.asList(record.getClassName().split(",")))));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return clientPrintTaskDtoIPage;
|
|
}
|
|
}
|
|
|
|
|
|
@Transactional
|
|
@Transactional
|
|
@@ -368,7 +457,9 @@ public class ClientServiceImpl implements ClientService {
|
|
public List<Map<String, Object>> getPrintDataBatch(String machineCode, Long orgId, Long semesterId, Long examId, String printPlanId, String status, String courseCode, String paperNumber, String examPlace, String examRoom, Long examStartTime, Long examEndTime, Boolean isDownload, Boolean validate) {
|
|
public List<Map<String, Object>> getPrintDataBatch(String machineCode, Long orgId, Long semesterId, Long examId, String printPlanId, String status, String courseCode, String paperNumber, String examPlace, String examRoom, Long examStartTime, Long examEndTime, Boolean isDownload, Boolean validate) {
|
|
Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
|
|
Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
|
|
// Set<Long> orgIds = teachcloudCommonService.listSubOrgIds(null);
|
|
// Set<Long> orgIds = teachcloudCommonService.listSubOrgIds(null);
|
|
- List<ClientPrintTaskDto> pirntTaskDtoList = examPrintPlanService.listClientPrintTask(schoolId, semesterId, examId, machineCode, printPlanId, status, courseCode, paperNumber, examPlace, examRoom, examStartTime, examEndTime, isDownload, validate, orgId);
|
|
|
|
|
|
+ // 以下状态考场状态不可查询
|
|
|
|
+ String[] examDetailStatus = new String[]{ExamDetailStatusEnum.NEW.name(), ExamDetailStatusEnum.READY.name(), ExamDetailStatusEnum.CANCEL.name()};
|
|
|
|
+ List<ClientPrintTaskDto> pirntTaskDtoList = clientMapper.listClientPrintTask(schoolId, semesterId, examId, machineCode, printPlanId, status, courseCode, paperNumber, examPlace, examRoom, examStartTime, examEndTime, isDownload, validate, orgId, examDetailStatus);
|
|
// 撤回
|
|
// 撤回
|
|
long count = pirntTaskDtoList.stream().map(m -> {
|
|
long count = pirntTaskDtoList.stream().map(m -> {
|
|
ExamDetail examDetail = examDetailService.getById(m.getExamDetailId());
|
|
ExamDetail examDetail = examDetailService.getById(m.getExamDetailId());
|
|
@@ -552,7 +643,9 @@ public class ClientServiceImpl implements ClientService {
|
|
@Override
|
|
@Override
|
|
public List<Map<String, Object>> getBatchUrl(String machineCode, Long orgId, Long semesterId, Long examId, Long printPlanId, String courseCode, String paperNumber, Boolean isTry, Boolean isPass) {
|
|
public List<Map<String, Object>> getBatchUrl(String machineCode, Long orgId, Long semesterId, Long examId, Long printPlanId, String courseCode, String paperNumber, Boolean isTry, Boolean isPass) {
|
|
Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
|
|
Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
|
|
- List<ClientExamTaskDto> clientExamTaskDtos = examTaskService.listTryTask(schoolId, semesterId, examId, machineCode, orgId, printPlanId, courseCode, paperNumber, isTry, isPass);
|
|
|
|
|
|
+ // 印刷任务状态为印刷中(PRINTING),考场状态为待打印(WAITING)
|
|
|
|
+ String[] examDetailStatus = {ExamDetailStatusEnum.NEW.name(), ExamDetailStatusEnum.READY.name(), ExamDetailStatusEnum.CANCEL.name()};
|
|
|
|
+ List<ClientExamTaskDto> clientExamTaskDtos = clientMapper.pageTryTask(schoolId, semesterId, examId, machineCode, orgId, printPlanId, courseCode, paperNumber, isTry, isPass, PrintPlanStatusEnum.PRINTING.name(), examDetailStatus);
|
|
List<Map<String, Object>> list = new ArrayList<>();
|
|
List<Map<String, Object>> list = new ArrayList<>();
|
|
for (ClientExamTaskDto clientExamTaskDto : clientExamTaskDtos) {
|
|
for (ClientExamTaskDto clientExamTaskDto : clientExamTaskDtos) {
|
|
Map<String, Object> map = new HashMap<>();
|
|
Map<String, Object> map = new HashMap<>();
|
|
@@ -560,7 +653,7 @@ public class ClientServiceImpl implements ClientService {
|
|
map.put("courseCode", clientExamTaskDto.getCourseCode());
|
|
map.put("courseCode", clientExamTaskDto.getCourseCode());
|
|
map.put("courseName", clientExamTaskDto.getCourseName());
|
|
map.put("courseName", clientExamTaskDto.getCourseName());
|
|
map.put("paperNumber", clientExamTaskDto.getPaperNumber());
|
|
map.put("paperNumber", clientExamTaskDto.getPaperNumber());
|
|
- List<Map<String, String>> mapList = examTaskDetailService.getPaperUrl(schoolId, Long.valueOf(clientExamTaskDto.getPrintPlanId()), Long.valueOf(clientExamTaskDto.getExamTaskId()));
|
|
|
|
|
|
+ List<Map<String, String>> mapList = this.getPaperUrl(schoolId, Long.valueOf(clientExamTaskDto.getPrintPlanId()), Long.valueOf(clientExamTaskDto.getExamTaskId()));
|
|
map.put("list", mapList);
|
|
map.put("list", mapList);
|
|
list.add(map);
|
|
list.add(map);
|
|
}
|
|
}
|
|
@@ -570,7 +663,9 @@ public class ClientServiceImpl implements ClientService {
|
|
@Override
|
|
@Override
|
|
public void exportClientPrintTask(HttpServletResponse response, String machineCode, Long orgId, Long semesterId, Long examId, String printPlanId, String status, String courseCode, String paperNumber, String examPlace, String examRoom, Long examStartTime, Long examEndTime, Boolean isDownload, Boolean validate) throws Exception {
|
|
public void exportClientPrintTask(HttpServletResponse response, String machineCode, Long orgId, Long semesterId, Long examId, String printPlanId, String status, String courseCode, String paperNumber, String examPlace, String examRoom, Long examStartTime, Long examEndTime, Boolean isDownload, Boolean validate) throws Exception {
|
|
Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
|
|
Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
|
|
- List<ClientPrintTaskDto> printTaskDtoIList = examPrintPlanService.listClientPrintTask(schoolId, semesterId, examId, machineCode, printPlanId, status, courseCode, paperNumber, examPlace, examRoom, examStartTime, examEndTime, isDownload, validate, orgId);
|
|
|
|
|
|
+ // 以下状态考场状态不可查询
|
|
|
|
+ String[] examDetailStatus = new String[]{ExamDetailStatusEnum.NEW.name(), ExamDetailStatusEnum.READY.name(), ExamDetailStatusEnum.CANCEL.name()};
|
|
|
|
+ List<ClientPrintTaskDto> printTaskDtoIList = clientMapper.listClientPrintTask(schoolId, semesterId, examId, machineCode, printPlanId, status, courseCode, paperNumber, examPlace, examRoom, examStartTime, examEndTime, isDownload, validate, orgId, examDetailStatus);
|
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
printTaskDtoIList = printTaskDtoIList.stream().map(m -> {
|
|
printTaskDtoIList = printTaskDtoIList.stream().map(m -> {
|
|
if (m.getExamStartTime() != null) {
|
|
if (m.getExamStartTime() != null) {
|
|
@@ -599,7 +694,31 @@ public class ClientServiceImpl implements ClientService {
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public ClientPrintTaskTotalDto taskTotalData(Long semesterId, Long examId, String printPlanId, Long orgId, String status, String courseCode, String paperNumber, String examPlace, String examRoom, Long examStartTime, Long examEndTime, Boolean isDownload, Boolean validate, String machineCode) {
|
|
public ClientPrintTaskTotalDto taskTotalData(Long semesterId, Long examId, String printPlanId, Long orgId, String status, String courseCode, String paperNumber, String examPlace, String examRoom, Long examStartTime, Long examEndTime, Boolean isDownload, Boolean validate, String machineCode) {
|
|
- return examPrintPlanService.clientTaskTotalData(semesterId, examId, printPlanId, orgId, status, courseCode, paperNumber, examPlace, examRoom, examStartTime, examEndTime, isDownload, validate, machineCode);
|
|
|
|
|
|
+ Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
|
|
|
|
+ String[] examDetailStatus = new String[]{ExamDetailStatusEnum.NEW.name(), ExamDetailStatusEnum.READY.name(), ExamDetailStatusEnum.CANCEL.name()};
|
|
|
|
+ ClientPrintTaskTotalDto clientPrintTaskTotalDto = clientMapper.clientTaskTotalData(schoolId, semesterId, examId, printPlanId, status, courseCode, paperNumber, examPlace, examRoom, examStartTime, examEndTime, isDownload, validate, machineCode, orgId, examDetailStatus);
|
|
|
|
+ if (clientPrintTaskTotalDto != null) {
|
|
|
|
+ // 累计a3,a4
|
|
|
|
+ List<ClientPrintData> list = clientPrintDataService.listBySchoolIdAndMachineCode(schoolId, machineCode);
|
|
|
|
+ if (!list.isEmpty()) {
|
|
|
|
+ int paperPages = list.stream().filter(m -> m.getPaperPages() != null).mapToInt(ClientPrintData::getPaperPages).sum();
|
|
|
|
+ clientPrintTaskTotalDto.setHostPaperPages(paperPages / 2);
|
|
|
|
+ int cardPages = list.stream().filter(m -> m.getCardPages() != null).mapToInt(ClientPrintData::getCardPages).sum();
|
|
|
|
+ clientPrintTaskTotalDto.setHostCardPages(cardPages / 2);
|
|
|
|
+ int pagesA4 = list.stream().filter(m -> m.getPagesA4() != null).mapToInt(ClientPrintData::getPagesA4).sum();
|
|
|
|
+ clientPrintTaskTotalDto.setHostPagesA4(pagesA4 / 2);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 试卷总计
|
|
|
|
+ String paperNumberStrs = clientPrintTaskTotalDto.getPaperNumberAndType();
|
|
|
|
+ if (StringUtils.isNotBlank(paperNumberStrs)) {
|
|
|
|
+ String[] paperNumbers = paperNumberStrs.split(",");
|
|
|
|
+ Set<String> paperNumberSet = new HashSet<>(Arrays.asList(paperNumbers));
|
|
|
|
+ clientPrintTaskTotalDto.setPaperCount(paperNumberSet.size());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return clientPrintTaskTotalDto;
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -614,15 +733,6 @@ public class ClientServiceImpl implements ClientService {
|
|
return examPrintPlanService.clientStatisticsTotalData(orgId, semesterId, examId, printPlanId, examPlace, examStartTime, examEndTime, courseCode, paperNumber);
|
|
return examPrintPlanService.clientStatisticsTotalData(orgId, semesterId, examId, printPlanId, examPlace, examStartTime, examEndTime, courseCode, paperNumber);
|
|
}
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
|
- public void checkPrivilege(Long userId) {
|
|
|
|
- List<SysPrivilege> sysPrivileges = sysPrivilegeService.getClientUrlByUserId(userId);
|
|
|
|
- long count = sysPrivileges.stream().filter(m -> "打印端".equals(m.getName()) && "client".equals(m.getUrl())).count();
|
|
|
|
- if (count == 0) {
|
|
|
|
- throw ExceptionResultEnum.ERROR.exception("用户没有客户端权限");
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
@Override
|
|
@Override
|
|
public boolean updatePassword(Long userId, String password) {
|
|
public boolean updatePassword(Long userId, String password) {
|
|
SysUser sysUser = sysUserService.getById(userId);
|
|
SysUser sysUser = sysUserService.getById(userId);
|
|
@@ -783,6 +893,41 @@ public class ClientServiceImpl implements ClientService {
|
|
return clientPrintDataDtos;
|
|
return clientPrintDataDtos;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public List<Map<String, String>> getPaperUrl(Long schoolId, Long printPlanId, Long examTaskId) {
|
|
|
|
+ ExamTask examTask = examTaskService.getById(examTaskId);
|
|
|
|
+ List<ExamDetailCourse> examDetailCourses = examDetailCourseService.listByPrintPlanIdAndCourseCodeAndPaperNumber(schoolId, printPlanId, examTask.getCourseCode(), examTask.getPaperNumber());
|
|
|
|
+ if (CollectionUtils.isNotEmpty(examDetailCourses)) {
|
|
|
|
+ Set<String> relatePaperTypes = examDetailCourses.stream().filter(m -> StringUtils.isNotBlank(m.getPaperType())).map(m -> m.getPaperType()).collect(Collectors.toSet());
|
|
|
|
+ List<Map<String, String>> paperList = new ArrayList<>();
|
|
|
|
+ ExamTaskDetail examTaskDetail = examTaskDetailService.getByExamTaskId(examTaskId);
|
|
|
|
+ if (CollectionUtils.isEmpty(relatePaperTypes)) {
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("未找到关联的试卷卷型");
|
|
|
|
+ }
|
|
|
|
+ List<PaperInfoVo> paperInfoVoList = ExamTaskUtil.parsePaperAttachmentPath(examTaskDetail.getPaperAttachmentIds());
|
|
|
|
+ if (CollectionUtils.isEmpty(paperInfoVoList)) {
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("未找到关联的试卷文件");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Map<String, String> paperMap = paperInfoVoList.stream().collect(Collectors.toMap(m -> m.getName(), m -> String.valueOf(m.getAttachmentId())));
|
|
|
|
+ for (String relatePaperType : relatePaperTypes) {
|
|
|
|
+ String[] paperTypes = relatePaperType.split(",");
|
|
|
|
+ for (String paperType : paperTypes) {
|
|
|
|
+ if (!paperMap.containsKey(paperType)) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ String attachmentId = paperMap.get(paperType);
|
|
|
|
+ if (StringUtils.isNotBlank(attachmentId)) {
|
|
|
|
+ paperList.add(teachcloudCommonService.filePreviewByAttachmentId(Long.valueOf(attachmentId), false));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ paperList = paperList.stream().distinct().collect(Collectors.toList());
|
|
|
|
+ return paperList;
|
|
|
|
+ }
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* new ClientPrintDataDto
|
|
* new ClientPrintDataDto
|
|
*
|
|
*
|