Quellcode durchsuchen

新增一些接口校验

yin vor 4 Monaten
Ursprung
Commit
1407b87fa8

+ 2 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/BasicExamStudentService.java

@@ -100,4 +100,6 @@ public interface BasicExamStudentService extends IService<BasicExamStudent> {
     Map<String, Object> saveBasicExamStudentFormSync(Long schoolId, Long examId, List<TSyncDataStudent> examStudentDataVo);
 
     String listByTeacherByExamIdAndPaperNumber(Long examId, String paperNumber);
+
+    BasicExamStudent findByExamIdAndCoursePaperIdAndStudentCode(Long examId, String coursePaperId, String studentCode);
 }

+ 9 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/BasicExamStudentServiceImpl.java

@@ -791,4 +791,13 @@ public class BasicExamStudentServiceImpl extends ServiceImpl<BasicExamStudentMap
     public String listByTeacherByExamIdAndPaperNumber(Long examId, String paperNumber) {
         return this.baseMapper.listByTeacherByExamIdAndPaperNumber(examId, paperNumber);
     }
+
+    @Override
+    public BasicExamStudent findByExamIdAndCoursePaperIdAndStudentCode(Long examId, String coursePaperId, String studentCode) {
+        QueryWrapper<BasicExamStudent> queryWrapper = new QueryWrapper<>();
+        queryWrapper.lambda().eq(BasicExamStudent::getExamId, examId)
+                .eq(BasicExamStudent::getCoursePaperId, coursePaperId)
+                .eq(BasicExamStudent::getStudentCode,studentCode);
+        return this.getOne(queryWrapper);
+    }
 }

+ 45 - 2
distributed-print/src/main/java/com/qmth/distributed/print/api/mark/ScanStudentController.java

@@ -7,14 +7,22 @@ import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
 import com.qmth.boot.api.constant.ApiConstant;
+import com.qmth.boot.core.exception.ParameterException;
+import com.qmth.distributed.print.business.service.BasicExamService;
+import com.qmth.distributed.print.business.service.BasicExamStudentService;
 import com.qmth.teachcloud.common.contant.SystemConstant;
+import com.qmth.teachcloud.common.entity.BasicExam;
+import com.qmth.teachcloud.common.entity.BasicExamStudent;
+import com.qmth.teachcloud.common.enums.BasicExamStudentStatusEnum;
 import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
 import com.qmth.teachcloud.common.util.Result;
 import com.qmth.teachcloud.common.util.ResultUtil;
 import com.qmth.teachcloud.mark.bean.UpdateTimeVo;
 import com.qmth.teachcloud.mark.bean.student.AbsentManualUpdateVo;
 import com.qmth.teachcloud.mark.bean.student.StudentQuery;
+import com.qmth.teachcloud.mark.entity.MarkPaper;
 import com.qmth.teachcloud.mark.entity.MarkStudent;
+import com.qmth.teachcloud.mark.service.MarkPaperService;
 import com.qmth.teachcloud.mark.service.MarkStudentService;
 
 import io.swagger.annotations.Api;
@@ -37,6 +45,14 @@ public class ScanStudentController extends BaseController {
     @Resource
     private MarkStudentService markStudentService;
 
+    @Resource
+    private BasicExamStudentService basicExamStudentService;
+    @Resource
+    private BasicExamService basicExamService;
+
+    @Resource
+    private MarkPaperService markPaperService;
+
     @ApiOperation(value = "考生查询")
     @RequestMapping(value = "find", method = RequestMethod.POST)
     public Result student(@Validated StudentQuery query) {
@@ -113,8 +129,35 @@ public class ScanStudentController extends BaseController {
 
     @ApiOperation(value = "考生新增")
     @RequestMapping(value = "save", method = RequestMethod.POST)
-    public Result studentSave(@RequestParam Long examId, @RequestParam String coursePaperId, @RequestParam String studentCode, @RequestParam String studentName,@RequestParam(required = false) String paperType) {
-        return ResultUtil.ok(markStudentService.add(examId,coursePaperId,studentCode,studentName,paperType));
+    public Result studentSave(@RequestParam Long examId, @RequestParam String coursePaperId, @RequestParam String studentCode, @RequestParam String studentName,@RequestParam(required = false) String paperType,@RequestParam String teachClassName) {
+        MarkStudent markStudent = markStudentService.findByExamIdAndCoursePaperIdAndStudentCode(examId,coursePaperId,studentCode);
+        if(markStudent != null ){
+            throw new ParameterException("考生已存在");
+        }
+        BasicExamStudent basicExamStudent = basicExamStudentService.findByExamIdAndCoursePaperIdAndStudentCode(examId,coursePaperId,studentCode);
+        if(basicExamStudent != null ){
+            throw new ParameterException("基础考生已存在");
+        }
+        MarkPaper markPaper = markPaperService.getByExamIdAndCoursePaperId(examId, coursePaperId);
+        BasicExam basicExam = basicExamService.getById(examId);
+        basicExamStudent = new BasicExamStudent();
+        basicExamStudent.setId(SystemConstant.getDbUuid());
+        basicExamStudent.setSchoolId(basicExam.getSchoolId());
+        basicExamStudent.setSemesterId(Long.valueOf(basicExam.getSemesterId()));
+        basicExamStudent.setExamId(examId);
+        basicExamStudent.setCourseId(markPaper.getCourseId());
+        basicExamStudent.setCourseCode(markPaper.getCourseCode());
+        basicExamStudent.setCourseName(markPaper.getCourseName());
+        basicExamStudent.setCoursePaperId(coursePaperId);
+        basicExamStudent.setPaperNumber(markPaper.getPaperNumber());
+        basicExamStudent.setPaperType(paperType);
+        basicExamStudent.setStudentCode(studentCode);
+        basicExamStudent.setStudentName(studentName);
+        basicExamStudent.setStatus(BasicExamStudentStatusEnum.N);
+        basicExamStudent.setEnable(true);
+        basicExamStudent.setTeachClassName(teachClassName);
+        this.basicExamStudentService.save(basicExamStudent);
+        return ResultUtil.ok(markStudentService.add(examId,coursePaperId,studentCode,studentName,paperType,basicExamStudent.getId()));
     }
 
 }

+ 10 - 0
teachcloud-common/src/main/java/com/qmth/teachcloud/common/bean/dto/CoursePaperNumberDto.java

@@ -49,6 +49,8 @@ public class CoursePaperNumberDto {
         private String coursePaperId;
         private Boolean markFinished;
 
+        private String paperType;
+
         public String getCoursePaperNumber() {
             return coursePaperNumber;
         }
@@ -72,6 +74,14 @@ public class CoursePaperNumberDto {
         public void setMarkFinished(Boolean markFinished) {
             this.markFinished = markFinished;
         }
+
+        public String getPaperType() {
+            return paperType;
+        }
+
+        public void setPaperType(String paperType) {
+            this.paperType = paperType;
+        }
     }
 
 }

+ 1 - 1
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/MarkStudentService.java

@@ -264,5 +264,5 @@ public interface MarkStudentService extends IService<MarkStudent> {
 
     UpdateTimeVo breachUpdate(Long studentId, Boolean breach);
 
-    boolean add(Long examId, String coursePaperId, String studentCode, String studentName, String paperType);
+    boolean add(Long examId, String coursePaperId, String studentCode, String studentName, String paperType, Long basicStudentId);
 }

+ 3 - 2
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/impl/MarkStudentServiceImpl.java

@@ -2430,10 +2430,11 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
     }
 
     @Override
-    public boolean add(Long examId, String coursePaperId, String studentCode, String studentName, String paperType) {
+    @Transactional
+    public boolean add(Long examId, String coursePaperId, String studentCode, String studentName, String paperType, Long basicStudentId) {
         SysUser user = (SysUser) ServletUtil.getRequestUser();
         MarkPaper markPaper = markPaperService.getByExamIdAndCoursePaperId(examId, coursePaperId);
-        MarkStudent markStudent = new MarkStudent(SystemConstant.getDbUuid(), examId, null, markPaper.getCourseId(), markPaper.getPaperNumber(), coursePaperId, markPaper.getSerialNumber(), paperType, studentCode, "", null, null, null, null, user.getId());
+        MarkStudent markStudent = new MarkStudent(SystemConstant.getDbUuid(), examId, basicStudentId, markPaper.getCourseId(), markPaper.getPaperNumber(), coursePaperId, markPaper.getSerialNumber(), paperType, studentCode, "", null, null, null, null, user.getId());
         if (markStudent.getSecretNumber() == null) {
             markStudent.randomSecretNumber();
             while (this.countByExamIdAndSecretNumber(markStudent.getExamId(), markStudent.getSecretNumber()) > 0) {

+ 1 - 0
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/impl/ScanAnswerCardServiceImpl.java

@@ -370,6 +370,7 @@ public class ScanAnswerCardServiceImpl extends ServiceImpl<ScanAnswerCardMapper,
     }
 
     @Override
+    @Transactional
     public AnswerCardVo cardCopy(Long examId, Integer number) {
         ScanAnswerCard old = this.findByExamAndNumber(examId,number);
         if(old ==null ){

+ 1 - 0
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/impl/ScanConditionServiceImpl.java

@@ -95,6 +95,7 @@ public class ScanConditionServiceImpl implements ScanConditionService {
                 paperNumberDto.setCoursePaperNumber(markPaper.getPaperNumber());
                 paperNumberDto.setCoursePaperId(markPaper.getCoursePaperId());
                 paperNumberDto.setMarkFinished(markPaper.getStatus() != null && markPaper.getStatus().equals(MarkPaperStatus.FINISH));
+                paperNumberDto.setPaperType(markPaper.getPaperType());
                 paperNumberDtoList.add(paperNumberDto);
             }
             coursePaperNumberDto.setPaperNumberList(paperNumberDtoList);