diff --git a/src/main/java/com/subsidy/controller/CompanyDictController.java b/src/main/java/com/subsidy/controller/CompanyDictController.java index a2972e3..284756f 100644 --- a/src/main/java/com/subsidy/controller/CompanyDictController.java +++ b/src/main/java/com/subsidy/controller/CompanyDictController.java @@ -110,7 +110,7 @@ public class CompanyDictController { @PostMapping(value = "getCompanyDataOverview") @ApiOperation("数据统计") - @LoginRequired +// @LoginRequired public ResponseVO getCompanyDataOverview() { return ResponseData.generateCreatedResponse(0, companyDictService.getCompanyDataOverview()); } diff --git a/src/main/java/com/subsidy/controller/CourseContentController.java b/src/main/java/com/subsidy/controller/CourseContentController.java index 2e55786..2d13003 100644 --- a/src/main/java/com/subsidy/controller/CourseContentController.java +++ b/src/main/java/com/subsidy/controller/CourseContentController.java @@ -8,6 +8,8 @@ import com.subsidy.dto.vod.ChangeOrdersDTO; import com.subsidy.model.CourseContentDO; import com.subsidy.service.CourseContentService; import com.subsidy.util.ConstantUtils; +import com.subsidy.util.excel.ExcelUtil; +import com.subsidy.vo.course.ExportClassContentVO; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; @@ -16,14 +18,8 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; -/** - *

- * 课程目录表 前端控制器 - *

- * - * @author DengMin - * @since 2021-10-11 - */ +import java.util.List; + @RestController @Api(tags = "课程目录表") @RequestMapping("/courseContent") @@ -59,4 +55,13 @@ public class CourseContentController { public ResponseVO updateContent(@RequestBody CourseContentDO courseContentDO){ return ResponseData.generateCreatedResponse(0,courseContentService.updateContent(courseContentDO)); } + + @PostMapping("exportClassContent") + @ApiOperation("导出课程章节内容+视频 courseId 课程id") +// @LoginRequired + public void exportClassContent(@RequestBody CourseContentDO courseContentDO){ + List exportClassContentVOS = courseContentService.exportClassContent(courseContentDO); + ExcelUtil.writeExcel(exportClassContentVOS, ExportClassContentVO.class); + } + } diff --git a/src/main/java/com/subsidy/service/CourseContentService.java b/src/main/java/com/subsidy/service/CourseContentService.java index 03b2605..5b24ff6 100644 --- a/src/main/java/com/subsidy/service/CourseContentService.java +++ b/src/main/java/com/subsidy/service/CourseContentService.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService; import com.subsidy.dto.content.GetContendVodsDTO; import com.subsidy.dto.vod.ChangeOrdersDTO; import com.subsidy.model.CourseContentDO; +import com.subsidy.vo.course.ExportClassContentVO; import com.subsidy.vo.vod.GetContendVodsVO; import java.util.List; @@ -25,4 +26,6 @@ public interface CourseContentService extends IService { String addContent(CourseContentDO courseContentDO); String updateContent(CourseContentDO courseContentDO); + + List exportClassContent(CourseContentDO courseContentDO); } diff --git a/src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java b/src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java index 74f6e41..e66fa5b 100644 --- a/src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java @@ -1353,6 +1353,8 @@ public class AdministerServiceImpl extends ServiceImpl failMembers = new ArrayList<>(); + ExcelUtil.readExcelWithoutTitle(null, ImportMemberDTO.class, multipartFile).forEach(s -> { MemberDO memberDO = memberMapper.selectOne(new QueryWrapper() @@ -1360,7 +1362,9 @@ public class AdministerServiceImpl extends ServiceImpl implements CourseContentService { + @Autowired + private VodDictMapper vodDictMapper; + + @Autowired + private CourseDictMapper courseDictMapper; + @Override public List getContents(CourseContentDO courseContentDO) { return this.baseMapper.selectList(new QueryWrapper() @@ -31,20 +48,20 @@ public class CourseContentServiceImpl extends ServiceImpl() - .lambda() - .eq(CourseContentDO::getCourseId,courseContentDO.getCourseId()) - .eq(CourseContentDO::getContent,courseContentDO.getContent()) - .ne(CourseContentDO::getId,courseContentDO.getId())); + int count = this.baseMapper.selectCount(new QueryWrapper() + .lambda() + .eq(CourseContentDO::getCourseId, courseContentDO.getCourseId()) + .eq(CourseContentDO::getContent, courseContentDO.getContent()) + .ne(CourseContentDO::getId, courseContentDO.getId())); - if (count>0){ + if (count > 0) { throw new HttpException(40001); } this.baseMapper.updateById(courseContentDO); return ConstantUtils.SET_SUCCESS; } + public List exportClassContent(CourseContentDO courseContentDO) { + + List exportClassContentVOS = new ArrayList(); + + CourseDictDO courseDictDO = courseDictMapper.selectById(courseContentDO.getCourseId()); + + List courseContentDOS = this.baseMapper.selectList(new QueryWrapper() + .lambda() + .eq(CourseContentDO::getCourseId, courseContentDO.getCourseId()) + .orderByAsc(CourseContentDO::getOrderNo) + .orderByAsc(CourseContentDO::getCreateDate)); + + int totalLength = 0; + + for (CourseContentDO ccd : courseContentDOS) { + List contendVods = vodDictMapper.getContendVods(null, ccd.getId()); + for (GetContendVodsVO cvv : contendVods) { + ExportClassContentVO exportClassContentVO = new ExportClassContentVO(); + exportClassContentVO.setCourseName(courseDictDO.getCourseName()); + exportClassContentVO.setContent(ccd.getContent()); + exportClassContentVO.setVodAliasName(cvv.getVodAliasName()); + exportClassContentVO.setVodLength(MathUtil.vodLength(cvv.getVodLength())); + totalLength += cvv.getVodLength(); + exportClassContentVOS.add(exportClassContentVO); + } + } + + //总时长(时分秒) + String totalLengthTmp = MathUtil.secToTime(totalLength); + + //总时长(分钟) + String totalMinute = MathUtil.ceilSecond(totalLength); + exportClassContentVOS.stream().forEach(x -> { + x.setTotalLength(totalLengthTmp); + x.setTotalMinute(totalMinute); + }); + + return exportClassContentVOS; + } + } diff --git a/src/main/java/com/subsidy/service/impl/RenSheJuServiceImpl.java b/src/main/java/com/subsidy/service/impl/RenSheJuServiceImpl.java index e0498d7..cde6850 100644 --- a/src/main/java/com/subsidy/service/impl/RenSheJuServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/RenSheJuServiceImpl.java @@ -161,7 +161,7 @@ public class RenSheJuServiceImpl implements RenSheJuService { loginList.setEndTime(Timestamp.valueOf(loginOutRecords.get(i).getCreateDate()).getTime()); //查看这个人该时间段的学习记录 - List chapterList3s = renSheJuMapper.dailyStudyRecords(dailyStudyInfoVO.getMemberId(), dailyStudyInfoVO.getDownCode(), loginRecords.get(0).getCreateDate().toString().replace("T", " "), loginOutRecords.get(i).getCreateDate().toString().replace("T", " ")); + List chapterList3s = renSheJuMapper.dailyStudyRecords(dailyStudyInfoVO.getMemberId(), dailyStudyInfoVO.getDownCode(), loginRecords.get(i).getCreateDate().toString().replace("T", " "), loginOutRecords.get(i).getCreateDate().toString().replace("T", " ")); if (chapterList3s.size() > 0) { loginList.setChapterList(chapterList3s); loginLists.add(loginList); diff --git a/src/main/java/com/subsidy/service/impl/ShehuihuaServiceImpl.java b/src/main/java/com/subsidy/service/impl/ShehuihuaServiceImpl.java index a13d539..14c9470 100644 --- a/src/main/java/com/subsidy/service/impl/ShehuihuaServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/ShehuihuaServiceImpl.java @@ -201,7 +201,7 @@ public class ShehuihuaServiceImpl implements ShehuihuaService { loginList.setEndTime(Timestamp.valueOf(loginOutRecords.get(i).getCreateDate()).getTime()); //查看这个人该时间段的学习记录 - List chapterList3s = renSheJuMapper.dailyStudyRecords(dailyStudyInfoVO.getMemberId(), dailyStudyInfoVO.getDownCode(), loginRecords.get(0).getCreateDate().toString().replace("T", " "), loginOutRecords.get(i).getCreateDate().toString().replace("T", " ")); + List chapterList3s = renSheJuMapper.dailyStudyRecords(dailyStudyInfoVO.getMemberId(), dailyStudyInfoVO.getDownCode(), loginRecords.get(i).getCreateDate().toString().replace("T", " "), loginOutRecords.get(i).getCreateDate().toString().replace("T", " ")); if (chapterList3s.size() > 0) { loginList.setChapterList(chapterList3s); loginLists.add(loginList); diff --git a/src/main/java/com/subsidy/vo/course/ExportClassContentVO.java b/src/main/java/com/subsidy/vo/course/ExportClassContentVO.java new file mode 100644 index 0000000..d071562 --- /dev/null +++ b/src/main/java/com/subsidy/vo/course/ExportClassContentVO.java @@ -0,0 +1,27 @@ +package com.subsidy.vo.course; + +import com.subsidy.util.excel.ExcelColumn; +import lombok.Data; + +@Data +public class ExportClassContentVO { + + @ExcelColumn(col = 1,value = "课程名") + private String courseName; + + @ExcelColumn(col = 2,value = "总时长(时分秒)") + private String totalLength; + + @ExcelColumn(col = 3,value = "总时长(分钟)") + private String totalMinute; + + @ExcelColumn(col = 4,value = "章节") + private String content; + + @ExcelColumn(col = 5,value = "视频名称") + private String vodAliasName; + + @ExcelColumn(col = 6,value = "视频长度") + private String vodLength; + +} diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 3287aa3..9ce1e86 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,5 +1,5 @@ # 环境配置 -spring.profiles.active=dev +spring.profiles.active=prod #和CPU数 spring.server.acceptorThreadCount=600 spring.server.minSpareThreads=100 diff --git a/src/main/resources/mapper/ClassDictMapper.xml b/src/main/resources/mapper/ClassDictMapper.xml index 4801738..57da213 100644 --- a/src/main/resources/mapper/ClassDictMapper.xml +++ b/src/main/resources/mapper/ClassDictMapper.xml @@ -256,7 +256,7 @@ FROM vod_play_history t1 WHERE - DATE_FORMAT( DATE_ADD( t1.create_date, INTERVAL 1 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' ) + DATE_FORMAT( DATE_ADD( t1.create_date, INTERVAL 2 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' ) AND t1.delete_date IS NULL diff --git a/src/main/resources/mapper/OprAdmDictMapper.xml b/src/main/resources/mapper/OprAdmDictMapper.xml index 6ba7e01..1fde4e8 100644 --- a/src/main/resources/mapper/OprAdmDictMapper.xml +++ b/src/main/resources/mapper/OprAdmDictMapper.xml @@ -70,7 +70,7 @@ FROM opr_adm_dict WHERE - create_date < (NOW() - INTERVAL 1 DAY) + create_date < (NOW() - INTERVAL 2 DAY) diff --git a/src/main/resources/mapper/OprMemDictMapper.xml b/src/main/resources/mapper/OprMemDictMapper.xml index 5ca5c51..5ff33bf 100644 --- a/src/main/resources/mapper/OprMemDictMapper.xml +++ b/src/main/resources/mapper/OprMemDictMapper.xml @@ -52,7 +52,7 @@ FROM opr_mem_dict WHERE - create_date < (NOW() - INTERVAL 1 DAY) + create_date < (NOW() - INTERVAL 2 DAY) @@ -341,7 +341,7 @@ exercise_done_result t1 WHERE t1.delete_date IS NULL - AND DATE_FORMAT( DATE_ADD( t1.create_date, INTERVAL 1 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' ) + AND DATE_FORMAT( DATE_ADD( t1.create_date, INTERVAL 2 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' ) AND class_id = #{classId} AND member_id = #{memberId} @@ -372,7 +372,7 @@ LEFT JOIN class_dict t2 ON t1.class_id = t2.id LEFT JOIN member t3 ON t1.ask_id = t3.id WHERE - DATE_FORMAT( DATE_ADD( t1.update_date, INTERVAL 1 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' ) + DATE_FORMAT( DATE_ADD( t1.update_date, INTERVAL 2 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' ) AND t1.delete_date IS NULL AND t2.delete_date IS NULL AND t3.delete_date IS NULL @@ -386,7 +386,7 @@ left join class_dict t2 on t.class_id = t2.id WHERE t.delete_date IS NULL - AND DATE_FORMAT( DATE_ADD( t.create_date, INTERVAL 1 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( + AND DATE_FORMAT( DATE_ADD( t.create_date, INTERVAL 2 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' ) @@ -412,7 +412,7 @@ class_id = #{classId} AND t1.delete_date IS NULL and t2.delete_date is null - AND DATE_FORMAT( DATE_ADD( t1.update_date, INTERVAL 1 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( + AND DATE_FORMAT( DATE_ADD( t1.update_date, INTERVAL 2 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' ) @@ -431,7 +431,7 @@ LEFT JOIN member t2 ON t1.member_id = t2.id WHERE class_id = #{classId} - AND DATE_FORMAT( DATE_ADD( t1.create_date, INTERVAL 1 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' ) + AND DATE_FORMAT( DATE_ADD( t1.create_date, INTERVAL 2 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' ) AND t1.paper_id IS NOT NULL AND t1.result = 1 @@ -451,7 +451,7 @@ WHERE t1.delete_date is null and class_id = #{classId} - AND DATE_FORMAT( DATE_ADD( t1.create_date, INTERVAL 1 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' ) + AND DATE_FORMAT( DATE_ADD( t1.create_date, INTERVAL 2 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' ) AND t1.paper_id IS NULL AND t1.result = 1 and t1.member_id @@ -474,7 +474,7 @@ LEFT JOIN member t2 ON t1.member_id = t2.id WHERE t1.delete_date is null - AND DATE_FORMAT( DATE_ADD( t1.create_date, INTERVAL 1 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' ) + AND DATE_FORMAT( DATE_ADD( t1.create_date, INTERVAL 2 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' ) and class_id = #{classId} AND t1.paper_id IS not NULL AND t1.result = 1 diff --git a/src/main/resources/mapper/SignInRecordMapper.xml b/src/main/resources/mapper/SignInRecordMapper.xml index 48c992a..bfa5aa6 100644 --- a/src/main/resources/mapper/SignInRecordMapper.xml +++ b/src/main/resources/mapper/SignInRecordMapper.xml @@ -55,7 +55,7 @@ delete_date IS NULL AND date(sign_in_date) = date_sub( curdate(), - INTERVAL 1 DAY) + INTERVAL 2 DAY)