Эх сурвалжийг харах

成绩查询导出BUG修改

wangliang 3 жил өмнө
parent
commit
f298a21536

+ 6 - 6
themis-admin/src/main/java/com/qmth/themis/admin/api/TEExamStudentController.java

@@ -399,7 +399,7 @@ public class TEExamStudentController {
     @RequestMapping(value = "/mark/result", method = RequestMethod.POST)
     @ApiResponses({@ApiResponse(code = 200, message = "考试批次信息", response = MarkResultDto.class)})
     public Result markResult(@ApiParam(value = "考试批次id", required = true) @RequestParam Long examId,
-                             @ApiParam(value = "考试场次id", required = false) @RequestParam(required = false) Long activityId,
+                             @ApiParam(value = "考试场次id", required = false) @RequestParam(required = false) Long examActivityId,
                              @ApiParam(value = "证件号", required = false) @RequestParam(required = false) String identity,
                              @ApiParam(value = "姓名", required = false) @RequestParam(required = false) String name,
                              @ApiParam(value = "科目代码", required = false) @RequestParam(required = false) String courseCode,
@@ -410,7 +410,7 @@ public class TEExamStudentController {
         }
         commonMarkResult(examId);
         IPage<MarkResultDto> markResultDtoIPage = teExamStudentService
-                .markResultQuery(new Page<>(pageNumber, pageSize), examId, activityId, identity, name, courseCode);
+                .markResultQuery(new Page<>(pageNumber, pageSize), examId, examActivityId, identity, name, courseCode);
         if (Objects.nonNull(markResultDtoIPage)) {
             List<MarkResultDto> markResultDtoList = markResultDtoIPage.getRecords();
             if (Objects.nonNull(markResultDtoList) && markResultDtoList.size() > 0) {
@@ -439,7 +439,7 @@ public class TEExamStudentController {
     @Transactional
     @ApiResponses({@ApiResponse(code = 200, message = "{\"taskId\":0}", response = Result.class)})
     public Result markResultSimpleExport(@ApiParam(value = "考试批次id", required = true) @RequestParam Long examId,
-                                         @ApiParam(value = "考试场次id", required = false) @RequestParam(required = false) Long activityId,
+                                         @ApiParam(value = "考试场次id", required = false) @RequestParam(required = false) Long examActivityId,
                                          @ApiParam(value = "证件号", required = false) @RequestParam(required = false) String identity,
                                          @ApiParam(value = "姓名", required = false) @RequestParam(required = false) String name,
                                          @ApiParam(value = "科目代码", required = false) @RequestParam(required = false) String courseCode) {
@@ -460,7 +460,7 @@ public class TEExamStudentController {
             transMap.put(SystemConstant.CREATE_ID, tbUser.getId());
             transMap.put(SystemConstant.ORG_ID, tbUser.getOrgId());
             transMap.put(SystemConstant.EXAM_ID, examId);
-            transMap.put(SystemConstant.ACTIVITY_ID, activityId);
+            transMap.put(SystemConstant.ACTIVITY_ID, examActivityId);
             transMap.put("identity", identity);
             transMap.put(SystemConstant.NAME, name);
             transMap.put(SystemConstant.COURSE_CODE, courseCode);
@@ -486,7 +486,7 @@ public class TEExamStudentController {
     @Transactional
     @ApiResponses({@ApiResponse(code = 200, message = "{\"taskId\":0}", response = Result.class)})
     public Result markResultStandardExport(@ApiParam(value = "考试批次id", required = true) @RequestParam Long examId,
-                                           @ApiParam(value = "考试场次id", required = false) @RequestParam(required = false) Long activityId,
+                                           @ApiParam(value = "考试场次id", required = false) @RequestParam(required = false) Long examActivityId,
                                            @ApiParam(value = "证件号", required = false) @RequestParam(required = false) String identity,
                                            @ApiParam(value = "姓名", required = false) @RequestParam(required = false) String name,
                                            @ApiParam(value = "科目代码", required = false) @RequestParam(required = false) String courseCode) {
@@ -507,7 +507,7 @@ public class TEExamStudentController {
             transMap.put(SystemConstant.CREATE_ID, tbUser.getId());
             transMap.put(SystemConstant.ORG_ID, tbUser.getOrgId());
             transMap.put(SystemConstant.EXAM_ID, examId);
-            transMap.put(SystemConstant.ACTIVITY_ID, activityId);
+            transMap.put(SystemConstant.ACTIVITY_ID, examActivityId);
             transMap.put("identity", identity);
             transMap.put(SystemConstant.NAME, name);
             transMap.put(SystemConstant.COURSE_CODE, courseCode);

+ 7 - 7
themis-business/src/main/java/com/qmth/themis/business/service/TEExamStudentService.java

@@ -26,7 +26,7 @@ public interface TEExamStudentService extends IService<TEExamStudent> {
      *
      * @param iPage
      * @param examId
-     * @param activityId
+     * @param examActivityId
      * @param identity
      * @param name
      * @param roomCode
@@ -36,9 +36,9 @@ public interface TEExamStudentService extends IService<TEExamStudent> {
      * @param classNo
      * @return
      */
-    public IPage<TEExamStudentDto> examStudentQuery(IPage<Map> iPage, Long examId, Long activityId, String identity, String name, String roomCode, String courseCode, String grade, Integer enable, String classNo, Integer hasPhoto);
+    public IPage<TEExamStudentDto> examStudentQuery(IPage<Map> iPage, Long examId, Long examActivityId, String identity, String name, String roomCode, String courseCode, String grade, Integer enable, String classNo, Integer hasPhoto);
 
-    public List<TEExamStudentDto> examStudentList(Long examId, Long activityId, String identity, String name, String roomCode, String courseCode, String grade, Integer enable, String classNo, Integer hasPhoto);
+    public List<TEExamStudentDto> examStudentList(Long examId, Long examActivityId, String identity, String name, String roomCode, String courseCode, String grade, Integer enable, String classNo, Integer hasPhoto);
 
     ExamStudentCacheBean getExamStudentCacheBean(Long examStudentId);
 
@@ -72,25 +72,25 @@ public interface TEExamStudentService extends IService<TEExamStudent> {
      *
      * @param iPage
      * @param examId
-     * @param activityId
+     * @param examActivityId
      * @param identity
      * @param name
      * @param courseCode
      * @return
      */
-    public IPage<MarkResultDto> markResultQuery(IPage<Map> iPage, Long examId, Long activityId, String identity, String name, String courseCode);
+    public IPage<MarkResultDto> markResultQuery(IPage<Map> iPage, Long examId, Long examActivityId, String identity, String name, String courseCode);
 
     /**
      * 查询学生成绩信息(导出用)
      *
      * @param examId
-     * @param activityId
+     * @param examActivityId
      * @param identity
      * @param name
      * @param courseCode
      * @return
      */
-    public List<MarkResultSimpleExportDto> markResultQueryExport(Long examId, Long activityId, String identity, String name, String courseCode);
+    public List<MarkResultSimpleExportDto> markResultQueryExport(Long examId, Long examActivityId, String identity, String name, String courseCode);
 
     public List<TEExamStudentDto> findExamStudentNeedMark(Long examId, String courseCode, Long idGt, Integer count);
 }

+ 11 - 11
themis-business/src/main/java/com/qmth/themis/business/service/impl/TEExamStudentServiceImpl.java

@@ -40,7 +40,7 @@ public class TEExamStudentServiceImpl extends ServiceImpl<TEExamStudentMapper, T
      *
      * @param iPage
      * @param examId
-     * @param activityId
+     * @param examActivityId
      * @param identity
      * @param name
      * @param roomCode
@@ -51,11 +51,11 @@ public class TEExamStudentServiceImpl extends ServiceImpl<TEExamStudentMapper, T
      * @return
      */
     @Override
-    public IPage<TEExamStudentDto> examStudentQuery(IPage<Map> iPage, Long examId, Long activityId, String identity,
+    public IPage<TEExamStudentDto> examStudentQuery(IPage<Map> iPage, Long examId, Long examActivityId, String identity,
             String name, String roomCode, String courseCode, String grade, Integer enable, String classNo,
             Integer hasPhoto) {
         return teExamStudentMapper
-                .examStudentQuery(iPage, examId, activityId, identity, name, roomCode, courseCode, grade, enable,
+                .examStudentQuery(iPage, examId, examActivityId, identity, name, roomCode, courseCode, grade, enable,
                         classNo, hasPhoto);
     }
 
@@ -132,10 +132,10 @@ public class TEExamStudentServiceImpl extends ServiceImpl<TEExamStudentMapper, T
     }
 
     @Override
-    public List<TEExamStudentDto> examStudentList(Long examId, Long activityId, String identity, String name,
+    public List<TEExamStudentDto> examStudentList(Long examId, Long examActivityId, String identity, String name,
             String roomCode, String courseCode, String grade, Integer enable, String classNo, Integer hasPhoto) {
         return teExamStudentMapper
-                .examStudentList(examId, activityId, identity, name, roomCode, courseCode, grade, enable, classNo,
+                .examStudentList(examId, examActivityId, identity, name, roomCode, courseCode, grade, enable, classNo,
                         hasPhoto);
     }
 
@@ -158,32 +158,32 @@ public class TEExamStudentServiceImpl extends ServiceImpl<TEExamStudentMapper, T
      *
      * @param iPage
      * @param examId
-     * @param activityId
+     * @param examActivityId
      * @param identity
      * @param name
      * @param courseCode
      * @return
      */
     @Override
-    public IPage<MarkResultDto> markResultQuery(IPage<Map> iPage, Long examId, Long activityId, String identity,
+    public IPage<MarkResultDto> markResultQuery(IPage<Map> iPage, Long examId, Long examActivityId, String identity,
             String name, String courseCode) {
-        return teExamStudentMapper.markResultQuery(iPage, examId, activityId, identity, name, courseCode);
+        return teExamStudentMapper.markResultQuery(iPage, examId, examActivityId, identity, name, courseCode);
     }
 
     /**
      * 查询学生成绩信息(导出用)
      *
      * @param examId
-     * @param activityId
+     * @param examActivityId
      * @param identity
      * @param name
      * @param courseCode
      * @return
      */
     @Override
-    public List<MarkResultSimpleExportDto> markResultQueryExport(Long examId, Long activityId, String identity,
+    public List<MarkResultSimpleExportDto> markResultQueryExport(Long examId, Long examActivityId, String identity,
             String name, String courseCode) {
-        return teExamStudentMapper.markResultQueryExport(examId, activityId, identity, name, courseCode);
+        return teExamStudentMapper.markResultQueryExport(examId, examActivityId, identity, name, courseCode);
     }
 
     @Override

+ 10 - 12
themis-business/src/main/java/com/qmth/themis/business/templete/impl/TaskMarkResultStandardExportTemplete.java

@@ -126,7 +126,7 @@ public class TaskMarkResultStandardExportTemplete implements TaskExportTemplete
                             }.getType());
             Map<Long, List<ExcelDto>> excelDtoMap = null;
             Map<Long, Map<String, Integer>> paperObjectiveAnswerMap = new HashMap<>();
-            List<ExcelDto> dynamicExcelHead = new ArrayList<>();
+            Set<String> titleSet = new LinkedHashSet<>();
             if (Objects.nonNull(markResultStandardExportDtoList) && markResultStandardExportDtoList.size() > 0) {
                 for (MarkResultStandardExportDto m : markResultStandardExportDtoList) {
                     excelDtoMap = new HashMap<>();
@@ -135,24 +135,22 @@ public class TaskMarkResultStandardExportTemplete implements TaskExportTemplete
                         if (!paperObjectiveAnswerMap.containsKey(m.getPaperId())) {
                             objectiveAnswerCacheBeanMap = teExamPaperService.getPaperStructCacheBean(m.getPaperId());
                             paperObjectiveAnswerMap.put(m.getPaperId(), objectiveAnswerCacheBeanMap);
-                        } else {
-                            objectiveAnswerCacheBeanMap = paperObjectiveAnswerMap.get(m.getPaperId());
-                        }
-                        if (dynamicExcelHead.size() == 0) {
                             objectiveAnswerCacheBeanMap.forEach((k, v) -> {
                                 if (v != 6) {//套题暂不展现
                                     String title = QuestionTypeEnum.convertToTitle(v) + k;
                                     if (v >= 1 && v < 4) {
                                         ExcelDto excelAnswerDto = new ExcelDto(title + "作答");
                                         ExcelDto excelScoreDto = new ExcelDto(title + "得分");
-                                        dynamicExcelHead.add(excelAnswerDto);
-                                        dynamicExcelHead.add(excelScoreDto);
+                                        titleSet.add(excelAnswerDto.getTitle());
+                                        titleSet.add(excelScoreDto.getTitle());
                                     } else {
                                         ExcelDto excelScoreDto = new ExcelDto(title + "得分");
-                                        dynamicExcelHead.add(excelScoreDto);
+                                        titleSet.add(excelScoreDto.getTitle());
                                     }
                                 }
                             });
+                        } else {
+                            objectiveAnswerCacheBeanMap = paperObjectiveAnswerMap.get(m.getPaperId());
                         }
                     } else {
                         continue;
@@ -241,14 +239,14 @@ public class TaskMarkResultStandardExportTemplete implements TaskExportTemplete
                 }
             }
             num++;
-            Map<String, Integer> position = new HashMap<>();
+            Map<String, Integer> position = new LinkedHashMap<>();
             //动态表头
-            for (ExcelDto excelDto : dynamicExcelHead) {
+            for (String s : titleSet) {
                 Cell cell = row.createCell(num);
-                cell.setCellValue(excelDto.getTitle());
+                cell.setCellValue(s);
                 cell.setCellStyle(style);
                 sheet.setColumnWidth(num, 15 * 256);
-                position.put(excelDto.getTitle(), num);
+                position.put(s, num);
                 num++;
             }
             int rowIndex = 0, cellIndex = 0, max = SystemConstant.MAX_EXPORT_SIZE, size = markResultStandardExportDtoList