diff --git a/web-adapter/src/main/java/com/zcloud/edu/app/study/AppClassController.java b/web-adapter/src/main/java/com/zcloud/edu/app/study/AppClassController.java index d521981..058153b 100644 --- a/web-adapter/src/main/java/com/zcloud/edu/app/study/AppClassController.java +++ b/web-adapter/src/main/java/com/zcloud/edu/app/study/AppClassController.java @@ -8,10 +8,7 @@ import com.alibaba.cola.dto.SingleResponse; import com.zcloud.edu.api.study.ClassServiceI; import com.zcloud.edu.dto.clientobject.study.ClassCO; import com.zcloud.edu.dto.data.study.ClassQuestionDTO; -import com.zcloud.edu.dto.study.ClassAddCmd; -import com.zcloud.edu.dto.study.ClassPageQry; -import com.zcloud.edu.dto.study.ClassPostponeCmd; -import com.zcloud.edu.dto.study.ClassUpdateCmd; +import com.zcloud.edu.dto.study.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.AllArgsConstructor; @@ -39,5 +36,6 @@ public class AppClassController { return classService.appListPage(qry); } + } diff --git a/web-adapter/src/main/java/com/zcloud/edu/app/study/AppClassExamPaperController.java b/web-adapter/src/main/java/com/zcloud/edu/app/study/AppClassExamPaperController.java new file mode 100644 index 0000000..a1e720f --- /dev/null +++ b/web-adapter/src/main/java/com/zcloud/edu/app/study/AppClassExamPaperController.java @@ -0,0 +1,93 @@ +package com.zcloud.edu.app.study; + + +import com.alibaba.cola.dto.MultiResponse; +import com.alibaba.cola.dto.PageResponse; +import com.alibaba.cola.dto.Response; +import com.alibaba.cola.dto.SingleResponse; +import com.zcloud.edu.api.study.ClassExamPaperServiceI; +import com.zcloud.edu.dto.clientobject.study.ClassExamPaperCO; +import com.zcloud.edu.dto.study.ClassExamPaperAddCmd; +import com.zcloud.edu.dto.study.ClassExamPaperAutoAddCmd; +import com.zcloud.edu.dto.study.ClassExamPaperPageQry; +import com.zcloud.edu.dto.study.ClassExamPaperUpdateCmd; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.AllArgsConstructor; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.ArrayList; + +/** + * web-adapter + * + * @Author zhangyue + * @Date 2026-01-13 14:18:21 + */ +@Api(tags = "班级考试信息") +@RequestMapping("/${application.gateway}/app/classExamPaper") +@RestController +@AllArgsConstructor +public class AppClassExamPaperController { + private final ClassExamPaperServiceI classExamPaperService; + + @ApiOperation("新增") + @PostMapping("/save") + public SingleResponse add(@Validated @RequestBody ClassExamPaperAddCmd cmd) { + return classExamPaperService.add(cmd); + } + + @ApiOperation("自动生成试卷") + @PostMapping("/autoSave") + public SingleResponse autoSave(@Validated @RequestBody ClassExamPaperAutoAddCmd cmd) { + return classExamPaperService.autoSave(cmd); + } + + @ApiOperation("分页") + @PostMapping("/list") + public PageResponse page(@RequestBody ClassExamPaperPageQry qry) { + return classExamPaperService.listPage(qry); + } + + @ApiOperation("所有数据") + @GetMapping("/listAll") + public MultiResponse listAll() { + return MultiResponse.of(new ArrayList()); + } + + @ApiOperation("详情") + @GetMapping("/{id}") + public SingleResponse getInfoById(@PathVariable("id") Long id) { + return classExamPaperService.getInfoById(id); + } + + + @ApiOperation("详情") + @GetMapping("/getInfoByClassId/{classId}") + public SingleResponse getInfoByClassId(@PathVariable("classId") String classId) { + return classExamPaperService.getInfoByClassId(classId); + } + + @ApiOperation("删除") + @DeleteMapping("/{id}") + public Response remove(@PathVariable("id") Long id) { + classExamPaperService.remove(id); + return SingleResponse.buildSuccess(); + } + + @ApiOperation("删除多个") + @DeleteMapping("/ids") + public Response removeBatch(@RequestParam Long[] ids) { + classExamPaperService.removeBatch(ids); + return SingleResponse.buildSuccess(); + } + + @ApiOperation("修改") + @PutMapping("/edit") + public SingleResponse edit(@Validated @RequestBody ClassExamPaperUpdateCmd classExamPaperUpdateCmd) { + classExamPaperService.edit(classExamPaperUpdateCmd); + return SingleResponse.buildSuccess(); + } +} + diff --git a/web-adapter/src/main/java/com/zcloud/edu/app/study/AppStudentSignController.java b/web-adapter/src/main/java/com/zcloud/edu/app/study/AppStudentSignController.java new file mode 100644 index 0000000..920378e --- /dev/null +++ b/web-adapter/src/main/java/com/zcloud/edu/app/study/AppStudentSignController.java @@ -0,0 +1,83 @@ +package com.zcloud.edu.app.study; + + +import com.alibaba.cola.dto.MultiResponse; +import com.alibaba.cola.dto.PageResponse; +import com.alibaba.cola.dto.Response; +import com.alibaba.cola.dto.SingleResponse; +import com.jjb.saas.framework.auth.model.SSOUser; +import com.jjb.saas.framework.auth.utils.AuthContext; +import com.zcloud.edu.api.study.StudentSignServiceI; +import com.zcloud.edu.dto.clientobject.study.StudentSignCO; +import com.zcloud.edu.dto.study.*; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.AllArgsConstructor; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.ArrayList; + +/** + * web-adapter + * + * @Author zhangyue + * @Date 2026-01-13 14:18:19 + */ +@Api(tags = "学员签到") +@RequestMapping("/${application.gateway}/app/studentSign") +@RestController +@AllArgsConstructor +public class AppStudentSignController { + private final StudentSignServiceI studentSignService; + + @ApiOperation("对比人脸") + @PostMapping("/compareFace") + public SingleResponse compareFace(@Validated StudentSignAddCmd cmd) { + return studentSignService.add(cmd); + } + @ApiOperation("验证是否可签到") + @GetMapping("/verify") + public Response verify(@RequestBody StudentSignVerifyQry qry) { + return studentSignService.verify(qry); + } + @ApiOperation("分页") + @PostMapping("/list") + public PageResponse page(@RequestBody StudentSignPageQry qry) { + return studentSignService.listPage(qry); + } + + @ApiOperation("所有数据") + @GetMapping("/listAll") + public MultiResponse listAll(@RequestBody ClassAppSignQry qry) { + return studentSignService.listAll(qry); + } + + @ApiOperation("详情") + @GetMapping("/{id}") + public SingleResponse getInfoById(@PathVariable("id") Long id) { + return SingleResponse.of(new StudentSignCO()); + } + + @ApiOperation("删除") + @DeleteMapping("/{id}") + public Response remove(@PathVariable("id") Long id) { + studentSignService.remove(id); + return SingleResponse.buildSuccess(); + } + + @ApiOperation("删除多个") + @DeleteMapping("/ids") + public Response removeBatch(@RequestParam Long[] ids) { + studentSignService.removeBatch(ids); + return SingleResponse.buildSuccess(); + } + + @ApiOperation("修改") + @PutMapping("/edit") + public SingleResponse edit(@Validated @RequestBody StudentSignUpdateCmd studentSignUpdateCmd) { + studentSignService.edit(studentSignUpdateCmd); + return SingleResponse.buildSuccess(); + } +} + diff --git a/web-app/src/main/java/com/zcloud/edu/command/query/study/ClassCurriculumQueryExe.java b/web-app/src/main/java/com/zcloud/edu/command/query/study/ClassCurriculumQueryExe.java index fae8de9..7a2d69c 100644 --- a/web-app/src/main/java/com/zcloud/edu/command/query/study/ClassCurriculumQueryExe.java +++ b/web-app/src/main/java/com/zcloud/edu/command/query/study/ClassCurriculumQueryExe.java @@ -57,13 +57,13 @@ public class ClassCurriculumQueryExe { */ public SingleResponse executeGetInfoById(Long id) { ClassCurriculumDO classCurriculumDO = classCurriculumRepository.getInfoById(id); - List classCurriculumChapterDOList = classCurriculumChapterRepository.listByCurriculumId(classCurriculumDO.getClassCurriculumId()); + List classCurriculumChapterDOList = classCurriculumChapterRepository.listByClassCurriculumId(classCurriculumDO.getClassCurriculumId()); ClassCurriculumCO classCurriculumCO = new ClassCurriculumCO(); BeanUtils.copyProperties(classCurriculumDO, classCurriculumCO); List classCurriculumChapterCOList = classCurriculumChapterCoConvertor.converDOsToCOs(classCurriculumChapterDOList); long videoCount = classCurriculumChapterCOList.stream().filter(bean -> !ObjectUtils.isEmpty(bean.getVideoCoursewareId())).count(); - Tools.buildEntityTree(classCurriculumChapterCOList, "curriculumChapterId", "parentId", "children", "0"); - classCurriculumCO.setChapterList(classCurriculumChapterCOList); + Tools.buildEntityTree(classCurriculumChapterCOList, "curriculumChapterId", "parentId", "childCurriculumChapterCOList", "0"); + classCurriculumCO.setCurriculumChapterCOList(classCurriculumChapterCOList); classCurriculumCO.setVideoCount(videoCount); return SingleResponse.of(classCurriculumCO); } diff --git a/web-app/src/main/java/com/zcloud/edu/command/query/study/ClassExamPaperQueryExe.java b/web-app/src/main/java/com/zcloud/edu/command/query/study/ClassExamPaperQueryExe.java index cea4357..11ceca2 100644 --- a/web-app/src/main/java/com/zcloud/edu/command/query/study/ClassExamPaperQueryExe.java +++ b/web-app/src/main/java/com/zcloud/edu/command/query/study/ClassExamPaperQueryExe.java @@ -1,17 +1,22 @@ package com.zcloud.edu.command.query.study; +import cn.hutool.core.bean.BeanUtil; import com.alibaba.cola.dto.PageResponse; import com.alibaba.cola.dto.SingleResponse; import com.zcloud.edu.command.convertor.study.ClassExamPaperCoConvertor; +import com.zcloud.edu.dto.clientobject.resource.QuestionCO; import com.zcloud.edu.dto.clientobject.study.ClassExamPaperCO; import com.zcloud.edu.dto.study.ClassExamPaperPageQry; +import com.zcloud.edu.persistence.dataobject.QuestionDO; import com.zcloud.edu.persistence.dataobject.study.ClassExamPaperDO; +import com.zcloud.edu.persistence.repository.resource.QuestionRepository; import com.zcloud.edu.persistence.repository.study.ClassExamPaperRepository; import com.zcloud.gbscommon.utils.PageQueryHelper; import lombok.AllArgsConstructor; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Component; +import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -27,6 +32,7 @@ import java.util.Map; public class ClassExamPaperQueryExe { private final ClassExamPaperRepository classExamPaperRepository; private final ClassExamPaperCoConvertor classExamPaperCoConvertor; + private final QuestionRepository questionRepository; /** * 分页 @@ -52,5 +58,19 @@ public class ClassExamPaperQueryExe { BeanUtils.copyProperties(classExamPaperDO, classExamPaperCO); return SingleResponse.of(classExamPaperCO); } + /** + * 详情 + * @param classId + * @return + */ + public SingleResponse executeGetInfoByClassId(String classId) { + ClassExamPaperDO classExamPaperDO = classExamPaperRepository.findByClassId(classId); + List questionDOList = questionRepository.getInfoByExamPaperId(classExamPaperDO.getExamPaperId()); + List questionCOList = BeanUtil.copyToList(questionDOList, QuestionCO.class); + ClassExamPaperCO classExamPaperCO = new ClassExamPaperCO(); + BeanUtils.copyProperties(classExamPaperDO, classExamPaperCO); + classExamPaperCO.setQuestionList(questionCOList); + return SingleResponse.of(classExamPaperCO); + } } diff --git a/web-app/src/main/java/com/zcloud/edu/command/query/study/StudentSignQueryExe.java b/web-app/src/main/java/com/zcloud/edu/command/query/study/StudentSignQueryExe.java index 605e240..b9bef72 100644 --- a/web-app/src/main/java/com/zcloud/edu/command/query/study/StudentSignQueryExe.java +++ b/web-app/src/main/java/com/zcloud/edu/command/query/study/StudentSignQueryExe.java @@ -1,15 +1,30 @@ package com.zcloud.edu.command.query.study; +import com.alibaba.cola.dto.MultiResponse; import com.alibaba.cola.dto.PageResponse; +import com.alibaba.cola.dto.Response; import com.zcloud.edu.command.convertor.study.StudentSignCoConvertor; +import com.zcloud.edu.domain.model.study.ClassE; import com.zcloud.edu.dto.clientobject.study.StudentSignCO; +import com.zcloud.edu.dto.study.ClassAppSignQry; import com.zcloud.edu.dto.study.StudentSignPageQry; +import com.zcloud.edu.dto.study.StudentSignVerifyQry; +import com.zcloud.edu.persistence.dataobject.study.ClassDO; +import com.zcloud.edu.persistence.dataobject.study.StudentDO; +import com.zcloud.edu.persistence.dataobject.study.StudentExamRecordDO; import com.zcloud.edu.persistence.dataobject.study.StudentSignDO; +import com.zcloud.edu.persistence.repository.study.ClassRepository; +import com.zcloud.edu.persistence.repository.study.StudentExamRecordRepository; +import com.zcloud.edu.persistence.repository.study.StudentRepository; import com.zcloud.edu.persistence.repository.study.StudentSignRepository; import com.zcloud.gbscommon.utils.PageQueryHelper; import lombok.AllArgsConstructor; +import org.springframework.beans.BeanUtils; +import org.springframework.security.core.parameters.P; import org.springframework.stereotype.Component; +import org.springframework.web.multipart.MultipartFile; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -25,6 +40,9 @@ import java.util.Map; public class StudentSignQueryExe { private final StudentSignRepository studentSignRepository; private final StudentSignCoConvertor studentSignCoConvertor; + private final ClassRepository classRepository; + private final StudentRepository studentRepository; + private final StudentExamRecordRepository studentExamRecordRepository; /** * 分页 @@ -38,5 +56,42 @@ public class StudentSignQueryExe { List examCenterCOS = studentSignCoConvertor.converDOsToCOs(pageResponse.getData()); return PageResponse.of(examCenterCOS, pageResponse.getTotalCount(), pageResponse.getPageSize(), pageResponse.getPageIndex()); } + + public MultiResponse executeListAll(ClassAppSignQry qry) { + Map params = PageQueryHelper.toHashMap(qry); + List list = studentSignRepository.listAll(params); + List studentSignCOS = studentSignCoConvertor.converDOsToCOs(list); + return MultiResponse.of(studentSignCOS); + } + + + public Response executeVerify(StudentSignVerifyQry qry) { + ClassDO classDO = classRepository.getByClassId(qry.getClassId()); + ClassE classE = new ClassE(); + BeanUtils.copyProperties(classDO, classE); + classE.isBegin(); + StudentDO studentDO = studentRepository.findByClassIdAndPhone(classDO.getClassId(), qry.getPhone()); + if (studentDO == null){ + throw new RuntimeException("您不在此班级中"); + } + if(studentDO.getState() == 1){ + throw new RuntimeException("您已经完成此班级的学习"); + } + Map params = new HashMap<>(); + params.put("student_id", studentDO.getStudentId()); + params.put("type", qry.getType()); + if (qry.getType() == 1){ + List list = studentSignRepository.listAllByStudentId(params); + if (list != null && list.size() > 0){ + throw new RuntimeException("您已签到"); + } + } else if (qry.getType() == 2){ + List list = studentExamRecordRepository.listAllByStudentId(studentDO.getStudentId()); + if (list != null && list.size() == classDO.getNumberofexams()){ + throw new RuntimeException("您已经没有考试次数"); + } + } + return MultiResponse.buildSuccess(); + } } diff --git a/web-app/src/main/java/com/zcloud/edu/command/study/ClassAddExe.java b/web-app/src/main/java/com/zcloud/edu/command/study/ClassAddExe.java index 1080cfa..89e218f 100644 --- a/web-app/src/main/java/com/zcloud/edu/command/study/ClassAddExe.java +++ b/web-app/src/main/java/com/zcloud/edu/command/study/ClassAddExe.java @@ -1,11 +1,14 @@ package com.zcloud.edu.command.study; +import com.alibaba.cola.dto.SingleResponse; import com.alibaba.cola.exception.BizException; import com.jjb.saas.framework.auth.model.SSOUser; import com.jjb.saas.framework.auth.utils.AuthContext; import com.zcloud.edu.domain.gateway.study.ClassGateway; import com.zcloud.edu.domain.model.study.ClassE; +import com.zcloud.edu.dto.clientobject.study.ClassCO; import com.zcloud.edu.dto.study.ClassAddCmd; +import com.zcloud.edu.persistence.dataobject.study.ClassDO; import lombok.AllArgsConstructor; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Component; @@ -24,22 +27,21 @@ public class ClassAddExe { private final ClassGateway classGateway; @Transactional(rollbackFor = Exception.class) - public boolean execute(ClassAddCmd cmd) { + public SingleResponse execute(ClassAddCmd cmd) { ClassE classE = new ClassE(); BeanUtils.copyProperties(cmd, classE); SSOUser ssoUser = AuthContext.getCurrentUser(); classE.initSave(ssoUser.getTenantId()); - boolean res = false; try { - res = classGateway.add(classE); + Long id = classGateway.add(classE); + classE.setId(id); } catch (Exception e) { throw new RuntimeException(e); } - if (!res) { - throw new BizException("保存失败"); - } - return true; + ClassCO classCO = new ClassCO(); + BeanUtils.copyProperties(classE, classCO); + return SingleResponse.of(classCO); } } diff --git a/web-app/src/main/java/com/zcloud/edu/command/study/ClassCurriculumAddExe.java b/web-app/src/main/java/com/zcloud/edu/command/study/ClassCurriculumAddExe.java index d94eec5..8d31ace 100644 --- a/web-app/src/main/java/com/zcloud/edu/command/study/ClassCurriculumAddExe.java +++ b/web-app/src/main/java/com/zcloud/edu/command/study/ClassCurriculumAddExe.java @@ -40,28 +40,28 @@ public class ClassCurriculumAddExe { BeanUtils.copyProperties(curCmd, curriculum); BigDecimal decimal = BigDecimal.valueOf(curCmd.getVideoTotalTime()); curriculum.setVideoTotalTime(decimal); - for (ClassCurriculumChapterAddCmd chapterCmd : curCmd.getChapterList()){ + for (ClassCurriculumChapterAddCmd chapterCmd : curCmd.getCurriculumChapterAddCmdList()){ ClassCurriculumChapterE chapter = new ClassCurriculumChapterE(); BeanUtils.copyProperties(chapterCmd, chapter); - if (chapterCmd.getChildren() != null && chapterCmd.getChildren().size() > 0){ - for (ClassCurriculumChapterAddCmd childChapterCmd : chapterCmd.getChildren()){ + if (chapterCmd.getCurriculumChapterAddCmdList() != null && chapterCmd.getCurriculumChapterAddCmdList().size() > 0){ + for (ClassCurriculumChapterAddCmd childChapterCmd : chapterCmd.getCurriculumChapterAddCmdList()){ ClassCurriculumChapterE childChapter = new ClassCurriculumChapterE(); BeanUtils.copyProperties(childChapterCmd, childChapter); - if (chapter.getChildren() != null){ - chapter.getChildren().add(childChapter); + if (chapter.getCurriculumChapterAddCmdList() != null){ + chapter.getCurriculumChapterAddCmdList().add(childChapter); } else { List children = new ArrayList<>(); children.add(childChapter); - chapter.setChildren(children); + chapter.setCurriculumChapterAddCmdList(children); } } } - if (curriculum.getChapterList() != null){ - curriculum.getChapterList().add(chapter); + if (curriculum.getCurriculumChapterAddCmdList() != null){ + curriculum.getCurriculumChapterAddCmdList().add(chapter); } else { List chapterList = new ArrayList<>(); chapterList.add(chapter); - curriculum.setChapterList(chapterList); + curriculum.setCurriculumChapterAddCmdList(chapterList); } } classCurriculumEList.add(curriculum); diff --git a/web-app/src/main/java/com/zcloud/edu/command/study/StudentSignAddExe.java b/web-app/src/main/java/com/zcloud/edu/command/study/StudentSignAddExe.java index 281c1f5..9fa9840 100644 --- a/web-app/src/main/java/com/zcloud/edu/command/study/StudentSignAddExe.java +++ b/web-app/src/main/java/com/zcloud/edu/command/study/StudentSignAddExe.java @@ -4,10 +4,15 @@ import com.alibaba.cola.exception.BizException; import com.zcloud.edu.domain.gateway.study.StudentSignGateway; import com.zcloud.edu.domain.model.study.StudentSignE; import com.zcloud.edu.dto.study.StudentSignAddCmd; +import com.zcloud.edu.persistence.dataobject.study.StudentDO; +import com.zcloud.edu.persistence.repository.study.StudentRepository; +import com.zcloud.gbscommon.zcloudimgfiles.facade.ZcloudImgFilesFacade; import lombok.AllArgsConstructor; +import org.apache.dubbo.config.annotation.DubboReference; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.ObjectUtils; /** @@ -20,11 +25,28 @@ import org.springframework.transaction.annotation.Transactional; @AllArgsConstructor public class StudentSignAddExe { private final StudentSignGateway studentSignGateway; + private final StudentRepository studentRepository; + @DubboReference + private ZcloudImgFilesFacade zcloudImgFilesFacade; @Transactional(rollbackFor = Exception.class) public boolean execute(StudentSignAddCmd cmd) { + StudentSignE studentSignE = new StudentSignE(); BeanUtils.copyProperties(cmd, studentSignE); + StudentDO student = studentRepository.findFaceUrlByPhone(studentSignE.getPhone()); + + if (student == null || ObjectUtils.isEmpty(student.getUserAvatarUrl())) { + throw new RuntimeException("您还没有录入人脸"); + } + try { + studentSignE.compareFace(student.getUserAvatarUrl()); + } catch (Exception e) { + throw new RuntimeException(e); + } + + String path = studentSignE.getType() == 1 ? "clockSign" : "examSign"; + studentSignE.setFaceUrl(zcloudImgFilesFacade.saveFile(studentSignE.getFiles()[0], path)); boolean res = false; try { res = studentSignGateway.add(studentSignE); diff --git a/web-app/src/main/java/com/zcloud/edu/service/study/ClassExamPaperServiceImpl.java b/web-app/src/main/java/com/zcloud/edu/service/study/ClassExamPaperServiceImpl.java index 85cc6b3..0e96dec 100644 --- a/web-app/src/main/java/com/zcloud/edu/service/study/ClassExamPaperServiceImpl.java +++ b/web-app/src/main/java/com/zcloud/edu/service/study/ClassExamPaperServiceImpl.java @@ -67,5 +67,10 @@ public class ClassExamPaperServiceImpl implements ClassExamPaperServiceI { public SingleResponse getInfoById(Long id) { return classExamPaperQueryExe.executeGetInfoById(id); } + + @Override + public SingleResponse getInfoByClassId(String classId) { + return classExamPaperQueryExe.executeGetInfoByClassId(classId); + } } diff --git a/web-app/src/main/java/com/zcloud/edu/service/study/ClassServiceImpl.java b/web-app/src/main/java/com/zcloud/edu/service/study/ClassServiceImpl.java index 26ac283..eac4ad1 100644 --- a/web-app/src/main/java/com/zcloud/edu/service/study/ClassServiceImpl.java +++ b/web-app/src/main/java/com/zcloud/edu/service/study/ClassServiceImpl.java @@ -38,10 +38,10 @@ public class ClassServiceImpl implements ClassServiceI { } @Override - public SingleResponse add(ClassAddCmd cmd) { + public SingleResponse add(ClassAddCmd cmd) { - classAddExe.execute(cmd); - return SingleResponse.buildSuccess(); + + return classAddExe.execute(cmd); } @Override diff --git a/web-app/src/main/java/com/zcloud/edu/service/study/StudentSignServiceImpl.java b/web-app/src/main/java/com/zcloud/edu/service/study/StudentSignServiceImpl.java index 93cd311..518e30c 100644 --- a/web-app/src/main/java/com/zcloud/edu/service/study/StudentSignServiceImpl.java +++ b/web-app/src/main/java/com/zcloud/edu/service/study/StudentSignServiceImpl.java @@ -1,6 +1,8 @@ package com.zcloud.edu.service.study; +import com.alibaba.cola.dto.MultiResponse; import com.alibaba.cola.dto.PageResponse; +import com.alibaba.cola.dto.Response; import com.alibaba.cola.dto.SingleResponse; import com.zcloud.edu.api.study.StudentSignServiceI; import com.zcloud.edu.command.query.study.StudentSignQueryExe; @@ -8,9 +10,7 @@ import com.zcloud.edu.command.study.StudentSignAddExe; import com.zcloud.edu.command.study.StudentSignRemoveExe; import com.zcloud.edu.command.study.StudentSignUpdateExe; import com.zcloud.edu.dto.clientobject.study.StudentSignCO; -import com.zcloud.edu.dto.study.StudentSignAddCmd; -import com.zcloud.edu.dto.study.StudentSignPageQry; -import com.zcloud.edu.dto.study.StudentSignUpdateCmd; +import com.zcloud.edu.dto.study.*; import lombok.AllArgsConstructor; import org.springframework.stereotype.Service; @@ -55,5 +55,15 @@ public class StudentSignServiceImpl implements StudentSignServiceI { public void removeBatch(Long[] ids) { studentSignRemoveExe.execute(ids); } + + @Override + public MultiResponse listAll(ClassAppSignQry qry) { + return studentSignQueryExe.executeListAll(qry); + } + + @Override + public Response verify(StudentSignVerifyQry qry) { + return studentSignQueryExe.executeVerify(qry); + } } diff --git a/web-client/src/main/java/com/zcloud/edu/api/study/ClassExamPaperServiceI.java b/web-client/src/main/java/com/zcloud/edu/api/study/ClassExamPaperServiceI.java index 01a59fb..ec315fd 100644 --- a/web-client/src/main/java/com/zcloud/edu/api/study/ClassExamPaperServiceI.java +++ b/web-client/src/main/java/com/zcloud/edu/api/study/ClassExamPaperServiceI.java @@ -28,5 +28,7 @@ public interface ClassExamPaperServiceI { void removeBatch(Long[] ids); SingleResponse getInfoById(Long id); + + SingleResponse getInfoByClassId(String classId); } diff --git a/web-client/src/main/java/com/zcloud/edu/api/study/StudentSignServiceI.java b/web-client/src/main/java/com/zcloud/edu/api/study/StudentSignServiceI.java index 2f11987..4640f7e 100644 --- a/web-client/src/main/java/com/zcloud/edu/api/study/StudentSignServiceI.java +++ b/web-client/src/main/java/com/zcloud/edu/api/study/StudentSignServiceI.java @@ -1,11 +1,11 @@ package com.zcloud.edu.api.study; +import com.alibaba.cola.dto.MultiResponse; import com.alibaba.cola.dto.PageResponse; +import com.alibaba.cola.dto.Response; import com.alibaba.cola.dto.SingleResponse; import com.zcloud.edu.dto.clientobject.study.StudentSignCO; -import com.zcloud.edu.dto.study.StudentSignAddCmd; -import com.zcloud.edu.dto.study.StudentSignPageQry; -import com.zcloud.edu.dto.study.StudentSignUpdateCmd; +import com.zcloud.edu.dto.study.*; /** * web-client @@ -23,5 +23,9 @@ public interface StudentSignServiceI { void remove(Long id); void removeBatch(Long[] ids); + + MultiResponse listAll(ClassAppSignQry qry); + + Response verify(StudentSignVerifyQry qry); } diff --git a/web-client/src/main/java/com/zcloud/edu/dto/clientobject/study/ClassCurriculumCO.java b/web-client/src/main/java/com/zcloud/edu/dto/clientobject/study/ClassCurriculumCO.java index 480638c..e429af6 100644 --- a/web-client/src/main/java/com/zcloud/edu/dto/clientobject/study/ClassCurriculumCO.java +++ b/web-client/src/main/java/com/zcloud/edu/dto/clientobject/study/ClassCurriculumCO.java @@ -42,7 +42,7 @@ public class ClassCurriculumCO extends ClientObject { private long videoCount; // 章节目录 @ApiModelProperty(value = "章节目录") - private List chapterList; + private List curriculumChapterCOList; @ApiModelProperty(value = "所属单位id") diff --git a/web-client/src/main/java/com/zcloud/edu/dto/clientobject/study/ClassCurriculumChapterCO.java b/web-client/src/main/java/com/zcloud/edu/dto/clientobject/study/ClassCurriculumChapterCO.java index b28fd22..96d1115 100644 --- a/web-client/src/main/java/com/zcloud/edu/dto/clientobject/study/ClassCurriculumChapterCO.java +++ b/web-client/src/main/java/com/zcloud/edu/dto/clientobject/study/ClassCurriculumChapterCO.java @@ -128,7 +128,7 @@ public class ClassCurriculumChapterCO extends ClientObject { // 章节目录 @ApiModelProperty(value = "章节目录") - private List children; + private List childCurriculumChapterCOList; diff --git a/web-client/src/main/java/com/zcloud/edu/dto/clientobject/study/ClassExamPaperCO.java b/web-client/src/main/java/com/zcloud/edu/dto/clientobject/study/ClassExamPaperCO.java index acd2be0..5a1266a 100644 --- a/web-client/src/main/java/com/zcloud/edu/dto/clientobject/study/ClassExamPaperCO.java +++ b/web-client/src/main/java/com/zcloud/edu/dto/clientobject/study/ClassExamPaperCO.java @@ -2,11 +2,13 @@ package com.zcloud.edu.dto.clientobject.study; import com.alibaba.cola.dto.ClientObject; import com.fasterxml.jackson.annotation.JsonFormat; +import com.zcloud.edu.dto.clientobject.resource.QuestionCO; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.math.BigDecimal; import java.time.LocalDateTime; +import java.util.List; /** @@ -44,6 +46,8 @@ public class ClassExamPaperCO extends ClientObject { private Integer examTime; @ApiModelProperty(value = "企业名称") private String corpName; + @ApiModelProperty(value = "习题列表") + private List questionList; //删除标识true false @ApiModelProperty(value = "删除标识true false") private String deleteEnum; diff --git a/web-client/src/main/java/com/zcloud/edu/dto/study/ClassAppSignQry.java b/web-client/src/main/java/com/zcloud/edu/dto/study/ClassAppSignQry.java new file mode 100644 index 0000000..7671c23 --- /dev/null +++ b/web-client/src/main/java/com/zcloud/edu/dto/study/ClassAppSignQry.java @@ -0,0 +1,30 @@ +package com.zcloud.edu.dto.study; + +import com.alibaba.cola.dto.PageQuery; +import lombok.Data; + + +/** + * web-client + * + * @Author zhangyue + * @Date 2026-01-13 14:18:12 + */ +@Data +public class ClassAppSignQry { + + /** + * 查询条件操作前缀,支持以下几种数据库查询操作: + * - `like`: 模糊匹配查询,对应SQL的LIKE操作符 + * - `eq`: 等值查询,对应SQL的=操作符 + * - `gt`: 大于比较查询 + * - `lt`: 小于比较查询 + * - `ge`: 大于等于比较查询 + * - `le`: 小于等于比较查询 + * - `ne`: 不等比较查询,对应SQL的!=操作符 + */ + private String classId; + private String phone; + +} + diff --git a/web-client/src/main/java/com/zcloud/edu/dto/study/ClassCurriculumAddCmd.java b/web-client/src/main/java/com/zcloud/edu/dto/study/ClassCurriculumAddCmd.java index 0f56247..dd98d31 100644 --- a/web-client/src/main/java/com/zcloud/edu/dto/study/ClassCurriculumAddCmd.java +++ b/web-client/src/main/java/com/zcloud/edu/dto/study/ClassCurriculumAddCmd.java @@ -46,7 +46,7 @@ public class ClassCurriculumAddCmd extends Command { @ApiModelProperty(value = "课程目录", name = "curriculumChapterAddCmdList", required = true) @NotNull(message = "课程目录") - private List chapterList; + private List curriculumChapterAddCmdList; } diff --git a/web-client/src/main/java/com/zcloud/edu/dto/study/ClassCurriculumChapterAddCmd.java b/web-client/src/main/java/com/zcloud/edu/dto/study/ClassCurriculumChapterAddCmd.java index 326d33f..e8e71fc 100644 --- a/web-client/src/main/java/com/zcloud/edu/dto/study/ClassCurriculumChapterAddCmd.java +++ b/web-client/src/main/java/com/zcloud/edu/dto/study/ClassCurriculumChapterAddCmd.java @@ -52,7 +52,7 @@ public class ClassCurriculumChapterAddCmd extends Command { @ApiModelProperty(value = "目录课件", name = "curriculumChapterAddCmdList", required = true) @NotEmpty(message = "目录课件不能为空") - private List children; + private List curriculumChapterAddCmdList; } diff --git a/web-client/src/main/java/com/zcloud/edu/dto/study/StudentAddCmd.java b/web-client/src/main/java/com/zcloud/edu/dto/study/StudentAddCmd.java index b7898c2..e43e43a 100644 --- a/web-client/src/main/java/com/zcloud/edu/dto/study/StudentAddCmd.java +++ b/web-client/src/main/java/com/zcloud/edu/dto/study/StudentAddCmd.java @@ -26,7 +26,7 @@ public class StudentAddCmd extends Command { @ApiModelProperty(value = "学员userid", name = "userId", required = true) @NotNull(message = "学员userid不能为空") - private Integer userId; + private Long userId; @ApiModelProperty(value = "班级id", name = "classId", required = true) @NotEmpty(message = "班级id不能为空") diff --git a/web-client/src/main/java/com/zcloud/edu/dto/study/StudentSignAddCmd.java b/web-client/src/main/java/com/zcloud/edu/dto/study/StudentSignAddCmd.java index efc4098..fd9b54a 100644 --- a/web-client/src/main/java/com/zcloud/edu/dto/study/StudentSignAddCmd.java +++ b/web-client/src/main/java/com/zcloud/edu/dto/study/StudentSignAddCmd.java @@ -6,6 +6,7 @@ import lombok.AllArgsConstructor; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; +import org.springframework.web.multipart.MultipartFile; import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotNull; @@ -21,33 +22,25 @@ import javax.validation.constraints.NotNull; @NoArgsConstructor @AllArgsConstructor public class StudentSignAddCmd extends Command { - @ApiModelProperty(value = "学员id", name = "studentId", required = true) - @NotEmpty(message = "学员id不能为空") - private String studentId; - - @ApiModelProperty(value = "业务id", name = "studentSignId", required = true) - @NotEmpty(message = "业务id不能为空") - private String studentSignId; @ApiModelProperty(value = "班级id", name = "classId", required = true) @NotEmpty(message = "班级id不能为空") private String classId; - @ApiModelProperty(value = "用户id", name = "userId", required = true) - @NotNull(message = "用户id不能为空") - private Long userId; - @ApiModelProperty(value = "企业id", name = "corpinfoId", required = true) - @NotNull(message = "企业id不能为空") - private Long corpinfoId; - @ApiModelProperty(value = "签到人脸路径", name = "faceUrl", required = true) - @NotEmpty(message = "签到人脸路径不能为空") - private String faceUrl; @ApiModelProperty(value = "签到类型 1-打卡签到 2-人脸签到", name = "type", required = true) @NotNull(message = "签到类型 1-打卡签到 2-人脸签到不能为空") private Integer type; + @ApiModelProperty(value = "手机号", name = "phone", required = true) + @NotEmpty(message = "手机号不能为空") + private String phone; + + + @ApiModelProperty(value = "人脸照片", name = "files") + @NotEmpty(message = "请上传人脸照片") + private MultipartFile[] files; } diff --git a/web-client/src/main/java/com/zcloud/edu/dto/study/StudentSignVerifyQry.java b/web-client/src/main/java/com/zcloud/edu/dto/study/StudentSignVerifyQry.java new file mode 100644 index 0000000..e30bba4 --- /dev/null +++ b/web-client/src/main/java/com/zcloud/edu/dto/study/StudentSignVerifyQry.java @@ -0,0 +1,27 @@ +package com.zcloud.edu.dto.study; + +import com.alibaba.cola.dto.PageQuery; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; + + +/** + * web-client + * + * @Author zhangyue + * @Date 2026-01-13 14:18:20 + */ +@Data +public class StudentSignVerifyQry{ + + private String classId; + private String phone; + private Integer type; +} + diff --git a/web-domain/src/main/java/com/zcloud/edu/domain/gateway/study/ClassGateway.java b/web-domain/src/main/java/com/zcloud/edu/domain/gateway/study/ClassGateway.java index c88edda..ee6e32e 100644 --- a/web-domain/src/main/java/com/zcloud/edu/domain/gateway/study/ClassGateway.java +++ b/web-domain/src/main/java/com/zcloud/edu/domain/gateway/study/ClassGateway.java @@ -14,7 +14,7 @@ public interface ClassGateway { /** * 新增 */ - Boolean add(ClassE classE); + Long add(ClassE classE); /** * 修改 diff --git a/web-domain/src/main/java/com/zcloud/edu/domain/model/study/ClassCurriculumChapterE.java b/web-domain/src/main/java/com/zcloud/edu/domain/model/study/ClassCurriculumChapterE.java index fc30d66..82cd9c5 100644 --- a/web-domain/src/main/java/com/zcloud/edu/domain/model/study/ClassCurriculumChapterE.java +++ b/web-domain/src/main/java/com/zcloud/edu/domain/model/study/ClassCurriculumChapterE.java @@ -33,7 +33,7 @@ public class ClassCurriculumChapterE extends BaseE { //上级ID private String parentId; //子集 - private List children; + private List curriculumChapterAddCmdList; //删除标识true false private String deleteEnum; //备注 diff --git a/web-domain/src/main/java/com/zcloud/edu/domain/model/study/ClassCurriculumE.java b/web-domain/src/main/java/com/zcloud/edu/domain/model/study/ClassCurriculumE.java index 3be4cc0..fa91b18 100644 --- a/web-domain/src/main/java/com/zcloud/edu/domain/model/study/ClassCurriculumE.java +++ b/web-domain/src/main/java/com/zcloud/edu/domain/model/study/ClassCurriculumE.java @@ -38,7 +38,7 @@ public class ClassCurriculumE extends BaseE { //更新人姓名 private String updateName; - private List chapterList; + private List curriculumChapterAddCmdList; //租户id @@ -62,22 +62,22 @@ public class ClassCurriculumE extends BaseE { List classCurriculumChapterEList = new ArrayList(); for (ClassCurriculumE cur : curList){ cur.setClassCurriculumId(Tools.get32UUID()); - for (ClassCurriculumChapterE chapter : cur.getChapterList()){ + for (ClassCurriculumChapterE chapter : cur.getCurriculumChapterAddCmdList()){ chapter.setCurriculumChapterId(Tools.get32UUID()); chapter.setClassId(cur.getClassId()); chapter.setClassCurriculumId(cur.getClassCurriculumId()); chapter.setParentId("0"); - if (chapter.getChildren() != null && chapter.getChildren().size() > 0){ - for (ClassCurriculumChapterE childChapter : chapter.getChildren()){ + if (chapter.getCurriculumChapterAddCmdList() != null && chapter.getCurriculumChapterAddCmdList().size() > 0){ + for (ClassCurriculumChapterE childChapter : chapter.getCurriculumChapterAddCmdList()){ childChapter.setCurriculumChapterId(Tools.get32UUID()); childChapter.setClassId(cur.getClassId()); childChapter.setClassCurriculumId(cur.getClassCurriculumId()); childChapter.setParentId(chapter.getCurriculumChapterId()); } - classCurriculumChapterEList.addAll(chapter.getChildren()); + classCurriculumChapterEList.addAll(chapter.getCurriculumChapterAddCmdList()); } } - classCurriculumChapterEList.addAll(cur.getChapterList()); + classCurriculumChapterEList.addAll(cur.getCurriculumChapterAddCmdList()); } return classCurriculumChapterEList; } diff --git a/web-domain/src/main/java/com/zcloud/edu/domain/model/study/ClassE.java b/web-domain/src/main/java/com/zcloud/edu/domain/model/study/ClassE.java index e647752..a0dda6b 100644 --- a/web-domain/src/main/java/com/zcloud/edu/domain/model/study/ClassE.java +++ b/web-domain/src/main/java/com/zcloud/edu/domain/model/study/ClassE.java @@ -99,5 +99,16 @@ public class ClassE extends BaseE { } } + /** + * 判断班级是否开班 + */ + public void isBegin(){ + if(DateUtil.isBeforeThan(this.startTime)){ + throw new RuntimeException("班级未开班"); + } else if(DateUtil.isBeforeThan(this.endTime)){ + throw new RuntimeException("班级已结束"); + } + } + } diff --git a/web-domain/src/main/java/com/zcloud/edu/domain/model/study/StudentSignE.java b/web-domain/src/main/java/com/zcloud/edu/domain/model/study/StudentSignE.java index ecc364a..48bd6d4 100644 --- a/web-domain/src/main/java/com/zcloud/edu/domain/model/study/StudentSignE.java +++ b/web-domain/src/main/java/com/zcloud/edu/domain/model/study/StudentSignE.java @@ -1,9 +1,22 @@ package com.zcloud.edu.domain.model.study; +import com.alibaba.cola.exception.BizException; import com.jjb.saas.framework.domain.model.BaseE; +import com.zcloud.gbscommon.utils.Base64Util; +import com.zcloud.gbscommon.utils.FaceUtil; +import com.zcloud.gbscommon.utils.Tools; +import com.zcloud.gbscommon.zcloudimgfiles.facade.ZcloudImgFilesFacade; import lombok.Data; +import org.apache.dubbo.config.annotation.DubboReference; +import org.apache.tomcat.util.http.fileupload.ByteArrayOutputStream; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.web.multipart.MultipartFile; +import java.io.File; +import java.io.InputStream; +import java.net.URL; import java.time.LocalDateTime; +import java.util.Base64; /** * web-domain @@ -28,6 +41,9 @@ public class StudentSignE extends BaseE { private String faceUrl; //签到类型 1-打卡签到 2-人脸签到 private Integer type; + + private String phone; + private MultipartFile[] files; //环境 private String env; //删除标识true false @@ -52,5 +68,21 @@ public class StudentSignE extends BaseE { private Long createId; //修改人id private Long updateId; + private String prefixUrl = "https://jpfz.qhdsafety.com/gbsFileTest/"; + + @DubboReference + private ZcloudImgFilesFacade zcloudImgFilesFacade; + + public void compareFace(String templateFaceUrl) throws Exception { + String faceUrl = Base64Util.getBase64String(files[0]); + String templateFace = Base64Util.urlToBase64(prefixUrl + templateFaceUrl); + String confidence = FaceUtil.compareFace(templateFace, faceUrl); + + if (Double.valueOf(confidence) < 75) { + throw new BizException("人脸不匹配"); + } + this.setStudentSignId(Tools.get32UUID()); + } + } diff --git a/web-infrastructure/src/main/java/com/zcloud/edu/gatewayimpl/study/ClassGatewayImpl.java b/web-infrastructure/src/main/java/com/zcloud/edu/gatewayimpl/study/ClassGatewayImpl.java index 2ba948c..c9588c9 100644 --- a/web-infrastructure/src/main/java/com/zcloud/edu/gatewayimpl/study/ClassGatewayImpl.java +++ b/web-infrastructure/src/main/java/com/zcloud/edu/gatewayimpl/study/ClassGatewayImpl.java @@ -22,11 +22,11 @@ public class ClassGatewayImpl implements ClassGateway { private final ClassRepository classRepository; @Override - public Boolean add(ClassE classE) { + public Long add(ClassE classE) { ClassDO d = new ClassDO(); BeanUtils.copyProperties(classE, d); classRepository.save(d); - return true; + return d.getId(); } @Override diff --git a/web-infrastructure/src/main/java/com/zcloud/edu/persistence/dataobject/study/ClassDO.java b/web-infrastructure/src/main/java/com/zcloud/edu/persistence/dataobject/study/ClassDO.java index 85395af..9398a9c 100644 --- a/web-infrastructure/src/main/java/com/zcloud/edu/persistence/dataobject/study/ClassDO.java +++ b/web-infrastructure/src/main/java/com/zcloud/edu/persistence/dataobject/study/ClassDO.java @@ -67,13 +67,13 @@ public class ClassDO extends BaseDO { private Integer numberofexams; @ApiModelProperty(value = "班级学员总数") @TableField(exist = false) - private Integer totalCount; + private Integer totalCount = 0; @ApiModelProperty(value = "班级签到人数") @TableField(exist = false) - private Integer signCount; + private Integer signCount = 0; @ApiModelProperty(value = "考试通过人数") @TableField(exist = false) - private Integer finishCount; + private Integer finishCount = 0; } diff --git a/web-infrastructure/src/main/java/com/zcloud/edu/persistence/dataobject/study/StudentDO.java b/web-infrastructure/src/main/java/com/zcloud/edu/persistence/dataobject/study/StudentDO.java index d358451..3b2eb63 100644 --- a/web-infrastructure/src/main/java/com/zcloud/edu/persistence/dataobject/study/StudentDO.java +++ b/web-infrastructure/src/main/java/com/zcloud/edu/persistence/dataobject/study/StudentDO.java @@ -97,6 +97,5 @@ public class StudentDO extends BaseDO { @ApiModelProperty(value = "项目名称集合") private String projectNames; - } diff --git a/web-infrastructure/src/main/java/com/zcloud/edu/persistence/dataobject/study/StudentSignDO.java b/web-infrastructure/src/main/java/com/zcloud/edu/persistence/dataobject/study/StudentSignDO.java index 17b955c..d8dd998 100644 --- a/web-infrastructure/src/main/java/com/zcloud/edu/persistence/dataobject/study/StudentSignDO.java +++ b/web-infrastructure/src/main/java/com/zcloud/edu/persistence/dataobject/study/StudentSignDO.java @@ -1,11 +1,15 @@ package com.zcloud.edu.persistence.dataobject.study; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.jjb.saas.framework.repository.basedo.BaseDO; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; +import org.springframework.web.multipart.MultipartFile; + +import java.time.LocalDateTime; /** * web-infrastructure @@ -21,25 +25,44 @@ public class StudentSignDO extends BaseDO { //学员id @ApiModelProperty(value = "学员id") private String studentId; + //业务id @ApiModelProperty(value = "业务id") private String studentSignId; + //班级id @ApiModelProperty(value = "班级id") private String classId; + //用户id @ApiModelProperty(value = "用户id") private Long userId; + //企业id @ApiModelProperty(value = "企业id") private Long corpinfoId; + //签到人脸路径 @ApiModelProperty(value = "签到人脸路径") private String faceUrl; + //签到类型 1-打卡签到 2-人脸签到 @ApiModelProperty(value = "签到类型 1-打卡签到 2-人脸签到") private Integer type; + @ApiModelProperty(value = "签到时间") + private LocalDateTime createTime; + @ApiModelProperty(value = "学员名称") + @TableField(exist = false) + private String studentName; + + @ApiModelProperty(value = "班级名称") + @TableField(exist = false) + private String className; + + @ApiModelProperty(value = "培训地点") + @TableField(exist = false) + private String trainingLocation; } diff --git a/web-infrastructure/src/main/java/com/zcloud/edu/persistence/mapper/QuestionMapper.java b/web-infrastructure/src/main/java/com/zcloud/edu/persistence/mapper/QuestionMapper.java index 273f44e..46c0cd4 100644 --- a/web-infrastructure/src/main/java/com/zcloud/edu/persistence/mapper/QuestionMapper.java +++ b/web-infrastructure/src/main/java/com/zcloud/edu/persistence/mapper/QuestionMapper.java @@ -15,5 +15,7 @@ import java.util.List; @Mapper public interface QuestionMapper extends BaseMapper { List listByClassId(String classId); + + List listByExamPaperId(String examPaperId); } diff --git a/web-infrastructure/src/main/java/com/zcloud/edu/persistence/mapper/study/ClassCurriculumChapterMapper.java b/web-infrastructure/src/main/java/com/zcloud/edu/persistence/mapper/study/ClassCurriculumChapterMapper.java index 3db9e2c..f96cd5f 100644 --- a/web-infrastructure/src/main/java/com/zcloud/edu/persistence/mapper/study/ClassCurriculumChapterMapper.java +++ b/web-infrastructure/src/main/java/com/zcloud/edu/persistence/mapper/study/ClassCurriculumChapterMapper.java @@ -14,7 +14,7 @@ import java.util.List; */ @Mapper public interface ClassCurriculumChapterMapper extends BaseMapper { - List listByCurriculumId(String classCurriculumId); + List listByClassCurriculumId(String classCurriculumId); } diff --git a/web-infrastructure/src/main/java/com/zcloud/edu/persistence/mapper/study/StudentMapper.java b/web-infrastructure/src/main/java/com/zcloud/edu/persistence/mapper/study/StudentMapper.java index 86abf92..8b26a2a 100644 --- a/web-infrastructure/src/main/java/com/zcloud/edu/persistence/mapper/study/StudentMapper.java +++ b/web-infrastructure/src/main/java/com/zcloud/edu/persistence/mapper/study/StudentMapper.java @@ -5,6 +5,7 @@ import com.zcloud.edu.persistence.dataobject.study.ClassDO; import com.zcloud.edu.persistence.dataobject.study.StudentDO; import com.zcloud.edu.persistence.mapper.po.study.StudentCountPO; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; import java.util.List; import java.util.Map; @@ -21,5 +22,8 @@ public interface StudentMapper extends BaseMapper { List countStudentByClass(List classIds); + StudentDO findByClassIdAndPhone(@Param("classId") String classId, @Param("phone") String phone); + StudentDO findFaceUrlByPhone(@Param("phone") String phone); + } diff --git a/web-infrastructure/src/main/java/com/zcloud/edu/persistence/mapper/study/StudentSignMapper.java b/web-infrastructure/src/main/java/com/zcloud/edu/persistence/mapper/study/StudentSignMapper.java index 511ebfd..3f3e78e 100644 --- a/web-infrastructure/src/main/java/com/zcloud/edu/persistence/mapper/study/StudentSignMapper.java +++ b/web-infrastructure/src/main/java/com/zcloud/edu/persistence/mapper/study/StudentSignMapper.java @@ -3,6 +3,10 @@ package com.zcloud.edu.persistence.mapper.study; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.zcloud.edu.persistence.dataobject.study.StudentSignDO; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; /** * web-infrastructure @@ -12,6 +16,6 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface StudentSignMapper extends BaseMapper { - + List listAll(@Param("params") Map params); } diff --git a/web-infrastructure/src/main/java/com/zcloud/edu/persistence/repository/impl/resource/QuestionRepositoryImpl.java b/web-infrastructure/src/main/java/com/zcloud/edu/persistence/repository/impl/resource/QuestionRepositoryImpl.java index 2d24d70..5522abc 100644 --- a/web-infrastructure/src/main/java/com/zcloud/edu/persistence/repository/impl/resource/QuestionRepositoryImpl.java +++ b/web-infrastructure/src/main/java/com/zcloud/edu/persistence/repository/impl/resource/QuestionRepositoryImpl.java @@ -1,5 +1,6 @@ package com.zcloud.edu.persistence.repository.impl.resource; +import com.alibaba.cola.dto.MultiResponse; import com.jjb.saas.framework.repository.common.PageHelper; import com.zcloud.edu.domain.enums.CoursewareTypeEnum; import com.zcloud.edu.persistence.dataobject.QuestionDO; @@ -60,6 +61,11 @@ public class QuestionRepositoryImpl extends BaseRepositoryImpl getInfoByExamPaperId(String examPaperId) { + return questionMapper.listByExamPaperId(examPaperId); + } + @Override public boolean saveBatch(List list) { diff --git a/web-infrastructure/src/main/java/com/zcloud/edu/persistence/repository/impl/study/ClassCurriculumChapterRepositoryImpl.java b/web-infrastructure/src/main/java/com/zcloud/edu/persistence/repository/impl/study/ClassCurriculumChapterRepositoryImpl.java index 88a5223..ede58f7 100644 --- a/web-infrastructure/src/main/java/com/zcloud/edu/persistence/repository/impl/study/ClassCurriculumChapterRepositoryImpl.java +++ b/web-infrastructure/src/main/java/com/zcloud/edu/persistence/repository/impl/study/ClassCurriculumChapterRepositoryImpl.java @@ -40,8 +40,8 @@ public class ClassCurriculumChapterRepositoryImpl extends BaseRepositoryImpl listByCurriculumId(String classCurriculumId) { - return classCurriculumChapterMapper.listByCurriculumId(classCurriculumId); + public List listByClassCurriculumId(String classCurriculumId) { + return classCurriculumChapterMapper.listByClassCurriculumId(classCurriculumId); } @Override diff --git a/web-infrastructure/src/main/java/com/zcloud/edu/persistence/repository/impl/study/ClassExamPaperRepositoryImpl.java b/web-infrastructure/src/main/java/com/zcloud/edu/persistence/repository/impl/study/ClassExamPaperRepositoryImpl.java index 3694b42..bfb109d 100644 --- a/web-infrastructure/src/main/java/com/zcloud/edu/persistence/repository/impl/study/ClassExamPaperRepositoryImpl.java +++ b/web-infrastructure/src/main/java/com/zcloud/edu/persistence/repository/impl/study/ClassExamPaperRepositoryImpl.java @@ -66,5 +66,13 @@ public class ClassExamPaperRepositoryImpl extends BaseRepositoryImpl queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("class_id", classId); + queryWrapper.eq("delete_enum", "FALSE"); + return classExamPaperMapper.selectOne(queryWrapper); + } } diff --git a/web-infrastructure/src/main/java/com/zcloud/edu/persistence/repository/impl/study/StudentExamRecordRepositoryImpl.java b/web-infrastructure/src/main/java/com/zcloud/edu/persistence/repository/impl/study/StudentExamRecordRepositoryImpl.java index 67f993b..a21455d 100644 --- a/web-infrastructure/src/main/java/com/zcloud/edu/persistence/repository/impl/study/StudentExamRecordRepositoryImpl.java +++ b/web-infrastructure/src/main/java/com/zcloud/edu/persistence/repository/impl/study/StudentExamRecordRepositoryImpl.java @@ -14,6 +14,7 @@ import com.zcloud.gbscommon.utils.Query; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; +import java.util.List; import java.util.Map; /** @@ -54,5 +55,13 @@ public class StudentExamRecordRepositoryImpl extends BaseRepositoryImpl listAllByStudentId(String studentId) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("student_id", studentId); + queryWrapper.eq("delete_enum", "FALSE"); + return studentExamRecordMapper.selectList(queryWrapper); + } } diff --git a/web-infrastructure/src/main/java/com/zcloud/edu/persistence/repository/impl/study/StudentRepositoryImpl.java b/web-infrastructure/src/main/java/com/zcloud/edu/persistence/repository/impl/study/StudentRepositoryImpl.java index 70a5f99..e5ca78e 100644 --- a/web-infrastructure/src/main/java/com/zcloud/edu/persistence/repository/impl/study/StudentRepositoryImpl.java +++ b/web-infrastructure/src/main/java/com/zcloud/edu/persistence/repository/impl/study/StudentRepositoryImpl.java @@ -74,5 +74,15 @@ public class StudentRepositoryImpl extends BaseRepositoryImpl listAll(Map params) { + return studentSignMapper.listAll(params); + } + + @Override + public List listAllByStudentId(Map params) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("student_id", params.get("studentId")); + queryWrapper.eq("delete_enum", "FALSE"); + queryWrapper.eq("type", params.get("type")); + return studentSignMapper.selectList(queryWrapper); + } } diff --git a/web-infrastructure/src/main/java/com/zcloud/edu/persistence/repository/resource/QuestionRepository.java b/web-infrastructure/src/main/java/com/zcloud/edu/persistence/repository/resource/QuestionRepository.java index cb0d7f8..546ca21 100644 --- a/web-infrastructure/src/main/java/com/zcloud/edu/persistence/repository/resource/QuestionRepository.java +++ b/web-infrastructure/src/main/java/com/zcloud/edu/persistence/repository/resource/QuestionRepository.java @@ -1,5 +1,6 @@ package com.zcloud.edu.persistence.repository.resource; +import com.alibaba.cola.dto.MultiResponse; import com.zcloud.edu.persistence.dataobject.QuestionDO; import com.alibaba.cola.dto.SingleResponse; import com.alibaba.cola.dto.PageResponse; @@ -24,6 +25,8 @@ public interface QuestionRepository extends BaseRepository { SingleResponse getInfoById(Long id); + List getInfoByExamPaperId(String examPaperId); + boolean saveBatch(List list); Long getCountByVideoCourseware(String videoCoursewareId); diff --git a/web-infrastructure/src/main/java/com/zcloud/edu/persistence/repository/study/ClassCurriculumChapterRepository.java b/web-infrastructure/src/main/java/com/zcloud/edu/persistence/repository/study/ClassCurriculumChapterRepository.java index 6f7036b..4c30088 100644 --- a/web-infrastructure/src/main/java/com/zcloud/edu/persistence/repository/study/ClassCurriculumChapterRepository.java +++ b/web-infrastructure/src/main/java/com/zcloud/edu/persistence/repository/study/ClassCurriculumChapterRepository.java @@ -16,7 +16,7 @@ import java.util.Map; public interface ClassCurriculumChapterRepository extends BaseRepository { PageResponse listPage(Map params); - List listByCurriculumId(String classCurriculumId); + List listByClassCurriculumId(String classCurriculumId); Integer deleteByCurriculumId(String classCurriculumId); diff --git a/web-infrastructure/src/main/java/com/zcloud/edu/persistence/repository/study/ClassExamPaperRepository.java b/web-infrastructure/src/main/java/com/zcloud/edu/persistence/repository/study/ClassExamPaperRepository.java index c129fac..587f6ca 100644 --- a/web-infrastructure/src/main/java/com/zcloud/edu/persistence/repository/study/ClassExamPaperRepository.java +++ b/web-infrastructure/src/main/java/com/zcloud/edu/persistence/repository/study/ClassExamPaperRepository.java @@ -22,5 +22,7 @@ public interface ClassExamPaperRepository extends BaseRepository listAllByStudentId(String studentId); } diff --git a/web-infrastructure/src/main/java/com/zcloud/edu/persistence/repository/study/StudentRepository.java b/web-infrastructure/src/main/java/com/zcloud/edu/persistence/repository/study/StudentRepository.java index 69ad773..98ea3fb 100644 --- a/web-infrastructure/src/main/java/com/zcloud/edu/persistence/repository/study/StudentRepository.java +++ b/web-infrastructure/src/main/java/com/zcloud/edu/persistence/repository/study/StudentRepository.java @@ -27,5 +27,13 @@ public interface StudentRepository extends BaseRepository { List countStudentByClass(List classIds); + StudentDO findByClassIdAndPhone(String classId, String phone); + + StudentDO findFaceUrlByPhone(String phone); + + + + + } diff --git a/web-infrastructure/src/main/java/com/zcloud/edu/persistence/repository/study/StudentSignRepository.java b/web-infrastructure/src/main/java/com/zcloud/edu/persistence/repository/study/StudentSignRepository.java index 1c687dd..c0bc65c 100644 --- a/web-infrastructure/src/main/java/com/zcloud/edu/persistence/repository/study/StudentSignRepository.java +++ b/web-infrastructure/src/main/java/com/zcloud/edu/persistence/repository/study/StudentSignRepository.java @@ -1,9 +1,11 @@ package com.zcloud.edu.persistence.repository.study; +import com.alibaba.cola.dto.MultiResponse; import com.alibaba.cola.dto.PageResponse; import com.jjb.saas.framework.repository.repo.BaseRepository; import com.zcloud.edu.persistence.dataobject.study.StudentSignDO; +import java.util.List; import java.util.Map; /** @@ -16,5 +18,10 @@ public interface StudentSignRepository extends BaseRepository { PageResponse listPage(Map params); Integer deleteByClassId(String classId); + + List listAll(Map params); + + List listAllByStudentId(Map params); + } diff --git a/web-infrastructure/src/main/resources/mapper/QuestionMapper.xml b/web-infrastructure/src/main/resources/mapper/QuestionMapper.xml index cff66e2..622d97c 100644 --- a/web-infrastructure/src/main/resources/mapper/QuestionMapper.xml +++ b/web-infrastructure/src/main/resources/mapper/QuestionMapper.xml @@ -14,5 +14,17 @@ AND q.delete_enum = 'FALSE' and q.courseware_type = 1 + + diff --git a/web-infrastructure/src/main/resources/mapper/study/ClassCurriculumChapterMapper.xml b/web-infrastructure/src/main/resources/mapper/study/ClassCurriculumChapterMapper.xml index 95b39ef..91066d2 100644 --- a/web-infrastructure/src/main/resources/mapper/study/ClassCurriculumChapterMapper.xml +++ b/web-infrastructure/src/main/resources/mapper/study/ClassCurriculumChapterMapper.xml @@ -3,7 +3,7 @@ "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - SELECT c.id, c.curriculum_chapter_id, diff --git a/web-infrastructure/src/main/resources/mapper/study/StudentMapper.xml b/web-infrastructure/src/main/resources/mapper/study/StudentMapper.xml index fc6de82..d2fc350 100644 --- a/web-infrastructure/src/main/resources/mapper/study/StudentMapper.xml +++ b/web-infrastructure/src/main/resources/mapper/study/StudentMapper.xml @@ -20,7 +20,7 @@ SELECT count(*) total_count, count(CASE WHEN sign_flag = 1 THEN 1 END) sign_count, - count(CASE WHEN state = 3 THEN 1 END) finish_count, + count(CASE WHEN state = 1 THEN 1 END) finish_count, class_id FROM student @@ -34,7 +34,41 @@ GROUP BY class_id - - + + diff --git a/web-infrastructure/src/main/resources/mapper/study/StudentSignMapper.xml b/web-infrastructure/src/main/resources/mapper/study/StudentSignMapper.xml index e4b8556..ce6e32b 100644 --- a/web-infrastructure/src/main/resources/mapper/study/StudentSignMapper.xml +++ b/web-infrastructure/src/main/resources/mapper/study/StudentSignMapper.xml @@ -3,6 +3,41 @@ "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> + + + + + + + + + + + + + + + + + + +