Files
admin aac9f5934d feat: 添加多个功能模块和工具脚本
- 新增websocket客户端和服务端实现
- 添加图片压缩工具和快速压缩脚本
- 实现学生信息处理相关API
- 添加MQTT客户端和消息处理功能
- 更新.gitignore忽略更多文件类型
- 添加数据库操作工具和示例
- 实现多个测试脚本和工具类
2026-04-13 14:47:50 +08:00

70 KiB

In [ ]:
In [24]:
import os
def find_java_files(directory):
    java_files = []
    file_type=['java']
    for root, dirs, files in os.walk(directory):
        for file in files:
            for item in file_type:
                if file.endswith("."+item):
                    java_files.append(os.path.join(root, file))
    return java_files

# 使用示例
directory_path = r'F:\java\ai-video\web\src\main\java\com\hongxing\web\culum\controller' 
java_files = find_java_files(directory_path)
In [25]:
java_files
Out [25]:
['F:\\java\\ai-video\\web\\src\\main\\java\\com\\hongxing\\web\\culum\\controller\\ClassAttendNewController.java',
 'F:\\java\\ai-video\\web\\src\\main\\java\\com\\hongxing\\web\\culum\\controller\\ClassAttendStuController.java',
 'F:\\java\\ai-video\\web\\src\\main\\java\\com\\hongxing\\web\\culum\\controller\\ClassTypeController.java',
 'F:\\java\\ai-video\\web\\src\\main\\java\\com\\hongxing\\web\\culum\\controller\\CulumAttendController.java',
 'F:\\java\\ai-video\\web\\src\\main\\java\\com\\hongxing\\web\\culum\\controller\\CulumNewController.java',
 'F:\\java\\ai-video\\web\\src\\main\\java\\com\\hongxing\\web\\culum\\controller\\CulumPlanNewController.java',
 'F:\\java\\ai-video\\web\\src\\main\\java\\com\\hongxing\\web\\culum\\controller\\CulumWeekController.java']
In [26]:
content = ""
for item in java_files:
    with open(item, 'r', encoding='utf-8') as f:
        content = content + f.read()+"\n"
In [27]:
len(content)
Out [27]:
70797
In [28]:
import re

pattern = r"\*\*(?:\s*\*.*?\n)*\s*\*"#匹配多行注释
pattern1 = r"\/\/.*"#匹配单行注释
pattern2 =r'^\n'
pattern3 =r'import .*'
pattern4 =r'package .*'
pattern5 = r"\/\*.*?\*\/"#匹配多行注释
pattern6 = r"<--.*?-->"#匹配单行注释
pattern7=r"^\s*$"
pattern6 = r"<!--.*?-->"#匹配单行注释
patterns = [pattern, pattern1,pattern2, pattern3,pattern4,pattern5,pattern6]
# 替换每一行的"rain"为"rainy"
# new_text = re.sub(pattern,content, "", flags=re.S|re.M)
new_text = content
In [29]:
for item in patterns:
    new_text = re.sub(item, "", new_text)
In [30]:
lines = [line for line in new_text.splitlines() if line.strip() != '']
result = '\n'.join(lines)
In [31]:
result
Out [31]:
'@Api(value = "走班考勤考勤接口", tags = {"走班考勤管理相关接口"})\n@RestController\n@RequestMapping("/classAttend")\npublic class ClassAttendNewController extends BaseController {\n    @Autowired\n    private ClassAttendNewService classAttendService;\n    @Autowired\n    private StudentService studentService;\n    @Autowired\n    private SchoolRuleService schoolRuleService;\n    @Autowired\n    private CulumWeekService culumWeekService;\n    @Autowired\n    private RedisCacheUtils redisCacheUtils;\n    @Autowired\n    private ICameraService iCameraService;\n    @ApiOperation(value = "分页查询学生列表")\n    @GetMapping("/list")\n    public Result<?> getPageList(String name, @ApiParam(value = "分组id") Long teamId, @ApiParam(value = "年级id") Long gradeId, @ApiParam(value = "系部Id") Integer departmentId, @ApiParam(value = "班级id") Long classId, @ApiParam(value = "专业Id") String majorId) {\n        Page<Map<String, Object>> data = studentService.selectStudentCheckWorks(name, teamId, gradeId, classId, departmentId,majorId,0, false, null, this.getPagination());\n        return this.success(data);\n    }\n    @ApiOperation(value = "学生课程考勤信息")\n    @GetMapping(value = "/getAttend")\n    public Result<?> getAttendByIdAndDate(@ApiParam(value = "id") Long id, @ApiParam(value = "时间") Date date) {\n        return this.success(classAttendService.getAttendByIdAndDate(id, date));\n    }\n    @ApiOperation(value = "根据id查询课堂考勤信息")\n    @GetMapping(value = "/get/{id}")\n    public Result<?> getAttendById(@ApiParam(value = "根据id查询课堂考勤信息", required = true) @PathVariable Long id) {\n        return this.success(classAttendService.findAttendById(id));\n    }\n    @ApiOperation(value = "根据gradeid查询课堂考勤信息")\n    @GetMapping(value = "/get/pre")\n    public Result<?> getAttendPreById(Long gradeId, Long dateTime) {\n        return this.success(classAttendService.getAttendPreById(gradeId, dateTime));\n    }\n    @ApiOperation(value = "根据Serial查询课堂考勤信息")\n    @GetMapping(value = "/serial/pre")\n    public Result<?> getAttendPreBySerial(Long gradeId, Long dateTime, Integer serial) {\n        return this.success(classAttendService.getAttendPreBySerial(gradeId, dateTime, serial));\n    }\n    @ApiOperation(value = "根据年级id查询教师")\n    @GetMapping(value = "/teacher/list")\n    public Result<?> getListByGradeId(Long gradeId) {\n        return this.success(classAttendService.getListByGradeId(gradeId));\n    }\n    @ApiOperation(value = "根据教师及年级id查询课程")\n    @GetMapping(value = "/course/list")\n    public Result<?> getCouseListByGradeId(Long gradeId, String teaName) {\n        return this.success(classAttendService.getCouseListByGradeId(gradeId, teaName));\n    }\n    @ApiOperation(value = "根据教师课程信息")\n    @GetMapping(value = "/teacher/course")\n    public Result<?> getTeacherCourseById(Long gradeId, String teaName, String courseName, Long dateTime) {\n        return this.success(classAttendService.getClassAttendPreById(gradeId, teaName, courseName, dateTime));\n    }\n    @ApiOperation(value = "根据time_slot查询课堂考勤信息")\n    @GetMapping(value = "/timeSlot/pre")\n    public Result<?> getAttendPreByTimeSlot(Long gradeId, Long dateTime, String timeSlot, String courseName, String teaName) {\n        return this.success(classAttendService.getAttendPreByTimeSlot(gradeId, dateTime, timeSlot, courseName, teaName));\n    }\n    @ApiOperation(value = "根据serial查询课堂考勤信息")\n    @GetMapping(value = "/serial/list")\n    public Result<?> getAttendPreBySerialAndCourName(Long gradeId, Long dateTime, Integer serial, String courseTea) {\n        return this.success(classAttendService.getAttendPreBySerialAndCourName(gradeId, dateTime, serial, courseTea));\n    }\n    @ApiOperation(value = "根据分组id查询教室下拉列表")\n    @GetMapping(value = "/classRoom/list")\n    public Result<?> getClassRoomByTeamId(Long teamId, Long dateTime) {\n        List<String> list = classAttendService.getCurrentWeekClassRoomByTeamId(teamId, dateTime);\n        ArrayList<String> listNew = new ArrayList<>();\n        for (String s : list) {\n            if (StringUtils.isNotEmpty(s)) {\n                listNew.add(s.trim());\n            }\n        }\n        Collections.sort(listNew);\n        return this.success(listNew);\n    }\n    @ApiOperation(value = "根据教室和时间查询课堂考勤信息")\n    @GetMapping(value = "/classRoom/pre")\n    public Result<?> getAttendPreByClassRoom(Long teamId, String classRoom, Long dateTime) {\n        return this.success(classAttendService.getAttendPreByClassRoom(teamId, classRoom, dateTime));\n    }\n    @ApiOperation(value = "根据time_slot查询课堂考勤信息")\n    @GetMapping(value = "/classRoom/info")\n    public Result<?> getAttendPreByClassRoomInfo(String classRoom, Long dateTime, String timeSlot, String courseName, String teaName) {\n        return this.success(classAttendService.getAttendPreByClassRoomInfo(classRoom, dateTime, timeSlot, courseName, teaName));\n    }\n    @ApiOperation(value = "根据分组id查询课堂考勤信息")\n    @GetMapping(value = "/teamId/pre")\n    public Result<?> getAttendPreByTeamId(Long teamId, Long dateTime) {\n        return this.success(classAttendService.getAttendPreByTeamId(teamId, dateTime));\n    }\n    @ApiOperation(value = "根据年级id查询课堂考勤信息")\n    @GetMapping(value = "/gradeId/pre")\n    public Result<?> getAttendPreByGradeId(Long gradeId, Long dateTime) {\n        return this.success(classAttendService.getAttendPreByGradeId(gradeId, dateTime));\n    }\n    @ApiOperation(value = "根据班级id查询课堂考勤信息")\n    @GetMapping(value = "/classId/pre")\n    public Result<?> getAttendPreByClassId(Long classId, Long dateTime) {\n        return this.success(classAttendService.getAttendPreByClassId(classId, dateTime));\n    }\n    @ApiOperation(value = "根据分组id查询年级走班考勤情况")\n    @GetMapping(value = "/teamId/classAttendpre")\n    public Result<?> getClassAttendPreByTeamId(Long teamId, Long dateTime, Integer timeSlot) {\n        return this.success(classAttendService.getClassAttendPreByTeamId(teamId, dateTime, timeSlot));\n    }\n    @ApiOperation(value = "根据年级id查询班级走班考勤情况")\n    @GetMapping(value = "/gradeId/classAttendpre")\n    public Result<?> getClassAttendPreByGradeId(Long gradeId, Long dateTime, Integer timeSlot) {\n        return this.success(classAttendService.getClassAttendPreByGradeId(gradeId, dateTime, timeSlot));\n    }\n    @ApiOperation(value = "根据班级id查询学生走班考勤情况")\n    @GetMapping(value = "/classId/classAttendpre")\n    public Result<?> getClassAttendPreByClassId(Long classId, Long dateTime, Integer timeSlot) {\n        return this.success(classAttendService.getClassAttendPreByClassId(classId, dateTime, timeSlot));\n    }\n    @ApiOperation(value = "根据年级id查询学生课程考勤情况")\n    @GetMapping(value = "/gradeId/course/classAttendpre")\n    public Result<?> getClassAttendPreByCourseGradeId(Long gradeId, Long dateTime, Integer timeSlot) {\n        return this.success(classAttendService.getClassAttendPreByCourseGradeId(gradeId, dateTime, timeSlot));\n    }\n    @ApiOperation(value = "根据教室查看学生课程考勤情况")\n    @GetMapping(value = "/classRooom/classAttendpre")\n    public Result<?> getClassAttendPreByClassRooom(String classRoom, String timeSlot, Long dateTime, String courseName, String teaName) {\n        return this.success(classAttendService.getClassAttendPreByClassRooom(classRoom, timeSlot, dateTime, courseName, teaName));\n    }\n    @ApiOperation(value = "任课教师权限下根据教师课程信息")\n    @GetMapping(value = "/teacher/coursepre")\n    public Result<?> getClassAttendPreTByTeaName(Long teamId, Long gradeId, String teaName, Long dateTime) {\n        return this.success(classAttendService.getClassAttendPreTByTeaName(teamId, gradeId, teaName, dateTime));\n    }\n    @ApiOperation(value = "根据time_slot查询课堂考勤信息")\n    @GetMapping(value = "/timeSlot/classAttendpre")\n    public Result<?> getClassAttendAttendPreByTimeSlot(Long teamId, Long gradeId, Long dateTime, String timeSlot, String courseName, String teaName) {\n        return this.success(classAttendService.getClassAttendAttendPreByTimeSlot(teamId, gradeId, dateTime, timeSlot, courseName, teaName));\n    }\n    @ApiOperation(value = "根据courname查询课堂考勤信息")\n    @GetMapping(value = "/courname/classAttendpre")\n    public Result<?> getPageList(String name, @ApiParam(value = "分组id") Long teamId, @ApiParam(value = "年级id") Long gradeId, @ApiParam(value = "班级id") Long classId, String teaName, Long dateTime, String orderSort, String orderAsc) {\n        Pageable pageable = this.getPagination();\n        Map<String, Object> data = classAttendService.getPageAttendList(name, teamId, gradeId, classId, teaName, dateTime, orderSort, orderAsc, pageable);\n        return this.success(data);\n    }\n    @ApiOperation(value = "根据courname查询课堂考勤信息")\n    @GetMapping(value = "/courname/classAttendInfo")\n    public Result<?> getInfoList(Long teamId, String courseName, String classRoom, String teaName, Long dateTime) {\n        Map<String, Object> data = classAttendService.getInfoLists(teamId, courseName, classRoom, teaName, dateTime);\n        return this.success(data);\n    }\n    @ApiOperation(value = "根据教查看课程信息")\n    @GetMapping(value = "/teacher")\n    public Result<?> getTeacherById(Long teamId, String teaName, Long dateTime) {\n        return this.success(classAttendService.getTeacherById(teamId, teaName, dateTime));\n    }\n    @ApiOperation(value = "根据time_slot查询课堂考勤信息")\n    @GetMapping(value = "/timeSlot/preNew")\n    public Result<?> getAttendPreByTimeSlotNew(Long teamId, Long dateTime, String timeSlot, String courseName, String teaName) {\n        return this.success(classAttendService.getAttendPreByTimeSlotNew(teamId, dateTime, timeSlot, courseName, teaName));\n    }\n    @ApiOperation(value = "根据分组id查询课堂考勤信息")\n    @GetMapping(value = "/teamId/preNew")\n    public Result<?> getAttendPreByTeamIdNew(Long teamId, Long dateTime, String classRoom, String teaName) {\n        return this.success(classAttendService.getAttendPreByTeamIdNew(teamId, dateTime, classRoom, teaName));\n    }\n    @ApiOperation(value = "根据年级id查询课堂考勤信息")\n    @GetMapping(value = "/gradeId/preNew")\n    public Result<?> getAttendPreByGradeIdNew(Long gradeId, Long dateTime, String classRoom, String teaName) {\n        return this.success(classAttendService.getAttendPreByGradeIdNew(gradeId, dateTime, classRoom, teaName));\n    }\n    @ApiOperation(value = "根据班级id查询课堂考勤信息")\n    @GetMapping(value = "/classId/preNew")\n    public Result<?> getAttendPreByClassIdNew(Long classId, Long dateTime, String classRoom, String teaName) {\n        return this.success(classAttendService.getAttendPreByClassIdNew(classId, dateTime, classRoom, teaName));\n    }\n    @ApiOperation(value = "根据班级id导出课堂考勤信息")\n    @PostMapping(value = "/classId/exportExcel")\n    public void getAttendPreByClassIdExcel(Long classId, Long dateTime, HttpServletResponse response) {\n        List<Map<String, Object>> data = classAttendService.getAttendPreByClassIdClassIdExcel(classId, dateTime);\n        HSSFWorkbook wb = new HSSFWorkbook();\n        HSSFSheet sheet = wb.createSheet();\n        CellRangeAddress callRangeAddress = new CellRangeAddress(0, 0, 0, 9);\n        sheet.addMergedRegion(callRangeAddress);\n        HSSFRow nRow = sheet.createRow(0);\n        HSSFCell nCell = nRow.createCell(0);\n        nCell.setCellValue("备注:该模板是可创建用户导入的情况");\n        String[] title;\n        title = new String[]{"学号", "姓名", "手环号", "年级", "班级", "课程", "教室", "上课时间", "实际上课时间", "日期"};\n        nRow = sheet.createRow(1);\n        for (int i = 0; i < title.length; i++) {\n            nCell = nRow.createCell(i);\n            nCell.setCellValue(title[i]);\n        }\n        if (data.size() != 0) {\n            for (int j = 0; j < data.size(); j++) {\n                nRow = sheet.createRow(j + 2);\n              /*  for (int k = 0; k < studentKeyList.size(); k++) {\n                    nCell = nRow.createCell(k);\n                    nCell.setCellValue(getNullString(data.get(j).get(studentKeyList.get(k))));\n                }*/\n                nCell = nRow.createCell(0);\n                nCell.setCellValue(data.get(j).get("stuNo").toString());\n                nCell = nRow.createCell(1);\n                nCell.setCellValue(data.get(j).get("name").toString());\n                nCell = nRow.createCell(2);\n                nCell.setCellValue(data.get(j).get("bandNo").toString());\n                nCell = nRow.createCell(3);\n                nCell.setCellValue(data.get(j).get("gradeName").toString());\n                nCell = nRow.createCell(4);\n                nCell.setCellValue(data.get(j).get("className").toString());\n                nCell = nRow.createCell(5);\n                Object userName = data.get(j).get("courseName");\n                nCell.setCellValue(userName == null ? "" : userName.toString());\n                nCell = nRow.createCell(6);\n                Object seralNo = data.get(j).get("classRoom");\n                nCell.setCellValue(seralNo == null ? "" : seralNo.toString());\n                nCell = nRow.createCell(7);\n                nCell.setCellValue(data.get(j).get("timeSlot").toString());\n                nCell = nRow.createCell(8);\n                if (data.get(j).get("startTime") != null && data.get(j).get("endTime") != null) {\n                    nCell.setCellValue(DateToolUtil.getTimeToStringNew(data.get(j).get("startTime").toString()) + "-" + DateToolUtil.getTimeToStringNew(data.get(j).get("endTime").toString()));\n                } else {\n                    nCell.setCellValue("");\n                }\n                nCell = nRow.createCell(9);\n                nCell.setCellValue(data.get(j).get("attendDate").toString());\n            }\n        }\n        String excelName = "课堂考勤信息表";\n        try {\n            ExelUtil.loadResponse(excelName, response, wb);\n        } catch (IOException e) {\n            e.printStackTrace();\n        }\n    }\n    @ApiOperation(value = "根据学生id查看课程信息")\n    @GetMapping(value = "/getClassByStuId")\n    public Result<?> getClassByStuId(Long stuId, Long dateTime) {\n        return this.success(classAttendService.getClassByStuId(stuId, dateTime));\n    }\n    @ApiOperation(value = "根据教查看课程信息")\n    @GetMapping(value = "/getTeacherClass")\n    public Result<?> getTeacherClass(Long teamId, Long teaId, Long dateTime) {\n        return this.success(classAttendService.getTeacherDateById(teamId, teaId, dateTime));\n    }\n    @ApiOperation(value = "课堂考勤详情")\n    @GetMapping(value = "/getAttendByTeacherInfo")\n    public Result<?> getAttendByTeacherInfo(Long teamId, Long teaId, String dateTime, Integer serial) {\n        List<Map<String, Object>> data = classAttendService.getAttendByTeacherInfo(teamId, teaId, dateTime, serial);\n        return this.success(data);\n    }\n    @ApiOperation(value = "课堂考勤详情")\n    @GetMapping(value = "/createUpdateCulumStu")\n    public Result<?> createUpdateCulumStu(Long dateTime) {\n        culumWeekService.createUpdateCulumStu(dateTime);\n        return this.success();\n    }\n    @ApiOperation(value = "根据教室和时间查询课堂考勤信息")\n    @GetMapping(value = "/classRoom/pres")\n    public Result<?> getAttendPreByClassRooms(Long teamId, Long roomId, Long dateTime) {\n        return this.success(classAttendService.getAttendPreByClassRooms(teamId, roomId, dateTime));\n    }\n    @ApiOperation(value = "根据教查看课程信息")\n    @GetMapping(value = "/teachers")\n    public Result<?> getTeachesById(Long teamId, Long teaId, Long dateTime) {\n        return this.success(classAttendService.getTeacherByIds(teamId, teaId, dateTime));\n    }\n    @ApiOperation(value = "根据time_slot查询课堂考勤信息")\n    @GetMapping(value = "/getInfo")\n    public Result<?> getAttendPreByInfo(Long roomId, Long dateTime, String timeSlot, String courseName, Long teaId) {\n        return this.success(classAttendService.getAttendPreByInfo(roomId, dateTime, timeSlot, courseName, teaId));\n    }\n  /*  @ApiOperation(value = "根据time_slot查询课堂考勤信息")\n    @GetMapping(value = "/createClassAttend")\n    public Result<?> createClassAttend(Long stuId,Long dateTime,String attendFile) {\n        classAttendService.createClassAttend(stuId,DateToolUtil.dateTimeToDate(dateTime),attendFile);\n        return this.success();\n    }*/\n    @ApiOperation(value = "根据time_slot查询课堂考勤信息")\n    @GetMapping(value = "/createClassAttendRedis")\n    public void createClassAttend() {\n        System.out.println("4444");\n        redisCacheUtils.clearClassAttend();\n        redisCacheUtils.cacheClassAttend();\n    }\n    @ApiOperation(value = "导出教师课堂考勤统计")\n    @PostMapping("/exportExcelPre")\n    public void exportExcelCulumAttendList(Long roomId, Long dateTime, String timeSlot, String courseName, Long teaId, HttpServletResponse response) {\n        List<Map<String, Object>> data = classAttendService.findAttendListByRoomIdAndDateInfo(roomId, timeSlot,dateTime, courseName, teaId);\n        HSSFWorkbook wb = new HSSFWorkbook();\n        HSSFSheet sheet = wb.createSheet();\n        CellRangeAddress callRangeAddress = new CellRangeAddress(0, 0, 0, 10);\n        sheet.addMergedRegion(callRangeAddress);\n        HSSFRow nRow = sheet.createRow(0);\n        HSSFCell nCell = nRow.createCell(0);\n        nCell.setCellValue("上课出勤信息表");\n        String[] title;\n        title = new String[]{"学号", "姓名", "年级", "班级", "课程名称","教师", "教室", "上课时间","考勤时间", "状态","日期"};\n        nRow = sheet.createRow(1);\n        for (int i = 0; i < title.length; i++) {\n            nCell = nRow.createCell(i);\n            nCell.setCellValue(title[i]);\n        }\n        if (data.size() != 0) {\n            for (int j = 0; j < data.size(); j++) {\n                nCell = nRow.createCell(0);\n                nCell.setCellValue(data.get(j).get("stuNo").toString());\n                nCell = nRow.createCell(1);\n                nCell.setCellValue(data.get(j).get("name").toString());\n                nCell = nRow.createCell(2);\n                nCell.setCellValue(data.get(j).get("gradeName").toString());\n                nCell = nRow.createCell(3);\n                nCell.setCellValue(data.get(j).get("className").toString());\n                nCell = nRow.createCell(4);\n                Object userName = data.get(j).get("courseName");\n                nCell.setCellValue(userName == null ? "" : userName.toString());\n                nCell = nRow.createCell(5);\n                Object teaName = data.get(j).get("teaName");\n                nCell.setCellValue(teaName == null ? "" : teaName.toString());\n                nCell = nRow.createCell(6);\n                Object seralNo = data.get(j).get("classRoom");\n                nCell.setCellValue(seralNo == null ? "" : seralNo.toString());\n                nCell = nRow.createCell(7);\n                nCell.setCellValue(data.get(j).get("timeSlot").toString());\n                nCell = nRow.createCell(8);\n                if (data.get(j).get("startTime") != null) {\n                    nCell.setCellValue(DateToolUtil.getTimeToStringNew(data.get(j).get("startTime").toString()));\n                } else {\n                    nCell.setCellValue("");\n                }\n                nCell = nRow.createCell(9);\n                Integer state = Integer.valueOf(data.get(j).get("state").toString());\n                nCell.setCellValue(state==1?"出勤":"缺勤");\n                nCell = nRow.createCell(9);\n                nCell.setCellValue(data.get(j).get("attendDate").toString());\n            }\n        }\n        String excelName = "上课出勤信息表";\n        try {\n            ExelUtil.loadResponse(excelName, response, wb);\n        } catch (IOException e) {\n            e.printStackTrace();\n        }\n    }\n    @ApiOperation(value = "传输学生信息到摄像头")\n    @GetMapping(value = "/sendImgInfo")\n    public Result<?> sendImgInfo(Long roomId, Long dateTime, String timeSlot, String courseName, Long teaId) {\n        TCamera tCamera = iCameraService.selectCameraByRoomId(roomId);\n        if(tCamera ==null){\n            return this.failure("教室未绑定摄像头!");\n        }\n        return this.success(classAttendService.sendImgInfo(roomId, dateTime, timeSlot, courseName, teaId));\n    }\n    @ApiOperation(value = "教师修改考勤信息")\n    @PostMapping(value = "/update")\n    public Result<?> updateClassAttend(@RequestBody ClassAttendStateDto classAttendStateDto) {\n       if(classAttendStateDto.getState()==1 && classAttendStateDto.getDateTime()==null){\n           return this.success("考勤时间不能为空");\n       }\n       classAttendService.updateClassAttend(classAttendStateDto);\n        return this.success();\n    }\n}\n@Api(value = "走班考勤考勤接口", tags = {"走班考勤管理相关接口"})\n@RestController\n@RequestMapping("/classAttendStu")\npublic class ClassAttendStuController extends BaseController {\n    @Autowired\n    private ClassAttendStuService classAttendStuService;\n    @Autowired\n    private CulumPlanNewService culumPlanNewService;\n    @Autowired\n    private SynchronizationStudentService synchronizationStudentService;\n    @ApiOperation(value = "同步课程表")\n    @PostMapping("/synchron")\n    public Result<?> create(Long teamId,Integer planId) {\n        synchronizationStudentService.getSynchronizationStudentByTeamIdAndPlanId(teamId,planId);\n        return this.success();\n    }\n    @ApiOperation(value = "同步学生课程表")\n    @PostMapping("/synchronStu")\n    public Result<?> synchronStu(Long teamId,Long stuId) {\n        synchronizationStudentService.getSynchronizationStudentByTeamIdAndStuId(teamId,stuId);\n        return this.success();\n    }\n    @ApiOperation(value = "生成本周课程表")\n    @PostMapping("/createThisWeek")\n    public Result<?> createThisWeek(Integer planId) {\n        classAttendStuService.createThisWeek(planId);\n        return this.success();\n    }\n    @ApiOperation(value = "生成学生本周课程表")\n    @PostMapping("/createThisWeekStu")\n    public Result<?> createThisStuWeek(Long stuId) {\n        classAttendStuService.createThisWeekStu(stuId);\n        return this.success();\n    }\n}\n@Api(value = "课程大类接口", tags = {"课程大类相关接口"})\n@RestController\n@RequestMapping("/culum/type")\npublic class ClassTypeController extends BaseController {\n    @Autowired\n    private ClassTypeService classTypService;\n    @Autowired\n    private TeamService teamService;\n    @ApiOperation(value = "分页查询课程大类")\n    @GetMapping("/list")\n    public Result<?> getPageList(@ApiParam(value = "分组id") Long teamId,@ApiParam(value = "名称") String coursesName) {\n        Pageable pageable = this.getPagination();\n        Page<ClassType> data  = classTypService.getPageClassTypeList(teamId,coursesName,pageable);\n        Page<ClassTypeDto> data2 = data.map(classTyp -> {\n            ClassTypeDto dto = new ClassTypeDto();\n            BeanUtils.copyProperties(classTyp,dto);\n            if (classTyp.getTeamId() != null) {\n                dto.setTeamName(teamService.findById(classTyp.getTeamId()).getName());\n            }\n            return dto;\n        });\n        return this.success(data2);\n    }\n    @ApiOperation(value = "新增")\n    @PostMapping("/add")\n    public Result<?> add(@RequestBody ClassTypeRequest classTypeRequest) {\n        List<ClassType> list = classTypService.findAllByName(classTypeRequest.getName(),classTypeRequest.getTeamId());\n        if(list.size()>0){\n            return this.failure("名称已存在");\n        }\n        ClassType culumPlanNew = new ClassType();\n        BeanUtils.copyProperties(classTypeRequest, culumPlanNew);\n        classTypService.insert(culumPlanNew);\n        return this.success();\n    }\n    @ApiOperation(value = "修改")\n    @PostMapping("/update")\n    public Result<?> update(@RequestBody ClassTypeRequest classTypeRequest) {\n        ClassType culumPlanNew = classTypService.findById(classTypeRequest.getId());\n        if(culumPlanNew.getName().equals(classTypeRequest.getName())){\n            return this.failure("名称未改动");\n        }\n        List<ClassType> list = classTypService.findAllByName(classTypeRequest.getName(),classTypeRequest.getTeamId());\n        if(list.size()>0){\n            return this.failure("名称已存在");\n        }\n        culumPlanNew.setCourseNames(classTypeRequest.getCourseNames());\n        culumPlanNew.setName(classTypeRequest.getName());\n        classTypService.update(culumPlanNew);\n        return this.success();\n    }\n    @ApiOperation(value = "删除")\n    @PostMapping("/delete")\n    public Result<?> delete(@RequestParam Integer id) {\n        classTypService.deleteById(id);\n        return this.success();\n    }\n    @ApiOperation(value = "根据id查询课程大类信息")\n    @GetMapping(value = "/get")\n    public Result<?> getClassTypeById(@RequestParam Integer id) {\n        return this.success(classTypService.findById(id));\n    }\n    @ApiOperation(value = "根据id查询大类下的课程信息")\n    @GetMapping(value = "/course")\n    public Result<?> getCourseById(Integer id,Long teamId) {\n        return this.success(classTypService.getCourseById(id,teamId));\n    }\n    @ApiOperation(value = "根据id添加课程")\n    @PostMapping(value = "/add/course")\n    public Result<?> saveCulumById(@RequestBody ClassTypeRequest classTypeRequest) {\n        classTypService.saveCourseById(classTypeRequest);\n        return this.success();\n    }\n    @ApiOperation(value = "根据teamId查看所有分组下课程大类")\n    @GetMapping(value = "/listSelect")\n    public Result<?> listSelect(Long teamId) {\n        return this.success( classTypService.listSelect(teamId));\n    }\n}\n@Api(value = "课程接口", tags = {"课程相关接口"})\n@RestController\n@RequestMapping("/culumAttend")\npublic class CulumAttendController extends BaseController {\n    @Autowired\n    private CulumAttendService culumAttendService;\n    @ApiOperation(value = "分页查询教师课堂考勤统计")\n    @GetMapping("/listPage")\n    public Result<?> getPageCulumAttendList(\n            @RequestParam(required = false) Long teamId,\n            @RequestParam(required = false) Long teaId,\n            @RequestParam(required = false) String teaName,\n            @RequestParam(required = false) String courseName,\n            @RequestParam(required = false) Long startTime,\n            @RequestParam(required = false) Long endTime,\n            @RequestParam(required = false) Integer type,\n            @RequestParam(defaultValue = "1") Integer pageNumber,\n            @RequestParam(defaultValue = "10") Integer pageSize,\n            @RequestParam(required = false) String sortField,\n            @RequestParam(required = false, defaultValue = "asc") String sortOrder) {\n        Page<CulumAttend> page = new Page<>(pageNumber, pageSize);\n        if (StringUtils.isNotBlank(sortField)) {\n            boolean isDesc = "desc".equalsIgnoreCase(sortOrder);\n            page.addOrder(new OrderItem(sortField, isDesc));\n        }\n        IPage<CulumAttend> data = culumAttendService.getPageCulumAttendList(\n                page, teaId, courseName, startTime, endTime, teamId, type,teaName);\n        return this.success(data);\n    }\n    @ApiOperation(value = "查询科目堂出勤统计")\n    @GetMapping("/courseName/countPre")\n    public Result<?> getCulumAttendCourseNamePre(\n            @RequestParam(required = false) Long teamId,\n            @RequestParam(required = false) String courseName,\n            @RequestParam(required = false) Long startTime,\n            @RequestParam(required = false) Long endTime) {\n        Map<String,Object> data = culumAttendService.getCulumAttendCourseNamePre(courseName, startTime, endTime, teamId);\n        return this.success(data);\n    }\n    @ApiOperation(value = "查询科目堂出勤统计对比")\n    @GetMapping("/courseName/countPreTop")\n    public Result<?> getCulumAttendCourseNamePreTop(\n            @RequestParam(required = false) Long teamId,\n            @RequestParam(required = false) String courseName,\n            @RequestParam(required = false) Long startTime,\n            @RequestParam(required = false) Long endTime) {\n        Map<String,Object> data = culumAttendService.getCulumAttendCourseNamePreTop(courseName, startTime, endTime, teamId);\n        return this.success(data);\n    }\n    @ApiOperation(value = "查询教师课堂出勤统计")\n    @GetMapping("/countPre")\n    public Result<?> getCulumAttendPre(\n            @RequestParam(required = false) Long teamId,\n            @RequestParam(required = false) Long teaId,\n            @RequestParam(required = false) Long startTime,\n            @RequestParam(required = false) Long endTime) {\n        Map<String,Object> data = culumAttendService.getCulumAttendPre(teaId, startTime, endTime, teamId);\n        return this.success(data);\n    }\n    @ApiOperation(value = "查询教师出勤统计")\n    @GetMapping("/teacher/countPre")\n    public Result<?> getCulumAttendCourseNamePre(\n            @RequestParam(required = false) Long teamId,\n            @RequestParam(required = false) Long teaId,\n            @RequestParam(required = false) Long startTime,\n            @RequestParam(required = false) Long endTime) {\n        Map<String,Object> data = culumAttendService.getCulumAttendTeaPre(teaId, startTime, endTime, teamId);\n        return this.success(data);\n    }\n    @ApiOperation(value = "查询学生出勤统计")\n    @GetMapping("/stu/countPre")\n    public Result<?> getCulumAttendStuPre(\n            @RequestParam(required = false) Long teamId,\n            @RequestParam(required = false) Long stuId,\n            @RequestParam(required = false) Long startTime,\n            @RequestParam(required = false) Long endTime) {\n        Map<String,Object> data = culumAttendService.getCulumAttendStuPre(stuId, startTime, endTime, teamId);\n        return this.success(data);\n    }\n    @ApiOperation(value = "查询全校课堂出勤统计")\n    @GetMapping("/allPre")\n    public Result<?> getCulumAttendAllPre(\n            @RequestParam(required = false) Long teamId,\n            @RequestParam(required = false) Long startTime,\n            @RequestParam(required = false) Long endTime) {\n        Map<String,Object> data = culumAttendService.getCulumAttendAllPre( startTime, endTime, teamId);\n        return this.success(data);\n    }\n    @Log(title = "课堂出勤记录",businessType = BusinessType.EXPORT)\n    @ApiOperation(value = "导出教师课堂考勤统计")\n    @PostMapping("/exportExcel")\n    public void exportExcelCulumAttendList(\n            @RequestParam(required = false) Long teamId,\n            @RequestParam(required = false) Long teaId,\n            @RequestParam(required = false) String teaName,\n            @RequestParam(required = false) String courseName,\n            @RequestParam(required = false) Long startTime,\n            @RequestParam(required = false) Long endTime,\n            @RequestParam(required = false) Integer type, HttpServletResponse response) {\n        List<CulumAttend> data = culumAttendService.getCulumAttendList(teaId, courseName, startTime, endTime, teamId, type,teaName);\n        HSSFWorkbook wb = new HSSFWorkbook();\n        HSSFSheet sheet = wb.createSheet();\n        CellRangeAddress callRangeAddress = new CellRangeAddress(0, 0, 0, 8);\n        sheet.addMergedRegion(callRangeAddress);\n        HSSFRow nRow = sheet.createRow(0);\n        HSSFCell nCell = nRow.createCell(0);\n        nCell.setCellValue("课堂考勤信息表");\n        String[] title;\n        title = new String[]{"课程名称", "教师", "教室", "上课日期", "上课时间","出勤率", "应到人数", "出勤人数", "缺勤人数"};\n        nRow = sheet.createRow(1);\n        for (int i = 0; i < title.length; i++) {\n            nCell = nRow.createCell(i);\n            nCell.setCellValue(title[i]);\n        }\n        if (data.size() != 0) {\n            for (int j = 0; j < data.size(); j++) {\n                nRow = sheet.createRow(j + 2);\n                nCell = nRow.createCell(0);\n                nCell.setCellValue(data.get(j).getCourseName());\n                nCell = nRow.createCell(1);\n                nCell.setCellValue(data.get(j).getTeaName());\n                nCell = nRow.createCell(2);\n                nCell.setCellValue(data.get(j).getClassRoom());\n                nCell = nRow.createCell(3);\n                nCell.setCellValue(DateToolUtil.getDateTimeToString(data.get(j).getAttendDate()));\n                nCell = nRow.createCell(4);\n                nCell.setCellValue(data.get(j).getTimeSlot());\n                nCell = nRow.createCell(5);\n                nCell.setCellValue(data.get(j).getAttendPre());\n                nCell = nRow.createCell(6);\n                nCell.setCellValue(data.get(j).getStuSum());\n                nCell = nRow.createCell(7);\n                nCell.setCellValue(data.get(j).getAttendStu());\n                nCell = nRow.createCell(8);\n                nCell.setCellValue(data.get(j).getAttendNostu());\n            }\n        }\n        String excelName = "课堂考勤信息表";\n        try {\n            ExelUtil.loadResponse(excelName, response, wb);\n        } catch (IOException e) {\n            e.printStackTrace();\n        }\n    }\n    @ApiOperation(value = "教师修改考勤信息")\n    @GetMapping(value = "/test")\n    public Result<?> updateTest() {\n        DateToolUtil.dateToDate(System.currentTimeMillis());\n        culumAttendService.updateClassAttend(241L,"13:45-14:25",DateToolUtil.dateToDate(new Date().getTime()),"数学",86L);\n        return this.success();\n    }\n}\n@Api(value = "课程接口", tags = {"课程相关接口"})\n@RestController\n@RequestMapping("/culum")\npublic class CulumNewController extends BaseController {\n    @Autowired\n    private CulumNewService culumNewService;\n    @Autowired\n    private CulumStuService culumStuService;\n    @Autowired\n    private AccountService accountService;\n    @Autowired\n    private CulumPlanNewService culumPlanService;\n    @Autowired\n    private StudentService studentService;\n    @Autowired\n    private ClassAttendNewService classAttendService;\n    @Autowired\n    private ClassTypeService classTypService;\n    @PostMapping("/inExcel")\n    @ApiOperation(value = "excel批量导入值班表")\n    public Result<?> inExcel(@RequestParam(value="file",required=false) MultipartFile file, @RequestParam Integer id, HttpServletRequest request, HttpServletResponse response) throws Exception{\n        if(file==null) {\n            return null;\n        }\n        String name=file.getOriginalFilename();\n        String filePath = request.getSession().getServletContext().getRealPath("/") + "upload"+"\\\\"\n                + file.getOriginalFilename();\n        long size=file.getSize();\n        if(name==null || ("").equals(name) && size==0) {\n            return this.failure("导入失败",500);\n        }\n        int i=0;\n        try {\n            InputStream in = file.getInputStream();\n            i=culumNewService.inExcel(filePath,file,id);\n        } catch (IOException e) {\n            e.printStackTrace();\n        }\n        if(i>0){\n            return this.success();\n        }else{\n            return this.failure("导入失败",500);\n        }\n    }\n    @ApiOperation(value = "根据id查询课程表信息")\n    @GetMapping(value = "/get/{id}")\n    public Result<?> getCulumByPlanId(@ApiParam(value = "根据id查询课程表信息",required = true) @PathVariable Integer id) {\n        return this.success(culumNewService.findCulumNewById(id));\n    }\n    @ApiOperation(value = "根据id查询课程表信息")\n    @GetMapping(value = "/get/culum")\n    public Result<?> getCulumById(Long gradeId,Long classId, Integer id,Integer serial,String week) {\n        return this.success(culumNewService.getCulumById(gradeId,classId,id,serial,week));\n    }\n    @ApiOperation(value = "根据id添加学生")\n    @PostMapping(value = "/add/culum")\n    public Result<?> saveCulumById(@RequestBody CulumStuRequest culumStuRequest) {\n        culumNewService.saveCulumById(culumStuRequest);\n        return this.success();\n    }\n    @PostMapping("/inExcelStudent")\n    @ApiOperation(value = "excel批量导入课程学生")\n    public Result<?> inExcelStudent(@RequestParam(value="file",required=false) MultipartFile file, @RequestParam Integer id,@RequestParam Long gradeId,@RequestParam Integer serial,@RequestParam Integer planId,Integer stuNum,@RequestParam String week,HttpServletRequest request, HttpServletResponse response) throws Exception{\n        if(file==null) {\n            return null;\n        }\n        String name=file.getOriginalFilename();\n        String filePath = request.getSession().getServletContext().getRealPath("/") + "upload"+"\\\\"\n                + file.getOriginalFilename();\n        long size=file.getSize();\n        if(name==null || ("").equals(name) && size==0) {\n            return this.failure("导入失败",500);\n        }\n        List<CulumStuAddRequest> list=new ArrayList<>();\n        try {\n            InputStream in = file.getInputStream();\n            list=culumStuService.inExcelStudent(filePath,file,id,gradeId,serial,planId,stuNum,week);\n        } catch (IOException e) {\n            e.printStackTrace();\n        }\n            return this.success(list);\n    }\n    @ApiOperation(value = "根据id查询修改课程上课人数限制")\n    @PostMapping(value = "/update/culum")\n    public Result<?> updateCulumById(@RequestParam String courseName,@RequestParam Long gradeId,@RequestParam String classRoom,@RequestParam Integer planId,@RequestParam String teaName,@RequestParam String stuNum) {\n        return this.success(culumNewService.updateCulumById(courseName,gradeId,classRoom,planId,teaName,stuNum));\n    }\n    @ApiOperation(value = "根据id查询课程上课人数限制")\n    @GetMapping(value = "/get/culumNum")\n    public Result<?> getCulumNumById(Integer id) {\n        return this.success(culumNewService.findById(id));\n    }\n    @PostMapping("/inExcelStudentNew")\n    @ApiOperation(value = "excel批量导入课程学生")\n    public Result<?> inExcelStudentNew(@RequestParam(value="file",required=false) MultipartFile file, @RequestParam String courseName,@RequestParam Long gradeId,@RequestParam String classRoom,@RequestParam Integer planId,@RequestParam String teaName,HttpServletRequest request, HttpServletResponse response) throws Exception{\n        if(file==null) {\n            return null;\n        }\n        String name=file.getOriginalFilename();\n        String filePath = request.getSession().getServletContext().getRealPath("/") + "upload"+"\\\\"\n                + file.getOriginalFilename();\n        long size=file.getSize();\n        if(name==null || ("").equals(name) && size==0) {\n            return this.failure("导入失败",500);\n        }\n        List<CulumStuAddNewRequest> list=new ArrayList<>();\n        try {\n            InputStream in = file.getInputStream();\n            list=culumStuService.inExcelStudentNew(filePath,file,courseName,gradeId,classRoom,planId,teaName);\n        } catch (IOException e) {\n            e.printStackTrace();\n        }\n        return this.success(list);\n    }\n    @PostMapping("/inExcelNew")\n    @ApiOperation(value = "excel批量导入值班表")\n    public Result<?> inExcelNew(@RequestParam(value="file",required=false) MultipartFile file, @RequestParam Integer id,@RequestParam Integer rows,@RequestParam Integer type, HttpServletRequest request, HttpServletResponse response) throws Exception{\n        if(file==null) {\n            return null;\n        }\n        String name=file.getOriginalFilename();\n        String filePath = request.getSession().getServletContext().getRealPath("/") + "upload"+"\\\\"\n                + file.getOriginalFilename();\n        long size=file.getSize();\n        if(name==null || ("").equals(name) && size==0) {\n            return this.failure("导入失败",500);\n        }\n        int i=0;\n        i=culumNewService.inExcelNew(filePath,file,id,rows,type);\n        try {\n            InputStream in = file.getInputStream();\n        } catch (IOException e) {\n            e.printStackTrace();\n        }\n        if(i>0){\n            return this.success();\n        }else{\n            return this.failure("导入失败",500);\n        }\n    }\n    @PostMapping("/inExcelStudentNewTwo")\n    @ApiOperation(value = "excel批量导入课程学生新逻辑2")\n    public Result<?> inExcelStudentNewTwo(@RequestParam(value="file",required=false) MultipartFile file, @RequestParam Long gradeId,@RequestParam Integer planId,HttpServletRequest request, HttpServletResponse response) throws Exception{\n        if(file==null) {\n            return null;\n        }\n        String name=file.getOriginalFilename();\n        String filePath = request.getSession().getServletContext().getRealPath("/") + "upload"+"\\\\"\n                + file.getOriginalFilename();\n        long size=file.getSize();\n        if(name==null || ("").equals(name) && size==0) {\n            return this.failure("导入失败",500);\n        }\n        List<CulumStuAddTwoRequest> list=new ArrayList<>();\n        try {\n            InputStream in = file.getInputStream();\n            list=culumStuService.inExcelStudentNewTwo(filePath,file,gradeId,planId);\n        } catch (IOException e) {\n            e.printStackTrace();\n        }\n        return this.success(list);\n    }\n    @ApiOperation(value = "导出课程表模板一 ")\n    @GetMapping("/exportExcelOne")\n    public void downLoadPayerCreditInfoExcel(HttpServletResponse response) {\n        HSSFWorkbook wb = new HSSFWorkbook();\n        HSSFSheet sheet = wb.createSheet();\n        CellRangeAddress callRangeAddress = new CellRangeAddress(0,0,0,7);\n        sheet.addMergedRegion(callRangeAddress);\n        HSSFRow nRow = sheet.createRow(0);\n        HSSFCell nCell = nRow.createCell(0);\n        nCell.setCellValue("课程表样式一");\n        String[] title;\n        title = new String[]{"上课时间", "周一", "周二", "周三", "周四", "周五", "周六", "周日"};\n        nRow = sheet.createRow(1);\n        for (int i = 0; i < title.length; i++) {\n            nCell = nRow.createCell(i);\n            nCell.setCellValue(title[i]);\n        }\n        String[] title1;\n        title1 = new String[]{"第一节/9:00-9:45", "初中语文-13/江雪雯/301/32;初中语文-14/刘昭华/312A/32;初中语文-15/王然/303/32", "初中语文-13/江雪雯/301/32;初中语文-14/刘昭华/312A/32;初中语文-15/王然/303/32", "初中语文-13/江雪雯/301/32;初中语文-14/刘昭华/312A/32;初中语文-15/王然/303/32", "初中语文-13/江雪雯/301/32;初中语文-14/刘昭华/312A/32;初中语文-15/王然/303/32", "初中语文-13/江雪雯/301/32;初中语文-14/刘昭华/312A/32;初中语文-15/王然/303/32"};\n        nRow = sheet.createRow(2);\n        for (int i = 0; i < title1.length; i++) {\n            nCell = nRow.createCell(i);\n            nCell.setCellValue(title1[i]);\n        }\n        String excelName = "课程表样式一";\n        try {\n            ExelUtil.loadResponse(excelName, response, wb);\n        } catch (IOException e) {\n            e.printStackTrace();\n        }\n    }\n    @ApiOperation(value = "导出课程表模板二 ")\n    @GetMapping("/exportExcelTwo")\n    public void exportTwo(HttpServletResponse response) throws Exception {\n        String[] tiles = {"上课时间", "周一", "周二", "周三", "周四", "周五", "周六", "周日"};\n        HSSFWorkbook wb = new HSSFWorkbook();\n        HSSFSheet sheet = wb.createSheet();\n        HSSFCellStyle style = wb.createCellStyle();\n        style.setWrapText(true);\n        CellRangeAddress callRangeAddress = new CellRangeAddress(0, 0, 0, 7);\n        sheet.addMergedRegion(callRangeAddress);\n        HSSFRow nRow = sheet.createRow(0);\n        HSSFCell nCell = nRow.createCell(0);\n        nCell.setCellValue("课程表样式二");\n        nRow = sheet.createRow(1);\n        for (int i = 0; i < tiles.length; i++) {\n            nCell = nRow.createCell(i);\n            nCell.setCellValue(tiles[i]);\n        }\n        nRow = sheet.createRow( 3);\n        nCell = nRow.createCell(0);\n        nCell.setCellStyle(style);\n        nCell.setCellValue("第一节/9:00-9:40");\n        sheet.addMergedRegion(new CellRangeAddress( 3,  4, 0, 0));\n        nCell = nRow.createCell(1);\n        nCell.setCellStyle(style);\n        nCell.setCellValue("初中数学I-2/佘珺彤/308/19");\n        nCell = nRow.createCell(2);\n        nCell.setCellStyle(style);\n        nCell.setCellValue("初中数学I-2/佘珺彤/308/19");\n        nCell = nRow.createCell(3);\n        nCell.setCellStyle(style);\n        nCell.setCellValue("初中数学I-2/佘珺彤/308/19");\n        nCell = nRow.createCell(4);\n        nCell.setCellStyle(style);\n        nCell.setCellValue("初中数学I-2/佘珺彤/308/19");\n        nCell = nRow.createCell(5);\n        nCell.setCellStyle(style);\n        nCell.setCellValue("初中数学I-2/佘珺彤/308/19");\n        nRow = sheet.createRow(4);\n        nCell = nRow.createCell(1);\n        nCell.setCellStyle(style);\n        nCell.setCellValue("初中数学I-2/佘珺彤/308/19");\n        nCell = nRow.createCell(2);\n        nCell.setCellStyle(style);\n        nCell.setCellValue("初中数学I-2/佘珺彤/308/19");\n        nCell = nRow.createCell(3);\n        nCell.setCellStyle(style);\n        nCell.setCellValue("初中数学I-2/佘珺彤/308/19");\n        nCell = nRow.createCell(4);\n        nCell.setCellStyle(style);\n        nCell.setCellValue("初中数学I-2/佘珺彤/308/19");\n        nCell = nRow.createCell(5);\n        nCell.setCellStyle(style);\n        nCell.setCellValue("初中数学I-2/佘珺彤/308/19");\n        nRow = sheet.createRow( 5);\n        nCell = nRow.createCell(0);\n        nCell.setCellStyle(style);\n        nCell.setCellValue("第一节/9:00-9:40");\n        sheet.addMergedRegion(new CellRangeAddress( 5,  6, 0, 0));\n        nCell = nRow.createCell(1);\n        nCell.setCellStyle(style);\n        nCell.setCellValue("初中数学I-2/佘珺彤/308/19");\n        nCell = nRow.createCell(2);\n        nCell.setCellStyle(style);\n        nCell.setCellValue("初中数学I-2/佘珺彤/308/19");\n        nCell = nRow.createCell(3);\n        nCell.setCellStyle(style);\n        nCell.setCellValue("初中数学I-2/佘珺彤/308/19");\n        nCell = nRow.createCell(4);\n        nCell.setCellStyle(style);\n        nCell.setCellValue("初中数学I-2/佘珺彤/308/19");\n        nCell = nRow.createCell(5);\n        nCell.setCellStyle(style);\n        nCell.setCellValue("初中数学I-2/佘珺彤/308/19");\n        nRow = sheet.createRow(6);\n        nCell = nRow.createCell(1);\n        nCell.setCellStyle(style);\n        nCell.setCellValue("初中数学I-2/佘珺彤/308/19");\n        nCell = nRow.createCell(2);\n        nCell.setCellStyle(style);\n        nCell.setCellValue("初中数学I-2/佘珺彤/308/19");\n        nCell = nRow.createCell(3);\n        nCell.setCellStyle(style);\n        nCell.setCellValue("初中数学I-2/佘珺彤/308/19");\n        nCell = nRow.createCell(4);\n        nCell.setCellStyle(style);\n        nCell.setCellValue("初中数学I-2/佘珺彤/308/19");\n        nCell = nRow.createCell(5);\n        nCell.setCellStyle(style);\n        nCell.setCellValue("初中数学I-2/佘珺彤/308/19");\n        String excelName = "课程表样式二";\n        try {\n            ExelUtil.loadResponse(excelName, response, wb);\n        } catch (IOException e) {\n            e.printStackTrace();\n        }\n    }\n    @ApiOperation(value = "导出学生选课模板一 ")\n    @GetMapping("/exportExcelStudentOne")\n    public void exportExcelStudentOne(HttpServletResponse response) {\n        HSSFWorkbook wb = new HSSFWorkbook();\n        HSSFSheet sheet = wb.createSheet();\n        CellRangeAddress callRangeAddress = new CellRangeAddress(0,0,0,1);\n        sheet.addMergedRegion(callRangeAddress);\n        HSSFRow nRow = sheet.createRow(0);\n        HSSFCell nCell = nRow.createCell(0);\n        nCell.setCellValue("学生选课表样式");\n        String[] title;\n        title = new String[]{"学号","姓名"};\n        nRow = sheet.createRow(1);\n        for (int i = 0; i < title.length; i++) {\n            nCell = nRow.createCell(i);\n            nCell.setCellValue(title[i]);\n        }\n        String[] title1;\n        title1 = new String[]{"20210001","张三" };\n        nRow = sheet.createRow(2);\n        for (int i = 0; i < title1.length; i++) {\n            nCell = nRow.createCell(i);\n            nCell.setCellValue(title1[i]);\n        }\n        String excelName = "课程表样式";\n        try {\n            ExelUtil.loadResponse(excelName, response, wb);\n        } catch (IOException e) {\n            e.printStackTrace();\n        }\n    }\n    @ApiOperation(value = "导出学生选课模板二 ")\n    @GetMapping("/exportExcelStudentTwo")\n    public void exportExcelStudentTwo(HttpServletResponse response) {\n        HSSFWorkbook wb = new HSSFWorkbook();\n        HSSFSheet sheet = wb.createSheet();\n        CellRangeAddress callRangeAddress = new CellRangeAddress(0,0,0,5);\n        sheet.addMergedRegion(callRangeAddress);\n        HSSFRow nRow = sheet.createRow(0);\n        HSSFCell nCell = nRow.createCell(0);\n        nCell.setCellValue("学生选课表样式");\n        String[] title;\n        title = new String[]{"课程名","教师","教室","上课时间","学生人数","学生名单"};\n        nRow = sheet.createRow(1);\n        for (int i = 0; i < title.length; i++) {\n            nCell = nRow.createCell(i);\n            nCell.setCellValue(title[i]);\n        }\n        String[] title1;\n        title1 = new String[]{"地理-11","刘艳","206","周一/9:00-9:40,周四/9:00-9:40,周五/9:50-10:30","36","测试1/20220163,测试2/20220242,测试3/20220341,测试4/19081403,测试5/20220300,测试6/20220210,测试7/20220393,测试8/20220360" };\n        nRow = sheet.createRow(2);\n        for (int i = 0; i < title1.length; i++) {\n            nCell = nRow.createCell(i);\n            nCell.setCellValue(title1[i]);\n        }\n        String excelName = "课程表样式";\n        try {\n            ExelUtil.loadResponse(excelName, response, wb);\n        } catch (IOException e) {\n            e.printStackTrace();\n        }\n    }\n    @PostMapping("/chearStudentNew")\n    @ApiOperation(value = "批量清除课程学生")\n    public Result<?> chearStudentNew(@RequestParam String courseName,@RequestParam String classRoom,@RequestParam Integer planId,@RequestParam String teaName){\n        culumStuService.chearStudentNew(courseName,classRoom,planId,teaName);\n        return this.success();\n    }\n    @PostMapping("/createClassStu")\n    @ApiOperation(value = "立即生成学生本周课程表")\n    public Result<?> createNewBand(@RequestParam Integer planId) {\n        SimpleDateFormat def = new SimpleDateFormat("yyyy-MM-dd");\n        Date date = new Date();\n        Date createTime = null;\n        try {\n            createTime = def.parse(def.format(date));\n        } catch (ParseException e) {\n            e.printStackTrace();\n        }\n        Map<String, Date> map = DateToolUtil.findNewWeekDates(createTime);\n        CulumPlanNew culumPlan = culumPlanService.findById(planId);\n        if (culumPlan.getStartDate().getTime() <= createTime.getTime() && createTime.getTime() <= culumPlan.getEndDate().getTime()) {\n            List<CulumNew> listC = culumNewService.findAllCulumNewByPlanId(culumPlan.getId());\n            Long teamId = culumPlan.getTeamId();\n            if (!listC.isEmpty()) {\n                ExecutorService executorService = Executors.newFixedThreadPool(100); \n                for (CulumNew culum : listC) {\n                    List<Long> listStu1 = culumStuService.findStuIdsById(culum.getId());\n                    if (!listStu1.isEmpty()) {\n                        List<String> result = Arrays.asList(culum.getTimeSlot().split("-"));\n                        Date attendDate = map.get(culum.getWeek());\n                        Date stateTime = DateToolUtil.getStringToDate(def.format(attendDate) + " " + result.get(0) + ":00");\n                        Date endTime = DateToolUtil.getStringToDate(def.format(attendDate) + " " + result.get(1) + ":00");\n                        String classRoom = culum.getClassRoom();\n                        classAttendService.deleteByAttendDateAndTeamId(attendDate, culum.getTeamId(), culum.getSerial(), listStu1);\n                        for (Long stuId : listStu1) {\n                            executorService.submit(() -> {\n                                Student student = studentService.findById(stuId);\n                                ClassAttend classAttendence = new ClassAttend();\n                                classAttendence.setAttendDate(attendDate);\n                                classAttendence.setClassETime(endTime);\n                                classAttendence.setClassRoom(classRoom);\n                                classAttendence.setClassSTime(stateTime);\n                                classAttendence.setName(student.getStuName());\n                                classAttendence.setStudentId(student.getId());\n                                classAttendence.setTeamId(teamId);\n                                classAttendence.setState(0);\n                                classAttendence.setTeaId(culum.getTeaId());\n                                classAttendence.setRoomId(culum.getRoomId());\n                                classAttendence.setSerial(culum.getSerial());\n                                classAttendence.setTimeSlot(culum.getTimeSlot());\n                                classAttendence.setCourseName(culum.getCourseName());\n                                classAttendence.setBandNo(student.getSeralNo());\n                                classAttendence.setStuNo(student.getStuNo());\n                                classAttendence.setTeaName(culum.getTeaName());\n                                classAttendence.setClassSTimes(new Date(stateTime.getTime() - 120000L));\n                                classAttendence.setClassETimes(new Date(endTime.getTime() + 120000L));\n                                classAttendence.setMajorId(student.getMajorId());\n                                classAttendence.setMajorName(student.getMajorName());\n                                classAttendence.setAttendType(0);\n                                classAttendService.insert(classAttendence);\n                            });\n                        }\n                    }\n                }\n            }\n        }\n        return success();\n    }\n    @PostMapping("/inExcelStudentTwo")\n    @ApiOperation(value = "excel批量导入课程学生")\n    public Result<?> inExcelStudentTwo(@RequestParam(value="file",required=false) MultipartFile file, @RequestParam String courseName,@RequestParam Long gradeId,@RequestParam String classRoom,@RequestParam Integer planId,@RequestParam String teaName,HttpServletRequest request, HttpServletResponse response) throws Exception{\n        if(file==null) {\n            return null;\n        }\n        String name=file.getOriginalFilename();\n        String filePath = request.getSession().getServletContext().getRealPath("/") + "upload"+"\\\\"\n                + file.getOriginalFilename();\n        long size=file.getSize();\n        if(name==null || ("").equals(name) && size==0) {\n            return this.failure("导入失败",500);\n        }\n        List<CulumStuAddNewRequest> list=new ArrayList<>();\n        try {\n            InputStream in = file.getInputStream();\n            list=culumStuService.inExcelStudentTwo(filePath,file,courseName,gradeId,classRoom,planId,teaName);\n        } catch (IOException e) {\n            e.printStackTrace();\n        }\n        return this.success(list);\n    }\n    @ApiOperation(value = "根据课程大类id查询所有教师")\n    @GetMapping(value = "/get/teacher")\n    public Result<?> getTeacherById(Integer id) {\n        return this.success(classTypService.getTeacherById(id));\n    }\n    @ApiOperation(value = "生成本周课程表")\n    @PostMapping(value = "/generateWeekCurriculum")\n    public Result<?> generateWeekCurriculum(Long teamId,Long gradeId,Integer plainId) {\n        List<CulumNew> findCulumNewList = culumNewService.findAllCulumNewByByTeamIdAndGradeIdAndPlainId(teamId,gradeId,plainId);\n        if (!findCulumNewList.isEmpty()) {\n            return this.failure("本周课程表已存在!");\n        }\n        List<Map<String, Object>> attendList = classAttendService.getAttendByTeamIdAndGradeIdAndAttendDate(teamId, gradeId);\n        if (attendList.isEmpty()) {\n            return this.failure("学生课程表没有课程,请同步课程!");\n        }\n        List<CulumNew> culumNewList = reflexObjList(attendList, CulumNew.class);\n        ThreadPoolExecutor poolExecutor = new ThreadPoolExecutor(10, 20, 1, TimeUnit.MINUTES, new LinkedBlockingDeque<>(culumNewList.size()));\n        for (CulumNew culumNew : culumNewList) {\n            culumNew.setPlanId(plainId);\n            SaveEntityTask<CulumNew, CulumNewService> saveTask = new SaveEntityTask<>(culumNew, culumNewService);\n            poolExecutor.submit(saveTask);\n        }\n        poolExecutor.shutdown();\n        return this.success("生成本周课程表成功!");\n    }\n    @ApiOperation(value = "根据teamId查询课目")\n    @GetMapping(value = "/courseName")\n    public Result<?> getCourseNameByTeamId(Long teamId) {\n        return this.success(culumNewService.getCourseNameByTeamId(teamId));\n    }\n}\n@Api(value = "课程计划接口", tags = {"课程计划相关接口"})\n@RestController\n@RequestMapping("/culum/planNew")\npublic class CulumPlanNewController extends BaseController {\n    @Autowired\n    private CulumPlanNewService culumPlanNewService;\n    @ApiOperation(value = "分页查询课程计划")\n    @GetMapping(    "/list")\n    public Result<?> getPageList(@ApiParam(value = "分组id") Long teamId,@ApiParam(value = "年级id") Long gradeId) {\n        Page<Map<String,Object>> data  = culumPlanNewService.getPageCulumPlanNewList(teamId, gradeId,this.getPagination());\n        return this.success(data);\n    }\n    @ApiOperation(value = "启用课程计划")\n    @PostMapping("/start")\n    public Result<?> setStartUsing(@ApiParam(value = "id") Integer id,@ApiParam(value = "状态") Integer state) {\n        culumPlanNewService.setStartUsing(id,state);\n        return this.success();\n    }\n    @Log(title = "学期课表",businessType = BusinessType.INSERT)\n    @ApiOperation(value = "新增")\n    @PostMapping("/add")\n    public Result<?> add(@RequestBody CulumPlanNewRequest culumPlanNewRequest) {\n        CulumPlanNew culumPlanNew = new CulumPlanNew();\n        BeanUtils.copyProperties(culumPlanNewRequest, culumPlanNew);\n        culumPlanNew.setState(0);\n        CulumPlanNew save = culumPlanNewService.save(culumPlanNew);\n        if(save !=null){\n            return this.success(save.getId());\n        }\n        return this.failure();\n    }\n    @Log(title = "学期课表",businessType = BusinessType.UPDATE)\n    @ApiOperation(value = "修改")\n    @PostMapping("/update/{id}")\n    public Result<?> update(@PathVariable @ApiParam(value = "id", required = true) Integer id, @RequestBody CulumPlanNewRequest culumPlanNewRequest) {\n        culumPlanNewService.updateCulumPlanNew(id,culumPlanNewRequest);\n        return this.success();\n    }\n    @Log(title = "学期课表",businessType = BusinessType.DELETE)\n    @ApiOperation(value = "删除")\n    @PostMapping("/delete/{id}")\n    public Result<?> delete(@PathVariable @ApiParam(value = "id", required = true) Integer id) {\n        culumPlanNewService.deleteById(id);\n        return this.success();\n    }\n    @ApiOperation(value = "根据id查询课程计划信息")\n    @GetMapping(value = "/get/{id}")\n    public Result<?> getCulumPlanNewById(@ApiParam(value = "课程计划id",required = true) @PathVariable Integer id) {\n        return this.success(culumPlanNewService.findById(id));\n    }\n}\n@Api(value = "课程接口", tags = {"课程相关接口"})\n@RestController\n@RequestMapping("/culum/week")\npublic class CulumWeekController extends BaseController {\n    @Autowired\n    private CulumWeekService culumWeekService;\n    @ApiOperation(value = "分页查询周几修改节数列表")\n    @GetMapping("/list")\n    public Result<?> getPageList(Long gradeId,String week) {\n        Pageable pageable = this.getPagination();\n        Page<CulumWeek> data  = culumWeekService.getPageCulumWeekList(gradeId,week,pageable);\n        return this.success(data);\n    }\n    @ApiOperation(value = "新增")\n    @PostMapping("/add")\n    public Result<?> add(@RequestBody CulumWeekRequest culumWeekRequest) {\n        CulumWeek culumWeek1 = culumWeekService.findAllByGradeIdAndWeek(culumWeekRequest.getSerial(),culumWeekRequest.getGradeId(),culumWeekRequest.getWeek());\n        if(culumWeek1 !=null){\n            return this.failure("该节数已存在");\n        }\n        CulumWeek culumWeek = new CulumWeek();\n        BeanUtils.copyProperties(culumWeekRequest, culumWeek);\n        culumWeekService.insert(culumWeek);\n        return this.success();\n    }\n    @ApiOperation(value = "修改")\n    @PostMapping("/update")\n    public Result<?> update(@RequestBody CulumWeekRequest culumWeekRequest) {\n        CulumWeek culumWeek1 = culumWeekService.findAllByGradeIdAndWeek(culumWeekRequest.getSerial(),culumWeekRequest.getGradeId(),culumWeekRequest.getWeek());\n        if(culumWeek1 !=null && culumWeek1.getId() !=culumWeekRequest.getId()){\n            return this.failure("该节数已存在");\n        }\n        CulumWeek culumWeek = new CulumWeek();\n        BeanUtils.copyProperties(culumWeekRequest, culumWeek);\n        culumWeekService.update(culumWeek);\n        return this.success();\n    }\n    @ApiOperation(value = "修改启用状态")\n    @PostMapping("/updateState")\n    public Result<?> update(Integer id, Integer state) {\n        CulumWeek culumWeek = culumWeekService.findById(id);\n        culumWeek.setState(state);\n        culumWeekService.update(culumWeek);\n        return this.success();\n    }\n    @ApiOperation(value = "删除")\n    @PostMapping("/delete")\n    public Result<?> delete(@RequestParam Integer id) {\n        culumWeekService.deleteById(id);\n        return this.success();\n    }\n    @ApiOperation(value = "根据id查询")\n    @GetMapping(value = "/get")\n    public Result<?> getClassTypeById(@RequestParam Integer id) {\n        return this.success(culumWeekService.findById(id));\n    }\n}'
In [32]:
with open('finally.txt', 'w', encoding='utf-8') as file:
    file.write(result)
In [ ]:
In [ ]:
In [ ]: