Переглянути джерело

代码优化+单点登录验证功能

wangchangsheng 2 роки тому
батько
коміт
fe85208261
26 змінених файлів з 287 додано та 35 видалено
  1. 1 0
      exam-06173-api/src/main/java/com/gyee/boot/base/api/api/ApiError.java
  2. 13 0
      exam-06173-api/src/main/java/com/gyee/boot/base/api/utils/passwd/PassHandler.java
  3. 22 0
      exam-06173-api/src/main/java/com/gyee/exam/modules/course/controller/CourseController.java
  4. 25 0
      exam-06173-api/src/main/java/com/gyee/exam/modules/course/dto/request/CourseOpenDepartReqDTO.java
  5. 34 0
      exam-06173-api/src/main/java/com/gyee/exam/modules/course/dto/response/CourseOpenDepartDTO.java
  6. 10 8
      exam-06173-api/src/main/java/com/gyee/exam/modules/course/dto/response/CourseUserIdTotalDTO.java
  7. 4 0
      exam-06173-api/src/main/java/com/gyee/exam/modules/course/mapper/CourseLearnMapper.java
  8. 3 0
      exam-06173-api/src/main/java/com/gyee/exam/modules/course/mapper/CourseMapper.java
  9. 11 0
      exam-06173-api/src/main/java/com/gyee/exam/modules/course/service/CourseLearnService.java
  10. 9 0
      exam-06173-api/src/main/java/com/gyee/exam/modules/course/service/CourseService.java
  11. 2 2
      exam-06173-api/src/main/java/com/gyee/exam/modules/course/service/impl/CourseFileLearnServiceImpl.java
  12. 9 0
      exam-06173-api/src/main/java/com/gyee/exam/modules/course/service/impl/CourseLearnServiceImpl.java
  13. 20 1
      exam-06173-api/src/main/java/com/gyee/exam/modules/course/service/impl/CourseServiceImpl.java
  14. 3 0
      exam-06173-api/src/main/java/com/gyee/exam/modules/exam/dto/ExamDTO.java
  15. 9 0
      exam-06173-api/src/main/java/com/gyee/exam/modules/exam/dto/response/ExamCheckRespDTO.java
  16. 7 8
      exam-06173-api/src/main/java/com/gyee/exam/modules/exam/dto/response/ExamOnlineRespDTO.java
  17. 3 0
      exam-06173-api/src/main/java/com/gyee/exam/modules/exam/dto/response/ExamUseridTotalDTO.java
  18. 4 0
      exam-06173-api/src/main/java/com/gyee/exam/modules/exam/service/impl/ExamServiceImpl.java
  19. 1 1
      exam-06173-api/src/main/java/com/gyee/exam/modules/paper/service/impl/PaperServiceImpl.java
  20. 3 0
      exam-06173-api/src/main/java/com/gyee/exam/modules/sys/user/dto/request/SysUserLoginReqDTO.java
  21. 40 10
      exam-06173-api/src/main/java/com/gyee/exam/modules/sys/user/service/impl/SysUserServiceImpl.java
  22. 1 0
      exam-06173-api/src/main/resources/mapper/course/CourseDepartMapper.xml
  23. 29 0
      exam-06173-api/src/main/resources/mapper/course/CourseLearnMapper.xml
  24. 18 3
      exam-06173-api/src/main/resources/mapper/course/CourseMapper.xml
  25. 5 2
      exam-06173-api/src/main/resources/mapper/exam/ExamDepartMapper.xml
  26. 1 0
      exam-06173-api/src/main/resources/mapper/exam/ExamMapper.xml

+ 1 - 0
exam-06173-api/src/main/java/com/gyee/boot/base/api/api/ApiError.java

@@ -41,6 +41,7 @@ public enum ApiError implements Serializable {
     ERROR_90010005("账号被禁用,请联系管理员!"),
     ERROR_90010006("活动用户不足,无法开启竞拍!"),
     ERROR_90010007("旧密码不正确,请确认!"),
+    ERROR_90010008("单点登录验证错误!!"),
 
 
     ERROR_60000001("数据不存在!");

+ 13 - 0
exam-06173-api/src/main/java/com/gyee/boot/base/api/utils/passwd/PassHandler.java

@@ -26,6 +26,19 @@ public class PassHandler {
 		String pwdMd5 = MD5Util.MD5(inputPass);
 		return MD5Util.MD5(pwdMd5 + salt).equals(pass);
 	}
+
+	/**
+	 * checkMark:单点登录校验
+	 * @author Bool
+	 * @param userName 用户username
+	 * @param key 固定的key
+	 * @param mark 单点登录
+	 * @return
+	 */
+	public static boolean checkMark(String userName , String key , String mark){
+		String pwdMd5 = MD5Util.MD5(userName+key);
+		return pwdMd5.equals(mark);
+	}
 	
 	
 	/**

+ 22 - 0
exam-06173-api/src/main/java/com/gyee/exam/modules/course/controller/CourseController.java

@@ -11,6 +11,7 @@ import com.gyee.boot.base.api.utils.BeanMapper;
 import com.gyee.boot.base.aspect.log.enums.LogType;
 import com.gyee.exam.modules.course.dto.CourseDTO;
 import com.gyee.exam.modules.course.dto.ext.CourseDetailExtDTO;
+import com.gyee.exam.modules.course.dto.request.CourseOpenDepartReqDTO;
 import com.gyee.exam.modules.course.dto.request.UserCourseReqDTO;
 import com.gyee.exam.modules.course.dto.response.*;
 import com.gyee.exam.modules.course.entity.Course;
@@ -281,5 +282,26 @@ public class CourseController extends BaseController {
 
 
 
+    /**
+     * 返回课程开放部门
+     * @return
+     */
+    @ApiOperation(value = "返回课程开放部门")
+    @PostMapping("/course-open-depart")
+    public ApiRest courseOpenDepart(@RequestBody CourseOpenDepartReqDTO reqDTO) {
+
+        if(null == reqDTO || StringUtils.isEmpty(reqDTO.getCourseId().trim())){
+            return super.failure("请求课程编码不能为空");
+        }
+        List<CourseOpenDepartDTO> dtoList = baseService.getCourseOpenDepart(reqDTO);
+        return super.success(dtoList);
+
+    }
+
+
+
+
+
+
 
 }

+ 25 - 0
exam-06173-api/src/main/java/com/gyee/exam/modules/course/dto/request/CourseOpenDepartReqDTO.java

@@ -0,0 +1,25 @@
+package com.gyee.exam.modules.course.dto.request;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * <p>
+ * 获取课程开放部门
+ * </p>
+ *
+ * @author 聪明笨狗
+ * @since 10点06分
+ */
+@Data
+@ApiModel(value="获取课程开放部门", description="获取课程开放部门")
+public class CourseOpenDepartReqDTO {
+
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty(value = "课程ID", required=true)
+    private String courseId;
+
+
+}

+ 34 - 0
exam-06173-api/src/main/java/com/gyee/exam/modules/course/dto/response/CourseOpenDepartDTO.java

@@ -0,0 +1,34 @@
+package com.gyee.exam.modules.course.dto.response;
+
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * <p>
+ * 课程开放部门向应类
+ * </p>
+ *
+ * @author 聪明笨狗
+ * @since 10点10分
+ */
+@Data
+@ApiModel(value="课程开放部门向应类", description="课程开放部门向应类")
+public class CourseOpenDepartDTO {
+
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty(value = "部门id")
+    private String deptId;
+
+    @ApiModelProperty(value = "部门编码")
+    private String deptCode;
+
+    @ApiModelProperty(value = "部门名称")
+    private String deptName;
+
+    @ApiModelProperty(value = "部门名称")
+    private String courseId;
+
+}

+ 10 - 8
exam-06173-api/src/main/java/com/gyee/exam/modules/course/dto/response/CourseUserIdTotalDTO.java

@@ -5,6 +5,8 @@ import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
+import java.util.Date;
+
 @Data
 @ApiModel(value="职员培训统计", description="职员培训统计")
 public class CourseUserIdTotalDTO {
@@ -28,10 +30,10 @@ public class CourseUserIdTotalDTO {
     private String createTime;
 
     @ApiModelProperty(value = "最后学习时间时间")
-    private String updateTime;
+    private Date updateTime;
 
     @ApiModelProperty(value = "学习完成时间")
-    private String finishTime;
+    private Date finishTime;
 
     @ApiModelProperty(value = "是否关联考试")
     private int associate;
@@ -43,10 +45,10 @@ public class CourseUserIdTotalDTO {
     private int learnMin;
 
 
-    public String getFinishTime() {
-        if(1==state){
-            finishTime = updateTime;
-        }
-        return finishTime;
-    }
+//    public String getFinishTime() {
+//        if(1==state){
+//            finishTime = updateTime;
+//        }
+//        return finishTime;
+//    }
 }

+ 4 - 0
exam-06173-api/src/main/java/com/gyee/exam/modules/course/mapper/CourseLearnMapper.java

@@ -3,6 +3,7 @@ package com.gyee.exam.modules.course.mapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.gyee.boot.base.api.api.dto.BaseUserQueryReqDTO;
 import com.gyee.exam.modules.course.dto.CourseLearnDTO;
 import com.gyee.exam.modules.course.dto.request.CourseLearnReqDTO;
 import com.gyee.exam.modules.course.entity.CourseLearn;
@@ -34,4 +35,7 @@ public interface CourseLearnMapper extends BaseMapper<CourseLearn> {
      * @return
      */
     List<CourseLearn> findForRefresh(String courseId);
+
+
+    List<CourseLearnDTO> selectCourseLearnFinishTime(@Param("query") BaseUserQueryReqDTO reqDTO);
 }

+ 3 - 0
exam-06173-api/src/main/java/com/gyee/exam/modules/course/mapper/CourseMapper.java

@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.gyee.boot.base.api.api.dto.BaseQueryReqDTO;
 import com.gyee.boot.base.api.api.dto.BaseUserQueryReqDTO;
 import com.gyee.exam.modules.course.dto.ext.CourseDetailExtDTO;
+import com.gyee.exam.modules.course.dto.request.CourseOpenDepartReqDTO;
 import com.gyee.exam.modules.course.dto.request.UserCourseReqDTO;
 import com.gyee.exam.modules.course.dto.response.*;
 import com.gyee.exam.modules.course.entity.Course;
@@ -51,4 +52,6 @@ public interface CourseMapper extends BaseMapper<Course> {
 
 
     List<CourseUserIdTotalDTO> selectCourseUserIdTotal(@Param("query") BaseUserQueryReqDTO reqDTO);
+
+    List<CourseOpenDepartDTO> selectCourseOpenDepart(@Param("query") CourseOpenDepartReqDTO reqDTO);
 }

+ 11 - 0
exam-06173-api/src/main/java/com/gyee/exam/modules/course/service/CourseLearnService.java

@@ -2,11 +2,14 @@ package com.gyee.exam.modules.course.service;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.gyee.boot.base.api.api.dto.BaseUserQueryReqDTO;
 import com.gyee.boot.base.api.api.dto.PagingReqDTO;
 import com.gyee.exam.modules.course.dto.CourseLearnDTO;
 import com.gyee.exam.modules.course.dto.request.CourseLearnReqDTO;
 import com.gyee.exam.modules.course.entity.CourseLearn;
 
+import java.util.List;
+
 /**
 * <p>
 * 课程学习记录业务类
@@ -30,4 +33,12 @@ public interface CourseLearnService extends IService<CourseLearn> {
      * @param courseId
      */
     void reCheck(String courseId);
+
+
+    /**
+     * 获取职员完成课程时间
+     * @param reqDTO
+     * @return
+     */
+    List<CourseLearnDTO> getCourseLearnFinishTime(BaseUserQueryReqDTO reqDTO);
 }

+ 9 - 0
exam-06173-api/src/main/java/com/gyee/exam/modules/course/service/CourseService.java

@@ -7,6 +7,7 @@ import com.gyee.boot.base.api.api.dto.BaseUserQueryReqDTO;
 import com.gyee.boot.base.api.api.dto.PagingReqDTO;
 import com.gyee.exam.modules.course.dto.CourseDTO;
 import com.gyee.exam.modules.course.dto.ext.CourseDetailExtDTO;
+import com.gyee.exam.modules.course.dto.request.CourseOpenDepartReqDTO;
 import com.gyee.exam.modules.course.dto.request.UserCourseReqDTO;
 import com.gyee.exam.modules.course.dto.response.*;
 import com.gyee.exam.modules.course.entity.Course;
@@ -122,6 +123,14 @@ public interface CourseService extends IService<Course> {
     List<CourseUserIdTotalDTO> getCourseUserIdTotal(BaseUserQueryReqDTO reqDTO);
 
 
+    /**
+     * 课程开放部门
+     * @param reqDTO
+     * @return
+     */
+    List<CourseOpenDepartDTO> getCourseOpenDepart(CourseOpenDepartReqDTO reqDTO);
+
+
 
 
 }

+ 2 - 2
exam-06173-api/src/main/java/com/gyee/exam/modules/course/service/impl/CourseFileLearnServiceImpl.java

@@ -159,10 +159,10 @@ public class CourseFileLearnServiceImpl extends ServiceImpl<CourseFileLearnMappe
             learn.setCourseId(courseId);
             learn.setFileId(fileId);
             learn.setUserId(userId);
-            learn.setLearnMin(time.intValue());
+            learn.setLearnMin(time.intValue()>=fileRef.getNeedLearn() ? fileRef.getNeedLearn() : time.intValue());
             this.save(learn);
         }else{
-            learn.setLearnMin(learn.getLearnMin() + time.intValue());
+            learn.setLearnMin((learn.getLearnMin() + time.intValue()) >= fileRef.getNeedLearn() ? fileRef.getNeedLearn() : learn.getLearnMin() + time.intValue());
             learn.setUpdateTime(new Date());
             this.updateById(learn);
         }

+ 9 - 0
exam-06173-api/src/main/java/com/gyee/exam/modules/course/service/impl/CourseLearnServiceImpl.java

@@ -2,6 +2,7 @@ package com.gyee.exam.modules.course.service.impl;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.gyee.boot.base.api.api.dto.BaseUserQueryReqDTO;
 import com.gyee.boot.base.api.api.dto.PagingReqDTO;
 import com.gyee.exam.modules.course.dto.CourseLearnDTO;
 import com.gyee.exam.modules.course.dto.request.CourseLearnReqDTO;
@@ -62,4 +63,12 @@ public class CourseLearnServiceImpl extends ServiceImpl<CourseLearnMapper, Cours
         this.updateBatchById(list);
 
     }
+
+    @Override
+    public List<CourseLearnDTO> getCourseLearnFinishTime(BaseUserQueryReqDTO reqDTO) {
+        List<CourseLearnDTO>  dtos = baseMapper.selectCourseLearnFinishTime(reqDTO);
+        return dtos;
+    }
+
+
 }

+ 20 - 1
exam-06173-api/src/main/java/com/gyee/exam/modules/course/service/impl/CourseServiceImpl.java

@@ -14,9 +14,11 @@ import com.gyee.boot.base.api.utils.BeanMapper;
 import com.gyee.boot.base.api.utils.DecimalUtils;
 import com.gyee.exam.enums.OpenType;
 import com.gyee.exam.modules.course.dto.CourseDTO;
+import com.gyee.exam.modules.course.dto.CourseLearnDTO;
 import com.gyee.exam.modules.course.dto.ext.CourseDetailExtDTO;
 import com.gyee.exam.modules.course.dto.ext.CourseRefDirExtDTO;
 import com.gyee.exam.modules.course.dto.ext.CourseRefFileExtDTO;
+import com.gyee.exam.modules.course.dto.request.CourseOpenDepartReqDTO;
 import com.gyee.exam.modules.course.dto.request.UserCourseReqDTO;
 import com.gyee.exam.modules.course.dto.response.*;
 import com.gyee.exam.modules.course.entity.Course;
@@ -75,6 +77,7 @@ public class CourseServiceImpl extends ServiceImpl<CourseMapper, Course> impleme
     @Autowired
     private  CourseFileLearnService courseFileLearnService;
 
+
     @Override
     public IPage<CourseDTO> paging(PagingReqDTO<CourseDTO> reqDTO) {
 
@@ -228,7 +231,7 @@ public class CourseServiceImpl extends ServiceImpl<CourseMapper, Course> impleme
         page.getRecords().stream().forEach(i->{
             i.setNeedLearnCount(map.get(i.getId()).getNeedLearn());
             i.setLearnMinCount(map.get(i.getId()).getLearnMin());
-            i.setProportion(DecimalUtils.round(map.get(i.getId()).getLearnMin() / map.get(i.getId()).getNeedLearn(), 2));
+            i.setProportion(DecimalUtils.round(null == map.get(i.getId()).getLearnMin() ? 0 : map.get(i.getId()).getLearnMin() / map.get(i.getId()).getNeedLearn(), 2));
         });
         return page;
     }
@@ -355,15 +358,31 @@ public class CourseServiceImpl extends ServiceImpl<CourseMapper, Course> impleme
 
         List<CourseUserIdTotalDTO> dtoList = baseMapper.selectCourseUserIdTotal(reqDTO);
         List<CourseUserIdTotalDTO> mindtos = courseFileLearnService.getCourseUserIdTotalMin(reqDTO);
+        List<CourseLearnDTO> learndtos =  courseLearnService.getCourseLearnFinishTime(reqDTO);
         if(null != mindtos && mindtos.size()>0){
             Map<String,Integer> map = mindtos.stream().collect(Collectors.toMap(CourseUserIdTotalDTO::getId, CourseUserIdTotalDTO::getLearnMin));
             dtoList.stream().forEach(d->{
                 d.setLearnMin(map.get(d.getId()));
             });
         }
+
+        if(null != learndtos && learndtos.size()>0){
+            Map<String,List<CourseLearnDTO> > groupmap = learndtos.stream().collect(Collectors.groupingBy(CourseLearnDTO::getCourseId));
+            dtoList.stream().forEach(d->{
+                d.setUpdateTime(groupmap.get(d.getId()).get(0).getUpdateTime());
+                d.setFinishTime(groupmap.get(d.getId()).get(0).getFinishTime());
+            });
+        }
+
         return dtoList;
 
     }
 
+    @Override
+    public List<CourseOpenDepartDTO> getCourseOpenDepart(CourseOpenDepartReqDTO reqDTO) {
+        List<CourseOpenDepartDTO> dtos = baseMapper.selectCourseOpenDepart(reqDTO);
+        return dtos;
+    }
+
 
 }

+ 3 - 0
exam-06173-api/src/main/java/com/gyee/exam/modules/exam/dto/ExamDTO.java

@@ -149,4 +149,7 @@ public class ExamDTO implements Serializable {
     @ApiModelProperty(value = "数据标识", required=true)
     private Integer dataFlag;
 
+    @ApiModelProperty(value = "是否关联考试 1:关联;0:未关联")
+    private Integer associate;
+
 }

+ 9 - 0
exam-06173-api/src/main/java/com/gyee/exam/modules/exam/dto/response/ExamCheckRespDTO.java

@@ -37,6 +37,15 @@ public class ExamCheckRespDTO extends ExamDTO {
     @ApiModelProperty(value = "null=未学习,0=学习中,1=已学完")
     private Integer finish;
 
+    @Override
+    public Integer getAssociate() {
+
+        if (null != getCourseId() && getCourseId().length()>0){
+            return 1;
+        }
+        return super.getAssociate();
+    }
+
     /**
      * 是否迟到
      * @return

+ 7 - 8
exam-06173-api/src/main/java/com/gyee/exam/modules/exam/dto/response/ExamOnlineRespDTO.java

@@ -23,16 +23,15 @@ public class ExamOnlineRespDTO extends ExamDTO {
     @ApiModelProperty(value = "我的考试次数", required=true)
     private Integer tryCount;
 
-    @ApiModelProperty(value = "是否关联考试 1:关联;0:未关联")
-    private Integer associate;
-
-
-
-
-
-
 
+    @Override
+    public Integer getAssociate() {
 
+        if (null != getCourseId() && getCourseId().length()>0){
+            return 1;
+        }
+        return super.getAssociate();
+    }
 
     /**
      * 是否结束

+ 3 - 0
exam-06173-api/src/main/java/com/gyee/exam/modules/exam/dto/response/ExamUseridTotalDTO.java

@@ -33,4 +33,7 @@ public class ExamUseridTotalDTO {
     @ApiModelProperty(value = "是否关联课程")
     private int associate;
 
+    @ApiModelProperty(value = "考试详情id")
+    private String  paperId;
+
 }

+ 4 - 0
exam-06173-api/src/main/java/com/gyee/exam/modules/exam/service/impl/ExamServiceImpl.java

@@ -187,6 +187,10 @@ public class ExamServiceImpl extends ServiceImpl<ExamMapper, Exam> implements Ex
             StatCourseLearnDTO state = statCourseService.checkUserCourseStat(dto);
             respDTO.setFinish(state.getState());
         }
+
+//        if(null == respDTO.getFinish() || respDTO.getFinish()<1){
+//            throw new ServiceException("请考生完成相关培训课程再来考试!");
+//        }
         return respDTO;
     }
 

+ 1 - 1
exam-06173-api/src/main/java/com/gyee/exam/modules/paper/service/impl/PaperServiceImpl.java

@@ -123,7 +123,7 @@ public class PaperServiceImpl extends ServiceImpl<PaperMapper, Paper> implements
 
 
         //
-        if(null != check.getFinish() && check.getFinish()<1){
+        if(null != check.getAssociate() && check.getAssociate()>0 &&(null == check.getFinish() || check.getFinish()<1)){
             throw new ServiceException("请考生完成相关培训课程再来考试!");
         }
 

+ 3 - 0
exam-06173-api/src/main/java/com/gyee/exam/modules/sys/user/dto/request/SysUserLoginReqDTO.java

@@ -32,4 +32,7 @@ public class SysUserLoginReqDTO implements Serializable {
     @ApiModelProperty(value = "用户输入的验证码值", required=true)
     private String captchaValue;
 
+    @ApiModelProperty(value = "系统单点登录字段")
+    private String mark;
+
 }

+ 40 - 10
exam-06173-api/src/main/java/com/gyee/exam/modules/sys/user/service/impl/SysUserServiceImpl.java

@@ -141,20 +141,28 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
     @Override
     public SysUserLoginDTO login(SysUserLoginReqDTO reqDTO) {
 
-        // 校验图形验证码
-//        if (!StringUtils.isBlank(reqDTO.getCaptchaKey())) {
-//            boolean check = captchaService.checkCaptcha(reqDTO.getCaptchaKey(), reqDTO.getCaptchaValue());
-//            if (!check) {
-//                throw new ServiceException("图形验证码不正确或已失效!");
-//            }
-//        }
+
 
         QueryWrapper<SysUser> wrapper = new QueryWrapper<>();
         wrapper.lambda().eq(SysUser::getUserName, reqDTO.getUsername());
-        SysUser user = this.getOne(wrapper, false);
+        SysUser user;
+
+        if(null == reqDTO.getMark() || reqDTO.getMark().trim().length()<1){
+            // 校验图形验证码
+            if (!StringUtils.isBlank(reqDTO.getCaptchaKey())) {
+                boolean check = captchaService.checkCaptcha(reqDTO.getCaptchaKey(), reqDTO.getCaptchaValue());
+                if (!check) {
+                    throw new ServiceException("图形验证码不正确或已失效!");
+                }
+            }
+            user = this.getOne(wrapper, false);
+            // 校验用户状态&密码
+            return this.checkAndLogin(user, reqDTO.getPassword());
+        }else {
+            user = this.getOne(wrapper, false);
+            return this.checkAndMark(user,reqDTO.getMark());
+        }
 
-        // 校验用户状态&密码
-        return this.checkAndLogin(user, reqDTO.getPassword());
     }
 
     @Override
@@ -261,6 +269,28 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
         return this.setToken(user);
     }
 
+
+    private SysUserLoginDTO checkAndMark(SysUser user, String mark) {
+
+        if (user == null) {
+            throw new ServiceException(ApiError.ERROR_90010001);
+        }
+
+        // 被禁用
+        if (user.getState().equals(CommonState.ABNORMAL)) {
+            throw new ServiceException(ApiError.ERROR_90010005);
+        }
+
+        if (!StringUtils.isBlank(mark)) {
+            boolean pass = PassHandler.checkMark(user.getUserName(), "gdnxfdexam321", mark);
+            if (!pass) {
+                throw new ServiceException(ApiError.ERROR_90010008);
+            }
+        }
+
+        return this.setToken(user);
+    }
+
     @Override
     public SysUserLoginDTO token(String token) {
 

+ 1 - 0
exam-06173-api/src/main/resources/mapper/course/CourseDepartMapper.xml

@@ -46,6 +46,7 @@
         </where>
         group by uc.user_name,uc.real_name, uc.id
         ORDER BY total DESC
+        LIMIT 20
 
     </select>
 

+ 29 - 0
exam-06173-api/src/main/resources/mapper/course/CourseLearnMapper.xml

@@ -61,4 +61,33 @@
         FROM el_course_learn cl WHERE course_id=#{courseId}
     </select>
 
+
+    <select id="selectCourseLearnFinishTime" resultType="com.gyee.exam.modules.course.dto.CourseLearnDTO">
+
+
+        SELECT cl.* FROM el_course_learn cl
+        LEFT JOIN sys_user uc ON cl.user_id=uc.id
+        LEFT JOIN el_course cs ON cl.course_id=cs.id
+
+        <where>
+            and uc.id IS NOT NULL AND cs.id IS NOT NULL
+            <if test="query!=null">
+
+                <if test="query.statDateL!=null ">
+                    AND cs.create_time >= #{query.statDateL}
+                </if>
+
+                <if test="query.statDateR!=null ">
+                    AND cs.create_time &lt; #{query.statDateR}
+                </if>
+
+                <if test="query.userName!=null and query.userName!=''">
+                    AND uc.user_name = #{query.userName}
+                </if>
+
+            </if>
+        </where>
+
+    </select>
+
 </mapper>

+ 18 - 3
exam-06173-api/src/main/resources/mapper/course/CourseMapper.xml

@@ -342,9 +342,6 @@
 					SUM(ec.periods) periods,
 					SUM(rf.need_learn) needLearn,
                     ec.create_time createTime
-
-
-
 					from  el_course ec
 					INNER JOIN el_course_ref_file rf ON rf.course_id = ec.id
 					LEFT JOIN el_course_learn  cl  ON cl.course_id = ec.id
@@ -373,5 +370,23 @@
 
     </select>
 
+    <select id="selectCourseOpenDepart"
+            resultType="com.gyee.exam.modules.course.dto.response.CourseOpenDepartDTO">
+            select
+            sd.id deptId,
+            cd.dept_code deptCode,
+            sd.dept_name  deptName,
+            cd.course_id courseId
+
+            from  el_course_depart cd
+                LEFT JOIN sys_depart sd on cd.dept_code = sd.dept_code
+            <where>
+                <if test="query.courseId!=null and query.courseId!=''">
+                    AND cd.course_id  = #{query.courseId}
+                </if>
+            </where>
+
+    </select>
+
 
 </mapper>

+ 5 - 2
exam-06173-api/src/main/resources/mapper/exam/ExamDepartMapper.xml

@@ -30,7 +30,7 @@
             <if test="query!=null">
 
                 <if test="query.statDateL!=null ">
-                    AND ee.start_time >=    #{query.statDateL}
+                    AND ee.start_time >= #{query.statDateL}
                 </if>
 
                 <if test="query.statDateR!=null ">
@@ -45,6 +45,7 @@
 
         </where>
         GROUP BY  dept.dept_code
+        ORDER BY  passed DESC
 
 
     </select>
@@ -78,7 +79,9 @@
 
         </if>
 
-        GROUP BY uc.user_name,uc.real_name order by passed desc
+        GROUP BY uc.user_name,uc.real_name
+        order by passed desc
+        LIMIT 20
 
 
     </select>

+ 1 - 0
exam-06173-api/src/main/resources/mapper/exam/ExamMapper.xml

@@ -335,6 +335,7 @@
 					ec.id id,
                     ec.tmpl_id tmplId,
 				    ec.title title,
+                    ep.id paperId,
 					ep.create_time startTime,
 					ep.limit_time endTime,
 					ep.user_score score