Pārlūkot izejas kodu

班级量化考核

phoenix 1 gadu atpakaļ
vecāks
revīzija
96f621fa6f
19 mainītis faili ar 838 papildinājumiem un 71 dzēšanām
  1. 53 0
      src/main/java/com/xjrsoft/common/utils/excel/ExcelFillCellMergePrevColUtil.java
  2. 179 0
      src/main/java/com/xjrsoft/common/utils/excel/ExcelMergeUtil.java
  3. 12 31
      src/main/java/com/xjrsoft/module/evaluate/controller/EvaluateResultController.java
  4. 22 0
      src/main/java/com/xjrsoft/module/evaluate/dto/ResultViewingExcelDto.java
  5. 2 0
      src/main/java/com/xjrsoft/module/evaluate/mapper/EvaluateResultMapper.java
  6. 0 3
      src/main/java/com/xjrsoft/module/evaluate/service/IEvaluateManageService.java
  7. 6 4
      src/main/java/com/xjrsoft/module/evaluate/service/IEvaluateResultService.java
  8. 155 2
      src/main/java/com/xjrsoft/module/evaluate/service/impl/EvaluateResultServiceImpl.java
  9. 96 0
      src/main/java/com/xjrsoft/module/evaluate/vo/ResultViewingExcelVo.java
  10. 21 10
      src/main/java/com/xjrsoft/module/evaluate/vo/ResultViewingPageVo.java
  11. 11 12
      src/main/java/com/xjrsoft/module/student/controller/BaseStudentAssessmentInspectionController.java
  12. 25 0
      src/main/java/com/xjrsoft/module/student/dto/QuantitativeAssessmentExcelDto.java
  13. 7 4
      src/main/java/com/xjrsoft/module/student/mapper/BaseStudentAssessmentInspectionMapper.java
  14. 5 0
      src/main/java/com/xjrsoft/module/student/service/IBaseStudentAssessmentInspectionService.java
  15. 35 5
      src/main/java/com/xjrsoft/module/student/service/impl/BaseStudentAssessmentInspectionServiceImpl.java
  16. 121 0
      src/main/java/com/xjrsoft/module/student/vo/StudentIndividualBehaviorExcelVo.java
  17. 38 0
      src/main/resources/mapper/evaluate/EvaluateResultMapper.xml
  18. 40 0
      src/main/resources/mapper/student/BaseStudentAssessmentInspectionMapper.xml
  19. 10 0
      src/test/java/com/xjrsoft/xjrsoftboot/DateTime.java

+ 53 - 0
src/main/java/com/xjrsoft/common/utils/excel/ExcelFillCellMergePrevColUtil.java

@@ -0,0 +1,53 @@
+package com.xjrsoft.common.utils.excel;
+
+import com.alibaba.excel.metadata.Head;
+import com.alibaba.excel.metadata.data.WriteCellData;
+import com.alibaba.excel.write.handler.CellWriteHandler;
+import com.alibaba.excel.write.metadata.holder.WriteSheetHolder;
+import com.alibaba.excel.write.metadata.holder.WriteTableHolder;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.util.CellRangeAddress;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @description:列合并工具
+ * @author: phoenix
+ * @create: 2024/1/26 14:43
+ * @Version 1.0
+ */
+public class ExcelFillCellMergePrevColUtil implements CellWriteHandler {
+    private static final String KEY = "%s-%s";
+    //所有的合并信息都存在了这个map里面
+    Map<String, Integer> mergeInfo = new HashMap<>();
+
+    public ExcelFillCellMergePrevColUtil() {
+    }
+
+    public void afterCellDispose(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, List<WriteCellData<?>> list, Cell cell, Head head, Integer integer, Boolean aBoolean) {
+        //当前行
+        int curRowIndex = cell.getRowIndex();
+        //当前列
+        int curColIndex = cell.getColumnIndex();
+
+        Integer num = mergeInfo.get(String.format(KEY, curRowIndex, curColIndex));
+        if (null != num) {
+            // 合并最后一行 ,列
+            mergeWithPrevCol(writeSheetHolder, cell, curRowIndex, curColIndex, num);
+        }
+    }
+
+    public void mergeWithPrevCol(WriteSheetHolder writeSheetHolder, Cell cell, int curRowIndex, int curColIndex, int num) {
+        Sheet sheet = writeSheetHolder.getSheet();
+        CellRangeAddress cellRangeAddress = new CellRangeAddress(curRowIndex, curRowIndex, curColIndex, curColIndex + num);
+        sheet.addMergedRegion(cellRangeAddress);
+    }
+
+    //num从第几列开始增加多少列,(6,2,7)代表的意思就是第6行的第2列至第2+7也就是9列开始合并
+    public void add(int curRowIndex, int curColIndex, int num) {
+        mergeInfo.put(String.format(KEY, curRowIndex, curColIndex), num);
+    }
+}

+ 179 - 0
src/main/java/com/xjrsoft/common/utils/excel/ExcelMergeUtil.java

@@ -0,0 +1,179 @@
+package com.xjrsoft.common.utils.excel;
+
+import com.alibaba.excel.EasyExcel;
+import com.alibaba.excel.metadata.Head;
+import com.alibaba.excel.metadata.data.WriteCellData;
+import com.alibaba.excel.write.handler.CellWriteHandler;
+import com.alibaba.excel.write.metadata.holder.WriteSheetHolder;
+import com.alibaba.excel.write.metadata.holder.WriteTableHolder;
+import com.alibaba.excel.write.metadata.style.WriteCellStyle;
+import com.alibaba.excel.write.metadata.style.WriteFont;
+import com.alibaba.excel.write.style.HorizontalCellStyleStrategy;
+import org.apache.poi.ss.usermodel.*;
+import org.apache.poi.ss.util.CellRangeAddress;
+
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.net.URLEncoder;
+import java.util.List;
+
+/**
+ * @description:单元格合并工具类
+ * @author: phoenix
+ * @create: 2024/1/26 10:02
+ * @Version 1.0
+ */
+public class ExcelMergeUtil implements CellWriteHandler {
+    private int[] mergeColumnIndex;
+    private int mergeRowIndex;
+
+    public ExcelMergeUtil() {
+    }
+
+    public ExcelMergeUtil(int mergeRowIndex, int[] mergeColumnIndex) {
+        this.mergeRowIndex = mergeRowIndex;
+        this.mergeColumnIndex = mergeColumnIndex;
+    }
+
+
+    public void afterCellDispose(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, List<WriteCellData<?>> cellDataList, Cell cell, Head head, Integer relativeRowIndex, Boolean isHead) {
+
+        //当前行
+        int curRowIndex = cell.getRowIndex();
+        //当前列
+        int curColIndex = cell.getColumnIndex();
+
+        if (curRowIndex > mergeRowIndex) {
+            for (int i = 0; i < mergeColumnIndex.length; i++) {
+                if (curColIndex == mergeColumnIndex[i]) {
+                    mergeWithPrevRow(writeSheetHolder, cell, curRowIndex, curColIndex);
+                    break;
+                }
+            }
+        }
+    }
+
+    /**
+     * 当前单元格向上合并
+     *
+     * @param writeSheetHolder
+     * @param cell             当前单元格
+     * @param curRowIndex      当前行
+     * @param curColIndex      当前列
+     */
+    private void mergeWithPrevRow(WriteSheetHolder writeSheetHolder, Cell cell, int curRowIndex, int curColIndex) {
+        Object curData = cell.getCellTypeEnum() == CellType.STRING ? cell.getStringCellValue() : cell.getNumericCellValue();
+        Cell preCell = cell.getSheet().getRow(curRowIndex - 1).getCell(curColIndex);
+        Object preData = preCell.getCellTypeEnum() == CellType.STRING ? preCell.getStringCellValue() : preCell.getNumericCellValue();
+        // 将当前单元格数据与上一个单元格数据比较
+        Boolean dataBool = preData.equals(curData);
+        //此处需要注意:因为我是按照主体名称确定是否需要合并的,所以获取每一行第二列数据和上一行第一列数据进行比较,如果相等合并,getCell里面的值,是主体名称所在列的下标,不能大于需要合并列数组的第一个下标
+        Boolean bool = cell.getRow().getCell(0).getStringCellValue().equals(cell.getSheet().getRow(curRowIndex - 1).getCell(0).getStringCellValue());
+        if (dataBool && bool) {
+            Sheet sheet = writeSheetHolder.getSheet();
+            List<CellRangeAddress> mergeRegions = sheet.getMergedRegions();
+            boolean isMerged = false;
+            for (int i = 0; i < mergeRegions.size() && !isMerged; i++) {
+                CellRangeAddress cellRangeAddr = mergeRegions.get(i);
+                // 若上一个单元格已经被合并,则先移出原有的合并单元,再重新添加合并单元
+                if (cellRangeAddr.isInRange(curRowIndex - 1, curColIndex)) {
+                    sheet.removeMergedRegion(i);
+                    cellRangeAddr.setLastRow(curRowIndex);
+                    sheet.addMergedRegion(cellRangeAddr);
+                    isMerged = true;
+                }
+            }
+            // 若上一个单元格未被合并,则新增合并单元
+            if (!isMerged) {
+                CellRangeAddress cellRangeAddress = new CellRangeAddress(curRowIndex - 1, curRowIndex, curColIndex, curColIndex);
+                sheet.addMergedRegion(cellRangeAddress);
+            }
+        }
+    }
+
+    /**
+     * 头部样式
+     *
+     * @return
+     */
+    public static WriteCellStyle getHeadWriteCellStyle() {
+        // 这里需要设置不关闭流
+        WriteCellStyle headWriteCellStyle = new WriteCellStyle();
+        //设置背景颜色
+        headWriteCellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
+        //设置头字体
+        WriteFont headWriteFont = new WriteFont();
+        //字体大小
+        headWriteFont.setFontHeightInPoints((short) 13);
+        //是否加粗
+        headWriteFont.setBold(true);
+        headWriteCellStyle.setWriteFont(headWriteFont);
+        //设置头居中
+        headWriteCellStyle.setHorizontalAlignment(HorizontalAlignment.CENTER);
+        return headWriteCellStyle;
+    }
+
+    /**
+     * 内容样式
+     *
+     * @return
+     */
+    public static WriteCellStyle getContentWriteCellStyle() {
+        //内容策略
+        WriteCellStyle contentWriteCellStyle = new WriteCellStyle();
+        //设置 水平居中
+        contentWriteCellStyle.setHorizontalAlignment(HorizontalAlignment.CENTER);
+        //自动换行
+        contentWriteCellStyle.setWrapped(true);
+        //垂直居中
+        contentWriteCellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
+        //设置左边框
+        contentWriteCellStyle.setBorderLeft(BorderStyle.THIN);
+        //设置右边框
+        contentWriteCellStyle.setBorderRight(BorderStyle.THIN);
+        //设置上边框
+        contentWriteCellStyle.setBorderTop(BorderStyle.THIN);
+        //设置下边框
+        contentWriteCellStyle.setBorderBottom(BorderStyle.THIN);
+        return contentWriteCellStyle;
+    }
+
+    /**
+     * 合并单元格导出excel工具
+     *
+     * @param response         响应头
+     * @param fileName         文件名称
+     * @param lsit             需要导出的数据
+     * @param data             对应的excel导出类
+     * @param mergeColumeIndex 需要合并的下标
+     * @param mergeRowIndex    从第几行开始合并
+     * @throws IOException
+     */
+    public static void exportExcel(HttpServletResponse response, String fileName, List lsit, Class data, int[] mergeColumeIndex, int mergeRowIndex) throws IOException {
+        response.setContentType("application/vnd.ms-excel");
+        response.setCharacterEncoding("utf-8");
+        // 这里URLEncoder.encode可以防止中文乱码 当然和easyexcel没有关系
+        String fileNamePath = URLEncoder.encode(fileName + System.currentTimeMillis(), "UTF-8");
+        response.setHeader("Content-disposition", "attachment;filename=" + fileNamePath + ".xlsx");
+        // 调用合并单元格工具类,此工具类是根据工程名称相同则合并后面数据
+        ExcelMergeUtil excelFillCellMergeStrategy = new ExcelMergeUtil(mergeRowIndex, mergeColumeIndex);
+
+        //头部样式
+        WriteCellStyle headWriteCellStyle = ExcelMergeUtil.getHeadWriteCellStyle();
+        //内容样式
+        WriteCellStyle contentWriteCellStyle = ExcelMergeUtil.getContentWriteCellStyle();
+
+        HorizontalCellStyleStrategy horizontalCellStyleStrategy =
+                new HorizontalCellStyleStrategy(headWriteCellStyle, contentWriteCellStyle);
+        //合并列,可以实现最后一行合计的效果
+        //ExcelFillCellMergePrevColUtils column = new ExcelFillCellMergePrevColUtils();
+        //column.add(lsit.size() + 1, 0, 1);
+        EasyExcel.write(response.getOutputStream(), data)
+                .registerWriteHandler(horizontalCellStyleStrategy)
+                .registerWriteHandler(excelFillCellMergeStrategy)
+                //.registerWriteHandler(column)
+                //sheet显示的名字
+                .autoCloseStream(Boolean.TRUE).sheet(fileName)
+                .doWrite(lsit);
+    }
+}

+ 12 - 31
src/main/java/com/xjrsoft/module/evaluate/controller/EvaluateResultController.java

@@ -1,31 +1,23 @@
 package com.xjrsoft.module.evaluate.controller;
 
 import cn.dev33.satoken.annotation.SaCheckPermission;
-import com.alibaba.excel.EasyExcel;
-import com.alibaba.excel.support.ExcelTypeEnum;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.xjrsoft.common.model.result.RT;
 import com.xjrsoft.common.page.ConventPage;
 import com.xjrsoft.common.page.PageOutput;
-import com.xjrsoft.module.evaluate.dto.EvaluateResultDetailPageDetailDto;
-import com.xjrsoft.module.evaluate.dto.EvaluateResultDetailPageDto;
-import com.xjrsoft.module.evaluate.dto.EvaluateResultIndexPageDto;
-import com.xjrsoft.module.evaluate.dto.ResultViewingPageDto;
+import com.xjrsoft.module.evaluate.dto.*;
 import com.xjrsoft.module.evaluate.service.IEvaluateResultService;
-import com.xjrsoft.module.evaluate.vo.*;
-import com.xjrsoft.module.textbook.vo.TextbookIssueRecordExcelVo;
+import com.xjrsoft.module.evaluate.vo.EvaluateResultDetailPageDetailVo;
+import com.xjrsoft.module.evaluate.vo.EvaluateResultDetailPageVo;
+import com.xjrsoft.module.evaluate.vo.EvaluateResultIndexPageVo;
+import com.xjrsoft.module.evaluate.vo.ResultViewingPageVo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
 import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import javax.validation.Valid;
-import java.io.ByteArrayOutputStream;
-import java.util.ArrayList;
-import java.util.List;
 
 /**
 * @title: 评价结果
@@ -77,22 +69,11 @@ public class EvaluateResultController {
         return RT.ok(pageOutput);
     }
 
-    @GetMapping("/export")
-    @ApiOperation(value = "导出")
-    public ResponseEntity<byte[]> exportData() {
-        List<ResultViewingExportVo> customerList = evaluateResultService.getList();
-        List<TextbookIssueRecordExcelVo> dataList = new ArrayList<>();
-//        SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日 HH:mm:ss");
-//        for (TextbookIssueRecordPageVo textbookIssueRecordPageVo : customerList) {
-//            if(textbookIssueRecordPageVo.getCreateDate() == null){
-//                continue;
-//            }
-//            textbookIssueRecordPageVo.setCreateDateStr(sdf.format(textbookIssueRecordPageVo.getCreateDate()));
-//            dataList.add(BeanUtil.toBean(textbookIssueRecordPageVo, TextbookIssueRecordExcelVo.class));
-//        }
-        ByteArrayOutputStream bot = new ByteArrayOutputStream();
-        EasyExcel.write(bot, TextbookIssueRecordExcelVo.class).automaticMergeHead(false).excelType(ExcelTypeEnum.XLSX).sheet().doWrite(dataList);
-
-        return RT.fileStream(bot.toByteArray(), "TextbookIssueRecord" + ExcelTypeEnum.XLSX.getValue());
+    @PostMapping("/export-query")
+//    @GetMapping("/expor")
+    @ApiOperation(value = "入参导出")
+    public ResponseEntity<byte[]>  exportDataQuery(@Valid @RequestBody ResultViewingExcelDto dto) {
+//    public ResponseEntity<byte[]>  exportDataQuery(@Valid ResultViewingExcelDto dto) {
+        return evaluateResultService.getList(dto);
     }
 }

+ 22 - 0
src/main/java/com/xjrsoft/module/evaluate/dto/ResultViewingExcelDto.java

@@ -0,0 +1,22 @@
+package com.xjrsoft.module.evaluate.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+
+/**
+* @title: 评价结果分页查询入参
+* @Author szs
+* @Date: 2024-01-16
+* @Version 1.0
+*/
+@Data
+@EqualsAndHashCode(callSuper = false)
+public class ResultViewingExcelDto{
+    /**
+     * 评价管理主键编号
+     */
+    @ApiModelProperty(value = "评价管理主键编号",required = true)
+    private Long evaluateManageId;
+}

+ 2 - 0
src/main/java/com/xjrsoft/module/evaluate/mapper/EvaluateResultMapper.java

@@ -30,5 +30,7 @@ public interface EvaluateResultMapper extends MPJBaseMapper<EvaluateResult> {
 
     List<ResultViewingPageVo> listByObjectIdAndEvaluateItemId(@Param("evaluateObjectIdList") List<Long> evaluateObjectIdList, @Param("evaluateManageItemIdList") List<Long> evaluateManageItemIdList);
 
+    List<ResultViewingPageVo> listTopicScoreByObjectIdAndTopic(@Param("evaluateObjectIdList") List<Long> evaluateObjectIdList, @Param("evaluateManageItemIdList") List<Long> evaluateManageItemIdList);
 
+    List<ResultViewingPageVo> listSynthesisScore(@Param("evaluateObjectIdList") List<Long> evaluateObjectIdList, @Param("evaluateManageItemIdList") List<Long> evaluateManageItemIdList);
 }

+ 0 - 3
src/main/java/com/xjrsoft/module/evaluate/service/IEvaluateManageService.java

@@ -5,10 +5,8 @@ import com.github.yulichang.base.MPJBaseService;
 import com.xjrsoft.module.evaluate.dto.EvaluateManagePageDto;
 import com.xjrsoft.module.evaluate.dto.EvaluateWritePageDto;
 import com.xjrsoft.module.evaluate.entity.EvaluateManage;
-import com.xjrsoft.module.evaluate.entity.EvaluateObject;
 import com.xjrsoft.module.evaluate.vo.EvaluateManageItemVo;
 import com.xjrsoft.module.evaluate.vo.EvaluateManagePageVo;
-import com.xjrsoft.module.evaluate.vo.EvaluateManageScoreVo;
 import com.xjrsoft.module.evaluate.vo.EvaluateWritePageVo;
 import com.xjrsoft.module.evaluate.vo.EvaluateWriteVo;
 
@@ -70,5 +68,4 @@ public interface IEvaluateManageService extends MPJBaseService<EvaluateManage> {
     List<EvaluateManageItemVo> getItemList(Long id);
 
     List<EvaluateManageItemVo> getResultList(Long id);
-
 }

+ 6 - 4
src/main/java/com/xjrsoft/module/evaluate/service/IEvaluateResultService.java

@@ -4,9 +4,11 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.github.yulichang.base.MPJBaseService;
 import com.xjrsoft.module.evaluate.dto.*;
 import com.xjrsoft.module.evaluate.entity.EvaluateResult;
-import com.xjrsoft.module.evaluate.vo.*;
-
-import java.util.List;
+import com.xjrsoft.module.evaluate.vo.EvaluateResultDetailPageDetailVo;
+import com.xjrsoft.module.evaluate.vo.EvaluateResultDetailPageVo;
+import com.xjrsoft.module.evaluate.vo.EvaluateResultIndexPageVo;
+import com.xjrsoft.module.evaluate.vo.ResultViewingPageVo;
+import org.springframework.http.ResponseEntity;
 
 /**
 * @title: 评价结果
@@ -26,5 +28,5 @@ public interface IEvaluateResultService extends MPJBaseService<EvaluateResult> {
 
     String saveBatch(EvaluateResultSaveDto dto);
 
-    List<ResultViewingExportVo> getList();
+    ResponseEntity<byte[]> getList(ResultViewingExcelDto dto);
 }

+ 155 - 2
src/main/java/com/xjrsoft/module/evaluate/service/impl/EvaluateResultServiceImpl.java

@@ -2,6 +2,9 @@ package com.xjrsoft.module.evaluate.service.impl;
 
 import cn.dev33.satoken.stp.StpUtil;
 import cn.hutool.core.bean.BeanUtil;
+import com.alibaba.excel.EasyExcel;
+import com.alibaba.excel.support.ExcelTypeEnum;
+import com.alibaba.excel.write.merge.LoopMergeStrategy;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -9,6 +12,7 @@ import com.github.yulichang.base.MPJBaseServiceImpl;
 import com.github.yulichang.wrapper.MPJLambdaWrapper;
 import com.xjrsoft.common.enums.DeleteMark;
 import com.xjrsoft.common.enums.EnabledMark;
+import com.xjrsoft.common.model.result.RT;
 import com.xjrsoft.common.page.ConventPage;
 import com.xjrsoft.module.base.entity.BaseClass;
 import com.xjrsoft.module.evaluate.dto.*;
@@ -24,8 +28,10 @@ import com.xjrsoft.module.evaluate.service.IEvaluateResultService;
 import com.xjrsoft.module.evaluate.vo.*;
 import com.xjrsoft.module.teacher.entity.XjrUser;
 import lombok.AllArgsConstructor;
+import org.springframework.http.ResponseEntity;
 import org.springframework.stereotype.Service;
 
+import java.io.ByteArrayOutputStream;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -284,7 +290,154 @@ public class EvaluateResultServiceImpl extends MPJBaseServiceImpl<EvaluateResult
     }
 
     @Override
-    public List<ResultViewingExportVo> getList() {
-        return null;
+    public ResponseEntity<byte[]> getList(ResultViewingExcelDto dto) {
+        List<ResultViewingExcelVo> customerList = new ArrayList<>();
+        //获取该评价管理下的被评对象-分页
+        MPJLambdaWrapper<EvaluateObject> evaluateObjectMPJLambdaWrapper = new MPJLambdaWrapper<>();
+        evaluateObjectMPJLambdaWrapper
+                .distinct()
+                .selectAs(EvaluateObject::getObjectId, ResultViewingPageVo::getObjectId)
+                .select("ifnull(t1.name, t2.name) as objectIdCN")
+                .leftJoin(XjrUser.class, XjrUser::getId, EvaluateObject::getObjectId)
+                .leftJoin(BaseClass.class, BaseClass::getId, EvaluateObject::getObjectId)
+                .eq(EvaluateObject::getEvaluateManageId, dto.getEvaluateManageId())
+                .disableSubLogicDel();
+        List<ResultViewingPageVo> resultViewingPageVoList = evaluateObjectMapper.selectJoinList(ResultViewingPageVo.class, evaluateObjectMPJLambdaWrapper);
+        //被评对象的id集合
+        List<Long> evaluateObjectIdList = new ArrayList<>();
+        for (ResultViewingPageVo resultViewingPageVo : resultViewingPageVoList) {
+            evaluateObjectIdList.add(resultViewingPageVo.getObjectId());
+        }
+
+        //获取该评价管理下的所有题目-多个
+        MPJLambdaWrapper<EvaluateManageItem> evaluateManageItemMPJLambdaWrapper = new MPJLambdaWrapper<>();
+        evaluateManageItemMPJLambdaWrapper
+                .eq(EvaluateManageItem::getEvaluateManageId, dto.getEvaluateManageId());
+        List<EvaluateManageItem> evaluateManageItemList = evaluateManageItemMapper.selectList(evaluateManageItemMPJLambdaWrapper);
+        //题目的id集合
+        //将题目处理成Map
+        List<Long> evaluateManageItemIdList = new ArrayList<>();
+        Map<Long, EvaluateManageItem> evaluateManageItemMap = new HashMap<>();
+        for (EvaluateManageItem evaluateManageItem : evaluateManageItemList) {
+            evaluateManageItemIdList.add(evaluateManageItem.getId());
+            evaluateManageItemMap.put(evaluateManageItem.getId(), evaluateManageItem);
+        }
+        //题目的总数
+        int evaluateManageItemNum = evaluateManageItemList.size();
+
+        //获取该评价管理下的被评对象的应打分人数,实际打分人数
+        MPJLambdaWrapper<EvaluateExecuter> evaluateExecuterMPJLambdaWrapper = new MPJLambdaWrapper<>();
+        evaluateExecuterMPJLambdaWrapper
+                .select("count(t.id) as planExecuterNum")
+                .selectAs(EvaluateObject::getObjectId, ResultViewingPageVo::getObjectId)
+                .selectSum(EvaluateExecuter::getStatus, ResultViewingPageVo::getActualExecuterNum)//这里值得推敲
+                .leftJoin(EvaluateObject.class, EvaluateObject::getId, EvaluateExecuter::getEvaluateObjectId)
+                .eq(EvaluateExecuter::getEvaluateManageId, dto.getEvaluateManageId())
+                .in(EvaluateObject::getObjectId, evaluateObjectIdList)
+                .groupBy(EvaluateObject::getObjectId)
+                .disableSubLogicDel();
+        List<ResultViewingPageVo> planAndActualExecuterNum = evaluateExecuterMapper.selectJoinList(ResultViewingPageVo.class, evaluateExecuterMPJLambdaWrapper);
+        //将应打分人数,实际打分人数处理成Map
+        Map<Long, ResultViewingPageVo> planAndActualExecuterNumMap = new HashMap<>();
+        for (ResultViewingPageVo resultViewingPageVo : planAndActualExecuterNum) {
+            planAndActualExecuterNumMap.put(resultViewingPageVo.getObjectId(), resultViewingPageVo);
+        }
+
+        Map<Long, List<ResultViewingPageVo>> sumScoreMap = new HashMap<>();
+        Map<Long, List<ResultViewingPageVo>> topicScoreMap = new HashMap<>();
+        Map<Long, Integer> synthesisScoreMap = new HashMap<>();
+        if (evaluateManageItemIdList.size() > 0 && evaluateObjectIdList.size() > 0) {
+            //获取该评价管理下的所有被评对象的所有题的总得分
+            List<ResultViewingPageVo> listByObjectIdAndEvaluateItemId = evaluateResultMapper.listByObjectIdAndEvaluateItemId(evaluateObjectIdList, evaluateManageItemIdList);
+            //将所有被评对象的所有题的总得分处理成Map
+            sumScoreMap = listByObjectIdAndEvaluateItemId.stream()
+                    .collect(Collectors.groupingBy(ResultViewingPageVo::getObjectId));
+
+            /*//获取该评价管理下的所有被评对象的标题的总得分
+            List<ResultViewingPageVo> listTopicScoreByObjectIdAndTopic = evaluateResultMapper.listTopicScoreByObjectIdAndTopic(evaluateObjectIdList, evaluateManageItemIdList);
+            //将所有被评对象的标题的总得分处理成Map
+            topicScoreMap = listTopicScoreByObjectIdAndTopic.stream()
+                    .collect(Collectors.groupingBy(ResultViewingPageVo::getObjectId));*/
+
+            //获取该评价管理下的所有被评对象的总得分
+            List<ResultViewingPageVo> listSynthesisScore = evaluateResultMapper.listSynthesisScore(evaluateObjectIdList, evaluateManageItemIdList);
+            //将所有被评对象的总得分处理成Map
+            for (ResultViewingPageVo r : listSynthesisScore) {
+                synthesisScoreMap.put(r.getObjectId(), r.getSynthesisScore());
+            }
+
+            /*MPJLambdaWrapper<EvaluateResult> evaluateResultMPJLambdaWrapper = new MPJLambdaWrapper<>();
+            evaluateResultMPJLambdaWrapper
+                    .selectSum(EvaluateResult::getScore, ResultViewingPageVo::getSumScore)
+                    .selectAs(EvaluateObject::getObjectId, ResultViewingPageVo::getObjectId)
+                    .selectAs(EvaluateResult::getEvaluateItemId, ResultViewingPageVo::getEvaluateManageItemId)
+                    .leftJoin(EvaluateObject.class, EvaluateObject::getId, EvaluateResult::getEvaluatedObjectId)
+                    .in(EvaluateObject::getObjectId, evaluateObjectIdList)
+                    .in(EvaluateResult::getEvaluateItemId, evaluateManageItemIdList)
+                    .groupBy(EvaluateResult::getEvaluateItemId, EvaluateObject::getEvaluateManageId)
+                    .disableSubLogicDel();
+            ResultViewingPageVo sumScore = evaluateResultMapper.selectJoinOne(ResultViewingPageVo.class, evaluateResultMPJLambdaWrapper);*/
+        }
+        //遍历分页记录
+        for (ResultViewingPageVo resultViewingPageVo : resultViewingPageVoList) {
+            List<ResultViewingPageVo> sumScoreList = sumScoreMap.get(resultViewingPageVo.getObjectId());
+            if(sumScoreList != null && sumScoreList.size() > 0){
+                for (ResultViewingPageVo r : sumScoreList) {
+                    customerList.add(new ResultViewingExcelVo(){{
+                        setObjectId(resultViewingPageVo.getObjectId());
+                        setObjectIdCN(resultViewingPageVo.getObjectIdCN());
+                        setEvaluateManageItemId(r.getEvaluateManageItemId());
+                        setProblem(evaluateManageItemMap.get(r.getEvaluateManageItemId()).getProblem());
+                        setTopic(evaluateManageItemMap.get(r.getEvaluateManageItemId()).getTopic());
+                        setPlanExecuterNum(planAndActualExecuterNumMap.get(resultViewingPageVo.getObjectId()).getPlanExecuterNum());
+                        int actualExecuterNum = planAndActualExecuterNumMap.get(resultViewingPageVo.getObjectId()).getActualExecuterNum();
+                        setActualExecuterNum(actualExecuterNum);
+                        setSumScore(r.getSumScore()/actualExecuterNum);
+                        setSynthesisScore(synthesisScoreMap.get(resultViewingPageVo.getObjectId())/actualExecuterNum);
+                    }});
+                }
+            }
+        }
+//        SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日 HH:mm:ss");
+//        for (TextbookIssueRecordPageVo textbookIssueRecordPageVo : customerList) {
+//            if(textbookIssueRecordPageVo.getCreateDate() == null){
+//                continue;
+//            }
+//            textbookIssueRecordPageVo.setCreateDateStr(sdf.format(textbookIssueRecordPageVo.getCreateDate()));
+//            dataList.add(BeanUtil.toBean(textbookIssueRecordPageVo, TextbookIssueRecordExcelVo.class));
+//        }
+
+
+        //返回流
+        ByteArrayOutputStream bot = new ByteArrayOutputStream();
+
+        // 设置排除的属性 也可以在数据模型的字段上加@ExcelIgnore注解排除
+        /*Set<String> excludeField = new HashSet<>();
+        excludeField.add("hireDate");
+        excludeField.add("salary");
+        // 写Excel
+        EasyExcel.write(filename, User.class)
+            .excludeColumnFiledNames(excludeField)
+            .sheet("用户信息")
+            .doWrite(getUserData());*/
+
+        // 方法2 自定义合并单元格策略
+        String fileName = "ResultViewing" + ExcelTypeEnum.XLSX.getValue();
+        // 每隔2行会合并 把eachColumn 设置成 3 也就是我们数据的长度,所以就第一列会合并。当然其他合并策略也可以自己写
+        LoopMergeStrategy loopMergeStrategy = new LoopMergeStrategy(evaluateManageItemNum, 0);
+        LoopMergeStrategy loopMergeStrategy1 = new LoopMergeStrategy(evaluateManageItemNum, 1);
+        LoopMergeStrategy loopMergeStrategy2 = new LoopMergeStrategy(evaluateManageItemNum, 2);
+        LoopMergeStrategy loopMergeStrategy3 = new LoopMergeStrategy(evaluateManageItemNum, 5);
+
+        EasyExcel.write(bot, ResultViewingExcelVo.class)
+                .automaticMergeHead(false)
+                .excelType(ExcelTypeEnum.XLSX)
+                .registerWriteHandler(loopMergeStrategy)
+                .registerWriteHandler(loopMergeStrategy1)
+                .registerWriteHandler(loopMergeStrategy2)
+                .registerWriteHandler(loopMergeStrategy3)
+                .sheet()
+                .doWrite(customerList);
+        return RT.fileStream(bot.toByteArray(), fileName);
     }
 }

+ 96 - 0
src/main/java/com/xjrsoft/module/evaluate/vo/ResultViewingExcelVo.java

@@ -0,0 +1,96 @@
+package com.xjrsoft.module.evaluate.vo;
+
+import com.alibaba.excel.annotation.ExcelIgnore;
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.alibaba.excel.annotation.write.style.ColumnWidth;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+* @title: 评价项表单出参
+* @Author szs
+* @Date: 2024-01-15
+* @Version 1.0
+*/
+/**
+ * @OnceAbsoluteMerge 指定从哪一行/列开始,哪一行/列结束,进行单元格合并
+ * firstRowIndex 起始行索引,从0开始
+ * lastRowIndex 结束行索引
+ * firstColumnIndex 起始列索引,从0开始
+ * lastColumnIndex 结束列索引
+ */
+// 例如: 第2-3行,2-3列进行合并
+//@OnceAbsoluteMerge(firstRowIndex = 1, lastRowIndex = 2, firstColumnIndex = 1, lastColumnIndex = 2)
+@Data
+public class ResultViewingExcelVo {
+
+    /**
+    * 具体被评的那个对象的id
+    */
+    @ExcelIgnore
+    @ApiModelProperty("具体被评的那个对象的id")
+    private Long objectId;
+    /**
+     * 具体被评的那个对象的id
+     */
+
+//  每隔两行合并一次(竖着合并单元格)
+//    @ContentLoopMerge(eachRow = 2)
+    @ExcelProperty(index = 0, value = "被评对象")
+    @ColumnWidth(20)
+    @ApiModelProperty("具体被评的那个对象的id")
+    private String objectIdCN;
+    /**
+     * 应打分人数
+     */
+    @ExcelProperty(index = 1, value = "应打分人数")
+    @ColumnWidth(10)
+    @ApiModelProperty("应打分人数")
+    private Integer planExecuterNum;
+    /**
+     * 实际打分人数
+     */
+    @ExcelProperty(index = 2, value = "实际打分人数")
+    @ColumnWidth(10)
+    @ApiModelProperty("实际打分人数")
+    private Integer actualExecuterNum;
+    /**
+     * 题目项的id
+     */
+    @ExcelIgnore
+    @ApiModelProperty("题目项的id")
+    private Long evaluateManageItemId;
+    /**
+     * 题目名称
+     */
+    @ExcelProperty(index = 3, value = "题目名称")
+    @ColumnWidth(50)
+    @ApiModelProperty("题目名称")
+    private String problem;
+    /**
+     * 单个被评对象的每一道题的总得分
+     */
+    @ExcelProperty(index = 4, value = "得分")
+    @ColumnWidth(10)
+    @ApiModelProperty("单个被评对象的每一道题的总得分")
+    private Integer sumScore;
+    /**
+     * 标题名称
+     */
+    @ExcelIgnore
+    @ApiModelProperty("标题名称")
+    private String topic;
+    /**
+     * 单个被评对象的每一道题的平均得分
+     */
+    @ExcelIgnore
+    @ApiModelProperty("单个被评对象的每个标题的平均得分")
+    private Integer topicScore;
+    /**
+     * 单个被评对象的每一道题的平均得分
+     */
+    @ExcelProperty(index = 5, value = "综合平均得分")
+    @ColumnWidth(10)
+    @ApiModelProperty("单个被评对象的综合平均得分")
+    private Integer synthesisScore;
+}

+ 21 - 10
src/main/java/com/xjrsoft/module/evaluate/vo/ResultViewingPageVo.java

@@ -22,6 +22,16 @@ public class ResultViewingPageVo {
      */
     @ApiModelProperty("具体被评的那个对象的id")
     private String objectIdCN;
+    /**
+     * 应打分人数
+     */
+    @ApiModelProperty("应打分人数")
+    private Integer planExecuterNum;
+    /**
+     * 实际打分人数
+     */
+    @ApiModelProperty("实际打分人数")
+    private Integer actualExecuterNum;
     /**
      * 题目项的id
      */
@@ -32,24 +42,25 @@ public class ResultViewingPageVo {
      */
     @ApiModelProperty("题目名称")
     private String problem;
+    /**
+     * 单个被评对象的每一道题的平均得分
+     */
+    @ApiModelProperty("单个被评对象的每一道题的平均得分")
+    private Integer sumScore;
     /**
      * 标题名称
      */
     @ApiModelProperty("标题名称")
     private String topic;
     /**
-     * 应打分人数
-     */
-    @ApiModelProperty("应打分人数")
-    private Integer planExecuterNum;
-    /**
-     * 实际打分人数
+     * 单个被评对象的每一道题的平均得分
      */
-    @ApiModelProperty("实际打分人数")
-    private Integer actualExecuterNum;
+    @ApiModelProperty("单个被评对象的每个标题的平均得分")
+    private Integer topicScore;
     /**
      * 单个被评对象的每一道题的平均得分
      */
-    @ApiModelProperty("单个被评对象的每一道题的平均得分")
-    private Integer sumScore;
+    @ApiModelProperty("单个被评对象的综合平均得分")
+    private Integer synthesisScore;
+
 }

+ 11 - 12
src/main/java/com/xjrsoft/module/student/controller/BaseStudentAssessmentInspectionController.java

@@ -6,10 +6,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.xjrsoft.common.model.result.RT;
 import com.xjrsoft.common.page.ConventPage;
 import com.xjrsoft.common.page.PageOutput;
-import com.xjrsoft.module.student.dto.AddBaseStudentAssessmentInspectionDto;
-import com.xjrsoft.module.student.dto.BaseStudentAssessmentInspectionMobilePageDto;
-import com.xjrsoft.module.student.dto.BaseStudentAssessmentInspectionPageDto;
-import com.xjrsoft.module.student.dto.UpdateBaseStudentAssessmentInspectionDto;
+import com.xjrsoft.module.student.dto.*;
 import com.xjrsoft.module.student.entity.BaseStudentAssessmentInspection;
 import com.xjrsoft.module.student.service.IBaseStudentAssessmentInspectionService;
 import com.xjrsoft.module.student.vo.BaseStudentAssessmentInspectionMobilePageVo;
@@ -19,14 +16,8 @@ import com.xjrsoft.module.student.vo.BaseStudentAssessmentInspectionVo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.*;
 
 import javax.validation.Valid;
 import java.util.List;
@@ -104,7 +95,15 @@ public class BaseStudentAssessmentInspectionController {
     @SaCheckPermission("basestudentassessmentinspection:delete")
     public RT<Boolean> delete(@Valid @RequestBody List<Long> ids) {
         return RT.ok(baseStudentAssessmentInspectionService.removeBatchByIds(ids));
+    }
 
+//    @PostMapping("/export-query")
+//    @ApiOperation(value = "入参导出")
+//    public ResponseEntity<byte[]>  exportDataQuery(@Valid @RequestBody QuantitativeAssessmentExcelDto dto) {
+    @GetMapping("/export")
+    @ApiOperation(value = "导出")
+    public ResponseEntity<byte[]>  exportDataQuery() {
+        return baseStudentAssessmentInspectionService.getQuantitativeAssessmentExcelByte(new QuantitativeAssessmentExcelDto());
     }
 
 }

+ 25 - 0
src/main/java/com/xjrsoft/module/student/dto/QuantitativeAssessmentExcelDto.java

@@ -0,0 +1,25 @@
+package com.xjrsoft.module.student.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+
+/**
+* @title: 导出班级量化考核入参
+* @Author szs
+* @Date: 2023-12-28
+* @Version 1.0
+*/
+@Data
+public class QuantitativeAssessmentExcelDto implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+    * 年月(2023-12)
+    */
+    @ApiModelProperty("年月(2023-12)")
+    private String yearAndMonth;
+}

+ 7 - 4
src/main/java/com/xjrsoft/module/student/mapper/BaseStudentAssessmentInspectionMapper.java

@@ -4,12 +4,13 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.github.yulichang.base.MPJBaseMapper;
 import com.xjrsoft.module.student.dto.BaseStudentAssessmentInspectionMobilePageDto;
 import com.xjrsoft.module.student.dto.BaseStudentAssessmentInspectionPageDto;
+import com.xjrsoft.module.student.dto.QuantitativeAssessmentExcelDto;
 import com.xjrsoft.module.student.entity.BaseStudentAssessmentInspection;
-import com.xjrsoft.module.student.vo.BaseStudentAssessmentInspectionMobilePageVo;
-import com.xjrsoft.module.student.vo.BaseStudentAssessmentInspectionMobileVo;
-import com.xjrsoft.module.student.vo.BaseStudentAssessmentInspectionPageVo;
-import com.xjrsoft.module.student.vo.BaseStudentAssessmentInspectionVo;
+import com.xjrsoft.module.student.vo.*;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 /**
 * @title: 学生班级巡查考核
@@ -46,4 +47,6 @@ public interface BaseStudentAssessmentInspectionMapper extends MPJBaseMapper<Bas
      * @return
      */
     BaseStudentAssessmentInspectionMobileVo getMobileInfo(Long id);
+
+    List<StudentIndividualBehaviorExcelVo> getStudentIndividualBehaviorExcelVoList(@Param("dto") QuantitativeAssessmentExcelDto dto);
 }

+ 5 - 0
src/main/java/com/xjrsoft/module/student/service/IBaseStudentAssessmentInspectionService.java

@@ -4,11 +4,13 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.github.yulichang.base.MPJBaseService;
 import com.xjrsoft.module.student.dto.BaseStudentAssessmentInspectionMobilePageDto;
 import com.xjrsoft.module.student.dto.BaseStudentAssessmentInspectionPageDto;
+import com.xjrsoft.module.student.dto.QuantitativeAssessmentExcelDto;
 import com.xjrsoft.module.student.entity.BaseStudentAssessmentInspection;
 import com.xjrsoft.module.student.vo.BaseStudentAssessmentInspectionMobilePageVo;
 import com.xjrsoft.module.student.vo.BaseStudentAssessmentInspectionMobileVo;
 import com.xjrsoft.module.student.vo.BaseStudentAssessmentInspectionPageVo;
 import com.xjrsoft.module.student.vo.BaseStudentAssessmentInspectionVo;
+import org.springframework.http.ResponseEntity;
 
 /**
 * @title: 学生班级巡查考核
@@ -44,4 +46,7 @@ public interface IBaseStudentAssessmentInspectionService extends MPJBaseService<
      * @return
      */
     BaseStudentAssessmentInspectionMobileVo getMobileInfo(Long id);
+
+
+    ResponseEntity<byte[]> getQuantitativeAssessmentExcelByte(QuantitativeAssessmentExcelDto dto);
 }

+ 35 - 5
src/main/java/com/xjrsoft/module/student/service/impl/BaseStudentAssessmentInspectionServiceImpl.java

@@ -1,16 +1,21 @@
 package com.xjrsoft.module.student.service.impl;
 
 import cn.dev33.satoken.stp.StpUtil;
+import com.alibaba.excel.EasyExcel;
+import com.alibaba.excel.support.ExcelTypeEnum;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.github.yulichang.base.MPJBaseServiceImpl;
 import com.github.yulichang.toolkit.MPJWrappers;
 import com.xjrsoft.common.enums.ScoreTypeEnum;
+import com.xjrsoft.common.model.result.RT;
 import com.xjrsoft.common.utils.VoToColumnUtil;
 import com.xjrsoft.module.base.entity.BaseClass;
 import com.xjrsoft.module.base.mapper.BaseClassMapper;
+import com.xjrsoft.module.evaluate.vo.ResultViewingExcelVo;
 import com.xjrsoft.module.student.dto.BaseStudentAssessmentInspectionMobilePageDto;
 import com.xjrsoft.module.student.dto.BaseStudentAssessmentInspectionPageDto;
+import com.xjrsoft.module.student.dto.QuantitativeAssessmentExcelDto;
 import com.xjrsoft.module.student.entity.BaseStudentAssessmentClassRelation;
 import com.xjrsoft.module.student.entity.BaseStudentAssessmentInspection;
 import com.xjrsoft.module.student.entity.BaseStudentAssessmentStudentRelation;
@@ -18,18 +23,17 @@ import com.xjrsoft.module.student.mapper.BaseStudentAssessmentClassRelationMappe
 import com.xjrsoft.module.student.mapper.BaseStudentAssessmentInspectionMapper;
 import com.xjrsoft.module.student.mapper.BaseStudentAssessmentStudentRelationMapper;
 import com.xjrsoft.module.student.service.IBaseStudentAssessmentInspectionService;
-import com.xjrsoft.module.student.vo.BaseStudentAssessmentClassListVo;
-import com.xjrsoft.module.student.vo.BaseStudentAssessmentInspectionMobilePageVo;
-import com.xjrsoft.module.student.vo.BaseStudentAssessmentInspectionMobileVo;
-import com.xjrsoft.module.student.vo.BaseStudentAssessmentInspectionPageVo;
-import com.xjrsoft.module.student.vo.BaseStudentAssessmentInspectionVo;
+import com.xjrsoft.module.student.vo.*;
 import com.xjrsoft.module.system.entity.File;
 import com.xjrsoft.module.system.service.IFileService;
 import com.xjrsoft.module.teacher.entity.XjrUser;
 import lombok.AllArgsConstructor;
+import org.springframework.http.ResponseEntity;
 import org.springframework.stereotype.Service;
 
+import java.io.ByteArrayOutputStream;
 import java.util.List;
+import java.util.Map;
 import java.util.stream.Collectors;
 
 /**
@@ -147,4 +151,30 @@ public class BaseStudentAssessmentInspectionServiceImpl extends MPJBaseServiceIm
 
         return result;
     }
+
+    @Override
+    public ResponseEntity<byte[]> getQuantitativeAssessmentExcelByte(QuantitativeAssessmentExcelDto dto) {
+        String fileName = "StudentAssessmentInspection" + ExcelTypeEnum.XLSX.getValue();
+        ByteArrayOutputStream bot = new ByteArrayOutputStream();
+        //TODO 学生个人行为原始数据
+        //求所有的个人行为集合
+        List<StudentIndividualBehaviorExcelVo> studentIndividualBehaviorExcelVoList = assessmentInspectionMapper.getStudentIndividualBehaviorExcelVoList(dto);
+        Map<Long, List<StudentIndividualBehaviorExcelVo>> studentIndividualBehaviorExcelVoListMap =  studentIndividualBehaviorExcelVoList.stream()
+                .collect(Collectors.groupingBy(StudentIndividualBehaviorExcelVo::getStudentUserId));
+
+        //未合并
+        EasyExcel.write(bot, ResultViewingExcelVo.class)
+                .automaticMergeHead(false)
+                .excelType(ExcelTypeEnum.XLSX)
+                .sheet("学生个人行为")
+                .doWrite(studentIndividualBehaviorExcelVoList);
+
+        //TODO 班级常规管理原始数据
+
+        //TODO 获奖原始数据
+
+        //TODO 班级量化考核统计表总
+
+        return RT.fileStream(bot.toByteArray(), fileName);
+    }
 }

+ 121 - 0
src/main/java/com/xjrsoft/module/student/vo/StudentIndividualBehaviorExcelVo.java

@@ -0,0 +1,121 @@
+package com.xjrsoft.module.student.vo;
+
+import com.alibaba.excel.annotation.ExcelIgnore;
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.alibaba.excel.annotation.format.DateTimeFormat;
+import com.alibaba.excel.annotation.write.style.ColumnWidth;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+
+/**
+* @title: 个人行为导出出参
+* @Author szs
+* @Date: 2024-01-25
+* @Version 1.0
+*/
+
+/**
+ * @OnceAbsoluteMerge 指定从哪一行/列开始,哪一行/列结束,进行单元格合并
+ * firstRowIndex 起始行索引,从0开始
+ * lastRowIndex 结束行索引
+ * firstColumnIndex 起始列索引,从0开始
+ * lastColumnIndex 结束列索引
+ */
+// 例如: 第2-3行,2-3列进行合并
+//@OnceAbsoluteMerge(firstRowIndex = 1, lastRowIndex = 2, firstColumnIndex = 1, lastColumnIndex = 2)
+@Data
+public class StudentIndividualBehaviorExcelVo {
+
+    /**
+    * 班主任user_id
+    */
+    //每隔两行合并一次(竖着合并单元格)
+    //@ContentLoopMerge(eachRow = 2)
+    @ExcelIgnore
+    @ApiModelProperty("班主任user_id")
+    private Long headTeacherUserId;
+    /**
+     * 班主任姓名
+     */
+    @ExcelProperty(index = 0, value = "班主任姓名")
+    @ColumnWidth(30)
+    @ApiModelProperty("班主任姓名")
+    private String headTeacherName;
+    /**
+     * 班级id
+     */
+    @ExcelIgnore
+    @ApiModelProperty("班级id")
+    private Long classId;
+    /**
+     * 班级名
+     */
+    @ExcelProperty(index = 1, value = "班级名")
+    @ColumnWidth(30)
+    @ApiModelProperty("班级名")
+    private String className;
+    /**
+     * 学生user_id
+     */
+    @ExcelIgnore
+    @ApiModelProperty("学生user_id")
+    private Long studentUserId;
+    /**
+     * 学号
+     */
+    @ExcelProperty(index = 2, value = "学号")
+    @ColumnWidth(30)
+    @ApiModelProperty("学号")
+    private String studentId;
+    /**
+     * 学生名
+     */
+    @ExcelProperty(index = 3, value = "学生名")
+    @ColumnWidth(30)
+    @ApiModelProperty("学生名")
+    private String studentName;
+    /**
+     * 学生基础分数
+     */
+    @ExcelProperty(index = 4, value = "学生基础分数")
+    @ColumnWidth(10)
+    @ApiModelProperty("学生基础分数")
+    private Integer baseScore;
+    /**
+     * 考核项目id
+     */
+    @ExcelIgnore
+    @ApiModelProperty("考核项目id")
+    private Long baseStudentAssessmentProjectId;
+    /**
+     * 考核项目
+     */
+    @ExcelProperty(index = 5, value = "考核项目")
+    @ColumnWidth(60)
+    @ApiModelProperty("考核项目")
+    private String baseStudentAssessmentProjectIdCN;
+    /**
+     * 考核项目
+     */
+    @DateTimeFormat("yyyy年MM月dd日HH时mm分ss秒")
+    @ExcelProperty(index = 6, value = "考核时间")
+    @ColumnWidth(60)
+    @ApiModelProperty("考核时间")
+    private LocalDateTime assessmentDate;
+    /**
+     * 项目分数
+     */
+    @ExcelProperty(index = 7, value = "项目分数")
+    @ColumnWidth(10)
+    @ApiModelProperty("项目分数")
+    private Integer projectScore;
+    /**
+     * 最终得分
+     */
+    @ExcelProperty(index = 8, value = "最终得分")
+    @ColumnWidth(10)
+    @ApiModelProperty("最终得分")
+    private Integer finalScore;
+}

+ 38 - 0
src/main/resources/mapper/evaluate/EvaluateResultMapper.xml

@@ -150,4 +150,42 @@
         </foreach>
         group by t1.object_id, t.evaluate_item_id;
     </select>
+
+    <select id="listTopicScoreByObjectIdAndTopic" resultType="com.xjrsoft.module.evaluate.vo.ResultViewingPageVo">
+        select sum(t.score)       as topicScore,
+        t1.object_id       as objectId,
+        t2.topic
+        from evaluate_result t
+        left join evaluate_object t1 on t1.id = t.evaluated_object_id
+        left join evaluate_manage_item t2 on t2.id = t.evaluate_item_id
+        where t.evaluate_item_id in
+        <foreach item="evaluateManageItemId" index="index" collection="evaluateManageItemIdList" open="(" close=")"
+                 separator=",">
+            #{evaluateManageItemId}
+        </foreach>
+        and t1.object_id in
+        <foreach item="evaluateObjectId" index="index" collection="evaluateObjectIdList" open="(" close=")"
+                 separator=",">
+            #{evaluateObjectId}
+        </foreach>
+        group by t1.object_id, t2.topic;
+    </select>
+
+    <select id="listSynthesisScore" resultType="com.xjrsoft.module.evaluate.vo.ResultViewingPageVo">
+        select sum(t.score)       as synthesisScore,
+        t1.object_id       as objectId
+        from evaluate_result t
+        left join evaluate_object t1 on t1.id = t.evaluated_object_id
+        where t.evaluate_item_id in
+        <foreach item="evaluateManageItemId" index="index" collection="evaluateManageItemIdList" open="(" close=")"
+                 separator=",">
+            #{evaluateManageItemId}
+        </foreach>
+        and t1.object_id in
+        <foreach item="evaluateObjectId" index="index" collection="evaluateObjectIdList" open="(" close=")"
+                 separator=",">
+            #{evaluateObjectId}
+        </foreach>
+        group by t1.object_id;
+    </select>
 </mapper>

+ 40 - 0
src/main/resources/mapper/student/BaseStudentAssessmentInspectionMapper.xml

@@ -102,4 +102,44 @@
         left join xjr_user t7 on t1.create_user_id=t7.id
         where t.id=#{id};
     </select>
+
+    <select id="getStudentIndividualBehaviorExcelVoList" parameterType="com.xjrsoft.module.student.dto.QuantitativeAssessmentExcelDto" resultType="com.xjrsoft.module.student.vo.StudentIndividualBehaviorExcelVo">
+        with total_score as (
+        select
+        t.user_id as studentUserId,
+        sum(if(t1.score_type = 'score_add', t1.score, -1 * t1.score)) as finalScore
+        from base_student_assessment_student_relation t
+        left join base_student_assessment_inspection t1 on t1.id = t.base_student_assessment_inspection_id
+        where t1.delete_mark = 0
+        <if test="dto.yearAndMonth != null and dto.yearAndMonth != ''">
+            and date_format(t1.assessment_date, '%Y-%m') = #{dto.yearAndMonth}
+        </if>
+        group by t.user_id
+        )
+        select
+        t4.id as headTeacherUserId,
+        t4.name as headTeacherName,
+        t.class_id as classId,
+        t.class_name as className,
+        t.user_id as studentUserId,
+        t.student_id as studentId,
+        t.name as studentName,
+        t5.base_score as baseScore,
+        t2.id as baseStudentAssessmentProjectId,
+        t2.name as baseStudentAssessmentProjectIdCN,
+        t1.assessment_date as assessmentDate,
+        if(t1.score_type = 'score_add', t1.score, -1 * t1.score) as projectScore,
+        t5.base_score + t6.finalScore as finalScore
+        from base_student_assessment_student_relation t
+        left join base_student_assessment_inspection t1 on t1.id = t.base_student_assessment_inspection_id
+        left join base_student_assessment_project t2 on t2.id = t1.base_student_assessment_project_id
+        left join base_class t3 on t3.id = t.class_id
+        left join xjr_user t4 on t4.id = t3.teacher_id
+        left join base_student_assessment_base_score t5 on t5.base_semester_id = t1.base_semester_id
+        left join total_score t6 on t6.studentUserId = t.user_id
+        where t1.delete_mark = 0
+        <if test="dto.yearAndMonth != null and dto.yearAndMonth != ''">
+            and date_format(t1.assessment_date, '%Y-%m') = #{dto.yearAndMonth}
+        </if>
+    </select>
 </mapper>

+ 10 - 0
src/test/java/com/xjrsoft/xjrsoftboot/DateTime.java

@@ -3,6 +3,8 @@ package com.xjrsoft.xjrsoftboot;
 import cn.hutool.core.date.DateUtil;
 import org.junit.jupiter.api.Test;
 
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -24,4 +26,12 @@ public class DateTime {
         List<Long> classIdList = new ArrayList<>();
         System.err.println(list.contains(classIdList));
     }
+
+    @Test
+    public void LocalDateTimeTest(){
+        String dateString = "2022-01-01";
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+        LocalDateTime dateTime = LocalDateTime.parse(dateString, formatter);
+        System.err.println(dateTime);
+    }
 }