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);
} }
...@@ -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;
...@@ -59,6 +62,9 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig ...@@ -59,6 +62,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,102 +130,105 @@ ...@@ -130,102 +130,105 @@
</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
mem_cnt AS memberCount, SELECT
floor( t2.ttl / mem_cnt ) AS studyVodCounts, t10.mem_cnt AS memberCount,
t3.total_vods AS totalVodCounts, ifnull( floor( t2.ttl / t10.mem_cnt ), 0 ) AS studyVodCounts,
avg_playlength AS avgVodPlayLength, ifnull( t3.total_vods, 0 ) AS totalVodCounts,
floor( t4.pass_cnt * 100 / mem_cnt ) AS passRate, ifnull( avg_playlength, 0 ) AS avgVodPlayLength,
t5.ask_cnt AS answerCount ifnull( floor( t4.pass_cnt * 100 / t10.mem_cnt ), 0 ) AS passRate,
FROM ifnull( t5.ask_cnt, 0 ) AS answerCount
( FROM
SELECT ( 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
t.class_id, LEFT JOIN (
count( SELECT
DISTINCT ( t.member_id )) AS mem_cnt, t.class_id,
round( sum( t.play_length )/ count( DISTINCT ( t.member_id )), 0 ) AS avg_playlength count(
FROM DISTINCT ( t.member_id )) AS mem_cnt,
vod_play_history t round( sum( t.play_length )/ count( DISTINCT ( t.member_id )), 0 ) AS avg_playlength
WHERE FROM
t.delete_date IS NULL vod_play_history t
AND t.class_id = #{classId} WHERE
) t t.delete_date IS NULL
LEFT JOIN ( AND t.class_id = #{classId}
SELECT ) t ON t.class_id = t10.class_id
t3.class_id, LEFT JOIN (
sum( t3.cnt ) AS ttl SELECT
FROM t3.class_id,
( sum( t3.cnt ) AS ttl
SELECT FROM
t.class_id, (
t.member_id, SELECT
t.vod_id, t.class_id,
IF t.member_id,
( sum( t.play_length )>= t2.vod_length, 1, 0 ) AS cnt t.vod_id,
FROM IF
vod_play_history t ( sum( t.play_length )>= t2.vod_length, 1, 0 ) AS cnt
LEFT JOIN vod_dict t2 ON t.vod_id = t2.id FROM
WHERE vod_play_history t
t.class_id = #{classId} LEFT JOIN vod_dict t2 ON t.vod_id = t2.id
AND t.delete_date IS NULL WHERE
GROUP BY t.class_id = #{classId}
t.class_id, AND t.delete_date IS NULL
t.member_id, GROUP BY
t.vod_id t.class_id,
) t3 t.member_id,
) t2 ON t.class_id = t2.class_id t.vod_id
LEFT JOIN ( ) t3
SELECT ) t2 ON t.class_id = t2.class_id
t.id, LEFT JOIN (
count( 1 ) AS total_vods SELECT
FROM t.id,
class_dict t count( 1 ) AS total_vods
LEFT JOIN course_content t2 ON t.course_id = t2.course_id FROM
LEFT JOIN vod_dict t3 ON t2.id = t3.content_id class_dict t
WHERE LEFT JOIN course_content t2 ON t.course_id = t2.course_id
t.delete_date IS NULL LEFT JOIN vod_dict t3 ON t2.id = t3.content_id
AND t2.delete_date IS NULL WHERE
AND t3.delete_date IS NULL t.delete_date IS NULL
AND t.id = #{classId} AND t2.delete_date IS NULL
) t3 ON t.class_id = t3.id AND t3.delete_date IS NULL
LEFT JOIN ( AND t.id = #{classId}
SELECT ) t3 ON t.class_id = t3.id
t2.class_id, LEFT JOIN (
sum( SELECT
IF t2.class_id,
( t2.cnt >= t4.paper_cnt, 1, 0 )) AS pass_cnt sum(
FROM IF
( ( t2.cnt >= t4.paper_cnt, 1, 0 )) AS pass_cnt
SELECT FROM
t2.class_id, (
t2.member_id, SELECT
sum( t2.cnt ) AS cnt t2.class_id,
FROM t2.member_id,
( sum( t2.cnt ) AS cnt
SELECT FROM
t.paper_id, (
t.class_id, SELECT
t.member_id, t.paper_id,
IF t.class_id,
( max( t.score )>= 60, 1, 0 ) AS cnt t.member_id,
FROM IF
exercise_done_result t ( max( t.score )>= 60, 1, 0 ) AS cnt
WHERE FROM
t.class_id = #{classId} exercise_done_result t
AND t.delete_date IS NULL WHERE
GROUP BY t.class_id = #{classId}
t.paper_id, AND t.delete_date IS NULL
t.class_id, GROUP BY
t.member_id t.paper_id,
) t2 t.class_id,
GROUP BY t.member_id
t2.class_id, ) t2
t2.member_id GROUP BY
) t2 t2.class_id,
LEFT JOIN class_dict t3 ON t2.class_id = t3.id t2.member_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 ) t2
) t4 ON t.class_id = t4.class_id LEFT JOIN class_dict t3 ON t2.class_id = t3.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.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>
<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!