From c6096c2104cfe6b14f1c2e9d2564b3e76dca8e1f Mon Sep 17 00:00:00 2001 From: tuyp Date: Mon, 26 Dec 2022 15:43:44 +0800 Subject: [PATCH] 人社局跑数据准备中 新加了个有效时长 --- src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java | 23 +++++++++++++++++++---- src/main/java/com/subsidy/util/ExcelFormatUtils.java | 2 +- src/main/java/com/subsidy/util/MathUtil.java | 5 +++++ src/main/java/com/subsidy/util/excel/ExcelUtil.java | 12 ++++++++---- src/main/java/com/subsidy/vo/classdict/ClassDetailVO.java | 7 +++++-- src/main/resources/application.properties | 2 +- 6 files changed, 39 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java b/src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java index b4ce8b3..8b43acd 100644 --- a/src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java @@ -473,16 +473,21 @@ public class AdministerServiceImpl extends ServiceImpl= vodDictDO.getVodLength()) { + validLength+=vodDictDO.getVodLength(); i++; + }else { + validLength+=totalPlayLength; } playLength += totalPlayLength; } //培训时长 classDetailVO.setTrainingLength(playLength); + classDetailVO.setValidLength(MathUtil.floorSecond(validLength)); //学生测试完成情况 多套卷子各返回最高成绩 List getMaxScoreVOS = exerciseDoneResultMapper.getMaxScore(classDictDO.getId(), classDetailVO.getId()); @@ -529,6 +534,7 @@ public class AdministerServiceImpl extends ServiceImpl exportClassDetail(ClassDetailDTO classDetailDTO) throws Exception { Page pager = new Page(1, -1L); @@ -547,15 +553,20 @@ public class AdministerServiceImpl extends ServiceImpl= vodDictDO.getVodLength()) { i++; + validLength+=vodDictDO.getVodLength(); + }else { + validLength+=totalPlayLength; } playLength += totalPlayLength; } //课程进度 + classDetailVO.setValidLength(MathUtil.floorSecond(validLength)); classDetailVO.setClassProcess(i + "/" + vodDictDOS.size()); //学生测试完成情况 多套卷子各返回最高成绩 @@ -1574,7 +1585,7 @@ public class AdministerServiceImpl extends ServiceImpl memberList = Arrays.asList("序号", "成员名称","身份证号码", "性别", "账号", "联系方式", "签到次数", "课程进度", "学习时长(小时)","学习时长(分钟)", "答疑数", "测试成绩", "总评价"); + public static final List memberList = Arrays.asList("序号", "成员名称","身份证号码", "性别", "账号", "联系方式", "签到次数", "课程进度", "学习时长(小时)","学习时长(分钟)","累计有效学习时长", "答疑数", "测试成绩", "总评价"); public static final List signList = Arrays.asList("序号", "成员名称", "身份证号", "联系方式", "签到次数", "签到时间","最近签到ip地址","最近签到设备型号"); diff --git a/src/main/java/com/subsidy/util/MathUtil.java b/src/main/java/com/subsidy/util/MathUtil.java index 70a9d8e..7c47499 100644 --- a/src/main/java/com/subsidy/util/MathUtil.java +++ b/src/main/java/com/subsidy/util/MathUtil.java @@ -35,6 +35,11 @@ public class MathUtil { return String.valueOf((int) Math.ceil((double) length / 60)); } + //习题/视频 ==> 秒钟向下取整 + public static String floorSecond(int length) { + return String.valueOf((int) Math.ceil((double) length / 60)); + } + //视频秒数处理 public static String vodLength(int i) { if (i > 60) { diff --git a/src/main/java/com/subsidy/util/excel/ExcelUtil.java b/src/main/java/com/subsidy/util/excel/ExcelUtil.java index 68bbed0..8182d79 100644 --- a/src/main/java/com/subsidy/util/excel/ExcelUtil.java +++ b/src/main/java/com/subsidy/util/excel/ExcelUtil.java @@ -493,7 +493,7 @@ public class ExcelUtil { sheet.addMergedRegion(cellRangeAddress21); setBorderStyle(HSSFCellStyle.BORDER_THIN, cellRangeAddress21, sheet, workbook); //给合并过的单元格加边框 - CellRangeAddress cellRangeAddress22 = new CellRangeAddress(1, 1, 5, 12); + CellRangeAddress cellRangeAddress22 = new CellRangeAddress(1, 1, 5, 13); sheet.addMergedRegion(cellRangeAddress22); setBorderStyle(HSSFCellStyle.BORDER_THIN, cellRangeAddress22, sheet, workbook); //给合并过的单元格加边框 @@ -509,7 +509,7 @@ public class ExcelUtil { sheet.addMergedRegion(cellRangeAddress31); setBorderStyle(HSSFCellStyle.BORDER_THIN, cellRangeAddress31, sheet, workbook); //给合并过的单元格加边框 - CellRangeAddress cellRangeAddress32 = new CellRangeAddress(2, 2, 5, 12); + CellRangeAddress cellRangeAddress32 = new CellRangeAddress(2, 2, 5, 13); sheet.addMergedRegion(cellRangeAddress32); setBorderStyle(HSSFCellStyle.BORDER_THIN, cellRangeAddress32, sheet, workbook); //给合并过的单元格加边框 thirdRow.createCell(0).setCellValue(thirdHead[0]); @@ -584,14 +584,18 @@ public class ExcelUtil { newCell = dataRow.createCell(10); newCell.setCellStyle(cellStyle); - newCell.setCellValue(classDetailVO.getAskCounts()); + newCell.setCellValue(classDetailVO.getValidLength()); newCell = dataRow.createCell(11); newCell.setCellStyle(cellStyle); - newCell.setCellValue(classDetailVO.getScore()); + newCell.setCellValue(classDetailVO.getAskCounts()); newCell = dataRow.createCell(12); newCell.setCellStyle(cellStyle); + newCell.setCellValue(classDetailVO.getScore()); + + newCell = dataRow.createCell(13); + newCell.setCellStyle(cellStyle); newCell.setCellValue(classDetailVO.getResult()); rowIndex++; seq++; diff --git a/src/main/java/com/subsidy/vo/classdict/ClassDetailVO.java b/src/main/java/com/subsidy/vo/classdict/ClassDetailVO.java index ab987bb..06895cf 100644 --- a/src/main/java/com/subsidy/vo/classdict/ClassDetailVO.java +++ b/src/main/java/com/subsidy/vo/classdict/ClassDetailVO.java @@ -63,6 +63,9 @@ public class ClassDetailVO{ @ExcelColumn(col = 9,value = "培训时长(分钟)") private String trainingLengthMinute; + @ExcelColumn(col = 10,value = "累计有效学习时长") + private String validLength; + /** * 作对个数 */ @@ -76,13 +79,13 @@ public class ClassDetailVO{ /** * 评价测试 */ - @ExcelColumn(col = 10,value = "评价测试") + @ExcelColumn(col = 11,value = "评价测试") private String score; /** * 答疑个数 */ - @ExcelColumn(col = 11,value = "答题数") + @ExcelColumn(col = 12,value = "答题数") private Integer askCounts; 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 -- libgit2 0.25.0