Commit 38195ce4 by 涂亚平

年前上线版本

1 parent 99eb06b2
......@@ -28,8 +28,8 @@ public class RedisPrefixConstant {
public static final String SUBSIDY_SETTINGS_PREFIX = "subsidySettings:";
/**
* subsidySignInfo_memberId_1_classId_12_20211223_long,do 学生签到数据
* subsidySignInfo:memberId:1:classId:12:20211223:long,do 学生签到数据
*/
public static final String SUBSIDY_SIGN_INFO_PREFIX = "subsidySignInfo:";
public static final String SUBSIDY_SIGN_INFO_PREFIX = "subsidySignInfo:memberId:";
}
......@@ -62,7 +62,7 @@ public class AdministerController {
@PostMapping("/administers")
@ApiOperation("查询所有运营者 { userName pageNum pageSize }")
//@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO operators(@RequestBody OperatorsDTO operatorsDTO){
return ResponseData.generateCreatedResponse(0,administerService.operators(operatorsDTO));
}
......@@ -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);
......@@ -189,7 +189,7 @@ public class AdministerController {
}
@PostMapping("exportClassVodDailyInfo")
@ApiOperation("学习记录---每日学习时长(视频维度)")
@ApiOperation("学习记录---每日学习时长(视频维度) pageSize pageNum userName classId")
public void exportClassVodDailyInfo(@RequestBody ClassVodDailyInfoDTO classVodDailyInfoDTO ){
administerService.exportClassVodDailyInfo(classVodDailyInfoDTO);
}
......
......@@ -3,20 +3,13 @@ package com.subsidy.jobs;
import com.subsidy.mapper.OprAdmDictMapper;
import com.subsidy.mapper.OprMemDictMapper;
import com.subsidy.mapper.VodPlayHistoryMapper;
import com.subsidy.mongodb.OprAdmDictDO;
import com.subsidy.model.OprMemDictDO;
import com.subsidy.model.VodPlayHistoryDO;
import com.subsidy.util.DateFormatUtil;
import com.subsidy.model.OprAdmDictDO;
import com.subsidy.util.RedisUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Set;
/**
* <p>
......
package com.subsidy.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.subsidy.mongodb.OprAdmDictDO;
import com.subsidy.model.OprAdmDictDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.subsidy.vo.opr.GetHistoryVO;
import org.springframework.stereotype.Repository;
......
package com.subsidy.mongodb;
package com.subsidy.model;
import com.subsidy.util.BaseModel;
import com.baomidou.mybatisplus.annotation.TableName;
......@@ -17,9 +17,11 @@ import org.omg.CosNaming.NamingContextExtPackage.StringNameHelper;
* @since 2021-12-13
*/
@Data
public class OprAdmDictDO {
@EqualsAndHashCode(callSuper = true)
@TableName("opr_adm_dict")
public class OprAdmDictDO extends BaseModel{
private String _id;
private Long id;
/**
* 用户id
......@@ -27,16 +29,6 @@ public class OprAdmDictDO {
private Long userId;
/**
* 公司id
*/
private Long companyId;
/**
* 名字
*/
private String userName;
/**
* 操作类型
*/
private String oprType;
......@@ -46,14 +38,5 @@ public class OprAdmDictDO {
*/
private Integer result;
/**
* 登录时间
*/
private String loginDateFormat;
/**
* 创建时间
*/
private String createDate;
}
......@@ -16,9 +16,11 @@ import lombok.EqualsAndHashCode;
* @since 2021-12-13
*/
@Data
public class OprMemDictDO {
@EqualsAndHashCode(callSuper = true)
@TableName("opr_mem_dict")
public class OprMemDictDO extends BaseModel {
private String _id;
private Long id;
/**
* 用户id
......@@ -26,16 +28,6 @@ public class OprMemDictDO {
private Long userId;
/**
* 公司id
*/
private Long companyId;
/**
* 公司名称
*/
private String companyName;
/**
* 操作类型
*/
private String oprType;
......@@ -45,15 +37,4 @@ public class OprMemDictDO {
*/
private Integer result;
/**
* 登录时间
*/
private String loginDateFormat;
/**
* 创建时间
*/
private String createDate;
private String userName;
}
......@@ -2,9 +2,8 @@ package com.subsidy.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.subsidy.dto.opr.GetHistoryDTO;
import com.subsidy.mongodb.OprAdmDictDO;
import com.subsidy.model.OprAdmDictDO;
import com.baomidou.mybatisplus.extension.service.IService;
import com.subsidy.mongodb.PageVO;
import com.subsidy.vo.opr.GetHistoryVO;
/**
......@@ -17,6 +16,7 @@ import com.subsidy.vo.opr.GetHistoryVO;
*/
public interface OprAdmDictService extends IService<OprAdmDictDO> {
PageVO<GetHistoryVO> getHistory(GetHistoryDTO getHistoryDTO);
//PageVO<GetHistoryVO> getHistory(GetHistoryDTO getHistoryDTO);
IPage<GetHistoryVO> getHistory(GetHistoryDTO getHistoryDTO);
}
......@@ -17,6 +17,6 @@ import com.subsidy.vo.opr.GetHistoryVO;
*/
public interface OprMemDictService extends IService<OprMemDictDO> {
PageVO<GetHistoryVO> getHistory(GetHistoryDTO getHistoryDTO);
//PageVO<GetHistoryVO> getHistory(GetHistoryDTO getHistoryDTO);
IPage<GetHistoryVO> getHistory(GetHistoryDTO getHistoryDTO);
}
......@@ -23,6 +23,7 @@ import com.subsidy.mapper.DepartmentDictMapper;
import com.subsidy.mapper.ExerciseDoneResultMapper;
import com.subsidy.mapper.MemberDepartmentMappingMapper;
import com.subsidy.mapper.MemberMapper;
import com.subsidy.mapper.OprAdmDictMapper;
import com.subsidy.mapper.RoleAdministerMappingMapper;
import com.subsidy.mapper.VodDictMapper;
import com.subsidy.mapper.VodPlayHistoryMapper;
......@@ -40,8 +41,7 @@ import com.subsidy.model.MemberDepartmentMappingDO;
import com.subsidy.model.RoleAdministerMappingDO;
import com.subsidy.model.SignInRecordDO;
import com.subsidy.model.VodDictDO;
import com.subsidy.model.VodPlayHistoryDO;
import com.subsidy.mongodb.OprAdmDictDO;
import com.subsidy.model.OprAdmDictDO;
import com.subsidy.service.AdministerService;
import com.subsidy.util.ConstantUtils;
import com.subsidy.util.DateFormatUtil;
......@@ -95,10 +95,6 @@ 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.data.domain.Sort;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -121,10 +117,12 @@ import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
......@@ -181,7 +179,10 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
private RedisUtil redisUtil;
@Autowired
private MongoTemplate mongoTemplate;
private OprAdmDictMapper oprAdmDictMapper;
//@Autowired
//private MongoTemplate mongoTemplate;
public LoginVO login(AdministerDO administerDO) {
......@@ -205,11 +206,9 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
throw new HttpException(10013);
}
/**
* 最近5次都输入失败,5分钟后再验证 待优化
* 最近5次都输入失败,5分钟后再验证
*/
Query query = new Query(Criteria.where("userId").is(1).and("createDate").gte(System.currentTimeMillis() - 5 * 60 * 1000 + ""));//可累加条件
query.with(Sort.by("createDate").descending());
List<OprAdmDictDO> oprAdmDictDOS = mongoTemplate.find(query, OprAdmDictDO.class);
List<OprAdmDictDO> oprAdmDictDOS = oprAdmDictMapper.getLoginInfo(administerDO1.getId());
//查mysql逻辑
//List<OprAdmDictDO> oprAdmDictDOS = oprAdmDictMapper.getLoginInfo(administerDO1.getId());
......@@ -234,12 +233,12 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
oprAdmDictDO.setUserId(administerDO1.getId());
oprAdmDictDO.setOprType("登录");
oprAdmDictDO.setResult(1);
oprAdmDictDO.setCreateDate(System.currentTimeMillis() + "");
oprAdmDictDO.setLoginDateFormat(DateFormatUtil.format(new Date(), "yyyyMMdd"));
oprAdmDictDO.setUserName(administerDO1.getUserName());
oprAdmDictDO.setCompanyId(administerDO1.getCompanyId());
//oprAdmDictMapper.insert(oprAdmDictDO);
mongoTemplate.insert(oprAdmDictDO);
//oprAdmDictDO.setCreateDate(System.currentTimeMillis() + "");
//oprAdmDictDO.setLoginDateFormat(DateFormatUtil.format(new Date(), "yyyyMMdd"));
//oprAdmDictDO.setUserName(administerDO1.getUserName());
//oprAdmDictDO.setCompanyId(administerDO1.getCompanyId());
oprAdmDictMapper.insert(oprAdmDictDO);
//mongoTemplate.insert(oprAdmDictDO);
loginVO.setToken(token);
return loginVO;
} else {
......@@ -248,12 +247,12 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
oprAdmDictDO.setUserId(administerDO1.getId());
oprAdmDictDO.setOprType("登录");
oprAdmDictDO.setResult(0);
//oprAdmDictMapper.insert(oprAdmDictDO);
oprAdmDictDO.setCreateDate(System.currentTimeMillis() + "");
oprAdmDictDO.setLoginDateFormat(DateFormatUtil.format(new Date(), "yyyyMMdd"));
oprAdmDictDO.setUserName(administerDO1.getUserName());
oprAdmDictDO.setCompanyId(administerDO1.getCompanyId());
mongoTemplate.insert(oprAdmDictDO);
oprAdmDictMapper.insert(oprAdmDictDO);
//oprAdmDictDO.setCreateDate(System.currentTimeMillis() + "");
//oprAdmDictDO.setLoginDateFormat(DateFormatUtil.format(new Date(), "yyyyMMdd"));
//oprAdmDictDO.setUserName(administerDO1.getUserName());
//oprAdmDictDO.setCompanyId(administerDO1.getCompanyId());
//mongoTemplate.insert(oprAdmDictDO);
int i = 0;
......@@ -501,7 +500,7 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
.eq(AnsweringQuestionDO::getClassId, classDetailDTO.getId()));
classDetailVO.setAskCounts(count);
//签到次数
long set = redisUtil.scan(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + "memberId:" + classDetailVO.getId() + ":classId:" + classDetailDTO.getId() + "*").stream().count();
long set = redisUtil.scan(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + classDetailVO.getId() + ":classId:" + classDetailDTO.getId() + "*").stream().count();
classDetailVO.setSignCounts(set);
}
......@@ -575,7 +574,7 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
classDetailVO.setAskCounts(count);
//签到次数
long set = redisUtil.scan(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + "memberId:" + classDetailVO.getId() + ":classId:" + classDetailDTO.getId() + "*").stream().count();
long set = redisUtil.scan(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + classDetailVO.getId() + ":classId:" + classDetailDTO.getId() + "*").stream().count();
classDetailVO.setSignCounts(set);
}
......@@ -622,14 +621,25 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
classSignVO.setTrainingLength(playLength);
classSignVO.setTrainingLengthStr(MathUtil.secToTime(playLength));
Set<String> sortSet = new TreeSet<String>(new Comparator<String>() {
@Override
public int compare(String o1, String o2) {
return -o2.compareTo(o1);//降序排列
}
});
//签到
Set<SignInRecordDO> set = redisUtil.scan(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + "memberId:" + classSignVO.getId() + ":classId:" + classDetailDTO.getId() + "*");
Set<String> set = redisUtil.scan(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + classSignVO.getId() + ":classId:" + classDetailDTO.getId() + "*");
classSignVO.setSignCounts(set.size());
StringBuilder stringBuilder = new StringBuilder();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
sortSet.addAll(set);
//签到时间
for (SignInRecordDO signInRecordDO : set) {
stringBuilder.append(signInRecordDO.getSignInDate().toString().replace("T", " ")).append(";");
for (String signInRecordDO : sortSet) {
String[] array = signInRecordDO.split(":");
//时间戳转时间
stringBuilder.append(sdf.format(new Date(Long.valueOf(array[array.length-1])))).append(";");
}
if (StringUtils.isNotBlank(stringBuilder.toString())) {
String signInDate = stringBuilder.toString().substring(0, stringBuilder.length() - 1);
......@@ -673,13 +683,25 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
classSignVO.setTrainingLengthStr(MathUtil.secToTime(playLength));
//签到
Set<SignInRecordDO> set = redisUtil.scan(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + "memberId:" + classSignVO.getId() + ":classId:" + classDetailDTO.getId() + "*");
Set<String> set = redisUtil.scan(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + classSignVO.getId() + ":classId:" + classDetailDTO.getId() + "*");
classSignVO.setSignCounts(set.size());
Set<String> sortSet = new TreeSet<String>(new Comparator<String>() {
@Override
public int compare(String o1, String o2) {
return -o2.compareTo(o1);//降序排列
}
});
sortSet.addAll(set);
StringBuilder stringBuilder = new StringBuilder();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//签到时间
for (SignInRecordDO signInRecordDO : set) {
stringBuilder.append(signInRecordDO.getSignInDate().toString().replace("T", " ")).append(";");
for (String signInRecordDO : sortSet) {
String[] array = signInRecordDO.split(":");
//时间戳转时间
stringBuilder.append(sdf.format(new Date(Long.valueOf(array[array.length-1])))).append(";");
}
if (StringUtils.isNotBlank(stringBuilder.toString())) {
String signInDate = stringBuilder.toString().substring(0, stringBuilder.length() - 1);
......@@ -880,6 +902,7 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
}
writeExcel(memberIds, hashMap, title);
}
public IPage<ClassDailyInfoVO> classVodDailyInfo(ClassVodDailyInfoDTO classVodDailyInfoDTO) {
......@@ -893,12 +916,12 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
List<ClassDailyInfoVO> classDailyInfoVOS = classDailyInfoVOIPage.getRecords();
//获取班级、每个学员维度的视频播放总时长
List<VodPlayHistoryDO> vodPlayHistoryDOS = vodPlayHistoryMapper.classMemberPlayLength(classVodDailyInfoDTO.getClassId());
List<ClassMemberPlayLengthVO> vodPlayHistoryDOS = vodPlayHistoryMapper.classMemberPlayLength(classVodDailyInfoDTO.getClassId());
HashMap<String, Integer> hashMap = new HashMap<>();
//存在一个map里
for (VodPlayHistoryDO vodPlayHistoryDO : vodPlayHistoryDOS) {
for (ClassMemberPlayLengthVO vodPlayHistoryDO : vodPlayHistoryDOS) {
hashMap.put(vodPlayHistoryDO.getMemberId() + "-" + vodPlayHistoryDO.getVodId(), vodPlayHistoryDO.getPlayLength());
}
......@@ -907,22 +930,30 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
List<VodDictDO> vodDictDOS = vodDictMapper.getCourseVods(classDictDO.getCourseId(), null);
for (ClassDailyInfoVO classDailyInfoVO : classDailyInfoVOS) {
//查看某个视频的完成情况
//查看这个人某个视频的长度
int total = 0;
List<ClassVodDailyInfoItemVO> classVodDailyInfoItemVOS = new ArrayList<>();
for (VodDictDO vodDictDO : vodDictDOS) {
int playLength = hashMap.get(classDailyInfoVO.getId() + "-" + vodDictDO.getId());
Integer playLength = hashMap.get(classDailyInfoVO.getId() + "-" + vodDictDO.getId());
ClassVodDailyInfoItemVO classVodDailyInfoItemVO = new ClassVodDailyInfoItemVO();
classVodDailyInfoItemVO.setPlayLength(playLength);
classVodDailyInfoItemVOS.add(classVodDailyInfoItemVO);
if (playLength>vodDictDO.getVodLength()){
total ++;
classVodDailyInfoItemVO.setVodId(vodDictDO.getId());
classVodDailyInfoItemVO.setVodName(vodDictDO.getVodName());
if (null != playLength) {
classVodDailyInfoItemVO.setPlayLength(playLength);
classVodDailyInfoItemVOS.add(classVodDailyInfoItemVO);
if (playLength >= vodDictDO.getVodLength()) {
total++;
}
} else {
classVodDailyInfoItemVO.setPlayLength(0);
classVodDailyInfoItemVOS.add(classVodDailyInfoItemVO);
}
}
classDailyInfoVO.setTotal(MathUtil.intDivFloorPercent(total,vodDictDOS.size()));
classDailyInfoVO.setTotal(MathUtil.intDivFloorPercent(total, vodDictDOS.size()));
classDailyInfoVO.setClassVodDailyInfoItemVOS(classVodDailyInfoItemVOS);
}
return classDailyInfoVOIPage;
}
public void exportClassVodDailyInfo(ClassVodDailyInfoDTO classVodDailyInfoDTO){
......@@ -966,6 +997,76 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
}
public <T> void writeVodExcel(List<ClassDailyInfoVO> classDailyInfoVOS, HashMap<String, Integer> hashMap, List<String> title, HashMap<String, Integer> vodHashmap) {
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();
title.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) {
classDailyInfoVOS.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);
Cell namecell = r.createCell(a.getAndIncrement());
namecell.setCellValue(data.getUserName());
Cell totalCell = r.createCell(a.getAndIncrement());
Integer total = 0;
for (String tt : title) {
if (!"姓名".equals(tt) && !"合计完成率".equals(tt)) {
Cell cell1 = r.createCell(a.getAndIncrement());
if (null != hashMap) {
Integer playLength = hashMap.get(data.getId() + "-" + tt);
if (null != playLength) {
cell1.setCellValue(MathUtil.secToTime(playLength));
if (vodHashmap.get(tt) <= playLength) {
total++;
}
} else {
cell1.setCellValue("00:00:00");
}
}
}
}
totalCell.setCellValue(MathUtil.intDivFloorPercent(total, vodHashmap.keySet().size()) + "%");
});
}
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);
}
}
/**
* 导出excel文件
*/
......@@ -1003,7 +1104,7 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
namecell.setCellValue(memberMapper.selectById(data).getUserName());
int total = 0;
for (String date : dates) {
if (!date.equals("姓名") && !"合计完成率".equals(date)) {
if (!date.equals("姓名") && !"合计总时长".equals(date)) {
Cell cell1 = r.createCell(a.getAndIncrement());
if (null != hashMap1) {
total += null == hashMap1.get(date) ? 0 : hashMap1.get(date);
......@@ -1027,6 +1128,7 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
} catch (IOException e) {
log.error(String.format("downLoad excel exception"), e);
}
}
//JAVA 获取时间段内的每一天
......
......@@ -22,6 +22,7 @@ import com.subsidy.mapper.ExerciseDoneResultMapper;
import com.subsidy.mapper.FileDictMapper;
import com.subsidy.mapper.MemberDepartmentMappingMapper;
import com.subsidy.mapper.MemberMapper;
import com.subsidy.mapper.OprMemDictMapper;
import com.subsidy.mapper.PaperDictMapper;
import com.subsidy.mapper.VodPlayHistoryMapper;
import com.subsidy.model.ClassDictDO;
......@@ -118,6 +119,9 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
@Autowired
private CompanyDictMapper companyDictMapper;
@Autowired
private OprMemDictMapper oprMemDictMapper;
public IPage<GetAllVO> getAll(GetAllDTO getAllDTO) {
Page pager = new Page(getAllDTO.getPageNum(), getAllDTO.getPageSize());
IPage iPage = this.baseMapper.getMembers(pager, getAllDTO.getDepartmentId(), getAllDTO.getUserName(), getAllDTO.getStatus());
......@@ -247,12 +251,13 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
oprMemDictDO.setUserId(memberDO.getId());
oprMemDictDO.setOprType("登录");
oprMemDictDO.setResult(0);
oprMemDictDO.setUserName(memberDO.getUserName());
oprMemDictDO.setCreateDate(System.currentTimeMillis() + "");
oprMemDictDO.setLoginDateFormat(DateFormatUtil.format(new Date(), "yyyyMMdd"));
oprMemDictDO.setCompanyId(companyDictDO.getId());
oprMemDictDO.setCompanyName(companyDictDO.getCompanyName());
mongoTemplate.insert(oprMemDictDO);
//oprMemDictDO.setUserName(memberDO.getUserName());
//oprMemDictDO.setCreateDate(System.currentTimeMillis() + "");
//oprMemDictDO.setLoginDateFormat(DateFormatUtil.format(new Date(), "yyyyMMdd"));
//oprMemDictDO.setCompanyId(companyDictDO.getId());
//oprMemDictDO.setCompanyName(companyDictDO.getCompanyName());
//mongoTemplate.insert(oprMemDictDO);
oprMemDictMapper.insert(oprMemDictDO);
//redisUtil.set(RedisPrefixConstant.SUBSIDY_MEMBER_LOGIN_PREFIX + memberDO.getId() + ":" + memberDO.getUserName() + ":" + companyDictDO.getCompanyName() + ":" + LocalDateTime.now(), oprMemDictDO);
throw new HttpException(10013);
}
......@@ -272,25 +277,27 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
oprMemDictDO.setUserId(memberDO.getId());
oprMemDictDO.setOprType("登录");
oprMemDictDO.setResult(0);
oprMemDictDO.setUserName(memberDO.getUserName());
oprMemDictDO.setCreateDate(System.currentTimeMillis() + "");
oprMemDictDO.setLoginDateFormat(DateFormatUtil.format(new Date(), "yyyyMMdd"));
oprMemDictDO.setCompanyId(companyDictDO.getId());
oprMemDictDO.setCompanyName(companyDictDO.getCompanyName());
mongoTemplate.insert(oprMemDictDO);
//oprMemDictDO.setUserName(memberDO.getUserName());
//oprMemDictDO.setCreateDate(System.currentTimeMillis() + "");
//oprMemDictDO.setLoginDateFormat(DateFormatUtil.format(new Date(), "yyyyMMdd"));
//oprMemDictDO.setCompanyId(companyDictDO.getId());
//oprMemDictDO.setCompanyName(companyDictDO.getCompanyName());
//mongoTemplate.insert(oprMemDictDO);
oprMemDictMapper.insert(oprMemDictDO);
throw new HttpException(70010);
}
//审计日志
OprMemDictDO oprMemDictDO = new OprMemDictDO();
oprMemDictDO.setUserId(memberDO.getId());
oprMemDictDO.setOprType("登录");
oprMemDictDO.setUserName(memberDO.getUserName());
//oprMemDictDO.setUserName(memberDO.getUserName());
oprMemDictDO.setResult(1);
oprMemDictDO.setCreateDate(System.currentTimeMillis() + "");
oprMemDictDO.setLoginDateFormat(DateFormatUtil.format(new Date(), "yyyyMMdd"));
oprMemDictDO.setCompanyId(companyDictDO.getId());
oprMemDictDO.setCompanyName(companyDictDO.getCompanyName());
mongoTemplate.insert(oprMemDictDO);
//oprMemDictDO.setCreateDate(System.currentTimeMillis() + "");
//oprMemDictDO.setLoginDateFormat(DateFormatUtil.format(new Date(), "yyyyMMdd"));
//oprMemDictDO.setCompanyId(companyDictDO.getId());
//oprMemDictDO.setCompanyName(companyDictDO.getCompanyName());
oprMemDictMapper.insert(oprMemDictDO);
//mongoTemplate.insert(oprMemDictDO);
return userRoleVO;
}
......@@ -322,12 +329,13 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
oprMemDictDO.setUserId(memberDO.getId());
oprMemDictDO.setOprType("登录");
oprMemDictDO.setResult(1);
oprMemDictDO.setUserName(memberDO.getUserName());
oprMemDictDO.setCreateDate(System.currentTimeMillis() + "");
oprMemDictDO.setLoginDateFormat(DateFormatUtil.format(new Date(), "yyyyMMdd"));
oprMemDictDO.setCompanyId(companyDictDO.getId());
oprMemDictDO.setCompanyName(companyDictDO.getCompanyName());
mongoTemplate.insert(oprMemDictDO);
//oprMemDictDO.setUserName(memberDO.getUserName());
//oprMemDictDO.setCreateDate(System.currentTimeMillis() + "");
//oprMemDictDO.setLoginDateFormat(DateFormatUtil.format(new Date(), "yyyyMMdd"));
//oprMemDictDO.setCompanyId(companyDictDO.getId());
//oprMemDictDO.setCompanyName(companyDictDO.getCompanyName());
//mongoTemplate.insert(oprMemDictDO);
oprMemDictMapper.insert(oprMemDictDO);
//redisUtil.set(RedisPrefixConstant.SUBSIDY_MEMBER_LOGIN_PREFIX + memberDO.getId() + ":" + System.currentTimeMillis(), 1);
return memberVO;
} else {
......@@ -336,12 +344,13 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
oprMemDictDO.setUserId(memberDO.getId());
oprMemDictDO.setOprType("登录");
oprMemDictDO.setResult(0);
oprMemDictDO.setUserName(memberDO.getUserName());
oprMemDictDO.setCreateDate(System.currentTimeMillis() + "");
oprMemDictDO.setLoginDateFormat(DateFormatUtil.format(new Date(), "yyyyMMdd"));
oprMemDictDO.setCompanyName(companyDictDO.getCompanyName());
oprMemDictDO.setCompanyId(companyDictDO.getId());
mongoTemplate.insert(oprMemDictDO);
//oprMemDictDO.setUserName(memberDO.getUserName());
//oprMemDictDO.setCreateDate(System.currentTimeMillis() + "");
//oprMemDictDO.setLoginDateFormat(DateFormatUtil.format(new Date(), "yyyyMMdd"));
//oprMemDictDO.setCompanyName(companyDictDO.getCompanyName());
//oprMemDictDO.setCompanyId(companyDictDO.getId());
//mongoTemplate.insert(oprMemDictDO);
oprMemDictMapper.insert(oprMemDictDO);
//redisUtil.set(RedisPrefixConstant.SUBSIDY_MEMBER_LOGIN_PREFIX + memberDO.getId() + ":" + System.currentTimeMillis(), oprMemDictDO);
throw new HttpException(10016);
}
......@@ -350,12 +359,13 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
oprMemDictDO.setUserId(memberDO.getId());
oprMemDictDO.setOprType("登录");
oprMemDictDO.setResult(0);
oprMemDictDO.setUserName(memberDO.getUserName());
oprMemDictDO.setCreateDate(System.currentTimeMillis() + "");
oprMemDictDO.setLoginDateFormat(DateFormatUtil.format(new Date(), "yyyyMMdd"));
oprMemDictDO.setCompanyName(companyDictDO.getCompanyName());
oprMemDictDO.setCompanyId(companyDictDO.getId());
mongoTemplate.insert(oprMemDictDO);
//oprMemDictDO.setUserName(memberDO.getUserName());
//oprMemDictDO.setCreateDate(System.currentTimeMillis() + "");
//oprMemDictDO.setLoginDateFormat(DateFormatUtil.format(new Date(), "yyyyMMdd"));
//oprMemDictDO.setCompanyName(companyDictDO.getCompanyName());
//oprMemDictDO.setCompanyId(companyDictDO.getId());
//mongoTemplate.insert(oprMemDictDO);
oprMemDictMapper.insert(oprMemDictDO);
//redisUtil.set(RedisPrefixConstant.SUBSIDY_MEMBER_LOGIN_PREFIX + memberDO.getId() + ":" + System.currentTimeMillis(), 0);
throw new HttpException(10015);
}
......
......@@ -3,27 +3,13 @@ package com.subsidy.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.subsidy.dto.opr.GetHistoryDTO;
import com.subsidy.mapper.AdministerMapper;
import com.subsidy.mapper.CompanyDictMapper;
import com.subsidy.model.AdministerDO;
import com.subsidy.model.CompanyDictDO;
import com.subsidy.mongodb.OprAdmDictDO;
import com.subsidy.model.OprAdmDictDO;
import com.subsidy.mapper.OprAdmDictMapper;
import com.subsidy.mongodb.PageVO;
import com.subsidy.service.OprAdmDictService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.util.MongoUtil;
import com.subsidy.vo.opr.GetHistoryVO;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
* <p>
* 审计表 服务实现类
......@@ -35,44 +21,38 @@ import java.util.List;
@Service
public class OprAdmDictServiceImpl extends ServiceImpl<OprAdmDictMapper, OprAdmDictDO> implements OprAdmDictService {
@Autowired
private MongoTemplate mongoTemplate;
@Autowired
private MongoUtil mongoUtil;
@Autowired
private AdministerMapper administerMapper;
@Autowired
private CompanyDictMapper companyDictMapper;
public PageVO<GetHistoryVO> getHistory(GetHistoryDTO getHistoryDTO){
PageVO pageVO = new PageVO();
List<GetHistoryVO> getHistoryVOS = new ArrayList<>();
//可累加条件
Query query = new Query(Criteria.where("userName").regex(getHistoryDTO.getUserName())
.andOperator(Criteria.where("loginDateFormat").gte(getHistoryDTO.getStartDate()),
Criteria.where("loginDateFormat").lte(getHistoryDTO.getEndDate())));
Long count = mongoTemplate.count(query,OprAdmDictDO.class);
mongoUtil.start(getHistoryDTO.getPageNum(),getHistoryDTO.getPageSize(),query);
List<OprAdmDictDO> oprAdmDictDOS = mongoTemplate.find(query,OprAdmDictDO.class);
for (OprAdmDictDO oprAdmDictDO : oprAdmDictDOS){
AdministerDO administerDO = administerMapper.selectById(oprAdmDictDO.getUserId());
CompanyDictDO companyDictDO = companyDictMapper.selectById(administerDO.getCompanyId());
GetHistoryVO getHistoryVO = new GetHistoryVO();
BeanUtils.copyProperties(oprAdmDictDO,getHistoryVO);
getHistoryVO.setCompanyName(companyDictDO.getCompanyName());
getHistoryVO.setUserName(administerDO.getUserName());
getHistoryVOS.add(getHistoryVO);
}
pageVO.setRecords(getHistoryVOS);
pageVO.setTotal(count);
return pageVO;
//public PageVO<GetHistoryVO> getHistory(GetHistoryDTO getHistoryDTO){
//
// PageVO pageVO = new PageVO();
//
// List<GetHistoryVO> getHistoryVOS = new ArrayList<>();
//
// //可累加条件
// Query query = new Query(Criteria.where("userName").regex(getHistoryDTO.getUserName())
// .andOperator(Criteria.where("loginDateFormat").gte(getHistoryDTO.getStartDate()),
// Criteria.where("loginDateFormat").lte(getHistoryDTO.getEndDate())));
// Long count = mongoTemplate.count(query,OprAdmDictDO.class);
// mongoUtil.start(getHistoryDTO.getPageNum(),getHistoryDTO.getPageSize(),query);
// List<OprAdmDictDO> oprAdmDictDOS = mongoTemplate.find(query,OprAdmDictDO.class);
// for (OprAdmDictDO oprAdmDictDO : oprAdmDictDOS){
// AdministerDO administerDO = administerMapper.selectById(oprAdmDictDO.getUserId());
// CompanyDictDO companyDictDO = companyDictMapper.selectById(administerDO.getCompanyId());
// GetHistoryVO getHistoryVO = new GetHistoryVO();
// BeanUtils.copyProperties(oprAdmDictDO,getHistoryVO);
// getHistoryVO.setCompanyName(companyDictDO.getCompanyName());
// getHistoryVO.setUserName(administerDO.getUserName());
// getHistoryVOS.add(getHistoryVO);
// }
// pageVO.setRecords(getHistoryVOS);
// pageVO.setTotal(count);
//
// return pageVO;
//}
public IPage<GetHistoryVO> getHistory(GetHistoryDTO getHistoryDTO){
Page pager = new Page(getHistoryDTO.getPageNum(), getHistoryDTO.getPageSize());
return this.baseMapper.getHistory(pager,getHistoryDTO.getUserName(),getHistoryDTO.getStartDate(),getHistoryDTO.getEndDate());
}
}
......@@ -5,27 +5,16 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.subsidy.dto.opr.GetHistoryDTO;
import com.subsidy.mapper.CompanyDictMapper;
import com.subsidy.mapper.MemberMapper;
import com.subsidy.model.AdministerDO;
import com.subsidy.model.CompanyDictDO;
import com.subsidy.model.MemberDO;
import com.subsidy.model.OprMemDictDO;
import com.subsidy.mapper.OprMemDictMapper;
import com.subsidy.mongodb.OprAdmDictDO;
import com.subsidy.mongodb.PageVO;
import com.subsidy.service.OprMemDictService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.util.MongoUtil;
import com.subsidy.vo.opr.GetHistoryVO;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
* <p>
* 审计表 服务实现类
......@@ -49,33 +38,37 @@ public class OprMemDictServiceImpl extends ServiceImpl<OprMemDictMapper, OprMemD
@Autowired
private CompanyDictMapper companyDictMapper;
public PageVO<GetHistoryVO> getHistory(GetHistoryDTO getHistoryDTO) {
PageVO pageVO = new PageVO();
List<GetHistoryVO> getHistoryVOS = new ArrayList<>();
//public PageVO<GetHistoryVO> getHistory(GetHistoryDTO getHistoryDTO) {
//
// PageVO pageVO = new PageVO();
//
// List<GetHistoryVO> getHistoryVOS = new ArrayList<>();
//
// //可累加条件
// Query query = new Query(Criteria.where("userName").regex(getHistoryDTO.getUserName())
// .andOperator(Criteria.where("loginDateFormat").gte(getHistoryDTO.getStartDate()),
// Criteria.where("loginDateFormat").lte(getHistoryDTO.getEndDate())));
// Long count = mongoTemplate.count(query, OprMemDictDO.class);
// mongoUtil.start(getHistoryDTO.getPageNum(), getHistoryDTO.getPageSize(), query);
// List<OprMemDictDO> oprMemDictDOS = mongoTemplate.find(query, OprMemDictDO.class);
// for (OprMemDictDO oprMemDictDO : oprMemDictDOS) {
// MemberDO memberDO = memberMapper.selectById(oprMemDictDO.getUserId());
// CompanyDictDO companyDictDO = companyDictMapper.selectById(memberDO.getCompanyId());
// GetHistoryVO getHistoryVO = new GetHistoryVO();
// BeanUtils.copyProperties(oprMemDictDO, getHistoryVO);
// getHistoryVO.setCompanyName(companyDictDO.getCompanyName());
// getHistoryVO.setUserName(memberDO.getUserName());
// getHistoryVOS.add(getHistoryVO);
// }
// pageVO.setRecords(getHistoryVOS);
// pageVO.setTotal(count);
//
// return pageVO;
//}
//可累加条件
Query query = new Query(Criteria.where("userName").regex(getHistoryDTO.getUserName())
.andOperator(Criteria.where("loginDateFormat").gte(getHistoryDTO.getStartDate()),
Criteria.where("loginDateFormat").lte(getHistoryDTO.getEndDate())));
Long count = mongoTemplate.count(query, OprMemDictDO.class);
mongoUtil.start(getHistoryDTO.getPageNum(), getHistoryDTO.getPageSize(), query);
List<OprMemDictDO> oprMemDictDOS = mongoTemplate.find(query, OprMemDictDO.class);
for (OprMemDictDO oprMemDictDO : oprMemDictDOS) {
MemberDO memberDO = memberMapper.selectById(oprMemDictDO.getUserId());
CompanyDictDO companyDictDO = companyDictMapper.selectById(memberDO.getCompanyId());
GetHistoryVO getHistoryVO = new GetHistoryVO();
BeanUtils.copyProperties(oprMemDictDO, getHistoryVO);
getHistoryVO.setCompanyName(companyDictDO.getCompanyName());
getHistoryVO.setUserName(memberDO.getUserName());
getHistoryVOS.add(getHistoryVO);
}
pageVO.setRecords(getHistoryVOS);
pageVO.setTotal(count);
return pageVO;
public IPage<GetHistoryVO> getHistory(GetHistoryDTO getHistoryDTO){
Page pager = new Page(getHistoryDTO.getPageNum(), getHistoryDTO.getPageSize());
return this.baseMapper.getHistory(pager,getHistoryDTO.getUserName(),getHistoryDTO.getStartDate(),getHistoryDTO.getEndDate());
}
}
......@@ -29,6 +29,9 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.util.Date;
import java.util.List;
import java.util.concurrent.ExecutorService;
......@@ -59,6 +62,9 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig
@Autowired
private ClassHourDictMapper classHourDictMapper;
@Autowired
private SignInRecordMapper signInRecordMapper;
public IPage<GetMemberSignInfoVO> getMemberSignInfo(GetMemberSignInfoDTO getMemberSignInfoDTO) {
Page pager = new Page(getMemberSignInfoDTO.getPageNum(), getMemberSignInfoDTO.getPageSize());
......@@ -75,7 +81,7 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig
List<ClassDictDO> classDictDOS = classMemberMappingMapper.getMemberClass(signInRecordDO.getMemberId());
for (ClassDictDO classDictDO : classDictDOS) {
redisUtil.set(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + "memberId:" + signInRecordDO.getMemberId() + ":classId:" + classDictDO.getId() + ":" + DateFormatUtil.format(new Date(), "yyyyMMdd") + ":" + System.currentTimeMillis(), null);
redisUtil.set(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + signInRecordDO.getMemberId() + ":classId:" + classDictDO.getId() + ":" + DateFormatUtil.format(new Date(), "yyyyMMdd") + ":" + System.currentTimeMillis(), null);
}
return ConstantUtils.ADD_SUCCESS;
......@@ -110,7 +116,7 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig
signInStatusVO.setStatus(flag);
//获取有效课程
long count = classMemberMappingMapper.getMemberClassCount(signInRecordDO.getMemberId());
long size = redisUtil.scan(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + "memberId:" + signInRecordDO.getMemberId() + "*:" + DateFormatUtil.format(new Date(), "yyyyMMdd")+"*").stream().count();
long size = redisUtil.scan(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + signInRecordDO.getMemberId() + "*:" + DateFormatUtil.format(new Date(), "yyyyMMdd")+"*").stream().count();
if (size != count) {
signInStatusVO.setStatus(false);
......@@ -128,16 +134,25 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig
//}
//预写公司设置数据
List<ClassHourDictDO> classHourDictDOS = classHourDictMapper.selectList(null);
for (ClassHourDictDO classHourDictDO : classHourDictDOS) {
redisUtil.set("subsidySettings:"+ classHourDictDO.getCompanyId(), classHourDictDO);
}
//List<ClassHourDictDO> classHourDictDOS = classHourDictMapper.selectList(null);
//for (ClassHourDictDO classHourDictDO : classHourDictDOS) {
// redisUtil.set("subsidySettings:"+ classHourDictDO.getCompanyId(), classHourDictDO);
//}
//预写学生账号数据
//List<MemberDO> memberDOS = memberMapper.selectList(null);
//for (MemberDO memberDO : memberDOS){
// redisUtil.set(RedisPrefixConstant.SUBSIDY_COMPANY_MEMBER_PREFIX+memberDO.getCompanyId()+":"+memberDO.getAccountName(),memberDO);
//}
//签到数据
List<SignInRecordDO> signInRecordDOS = signInRecordMapper.selectList(null);
for (SignInRecordDO signInRecordDO : signInRecordDOS){
redisUtil.set(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX+signInRecordDO.getMemberId()+":classId:"+
signInRecordDO.getClassId()+":"+signInRecordDO.getSignInDate().toString().split("T")[0]+":"+signInRecordDO.getSignInDate().toInstant(ZoneOffset.of("+8")).toEpochMilli(),signInRecordDO);
}
}
}
......@@ -5,7 +5,7 @@ import lombok.Data;
@Data
public class ClassVodDailyInfoItemVO {
private Integer vodId;
private Long vodId;
private String vodName;
......
......@@ -34,12 +34,19 @@ mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
#spring.redis.lettuce.pool.max-active=32
#spring.redis.lettuce.pool.min-idle=8
spring.application.name=spring-boot-mongodb
# mongodb
#spring.data.mongodb.uri=mongodb://47.97.19.66:27017/subsidy
spring.data.mongodb.username=root
spring.data.mongodb.password=123456
#spring.data.mongodb.authentication-database=subsidy
spring.data.mongodb.database=subsidy
spring.data.mongodb.host=47.97.19.66
spring.data.mongodb.port=27017
#spring.application.name=spring-boot-mongodb
## mongodb
##spring.data.mongodb.uri=mongodb://47.97.19.66:27017/subsidy
#spring.data.mongodb.username=root
#spring.data.mongodb.password=123456
##spring.data.mongodb.authentication-database=subsidy
#spring.data.mongodb.database=subsidy
#spring.data.mongodb.host=47.97.19.66
#spring.data.mongodb.port=27017
spring.redis.host=47.97.19.66
spring.redis.password=Ykhl@208
spring.redis.port=6389
spring.redis.lettuce.pool.max-idle=16
spring.redis.lettuce.pool.max-active=32
spring.redis.lettuce.pool.min-idle=8
\ No newline at end of file
......@@ -32,8 +32,15 @@ spring.servlet.multipart.max-request-size=4098KB
#wechat.msgUrl= https://teachai.youkehulian.com/login
#wechat.templateId= Z1HNPLOrKiHEjfR1KMP-cC-uH3BWqDJIHv365Ev20yQ
spring.redis.cluster.nodes=47.97.19.66:6377,47.97.19.66:6378,47.97.16.66:6379
spring.redis.password=Ykhl@208
#spring.redis.cluster.nodes=47.97.19.66:6377,47.97.19.66:6378,47.97.16.66:6379
#spring.redis.password=Ykhl@208
#spring.redis.lettuce.pool.max-idle=16
#spring.redis.lettuce.pool.max-active=32
#spring.redis.lettuce.pool.min-idle=8
spring.redis.host=r-uf6pdbuxqgy0ztfmn1pd.redis.rds.aliyuncs.com
spring.redis.password=r-uf6pdbuxqgy0ztfmn1:Ykhl@208
spring.redis.port=6379
spring.redis.lettuce.pool.max-idle=16
spring.redis.lettuce.pool.max-active=32
spring.redis.lettuce.pool.min-idle=8
\ No newline at end of file
# 环境配置
spring.profiles.active=dev
spring.profiles.active=prod
# 端口号
spring.server.port=23457
spring.server.port=23459
#嵌入tomcat配置
#和CPU数
spring.server.acceptorThreadCount=600
......@@ -68,9 +68,3 @@ spring.quartz.overwrite-existing-jobs=false
#spring.redis.port=6379
#spring.redis.password=r-uf6m4cpkjrgpzywjm3:Ykhl@208
spring.redis.host=47.97.19.66
spring.redis.password=Ykhl@208
spring.redis.port=6389
spring.redis.lettuce.pool.max-idle=16
spring.redis.lettuce.pool.max-active=32
spring.redis.lettuce.pool.min-idle=8
\ No newline at end of file
......@@ -3,7 +3,7 @@
<mapper namespace="com.subsidy.mapper.OprAdmDictMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.subsidy.mongodb.OprAdmDictDO">
<resultMap id="BaseResultMap" type="com.subsidy.model.OprAdmDictDO">
<id column="id" property="id" />
<result column="create_date" property="createDate" />
<result column="update_date" property="updateDate" />
......@@ -50,7 +50,7 @@
t.create_date DESC
</select>
<select id="getLoginInfo" parameterType="long" resultType="com.subsidy.mongodb.OprAdmDictDO">
<select id="getLoginInfo" parameterType="long" resultType="com.subsidy.model.OprAdmDictDO">
SELECT
*
FROM
......@@ -68,7 +68,7 @@
LIMIT 5)t2
</select>
<select id="getRecordByDate" resultType="com.subsidy.mongodb.OprAdmDictDO">
<select id="getRecordByDate" resultType="com.subsidy.model.OprAdmDictDO">
SELECT
*
FROM
......
......@@ -130,102 +130,105 @@
</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 = #{classId}
) t
LEFT JOIN (
SELECT
t3.class_id,
sum( t3.cnt ) AS ttl
FROM
(
SELECT
t.class_id,
t.member_id,
t.vod_id,
IF
( sum( t.play_length )>= t2.vod_length, 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
t10.mem_cnt AS memberCount,
ifnull( floor( t2.ttl / t10.mem_cnt ), 0 ) AS studyVodCounts,
ifnull( t3.total_vods, 0 ) AS totalVodCounts,
ifnull( avg_playlength, 0 ) AS avgVodPlayLength,
ifnull( floor( t4.pass_cnt * 100 / t10.mem_cnt ), 0 ) AS passRate,
ifnull( t5.ask_cnt, 0 ) AS answerCount
FROM
( SELECT t.class_id, count( 1 ) AS mem_cnt FROM class_member_mapping t WHERE t.delete_date IS NULL AND t.class_id = #{classId} ) t10
LEFT JOIN (
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 = #{classId}
) t ON t.class_id = t10.class_id
LEFT JOIN (
SELECT
t3.class_id,
sum( t3.cnt ) AS ttl
FROM
(
SELECT
t.class_id,
t.member_id,
t.vod_id,
IF
( sum( t.play_length )>= t2.vod_length, 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">
......@@ -321,15 +324,20 @@
SELECT
t.member_id,
t.vod_id,
t3.vod_name,
sum( t.play_length ) AS play_length
FROM
vod_play_history t
LEFT JOIN class_member_mapping t2 ON t.member_id = t2.id
left join vod_dict t3 on t.vod_id = t3.id
WHERE
t.delete_date IS NULL
AND t.class_id = #{classId}
GROUP BY
t.class_id,
t.member_id
t.member_id,
t.vod_id,
t3.vod_name
</select>
</mapper>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!