添加学生签到验证和人脸识别功能
parent
7d972b76b1
commit
c0c7085f0c
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -57,13 +57,13 @@ public class ClassCurriculumQueryExe {
|
|||
*/
|
||||
public SingleResponse<ClassCurriculumCO> executeGetInfoById(Long id) {
|
||||
ClassCurriculumDO classCurriculumDO = classCurriculumRepository.getInfoById(id);
|
||||
List<ClassCurriculumChapterDO> classCurriculumChapterDOList = classCurriculumChapterRepository.listByCurriculumId(classCurriculumDO.getClassCurriculumId());
|
||||
List<ClassCurriculumChapterDO> classCurriculumChapterDOList = classCurriculumChapterRepository.listByClassCurriculumId(classCurriculumDO.getClassCurriculumId());
|
||||
ClassCurriculumCO classCurriculumCO = new ClassCurriculumCO();
|
||||
BeanUtils.copyProperties(classCurriculumDO, classCurriculumCO);
|
||||
List<ClassCurriculumChapterCO> 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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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<StudentSignCO> examCenterCOS = studentSignCoConvertor.converDOsToCOs(pageResponse.getData());
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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<ClassCO> 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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<ClassCurriculumChapterE> 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<ClassCurriculumChapterE> chapterList = new ArrayList<>();
|
||||
chapterList.add(chapter);
|
||||
curriculum.setChapterList(chapterList);
|
||||
curriculum.setCurriculumChapterAddCmdList(chapterList);
|
||||
}
|
||||
}
|
||||
classCurriculumEList.add(curriculum);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -67,5 +67,10 @@ public class ClassExamPaperServiceImpl implements ClassExamPaperServiceI {
|
|||
public SingleResponse<ClassExamPaperCO> getInfoById(Long id) {
|
||||
return classExamPaperQueryExe.executeGetInfoById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SingleResponse<ClassExamPaperCO> getInfoByClassId(String classId) {
|
||||
return classExamPaperQueryExe.executeGetInfoByClassId(classId);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -38,10 +38,10 @@ public class ClassServiceImpl implements ClassServiceI {
|
|||
}
|
||||
|
||||
@Override
|
||||
public SingleResponse add(ClassAddCmd cmd) {
|
||||
public SingleResponse<ClassCO> add(ClassAddCmd cmd) {
|
||||
|
||||
classAddExe.execute(cmd);
|
||||
return SingleResponse.buildSuccess();
|
||||
|
||||
return classAddExe.execute(cmd);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -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<StudentSignCO> listAll(ClassAppSignQry qry) {
|
||||
return studentSignQueryExe.executeListAll(qry);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Response verify(StudentSignVerifyQry qry) {
|
||||
return studentSignQueryExe.executeVerify(qry);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,5 +28,7 @@ public interface ClassExamPaperServiceI {
|
|||
void removeBatch(Long[] ids);
|
||||
|
||||
SingleResponse<ClassExamPaperCO> getInfoById(Long id);
|
||||
|
||||
SingleResponse<ClassExamPaperCO> getInfoByClassId(String classId);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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<StudentSignCO> listAll(ClassAppSignQry qry);
|
||||
|
||||
Response verify(StudentSignVerifyQry qry);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ public class ClassCurriculumCO extends ClientObject {
|
|||
private long videoCount;
|
||||
// 章节目录
|
||||
@ApiModelProperty(value = "章节目录")
|
||||
private List<ClassCurriculumChapterCO> chapterList;
|
||||
private List<ClassCurriculumChapterCO> curriculumChapterCOList;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "所属单位id")
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ public class ClassCurriculumChapterCO extends ClientObject {
|
|||
|
||||
// 章节目录
|
||||
@ApiModelProperty(value = "章节目录")
|
||||
private List<ClassCurriculumChapterCO> children;
|
||||
private List<ClassCurriculumChapterCO> childCurriculumChapterCOList;
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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<QuestionCO> questionList;
|
||||
//删除标识true false
|
||||
@ApiModelProperty(value = "删除标识true false")
|
||||
private String deleteEnum;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -46,7 +46,7 @@ public class ClassCurriculumAddCmd extends Command {
|
|||
|
||||
@ApiModelProperty(value = "课程目录", name = "curriculumChapterAddCmdList", required = true)
|
||||
@NotNull(message = "课程目录")
|
||||
private List<ClassCurriculumChapterAddCmd> chapterList;
|
||||
private List<ClassCurriculumChapterAddCmd> curriculumChapterAddCmdList;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ public class ClassCurriculumChapterAddCmd extends Command {
|
|||
|
||||
@ApiModelProperty(value = "目录课件", name = "curriculumChapterAddCmdList", required = true)
|
||||
@NotEmpty(message = "目录课件不能为空")
|
||||
private List<ClassCurriculumChapterAddCmd> children;
|
||||
private List<ClassCurriculumChapterAddCmd> curriculumChapterAddCmdList;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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不能为空")
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
@ -14,7 +14,7 @@ public interface ClassGateway {
|
|||
/**
|
||||
* 新增
|
||||
*/
|
||||
Boolean add(ClassE classE);
|
||||
Long add(ClassE classE);
|
||||
|
||||
/**
|
||||
* 修改
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ public class ClassCurriculumChapterE extends BaseE {
|
|||
//上级ID
|
||||
private String parentId;
|
||||
//子集
|
||||
private List<ClassCurriculumChapterE> children;
|
||||
private List<ClassCurriculumChapterE> curriculumChapterAddCmdList;
|
||||
//删除标识true false
|
||||
private String deleteEnum;
|
||||
//备注
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ public class ClassCurriculumE extends BaseE {
|
|||
//更新人姓名
|
||||
private String updateName;
|
||||
|
||||
private List<ClassCurriculumChapterE> chapterList;
|
||||
private List<ClassCurriculumChapterE> curriculumChapterAddCmdList;
|
||||
|
||||
|
||||
//租户id
|
||||
|
|
@ -62,22 +62,22 @@ public class ClassCurriculumE extends BaseE {
|
|||
List<ClassCurriculumChapterE> classCurriculumChapterEList = new ArrayList<ClassCurriculumChapterE>();
|
||||
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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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("班级已结束");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -97,6 +97,5 @@ public class StudentDO extends BaseDO {
|
|||
@ApiModelProperty(value = "项目名称集合")
|
||||
private String projectNames;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,5 +15,7 @@ import java.util.List;
|
|||
@Mapper
|
||||
public interface QuestionMapper extends BaseMapper<QuestionDO> {
|
||||
List<QuestionDO> listByClassId(String classId);
|
||||
|
||||
List<QuestionDO> listByExamPaperId(String examPaperId);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ import java.util.List;
|
|||
*/
|
||||
@Mapper
|
||||
public interface ClassCurriculumChapterMapper extends BaseMapper<ClassCurriculumChapterDO> {
|
||||
List<ClassCurriculumChapterDO> listByCurriculumId(String classCurriculumId);
|
||||
List<ClassCurriculumChapterDO> listByClassCurriculumId(String classCurriculumId);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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<StudentDO> {
|
|||
|
||||
List<ClassDO> countStudentByClass(List<String> classIds);
|
||||
|
||||
StudentDO findByClassIdAndPhone(@Param("classId") String classId, @Param("phone") String phone);
|
||||
StudentDO findFaceUrlByPhone(@Param("phone") String phone);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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<StudentSignDO> {
|
||||
|
||||
List<StudentSignDO> listAll(@Param("params") Map<String, Object> params);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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<QuestionMapper, Q
|
|||
return SingleResponse.of(questionMapper.selectById(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<QuestionDO> getInfoByExamPaperId(String examPaperId) {
|
||||
return questionMapper.listByExamPaperId(examPaperId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveBatch(List<QuestionDO> list) {
|
||||
|
||||
|
|
|
|||
|
|
@ -40,8 +40,8 @@ public class ClassCurriculumChapterRepositoryImpl extends BaseRepositoryImpl<Cla
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<ClassCurriculumChapterDO> listByCurriculumId(String classCurriculumId) {
|
||||
return classCurriculumChapterMapper.listByCurriculumId(classCurriculumId);
|
||||
public List<ClassCurriculumChapterDO> listByClassCurriculumId(String classCurriculumId) {
|
||||
return classCurriculumChapterMapper.listByClassCurriculumId(classCurriculumId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -66,5 +66,13 @@ public class ClassExamPaperRepositoryImpl extends BaseRepositoryImpl<ClassExamPa
|
|||
updateWrapper.eq("class_id", classId);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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<StudentE
|
|||
updateWrapper.set("delete_enum", "TRUE");
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -74,5 +74,15 @@ public class StudentRepositoryImpl extends BaseRepositoryImpl<StudentMapper, Stu
|
|||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +1,13 @@
|
|||
package com.zcloud.edu.persistence.repository.impl.study;
|
||||
|
||||
import com.alibaba.cola.dto.MultiResponse;
|
||||
import com.alibaba.cola.dto.PageResponse;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.jjb.saas.framework.repository.common.PageHelper;
|
||||
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.mapper.study.StudentSignMapper;
|
||||
import com.zcloud.edu.persistence.repository.study.StudentSignRepository;
|
||||
|
|
@ -14,6 +16,7 @@ import com.zcloud.gbscommon.utils.Query;
|
|||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
|
|
@ -45,5 +48,19 @@ public class StudentSignRepositoryImpl extends BaseRepositoryImpl<StudentSignMap
|
|||
updateWrapper.set("delete_enum", "TRUE");
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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<QuestionDO> {
|
|||
|
||||
SingleResponse<QuestionDO> getInfoById(Long id);
|
||||
|
||||
List<QuestionDO> getInfoByExamPaperId(String examPaperId);
|
||||
|
||||
boolean saveBatch(List<QuestionDO> list);
|
||||
|
||||
Long getCountByVideoCourseware(String videoCoursewareId);
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import java.util.Map;
|
|||
public interface ClassCurriculumChapterRepository extends BaseRepository<ClassCurriculumChapterDO> {
|
||||
PageResponse<ClassCurriculumChapterDO> listPage(Map<String, Object> params);
|
||||
|
||||
List<ClassCurriculumChapterDO> listByCurriculumId(String classCurriculumId);
|
||||
List<ClassCurriculumChapterDO> listByClassCurriculumId(String classCurriculumId);
|
||||
|
||||
Integer deleteByCurriculumId(String classCurriculumId);
|
||||
|
||||
|
|
|
|||
|
|
@ -22,5 +22,7 @@ public interface ClassExamPaperRepository extends BaseRepository<ClassExamPaperD
|
|||
ClassExamPaperDO findById(Long id);
|
||||
|
||||
Integer deleteByClassId(String classId);
|
||||
|
||||
ClassExamPaperDO findByClassId(String id);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import com.alibaba.cola.dto.PageResponse;
|
|||
import com.jjb.saas.framework.repository.repo.BaseRepository;
|
||||
import com.zcloud.edu.persistence.dataobject.study.StudentExamRecordDO;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
|
|
@ -18,5 +19,7 @@ public interface StudentExamRecordRepository extends BaseRepository<StudentExamR
|
|||
void deleteByStudentId(String studentId);
|
||||
|
||||
Integer deleteByClassId(String classId);
|
||||
|
||||
List<StudentExamRecordDO> listAllByStudentId(String studentId);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,5 +27,13 @@ public interface StudentRepository extends BaseRepository<StudentDO> {
|
|||
|
||||
List<ClassDO> countStudentByClass(List<String> classIds);
|
||||
|
||||
StudentDO findByClassIdAndPhone(String classId, String phone);
|
||||
|
||||
StudentDO findFaceUrlByPhone(String phone);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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<StudentSignDO> {
|
|||
PageResponse<StudentSignDO> listPage(Map<String, Object> params);
|
||||
|
||||
Integer deleteByClassId(String classId);
|
||||
|
||||
List<StudentSignDO> listAll(Map<String, Object> params);
|
||||
|
||||
List<StudentSignDO> listAllByStudentId(Map<String, Object> params);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,5 +14,17 @@
|
|||
AND q.delete_enum = 'FALSE'
|
||||
and q.courseware_type = 1
|
||||
</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>
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<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
|
||||
c.id,
|
||||
c.curriculum_chapter_id,
|
||||
|
|
|
|||
|
|
@ -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
|
||||
</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>
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,41 @@
|
|||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<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>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue