|
@@ -3,48 +3,61 @@ package com.qmth.distributed.print.business.service.impl;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.qmth.distributed.print.business.entity.ClientStatus;
|
|
|
+import com.qmth.distributed.print.business.entity.ExamDetailCourse;
|
|
|
import com.qmth.distributed.print.business.mapper.ClientStatusMapper;
|
|
|
import com.qmth.distributed.print.business.service.ClientStatusService;
|
|
|
+import com.qmth.distributed.print.business.service.ExamDetailCourseService;
|
|
|
import com.qmth.distributed.print.business.service.ExamTaskService;
|
|
|
import com.qmth.distributed.print.common.contant.SystemConstant;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
/**
|
|
|
* @Date: 2021/4/19.
|
|
|
*/
|
|
|
@Service
|
|
|
public class ClientStatusServiceImpl extends ServiceImpl<ClientStatusMapper, ClientStatus> implements ClientStatusService {
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ExamDetailCourseService examDetailCourseService;
|
|
|
+
|
|
|
@Override
|
|
|
public Boolean tagPass(Long schoolId, Long printPlanId, String courseCode, String courseName, String paperNumber, String machineCode, Boolean isPass, Long userId) {
|
|
|
- QueryWrapper<ClientStatus> queryWrapper = new QueryWrapper<>();
|
|
|
- queryWrapper.lambda().eq(ClientStatus::getSchoolId, schoolId).eq(ClientStatus::getPrintPlanId, printPlanId).eq(ClientStatus::getCourseCode, courseCode).eq(ClientStatus::getPaperNumber, paperNumber).eq(ClientStatus::getMachineCode, machineCode);
|
|
|
- ClientStatus clientStatus = this.getOne(queryWrapper);
|
|
|
- if(clientStatus != null){
|
|
|
- clientStatus.setPass(isPass);
|
|
|
- clientStatus.setUpdateId(userId);
|
|
|
- clientStatus.setUpdateTime(System.currentTimeMillis());
|
|
|
- // 合格,更新打印时间
|
|
|
- if(isPass){
|
|
|
+ List<ExamDetailCourse> examDetailCourses = examDetailCourseService.listByPrintPlanIdAndCourseCodeAndPaperNumber(schoolId, printPlanId, courseCode, paperNumber);
|
|
|
+ for (ExamDetailCourse examDetailCours : examDetailCourses) {
|
|
|
+ QueryWrapper<ClientStatus> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.lambda().eq(ClientStatus::getSchoolId, schoolId).eq(ClientStatus::getExamDetailId, examDetailCours.getExamDetailId()).eq(ClientStatus::getPrintPlanId, printPlanId).eq(ClientStatus::getCourseCode, courseCode).eq(ClientStatus::getPaperNumber, paperNumber).eq(ClientStatus::getMachineCode, machineCode);
|
|
|
+ ClientStatus clientStatus = this.getOne(queryWrapper);
|
|
|
+ if(clientStatus != null){
|
|
|
+ clientStatus.setPass(isPass);
|
|
|
+ clientStatus.setUpdateId(userId);
|
|
|
+ clientStatus.setUpdateTime(System.currentTimeMillis());
|
|
|
+ // 合格,更新打印时间
|
|
|
+ if(isPass){
|
|
|
+ clientStatus.setTryTime(System.currentTimeMillis());
|
|
|
+ }
|
|
|
+ this.updateById(clientStatus);
|
|
|
+ } else {
|
|
|
+ clientStatus = new ClientStatus();
|
|
|
+ clientStatus.setId(SystemConstant.getDbUuid());
|
|
|
+ clientStatus.setSchoolId(schoolId);
|
|
|
+ clientStatus.setExamDetailId(examDetailCours.getExamDetailId());
|
|
|
+ clientStatus.setPrintPlanId(printPlanId);
|
|
|
+ clientStatus.setMachineCode(machineCode);
|
|
|
+ clientStatus.setCourseCode(courseCode);
|
|
|
+ clientStatus.setCourseName(courseName);
|
|
|
+ clientStatus.setPaperNumber(paperNumber);
|
|
|
+ clientStatus.setTry(true);
|
|
|
clientStatus.setTryTime(System.currentTimeMillis());
|
|
|
+ clientStatus.setPass(isPass);
|
|
|
+ clientStatus.setDownload(false);
|
|
|
+ clientStatus.setCreateId(userId);
|
|
|
+ clientStatus.setCreateTime(System.currentTimeMillis());
|
|
|
+ this.save(clientStatus);
|
|
|
}
|
|
|
- return this.updateById(clientStatus);
|
|
|
- } else {
|
|
|
- clientStatus = new ClientStatus();
|
|
|
- clientStatus.setId(SystemConstant.getDbUuid());
|
|
|
- clientStatus.setSchoolId(schoolId);
|
|
|
- clientStatus.setPrintPlanId(printPlanId);
|
|
|
- clientStatus.setMachineCode(machineCode);
|
|
|
- clientStatus.setCourseCode(courseCode);
|
|
|
- clientStatus.setCourseName(courseName);
|
|
|
- clientStatus.setPaperNumber(paperNumber);
|
|
|
- clientStatus.setTry(true);
|
|
|
- clientStatus.setTryTime(System.currentTimeMillis());
|
|
|
- clientStatus.setPass(isPass);
|
|
|
- clientStatus.setCreateId(userId);
|
|
|
- clientStatus.setCreateTime(System.currentTimeMillis());
|
|
|
- return this.save(clientStatus);
|
|
|
}
|
|
|
+ return true;
|
|
|
}
|
|
|
}
|