Sfoglia il codice sorgente

Merge branch 'pre'

dzx 1 anno fa
parent
commit
fe1aa4371c

+ 9 - 5
src/main/java/com/xjrsoft/module/classtime/controller/ClassTimeStatisticsController.java

@@ -2,6 +2,7 @@ package com.xjrsoft.module.classtime.controller;
 
 import cn.dev33.satoken.annotation.SaCheckPermission;
 import cn.hutool.core.bean.BeanUtil;
+import com.alibaba.excel.support.ExcelTypeEnum;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -25,6 +26,7 @@ import com.xjrsoft.module.classtime.vo.ClassTimeStatisticsVo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
+import org.springframework.http.ResponseEntity;
 import org.springframework.web.bind.annotation.DeleteMapping;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -35,6 +37,7 @@ import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.validation.Valid;
+import java.io.IOException;
 import java.time.LocalDate;
 import java.util.Date;
 import java.util.List;
@@ -131,7 +134,7 @@ public class ClassTimeStatisticsController {
                 new QueryWrapper<ClassTimeStatistics>().lambda().orderByDesc(ClassTimeStatistics::getEndDate)
         );
         if (list.isEmpty()) {
-            return RT.error("未查询到数据");
+            return RT.ok();
         }
         ClassTimeStatistics result = list.get(0);
         return RT.ok(result.getEndDate());
@@ -188,12 +191,13 @@ public class ClassTimeStatisticsController {
         return RT.ok(recordList);
     }
 
-    @GetMapping(value = "/record-export")
+    @PostMapping(value = "/record-export-query")
     @ApiOperation(value="课时统计详情导出")
     @SaCheckPermission("classtimestatistics:detail")
-    public RT<List<ClassTimeStatisticsRecordVo>> recordExport(@Valid RefreshStatisticsDto dto){
-        List<ClassTimeStatisticsRecordVo> recordList = classTimeStatisticsService.getRecordList(dto.getId());
-        return RT.ok(recordList);
+    public ResponseEntity<byte[]> recordExport(@Valid @RequestBody  RefreshStatisticsDto dto) throws IOException {
+        byte[] bytes = classTimeStatisticsService.recordExport(dto.getId());
+        String fileName = "recordExport" + ExcelTypeEnum.XLSX.getValue();
+        return RT.fileStream(bytes, fileName);
     }
 
 }

+ 8 - 0
src/main/java/com/xjrsoft/module/classtime/service/IClassTimeStatisticsService.java

@@ -6,6 +6,7 @@ import com.xjrsoft.module.classtime.entity.ClassTimeStatistics;
 import com.xjrsoft.module.classtime.vo.ClassTimeStatisticsRecordVo;
 import org.apache.ibatis.annotations.Param;
 
+import java.io.IOException;
 import java.util.List;
 
 /**
@@ -57,4 +58,11 @@ public interface IClassTimeStatisticsService extends MPJBaseService<ClassTimeSta
     Boolean lockData(Long id);
 
     List<ClassTimeStatisticsRecordVo> getRecordList(@Param("id") Long id);
+
+    /**
+     * 导出明细
+     * @param id
+     * @return
+     */
+    byte[] recordExport(Long id) throws IOException;
 }

+ 374 - 11
src/main/java/com/xjrsoft/module/classtime/service/impl/ClassTimeStatisticsServiceImpl.java

@@ -1,6 +1,10 @@
 package com.xjrsoft.module.classtime.service.impl;
 
 import cn.hutool.core.bean.BeanUtil;
+import com.alibaba.excel.EasyExcel;
+import com.alibaba.excel.ExcelWriter;
+import com.alibaba.excel.support.ExcelTypeEnum;
+import com.alibaba.excel.write.metadata.WriteSheet;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.github.yulichang.base.MPJBaseServiceImpl;
@@ -11,7 +15,6 @@ import com.google.gson.JsonObject;
 import com.google.gson.JsonParser;
 import com.xjrsoft.common.enums.CourseAdjustTypeEnum;
 import com.xjrsoft.common.enums.CourseTimeTypeEnum;
-import com.xjrsoft.common.enums.EnabledMark;
 import com.xjrsoft.common.exception.MyException;
 import com.xjrsoft.module.classtime.dto.AddClassTimeStatisticsDto;
 import com.xjrsoft.module.classtime.entity.ClassTimeDelete;
@@ -29,12 +32,27 @@ import com.xjrsoft.module.classtime.vo.TeacherListVo;
 import com.xjrsoft.module.classtime.vo.WeekTimeRangeVo;
 import com.xjrsoft.module.oa.entity.WfTeacherCourseTime;
 import lombok.AllArgsConstructor;
+import org.apache.poi.ss.usermodel.BorderStyle;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.CellStyle;
+import org.apache.poi.ss.usermodel.Font;
+import org.apache.poi.ss.usermodel.HorizontalAlignment;
+import org.apache.poi.ss.usermodel.IndexedColors;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.usermodel.VerticalAlignment;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.apache.poi.ss.util.CellRangeAddress;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
 import java.math.BigDecimal;
 import java.time.DayOfWeek;
 import java.time.LocalDate;
+import java.time.format.DateTimeFormatter;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Date;
@@ -138,7 +156,7 @@ public class ClassTimeStatisticsServiceImpl extends MPJBaseServiceImpl<ClassTime
     @Transactional(rollbackFor = Exception.class)
     public Boolean refreshRecord(ClassTimeStatistics statistics) {
         try {
-            // 1、查询教师
+// 1、查询教师
             List<TeacherListVo> teacherList = this.baseMapper.getTeacherList();
             // 2、查询补课课时
             List<WfTeacherCourseTime> courseTimeList = this.baseMapper.getWfTeacherCourseTimeList(statistics);
@@ -186,6 +204,7 @@ public class ClassTimeStatisticsServiceImpl extends MPJBaseServiceImpl<ClassTime
                 //去重并存到map中
                 deleteMap.put(classId, new HashSet<>(dateList));
             }
+            DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
 
             //查询所有老师发起顶课通过的数量(只查询事假、病假),也要分别计算早自习、晚自习、正课、如果日期出入课时删除中,也需要跳过
             List<CourseListVo> allSubstituteList = this.baseMapper.getSubstituteList(statistics);
@@ -239,20 +258,24 @@ public class ClassTimeStatisticsServiceImpl extends MPJBaseServiceImpl<ClassTime
                         continue;
                     }
                     if("早自习".equals(courseListVo.getShortName())){
-                        classTime7 += weightSetMap.get(courseListVo.getShortName());
+                        classTime7 += weightSetMap.get(courseListVo.getShortName()) == null ? 0d : weightSetMap.get(courseListVo.getShortName());
                     }else if(zkList.contains(courseListVo.getShortName())){
-                        classTime8 += weightSetMap.get(courseListVo.getShortName());
+                        classTime8 += weightSetMap.get(courseListVo.getShortName()) == null ? 0d : weightSetMap.get(courseListVo.getShortName());
                     }else if(wzxList.contains(courseListVo.getShortName())){
-                        classTime9 += weightSetMap.get(courseListVo.getShortName());
+                        classTime9 += weightSetMap.get(courseListVo.getShortName()) == null ? 0d : weightSetMap.get(courseListVo.getShortName());
                     }
 
                     if(courseListVo.getAdjustType() != null && !courseListVo.getAdjustType().isEmpty()){
-                        if(CourseAdjustTypeEnum.courseSubstitute.getCode().equals(courseListVo.getAdjustType())){
-                            classTime10 += weightSetMap.get(courseListVo.getShortName());
-                        }else if(CourseAdjustTypeEnum.courseExchange.getCode().equals(courseListVo.getAdjustType())){
+                        if(CourseAdjustTypeEnum.courseExchange.getCode().equals(courseListVo.getAdjustType())){
                             classTime11 += weightSetMap.get(courseListVo.getShortName());
                         }
                     }
+                    JsonObject courseJson = new JsonObject();
+                    courseJson.addProperty("type", courseListVo.getShortName());
+                    courseJson.addProperty("scheduleDate", courseListVo.getScheduleDate().format(formatter));
+                    courseJson.addProperty("content", courseListVo.getClassName() + "," + courseListVo.getCourseName());
+                    courseJson.addProperty("adjustType", courseListVo.getAdjustType());
+                    allClassTimeDataArray.add(courseJson);
                 }
                 record.setClassTime7(classTime7);
                 record.setClassTime8(classTime8);
@@ -279,11 +302,11 @@ public class ClassTimeStatisticsServiceImpl extends MPJBaseServiceImpl<ClassTime
                         }
 
                         if("早自习".equals(courseListVo.getShortName())){
-                            zkTimes += weightSetMap.get(courseListVo.getShortName());
+                            zkTimes += weightSetMap.get(courseListVo.getShortName()) == null ? 0d : weightSetMap.get(courseListVo.getShortName());
                         }else if(zkList.contains(courseListVo.getShortName())){
-                            zkTimes += weightSetMap.get(courseListVo.getShortName());
+                            zkTimes += weightSetMap.get(courseListVo.getShortName()) == null ? 0d : weightSetMap.get(courseListVo.getShortName());
                         }else if(wzxList.contains(courseListVo.getShortName())){
-                            wzxTimes += weightSetMap.get(courseListVo.getShortName());
+                            wzxTimes += weightSetMap.get(courseListVo.getShortName()) == null ? 0d : weightSetMap.get(courseListVo.getShortName());
                         }
 
                         if(courseListVo.getAdjustType() != null && !courseListVo.getAdjustType().isEmpty()){
@@ -457,6 +480,346 @@ public class ClassTimeStatisticsServiceImpl extends MPJBaseServiceImpl<ClassTime
         return this.baseMapper.getRecordList(id);
     }
 
+    /**
+     * 导出课时统计明细
+     * @param id
+     * @return
+     */
+    @Override
+    public byte[] recordExport(Long id) throws IOException {
+        try {
+            //1、查询数据
+            List<ClassTimeStatisticsRecordVo> recordList = this.baseMapper.getRecordList(id);
+            //计算出一共有多少周
+            ClassTimeStatistics statistics = this.getById(id);
+            List<WeekTimeRangeVo> weekTimeRangeVos = calculateNaturalWeeks(statistics.getStartDate(), statistics.getEndDate());
+            /**
+             * 2、将查询出来的数据按照表头转换成二维数组
+             * 前端固定表头:序号、工号、姓名、教研会、督导听课、临近三年退休政策、出题、阅卷、周末培优、早自习、正课(含调顶课时)、晚辅(含调顶课时)、顶课、调课
+             * 中间动态表头:每周,总课时(含调顶课节)、顶课(节)、调课(节)、晚辅(节)......课时晚辅合计
+             * 后端固定表头:总课时、课时费(元)、外聘教师超课时费(元)、总金额(元)
+             */
+            //计算一共多少列
+            int column = 19 + (4 * weekTimeRangeVos.size());
+            List<ArrayList<String>> dataList = new ArrayList<>();
+            Integer sortCode = 1;
+            JsonParser parser = new JsonParser();
+            for (ClassTimeStatisticsRecordVo recordVo : recordList) {
+                ArrayList<String> rowData = new ArrayList<>();
+                rowData.add(sortCode.toString());//序号
+                rowData.add(recordVo.getUserName());//工号
+                rowData.add(recordVo.getName());//姓名
+                rowData.add(recordVo.getClassTime1()==null?"":recordVo.getClassTime1().toString());//教研会
+                rowData.add(recordVo.getClassTime2()==null?"":recordVo.getClassTime2().toString());//督导听课
+                rowData.add(recordVo.getClassTime3()==null?"":recordVo.getClassTime3().toString());//临近三年退休政策
+                rowData.add(recordVo.getClassTime4()==null?"":recordVo.getClassTime4().toString());//出题
+                rowData.add(recordVo.getClassTime5()==null?"":recordVo.getClassTime5().toString());//阅卷
+                rowData.add(recordVo.getClassTime6()==null?"":recordVo.getClassTime6().toString());//周末培优
+                rowData.add(recordVo.getClassTime7()==null?"":recordVo.getClassTime7().toString());//早自习
+                rowData.add(recordVo.getClassTime8()==null?"":recordVo.getClassTime8().toString());//正课(含调顶课时)
+                rowData.add(recordVo.getClassTime9()==null?"":recordVo.getClassTime9().toString());//晚辅(含调顶课时)
+                rowData.add(recordVo.getClassTime10()==null?"":recordVo.getClassTime10().toString());//顶课
+                rowData.add(recordVo.getClassTime11()==null?"":recordVo.getClassTime11().toString());//调课
+
+                //每周数据
+                JsonObject weekDataJson = parser.parse(recordVo.getWeekData()).getAsJsonObject();
+                JsonArray weekDataArray = weekDataJson.getAsJsonArray("weekData");
+                for (int i = 0; i < weekDataArray.size(); i ++){
+                    JsonObject jsonElement = weekDataArray.get(i).getAsJsonObject();
+                    rowData.add(jsonElement.get("zkTimes").getAsString());//总课时(含调顶课节)
+                    rowData.add(jsonElement.get("dkTimes").getAsString());//顶课(节)
+                    rowData.add(jsonElement.get("tkTimes").getAsString());//调课(节)
+                    rowData.add(jsonElement.get("wzxTimes").getAsString());//晚辅(节)
+                }
+                rowData.add(weekDataJson.get("allTimes").getAsString());//课时晚辅合计
+
+                rowData.add(recordVo.getAllClassTime().toString());//总课时
+                rowData.add(recordVo.getClassTimeAmount().toString());//课时费(元)
+                rowData.add(recordVo.getBeyondClassTimeAmount()==null?"":recordVo.getBeyondClassTimeAmount().toString());//外聘教师超课时费(元)
+                rowData.add(recordVo.getTotalAmount().toString());//总金额(元)
+                dataList.add(rowData);
+                sortCode ++;
+            }
+
+            // 创建一个新的工作簿
+            Workbook workbook = new XSSFWorkbook();
+            // 创建一个工作表(sheet)
+            String sheetName = "数据";
+            Sheet sheet = workbook.createSheet(sheetName);
+
+            // 创建一个字体对象
+            Font font = workbook.createFont();
+            font.setBold(true);// 设置为粗体
+            font.setFontName("宋体");
+            //font.setColor(IndexedColors.RED.getIndex()); // 设置字体颜色为红色
+            font.setFontHeightInPoints((short)24);
+
+
+            // 创建一个单元格样式对象
+            CellStyle cellStyle = workbook.createCellStyle();
+            cellStyle.setFont(font); // 将字体应用到样式
+            cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
+            cellStyle.setAlignment(HorizontalAlignment.CENTER);
+
+            // 第一行表头
+            {
+                Row row = sheet.createRow(0);
+                //合并第一行的列
+                sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, column - 1));
+
+                //3、处理表头
+                String title1 = statistics.getYear() + "年" + statistics.getMonth() + "月课时统计";
+                // 创建单元格并设置值
+                Cell cell = row.createCell(0);
+                cell.setCellValue(title1);
+                cell.setCellStyle(cellStyle);
+
+            }
+
+            //第二行表头
+            createSecondTitle(workbook, sheet, statistics, weekTimeRangeVos.size() * 4 + 1);
+
+            //第三行表头
+            createThirdTitle(workbook, sheet, statistics.getMonth(), weekTimeRangeVos, 13);
+            //第四行表头
+            createFourthTitle(workbook, sheet, weekTimeRangeVos, 13);
+            int dataRowNumber = 4;
+            //设置样式
+            font = workbook.createFont();
+            font.setBold(false);// 设置为粗体
+            font.setFontName("宋体");
+            //font.setColor(IndexedColors.RED.getIndex()); // 设置字体颜色为红色
+            font.setFontHeightInPoints((short)12);
+
+
+            // 创建一个单元格样式对象
+            cellStyle = workbook.createCellStyle();
+            cellStyle.setFont(font); // 将字体应用到样式
+            cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
+            cellStyle.setAlignment(HorizontalAlignment.CENTER);
+            for (ArrayList<String> rowData : dataList) {
+                Row dataRow = sheet.createRow(dataRowNumber);
+                for (int i = 0; i < rowData.size(); i ++){
+                    Cell row1cell2 = dataRow.createCell(i);
+                    row1cell2.setCellValue(rowData.get(i));
+                    row1cell2.setCellStyle(cellStyle);
+                }
+
+                dataRowNumber ++;
+            }
+            //写入文件
+            ByteArrayOutputStream bot = new ByteArrayOutputStream();
+            workbook.write(bot);
+            return bot.toByteArray();
+        }catch (Exception e){
+            log.error(e.getMessage());
+            throw new MyException("导出出错,请联系管理员");
+        }
+    }
+
+    /**
+     * 生成第二行表头
+     * 前端固定表头:序号、工号、姓名、教研会、督导听课、临近三年退休政策、出题、阅卷、周末培优、早自习、正课(含调顶课时)、晚辅(含调顶课时)、顶课、调课
+     * 中间动态表头:每周,总课时(含调顶课节)、顶课(节)、调课(节)、晚辅(节)......课时晚辅合计
+     * 后端固定表头:总课时、课时费(元)、外聘教师超课时费(元)、总金额(元)
+     */
+    void createSecondTitle(Workbook workbook, Sheet sheet, ClassTimeStatistics statistics, int mergeCoulmn){
+        Font font = workbook.createFont();
+        font.setFontName("宋体");
+        font.setFontHeightInPoints((short)12);
+
+        CellStyle cellStyle = workbook.createCellStyle();
+        cellStyle.setFont(font); // 将字体应用到样式
+        cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
+        cellStyle.setAlignment(HorizontalAlignment.CENTER);
+
+        Row row1 = sheet.createRow(1);
+        Cell row1cell1 = row1.createCell(0);
+        row1cell1.setCellValue("序号");
+        row1cell1.setCellStyle(cellStyle);
+
+        Cell row1cell2 = row1.createCell(1);
+        row1cell2.setCellValue("工号");
+        row1cell2.setCellStyle(cellStyle);
+
+        Cell row1cell3 = row1.createCell(2);
+        row1cell3.setCellValue("姓名");
+        row1cell3.setCellStyle(cellStyle);
+
+        Cell row1cell4 = row1.createCell(3);
+        row1cell4.setCellValue("教研会");
+        row1cell4.setCellStyle(cellStyle);
+
+        Cell row1cell5 = row1.createCell(4);
+        row1cell5.setCellValue("督导听课");
+        row1cell5.setCellStyle(cellStyle);
+
+        Cell row1cell6 = row1.createCell(5);
+        row1cell6.setCellValue("临近三年退休政策");
+        row1cell6.setCellStyle(cellStyle);
+
+        Cell row1cell7 = row1.createCell(6);
+        row1cell7.setCellValue("出题");
+        row1cell7.setCellStyle(cellStyle);
+
+        Cell row1cell8 = row1.createCell(7);
+        row1cell8.setCellValue("阅卷");
+        row1cell8.setCellStyle(cellStyle);
+
+        Cell row1cell9 = row1.createCell(8);
+        row1cell9.setCellValue("周末培优");
+        row1cell9.setCellStyle(cellStyle);
+
+        Cell row1cell10 = row1.createCell(9);
+        row1cell10.setCellValue("早自习");
+        row1cell10.setCellStyle(cellStyle);
+
+        Cell row1cell11 = row1.createCell(10);
+        row1cell11.setCellValue("正课(含调顶课时)");
+        row1cell11.setCellStyle(cellStyle);
+
+        Cell row1cell12 = row1.createCell(11);
+        row1cell12.setCellValue("晚辅(含调顶课时)");
+        row1cell12.setCellStyle(cellStyle);
+
+        Cell row1cell13 = row1.createCell(12);
+        row1cell13.setCellValue("顶课");
+        row1cell13.setCellStyle(cellStyle);
+
+        Cell row1cell14 = row1.createCell(13);
+        row1cell14.setCellValue("调课");
+        row1cell14.setCellStyle(cellStyle);
+
+        Cell row1cell15 = row1.createCell(14);
+        row1cell15.setCellValue("正课课时数(平台导出" + statistics.getMonth() + "月)");
+        row1cell15.setCellStyle(cellStyle);
+
+        int index = 14 + mergeCoulmn;
+        Cell row1cell16 = row1.createCell(index);
+        row1cell16.setCellValue("总课时");
+        row1cell16.setCellStyle(cellStyle);
+
+        Cell row1cell17 = row1.createCell(index + 1);
+        row1cell17.setCellValue("课时费(元)");
+        row1cell17.setCellStyle(cellStyle);
+
+        Cell row1cell18 = row1.createCell(index + 2);
+        row1cell18.setCellValue("外聘教师超课时费(元)");
+        row1cell18.setCellStyle(cellStyle);
+
+        Cell row1cell19 = row1.createCell(index + 3);
+        row1cell19.setCellValue("总金额(元)");
+        row1cell19.setCellStyle(cellStyle);
+        //合并表头
+        for(int i = 0; i < 14; i ++){
+            sheet.addMergedRegion(new CellRangeAddress(1, 3, i, i));
+        }
+
+        //合并中间动态表头
+        sheet.addMergedRegion(new CellRangeAddress(1, 1, 14, index - 1));
+        //合并前端表头
+        for(int i = index; i <  index + 4; i ++){
+            sheet.addMergedRegion(new CellRangeAddress(1, 3, i, i));
+        }
+    }
+
+    /**
+     * 生成第三行表头
+     * 关于周的表头,周一日期到周二日期,第几周,最后拼接一个单独的月份
+     *
+     * @param workbook
+     * @param sheet
+     * @param month 月份
+     * @param weekTimeRangeVos 周的数据,包含周一的日期周二的日期
+     * @param lastIndex 前一个表头的单元格
+     */
+    void createThirdTitle(Workbook workbook, Sheet sheet, int month, List<WeekTimeRangeVo> weekTimeRangeVos, int lastIndex){
+        Font font = workbook.createFont();
+        font.setFontName("宋体");
+        font.setFontHeightInPoints((short)12);
+
+        CellStyle cellStyle = workbook.createCellStyle();
+        cellStyle.setFont(font); // 将字体应用到样式
+        cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
+        cellStyle.setAlignment(HorizontalAlignment.CENTER);
+
+        //设置内容
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM.dd");
+        int rowNumber = 2;
+        Row row2 = sheet.createRow(rowNumber);
+
+        for(int i = 0; i < weekTimeRangeVos.size(); i ++){
+            WeekTimeRangeVo rangeVo = weekTimeRangeVos.get(i);
+            String cellValue = rangeVo.getMondayDate().format(formatter) + "-"
+                    + rangeVo.getSundayDate().format(formatter) + "(第" + rangeVo.getWeeks() + "周)";
+            Cell row1cell1 = row2.createCell(lastIndex + 1 + (i * 4));
+            row1cell1.setCellValue(cellValue);
+            row1cell1.setCellStyle(cellStyle);
+        }
+
+        //合并单元格
+        int monthIndex = 0;
+        for(int i = 0; i < weekTimeRangeVos.size(); i ++){
+            int startCoulmn = lastIndex + 1 + (i * 4);
+            int endCoulmn = startCoulmn + 3;
+            sheet.addMergedRegion(new CellRangeAddress(rowNumber, rowNumber, startCoulmn, endCoulmn));
+            monthIndex = endCoulmn;
+        }
+
+        Cell row1cell2 = row2.createCell(monthIndex + 1);
+        row1cell2.setCellValue(month + "月");
+        row1cell2.setCellStyle(cellStyle);
+    }
+
+    /**
+     * 生成第四行表头
+     * 表头内容:总课时(含调顶课节)、顶课(节)、顶课(节)、晚辅(节)、课时晚辅合计
+     *
+     * @param workbook
+     * @param sheet
+     * @param weekTimeRangeVos 周的数据,包含周一的日期周二的日期
+     * @param lastIndex 前一个表头的单元格
+     */
+    void createFourthTitle(Workbook workbook, Sheet sheet, List<WeekTimeRangeVo> weekTimeRangeVos, int lastIndex){
+        Font font = workbook.createFont();
+        font.setFontName("宋体");
+        font.setFontHeightInPoints((short)12);
+
+        CellStyle cellStyle = workbook.createCellStyle();
+        cellStyle.setFont(font); // 将字体应用到样式
+        cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
+        cellStyle.setAlignment(HorizontalAlignment.CENTER);
+
+        int rowNumber = 3;
+        Row row2 = sheet.createRow(rowNumber);
+        int index = lastIndex + 1;
+        for(int i = 0; i < weekTimeRangeVos.size(); i ++){
+            Cell row1cell1 = row2.createCell(index);
+            row1cell1.setCellValue("总课时(含调顶课节)");
+            row1cell1.setCellStyle(cellStyle);
+
+            index ++;
+            Cell row1cell2 = row2.createCell(index);
+            row1cell2.setCellValue("顶课(节)");
+            row1cell2.setCellStyle(cellStyle);
+
+            index ++;
+            Cell row1cell3 = row2.createCell(index);
+            row1cell3.setCellValue("顶课(节)");
+            row1cell3.setCellStyle(cellStyle);
+            index ++;
+            Cell row1cell4 = row2.createCell(index);
+            row1cell4.setCellValue("晚辅(节)");
+            row1cell4.setCellStyle(cellStyle);
+
+            index ++;
+        }
+        Cell row1cell5 = row2.createCell(index);
+        row1cell5.setCellValue("课时晚辅合计");
+        row1cell5.setCellStyle(cellStyle);
+    }
+
+
     //计算日期内一共几个周,并返回每周的周一日期和周日日期
     private static List<WeekTimeRangeVo> calculateNaturalWeeks(LocalDate startDate, LocalDate endDate) {
         List<WeekTimeRangeVo> result = new ArrayList<>();

+ 6 - 0
src/main/java/com/xjrsoft/module/classtime/vo/CourseListVo.java

@@ -36,4 +36,10 @@ public class CourseListVo {
     @ApiModelProperty("顶课老师")
     private Long exchangeTeacherId;
 
+    @ApiModelProperty("班级名称")
+    private String className;
+
+    @ApiModelProperty("课程名称")
+    private String courseName;
+
 }

+ 17 - 4
src/main/java/com/xjrsoft/module/concat/controller/ConcatController.java

@@ -63,11 +63,24 @@ public class ConcatController {
                 " left join xjr_dictionary_detail t6 on t1.gender = t6.code" +
                 " WHERE t1.delete_mark = 0" +
                 " AND t3.role_id = 2";
-        if(dto.getDeptId() != null){
+//        if(dto.getDeptId() != null){
+//            sql += " AND t5.hierarchy LIKE '%" + dto.getDeptId() + "%'";
+//        }else if(!StrUtil.isNotEmpty(dto.getName())){
+//            sql += " AND t5.id = " + parentId;
+//        }
+
+        if(StrUtil.isNotEmpty(dto.getName())&&dto.getDeptId() != null) {
             sql += " AND t5.hierarchy LIKE '%" + dto.getDeptId() + "%'";
-        }else if(!StrUtil.isNotEmpty(dto.getName())){
-            sql += " AND t5.id = " + parentId;
         }
+
+        if(!StrUtil.isNotEmpty(dto.getName())) {
+            if(dto.getDeptId() != null){
+                sql += " AND t5.id = " + dto.getDeptId();
+            }else {
+                sql += " AND t5.id = " + parentId;
+            }
+        }
+
         if(StrUtil.isNotEmpty(dto.getName())){
             concatList = new ArrayList<>();
             sql += "AND (t1.mobile = '%" + dto.getName() + "%' OR t1.name LIKE '%" + dto.getName() + "%')";
@@ -82,7 +95,7 @@ public class ConcatController {
                         setName(user.get("name").toString());
                         setMobile(user.get("mobile").toString());
                         setType(2);
-                        setGender(user.get("gender_cn").toString());
+                        setGender(user.get("gender_cn")==null?"":user.get("gender_cn").toString());
                     }}
             );
         }

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

@@ -558,7 +558,7 @@ public class BaseStudentAssessmentInspectionServiceImpl extends MPJBaseServiceIm
 
         JSONObject data = new JSONObject();
         String thing4 = "";
-        String thing1 = "";
+        String thing1 = "";
         if(AssessmentTypeEnum.CLASS.getCode().equals(inspection.getAssessmentType())){
             data.put("const3", new JSONObject() {{
                 put("value", AssessmentTypeEnum.CLASS.getValue());

+ 2 - 2
src/main/resources/mapper/classtime/ClassTimeStatisticsMapper.xml

@@ -17,7 +17,7 @@
     </select>
 
     <select id="getCourseList" parameterType="com.xjrsoft.module.classtime.entity.ClassTimeStatistics" resultType="com.xjrsoft.module.classtime.vo.CourseListVo">
-        SELECT t1.class_id, t1.teacher_id, t2.short_name,t1.adjust_type,t4.reason,t1.schedule_date FROM course_table t1
+        SELECT t1.class_id, t1.teacher_id, t2.short_name,t1.adjust_type,t4.reason,t1.schedule_date,t1.class_name,t1.course_name FROM course_table t1
         LEFT JOIN class_time t2 ON t1.time_period = t2.time_period AND t1.time_number = t2.number
         LEFT JOIN course_table_bak t3 ON t1.id = t3.id
         LEFT JOIN wf_course_adjust t4 ON t4.id = t3.wf_course_adjust_id
@@ -55,7 +55,7 @@
 
 
     <select id="getRecordList" resultType="com.xjrsoft.module.classtime.vo.ClassTimeStatisticsRecordVo">
-        SELECT t1.id,t2.user_name,t2.name,t3.name AS employ_type_cn,
+        SELECT t1.id,t2.user_name,t2.name,t3.name AS employ_type_cn,t1.week_data,
         t1.class_time1,t1.class_time2,t1.class_time3,t1.class_time4,t1.class_time5,
         t1.class_time6,t1.class_time7,t1.class_time8,t1.class_time9,t1.class_time10,t1.class_time11,
         t1.all_class_time,t1.total_amount,t1.class_time_amount,t1.beyond_class_time_amount FROM class_time_statistics_record t1