Explorar el Código

Merge branch 'dev_v2.1.0' into release_v2.1.0
merge

wangliang hace 4 años
padre
commit
6b64a1173d

+ 2 - 2
distributed-print/src/main/resources/application-dev.properties

@@ -69,8 +69,8 @@ com.qmth.api.global-auth=true
 #com.qmth.api.global-rate-limit=1/5s
 
 #token\u8D85\u65F6\u914D\u7F6E
-com.qmth.api.auth.time-max-ahead=-5
-com.qmth.api.auth.time-max-delay=30
+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 - 2
distributed-print/src/main/resources/application-release.properties

@@ -69,8 +69,8 @@ com.qmth.api.global-auth=true
 #com.qmth.api.global-rate-limit=1/5s
 
 #token\u8D85\u65F6\u914D\u7F6E
-com.qmth.api.auth.time-max-ahead=-5
-com.qmth.api.auth.time-max-delay=30
+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 - 2
distributed-print/src/main/resources/application-test.properties

@@ -69,8 +69,8 @@ com.qmth.api.global-auth=true
 #com.qmth.api.global-rate-limit=1/5s
 
 #token\u8D85\u65F6\u914D\u7F6E
-com.qmth.api.auth.time-max-ahead=-5
-com.qmth.api.auth.time-max-delay=30
+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

+ 5 - 5
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/bean/result/TeacherMyClassRankResult.java

@@ -10,7 +10,7 @@ public class TeacherMyClassRankResult {
     private String courseCode;
     private String courseName;
     private String teachCollegeName;
-    private Double scoreAssign;
+    private Double avgScore;
     private Integer teacherCount;
     private Integer rank;
 
@@ -54,12 +54,12 @@ public class TeacherMyClassRankResult {
         this.teachCollegeName = teachCollegeName;
     }
 
-    public Double getScoreAssign() {
-        return scoreAssign;
+    public Double getAvgScore() {
+        return avgScore;
     }
 
-    public void setScoreAssign(Double scoreAssign) {
-        this.scoreAssign = scoreAssign;
+    public void setAvgScore(Double avgScore) {
+        this.avgScore = avgScore;
     }
 
     public Integer getTeacherCount() {

+ 25 - 10
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/service/AnalyzeForReportService.java

@@ -83,11 +83,12 @@ public interface AnalyzeForReportService {
 
     /**
      * 构建考试课程教师维度分析表
-     * @param examId 考试id
+     *
+     * @param examId     考试id
      * @param courseCode 课程编号
      * @return 结果
      */
-    String buildAnalyzeExamCourseTeacherDio(Long examId,String courseCode);
+    String buildAnalyzeExamCourseTeacherDio(Long examId, String courseCode);
 
     /**
      * 构建分析试卷结构表 't_a_paper_struct'表
@@ -109,11 +110,12 @@ public interface AnalyzeForReportService {
 
     /**
      * 构建科目题目难度分类得分率表 - 教师与学校
-     * @param examId 考试id
+     *
+     * @param examId     考试id
      * @param courseCode 课程编号
      * @return 结果
      */
-    String buildExamPaperTeacherDifficult(Long examId,String courseCode);
+    String buildExamPaperTeacherDifficult(Long examId, String courseCode);
 
     /**
      * 构建表 ‘t_a_exam_total’
@@ -143,8 +145,9 @@ public interface AnalyzeForReportService {
 
     /**
      * 更新表 't_b_exam_course'表 状态
-     * @param examId 考试id
-     * @param courseCode 课程编号
+     *
+     * @param examId            考试id
+     * @param courseCode        课程编号
      * @param publishStatusEnum 发布状态
      * @return 结果
      */
@@ -152,13 +155,15 @@ public interface AnalyzeForReportService {
 
     /**
      * 数据计算总控
-     * @param examId 考试id
+     *
+     * @param examId     考试id
      * @param courseCode 课程代码
      */
     void dataCalculate(Long examId, String courseCode) throws Exception;
 
     /**
      * 计算前的准备工作 1.计算中状态报错 2.把其他状态改为计算中
+     *
      * @param examId
      * @param courseCode
      */
@@ -166,9 +171,19 @@ public interface AnalyzeForReportService {
 
     /**
      * 发布/撤回、报告
-     * @param examId 考试id
-     * @param courseCode 课程编号
+     *
+     * @param examId            考试id
+     * @param courseCode        课程编号
      * @param publishStatusEnum 发布状态
      */
-    void publishReport(Long examId,String courseCode,PublishStatusEnum publishStatusEnum);
+    void publishReport(Long examId, String courseCode, PublishStatusEnum publishStatusEnum);
+
+    /**
+     * 公式赋分方法
+     *
+     * @param examId     考试id
+     * @param schoolId   学校id
+     * @param courseCode 课程代码
+     */
+    void normalAssignScore(Long examId, Long schoolId, String courseCode);
 }

+ 68 - 0
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/service/impl/AnalyzeForReportServiceImpl.java

@@ -9,6 +9,7 @@ import com.qmth.teachcloud.common.service.SysOrgService;
 import com.qmth.teachcloud.common.service.SysUserService;
 import com.qmth.teachcloud.report.business.bean.dto.AnswerDetailBean;
 import com.qmth.teachcloud.report.business.bean.dto.query.BasicAnswerDto;
+import com.qmth.teachcloud.report.business.bean.dto.query.BasicExamRecordDto;
 import com.qmth.teachcloud.report.business.bean.dto.query.ValidAnswerDetailDto;
 import com.qmth.teachcloud.report.business.entity.*;
 import com.qmth.teachcloud.report.business.enums.LevelRuleEnum;
@@ -96,6 +97,8 @@ public class AnalyzeForReportServiceImpl implements AnalyzeForReportService {
     private TAExamCourseTeacherDifficultService taExamCourseTeacherDifficultService;
     @Resource
     private TAExamCourseTeacherDioService taExamCourseTeacherDioService;
+    @Resource
+    private TBExamRecordService tbExamRecordService;
 
 
     @Transactional(rollbackFor = Exception.class)
@@ -1454,6 +1457,71 @@ public class AnalyzeForReportServiceImpl implements AnalyzeForReportService {
         tbExamCourseService.updateById(tbExamCourse);
     }
 
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public void normalAssignScore(Long examId, Long schoolId, String courseCode) {
+        List<String> courseCodeList = new ArrayList<>();
+        courseCodeList.add(courseCode);
+
+        // 数据同步操作
+        // 获取当前课程下所有学生考试成绩记录
+        List<BasicExamRecordDto> basicExamRecordDtoDatasource = tbExamRecordService.findByExamIdAndCourseCodeS(examId, courseCodeList);
+        for (String s : courseCodeList) {
+            if (tbExamCourseService.verifyExamCourseCantRun(examId, schoolId, s, basicCourseService.findByCourseCode(s).getName())) {
+                throw ExceptionResultEnum.ERROR.exception("课程编号[" + s + "]的课程分析数据已测试或发布,不能变更基础数据");
+            }
+            List<BasicExamRecordDto> basicExamRecordDtoList = basicExamRecordDtoDatasource.stream()
+                    .filter(e -> s.equals(e.getCourseCode())).collect(Collectors.toList());
+            if (basicExamRecordDtoList.size() > 0) {
+                // 删除源数据
+                taExamCourseRecordService.remove(new QueryWrapper<TAExamCourseRecord>()
+                        .lambda().eq(TAExamCourseRecord::getExamId, examId).eq(TAExamCourseRecord::getCourseCode, s));
+                // 迁移数据至't_a_exam_course_record'
+                List<TAExamCourseRecord> taExamCourseRecordList = new ArrayList<>();
+                for (BasicExamRecordDto basicExamRecordDto : basicExamRecordDtoList) {
+                    boolean absent = basicExamRecordDto.getAbsent();
+                    // 正常公式赋分操作
+                    Long paperId = basicExamRecordDto.getPaperId();
+                    TBPaper tbPaper = tbPaperService.getById(paperId);
+                    if (Objects.isNull(tbPaper)) {
+                        throw ExceptionResultEnum.ERROR.exception("试卷信息数据异常");
+                    }
+                    BigDecimal fullScore = tbPaper.getTotalScore();
+                    BigDecimal myScore = basicExamRecordDto.getTotalScore();
+                    BigDecimal coefficient = tbPaper.getCoefficient();
+                    BigDecimal assignScore;
+                    // 当该试卷的赋分系数不为0时赋分
+                    if (coefficient != null && coefficient.compareTo(BigDecimal.ZERO) > 0 && !absent) {
+                        assignScore = myScore.add((fullScore.subtract(myScore)).divide(coefficient, 4, BigDecimal.ROUND_HALF_UP)).setScale(0,BigDecimal.ROUND_HALF_UP);
+                    } else {
+                        assignScore = myScore;
+                    }
+                    TAExamCourseRecord taExamCourseRecord = new TAExamCourseRecord();
+                    taExamCourseRecord.setId(SystemConstant.getDbUuid());
+                    taExamCourseRecord.setExamRecordId(basicExamRecordDto.getTbExamRecordId());
+                    // 数据同步默认赋分成绩为卷面成绩
+                    taExamCourseRecord.setSchoolId(tbExamService.getById(examId).getSchoolId());
+                    taExamCourseRecord.setAssignedScore(assignScore);
+                    taExamCourseRecord.setExamId(examId);
+                    taExamCourseRecord.setCourseCode(basicExamRecordDto.getCourseCode());
+                    taExamCourseRecord.setPaperId(basicExamRecordDto.getPaperId());
+                    taExamCourseRecord.setPaperType(basicExamRecordDto.getPaperType());
+                    taExamCourseRecord.setStudentId(basicExamRecordDto.getStudentId());
+                    taExamCourseRecord.setStudentCode(basicExamRecordDto.getStudentCode());
+                    taExamCourseRecord.setTeacherId(basicExamRecordDto.getTeacherId());
+                    taExamCourseRecord.setClazzId(basicExamRecordDto.getClazzId());
+                    taExamCourseRecord.setTeachCollegeId(basicExamRecordDto.getTeachCollegeId());
+                    taExamCourseRecord.setInspectCollegeId(basicExamRecordDto.getInspectCollegeId());
+                    taExamCourseRecord.setMajorId(basicExamRecordDto.getMajorId());
+                    taExamCourseRecord.setTotalScore(myScore);
+                    taExamCourseRecord.setAbsent(absent);
+                    taExamCourseRecord.setStudentCurrent(basicExamRecordDto.getStudentCurrent());
+                    taExamCourseRecordList.add(taExamCourseRecord);
+                }
+                taExamCourseRecordService.saveBatch(taExamCourseRecordList);
+            }
+        }
+    }
 
 
     private void verifyComputing(Long examId,String courseCode){

+ 7 - 1
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/templete/execute/AsyncDataCalculateTempleteService.java

@@ -12,12 +12,14 @@ import com.qmth.teachcloud.report.business.entity.TBExamCourse;
 import com.qmth.teachcloud.report.business.enums.PublishStatusEnum;
 import com.qmth.teachcloud.report.business.service.AnalyzeForReportService;
 import com.qmth.teachcloud.report.business.service.TBExamCourseService;
+import com.qmth.teachcloud.report.business.service.TBExamService;
 import com.qmth.teachcloud.report.business.templete.calculate.AsyncCalculateTaskTemplete;
 import com.qmth.teachcloud.report.business.templete.service.TaskCalculateService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Service;
 
+import javax.annotation.Resource;
 import java.io.IOException;
 import java.util.Map;
 
@@ -28,6 +30,8 @@ import java.util.Map;
  */
 @Service
 public class AsyncDataCalculateTempleteService extends AsyncCalculateTaskTemplete {
+    @Resource
+    private TBExamService tbExamService;
     private final static Logger log = LoggerFactory.getLogger(AsyncDataCalculateTempleteService.class);
     @Override
     public Result calculateTask(Map<String, Object> map) {
@@ -47,8 +51,10 @@ public class AsyncDataCalculateTempleteService extends AsyncCalculateTaskTemplet
                 .eq(TBExamCourse::getCourseCode,courseCode));
         PublishStatusEnum oldStatus =  tbExamCourse.getPublishStatus();
 
-        analyzeForReportService.realityForCalculate(examId,courseCode);
+
         try {
+            analyzeForReportService.normalAssignScore(examId,tbExamService.getById(examId).getSchoolId(),courseCode);
+            analyzeForReportService.realityForCalculate(examId,courseCode);
             TaskCalculateService taskCalculateService = SpringContextHolder.getBean(TaskCalculateService.class);
             taskCalculateService.dataCalculate(map);
             tbExamCourse.setPublishStatus(PublishStatusEnum.UN_PUBLISH);

+ 3 - 61
teachcloud-report/src/main/java/com/qmth/teachcloud/report/api/BasicDatasourceController.java

@@ -98,6 +98,8 @@ public class BasicDatasourceController {
     private TBCommonRankLevelConfigService tbCommonRankLevelConfigService;
     @Resource
     private SysRoleService sysRoleService;
+    @Resource
+    private AnalyzeForReportService analyzeForReportService;
 
     @ApiOperation(value = "试卷数据导入")
     @RequestMapping(value = "/paper/import", method = RequestMethod.POST)
@@ -696,67 +698,7 @@ public class BasicDatasourceController {
     @Transactional(rollbackFor = Exception.class)
     @ApiResponses({@ApiResponse(code = 200, message = "{\"success\":true}", response = Result.class)})
     public Result normalAssignScore(@RequestParam Long examId, @RequestParam Long schoolId, @RequestParam String courseCode) throws IOException, NoSuchFieldException {
-        List<String> courseCodeList = new ArrayList<>();
-        courseCodeList.add(courseCode);
-
-        // 数据同步操作
-        // 获取当前课程下所有学生考试成绩记录
-        List<BasicExamRecordDto> basicExamRecordDtoDatasource = tbExamRecordService.findByExamIdAndCourseCodeS(examId, courseCodeList);
-        for (String s : courseCodeList) {
-            if (tbExamCourseService.verifyExamCourseCantRun(examId, schoolId, s, basicCourseService.findByCourseCode(s).getName())) {
-                throw ExceptionResultEnum.ERROR.exception("课程编号[" + s + "]的课程分析数据已测试或发布,不能变更基础数据");
-            }
-            List<BasicExamRecordDto> basicExamRecordDtoList = basicExamRecordDtoDatasource.stream()
-                    .filter(e -> s.equals(e.getCourseCode())).collect(Collectors.toList());
-            if (basicExamRecordDtoList.size() > 0) {
-                // 删除源数据
-                taExamCourseRecordService.remove(new QueryWrapper<TAExamCourseRecord>()
-                        .lambda().eq(TAExamCourseRecord::getExamId, examId).eq(TAExamCourseRecord::getCourseCode, s));
-                // 迁移数据至't_a_exam_course_record'
-                List<TAExamCourseRecord> taExamCourseRecordList = new ArrayList<>();
-                for (BasicExamRecordDto basicExamRecordDto : basicExamRecordDtoList) {
-                    boolean absent = basicExamRecordDto.getAbsent();
-                    // 正常公式赋分操作
-                    Long paperId = basicExamRecordDto.getPaperId();
-                    TBPaper tbPaper = tbPaperService.getById(paperId);
-                    if (Objects.isNull(tbPaper)) {
-                        throw ExceptionResultEnum.ERROR.exception("试卷信息数据异常");
-                    }
-                    BigDecimal fullScore = tbPaper.getTotalScore();
-                    BigDecimal myScore = basicExamRecordDto.getTotalScore();
-                    BigDecimal coefficient = tbPaper.getCoefficient();
-                    BigDecimal assignScore;
-                    // 当该试卷的赋分系数不为0时赋分
-                    if (coefficient != null && coefficient.compareTo(BigDecimal.ZERO) > 0 && !absent) {
-                        assignScore = myScore.add((fullScore.subtract(myScore)).divide(coefficient, 4, BigDecimal.ROUND_HALF_UP)).setScale(0,BigDecimal.ROUND_HALF_UP);
-                    } else {
-                        assignScore = myScore;
-                    }
-                    TAExamCourseRecord taExamCourseRecord = new TAExamCourseRecord();
-                    taExamCourseRecord.setId(SystemConstant.getDbUuid());
-                    taExamCourseRecord.setExamRecordId(basicExamRecordDto.getTbExamRecordId());
-                    // 数据同步默认赋分成绩为卷面成绩
-                    taExamCourseRecord.setSchoolId(tbExamService.getById(examId).getSchoolId());
-                    taExamCourseRecord.setAssignedScore(assignScore);
-                    taExamCourseRecord.setExamId(examId);
-                    taExamCourseRecord.setCourseCode(basicExamRecordDto.getCourseCode());
-                    taExamCourseRecord.setPaperId(basicExamRecordDto.getPaperId());
-                    taExamCourseRecord.setPaperType(basicExamRecordDto.getPaperType());
-                    taExamCourseRecord.setStudentId(basicExamRecordDto.getStudentId());
-                    taExamCourseRecord.setStudentCode(basicExamRecordDto.getStudentCode());
-                    taExamCourseRecord.setTeacherId(basicExamRecordDto.getTeacherId());
-                    taExamCourseRecord.setClazzId(basicExamRecordDto.getClazzId());
-                    taExamCourseRecord.setTeachCollegeId(basicExamRecordDto.getTeachCollegeId());
-                    taExamCourseRecord.setInspectCollegeId(basicExamRecordDto.getInspectCollegeId());
-                    taExamCourseRecord.setMajorId(basicExamRecordDto.getMajorId());
-                    taExamCourseRecord.setTotalScore(myScore);
-                    taExamCourseRecord.setAbsent(absent);
-                    taExamCourseRecord.setStudentCurrent(basicExamRecordDto.getStudentCurrent());
-                    taExamCourseRecordList.add(taExamCourseRecord);
-                }
-                taExamCourseRecordService.saveBatch(taExamCourseRecordList);
-            }
-        }
+        analyzeForReportService.normalAssignScore(examId, schoolId, courseCode);
         return ResultUtil.ok(Collections.singletonMap(SystemConstant.SUCCESS, true));
     }
 

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

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

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

@@ -70,8 +70,8 @@ com.qmth.api.global-auth=false
 #com.qmth.api.global-rate-limit=1/5s
 
 #token\u8D85\u65F6\u914D\u7F6E
-com.qmth.api.auth.time-max-ahead=1m
-com.qmth.api.auth.time-max-delay=5m
+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

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

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