caozixuan 4 rokov pred
rodič
commit
1fd50b09b1

+ 3 - 3
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/bean/result/TeachCourseSurveyResult.java

@@ -32,7 +32,7 @@ public class TeachCourseSurveyResult {
     private int absentCount;
 
     @ApiModelProperty(value = "赋分系数")
-    private BigDecimal coefficient;
+    private String coefficient;
 
     @ApiModelProperty(value = "开课学院名称")
     private String teachCollegeName;
@@ -96,11 +96,11 @@ public class TeachCourseSurveyResult {
         this.absentCount = absentCount;
     }
 
-    public BigDecimal getCoefficient() {
+    public String getCoefficient() {
         return coefficient;
     }
 
-    public void setCoefficient(BigDecimal coefficient) {
+    public void setCoefficient(String coefficient) {
         this.coefficient = coefficient;
     }
 

+ 4 - 8
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/entity/TAExamCourse.java

@@ -195,7 +195,7 @@ public class TAExamCourse implements Serializable {
 
     @ApiModelProperty(value = "赋分系数")
     @TableField(value = "coefficient")
-    private BigDecimal coefficient;
+    private String coefficient;
 
     @ApiModelProperty(value = "卷面总体通过人数")
     @TableField(value = "paper_pass_count")
@@ -645,15 +645,11 @@ public class TAExamCourse implements Serializable {
         this.paperCurrentPassRate = paperCurrentPassRate;
     }
 
-    public BigDecimal getCoefficient() {
-        if (Objects.nonNull(coefficient)) {
-            return coefficient.setScale(SystemConstant.CALCULATE_SCALE, BigDecimal.ROUND_HALF_UP);
-        } else {
-            return coefficient;
-        }
+    public String getCoefficient() {
+        return coefficient;
     }
 
-    public void setCoefficient(BigDecimal coefficient) {
+    public void setCoefficient(String coefficient) {
         this.coefficient = coefficient;
     }
 

+ 10 - 5
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/service/impl/AnalyzeForReportServiceImpl.java

@@ -13,10 +13,7 @@ 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;
-import com.qmth.teachcloud.report.business.enums.PublishStatusEnum;
-import com.qmth.teachcloud.report.business.enums.QuantileEnum;
-import com.qmth.teachcloud.report.business.enums.ValidityEnum;
+import com.qmth.teachcloud.report.business.enums.*;
 import com.qmth.teachcloud.report.business.service.*;
 import com.qmth.teachcloud.report.business.utils.AnalyzeScopeUtil;
 import com.qmth.teachcloud.report.business.utils.ConversionUtils;
@@ -129,7 +126,15 @@ public class AnalyzeForReportServiceImpl implements AnalyzeForReportService {
             // 满分
             BigDecimal totalScore = tbPaper.getTotalScore();
             // 赋分系数
-            BigDecimal coefficient = tbPaper.getCoefficient();
+            String coefficient = "";
+            BigDecimal paperCoefficient = tbPaper.getCoefficient();
+            paperCoefficient = paperCoefficient.stripTrailingZeros();
+            AssignEnum assignEnum = tbPaper.getScoreType();
+            if (AssignEnum.SPECIAL_ASSIGN_SCORE.equals(assignEnum)){
+                coefficient = SystemConstant.DEFAULT_SIGN;
+            }else {
+                coefficient = paperCoefficient.toPlainString();
+            }
 
             /*
                 该课程总体学生成绩分析

+ 5 - 8
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/templete/execute/AsyncDataCalculateTempleteService.java

@@ -39,6 +39,8 @@ public class AsyncDataCalculateTempleteService extends AsyncCalculateTaskTemplet
     private AnalyzeForReportService analyzeForReportService;
     @Resource
     private CacheService cacheService;
+    @Resource
+    private TBExamCourseService tbExamCourseService;
 
 
     private final static Logger log = LoggerFactory.getLogger(AsyncDataCalculateTempleteService.class);
@@ -51,15 +53,9 @@ public class AsyncDataCalculateTempleteService extends AsyncCalculateTaskTemplet
         TBTaskService tbTaskService = SpringContextHolder.getBean(TBTaskService.class);
         tbTaskService.updateById(tbTask);
 
-        Long examId = SystemConstant.convertIdToLong(String.valueOf(map.get("examId")));
-        String courseCode = String.valueOf(map.get("courseCode"));
-
-        TBExamCourseService tbExamCourseService = SpringContextHolder.getBean(TBExamCourseService.class);
-        TBExamCourse tbExamCourse = tbExamCourseService.getOne(new QueryWrapper<TBExamCourse>().lambda()
-                .eq(TBExamCourse::getExamId,examId)
-                .eq(TBExamCourse::getCourseCode,courseCode));
+        TBExamCourse tbExamCourse = (TBExamCourse) map.get("tbExamCourse");
         PublishStatusEnum oldStatus =  tbExamCourse.getPublishStatus();
-        analyzeForReportService.realityForCalculate(examId, courseCode);
+
         String exception = null;
 
         try {
@@ -75,6 +71,7 @@ public class AsyncDataCalculateTempleteService extends AsyncCalculateTaskTemplet
             tbExamCourse.setPublishStatus(oldStatus);
         }finally {
             tbExamCourseService.updateById(tbExamCourse);
+            tbTask.setStatus(TaskStatusEnum.FINISH);
             tbTaskService.updateById(tbTask);
             if (Objects.isNull(exception)){
                 cacheService.removeExamStudentReportCache();

+ 10 - 7
teachcloud-report/src/main/java/com/qmth/teachcloud/report/api/CourseController.java

@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.google.common.reflect.TypeToken;
 import com.google.gson.Gson;
 import com.qmth.boot.api.constant.ApiConstant;
+import com.qmth.teachcloud.common.contant.SpringContextHolder;
 import com.qmth.teachcloud.common.contant.SystemConstant;
 import com.qmth.teachcloud.common.entity.SysUser;
 import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
@@ -15,14 +16,12 @@ import com.qmth.teachcloud.common.util.*;
 import com.qmth.teachcloud.report.business.bean.dto.excel.TAExamCourseExportDto;
 import com.qmth.teachcloud.report.business.bean.result.*;
 import com.qmth.teachcloud.report.business.bean.result.inspectCourseExamTotal.InspectCourseTotalReportResult;
+import com.qmth.teachcloud.report.business.entity.TBExamCourse;
 import com.qmth.teachcloud.report.business.entity.TBPaper;
 import com.qmth.teachcloud.report.business.enums.OrderEnum;
 import com.qmth.teachcloud.report.business.enums.PublishStatusEnum;
 import com.qmth.teachcloud.report.business.enums.SemesterEnum;
-import com.qmth.teachcloud.report.business.service.AnalyzeForReportService;
-import com.qmth.teachcloud.report.business.service.CourseReportService;
-import com.qmth.teachcloud.report.business.service.TAExamCourseService;
-import com.qmth.teachcloud.report.business.service.TBPaperService;
+import com.qmth.teachcloud.report.business.service.*;
 import com.qmth.teachcloud.report.business.templete.execute.AsyncDataCalculateTempleteService;
 import io.swagger.annotations.*;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -221,13 +220,17 @@ public class CourseController {
             @ApiParam(value = "科目编码", required = true) @RequestParam String courseCode,
             @ApiParam(value = "赋分系数", required = true) @RequestParam BigDecimal coefficient) {
 
-        if (coefficient.compareTo(BigDecimal.ONE) == 0){
-            throw ExceptionResultEnum.ERROR.exception("赋分系数有误,当赋分系数为1时所有学生成绩均为满分 异常");
-        }
         Map<String, Object> map = tbTaskService.saveTask(TaskTypeEnum.DATA_CALCULATE);
         map.put("examId", examId);
         map.put("courseCode", courseCode);
         map.put("coefficient", coefficient);
+        TBExamCourseService tbExamCourseService = SpringContextHolder.getBean(TBExamCourseService.class);
+        TBExamCourse tbExamCourse = tbExamCourseService.getOne(new QueryWrapper<TBExamCourse>().lambda()
+                .eq(TBExamCourse::getExamId,examId)
+                .eq(TBExamCourse::getCourseCode,courseCode));
+
+        analyzeForReportService.realityForCalculate(SystemConstant.convertIdToLong(examId), courseCode);
+        map.put("tbExamCourse", tbExamCourse);
         asyncDataCalculateTempleteService.calculateTask(map);
         return ResultUtil.ok();
     }