Commit 38195ce4 by 涂亚平

年前上线版本

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