فهرست منبع

成绩管理1对多

wangliang 8 ماه پیش
والد
کامیت
fea37b732b

+ 2 - 1
teachcloud-obe/src/main/java/com/qmth/teachcloud/obe/entity/TCPaperStruct.java

@@ -102,7 +102,7 @@ public class TCPaperStruct extends BaseEntity implements Serializable {
         updateInfo(userId);
     }
 
-    public TCPaperStruct(Long cultureProgramId, Long courseId, String courseCode, String courseName, String paperNumber, String paperStruct, Long userId, Long examId) {
+    public TCPaperStruct(Long cultureProgramId, Long courseId, String courseCode, String courseName, String paperNumber, String paperStruct, Long userId, Long examId, String paperStructDimension) {
         insertInfo(userId);
         this.cultureProgramId = cultureProgramId;
         this.courseId = courseId;
@@ -112,6 +112,7 @@ public class TCPaperStruct extends BaseEntity implements Serializable {
         this.paperStruct = paperStruct;
         this.enable = true;
         this.examId = examId;
+        this.paperStructDimension = paperStructDimension;
     }
 
     public Long getCultureProgramId() {

+ 9 - 10
teachcloud-obe/src/main/java/com/qmth/teachcloud/obe/service/impl/TCFinalScoreServiceImpl.java

@@ -126,7 +126,6 @@ public class TCFinalScoreServiceImpl extends ServiceImpl<TCFinalScoreMapper, TCF
 
             ExcelReader excelReader = ExcelReader.create(ExcelType.XLSX, file.getInputStream(), 1);
             List<String[]> arrayList = excelReader.getDataArrayList();
-            log.info("arrayList:{}", JacksonUtil.parseJson(arrayList));
 
             if (!CollectionUtils.isEmpty(arrayList)) {
                 SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
@@ -391,13 +390,13 @@ public class TCFinalScoreServiceImpl extends ServiceImpl<TCFinalScoreMapper, TCF
                     }
                 }
                 if (!CollectionUtils.isEmpty(paperStructDimensionResultList)) {
-                    TCPaperStruct tcPaperStruct = tcPaperStructService.queryPaperStruct(cultureProgramId, courseId, paperNumber, examId);
-                    if (Objects.nonNull(tcPaperStruct)) {
-                        tcPaperStructService.removeById(tcPaperStruct.getId());
+                    TCPaperStruct tcPaperStructDb = tcPaperStructService.queryPaperStruct(cultureProgramId, courseId, paperNumber, examId);
+                    if (Objects.nonNull(tcPaperStructDb)) {
+                        tcPaperStructService.removeById(tcPaperStructDb.getId());
                     }
                     paperStructDimensionResultList = SDFrame.read(paperStructDimensionResultList).sortDesc(Sorter.sortDescBy(PaperStructDimensionResult::getMainNumber).sortDesc(PaperStructDimensionResult::getMainNumber)).toLists();
-                    tcPaperStruct = new TCPaperStruct(cultureProgramId, courseId, basicCourse.getCode(), basicCourse.getName(), paperNumber, JacksonUtil.parseJson(paperStructDimensionResultList),
-                            sysUser.getId(), examId);
+                    TCPaperStruct tcPaperStruct = new TCPaperStruct(cultureProgramId, courseId, basicCourse.getCode(), basicCourse.getName(), paperNumber, JacksonUtil.parseJson(paperStructDimensionResultList),
+                            sysUser.getId(), examId, tcPaperStructDb.getPaperStructDimension());
                     tcPaperStructService.saveOrUpdate(tcPaperStruct);
                 }
             } else {
@@ -414,10 +413,10 @@ public class TCFinalScoreServiceImpl extends ServiceImpl<TCFinalScoreMapper, TCF
                                         SourceEnum.SYNC, sysUser.getId(), cultureProgramId, courseId));
                     }
                 }
-                TCPaperStruct tcPaperStruct = tcPaperStructService.queryPaperStruct(cultureProgramId, courseId, paperNumber, examId);
-                if (Objects.nonNull(tcPaperStruct)) {
-                    tcPaperStructService.removeById(tcPaperStruct.getId());
-                }
+//                TCPaperStruct tcPaperStruct = tcPaperStructService.queryPaperStruct(cultureProgramId, courseId, paperNumber, examId);
+//                if (Objects.nonNull(tcPaperStruct)) {
+//                    tcPaperStructService.removeById(tcPaperStruct.getId());
+//                }
             }
             if (!CollectionUtils.isEmpty(tcFinalScoreList) && !CollectionUtils.isEmpty(tcUsualScoreList)) {
                 successData.add("共同步").add(tcFinalScoreList.size() + "").add("条数据");

+ 8 - 3
teachcloud-obe/src/main/java/com/qmth/teachcloud/obe/service/impl/TCPaperStructServiceImpl.java

@@ -119,7 +119,6 @@ public class TCPaperStructServiceImpl extends ServiceImpl<TCPaperStructMapper, T
 
             ExcelReader excelReader = ExcelReader.create(ExcelType.XLSX, file.getInputStream(), 1);
             List<PaperStructDto> paperStructDtoList = excelReader.getObjectList(PaperStructDto.class);
-            log.info("paperStructDtoList:{}", JacksonUtil.parseJson(paperStructDtoList));
 
             if (!CollectionUtils.isEmpty(paperStructDtoList)) {
                 SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
@@ -171,8 +170,14 @@ public class TCPaperStructServiceImpl extends ServiceImpl<TCPaperStructMapper, T
                     TCPaperStruct tcPaperStruct = new TCPaperStruct(examId, cultureProgramId, courseId, markPaper.getCourseCode(), markPaper.getCourseName(), paperNumber, JacksonUtil.parseJson(paperStructDtoNewList), totalScore, 60d, sysUser.getId());
                     TCPaperStruct tcPaperStructDb = tcPaperStructService.queryPaperStruct(cultureProgramId, courseId, paperNumber, examId);
                     if (Objects.nonNull(tcPaperStructDb) && !tcPaperStructDb.equals(tcPaperStruct)) {
-                        tcFinalScoreService.remove(cultureProgramId, courseId, paperNumber, examId);
-                        trBasicInfoService.clearReportData(cultureProgramId, courseId, paperNumber, examId, true);
+                        if (Objects.nonNull(tcPaperStructDb.getPaperStruct()) && !Objects.equals(tcPaperStructDb.getPaperStruct(), tcPaperStruct.getPaperStruct())) {
+                            throw ExceptionResultEnum.ERROR.exception("导入的试卷结构不一致,请检查");
+                        }
+//                        tcFinalScoreService.remove(cultureProgramId, courseId, paperNumber, examId);
+//                        trBasicInfoService.clearReportData(cultureProgramId, courseId, paperNumber, examId, true);
+                    }
+                    if (Objects.nonNull(tcPaperStructDb.getPaperStructDimension())) {
+                        tcPaperStruct.updateInfo(tcPaperStructDb.getPaperStructDimension(), sysUser.getId());
                     }
                     tcPaperStructService.remove(cultureProgramId, courseId, paperNumber, examId);
                     tcPaperStructService.save(tcPaperStruct);