瀏覽代碼

Merge remote-tracking branch 'origin/dev_v2.1.0' into dev_v2.1.0

caozixuan 4 年之前
父節點
當前提交
37dea36d83

+ 4 - 1
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/mapper/TAExamCourseMapper.java

@@ -10,6 +10,7 @@ import com.qmth.teachcloud.report.business.entity.TAExamCourse;
 import com.qmth.teachcloud.report.business.enums.SemesterEnum;
 import org.apache.ibatis.annotations.Param;
 
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -44,12 +45,14 @@ public interface TAExamCourseMapper extends BaseMapper<TAExamCourse> {
      * @param examId
      * @param courseCode
      * @param publishStatus
+     * @param collegeIds
      * @return
      */
     IPage<TAExamCourseResult> surveyAspointsList(IPage<Map> iPage, @Param("schoolId") Long schoolId, @Param("examId") Long examId,
                                                  @Param("courseCode") String courseCode,
                                                  @Param("publishStatus") String publishStatus,
-                                                 @Param("semester") String semester);
+                                                 @Param("semester") String semester,
+                                                 @Param("collegeIds") List<Long> collegeIds);
 
     Map<String, String> getScoreAndRate(@Param("schoolId") Long schoolId, @Param("semester") String semester, @Param("examId") Long examId, @Param("courseCode") String courseCode);
 

+ 18 - 6
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/service/impl/TAExamCourseServiceImpl.java

@@ -4,8 +4,10 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.qmth.teachcloud.common.contant.SystemConstant;
+import com.qmth.teachcloud.common.entity.SysOrg;
 import com.qmth.teachcloud.common.entity.SysUser;
 import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
+import com.qmth.teachcloud.common.service.SysOrgService;
 import com.qmth.teachcloud.common.util.ServletUtil;
 import com.qmth.teachcloud.report.business.bean.result.*;
 import com.qmth.teachcloud.report.business.entity.TAExamCourse;
@@ -52,7 +54,7 @@ public class TAExamCourseServiceImpl extends ServiceImpl<TAExamCourseMapper, TAE
     TBPaperService tbPaperService;
 
     @Resource
-    TAExamCourseService taExamCourseService;
+    SysOrgService sysOrgService;
 
     @Resource
     TBExamService tbExamService;
@@ -70,7 +72,7 @@ public class TAExamCourseServiceImpl extends ServiceImpl<TAExamCourseMapper, TAE
     public IPage<TAExamCourseResult> surveyTeacherList(IPage<Map> iPage, Long examId, SemesterEnum semester, Long schoolId) {
         SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
         Long collegeId = sysUser.getOrgId();
-        return taExamCourseMapper.surveyTeacherList(iPage, examId, Objects.nonNull(semester) ? semester.name() : null, schoolId,collegeId);
+        return taExamCourseMapper.surveyTeacherList(iPage, examId, Objects.nonNull(semester) ? semester.name() : null, schoolId, collegeId);
     }
 
 
@@ -93,7 +95,17 @@ public class TAExamCourseServiceImpl extends ServiceImpl<TAExamCourseMapper, TAE
      */
     @Override
     public IPage<TAExamCourseResult> surveyAspointsList(IPage<Map> iPage, Long schoolId, Long examId, String courseCode, PublishStatusEnum publishStatus, SemesterEnum semester) {
-        return taExamCourseMapper.surveyAspointsList(iPage, schoolId, examId, courseCode, Objects.nonNull(publishStatus) ? publishStatus.name() : null, Objects.nonNull(semester) ? semester.name() : null);
+        SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
+        QueryWrapper<SysOrg> sysOrgQueryWrapper = new QueryWrapper<>();
+        sysOrgQueryWrapper.lambda().eq(SysOrg::getParentId, sysUser.getOrgId())
+                .eq(SysOrg::getEnable, true);
+        List<SysOrg> sysOrgList = sysOrgService.list(sysOrgQueryWrapper);
+        if (Objects.nonNull(sysOrgList) && sysOrgList.size() > 0) {
+            List<Long> collegeIds = sysOrgList.stream().map(s -> s.getId()).collect(Collectors.toList());
+            return taExamCourseMapper.surveyAspointsList(iPage, schoolId, examId, courseCode, Objects.nonNull(publishStatus) ? publishStatus.name() : null, Objects.nonNull(semester) ? semester.name() : null, collegeIds);
+        } else {
+            return taExamCourseMapper.surveyAspointsList(iPage, schoolId, examId, courseCode, Objects.nonNull(publishStatus) ? publishStatus.name() : null, Objects.nonNull(semester) ? semester.name() : null, Arrays.asList(sysUser.getOrgId()));
+        }
     }
 
     @Override
@@ -249,9 +261,9 @@ public class TAExamCourseServiceImpl extends ServiceImpl<TAExamCourseMapper, TAE
         for (TAExamCourseRecord taExamCourseRecord : taExamCourseRecordList) {
             BigDecimal paperScore = taExamCourseRecord.getTotalScore();
             BigDecimal assignScore;
-            if (coefficient.compareTo(BigDecimal.ZERO) != 0){
-                 assignScore = paperScore.add((fullScore.subtract(paperScore)).divide(coefficient, 4, BigDecimal.ROUND_HALF_UP));
-            }else {
+            if (coefficient.compareTo(BigDecimal.ZERO) != 0) {
+                assignScore = paperScore.add((fullScore.subtract(paperScore)).divide(coefficient, 4, BigDecimal.ROUND_HALF_UP));
+            } else {
                 assignScore = paperScore;
             }
 

+ 6 - 0
teachcloud-report-business/src/main/resources/mapper/TAExamCourseMapper.xml

@@ -76,6 +76,12 @@
             <if test="publishStatus != null and publishStatus != ''">
                 and tbec.publish_status = #{publishStatus}
             </if>
+            <if test="collegeIds != null and collegeIds != ''">
+                    and taec.teach_college_id in
+                <foreach collection="collegeIds" item="collegeId" index="index" open="(" separator="," close=")">
+                    #{collegeId}
+                </foreach>
+            </if>
         </where>
     </select>
 

+ 2 - 4
teachcloud-report/src/main/resources/application-dev.properties

@@ -72,10 +72,8 @@ com.qmth.api.global-auth=true
 #com.qmth.api.global-rate-limit=1/5s
 
 #token\u8D85\u65F6\u914D\u7F6E
-#com.qmth.auth.time-max-ahead=1m
-#com.qmth.auth.time-max-delay=5m
-com.qmth.auth.time-max-ahead=2h
-com.qmth.auth.time-max-delay=2h
+com.qmth.auth.time-max-ahead=1m
+com.qmth.auth.time-max-delay=5m
 
 #\u7F13\u5B58\u65F6\u95F4
 com.qmth.cache.expire-after-write=8h

+ 2 - 4
teachcloud-report/src/main/resources/application-test.properties

@@ -70,10 +70,8 @@ com.qmth.api.global-auth=true
 #com.qmth.api.global-rate-limit=1/5s
 
 #token\u8D85\u65F6\u914D\u7F6E
-#com.qmth.auth.time-max-ahead=1m
-#com.qmth.auth.time-max-delay=5m
-com.qmth.auth.time-max-ahead=2h
-com.qmth.auth.time-max-delay=2h
+com.qmth.auth.time-max-ahead=1m
+com.qmth.auth.time-max-delay=5m
 
 #\u7F13\u5B58\u65F6\u95F4
 com.qmth.cache.expire-after-write=8h