添加学生签到验证和人脸识别功能

dev
zhangyue 2026-01-24 10:06:11 +08:00
parent 7d972b76b1
commit c0c7085f0c
52 changed files with 653 additions and 76 deletions

View File

@ -8,10 +8,7 @@ import com.alibaba.cola.dto.SingleResponse;
import com.zcloud.edu.api.study.ClassServiceI; import com.zcloud.edu.api.study.ClassServiceI;
import com.zcloud.edu.dto.clientobject.study.ClassCO; import com.zcloud.edu.dto.clientobject.study.ClassCO;
import com.zcloud.edu.dto.data.study.ClassQuestionDTO; import com.zcloud.edu.dto.data.study.ClassQuestionDTO;
import com.zcloud.edu.dto.study.ClassAddCmd; import com.zcloud.edu.dto.study.*;
import com.zcloud.edu.dto.study.ClassPageQry;
import com.zcloud.edu.dto.study.ClassPostponeCmd;
import com.zcloud.edu.dto.study.ClassUpdateCmd;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
@ -39,5 +36,6 @@ public class AppClassController {
return classService.appListPage(qry); return classService.appListPage(qry);
} }
} }

View File

@ -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<ClassExamPaperCO> add(@Validated @RequestBody ClassExamPaperAddCmd cmd) {
return classExamPaperService.add(cmd);
}
@ApiOperation("自动生成试卷")
@PostMapping("/autoSave")
public SingleResponse<ClassExamPaperCO> autoSave(@Validated @RequestBody ClassExamPaperAutoAddCmd cmd) {
return classExamPaperService.autoSave(cmd);
}
@ApiOperation("分页")
@PostMapping("/list")
public PageResponse<ClassExamPaperCO> page(@RequestBody ClassExamPaperPageQry qry) {
return classExamPaperService.listPage(qry);
}
@ApiOperation("所有数据")
@GetMapping("/listAll")
public MultiResponse<ClassExamPaperCO> listAll() {
return MultiResponse.of(new ArrayList<ClassExamPaperCO>());
}
@ApiOperation("详情")
@GetMapping("/{id}")
public SingleResponse<ClassExamPaperCO> getInfoById(@PathVariable("id") Long id) {
return classExamPaperService.getInfoById(id);
}
@ApiOperation("详情")
@GetMapping("/getInfoByClassId/{classId}")
public SingleResponse<ClassExamPaperCO> 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();
}
}

View File

@ -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<StudentSignCO> 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<StudentSignCO> page(@RequestBody StudentSignPageQry qry) {
return studentSignService.listPage(qry);
}
@ApiOperation("所有数据")
@GetMapping("/listAll")
public MultiResponse<StudentSignCO> listAll(@RequestBody ClassAppSignQry qry) {
return studentSignService.listAll(qry);
}
@ApiOperation("详情")
@GetMapping("/{id}")
public SingleResponse<StudentSignCO> 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();
}
}

View File

@ -57,13 +57,13 @@ public class ClassCurriculumQueryExe {
*/ */
public SingleResponse<ClassCurriculumCO> executeGetInfoById(Long id) { public SingleResponse<ClassCurriculumCO> executeGetInfoById(Long id) {
ClassCurriculumDO classCurriculumDO = classCurriculumRepository.getInfoById(id); ClassCurriculumDO classCurriculumDO = classCurriculumRepository.getInfoById(id);
List<ClassCurriculumChapterDO> classCurriculumChapterDOList = classCurriculumChapterRepository.listByCurriculumId(classCurriculumDO.getClassCurriculumId()); List<ClassCurriculumChapterDO> classCurriculumChapterDOList = classCurriculumChapterRepository.listByClassCurriculumId(classCurriculumDO.getClassCurriculumId());
ClassCurriculumCO classCurriculumCO = new ClassCurriculumCO(); ClassCurriculumCO classCurriculumCO = new ClassCurriculumCO();
BeanUtils.copyProperties(classCurriculumDO, classCurriculumCO); BeanUtils.copyProperties(classCurriculumDO, classCurriculumCO);
List<ClassCurriculumChapterCO> classCurriculumChapterCOList = classCurriculumChapterCoConvertor.converDOsToCOs(classCurriculumChapterDOList); List<ClassCurriculumChapterCO> classCurriculumChapterCOList = classCurriculumChapterCoConvertor.converDOsToCOs(classCurriculumChapterDOList);
long videoCount = classCurriculumChapterCOList.stream().filter(bean -> !ObjectUtils.isEmpty(bean.getVideoCoursewareId())).count(); long videoCount = classCurriculumChapterCOList.stream().filter(bean -> !ObjectUtils.isEmpty(bean.getVideoCoursewareId())).count();
Tools.buildEntityTree(classCurriculumChapterCOList, "curriculumChapterId", "parentId", "children", "0"); Tools.buildEntityTree(classCurriculumChapterCOList, "curriculumChapterId", "parentId", "childCurriculumChapterCOList", "0");
classCurriculumCO.setChapterList(classCurriculumChapterCOList); classCurriculumCO.setCurriculumChapterCOList(classCurriculumChapterCOList);
classCurriculumCO.setVideoCount(videoCount); classCurriculumCO.setVideoCount(videoCount);
return SingleResponse.of(classCurriculumCO); return SingleResponse.of(classCurriculumCO);
} }

View File

@ -1,17 +1,22 @@
package com.zcloud.edu.command.query.study; package com.zcloud.edu.command.query.study;
import cn.hutool.core.bean.BeanUtil;
import com.alibaba.cola.dto.PageResponse; import com.alibaba.cola.dto.PageResponse;
import com.alibaba.cola.dto.SingleResponse; import com.alibaba.cola.dto.SingleResponse;
import com.zcloud.edu.command.convertor.study.ClassExamPaperCoConvertor; 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.clientobject.study.ClassExamPaperCO;
import com.zcloud.edu.dto.study.ClassExamPaperPageQry; 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.dataobject.study.ClassExamPaperDO;
import com.zcloud.edu.persistence.repository.resource.QuestionRepository;
import com.zcloud.edu.persistence.repository.study.ClassExamPaperRepository; import com.zcloud.edu.persistence.repository.study.ClassExamPaperRepository;
import com.zcloud.gbscommon.utils.PageQueryHelper; import com.zcloud.gbscommon.utils.PageQueryHelper;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -27,6 +32,7 @@ import java.util.Map;
public class ClassExamPaperQueryExe { public class ClassExamPaperQueryExe {
private final ClassExamPaperRepository classExamPaperRepository; private final ClassExamPaperRepository classExamPaperRepository;
private final ClassExamPaperCoConvertor classExamPaperCoConvertor; private final ClassExamPaperCoConvertor classExamPaperCoConvertor;
private final QuestionRepository questionRepository;
/** /**
* *
@ -52,5 +58,19 @@ public class ClassExamPaperQueryExe {
BeanUtils.copyProperties(classExamPaperDO, classExamPaperCO); BeanUtils.copyProperties(classExamPaperDO, classExamPaperCO);
return SingleResponse.of(classExamPaperCO); return SingleResponse.of(classExamPaperCO);
} }
/**
*
* @param classId
* @return
*/
public SingleResponse<ClassExamPaperCO> executeGetInfoByClassId(String classId) {
ClassExamPaperDO classExamPaperDO = classExamPaperRepository.findByClassId(classId);
List<QuestionDO> questionDOList = questionRepository.getInfoByExamPaperId(classExamPaperDO.getExamPaperId());
List<QuestionCO> questionCOList = BeanUtil.copyToList(questionDOList, QuestionCO.class);
ClassExamPaperCO classExamPaperCO = new ClassExamPaperCO();
BeanUtils.copyProperties(classExamPaperDO, classExamPaperCO);
classExamPaperCO.setQuestionList(questionCOList);
return SingleResponse.of(classExamPaperCO);
}
} }

View File

@ -1,15 +1,30 @@
package com.zcloud.edu.command.query.study; package com.zcloud.edu.command.query.study;
import com.alibaba.cola.dto.MultiResponse;
import com.alibaba.cola.dto.PageResponse; import com.alibaba.cola.dto.PageResponse;
import com.alibaba.cola.dto.Response;
import com.zcloud.edu.command.convertor.study.StudentSignCoConvertor; 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.clientobject.study.StudentSignCO;
import com.zcloud.edu.dto.study.ClassAppSignQry;
import com.zcloud.edu.dto.study.StudentSignPageQry; 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.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.edu.persistence.repository.study.StudentSignRepository;
import com.zcloud.gbscommon.utils.PageQueryHelper; import com.zcloud.gbscommon.utils.PageQueryHelper;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.security.core.parameters.P;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -25,6 +40,9 @@ import java.util.Map;
public class StudentSignQueryExe { public class StudentSignQueryExe {
private final StudentSignRepository studentSignRepository; private final StudentSignRepository studentSignRepository;
private final StudentSignCoConvertor studentSignCoConvertor; private final StudentSignCoConvertor studentSignCoConvertor;
private final ClassRepository classRepository;
private final StudentRepository studentRepository;
private final StudentExamRecordRepository studentExamRecordRepository;
/** /**
* *
@ -38,5 +56,42 @@ public class StudentSignQueryExe {
List<StudentSignCO> examCenterCOS = studentSignCoConvertor.converDOsToCOs(pageResponse.getData()); List<StudentSignCO> examCenterCOS = studentSignCoConvertor.converDOsToCOs(pageResponse.getData());
return PageResponse.of(examCenterCOS, pageResponse.getTotalCount(), pageResponse.getPageSize(), pageResponse.getPageIndex()); return PageResponse.of(examCenterCOS, pageResponse.getTotalCount(), pageResponse.getPageSize(), pageResponse.getPageIndex());
} }
public MultiResponse<StudentSignCO> executeListAll(ClassAppSignQry qry) {
Map<String, Object> params = PageQueryHelper.toHashMap(qry);
List<StudentSignDO> list = studentSignRepository.listAll(params);
List<StudentSignCO> 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<String, Object> params = new HashMap<>();
params.put("student_id", studentDO.getStudentId());
params.put("type", qry.getType());
if (qry.getType() == 1){
List<StudentSignDO> list = studentSignRepository.listAllByStudentId(params);
if (list != null && list.size() > 0){
throw new RuntimeException("您已签到");
}
} else if (qry.getType() == 2){
List<StudentExamRecordDO> list = studentExamRecordRepository.listAllByStudentId(studentDO.getStudentId());
if (list != null && list.size() == classDO.getNumberofexams()){
throw new RuntimeException("您已经没有考试次数");
}
}
return MultiResponse.buildSuccess();
}
} }

View File

@ -1,11 +1,14 @@
package com.zcloud.edu.command.study; package com.zcloud.edu.command.study;
import com.alibaba.cola.dto.SingleResponse;
import com.alibaba.cola.exception.BizException; import com.alibaba.cola.exception.BizException;
import com.jjb.saas.framework.auth.model.SSOUser; import com.jjb.saas.framework.auth.model.SSOUser;
import com.jjb.saas.framework.auth.utils.AuthContext; import com.jjb.saas.framework.auth.utils.AuthContext;
import com.zcloud.edu.domain.gateway.study.ClassGateway; import com.zcloud.edu.domain.gateway.study.ClassGateway;
import com.zcloud.edu.domain.model.study.ClassE; 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.dto.study.ClassAddCmd;
import com.zcloud.edu.persistence.dataobject.study.ClassDO;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -24,22 +27,21 @@ public class ClassAddExe {
private final ClassGateway classGateway; private final ClassGateway classGateway;
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public boolean execute(ClassAddCmd cmd) { public SingleResponse<ClassCO> execute(ClassAddCmd cmd) {
ClassE classE = new ClassE(); ClassE classE = new ClassE();
BeanUtils.copyProperties(cmd, classE); BeanUtils.copyProperties(cmd, classE);
SSOUser ssoUser = AuthContext.getCurrentUser(); SSOUser ssoUser = AuthContext.getCurrentUser();
classE.initSave(ssoUser.getTenantId()); classE.initSave(ssoUser.getTenantId());
boolean res = false;
try { try {
res = classGateway.add(classE); Long id = classGateway.add(classE);
classE.setId(id);
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
if (!res) { ClassCO classCO = new ClassCO();
throw new BizException("保存失败"); BeanUtils.copyProperties(classE, classCO);
} return SingleResponse.of(classCO);
return true;
} }
} }

View File

@ -40,28 +40,28 @@ public class ClassCurriculumAddExe {
BeanUtils.copyProperties(curCmd, curriculum); BeanUtils.copyProperties(curCmd, curriculum);
BigDecimal decimal = BigDecimal.valueOf(curCmd.getVideoTotalTime()); BigDecimal decimal = BigDecimal.valueOf(curCmd.getVideoTotalTime());
curriculum.setVideoTotalTime(decimal); curriculum.setVideoTotalTime(decimal);
for (ClassCurriculumChapterAddCmd chapterCmd : curCmd.getChapterList()){ for (ClassCurriculumChapterAddCmd chapterCmd : curCmd.getCurriculumChapterAddCmdList()){
ClassCurriculumChapterE chapter = new ClassCurriculumChapterE(); ClassCurriculumChapterE chapter = new ClassCurriculumChapterE();
BeanUtils.copyProperties(chapterCmd, chapter); BeanUtils.copyProperties(chapterCmd, chapter);
if (chapterCmd.getChildren() != null && chapterCmd.getChildren().size() > 0){ if (chapterCmd.getCurriculumChapterAddCmdList() != null && chapterCmd.getCurriculumChapterAddCmdList().size() > 0){
for (ClassCurriculumChapterAddCmd childChapterCmd : chapterCmd.getChildren()){ for (ClassCurriculumChapterAddCmd childChapterCmd : chapterCmd.getCurriculumChapterAddCmdList()){
ClassCurriculumChapterE childChapter = new ClassCurriculumChapterE(); ClassCurriculumChapterE childChapter = new ClassCurriculumChapterE();
BeanUtils.copyProperties(childChapterCmd, childChapter); BeanUtils.copyProperties(childChapterCmd, childChapter);
if (chapter.getChildren() != null){ if (chapter.getCurriculumChapterAddCmdList() != null){
chapter.getChildren().add(childChapter); chapter.getCurriculumChapterAddCmdList().add(childChapter);
} else { } else {
List<ClassCurriculumChapterE> children = new ArrayList<>(); List<ClassCurriculumChapterE> children = new ArrayList<>();
children.add(childChapter); children.add(childChapter);
chapter.setChildren(children); chapter.setCurriculumChapterAddCmdList(children);
} }
} }
} }
if (curriculum.getChapterList() != null){ if (curriculum.getCurriculumChapterAddCmdList() != null){
curriculum.getChapterList().add(chapter); curriculum.getCurriculumChapterAddCmdList().add(chapter);
} else { } else {
List<ClassCurriculumChapterE> chapterList = new ArrayList<>(); List<ClassCurriculumChapterE> chapterList = new ArrayList<>();
chapterList.add(chapter); chapterList.add(chapter);
curriculum.setChapterList(chapterList); curriculum.setCurriculumChapterAddCmdList(chapterList);
} }
} }
classCurriculumEList.add(curriculum); classCurriculumEList.add(curriculum);

View File

@ -4,10 +4,15 @@ import com.alibaba.cola.exception.BizException;
import com.zcloud.edu.domain.gateway.study.StudentSignGateway; import com.zcloud.edu.domain.gateway.study.StudentSignGateway;
import com.zcloud.edu.domain.model.study.StudentSignE; import com.zcloud.edu.domain.model.study.StudentSignE;
import com.zcloud.edu.dto.study.StudentSignAddCmd; 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 lombok.AllArgsConstructor;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;
/** /**
@ -20,11 +25,28 @@ import org.springframework.transaction.annotation.Transactional;
@AllArgsConstructor @AllArgsConstructor
public class StudentSignAddExe { public class StudentSignAddExe {
private final StudentSignGateway studentSignGateway; private final StudentSignGateway studentSignGateway;
private final StudentRepository studentRepository;
@DubboReference
private ZcloudImgFilesFacade zcloudImgFilesFacade;
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public boolean execute(StudentSignAddCmd cmd) { public boolean execute(StudentSignAddCmd cmd) {
StudentSignE studentSignE = new StudentSignE(); StudentSignE studentSignE = new StudentSignE();
BeanUtils.copyProperties(cmd, 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; boolean res = false;
try { try {
res = studentSignGateway.add(studentSignE); res = studentSignGateway.add(studentSignE);

View File

@ -67,5 +67,10 @@ public class ClassExamPaperServiceImpl implements ClassExamPaperServiceI {
public SingleResponse<ClassExamPaperCO> getInfoById(Long id) { public SingleResponse<ClassExamPaperCO> getInfoById(Long id) {
return classExamPaperQueryExe.executeGetInfoById(id); return classExamPaperQueryExe.executeGetInfoById(id);
} }
@Override
public SingleResponse<ClassExamPaperCO> getInfoByClassId(String classId) {
return classExamPaperQueryExe.executeGetInfoByClassId(classId);
}
} }

View File

@ -38,10 +38,10 @@ public class ClassServiceImpl implements ClassServiceI {
} }
@Override @Override
public SingleResponse add(ClassAddCmd cmd) { public SingleResponse<ClassCO> add(ClassAddCmd cmd) {
classAddExe.execute(cmd);
return SingleResponse.buildSuccess(); return classAddExe.execute(cmd);
} }
@Override @Override

View File

@ -1,6 +1,8 @@
package com.zcloud.edu.service.study; package com.zcloud.edu.service.study;
import com.alibaba.cola.dto.MultiResponse;
import com.alibaba.cola.dto.PageResponse; import com.alibaba.cola.dto.PageResponse;
import com.alibaba.cola.dto.Response;
import com.alibaba.cola.dto.SingleResponse; import com.alibaba.cola.dto.SingleResponse;
import com.zcloud.edu.api.study.StudentSignServiceI; import com.zcloud.edu.api.study.StudentSignServiceI;
import com.zcloud.edu.command.query.study.StudentSignQueryExe; 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.StudentSignRemoveExe;
import com.zcloud.edu.command.study.StudentSignUpdateExe; import com.zcloud.edu.command.study.StudentSignUpdateExe;
import com.zcloud.edu.dto.clientobject.study.StudentSignCO; import com.zcloud.edu.dto.clientobject.study.StudentSignCO;
import com.zcloud.edu.dto.study.StudentSignAddCmd; import com.zcloud.edu.dto.study.*;
import com.zcloud.edu.dto.study.StudentSignPageQry;
import com.zcloud.edu.dto.study.StudentSignUpdateCmd;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -55,5 +55,15 @@ public class StudentSignServiceImpl implements StudentSignServiceI {
public void removeBatch(Long[] ids) { public void removeBatch(Long[] ids) {
studentSignRemoveExe.execute(ids); studentSignRemoveExe.execute(ids);
} }
@Override
public MultiResponse<StudentSignCO> listAll(ClassAppSignQry qry) {
return studentSignQueryExe.executeListAll(qry);
}
@Override
public Response verify(StudentSignVerifyQry qry) {
return studentSignQueryExe.executeVerify(qry);
}
} }

View File

@ -28,5 +28,7 @@ public interface ClassExamPaperServiceI {
void removeBatch(Long[] ids); void removeBatch(Long[] ids);
SingleResponse<ClassExamPaperCO> getInfoById(Long id); SingleResponse<ClassExamPaperCO> getInfoById(Long id);
SingleResponse<ClassExamPaperCO> getInfoByClassId(String classId);
} }

View File

@ -1,11 +1,11 @@
package com.zcloud.edu.api.study; package com.zcloud.edu.api.study;
import com.alibaba.cola.dto.MultiResponse;
import com.alibaba.cola.dto.PageResponse; import com.alibaba.cola.dto.PageResponse;
import com.alibaba.cola.dto.Response;
import com.alibaba.cola.dto.SingleResponse; import com.alibaba.cola.dto.SingleResponse;
import com.zcloud.edu.dto.clientobject.study.StudentSignCO; import com.zcloud.edu.dto.clientobject.study.StudentSignCO;
import com.zcloud.edu.dto.study.StudentSignAddCmd; import com.zcloud.edu.dto.study.*;
import com.zcloud.edu.dto.study.StudentSignPageQry;
import com.zcloud.edu.dto.study.StudentSignUpdateCmd;
/** /**
* web-client * web-client
@ -23,5 +23,9 @@ public interface StudentSignServiceI {
void remove(Long id); void remove(Long id);
void removeBatch(Long[] ids); void removeBatch(Long[] ids);
MultiResponse<StudentSignCO> listAll(ClassAppSignQry qry);
Response verify(StudentSignVerifyQry qry);
} }

View File

@ -42,7 +42,7 @@ public class ClassCurriculumCO extends ClientObject {
private long videoCount; private long videoCount;
// 章节目录 // 章节目录
@ApiModelProperty(value = "章节目录") @ApiModelProperty(value = "章节目录")
private List<ClassCurriculumChapterCO> chapterList; private List<ClassCurriculumChapterCO> curriculumChapterCOList;
@ApiModelProperty(value = "所属单位id") @ApiModelProperty(value = "所属单位id")

View File

@ -128,7 +128,7 @@ public class ClassCurriculumChapterCO extends ClientObject {
// 章节目录 // 章节目录
@ApiModelProperty(value = "章节目录") @ApiModelProperty(value = "章节目录")
private List<ClassCurriculumChapterCO> children; private List<ClassCurriculumChapterCO> childCurriculumChapterCOList;

View File

@ -2,11 +2,13 @@ package com.zcloud.edu.dto.clientobject.study;
import com.alibaba.cola.dto.ClientObject; import com.alibaba.cola.dto.ClientObject;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.zcloud.edu.dto.clientobject.resource.QuestionCO;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List;
/** /**
@ -44,6 +46,8 @@ public class ClassExamPaperCO extends ClientObject {
private Integer examTime; private Integer examTime;
@ApiModelProperty(value = "企业名称") @ApiModelProperty(value = "企业名称")
private String corpName; private String corpName;
@ApiModelProperty(value = "习题列表")
private List<QuestionCO> questionList;
//删除标识true false //删除标识true false
@ApiModelProperty(value = "删除标识true false") @ApiModelProperty(value = "删除标识true false")
private String deleteEnum; private String deleteEnum;

View File

@ -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`: SQLLIKE
* - `eq`: SQL=
* - `gt`:
* - `lt`:
* - `ge`:
* - `le`:
* - `ne`: SQL!=
*/
private String classId;
private String phone;
}

View File

@ -46,7 +46,7 @@ public class ClassCurriculumAddCmd extends Command {
@ApiModelProperty(value = "课程目录", name = "curriculumChapterAddCmdList", required = true) @ApiModelProperty(value = "课程目录", name = "curriculumChapterAddCmdList", required = true)
@NotNull(message = "课程目录") @NotNull(message = "课程目录")
private List<ClassCurriculumChapterAddCmd> chapterList; private List<ClassCurriculumChapterAddCmd> curriculumChapterAddCmdList;
} }

View File

@ -52,7 +52,7 @@ public class ClassCurriculumChapterAddCmd extends Command {
@ApiModelProperty(value = "目录课件", name = "curriculumChapterAddCmdList", required = true) @ApiModelProperty(value = "目录课件", name = "curriculumChapterAddCmdList", required = true)
@NotEmpty(message = "目录课件不能为空") @NotEmpty(message = "目录课件不能为空")
private List<ClassCurriculumChapterAddCmd> children; private List<ClassCurriculumChapterAddCmd> curriculumChapterAddCmdList;
} }

View File

@ -26,7 +26,7 @@ public class StudentAddCmd extends Command {
@ApiModelProperty(value = "学员userid", name = "userId", required = true) @ApiModelProperty(value = "学员userid", name = "userId", required = true)
@NotNull(message = "学员userid不能为空") @NotNull(message = "学员userid不能为空")
private Integer userId; private Long userId;
@ApiModelProperty(value = "班级id", name = "classId", required = true) @ApiModelProperty(value = "班级id", name = "classId", required = true)
@NotEmpty(message = "班级id不能为空") @NotEmpty(message = "班级id不能为空")

View File

@ -6,6 +6,7 @@ import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import org.springframework.web.multipart.MultipartFile;
import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
@ -21,33 +22,25 @@ import javax.validation.constraints.NotNull;
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
public class StudentSignAddCmd extends Command { 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) @ApiModelProperty(value = "班级id", name = "classId", required = true)
@NotEmpty(message = "班级id不能为空") @NotEmpty(message = "班级id不能为空")
private String classId; 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) @ApiModelProperty(value = "签到类型 1-打卡签到 2-人脸签到", name = "type", required = true)
@NotNull(message = "签到类型 1-打卡签到 2-人脸签到不能为空") @NotNull(message = "签到类型 1-打卡签到 2-人脸签到不能为空")
private Integer type; private Integer type;
@ApiModelProperty(value = "手机号", name = "phone", required = true)
@NotEmpty(message = "手机号不能为空")
private String phone;
@ApiModelProperty(value = "人脸照片", name = "files")
@NotEmpty(message = "请上传人脸照片")
private MultipartFile[] files;
} }

View File

@ -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;
}

View File

@ -14,7 +14,7 @@ public interface ClassGateway {
/** /**
* *
*/ */
Boolean add(ClassE classE); Long add(ClassE classE);
/** /**
* *

View File

@ -33,7 +33,7 @@ public class ClassCurriculumChapterE extends BaseE {
//上级ID //上级ID
private String parentId; private String parentId;
//子集 //子集
private List<ClassCurriculumChapterE> children; private List<ClassCurriculumChapterE> curriculumChapterAddCmdList;
//删除标识true false //删除标识true false
private String deleteEnum; private String deleteEnum;
//备注 //备注

View File

@ -38,7 +38,7 @@ public class ClassCurriculumE extends BaseE {
//更新人姓名 //更新人姓名
private String updateName; private String updateName;
private List<ClassCurriculumChapterE> chapterList; private List<ClassCurriculumChapterE> curriculumChapterAddCmdList;
//租户id //租户id
@ -62,22 +62,22 @@ public class ClassCurriculumE extends BaseE {
List<ClassCurriculumChapterE> classCurriculumChapterEList = new ArrayList<ClassCurriculumChapterE>(); List<ClassCurriculumChapterE> classCurriculumChapterEList = new ArrayList<ClassCurriculumChapterE>();
for (ClassCurriculumE cur : curList){ for (ClassCurriculumE cur : curList){
cur.setClassCurriculumId(Tools.get32UUID()); cur.setClassCurriculumId(Tools.get32UUID());
for (ClassCurriculumChapterE chapter : cur.getChapterList()){ for (ClassCurriculumChapterE chapter : cur.getCurriculumChapterAddCmdList()){
chapter.setCurriculumChapterId(Tools.get32UUID()); chapter.setCurriculumChapterId(Tools.get32UUID());
chapter.setClassId(cur.getClassId()); chapter.setClassId(cur.getClassId());
chapter.setClassCurriculumId(cur.getClassCurriculumId()); chapter.setClassCurriculumId(cur.getClassCurriculumId());
chapter.setParentId("0"); chapter.setParentId("0");
if (chapter.getChildren() != null && chapter.getChildren().size() > 0){ if (chapter.getCurriculumChapterAddCmdList() != null && chapter.getCurriculumChapterAddCmdList().size() > 0){
for (ClassCurriculumChapterE childChapter : chapter.getChildren()){ for (ClassCurriculumChapterE childChapter : chapter.getCurriculumChapterAddCmdList()){
childChapter.setCurriculumChapterId(Tools.get32UUID()); childChapter.setCurriculumChapterId(Tools.get32UUID());
childChapter.setClassId(cur.getClassId()); childChapter.setClassId(cur.getClassId());
childChapter.setClassCurriculumId(cur.getClassCurriculumId()); childChapter.setClassCurriculumId(cur.getClassCurriculumId());
childChapter.setParentId(chapter.getCurriculumChapterId()); childChapter.setParentId(chapter.getCurriculumChapterId());
} }
classCurriculumChapterEList.addAll(chapter.getChildren()); classCurriculumChapterEList.addAll(chapter.getCurriculumChapterAddCmdList());
} }
} }
classCurriculumChapterEList.addAll(cur.getChapterList()); classCurriculumChapterEList.addAll(cur.getCurriculumChapterAddCmdList());
} }
return classCurriculumChapterEList; return classCurriculumChapterEList;
} }

View File

@ -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("班级已结束");
}
}
} }

View File

@ -1,9 +1,22 @@
package com.zcloud.edu.domain.model.study; package com.zcloud.edu.domain.model.study;
import com.alibaba.cola.exception.BizException;
import com.jjb.saas.framework.domain.model.BaseE; 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 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.time.LocalDateTime;
import java.util.Base64;
/** /**
* web-domain * web-domain
@ -28,6 +41,9 @@ public class StudentSignE extends BaseE {
private String faceUrl; private String faceUrl;
//签到类型 1-打卡签到 2-人脸签到 //签到类型 1-打卡签到 2-人脸签到
private Integer type; private Integer type;
private String phone;
private MultipartFile[] files;
//环境 //环境
private String env; private String env;
//删除标识true false //删除标识true false
@ -52,5 +68,21 @@ public class StudentSignE extends BaseE {
private Long createId; private Long createId;
//修改人id //修改人id
private Long updateId; 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());
}
} }

View File

@ -22,11 +22,11 @@ public class ClassGatewayImpl implements ClassGateway {
private final ClassRepository classRepository; private final ClassRepository classRepository;
@Override @Override
public Boolean add(ClassE classE) { public Long add(ClassE classE) {
ClassDO d = new ClassDO(); ClassDO d = new ClassDO();
BeanUtils.copyProperties(classE, d); BeanUtils.copyProperties(classE, d);
classRepository.save(d); classRepository.save(d);
return true; return d.getId();
} }
@Override @Override

View File

@ -67,13 +67,13 @@ public class ClassDO extends BaseDO {
private Integer numberofexams; private Integer numberofexams;
@ApiModelProperty(value = "班级学员总数") @ApiModelProperty(value = "班级学员总数")
@TableField(exist = false) @TableField(exist = false)
private Integer totalCount; private Integer totalCount = 0;
@ApiModelProperty(value = "班级签到人数") @ApiModelProperty(value = "班级签到人数")
@TableField(exist = false) @TableField(exist = false)
private Integer signCount; private Integer signCount = 0;
@ApiModelProperty(value = "考试通过人数") @ApiModelProperty(value = "考试通过人数")
@TableField(exist = false) @TableField(exist = false)
private Integer finishCount; private Integer finishCount = 0;
} }

View File

@ -97,6 +97,5 @@ public class StudentDO extends BaseDO {
@ApiModelProperty(value = "项目名称集合") @ApiModelProperty(value = "项目名称集合")
private String projectNames; private String projectNames;
} }

View File

@ -1,11 +1,15 @@
package com.zcloud.edu.persistence.dataobject.study; package com.zcloud.edu.persistence.dataobject.study;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.jjb.saas.framework.repository.basedo.BaseDO; import com.jjb.saas.framework.repository.basedo.BaseDO;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import org.springframework.web.multipart.MultipartFile;
import java.time.LocalDateTime;
/** /**
* web-infrastructure * web-infrastructure
@ -21,25 +25,44 @@ public class StudentSignDO extends BaseDO {
//学员id //学员id
@ApiModelProperty(value = "学员id") @ApiModelProperty(value = "学员id")
private String studentId; private String studentId;
//业务id //业务id
@ApiModelProperty(value = "业务id") @ApiModelProperty(value = "业务id")
private String studentSignId; private String studentSignId;
//班级id //班级id
@ApiModelProperty(value = "班级id") @ApiModelProperty(value = "班级id")
private String classId; private String classId;
//用户id //用户id
@ApiModelProperty(value = "用户id") @ApiModelProperty(value = "用户id")
private Long userId; private Long userId;
//企业id //企业id
@ApiModelProperty(value = "企业id") @ApiModelProperty(value = "企业id")
private Long corpinfoId; private Long corpinfoId;
//签到人脸路径 //签到人脸路径
@ApiModelProperty(value = "签到人脸路径") @ApiModelProperty(value = "签到人脸路径")
private String faceUrl; private String faceUrl;
//签到类型 1-打卡签到 2-人脸签到 //签到类型 1-打卡签到 2-人脸签到
@ApiModelProperty(value = "签到类型 1-打卡签到 2-人脸签到") @ApiModelProperty(value = "签到类型 1-打卡签到 2-人脸签到")
private Integer type; 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;
} }

View File

@ -15,5 +15,7 @@ import java.util.List;
@Mapper @Mapper
public interface QuestionMapper extends BaseMapper<QuestionDO> { public interface QuestionMapper extends BaseMapper<QuestionDO> {
List<QuestionDO> listByClassId(String classId); List<QuestionDO> listByClassId(String classId);
List<QuestionDO> listByExamPaperId(String examPaperId);
} }

View File

@ -14,7 +14,7 @@ import java.util.List;
*/ */
@Mapper @Mapper
public interface ClassCurriculumChapterMapper extends BaseMapper<ClassCurriculumChapterDO> { public interface ClassCurriculumChapterMapper extends BaseMapper<ClassCurriculumChapterDO> {
List<ClassCurriculumChapterDO> listByCurriculumId(String classCurriculumId); List<ClassCurriculumChapterDO> listByClassCurriculumId(String classCurriculumId);
} }

View File

@ -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.dataobject.study.StudentDO;
import com.zcloud.edu.persistence.mapper.po.study.StudentCountPO; import com.zcloud.edu.persistence.mapper.po.study.StudentCountPO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -21,5 +22,8 @@ public interface StudentMapper extends BaseMapper<StudentDO> {
List<ClassDO> countStudentByClass(List<String> classIds); List<ClassDO> countStudentByClass(List<String> classIds);
StudentDO findByClassIdAndPhone(@Param("classId") String classId, @Param("phone") String phone);
StudentDO findFaceUrlByPhone(@Param("phone") String phone);
} }

View File

@ -3,6 +3,10 @@ package com.zcloud.edu.persistence.mapper.study;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zcloud.edu.persistence.dataobject.study.StudentSignDO; import com.zcloud.edu.persistence.dataobject.study.StudentSignDO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/** /**
* web-infrastructure * web-infrastructure
@ -12,6 +16,6 @@ import org.apache.ibatis.annotations.Mapper;
*/ */
@Mapper @Mapper
public interface StudentSignMapper extends BaseMapper<StudentSignDO> { public interface StudentSignMapper extends BaseMapper<StudentSignDO> {
List<StudentSignDO> listAll(@Param("params") Map<String, Object> params);
} }

View File

@ -1,5 +1,6 @@
package com.zcloud.edu.persistence.repository.impl.resource; package com.zcloud.edu.persistence.repository.impl.resource;
import com.alibaba.cola.dto.MultiResponse;
import com.jjb.saas.framework.repository.common.PageHelper; import com.jjb.saas.framework.repository.common.PageHelper;
import com.zcloud.edu.domain.enums.CoursewareTypeEnum; import com.zcloud.edu.domain.enums.CoursewareTypeEnum;
import com.zcloud.edu.persistence.dataobject.QuestionDO; import com.zcloud.edu.persistence.dataobject.QuestionDO;
@ -60,6 +61,11 @@ public class QuestionRepositoryImpl extends BaseRepositoryImpl<QuestionMapper, Q
return SingleResponse.of(questionMapper.selectById(id)); return SingleResponse.of(questionMapper.selectById(id));
} }
@Override
public List<QuestionDO> getInfoByExamPaperId(String examPaperId) {
return questionMapper.listByExamPaperId(examPaperId);
}
@Override @Override
public boolean saveBatch(List<QuestionDO> list) { public boolean saveBatch(List<QuestionDO> list) {

View File

@ -40,8 +40,8 @@ public class ClassCurriculumChapterRepositoryImpl extends BaseRepositoryImpl<Cla
} }
@Override @Override
public List<ClassCurriculumChapterDO> listByCurriculumId(String classCurriculumId) { public List<ClassCurriculumChapterDO> listByClassCurriculumId(String classCurriculumId) {
return classCurriculumChapterMapper.listByCurriculumId(classCurriculumId); return classCurriculumChapterMapper.listByClassCurriculumId(classCurriculumId);
} }
@Override @Override

View File

@ -66,5 +66,13 @@ public class ClassExamPaperRepositoryImpl extends BaseRepositoryImpl<ClassExamPa
updateWrapper.eq("class_id", classId); updateWrapper.eq("class_id", classId);
return classExamPaperMapper.delete(updateWrapper); return classExamPaperMapper.delete(updateWrapper);
} }
@Override
public ClassExamPaperDO findByClassId(String classId) {
QueryWrapper<ClassExamPaperDO> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("class_id", classId);
queryWrapper.eq("delete_enum", "FALSE");
return classExamPaperMapper.selectOne(queryWrapper);
}
} }

View File

@ -14,6 +14,7 @@ import com.zcloud.gbscommon.utils.Query;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
@ -54,5 +55,13 @@ public class StudentExamRecordRepositoryImpl extends BaseRepositoryImpl<StudentE
updateWrapper.set("delete_enum", "TRUE"); updateWrapper.set("delete_enum", "TRUE");
return studentExamRecordMapper.delete( updateWrapper); return studentExamRecordMapper.delete( updateWrapper);
} }
@Override
public List<StudentExamRecordDO> listAllByStudentId(String studentId) {
QueryWrapper queryWrapper = new QueryWrapper<>();
queryWrapper.eq("student_id", studentId);
queryWrapper.eq("delete_enum", "FALSE");
return studentExamRecordMapper.selectList(queryWrapper);
}
} }

View File

@ -74,5 +74,15 @@ public class StudentRepositoryImpl extends BaseRepositoryImpl<StudentMapper, Stu
return studentMapper.countStudentByClass(classIds); return studentMapper.countStudentByClass(classIds);
} }
@Override
public StudentDO findByClassIdAndPhone(String classId, String phone) {
return studentMapper.findByClassIdAndPhone(classId, phone);
}
@Override
public StudentDO findFaceUrlByPhone(String phone) {
return studentMapper.findFaceUrlByPhone(phone);
}
} }

View File

@ -1,11 +1,13 @@
package com.zcloud.edu.persistence.repository.impl.study; package com.zcloud.edu.persistence.repository.impl.study;
import com.alibaba.cola.dto.MultiResponse;
import com.alibaba.cola.dto.PageResponse; import com.alibaba.cola.dto.PageResponse;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.jjb.saas.framework.repository.common.PageHelper; import com.jjb.saas.framework.repository.common.PageHelper;
import com.jjb.saas.framework.repository.repo.impl.BaseRepositoryImpl; import com.jjb.saas.framework.repository.repo.impl.BaseRepositoryImpl;
import com.zcloud.edu.persistence.dataobject.QuestionDO;
import com.zcloud.edu.persistence.dataobject.study.StudentSignDO; import com.zcloud.edu.persistence.dataobject.study.StudentSignDO;
import com.zcloud.edu.persistence.mapper.study.StudentSignMapper; import com.zcloud.edu.persistence.mapper.study.StudentSignMapper;
import com.zcloud.edu.persistence.repository.study.StudentSignRepository; import com.zcloud.edu.persistence.repository.study.StudentSignRepository;
@ -14,6 +16,7 @@ import com.zcloud.gbscommon.utils.Query;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
@ -45,5 +48,19 @@ public class StudentSignRepositoryImpl extends BaseRepositoryImpl<StudentSignMap
updateWrapper.set("delete_enum", "TRUE"); updateWrapper.set("delete_enum", "TRUE");
return studentSignMapper.delete(updateWrapper); return studentSignMapper.delete(updateWrapper);
} }
@Override
public List<StudentSignDO> listAll(Map<String, Object> params) {
return studentSignMapper.listAll(params);
}
@Override
public List<StudentSignDO> listAllByStudentId(Map<String, Object> 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);
}
} }

View File

@ -1,5 +1,6 @@
package com.zcloud.edu.persistence.repository.resource; package com.zcloud.edu.persistence.repository.resource;
import com.alibaba.cola.dto.MultiResponse;
import com.zcloud.edu.persistence.dataobject.QuestionDO; import com.zcloud.edu.persistence.dataobject.QuestionDO;
import com.alibaba.cola.dto.SingleResponse; import com.alibaba.cola.dto.SingleResponse;
import com.alibaba.cola.dto.PageResponse; import com.alibaba.cola.dto.PageResponse;
@ -24,6 +25,8 @@ public interface QuestionRepository extends BaseRepository<QuestionDO> {
SingleResponse<QuestionDO> getInfoById(Long id); SingleResponse<QuestionDO> getInfoById(Long id);
List<QuestionDO> getInfoByExamPaperId(String examPaperId);
boolean saveBatch(List<QuestionDO> list); boolean saveBatch(List<QuestionDO> list);
Long getCountByVideoCourseware(String videoCoursewareId); Long getCountByVideoCourseware(String videoCoursewareId);

View File

@ -16,7 +16,7 @@ import java.util.Map;
public interface ClassCurriculumChapterRepository extends BaseRepository<ClassCurriculumChapterDO> { public interface ClassCurriculumChapterRepository extends BaseRepository<ClassCurriculumChapterDO> {
PageResponse<ClassCurriculumChapterDO> listPage(Map<String, Object> params); PageResponse<ClassCurriculumChapterDO> listPage(Map<String, Object> params);
List<ClassCurriculumChapterDO> listByCurriculumId(String classCurriculumId); List<ClassCurriculumChapterDO> listByClassCurriculumId(String classCurriculumId);
Integer deleteByCurriculumId(String classCurriculumId); Integer deleteByCurriculumId(String classCurriculumId);

View File

@ -22,5 +22,7 @@ public interface ClassExamPaperRepository extends BaseRepository<ClassExamPaperD
ClassExamPaperDO findById(Long id); ClassExamPaperDO findById(Long id);
Integer deleteByClassId(String classId); Integer deleteByClassId(String classId);
ClassExamPaperDO findByClassId(String id);
} }

View File

@ -4,6 +4,7 @@ import com.alibaba.cola.dto.PageResponse;
import com.jjb.saas.framework.repository.repo.BaseRepository; import com.jjb.saas.framework.repository.repo.BaseRepository;
import com.zcloud.edu.persistence.dataobject.study.StudentExamRecordDO; import com.zcloud.edu.persistence.dataobject.study.StudentExamRecordDO;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
@ -18,5 +19,7 @@ public interface StudentExamRecordRepository extends BaseRepository<StudentExamR
void deleteByStudentId(String studentId); void deleteByStudentId(String studentId);
Integer deleteByClassId(String classId); Integer deleteByClassId(String classId);
List<StudentExamRecordDO> listAllByStudentId(String studentId);
} }

View File

@ -27,5 +27,13 @@ public interface StudentRepository extends BaseRepository<StudentDO> {
List<ClassDO> countStudentByClass(List<String> classIds); List<ClassDO> countStudentByClass(List<String> classIds);
StudentDO findByClassIdAndPhone(String classId, String phone);
StudentDO findFaceUrlByPhone(String phone);
} }

View File

@ -1,9 +1,11 @@
package com.zcloud.edu.persistence.repository.study; package com.zcloud.edu.persistence.repository.study;
import com.alibaba.cola.dto.MultiResponse;
import com.alibaba.cola.dto.PageResponse; import com.alibaba.cola.dto.PageResponse;
import com.jjb.saas.framework.repository.repo.BaseRepository; import com.jjb.saas.framework.repository.repo.BaseRepository;
import com.zcloud.edu.persistence.dataobject.study.StudentSignDO; import com.zcloud.edu.persistence.dataobject.study.StudentSignDO;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
@ -16,5 +18,10 @@ public interface StudentSignRepository extends BaseRepository<StudentSignDO> {
PageResponse<StudentSignDO> listPage(Map<String, Object> params); PageResponse<StudentSignDO> listPage(Map<String, Object> params);
Integer deleteByClassId(String classId); Integer deleteByClassId(String classId);
List<StudentSignDO> listAll(Map<String, Object> params);
List<StudentSignDO> listAllByStudentId(Map<String, Object> params);
} }

View File

@ -14,5 +14,17 @@
AND q.delete_enum = 'FALSE' AND q.delete_enum = 'FALSE'
and q.courseware_type = 1 and q.courseware_type = 1
</select> </select>
<select id="listByExamPaperId" resultType="com.zcloud.edu.persistence.dataobject.QuestionDO">
SELECT
q.*
FROM
question q
WHERE
q.exam_paper_id = #{examPaperId}
AND q.delete_enum = 'FALSE'
and q.courseware_type = 2
order by q.question_type, q.create_time desc
</select>
</mapper> </mapper>

View File

@ -3,7 +3,7 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zcloud.edu.persistence.mapper.study.ClassCurriculumChapterMapper"> <mapper namespace="com.zcloud.edu.persistence.mapper.study.ClassCurriculumChapterMapper">
<select id="listByCurriculumId" resultType="com.zcloud.edu.persistence.dataobject.study.ClassCurriculumChapterDO"> <select id="listByClassCurriculumId" resultType="com.zcloud.edu.persistence.dataobject.study.ClassCurriculumChapterDO">
SELECT SELECT
c.id, c.id,
c.curriculum_chapter_id, c.curriculum_chapter_id,

View File

@ -20,7 +20,7 @@
SELECT SELECT
count(*) total_count, count(*) total_count,
count(CASE WHEN sign_flag = 1 THEN 1 END) sign_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 class_id
FROM FROM
student student
@ -34,7 +34,41 @@
GROUP BY GROUP BY
class_id class_id
</select> </select>
<select id="findByClassIdAndPhone" resultType="com.zcloud.edu.persistence.dataobject.study.StudentDO">
SELECT
id,
student_id,
user_id,
class_id,
name,
class_corpinfo_id,
phone,
user_id_card,
sign_flag,
exam_sign_flag,
state
FROM
student
<where>
and class_id = #{classId}
and phone = #{phone}
and delete_enum = 'FALSE'
</where>
</select>
<select id="findFaceUrlByPhone" resultType="com.zcloud.edu.persistence.dataobject.study.StudentDO">
SELECT
user_avatar_url
FROM
user
<where>
and username = #{phone}
and delete_enum = 'FALSE'
and user_avatar_url is not null
and user_avatar_url != ''
</where>
order by
create_time desc
limit 1
</select>
</mapper> </mapper>

View File

@ -3,6 +3,41 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zcloud.edu.persistence.mapper.study.StudentSignMapper"> <mapper namespace="com.zcloud.edu.persistence.mapper.study.StudentSignMapper">
<select id="listAll" resultType="com.zcloud.edu.persistence.dataobject.study.StudentSignDO">
SELECT
s.name student_name,
cl.name class_name,
ss.create_time,
cl.training_location,
ss.type,
ss.face_url
FROM
student_sign ss
LEFT JOIN student s ON ss.student_id = ss.student_id
LEFT JOIN class cl ON cl.class_id = s.class_id
WHERE
s.phone = #{params.phone}
AND s.class_id = #{params.classId}
AND ss.delete_enum = 'FALSE'
</select>
<!--<select id="listAllByStudentId" resultType="com.zcloud.edu.persistence.dataobject.study.StudentSignDO">-->
<!-- SELECT-->
<!-- s.name student_name,-->
<!-- cl.name class_name,-->
<!-- ss.create_time,-->
<!-- cl.training_location,-->
<!-- ss.type,-->
<!-- ss.face_url-->
<!-- FROM-->
<!-- student_sign ss-->
<!-- LEFT JOIN student s ON ss.student_id = ss.student_id-->
<!-- LEFT JOIN class cl ON cl.class_id = s.class_id-->
<!-- WHERE-->
<!-- s.phone = #{params.phone}-->
<!-- AND s.class_id = #{params.classId}-->
<!-- AND ss.delete_enum = 'FALSE'-->
<!--</select>-->
</mapper> </mapper>