diff --git a/src/main/java/com/subsidy/controller/AdministerController.java b/src/main/java/com/subsidy/controller/AdministerController.java index a9d191a..815ec0b 100644 --- a/src/main/java/com/subsidy/controller/AdministerController.java +++ b/src/main/java/com/subsidy/controller/AdministerController.java @@ -94,7 +94,7 @@ public class AdministerController { @PostMapping("classDetail") @ApiOperation("班级管理--班级成员 id 班级id userName") - //@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) + @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) public ResponseVO classDetail(@RequestBody ClassDetailDTO classDetailDTO){ return ResponseData.generateCreatedResponse(0,administerService.classDetail(classDetailDTO)); } @@ -109,14 +109,14 @@ public class AdministerController { @PostMapping("signDetail") @ApiOperation("班级管理--注册签到 id 班级id userName") - //@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) + @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) public ResponseVO signDetail(@RequestBody ClassDetailDTO classDetailDTO){ return ResponseData.generateCreatedResponse(0,administerService.signDetail(classDetailDTO)); } @PostMapping("exportSignDetail") @ApiOperation("班级管理--注册签到 id 班级id userName") - //@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) + @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) public void exportSignDetail(@RequestBody ClassDetailDTO classDetailDTO)throws Exception{ classDetailDTO.setFlag(true); administerService.exportSignDetail(classDetailDTO); @@ -131,7 +131,7 @@ public class AdministerController { @PostMapping("exportExerciseTest") @ApiOperation("班级管理--测评成绩 id 班级id userName paperId") - //@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) + @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) public void exportExerciseTest(@RequestBody ClassDetailDTO classDetailDTO)throws Exception{ classDetailDTO.setFlag(true); administerService.exportExerciseTest(classDetailDTO); diff --git a/src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java b/src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java index 8a76b3d..8df156a 100644 --- a/src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java @@ -328,7 +328,6 @@ public class AdministerServiceImpl extends ServiceImpl() @@ -352,7 +351,6 @@ public class AdministerServiceImpl extends ServiceImpl() @@ -574,7 +571,7 @@ public class AdministerServiceImpl extends ServiceImpl exportAnswerRecord(ClassDetailDTO classDetailDTO) throws Exception { Page pager = new Page(1, -1L); IPage iPage = this.baseMapper.answerRecord(pager, classDetailDTO.getId(), classDetailDTO.getUserName()); @@ -870,9 +866,10 @@ public class AdministerServiceImpl extends ServiceImpl title = new ArrayList<>(); + title.add("序号"); title.add("姓名"); title.addAll(findDaysStr(classDailyInfoDTO.getStartDate(), classDailyInfoDTO.getEndDate())); - title.add("合计总时长"); + title.add("合计时长"); //获取班级成员 IPage classDailyInfoVOIPage = classMemberMappingMapper.getClassMembersWithName(pager, classDailyInfoDTO.getClassId(), classDailyInfoDTO.getUserName()); @@ -932,6 +929,7 @@ public class AdministerServiceImpl extends ServiceImpl classVodDailyInfoItemVOS = new ArrayList<>(); for (VodDictDO vodDictDO : vodDictDOS) { Integer playLength = hashMap.get(classDailyInfoVO.getId() + "-" + vodDictDO.getId()); @@ -944,11 +942,13 @@ public class AdministerServiceImpl extends ServiceImpl= vodDictDO.getVodLength()) { total++; } + playLengthTmp += playLength; } else { classVodDailyInfoItemVO.setPlayLength(0); classVodDailyInfoItemVOS.add(classVodDailyInfoItemVO); } } + classDailyInfoVO.setStudyLength(playLengthTmp); classDailyInfoVO.setTotal(MathUtil.intDivFloorPercent(total, vodDictDOS.size())); classDailyInfoVO.setClassVodDailyInfoItemVOS(classVodDailyInfoItemVOS); } @@ -956,7 +956,7 @@ public class AdministerServiceImpl extends ServiceImpl title = new ArrayList<>(); + title.add("序号"); title.add("姓名"); - title.add("合计完成率"); + title.add("完成率"); + title.add("学习时长"); for (VodDictDO vodDictDO : vodDictDOS) { title.add(vodDictDO.getVodName()); } @@ -1020,39 +1022,48 @@ public class AdministerServiceImpl extends ServiceImpl { + for (ClassDailyInfoVO classDailyInfoVO : classDailyInfoVOS){ Row r = sheet.createRow(ai.getAndIncrement()); AtomicInteger a = new AtomicInteger(); Cell cell = r.createCell(at.getAndIncrement()); CellStyle cellStyle = wb.createCellStyle(); cellStyle.setFillForegroundColor(IndexedColors.PALE_BLUE.getIndex()); cell.setCellStyle(cellStyle); + Cell seqcell = r.createCell(a.getAndIncrement()); + seqcell.setCellValue(i++); + Cell namecell = r.createCell(a.getAndIncrement()); - namecell.setCellValue(data.getUserName()); + namecell.setCellValue(classDailyInfoVO.getUserName()); Cell totalCell = r.createCell(a.getAndIncrement()); + Cell studyLengthCell = r.createCell(a.getAndIncrement()); Integer total = 0; + int studyLength = 0; for (String tt : title) { - if (!"姓名".equals(tt) && !"合计完成率".equals(tt)) { + + if (!"姓名".equals(tt) && !"完成率".equals(tt) && !"学习时长".equals(tt)&& !"序号".equals(tt)) { Cell cell1 = r.createCell(a.getAndIncrement()); if (null != hashMap) { - Integer playLength = hashMap.get(data.getId() + "-" + tt); + Integer playLength = hashMap.get(classDailyInfoVO.getId() + "-" + tt); if (null != playLength) { cell1.setCellValue(MathUtil.secToTime(playLength)); if (vodHashmap.get(tt) <= playLength) { total++; } + studyLength += playLength; } else { cell1.setCellValue("00:00:00"); } } } } + studyLengthCell.setCellValue(MathUtil.secToTime(studyLength)); totalCell.setCellValue(MathUtil.intDivFloorPercent(total, vodHashmap.keySet().size()) + "%"); - }); + } } String fileName = String.valueOf(new Date().getTime()); try { @@ -1092,32 +1103,35 @@ public class AdministerServiceImpl extends ServiceImpl { - Row r = sheet.createRow(ai.getAndIncrement()); - AtomicInteger a = new AtomicInteger(); - Cell cell = r.createCell(at.getAndIncrement()); - CellStyle cellStyle = wb.createCellStyle(); - cellStyle.setFillForegroundColor(IndexedColors.PALE_BLUE.getIndex()); - cell.setCellStyle(cellStyle); - HashMap hashMap1 = hashMap.get(data); - Cell namecell = r.createCell(a.getAndIncrement()); - namecell.setCellValue(memberMapper.selectById(data).getUserName()); - int total = 0; - for (String date : dates) { - if (!date.equals("姓名") && !"合计总时长".equals(date)) { - Cell cell1 = r.createCell(a.getAndIncrement()); - if (null != hashMap1) { - total += null == hashMap1.get(date) ? 0 : hashMap1.get(date); - cell1.setCellValue(null == hashMap1.get(date) ? "00:00:00" : MathUtil.secToTime(hashMap1.get(date))); - } else { - cell1.setCellValue("00:00:00"); - } + int i= 1; + for (Long lg : memberIds){ + Row r = sheet.createRow(ai.getAndIncrement()); + AtomicInteger a = new AtomicInteger(); + Cell cell = r.createCell(at.getAndIncrement()); + CellStyle cellStyle = wb.createCellStyle(); + cellStyle.setFillForegroundColor(IndexedColors.PALE_BLUE.getIndex()); + cell.setCellStyle(cellStyle); + HashMap hashMap1 = hashMap.get(lg); + Cell seqcell = r.createCell(a.getAndIncrement()); + seqcell.setCellValue(i++); + Cell namecell = r.createCell(a.getAndIncrement()); + namecell.setCellValue(memberMapper.selectById(lg).getUserName()); + int total = 0; + for (String date : dates) { + if (!date.equals("姓名") && !"合计时长".equals(date)&& !"序号".equals(date)) { + Cell cell1 = r.createCell(a.getAndIncrement()); + if (null != hashMap1) { + total += null == hashMap1.get(date) ? 0 : hashMap1.get(date); + cell1.setCellValue(null == hashMap1.get(date) ? "00:00:00" : MathUtil.secToTime(hashMap1.get(date))); + } else { + cell1.setCellValue("00:00:00"); } } + } + Cell totalCell = r.createCell(a.getAndIncrement()); + totalCell.setCellValue(MathUtil.secToTime(total)); + } - Cell totalCell = r.createCell(a.getAndIncrement()); - totalCell.setCellValue(MathUtil.secToTime(total)); - }); } String fileName = String.valueOf(new Date().getTime()); try { @@ -1223,10 +1237,10 @@ public class AdministerServiceImpl extends ServiceImpl memberStudyLogVOS = iPage.getRecords(); for (MemberStudyLogVO memberStudyLogVO : memberStudyLogVOS) { memberStudyLogVO.setPlayLength(MathUtil.secToTime(Integer.valueOf(memberStudyLogVO.getPlayLength()))); @@ -1244,7 +1258,7 @@ public class AdministerServiceImpl extends ServiceImpl() @@ -115,7 +114,6 @@ public class DepartmentDictServiceImpl extends ServiceImpl() diff --git a/src/main/java/com/subsidy/service/impl/MemberServiceImpl.java b/src/main/java/com/subsidy/service/impl/MemberServiceImpl.java index 73c34cd..5287227 100644 --- a/src/main/java/com/subsidy/service/impl/MemberServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/MemberServiceImpl.java @@ -376,7 +376,6 @@ public class MemberServiceImpl extends ServiceImpl imple return null; } - @Async public String updatePassword(MemberDO memberDO) { this.baseMapper.updateById(memberDO); MemberDO memberDO1 = this.baseMapper.selectById(memberDO.getId()); diff --git a/src/main/java/com/subsidy/service/impl/PaperDictServiceImpl.java b/src/main/java/com/subsidy/service/impl/PaperDictServiceImpl.java index b2345a9..83b17a1 100644 --- a/src/main/java/com/subsidy/service/impl/PaperDictServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/PaperDictServiceImpl.java @@ -28,19 +28,16 @@ public class PaperDictServiceImpl extends ServiceImpl() diff --git a/src/main/java/com/subsidy/service/impl/SmsVerifyCodeServiceImpl.java b/src/main/java/com/subsidy/service/impl/SmsVerifyCodeServiceImpl.java index 5914543..ef6d289 100644 --- a/src/main/java/com/subsidy/service/impl/SmsVerifyCodeServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/SmsVerifyCodeServiceImpl.java @@ -37,7 +37,6 @@ public class SmsVerifyCodeServiceImpl extends ServiceImpl() .lambda() diff --git a/src/main/java/com/subsidy/util/ExcelFormatUtils.java b/src/main/java/com/subsidy/util/ExcelFormatUtils.java index 3d4938f..5424dfd 100644 --- a/src/main/java/com/subsidy/util/ExcelFormatUtils.java +++ b/src/main/java/com/subsidy/util/ExcelFormatUtils.java @@ -6,11 +6,11 @@ import java.util.List; public class ExcelFormatUtils { - public static final List memberList = Arrays.asList("序号", "成员名称", "身份证号码", "账号", "联系方式", "签到次数", "课程进度", "培训时长", "答疑数", "测试成绩", "总评价"); + public static final List memberList = Arrays.asList("序号", "成员名称","身份证号码", "性别", "账号", "联系方式", "签到次数", "课程进度", "学习时长", "答疑数", "测试成绩", "总评价"); - public static final List signList = Arrays.asList("序号", "成员名称", "身份证号码", "手机号码", "培训时长", "课程进度", "完成率", "签到次数", "签到日期"); + public static final List signList = Arrays.asList("序号", "成员名称", "身份证号码", "联系方式", "学习时长", "课程进度", "完成率", "签到次数", "签到日期"); - public static final List scoreList = Arrays.asList("序号", "成员名称", "身份证号码", "手机号码", "测试最高成绩", "测试次数", "总评价"); + public static final List scoreList = Arrays.asList("序号", "成员名称", "身份证号码", "联系方式", "测试成绩", "测试次数", "总评价"); public static final List answersList = Arrays.asList("序号", "提问", "答疑", "提问时间", "提问成员", "答疑时间"); diff --git a/src/main/java/com/subsidy/util/excel/ExcelUtil.java b/src/main/java/com/subsidy/util/excel/ExcelUtil.java index 356d51d..6a529b6 100644 --- a/src/main/java/com/subsidy/util/excel/ExcelUtil.java +++ b/src/main/java/com/subsidy/util/excel/ExcelUtil.java @@ -404,38 +404,40 @@ public class ExcelUtil { newCell.setCellStyle(cellStyle); newCell.setCellValue(classDetailVO.getIdCard()); - newCell = dataRow.createCell(3); newCell.setCellStyle(cellStyle); - newCell.setCellValue(classDetailVO.getAccountName()); + newCell.setCellValue(classDetailVO.getGender()); newCell = dataRow.createCell(4); newCell.setCellStyle(cellStyle); - newCell.setCellValue(classDetailVO.getTelephone()); + newCell.setCellValue(classDetailVO.getAccountName()); newCell = dataRow.createCell(5); newCell.setCellStyle(cellStyle); - newCell.setCellValue(classDetailVO.getSignCounts()); + newCell.setCellValue(classDetailVO.getTelephone()); newCell = dataRow.createCell(6); newCell.setCellStyle(cellStyle); - newCell.setCellValue(classDetailVO.getClassProcess()); + newCell.setCellValue(classDetailVO.getSignCounts()); newCell = dataRow.createCell(7); newCell.setCellStyle(cellStyle); - newCell.setCellValue(classDetailVO.getTrainingLengthStr()); + newCell.setCellValue(classDetailVO.getClassProcess()); newCell = dataRow.createCell(8); newCell.setCellStyle(cellStyle); - newCell.setCellValue(classDetailVO.getAskCounts()); + newCell.setCellValue(classDetailVO.getTrainingLengthStr()); newCell = dataRow.createCell(9); newCell.setCellStyle(cellStyle); - newCell.setCellValue(classDetailVO.getScore()); + newCell.setCellValue(classDetailVO.getAskCounts()); newCell = dataRow.createCell(10); newCell.setCellStyle(cellStyle); + newCell.setCellValue(classDetailVO.getScore()); + newCell = dataRow.createCell(11); + newCell.setCellStyle(cellStyle); newCell.setCellValue(classDetailVO.getResult()); rowIndex++; seq++; @@ -1162,7 +1164,7 @@ public class ExcelUtil { int[] secondWidth = new int[6]; // 产生表格标题行,以及设置列宽 String[] secondHead = new String[6]; - List secondList = Arrays.asList("学员姓名", memberDO.getUserName(), "性别:" + memberDO.getGender(), "身份证号", memberDO.getIdCard(), "手机号", memberDO.getTelephone()); + List secondList = Arrays.asList("成员名称:" + memberDO.getUserName(), "性别:" + memberDO.getGender(), "身份证号码", memberDO.getIdCard(), "联系方式", memberDO.getTelephone()); ii = 0; for (int i = 0; i < 6; i++) { @@ -1257,6 +1259,7 @@ public class ExcelUtil { e.printStackTrace(); } } + private static void setStyle(CellStyle cellStyle) { // 水平居中 cellStyle.setAlignment(CellStyle.ALIGN_CENTER); diff --git a/src/main/java/com/subsidy/vo/administer/ClassDailyInfoVO.java b/src/main/java/com/subsidy/vo/administer/ClassDailyInfoVO.java index d6a3b63..2cf924b 100644 --- a/src/main/java/com/subsidy/vo/administer/ClassDailyInfoVO.java +++ b/src/main/java/com/subsidy/vo/administer/ClassDailyInfoVO.java @@ -16,5 +16,7 @@ public class ClassDailyInfoVO { private Integer total; + private Integer studyLength; + private List classVodDailyInfoItemVOS; } diff --git a/src/main/java/com/subsidy/vo/classdict/ClassDetailVO.java b/src/main/java/com/subsidy/vo/classdict/ClassDetailVO.java index a8521cf..b3a19d6 100644 --- a/src/main/java/com/subsidy/vo/classdict/ClassDetailVO.java +++ b/src/main/java/com/subsidy/vo/classdict/ClassDetailVO.java @@ -18,16 +18,22 @@ public class ClassDetailVO{ @ExcelColumn(col = 2,value = "账号") private String accountName; - @ExcelColumn(col = 3,value = "身份证号") + /** + * 性别 + */ + @ExcelColumn(col = 3,value = "性别") + private String gender; + + @ExcelColumn(col = 4,value = "身份证号") private String idCard; - @ExcelColumn(col = 4,value = "联系方式") + @ExcelColumn(col = 5,value = "联系方式") private String telephone; /** * 签到次数 */ - @ExcelColumn(col = 5,value = "签到次数") + @ExcelColumn(col = 6,value = "签到次数") private Long signCounts; /** @@ -40,12 +46,12 @@ public class ClassDetailVO{ */ //private Integer allVodCounts; - @ExcelColumn(col = 6,value = "课程进度") + @ExcelColumn(col = 7,value = "课程进度") private String classProcess; private Integer trainingLength; - @ExcelColumn(col = 7,value = "培训时长") + @ExcelColumn(col = 8,value = "培训时长") private String trainingLengthStr; @@ -62,13 +68,13 @@ public class ClassDetailVO{ /** * 评价测试 */ - @ExcelColumn(col = 8,value = "评价测试") + @ExcelColumn(col = 9,value = "评价测试") private String score; /** * 答疑个数 */ - @ExcelColumn(col = 9,value = "答题数") + @ExcelColumn(col = 10,value = "答题数") private Integer askCounts; diff --git a/src/main/resources/mapper/AdministerMapper.xml b/src/main/resources/mapper/AdministerMapper.xml index f88f415..e98eda5 100644 --- a/src/main/resources/mapper/AdministerMapper.xml +++ b/src/main/resources/mapper/AdministerMapper.xml @@ -47,6 +47,7 @@ SELECT t2.id, t2.user_name, + t2.gender, t2.id_card, t2.account_name, t2.telephone diff --git a/src/main/resources/mapper/VodPlayHistoryMapper.xml b/src/main/resources/mapper/VodPlayHistoryMapper.xml index 444de10..d9b8b72 100644 --- a/src/main/resources/mapper/VodPlayHistoryMapper.xml +++ b/src/main/resources/mapper/VodPlayHistoryMapper.xml @@ -35,8 +35,11 @@ t2.vod_name, t3.play_record, t3.create_date, - IF - ( t.play_length >= t2.vod_length, 'true', 'false' ) AS STATUS + IF + ( + round( t.play_length * 100 / t2.vod_length )>= 100, + 100, + round( t.play_length * 100 / t2.vod_length )) AS percent FROM ( SELECT