Commit b509e5d7 by 涂亚平

高并发ing 杭州前版本

1 parent ec1f234c
Showing with 527 additions and 171 deletions
......@@ -13,7 +13,7 @@ public class RedisPrefixConstant {
public static final String SUBSIDY_COMPANY_MEMBER_PREFIX = "subsidyMember_";
/**
* subsidy_memberLogin_memberId_now : OprMemDictDO 学员端审计记录
*subsidy_memberLogin_memberId_userName_companyName_now : 学员端审计记录
*/
public static final String SUBSIDY_MEMBER_LOGIN_PREFIX = "subsidy_memberLogin_";
......
......@@ -7,6 +7,7 @@ import com.subsidy.common.interceptor.LoginRequired;
import com.subsidy.dto.administer.ClassDailyInfoDTO;
import com.subsidy.dto.administer.ClassDetailDTO;
import com.subsidy.dto.administer.ClassVodInfoDTO;
import com.subsidy.dto.administer.MemberStudyLogDTO;
import com.subsidy.dto.administer.OperatorsDTO;
import com.subsidy.model.AdministerDO;
import com.subsidy.model.ExerciseDoneHistoryDO;
......@@ -179,6 +180,11 @@ public class AdministerController {
return ResponseData.generateCreatedResponse(0,administerService.classDailyInfo(classDailyInfoDTO));
}
@PostMapping("exportClassDailyInfo")
public void exportVodInfo(@RequestBody ClassDailyInfoDTO classDailyInfoDTO){
administerService.exportClassDailyInfo(classDailyInfoDTO);
}
@PostMapping("exportZip")
@ApiOperation("** 下载压缩包 id 班级id")
@CrossOrigin
......@@ -187,6 +193,13 @@ public class AdministerController {
administerService.export(classDetailDTO);
}
@PostMapping("memberStudyLog")
@ApiOperation("学员学习日志 classId memberId")
public void memberStudyLog(@RequestBody MemberStudyLogDTO memberStudyLogDTO) throws Exception{
administerService.memberStudyLog(memberStudyLogDTO);
}
@PostMapping("importMember")
@ApiOperation("导入学生 {companyId 公司id file}")
public ResponseVO importMember(Long companyId,@RequestParam("file") MultipartFile file){
......
......@@ -47,7 +47,7 @@ public class ClassHourDictController {
}
@PostMapping("pollingGet")
@ApiOperation("** 轮询查询当前这个人当天有没有超过最长时长 memberId playLength")
@ApiOperation("轮询查询当前这个人当天有没有超过最长时长 memberId playLength")
public ResponseVO pollingGet(@RequestBody VodPlayHistoryDO vodPlayHistoryDO){
return ResponseData.generateCreatedResponse(0,classHourDictService.pollingGet(vodPlayHistoryDO));
}
......
......@@ -40,27 +40,27 @@ public class MemberController {
@PostMapping("getAll")
@ApiOperation("查询某部门成员 pageNum pageSize departmentId userName status")
//@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO getAll(@RequestBody GetAllDTO getAllDTO){
return ResponseData.generateCreatedResponse(0,memberService.getAll(getAllDTO));
}
@PostMapping("deleteMember")
@ApiOperation("** 删除成员 id ")
@ApiOperation("删除成员 id ")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO deleteMember(@RequestBody MemberDO memberDO){
return ResponseData.generateCreatedResponse(0,memberService.deleteMember(memberDO));
}
@PostMapping("addMember")
@ApiOperation("** 新增成员 companyId departmentId userName accountName telephone gender image idCard")
@ApiOperation("新增成员 companyId departmentId userName accountName telephone gender image idCard")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO addMember(@RequestBody AddMemberDTO addMemberDTO){
return ResponseData.generateCreatedResponse(0,memberService.addMember(addMemberDTO));
}
@PostMapping("updateMember")
@ApiOperation("** 编辑成员 {id companyId departmentId userName accountName telephone gender image idCard status}")
@ApiOperation("编辑成员 {id companyId departmentId userName accountName telephone gender image idCard status}")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO updateMember(@RequestBody AddMemberDTO addMemberDTO){
return ResponseData.generateCreatedResponse(0,memberService.updateMember(addMemberDTO));
......@@ -85,19 +85,19 @@ public class MemberController {
}
@PostMapping("studyPage")
@ApiOperation("** 手机端:学习主页 id 学员id")
@ApiOperation("手机端:学习主页 id 学员id")
public ResponseVO studyPage(@RequestBody MemberDO memberDO){
return ResponseData.generateCreatedResponse(0,memberService.studyPage(memberDO));
}
@PostMapping("contentVod")
@ApiOperation("** 手机端:目录+视频 courseId 课程 memberId 学员id")
@ApiOperation("手机端:目录+视频 courseId 课程 memberId 学员id")
public ResponseVO contentVod(@RequestBody ContentMemberDTO contentVodDTO){
return ResponseData.generateCreatedResponse(0,memberService.contentVod(contentVodDTO));
}
@PostMapping("contentFiles")
@ApiOperation("** 手机端:目录+课件 courseId 课程 memberId 学员id")
@ApiOperation("手机端:目录+课件 courseId 课程 memberId 学员id")
public ResponseVO contentFiles(@RequestBody ContentMemberDTO contentMemberDTO){
return ResponseData.generateCreatedResponse(0,memberService.contentFiles(contentMemberDTO));
}
......
......@@ -30,7 +30,7 @@ public class OprAdmDictController {
private OprAdmDictService oprAdmDictService;
@PostMapping("getHistory")
@ApiOperation("获取后台用户审计 {pageSize pageNum userName startDate endDate}")
@ApiOperation("###获取后台用户审计 {pageSize pageNum userName startDate endDate}")
public ResponseVO getHistory(@RequestBody GetHistoryDTO getHistoryDTO){
return ResponseData.generateCreatedResponse(0,oprAdmDictService.getHistory(getHistoryDTO));
}
......
......@@ -31,7 +31,7 @@ public class OprMemDictController {
@PostMapping("getHistory")
@ApiOperation("获取学员审计 {pageSize pageNum userName startDate endDate}")
@ApiOperation("###获取学员审计 {pageSize pageNum userName startDate endDate}")
public ResponseVO getHistory(@RequestBody GetHistoryDTO getHistoryDTO){
return ResponseData.generateCreatedResponse(0,oprMemDictService.getHistory(getHistoryDTO));
}
......
......@@ -3,10 +3,12 @@ package com.subsidy.controller;
import com.subsidy.common.ResponseData;
import com.subsidy.common.ResponseVO;
import com.subsidy.common.interceptor.LoginRequired;
import com.subsidy.dto.member.GetMemberSignInfoDTO;
import com.subsidy.dto.sign.ClassSignInfoDTO;
import com.subsidy.model.SignInRecordDO;
import com.subsidy.service.SignInRecordService;
import com.subsidy.util.ConstantUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -32,26 +34,26 @@ public class SignInRecordController {
private SignInRecordService signInRecordService;
@PostMapping("getMemberSignInfo")
@ApiOperation("** 获取某个成员的签到记录 id 成员id pageSize pageNum")
@ApiOperation("###获取某个成员的签到记录 id 成员id pageSize pageNum")
public ResponseVO getMemberSignInfo(@RequestBody GetMemberSignInfoDTO getMemberSignInfoDTO) {
return ResponseData.generateCreatedResponse(0, signInRecordService.getMemberSignInfo(getMemberSignInfoDTO));
}
@PostMapping("signIn")
@ApiOperation("** 签到 memberId")
@ApiOperation("签到 memberId")
public ResponseVO signIn(@RequestBody SignInRecordDO signInRecordDO) {
return ResponseData.generateCreatedResponse(0, signInRecordService.signIn(signInRecordDO));
}
@PostMapping("classStudyHistory")
@ApiOperation("** 校区学习记录 id 校区id className courseName pageSize pageNum")
//@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
@ApiOperation("校区学习记录 id 校区id className courseName pageSize pageNum")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO classSignInfo(@RequestBody ClassSignInfoDTO classSignInfoDTO) {
return ResponseData.generateCreatedResponse(0, signInRecordService.classSignInfo(classSignInfoDTO));
}
@PostMapping("signInStatus")
@ApiOperation("** 判断学生当天有没有打卡 {memberId 学生id}")
@ApiOperation("判断学生当天有没有打卡 {memberId 学生id}")
public ResponseVO signInStatus(@RequestBody SignInRecordDO signInRecordDO) {
return ResponseData.generateCreatedResponse(0, signInRecordService.signInStatus(signInRecordDO));
}
......
......@@ -30,7 +30,7 @@ public class SmsVerifyCodeController {
private SmsVerifyCodeService smsVerifyCodeService;
@PostMapping(value = "/send")
@ApiOperation("** 发送短信验证码 {telephone} ")
@ApiOperation("发送短信验证码 {telephone} ")
public ResponseVO sendVerifyCode(@RequestBody SendVerifyCodeDTO sendVerifyCodeDTO ) {
smsVerifyCodeService.sendVerifyCode(sendVerifyCodeDTO);
return ResponseData.generateCreatedResponse(0);
......
......@@ -33,39 +33,38 @@ public class VodDictController {
private VodDictService vodDictService;
@PostMapping("/signature")
@ApiOperation("** 获取签名")
public ResponseVO signature()throws Exception{
return ResponseData.generateCreatedResponse(0,vodDictService.signature());
@ApiOperation("获取签名")
public ResponseVO signature() throws Exception {
return ResponseData.generateCreatedResponse(0, vodDictService.signature());
}
@PostMapping("getContendVods")
@ApiOperation("** 获取目录下的视频 {contentId vodName}")
@ApiOperation("获取目录下的视频 {contentId vodName}")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO getContendVods(@RequestBody GetContendVodsDTO getContendVodsDTO){
return ResponseData.generateCreatedResponse(0,vodDictService.getContendVods(getContendVodsDTO));
public ResponseVO getContendVods(@RequestBody GetContendVodsDTO getContendVodsDTO) {
return ResponseData.generateCreatedResponse(0, vodDictService.getContendVods(getContendVodsDTO));
}
@PostMapping("deleteVod")
@ApiOperation("** 删除视频 id ")
@ApiOperation("删除视频 id ")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO deleteVod(@RequestBody VodDictDO vodDictDO){
return ResponseData.generateCreatedResponse(0,vodDictService.deleteVod(vodDictDO));
public ResponseVO deleteVod(@RequestBody VodDictDO vodDictDO) {
return ResponseData.generateCreatedResponse(0, vodDictService.deleteVod(vodDictDO));
}
@PostMapping("addVod")
@ApiOperation("** 新增视频 contentId vodName vodLength vodType vodSize vodUrl vodCode")
@ApiOperation("新增视频 contentId vodName vodLength vodType vodSize vodUrl vodCode")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO addVod(@RequestBody VodDictDO vodDictDO){
return ResponseData.generateCreatedResponse(0,vodDictService.addVod(vodDictDO));
public ResponseVO addVod(@RequestBody VodDictDO vodDictDO) {
return ResponseData.generateCreatedResponse(0, vodDictService.addVod(vodDictDO));
}
@PostMapping("updateVod")
@ApiOperation("** 新增视频 id contentId vodName vodLength vodType vodSize vodUrl vodCode")
@ApiOperation("新增视频 id contentId vodName vodLength vodType vodSize vodUrl vodCode")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO updateVod(@RequestBody VodDictDO vodDictDO){
return ResponseData.generateCreatedResponse(0,vodDictService.updateVod(vodDictDO));
public ResponseVO updateVod(@RequestBody VodDictDO vodDictDO) {
return ResponseData.generateCreatedResponse(0, vodDictService.updateVod(vodDictDO));
}
}
......@@ -31,13 +31,13 @@ public class VodPlayHistoryController {
private VodPlayHistoryService vodPlayHistoryService;
@PostMapping("insertHistory")
@ApiOperation("** 记录学生看视频位置 ajax请求 classId班级id vodId 视频id memberId 成员id playLength 播放时长 playRecord 位点")
@ApiOperation("记录学生看视频位置 ajax请求 classId班级id vodId 视频id memberId 成员id playLength 播放时长 playRecord 位点")
public ResponseVO insertHistory(@RequestBody VodPlayHistoryDO vodPlayHistoryDO){
return ResponseData.generateCreatedResponse(0,vodPlayHistoryService.insertHistory(vodPlayHistoryDO));
}
@RequestMapping("insertHistoryNew")
@ApiOperation("** 记录学生看视频位置 classId班级id vodId 视频id memberId 成员id playLength 播放时长 playRecord 位点")
@ApiOperation("记录学生看视频位置 classId班级id vodId 视频id memberId 成员id playLength 播放时长 playRecord 位点")
public ResponseVO insertHistoryNew(@RequestBody String param){
VodPlayHistoryDO vodPlayHistoryDO = JSON.parseObject(param,VodPlayHistoryDO.class);
return ResponseData.generateCreatedResponse(0,vodPlayHistoryService.insertHistoryNew(vodPlayHistoryDO));
......
package com.subsidy.dto.administer;
import lombok.Data;
@Data
public class MemberStudyLogDTO {
private Long memberId;
private Long classId;
}
......@@ -2,9 +2,12 @@ package com.subsidy.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.subsidy.model.CourseContentDO;
import com.subsidy.model.FileDictDO;
import com.subsidy.model.VodDictDO;
import com.subsidy.vo.member.MemberVodVO;
import org.springframework.stereotype.Repository;
import java.io.File;
import java.util.List;
/**
......@@ -23,4 +26,14 @@ public interface CourseContentMapper extends BaseMapper<CourseContentDO> {
*/
List<VodDictDO> getCourseVods(Integer courseId);
/**
* 查看某个目录下 某个成员看视频的进度
*/
List<MemberVodVO> contentVodProcess(Long contentId, Long memberId);
/**
* 查看某个课程下的文件/课件
*/
List<FileDictDO> contentFiles(Long courseId);
}
......@@ -3,6 +3,9 @@ package com.subsidy.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.subsidy.model.VodPlayHistoryDO;
import com.subsidy.vo.administer.MemberStudyLogVO;
import com.subsidy.vo.member.ContentVodNewVO;
import com.subsidy.vo.sign.ClassSignInfoVO;
import com.subsidy.vo.vod.GetMemberStudyInfoVO;
import com.subsidy.vo.vod.StudyHistoryVO;
import org.springframework.stereotype.Repository;
......@@ -23,12 +26,12 @@ public interface VodPlayHistoryMapper extends BaseMapper<VodPlayHistoryDO> {
/**
* 查看某成员的学习历史
*/
IPage<StudyHistoryVO> studyHistory(IPage iPage,Long memberId);
IPage<StudyHistoryVO> studyHistory(IPage iPage, Long memberId);
/**
* 从成员,日期的维度查看学生学习时长
*/
List<GetMemberStudyInfoVO> getMemberStudyInfo(Long classId,List<Long> memberIds,String startDate,String endDate);
List<GetMemberStudyInfoVO> getMemberStudyInfo(Long classId, List<Long> memberIds, String startDate, String endDate);
/**
* 缩量记录
......@@ -45,5 +48,24 @@ public interface VodPlayHistoryMapper extends BaseMapper<VodPlayHistoryDO> {
/**
* 查看学生是否完成了某个视频
*/
int completeVodOrNot(Long memberId,Long vodId);
int completeVodOrNot(Long memberId, Long vodId);
/**
* 查看某个班级的学习记录
*/
ClassSignInfoVO classStudyHistory(Long classId);
/**
* 查看这个课程某个成员看的视频课程
*/
ContentVodNewVO memberRecentPlay(Long classId, Long memberId);
/**
* 查看某个成员某个课程的学习日志
*/
List<MemberStudyLogVO> memberStudyLog(Long classId, Long memberId);
}
......@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.subsidy.dto.administer.ClassDailyInfoDTO;
import com.subsidy.dto.administer.ClassDetailDTO;
import com.subsidy.dto.administer.ClassVodInfoDTO;
import com.subsidy.dto.administer.MemberStudyLogDTO;
import com.subsidy.dto.administer.OperatorsDTO;
import com.subsidy.model.AdministerDO;
import com.subsidy.model.ExerciseDoneHistoryDO;
......@@ -73,8 +74,12 @@ public interface AdministerService extends IService<AdministerDO> {
IPage<ClassDailyInfoVO> classDailyInfo(ClassDailyInfoDTO classDailyInfoDTO);
void exportClassDailyInfo(ClassDailyInfoDTO classDailyInfoDTO);
void export(ClassDetailDTO classDetailDTO)throws Exception;
void memberStudyLog(MemberStudyLogDTO memberStudyLogDTO)throws Exception;
String importMember(Long companyId, MultipartFile multipartFile);
}
......@@ -9,6 +9,7 @@ import com.subsidy.dto.member.GetAllDTO;
import com.subsidy.dto.member.PasswordLoginDTO;
import com.subsidy.dto.member.StudyHistoryDTO;
import com.subsidy.model.ExerciseDoneResultDO;
import com.subsidy.model.FileDictDO;
import com.subsidy.model.MemberDO;
import com.subsidy.vo.administer.UserRoleVO;
import com.subsidy.vo.member.ContentFilesVO;
......
......@@ -9,6 +9,7 @@ import com.subsidy.common.exception.HttpException;
import com.subsidy.dto.administer.ClassDailyInfoDTO;
import com.subsidy.dto.administer.ClassDetailDTO;
import com.subsidy.dto.administer.ClassVodInfoDTO;
import com.subsidy.dto.administer.MemberStudyLogDTO;
import com.subsidy.dto.administer.OperatorsDTO;
import com.subsidy.dto.member.ImportMemberDTO;
import com.subsidy.mapper.AdministerMapper;
......@@ -57,6 +58,7 @@ import com.subsidy.vo.administer.ExerciseTestVO;
import com.subsidy.vo.administer.GetMemberPapersVO;
import com.subsidy.vo.administer.GetPaperDetailVO;
import com.subsidy.vo.administer.LoginVO;
import com.subsidy.vo.administer.MemberStudyLogVO;
import com.subsidy.vo.administer.OperatorsVO;
import com.subsidy.vo.administer.PermissionsVO;
import com.subsidy.vo.classdict.ClassDetailVO;
......@@ -75,12 +77,18 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFFont;
import org.apache.poi.hssf.util.CellRangeAddress;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.Font;
import org.apache.poi.ss.usermodel.IndexedColors;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.streaming.SXSSFCell;
import org.apache.poi.xssf.streaming.SXSSFRow;
import org.apache.poi.xssf.streaming.SXSSFSheet;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
......@@ -99,14 +107,21 @@ import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.math.BigDecimal;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
......@@ -182,6 +197,9 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
redisUtil.set(RedisPrefixConstant.SUBSIDY_ADMINISTER_PREFIX + administerDO.getAccountName(), administerDO1);
}
if ("0".equals(administerDO1.getStatus())){
throw new HttpException(10013);
}
/**
* 最近5次都输入失败,5分钟后再验证 待优化
*/
......@@ -1002,7 +1020,130 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
return classDailyInfoVOIPage;
}
@Async
public void exportClassDailyInfo(ClassDailyInfoDTO classDailyInfoDTO) {
Page pager = new Page(1, -1L);
// 表头
List<String> title = new ArrayList<>();
title.add("姓名");
title.addAll(findDaysStr(classDailyInfoDTO.getStartDate(), classDailyInfoDTO.getEndDate()));
//获取班级成员
IPage<ClassDailyInfoVO> classDailyInfoVOIPage = classMemberMappingMapper.getClassMembersWithName(pager, classDailyInfoDTO.getClassId(), classDailyInfoDTO.getUserName());
//整理出这些学员id
List<ClassDailyInfoVO> classDailyInfoVOS = classDailyInfoVOIPage.getRecords();
List<Long> memberIds = new ArrayList<>();
for (ClassDailyInfoVO classDailyInfoVO : classDailyInfoVOS) {
memberIds.add(classDailyInfoVO.getId());
}
//这些成员完成情况
List<GetMemberStudyInfoVO> getMemberStudyInfoVOS = vodPlayHistoryMapper.getMemberStudyInfo(classDailyInfoDTO.getClassId(), memberIds, classDailyInfoDTO.getStartDate(), classDailyInfoDTO.getEndDate());
HashMap<Long, HashMap<String, Integer>> hashMap = new HashMap();
for (GetMemberStudyInfoVO getMemberStudyInfoVO : getMemberStudyInfoVOS) {
if (!hashMap.containsKey(getMemberStudyInfoVO.getMemberId())) {
HashMap<String, Integer> hashMap1 = new HashMap<>();
hashMap1.put(getMemberStudyInfoVO.getStudyDate(), getMemberStudyInfoVO.getPlayLength());
hashMap.put(getMemberStudyInfoVO.getMemberId(), hashMap1);
} else {
HashMap<String, Integer> hashMap1 = hashMap.get(getMemberStudyInfoVO.getMemberId());
hashMap1.put(getMemberStudyInfoVO.getStudyDate(), getMemberStudyInfoVO.getPlayLength());
hashMap.put(getMemberStudyInfoVO.getMemberId(), hashMap1);
}
}
writeExcel(memberIds, hashMap, title);
}
/**
* 导出excel文件
*/
public <T> void writeExcel(List<Long> memberIds, HashMap<Long, HashMap<String, Integer>> hashMap, List<String> dates) {
ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
HttpServletResponse response = servletRequestAttributes.getResponse();
Workbook wb = new XSSFWorkbook();
Sheet sheet = wb.createSheet();
AtomicInteger ai = new AtomicInteger();
Row row = sheet.createRow(ai.getAndIncrement());
AtomicInteger at = new AtomicInteger();
dates.forEach(field -> {
Cell cell = row.createCell(at.getAndIncrement());
CellStyle cellStyle = wb.createCellStyle();
cellStyle.setFillForegroundColor(IndexedColors.PALE_BLUE.getIndex());
Font font = wb.createFont();
font.setBoldweight(Font.BOLDWEIGHT_BOLD);
cellStyle.setFont(font);
cell.setCellStyle(cellStyle);
cell.setCellValue(field);
});
if (hashMap != null) {
memberIds.forEach(data -> {
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<String, Integer> hashMap1 = hashMap.get(data);
Cell namecell = r.createCell(a.getAndIncrement());
namecell.setCellValue(memberMapper.selectById(data).getUserName());
dates.forEach(field -> {
if (!field.equals("姓名")) {
Cell cell1 = r.createCell(a.getAndIncrement());
if (null != hashMap1) {
cell1.setCellValue(null == hashMap1.get(field) ? "00:00:00" : MathUtil.secToTime(hashMap1.get(field)));
} else {
cell1.setCellValue("00:00:00");
}
}
});
});
}
String fileName = String.valueOf(new Date().getTime());
try {
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.setHeader("content-disposition", "attachment;filename=" + URLEncoder.encode(fileName + ".xlsx", "utf-8"));
response.flushBuffer();
wb.write(response.getOutputStream());
} catch (IOException e) {
log.error(String.format("downLoad excel exception"), e);
}
}
//JAVA 获取时间段内的每一天
public static List<String> findDaysStr(String begintTime, String endTime) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Date dBegin = null;
Date dEnd = null;
try {
dBegin = sdf.parse(begintTime);
dEnd = sdf.parse(endTime);
} catch (ParseException e) {
e.printStackTrace();
}
List<String> daysStrList = new ArrayList<String>();
daysStrList.add(sdf.format(dBegin));
Calendar calBegin = Calendar.getInstance();
calBegin.setTime(dBegin);
Calendar calEnd = Calendar.getInstance();
calEnd.setTime(dEnd);
while (dEnd.after(calBegin.getTime())) {
calBegin.add(Calendar.DAY_OF_MONTH, 1);
String dayStr = sdf.format(calBegin.getTime());
daysStrList.add(dayStr);
}
return daysStrList;
}
public void export(ClassDetailDTO classDetailDTO) throws Exception {
ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
......@@ -1069,6 +1210,20 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
}
public void memberStudyLog(MemberStudyLogDTO memberStudyLogDTO) throws Exception {
MemberDO memberDO = memberMapper.selectById(memberStudyLogDTO.getMemberId());
List<MemberStudyLogVO> memberStudyLog = vodPlayHistoryMapper.memberStudyLog(memberStudyLogDTO.getClassId(), memberStudyLogDTO.getMemberId());
for (MemberStudyLogVO memberStudyLogVO : memberStudyLog) {
memberStudyLogVO.setPlayLength(MathUtil.secToTime(Integer.valueOf(memberStudyLogVO.getPlayLength())));
memberStudyLogVO.setTotalLength(MathUtil.secToTime(Integer.valueOf(memberStudyLogVO.getTotalLength())));
}
ExcelUtil.writeMemberStudyLog(memberDO, "学习日志", memberStudyLog, ExcelFormatUtils.studyLogList);
}
@Transactional(rollbackFor = Exception.class)
public String importMember(Long companyId, MultipartFile multipartFile) {
......@@ -1348,6 +1503,7 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
newCell = dataRow.createCell(10);
newCell.setCellStyle(cellStyle);
newCell.setCellValue(classDetailVO.getResult());
rowIndex++;
seq++;
......@@ -1755,11 +1911,8 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
//次数
newCell = dataRow.createCell(5);
newCell.setCellStyle(cellStyle);
if (exerciseTestVO.getScore() != 0) {
newCell.setCellValue(1);
} else {
newCell.setCellValue(0);
}
newCell.setCellValue(exerciseTestVO.getCount());
newCell = dataRow.createCell(6);
newCell.setCellStyle(cellStyle);
......
......@@ -64,50 +64,22 @@ public class ClassHourDictServiceImpl extends ServiceImpl<ClassHourDictMapper, C
MemberDO memberDO = memberMapper.selectById(vodPlayHistoryDO.getMemberId());
final ExecutorService newCachedThreadPool = Executors.newCachedThreadPool();
//查看系统设定的时长
ClassHourDictDO classHourDictDO = (ClassHourDictDO) redisUtil.get(RedisPrefixConstant.SUBSIDY_SETTINGS_PREFIX + memberDO.getCompanyId());
ClassHourDictDO classHourDictDO = new ClassHourDictDO();
Integer total = 0;
try {
//多个任务
Future<ClassHourDictDO> future1 = newCachedThreadPool.submit(() -> ///该学生完成了多少个 学生成绩,学生进度
pollingGetTask1(memberDO.getCompanyId())).get();
//查看系统设定的时长
classHourDictDO = future1.get();
Future<Integer> future2 = newCachedThreadPool.submit(() -> //答疑
pollingGetTask2(memberDO.getId())).get();
////查看当天这个人看了多少时间
total = future2.get();
} catch (Exception e) {
e.printStackTrace();
}
//执行后不再接收新任务,如果里面有任务,就执行完
newCachedThreadPool.shutdown();
try {
while (true) {
//等待所有任务都结束了继续执行
if (newCachedThreadPool.isTerminated()) {
break;
}
}
} catch (Exception ex) {
ex.printStackTrace();
}
if (classHourDictDO.getStatus() == 0) {
pollingGetVO.setBool(false);
return pollingGetVO;
}
//查看当天这个人看了多少时间
Integer total = vodPlayHistoryMapper.memberDailyStudyLength(memberDO.getId());
//是否超过时长 没超过 false 超过 true
if (classHourDictDO == null) {
pollingGetVO.setBool(true);
} else {
if (total + vodPlayHistoryDO.getPlayLength() < classHourDictDO.getClassHour() * 60 * 60) {
if (total + vodPlayHistoryDO.getPlayLength() <= classHourDictDO.getClassHour() * 60 * 60) {
pollingGetVO.setBool(false);
} else {
pollingGetVO.setBool(true);
......@@ -116,14 +88,4 @@ public class ClassHourDictServiceImpl extends ServiceImpl<ClassHourDictMapper, C
return pollingGetVO;
}
public Future<ClassHourDictDO> pollingGetTask1(Long companyId) {
System.out.println(redisUtil.get(RedisPrefixConstant.SUBSIDY_SETTINGS_PREFIX + companyId));
return new AsyncResult<>((ClassHourDictDO) redisUtil.get(RedisPrefixConstant.SUBSIDY_SETTINGS_PREFIX + companyId));
//return new AsyncResult<>("hello");
}
public Future<Integer> pollingGetTask2(Long memberId) {
return new AsyncResult<>(vodPlayHistoryMapper.memberDailyStudyLength(memberId));
}
}
......@@ -38,27 +38,20 @@ public class SmsVerifyCodeServiceImpl extends ServiceImpl<SmsVerifyCodeMapper, S
private RedisUtil redisUtil;
@Async
public void sendVerifyCode(SendVerifyCodeDTO sendVerifyCodeDTO){
MemberDO memberDO =memberMapper.selectOne(new QueryWrapper<MemberDO>()
public void sendVerifyCode(SendVerifyCodeDTO sendVerifyCodeDTO) {
MemberDO memberDO = memberMapper.selectOne(new QueryWrapper<MemberDO>()
.lambda()
.eq(MemberDO::getTelephone, sendVerifyCodeDTO.getTelephone()));
if(memberDO == null) {
if (memberDO == null) {
throw new HttpException(70012);
}
String code = RandomUtil.getRandomCode(6);
smsUtils.send(sendVerifyCodeDTO.getTelephone(), code);
//SmsVerifyCodeDO smsCodeDO = new SmsVerifyCodeDO();
//smsCodeDO.setVerifyCode(code);
//smsCodeDO.setTelephone(sendVerifyCodeDTO.getTelephone());
//this.baseMapper.insert(smsCodeDO);
/**
* 验证码存在redis
*/
redisUtil.set(RedisPrefixConstant.SUBSIDY_TELEPHONE_PREFIX +sendVerifyCodeDTO.getTelephone(),code,30*60);
redisUtil.set(RedisPrefixConstant.SUBSIDY_TELEPHONE_PREFIX + sendVerifyCodeDTO.getTelephone(), code, 30 * 60);
}
}
......@@ -21,10 +21,8 @@ import com.tencentcloudapi.vod.v20180717.VodClient;
import com.tencentcloudapi.vod.v20180717.models.DeleteMediaRequest;
import com.tencentcloudapi.vod.v20180717.models.MediaProcessTaskInput;
import com.tencentcloudapi.vod.v20180717.models.ProcessMediaRequest;
import com.tencentcloudapi.vod.v20180717.models.ProcessMediaResponse;
import com.tencentcloudapi.vod.v20180717.models.TranscodeTaskInput;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import java.util.Random;
......@@ -44,8 +42,7 @@ public class VodDictServiceImpl extends ServiceImpl<VodDictMapper, VodDictDO> im
private VODConfig vodConfig;
public SignatureVO signature() throws Exception {
//
public SignatureVO signature() {
SignatureVO signatureVO = new SignatureVO();
Signature signature = new Signature();
......@@ -61,21 +58,19 @@ public class VodDictServiceImpl extends ServiceImpl<VodDictMapper, VodDictDO> im
signatureVO.setSign(sign);
} catch (Exception ex) {
ex.printStackTrace();
// throw new MyException(ResultEnum.UNKNOWN_ERROR);
}
return signatureVO;
}
public IPage<GetContendVodsVO> getContendVods(GetContendVodsDTO getContendVodsDTO) {
Page pager = new Page(getContendVodsDTO.getPageNum(), getContendVodsDTO.getPageSize());
return this.baseMapper.getContendVods(pager,getContendVodsDTO.getVodName(),getContendVodsDTO.getContentId());
return this.baseMapper.getContendVods(pager, getContendVodsDTO.getVodName(), getContendVodsDTO.getContentId());
}
@Async
public String deleteVod(VodDictDO vodDictDO) {
VodDictDO vodDictDO1 = this.baseMapper.selectById(vodDictDO.getId());
this.baseMapper.deleteById(vodDictDO.getId());
try{
try {
//删除原视频
Credential cred = new Credential(vodConfig.getSecretId(), vodConfig.getSecretKey());
......@@ -94,13 +89,11 @@ public class VodDictServiceImpl extends ServiceImpl<VodDictMapper, VodDictDO> im
// 返回的resp是一个DeleteMediaResponse的实例,与请求对象对应
client.DeleteMedia(req);
} catch (TencentCloudSDKException e) {
System.out.println(e.toString());
}
return ConstantUtils.DELETE_SUCCESS;
}
@Async
public String addVod(VodDictDO vodDictDO) {
this.baseMapper.insert(vodDictDO);
//上传后直接转码
......@@ -124,9 +117,8 @@ public class VodDictServiceImpl extends ServiceImpl<VodDictMapper, VodDictDO> im
processMediaRequest.setMediaProcessTask(mediaProcessTaskInput1);
processMediaRequest.setFileId(vodDictDO.getVodCode());
ProcessMediaResponse processMediaResponse = null;
try {
processMediaResponse = client.ProcessMedia(processMediaRequest);
client.ProcessMedia(processMediaRequest);
} catch (Exception ex) {
throw new HttpException(50001);
}
......@@ -134,12 +126,10 @@ public class VodDictServiceImpl extends ServiceImpl<VodDictMapper, VodDictDO> im
return ConstantUtils.ADD_SUCCESS;
}
@Async
public String updateVod(VodDictDO vodDictDO) {
this.baseMapper.updateById(vodDictDO);
return ConstantUtils.SET_SUCCESS;
}
}
......@@ -14,4 +14,6 @@ public class ExcelFormatUtils {
public static final List<String> answersList = Arrays.asList("序号", "提问", "答疑", "提问时间", "提问成员", "答疑时间");
public static final List<String> studyLogList = Arrays.asList("开始时间","结束时间","操作对象","类型","平台","学习时长","有效时长");
}
......@@ -157,7 +157,6 @@ public class MathUtil {
}
return timeStr;
}
public static String unitFormat(int i) {
String retStr = null;
if (i >= 0 && i < 10) {
......
package com.subsidy.vo.administer;
import lombok.Data;
@Data
public class MemberStudyLogVO {
private String startDate;
private String endDate;
private String vodName;
private String studyType;
private String platForm;
private String playLength;
private String totalLength;
}
package com.subsidy.vo.member;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.subsidy.model.VodDictDO;
import lombok.Data;
import java.util.List;
......@@ -10,54 +7,9 @@ import java.util.List;
@Data
public class ContentVodNewVO {
private Integer playRecord;
private Long id;
/**
* 目录id
*/
private Long contentId;
/**
* 视频名称
*/
private String vodName;
/**
* 视频时长
*/
private Integer vodLength;
/**
* 视频格式
*/
private String vodType;
/**
* 视频大小
*/
private String vodSize;
/**
* 视频地址
*/
private String vodUrl;
/**
* 视频编码
*/
private String vodCode;
/**
* 讲师名称
*/
private String teacherName;
/**
* 封面
*/
private String coverPage;
private Integer playRecord;
private List<ContentVodVO> contentVodVOS;
......
......@@ -7,7 +7,7 @@ public class DayInfoItemVO {
private String studyDate;
private Long totalLength;
private Integer totalLength;
private Integer distinctLength;
......
......@@ -9,7 +9,7 @@ public class GetMemberStudyInfoVO {
private String studyDate;
private Long playLength;
private Integer playLength;
private Integer distinctLength;
......
# 环境配置
spring.profiles.active=dev
# 端口号
spring.server.port=23457
spring.server.port=23454
#嵌入tomcat配置
#和CPU数
spring.server.acceptorThreadCount=600
......
......@@ -53,6 +53,7 @@
left join member t2 on t.member_id = t2.id
WHERE
t.delete_date IS NULL
and t2.delete_date is null
AND t.class_id = #{classId}
<if test="userName !=null and userName !=''">
and t2.user_name like concat('%',#{userName} ,'%')
......
......@@ -43,4 +43,42 @@
and t2.id is not null
</select>
<select id="contentVodProcess" resultType="com.subsidy.vo.member.MemberVodVO">
SELECT
t3.id,
t2.play_record,
t3.vod_length,
t3.vod_name,
t3.vod_url,
floor( t2.play_record * 100 / t3.vod_length ) AS percent,
IF
( t2.play_record >= t3.vod_length * 0.8, 'true', 'false' ) AS STATUS
FROM
vod_play_history t2
LEFT JOIN vod_dict t3 ON t2.vod_id = t3.id
WHERE
t2.vod_id IN ( SELECT id FROM vod_dict t WHERE t.content_id = #{contentId} )
AND t2.member_id = #{memberId}
</select>
<select id="contentFiles" parameterType="long" resultType="com.subsidy.model.FileDictDO">
SELECT
t2.id,
t2.file_name,
t2.file_size,
t2.file_type,
t2.file_url
FROM
course_content t
LEFT JOIN file_dict t2 ON t.id = t2.content_id
WHERE
t.delete_date IS NULL
AND t2.delete_date IS NULL
AND t2.id IS NOT NULL
AND t.course_id = #{courseId}
ORDER BY
t.order_no,
t2.order_no
</select>
</mapper>
......@@ -84,7 +84,8 @@
exercise_done_result t
left join paper_dict t2 on t.paper_id = t2.id
WHERE
t.member_id = #{memberId}
t.delete_date is null
and t.member_id = #{memberId}
AND t.class_id = #{classId}
GROUP BY
t.class_id,
......
......@@ -76,7 +76,13 @@
<select id="getMembers" resultType="com.subsidy.vo.member.GetAllVO">
SELECT
t2.*
t2.id,
t2.user_name,
t2.account_name,
t2.telephone,
t2.gender,
t2.id_card,
t2.status
FROM
member_department_mapping t
LEFT JOIN member t2 ON t.member_id = t2.id
......
......@@ -37,6 +37,7 @@
WHERE
t.delete_date IS NULL
AND t2.delete_date IS NULL
and t3.delete_date is null
and t3.id = #{id}
<if test="courseName != null and courseName !=''">
AND t.course_name like concat('%',#{courseName} ,'%')
......
......@@ -27,7 +27,15 @@
<select id="getContendVods" resultType="com.subsidy.vo.vod.GetContendVodsVO">
SELECT
t.*,
t.id,
t.content_id,
t.vod_name,
t.vod_length,
t.vod_type,
t.vod_size,
t.vod_url,
t.teacher_name,
t.cover_page,
t2.content
FROM
vod_dict t
......
......@@ -103,7 +103,7 @@
<select id="memberDailyStudyLength" parameterType="long" resultType="integer">
SELECT
ifnull( sum( t.play_length ), 0 )
ifnull( sum( t.play_length ), 0 )
FROM
vod_play_history t
WHERE
......@@ -115,7 +115,7 @@
<select id="completeVodOrNot" resultType="integer">
SELECT
IF
( max( t.play_record ) > t2.vod_length*0.8, 1, 0 ) AS count
( max( t.play_record ) >= t2.vod_length*0.8, 1, 0 ) AS count
FROM
vod_play_history t
LEFT JOIN vod_dict t2 ON t.vod_id = t2.id
......@@ -125,4 +125,165 @@
t.member_id = #{memberId}
AND t.vod_id = #{vodId}
</select>
<select id="classStudyHistory" parameterType="long" resultType="com.subsidy.vo.sign.ClassSignInfoVO">
SELECT
mem_cnt AS memberCount,
floor( t2.ttl / mem_cnt ) AS studyVodCounts,
t3.total_vods AS totalVodCounts,
avg_playlength AS avgVodPlayLength,
floor( t4.pass_cnt * 100 / mem_cnt ) AS passRate,
t5.ask_cnt AS answerCount
FROM
(
SELECT
t.class_id,
count(
DISTINCT ( t.member_id )) AS mem_cnt,
round( sum( t.play_length )/ count( DISTINCT ( t.member_id )), 0 ) AS avg_playlength
FROM
vod_play_history t
WHERE
t.delete_date IS NULL
AND t.class_id = 17
) t
LEFT JOIN (
SELECT
t3.class_id,
sum( t3.cnt ) AS ttl
FROM
(
SELECT
t.class_id,
t.member_id,
t.vod_id,
IF
( max( t.play_length )>= t2.vod_length * 0.8, 1, 0 ) AS cnt
FROM
vod_play_history t
LEFT JOIN vod_dict t2 ON t.vod_id = t2.id
WHERE
t.class_id = #{classId}
AND t.delete_date IS NULL
GROUP BY
t.class_id,
t.member_id,
t.vod_id
) t3
) t2 ON t.class_id = t2.class_id
LEFT JOIN (
SELECT
t.id,
count( 1 ) AS total_vods
FROM
class_dict t
LEFT JOIN course_content t2 ON t.course_id = t2.course_id
LEFT JOIN vod_dict t3 ON t2.id = t3.content_id
WHERE
t.delete_date IS NULL
AND t2.delete_date IS NULL
AND t3.delete_date IS NULL
AND t.id = #{classId}
) t3 ON t.class_id = t3.id
LEFT JOIN (
SELECT
t2.class_id,
sum(
IF
( t2.cnt >= t4.paper_cnt, 1, 0 )) AS pass_cnt
FROM
(
SELECT
t2.class_id,
t2.member_id,
sum( t2.cnt ) AS cnt
FROM
(
SELECT
t.paper_id,
t.class_id,
t.member_id,
IF
( max( t.score )>= 60, 1, 0 ) AS cnt
FROM
exercise_done_result t
WHERE
t.class_id = #{classId}
AND t.delete_date IS NULL
GROUP BY
t.paper_id,
t.class_id,
t.member_id
) t2
GROUP BY
t2.class_id,
t2.member_id
) t2
LEFT JOIN class_dict t3 ON t2.class_id = t3.id
LEFT JOIN ( SELECT t.course_id, count( 1 ) AS paper_cnt FROM paper_dict t WHERE t.delete_date IS NULL GROUP BY t.course_id ) t4 ON t3.course_id = t4.course_id
) t4 ON t.class_id = t4.class_id
LEFT JOIN ( SELECT t.class_id, sum( 1 ) AS ask_cnt FROM answering_question t WHERE t.class_id = #{classId} AND t.delete_date IS NULL ) t5 ON t.class_id = t5.class_id
</select>
<select id="memberRecentPlay" resultType="com.subsidy.vo.member.ContentVodNewVO">
SELECT
t2.id,
t1.play_record
FROM
(
SELECT
t.vod_id,
max( t.create_date ) AS create_date,
t.play_record
FROM
vod_play_history t
WHERE
t.member_id = 1
AND t.class_id = 3
) t1
LEFT JOIN vod_dict t2 ON t1.vod_id = t2.id
</select>
<select id="memberStudyLog" resultType="com.subsidy.vo.administer.MemberStudyLogVO">
SELECT
DATE_SUB( t1.create_date, INTERVAL t1.play_length SECOND ) AS startDate,
t1.create_date AS endDate,
t1.vod_name,
'视频学习' AS studyType,
'有课互联系统' as platForm,
t1.play_length,
IF
( t2.total_length &lt;= t1.vod_length, t2.total_length, t1.vod_length ) AS total_length
FROM
(
SELECT
t.vod_id,
t.create_date,
t2.vod_name,
t.play_length,
t2.vod_length
FROM
vod_play_history t
LEFT JOIN vod_dict t2 ON t.vod_id = t2.id
WHERE
t.class_id = #{classId}
AND t.member_id = #{memberId}
) t1
LEFT JOIN (
SELECT
t.vod_id,
sum( t.play_length ) AS total_length
FROM
vod_play_history t
LEFT JOIN vod_dict t2 ON t.vod_id = t2.id
WHERE
t.class_id = #{classId}
AND t.member_id = #{memberId}
GROUP BY
t.vod_id
) t2 ON t1.vod_id = t2.vod_id
ORDER BY
t1.create_date DESC
</select>
</mapper>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!