Commit 38195ce4 by 涂亚平

年前上线版本

1 parent 99eb06b2
......@@ -28,8 +28,8 @@ public class RedisPrefixConstant {
public static final String SUBSIDY_SETTINGS_PREFIX = "subsidySettings:";
/**
* subsidySignInfo_memberId_1_classId_12_20211223_long,do 学生签到数据
* subsidySignInfo:memberId:1:classId:12:20211223:long,do 学生签到数据
*/
public static final String SUBSIDY_SIGN_INFO_PREFIX = "subsidySignInfo:";
public static final String SUBSIDY_SIGN_INFO_PREFIX = "subsidySignInfo:memberId:";
}
......@@ -62,7 +62,7 @@ public class AdministerController {
@PostMapping("/administers")
@ApiOperation("查询所有运营者 { userName pageNum pageSize }")
//@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO operators(@RequestBody OperatorsDTO operatorsDTO){
return ResponseData.generateCreatedResponse(0,administerService.operators(operatorsDTO));
}
......@@ -94,7 +94,7 @@ public class AdministerController {
@PostMapping("classDetail")
@ApiOperation("班级管理--班级成员 id 班级id userName")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
//@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO classDetail(@RequestBody ClassDetailDTO classDetailDTO){
return ResponseData.generateCreatedResponse(0,administerService.classDetail(classDetailDTO));
}
......@@ -109,14 +109,14 @@ public class AdministerController {
@PostMapping("signDetail")
@ApiOperation("班级管理--注册签到 id 班级id userName")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
//@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO signDetail(@RequestBody ClassDetailDTO classDetailDTO){
return ResponseData.generateCreatedResponse(0,administerService.signDetail(classDetailDTO));
}
@PostMapping("exportSignDetail")
@ApiOperation("班级管理--注册签到 id 班级id userName")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
//@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public void exportSignDetail(@RequestBody ClassDetailDTO classDetailDTO)throws Exception{
classDetailDTO.setFlag(true);
administerService.exportSignDetail(classDetailDTO);
......@@ -131,7 +131,7 @@ public class AdministerController {
@PostMapping("exportExerciseTest")
@ApiOperation("班级管理--测评成绩 id 班级id userName paperId")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
//@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public void exportExerciseTest(@RequestBody ClassDetailDTO classDetailDTO)throws Exception{
classDetailDTO.setFlag(true);
administerService.exportExerciseTest(classDetailDTO);
......@@ -189,7 +189,7 @@ public class AdministerController {
}
@PostMapping("exportClassVodDailyInfo")
@ApiOperation("学习记录---每日学习时长(视频维度)")
@ApiOperation("学习记录---每日学习时长(视频维度) pageSize pageNum userName classId")
public void exportClassVodDailyInfo(@RequestBody ClassVodDailyInfoDTO classVodDailyInfoDTO ){
administerService.exportClassVodDailyInfo(classVodDailyInfoDTO);
}
......
......@@ -3,20 +3,13 @@ package com.subsidy.jobs;
import com.subsidy.mapper.OprAdmDictMapper;
import com.subsidy.mapper.OprMemDictMapper;
import com.subsidy.mapper.VodPlayHistoryMapper;
import com.subsidy.mongodb.OprAdmDictDO;
import com.subsidy.model.OprMemDictDO;
import com.subsidy.model.VodPlayHistoryDO;
import com.subsidy.util.DateFormatUtil;
import com.subsidy.model.OprAdmDictDO;
import com.subsidy.util.RedisUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Set;
/**
* <p>
......
package com.subsidy.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.subsidy.mongodb.OprAdmDictDO;
import com.subsidy.model.OprAdmDictDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.subsidy.vo.opr.GetHistoryVO;
import org.springframework.stereotype.Repository;
......
package com.subsidy.mongodb;
package com.subsidy.model;
import com.subsidy.util.BaseModel;
import com.baomidou.mybatisplus.annotation.TableName;
......@@ -17,9 +17,11 @@ import org.omg.CosNaming.NamingContextExtPackage.StringNameHelper;
* @since 2021-12-13
*/
@Data
public class OprAdmDictDO {
@EqualsAndHashCode(callSuper = true)
@TableName("opr_adm_dict")
public class OprAdmDictDO extends BaseModel{
private String _id;
private Long id;
/**
* 用户id
......@@ -27,16 +29,6 @@ public class OprAdmDictDO {
private Long userId;
/**
* 公司id
*/
private Long companyId;
/**
* 名字
*/
private String userName;
/**
* 操作类型
*/
private String oprType;
......@@ -46,14 +38,5 @@ public class OprAdmDictDO {
*/
private Integer result;
/**
* 登录时间
*/
private String loginDateFormat;
/**
* 创建时间
*/
private String createDate;
}
......@@ -16,9 +16,11 @@ import lombok.EqualsAndHashCode;
* @since 2021-12-13
*/
@Data
public class OprMemDictDO {
@EqualsAndHashCode(callSuper = true)
@TableName("opr_mem_dict")
public class OprMemDictDO extends BaseModel {
private String _id;
private Long id;
/**
* 用户id
......@@ -26,16 +28,6 @@ public class OprMemDictDO {
private Long userId;
/**
* 公司id
*/
private Long companyId;
/**
* 公司名称
*/
private String companyName;
/**
* 操作类型
*/
private String oprType;
......@@ -45,15 +37,4 @@ public class OprMemDictDO {
*/
private Integer result;
/**
* 登录时间
*/
private String loginDateFormat;
/**
* 创建时间
*/
private String createDate;
private String userName;
}
......@@ -2,9 +2,8 @@ package com.subsidy.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.subsidy.dto.opr.GetHistoryDTO;
import com.subsidy.mongodb.OprAdmDictDO;
import com.subsidy.model.OprAdmDictDO;
import com.baomidou.mybatisplus.extension.service.IService;
import com.subsidy.mongodb.PageVO;
import com.subsidy.vo.opr.GetHistoryVO;
/**
......@@ -17,6 +16,7 @@ import com.subsidy.vo.opr.GetHistoryVO;
*/
public interface OprAdmDictService extends IService<OprAdmDictDO> {
PageVO<GetHistoryVO> getHistory(GetHistoryDTO getHistoryDTO);
//PageVO<GetHistoryVO> getHistory(GetHistoryDTO getHistoryDTO);
IPage<GetHistoryVO> getHistory(GetHistoryDTO getHistoryDTO);
}
......@@ -17,6 +17,6 @@ import com.subsidy.vo.opr.GetHistoryVO;
*/
public interface OprMemDictService extends IService<OprMemDictDO> {
PageVO<GetHistoryVO> getHistory(GetHistoryDTO getHistoryDTO);
//PageVO<GetHistoryVO> getHistory(GetHistoryDTO getHistoryDTO);
IPage<GetHistoryVO> getHistory(GetHistoryDTO getHistoryDTO);
}
......@@ -22,6 +22,7 @@ import com.subsidy.mapper.ExerciseDoneResultMapper;
import com.subsidy.mapper.FileDictMapper;
import com.subsidy.mapper.MemberDepartmentMappingMapper;
import com.subsidy.mapper.MemberMapper;
import com.subsidy.mapper.OprMemDictMapper;
import com.subsidy.mapper.PaperDictMapper;
import com.subsidy.mapper.VodPlayHistoryMapper;
import com.subsidy.model.ClassDictDO;
......@@ -118,6 +119,9 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
@Autowired
private CompanyDictMapper companyDictMapper;
@Autowired
private OprMemDictMapper oprMemDictMapper;
public IPage<GetAllVO> getAll(GetAllDTO getAllDTO) {
Page pager = new Page(getAllDTO.getPageNum(), getAllDTO.getPageSize());
IPage iPage = this.baseMapper.getMembers(pager, getAllDTO.getDepartmentId(), getAllDTO.getUserName(), getAllDTO.getStatus());
......@@ -247,12 +251,13 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
oprMemDictDO.setUserId(memberDO.getId());
oprMemDictDO.setOprType("登录");
oprMemDictDO.setResult(0);
oprMemDictDO.setUserName(memberDO.getUserName());
oprMemDictDO.setCreateDate(System.currentTimeMillis() + "");
oprMemDictDO.setLoginDateFormat(DateFormatUtil.format(new Date(), "yyyyMMdd"));
oprMemDictDO.setCompanyId(companyDictDO.getId());
oprMemDictDO.setCompanyName(companyDictDO.getCompanyName());
mongoTemplate.insert(oprMemDictDO);
//oprMemDictDO.setUserName(memberDO.getUserName());
//oprMemDictDO.setCreateDate(System.currentTimeMillis() + "");
//oprMemDictDO.setLoginDateFormat(DateFormatUtil.format(new Date(), "yyyyMMdd"));
//oprMemDictDO.setCompanyId(companyDictDO.getId());
//oprMemDictDO.setCompanyName(companyDictDO.getCompanyName());
//mongoTemplate.insert(oprMemDictDO);
oprMemDictMapper.insert(oprMemDictDO);
//redisUtil.set(RedisPrefixConstant.SUBSIDY_MEMBER_LOGIN_PREFIX + memberDO.getId() + ":" + memberDO.getUserName() + ":" + companyDictDO.getCompanyName() + ":" + LocalDateTime.now(), oprMemDictDO);
throw new HttpException(10013);
}
......@@ -272,25 +277,27 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
oprMemDictDO.setUserId(memberDO.getId());
oprMemDictDO.setOprType("登录");
oprMemDictDO.setResult(0);
oprMemDictDO.setUserName(memberDO.getUserName());
oprMemDictDO.setCreateDate(System.currentTimeMillis() + "");
oprMemDictDO.setLoginDateFormat(DateFormatUtil.format(new Date(), "yyyyMMdd"));
oprMemDictDO.setCompanyId(companyDictDO.getId());
oprMemDictDO.setCompanyName(companyDictDO.getCompanyName());
mongoTemplate.insert(oprMemDictDO);
//oprMemDictDO.setUserName(memberDO.getUserName());
//oprMemDictDO.setCreateDate(System.currentTimeMillis() + "");
//oprMemDictDO.setLoginDateFormat(DateFormatUtil.format(new Date(), "yyyyMMdd"));
//oprMemDictDO.setCompanyId(companyDictDO.getId());
//oprMemDictDO.setCompanyName(companyDictDO.getCompanyName());
//mongoTemplate.insert(oprMemDictDO);
oprMemDictMapper.insert(oprMemDictDO);
throw new HttpException(70010);
}
//审计日志
OprMemDictDO oprMemDictDO = new OprMemDictDO();
oprMemDictDO.setUserId(memberDO.getId());
oprMemDictDO.setOprType("登录");
oprMemDictDO.setUserName(memberDO.getUserName());
//oprMemDictDO.setUserName(memberDO.getUserName());
oprMemDictDO.setResult(1);
oprMemDictDO.setCreateDate(System.currentTimeMillis() + "");
oprMemDictDO.setLoginDateFormat(DateFormatUtil.format(new Date(), "yyyyMMdd"));
oprMemDictDO.setCompanyId(companyDictDO.getId());
oprMemDictDO.setCompanyName(companyDictDO.getCompanyName());
mongoTemplate.insert(oprMemDictDO);
//oprMemDictDO.setCreateDate(System.currentTimeMillis() + "");
//oprMemDictDO.setLoginDateFormat(DateFormatUtil.format(new Date(), "yyyyMMdd"));
//oprMemDictDO.setCompanyId(companyDictDO.getId());
//oprMemDictDO.setCompanyName(companyDictDO.getCompanyName());
oprMemDictMapper.insert(oprMemDictDO);
//mongoTemplate.insert(oprMemDictDO);
return userRoleVO;
}
......@@ -322,12 +329,13 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
oprMemDictDO.setUserId(memberDO.getId());
oprMemDictDO.setOprType("登录");
oprMemDictDO.setResult(1);
oprMemDictDO.setUserName(memberDO.getUserName());
oprMemDictDO.setCreateDate(System.currentTimeMillis() + "");
oprMemDictDO.setLoginDateFormat(DateFormatUtil.format(new Date(), "yyyyMMdd"));
oprMemDictDO.setCompanyId(companyDictDO.getId());
oprMemDictDO.setCompanyName(companyDictDO.getCompanyName());
mongoTemplate.insert(oprMemDictDO);
//oprMemDictDO.setUserName(memberDO.getUserName());
//oprMemDictDO.setCreateDate(System.currentTimeMillis() + "");
//oprMemDictDO.setLoginDateFormat(DateFormatUtil.format(new Date(), "yyyyMMdd"));
//oprMemDictDO.setCompanyId(companyDictDO.getId());
//oprMemDictDO.setCompanyName(companyDictDO.getCompanyName());
//mongoTemplate.insert(oprMemDictDO);
oprMemDictMapper.insert(oprMemDictDO);
//redisUtil.set(RedisPrefixConstant.SUBSIDY_MEMBER_LOGIN_PREFIX + memberDO.getId() + ":" + System.currentTimeMillis(), 1);
return memberVO;
} else {
......@@ -336,12 +344,13 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
oprMemDictDO.setUserId(memberDO.getId());
oprMemDictDO.setOprType("登录");
oprMemDictDO.setResult(0);
oprMemDictDO.setUserName(memberDO.getUserName());
oprMemDictDO.setCreateDate(System.currentTimeMillis() + "");
oprMemDictDO.setLoginDateFormat(DateFormatUtil.format(new Date(), "yyyyMMdd"));
oprMemDictDO.setCompanyName(companyDictDO.getCompanyName());
oprMemDictDO.setCompanyId(companyDictDO.getId());
mongoTemplate.insert(oprMemDictDO);
//oprMemDictDO.setUserName(memberDO.getUserName());
//oprMemDictDO.setCreateDate(System.currentTimeMillis() + "");
//oprMemDictDO.setLoginDateFormat(DateFormatUtil.format(new Date(), "yyyyMMdd"));
//oprMemDictDO.setCompanyName(companyDictDO.getCompanyName());
//oprMemDictDO.setCompanyId(companyDictDO.getId());
//mongoTemplate.insert(oprMemDictDO);
oprMemDictMapper.insert(oprMemDictDO);
//redisUtil.set(RedisPrefixConstant.SUBSIDY_MEMBER_LOGIN_PREFIX + memberDO.getId() + ":" + System.currentTimeMillis(), oprMemDictDO);
throw new HttpException(10016);
}
......@@ -350,12 +359,13 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
oprMemDictDO.setUserId(memberDO.getId());
oprMemDictDO.setOprType("登录");
oprMemDictDO.setResult(0);
oprMemDictDO.setUserName(memberDO.getUserName());
oprMemDictDO.setCreateDate(System.currentTimeMillis() + "");
oprMemDictDO.setLoginDateFormat(DateFormatUtil.format(new Date(), "yyyyMMdd"));
oprMemDictDO.setCompanyName(companyDictDO.getCompanyName());
oprMemDictDO.setCompanyId(companyDictDO.getId());
mongoTemplate.insert(oprMemDictDO);
//oprMemDictDO.setUserName(memberDO.getUserName());
//oprMemDictDO.setCreateDate(System.currentTimeMillis() + "");
//oprMemDictDO.setLoginDateFormat(DateFormatUtil.format(new Date(), "yyyyMMdd"));
//oprMemDictDO.setCompanyName(companyDictDO.getCompanyName());
//oprMemDictDO.setCompanyId(companyDictDO.getId());
//mongoTemplate.insert(oprMemDictDO);
oprMemDictMapper.insert(oprMemDictDO);
//redisUtil.set(RedisPrefixConstant.SUBSIDY_MEMBER_LOGIN_PREFIX + memberDO.getId() + ":" + System.currentTimeMillis(), 0);
throw new HttpException(10015);
}
......
......@@ -3,27 +3,13 @@ package com.subsidy.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.subsidy.dto.opr.GetHistoryDTO;
import com.subsidy.mapper.AdministerMapper;
import com.subsidy.mapper.CompanyDictMapper;
import com.subsidy.model.AdministerDO;
import com.subsidy.model.CompanyDictDO;
import com.subsidy.mongodb.OprAdmDictDO;
import com.subsidy.model.OprAdmDictDO;
import com.subsidy.mapper.OprAdmDictMapper;
import com.subsidy.mongodb.PageVO;
import com.subsidy.service.OprAdmDictService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.util.MongoUtil;
import com.subsidy.vo.opr.GetHistoryVO;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
* <p>
* 审计表 服务实现类
......@@ -35,44 +21,38 @@ import java.util.List;
@Service
public class OprAdmDictServiceImpl extends ServiceImpl<OprAdmDictMapper, OprAdmDictDO> implements OprAdmDictService {
@Autowired
private MongoTemplate mongoTemplate;
@Autowired
private MongoUtil mongoUtil;
@Autowired
private AdministerMapper administerMapper;
@Autowired
private CompanyDictMapper companyDictMapper;
public PageVO<GetHistoryVO> getHistory(GetHistoryDTO getHistoryDTO){
PageVO pageVO = new PageVO();
List<GetHistoryVO> getHistoryVOS = new ArrayList<>();
//可累加条件
Query query = new Query(Criteria.where("userName").regex(getHistoryDTO.getUserName())
.andOperator(Criteria.where("loginDateFormat").gte(getHistoryDTO.getStartDate()),
Criteria.where("loginDateFormat").lte(getHistoryDTO.getEndDate())));
Long count = mongoTemplate.count(query,OprAdmDictDO.class);
mongoUtil.start(getHistoryDTO.getPageNum(),getHistoryDTO.getPageSize(),query);
List<OprAdmDictDO> oprAdmDictDOS = mongoTemplate.find(query,OprAdmDictDO.class);
for (OprAdmDictDO oprAdmDictDO : oprAdmDictDOS){
AdministerDO administerDO = administerMapper.selectById(oprAdmDictDO.getUserId());
CompanyDictDO companyDictDO = companyDictMapper.selectById(administerDO.getCompanyId());
GetHistoryVO getHistoryVO = new GetHistoryVO();
BeanUtils.copyProperties(oprAdmDictDO,getHistoryVO);
getHistoryVO.setCompanyName(companyDictDO.getCompanyName());
getHistoryVO.setUserName(administerDO.getUserName());
getHistoryVOS.add(getHistoryVO);
}
pageVO.setRecords(getHistoryVOS);
pageVO.setTotal(count);
return pageVO;
//public PageVO<GetHistoryVO> getHistory(GetHistoryDTO getHistoryDTO){
//
// PageVO pageVO = new PageVO();
//
// List<GetHistoryVO> getHistoryVOS = new ArrayList<>();
//
// //可累加条件
// Query query = new Query(Criteria.where("userName").regex(getHistoryDTO.getUserName())
// .andOperator(Criteria.where("loginDateFormat").gte(getHistoryDTO.getStartDate()),
// Criteria.where("loginDateFormat").lte(getHistoryDTO.getEndDate())));
// Long count = mongoTemplate.count(query,OprAdmDictDO.class);
// mongoUtil.start(getHistoryDTO.getPageNum(),getHistoryDTO.getPageSize(),query);
// List<OprAdmDictDO> oprAdmDictDOS = mongoTemplate.find(query,OprAdmDictDO.class);
// for (OprAdmDictDO oprAdmDictDO : oprAdmDictDOS){
// AdministerDO administerDO = administerMapper.selectById(oprAdmDictDO.getUserId());
// CompanyDictDO companyDictDO = companyDictMapper.selectById(administerDO.getCompanyId());
// GetHistoryVO getHistoryVO = new GetHistoryVO();
// BeanUtils.copyProperties(oprAdmDictDO,getHistoryVO);
// getHistoryVO.setCompanyName(companyDictDO.getCompanyName());
// getHistoryVO.setUserName(administerDO.getUserName());
// getHistoryVOS.add(getHistoryVO);
// }
// pageVO.setRecords(getHistoryVOS);
// pageVO.setTotal(count);
//
// return pageVO;
//}
public IPage<GetHistoryVO> getHistory(GetHistoryDTO getHistoryDTO){
Page pager = new Page(getHistoryDTO.getPageNum(), getHistoryDTO.getPageSize());
return this.baseMapper.getHistory(pager,getHistoryDTO.getUserName(),getHistoryDTO.getStartDate(),getHistoryDTO.getEndDate());
}
}
......@@ -5,27 +5,16 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.subsidy.dto.opr.GetHistoryDTO;
import com.subsidy.mapper.CompanyDictMapper;
import com.subsidy.mapper.MemberMapper;
import com.subsidy.model.AdministerDO;
import com.subsidy.model.CompanyDictDO;
import com.subsidy.model.MemberDO;
import com.subsidy.model.OprMemDictDO;
import com.subsidy.mapper.OprMemDictMapper;
import com.subsidy.mongodb.OprAdmDictDO;
import com.subsidy.mongodb.PageVO;
import com.subsidy.service.OprMemDictService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.util.MongoUtil;
import com.subsidy.vo.opr.GetHistoryVO;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
* <p>
* 审计表 服务实现类
......@@ -49,33 +38,37 @@ public class OprMemDictServiceImpl extends ServiceImpl<OprMemDictMapper, OprMemD
@Autowired
private CompanyDictMapper companyDictMapper;
public PageVO<GetHistoryVO> getHistory(GetHistoryDTO getHistoryDTO) {
PageVO pageVO = new PageVO();
List<GetHistoryVO> getHistoryVOS = new ArrayList<>();
//public PageVO<GetHistoryVO> getHistory(GetHistoryDTO getHistoryDTO) {
//
// PageVO pageVO = new PageVO();
//
// List<GetHistoryVO> getHistoryVOS = new ArrayList<>();
//
// //可累加条件
// Query query = new Query(Criteria.where("userName").regex(getHistoryDTO.getUserName())
// .andOperator(Criteria.where("loginDateFormat").gte(getHistoryDTO.getStartDate()),
// Criteria.where("loginDateFormat").lte(getHistoryDTO.getEndDate())));
// Long count = mongoTemplate.count(query, OprMemDictDO.class);
// mongoUtil.start(getHistoryDTO.getPageNum(), getHistoryDTO.getPageSize(), query);
// List<OprMemDictDO> oprMemDictDOS = mongoTemplate.find(query, OprMemDictDO.class);
// for (OprMemDictDO oprMemDictDO : oprMemDictDOS) {
// MemberDO memberDO = memberMapper.selectById(oprMemDictDO.getUserId());
// CompanyDictDO companyDictDO = companyDictMapper.selectById(memberDO.getCompanyId());
// GetHistoryVO getHistoryVO = new GetHistoryVO();
// BeanUtils.copyProperties(oprMemDictDO, getHistoryVO);
// getHistoryVO.setCompanyName(companyDictDO.getCompanyName());
// getHistoryVO.setUserName(memberDO.getUserName());
// getHistoryVOS.add(getHistoryVO);
// }
// pageVO.setRecords(getHistoryVOS);
// pageVO.setTotal(count);
//
// return pageVO;
//}
//可累加条件
Query query = new Query(Criteria.where("userName").regex(getHistoryDTO.getUserName())
.andOperator(Criteria.where("loginDateFormat").gte(getHistoryDTO.getStartDate()),
Criteria.where("loginDateFormat").lte(getHistoryDTO.getEndDate())));
Long count = mongoTemplate.count(query, OprMemDictDO.class);
mongoUtil.start(getHistoryDTO.getPageNum(), getHistoryDTO.getPageSize(), query);
List<OprMemDictDO> oprMemDictDOS = mongoTemplate.find(query, OprMemDictDO.class);
for (OprMemDictDO oprMemDictDO : oprMemDictDOS) {
MemberDO memberDO = memberMapper.selectById(oprMemDictDO.getUserId());
CompanyDictDO companyDictDO = companyDictMapper.selectById(memberDO.getCompanyId());
GetHistoryVO getHistoryVO = new GetHistoryVO();
BeanUtils.copyProperties(oprMemDictDO, getHistoryVO);
getHistoryVO.setCompanyName(companyDictDO.getCompanyName());
getHistoryVO.setUserName(memberDO.getUserName());
getHistoryVOS.add(getHistoryVO);
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());
}
pageVO.setRecords(getHistoryVOS);
pageVO.setTotal(count);
return pageVO;
}
}
......@@ -29,6 +29,9 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.util.Date;
import java.util.List;
import java.util.concurrent.ExecutorService;
......@@ -60,6 +63,9 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig
@Autowired
private ClassHourDictMapper classHourDictMapper;
@Autowired
private SignInRecordMapper signInRecordMapper;
public IPage<GetMemberSignInfoVO> getMemberSignInfo(GetMemberSignInfoDTO getMemberSignInfoDTO) {
Page pager = new Page(getMemberSignInfoDTO.getPageNum(), getMemberSignInfoDTO.getPageSize());
......@@ -75,7 +81,7 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig
List<ClassDictDO> classDictDOS = classMemberMappingMapper.getMemberClass(signInRecordDO.getMemberId());
for (ClassDictDO classDictDO : classDictDOS) {
redisUtil.set(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + "memberId:" + signInRecordDO.getMemberId() + ":classId:" + classDictDO.getId() + ":" + DateFormatUtil.format(new Date(), "yyyyMMdd") + ":" + System.currentTimeMillis(), null);
redisUtil.set(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + signInRecordDO.getMemberId() + ":classId:" + classDictDO.getId() + ":" + DateFormatUtil.format(new Date(), "yyyyMMdd") + ":" + System.currentTimeMillis(), null);
}
return ConstantUtils.ADD_SUCCESS;
......@@ -110,7 +116,7 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig
signInStatusVO.setStatus(flag);
//获取有效课程
long count = classMemberMappingMapper.getMemberClassCount(signInRecordDO.getMemberId());
long size = redisUtil.scan(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + "memberId:" + signInRecordDO.getMemberId() + "*:" + DateFormatUtil.format(new Date(), "yyyyMMdd")+"*").stream().count();
long size = redisUtil.scan(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + signInRecordDO.getMemberId() + "*:" + DateFormatUtil.format(new Date(), "yyyyMMdd")+"*").stream().count();
if (size != count) {
signInStatusVO.setStatus(false);
......@@ -128,16 +134,25 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig
//}
//预写公司设置数据
List<ClassHourDictDO> classHourDictDOS = classHourDictMapper.selectList(null);
for (ClassHourDictDO classHourDictDO : classHourDictDOS) {
redisUtil.set("subsidySettings:"+ classHourDictDO.getCompanyId(), classHourDictDO);
}
//List<ClassHourDictDO> classHourDictDOS = classHourDictMapper.selectList(null);
//for (ClassHourDictDO classHourDictDO : classHourDictDOS) {
// redisUtil.set("subsidySettings:"+ classHourDictDO.getCompanyId(), classHourDictDO);
//}
//预写学生账号数据
//List<MemberDO> memberDOS = memberMapper.selectList(null);
//for (MemberDO memberDO : memberDOS){
// redisUtil.set(RedisPrefixConstant.SUBSIDY_COMPANY_MEMBER_PREFIX+memberDO.getCompanyId()+":"+memberDO.getAccountName(),memberDO);
//}
//签到数据
List<SignInRecordDO> signInRecordDOS = signInRecordMapper.selectList(null);
for (SignInRecordDO signInRecordDO : signInRecordDOS){
redisUtil.set(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX+signInRecordDO.getMemberId()+":classId:"+
signInRecordDO.getClassId()+":"+signInRecordDO.getSignInDate().toString().split("T")[0]+":"+signInRecordDO.getSignInDate().toInstant(ZoneOffset.of("+8")).toEpochMilli(),signInRecordDO);
}
}
}
......@@ -5,7 +5,7 @@ import lombok.Data;
@Data
public class ClassVodDailyInfoItemVO {
private Integer vodId;
private Long vodId;
private String vodName;
......
......@@ -34,12 +34,19 @@ mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
#spring.redis.lettuce.pool.max-active=32
#spring.redis.lettuce.pool.min-idle=8
spring.application.name=spring-boot-mongodb
# mongodb
#spring.data.mongodb.uri=mongodb://47.97.19.66:27017/subsidy
spring.data.mongodb.username=root
spring.data.mongodb.password=123456
#spring.data.mongodb.authentication-database=subsidy
spring.data.mongodb.database=subsidy
spring.data.mongodb.host=47.97.19.66
spring.data.mongodb.port=27017
#spring.application.name=spring-boot-mongodb
## mongodb
##spring.data.mongodb.uri=mongodb://47.97.19.66:27017/subsidy
#spring.data.mongodb.username=root
#spring.data.mongodb.password=123456
##spring.data.mongodb.authentication-database=subsidy
#spring.data.mongodb.database=subsidy
#spring.data.mongodb.host=47.97.19.66
#spring.data.mongodb.port=27017
spring.redis.host=47.97.19.66
spring.redis.password=Ykhl@208
spring.redis.port=6389
spring.redis.lettuce.pool.max-idle=16
spring.redis.lettuce.pool.max-active=32
spring.redis.lettuce.pool.min-idle=8
\ No newline at end of file
......@@ -32,8 +32,15 @@ spring.servlet.multipart.max-request-size=4098KB
#wechat.msgUrl= https://teachai.youkehulian.com/login
#wechat.templateId= Z1HNPLOrKiHEjfR1KMP-cC-uH3BWqDJIHv365Ev20yQ
spring.redis.cluster.nodes=47.97.19.66:6377,47.97.19.66:6378,47.97.16.66:6379
spring.redis.password=Ykhl@208
#spring.redis.cluster.nodes=47.97.19.66:6377,47.97.19.66:6378,47.97.16.66:6379
#spring.redis.password=Ykhl@208
#spring.redis.lettuce.pool.max-idle=16
#spring.redis.lettuce.pool.max-active=32
#spring.redis.lettuce.pool.min-idle=8
spring.redis.host=r-uf6pdbuxqgy0ztfmn1pd.redis.rds.aliyuncs.com
spring.redis.password=r-uf6pdbuxqgy0ztfmn1:Ykhl@208
spring.redis.port=6379
spring.redis.lettuce.pool.max-idle=16
spring.redis.lettuce.pool.max-active=32
spring.redis.lettuce.pool.min-idle=8
\ No newline at end of file
# 环境配置
spring.profiles.active=dev
spring.profiles.active=prod
# 端口号
spring.server.port=23457
spring.server.port=23459
#嵌入tomcat配置
#和CPU数
spring.server.acceptorThreadCount=600
......@@ -68,9 +68,3 @@ spring.quartz.overwrite-existing-jobs=false
#spring.redis.port=6379
#spring.redis.password=r-uf6m4cpkjrgpzywjm3:Ykhl@208
spring.redis.host=47.97.19.66
spring.redis.password=Ykhl@208
spring.redis.port=6389
spring.redis.lettuce.pool.max-idle=16
spring.redis.lettuce.pool.max-active=32
spring.redis.lettuce.pool.min-idle=8
\ No newline at end of file
......@@ -3,7 +3,7 @@
<mapper namespace="com.subsidy.mapper.OprAdmDictMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.subsidy.mongodb.OprAdmDictDO">
<resultMap id="BaseResultMap" type="com.subsidy.model.OprAdmDictDO">
<id column="id" property="id" />
<result column="create_date" property="createDate" />
<result column="update_date" property="updateDate" />
......@@ -50,7 +50,7 @@
t.create_date DESC
</select>
<select id="getLoginInfo" parameterType="long" resultType="com.subsidy.mongodb.OprAdmDictDO">
<select id="getLoginInfo" parameterType="long" resultType="com.subsidy.model.OprAdmDictDO">
SELECT
*
FROM
......@@ -68,7 +68,7 @@
LIMIT 5)t2
</select>
<select id="getRecordByDate" resultType="com.subsidy.mongodb.OprAdmDictDO">
<select id="getRecordByDate" resultType="com.subsidy.model.OprAdmDictDO">
SELECT
*
FROM
......
......@@ -130,15 +130,17 @@
</select>
<select id="classStudyHistory" parameterType="long" resultType="com.subsidy.vo.sign.ClassSignInfoVO">
SELECT
mem_cnt AS memberCount,
floor( t2.ttl / mem_cnt ) AS studyVodCounts,
t3.total_vods AS totalVodCounts,
avg_playlength AS avgVodPlayLength,
floor( t4.pass_cnt * 100 / mem_cnt ) AS passRate,
t5.ask_cnt AS answerCount
FROM
(
t10.mem_cnt AS memberCount,
ifnull( floor( t2.ttl / t10.mem_cnt ), 0 ) AS studyVodCounts,
ifnull( t3.total_vods, 0 ) AS totalVodCounts,
ifnull( avg_playlength, 0 ) AS avgVodPlayLength,
ifnull( floor( t4.pass_cnt * 100 / t10.mem_cnt ), 0 ) AS passRate,
ifnull( t5.ask_cnt, 0 ) AS answerCount
FROM
( SELECT t.class_id, count( 1 ) AS mem_cnt FROM class_member_mapping t WHERE t.delete_date IS NULL AND t.class_id = #{classId} ) t10
LEFT JOIN (
SELECT
t.class_id,
count(
......@@ -149,7 +151,7 @@
WHERE
t.delete_date IS NULL
AND t.class_id = #{classId}
) t
) t ON t.class_id = t10.class_id
LEFT JOIN (
SELECT
t3.class_id,
......@@ -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
) t4 ON t.class_id = t4.class_id
LEFT JOIN ( SELECT t.class_id, sum( 1 ) AS ask_cnt FROM answering_question t WHERE t.class_id = #{classId} AND t.delete_date IS NULL ) t5 ON t.class_id = t5.class_id
</select>
<select id="memberRecentPlay" resultType="com.subsidy.vo.member.ContentVodNewVO">
......@@ -321,15 +324,20 @@
SELECT
t.member_id,
t.vod_id,
t3.vod_name,
sum( t.play_length ) AS play_length
FROM
vod_play_history t
LEFT JOIN class_member_mapping t2 ON t.member_id = t2.id
left join vod_dict t3 on t.vod_id = t3.id
WHERE
t.delete_date IS NULL
AND t.class_id = #{classId}
GROUP BY
t.class_id,
t.member_id
t.member_id,
t.vod_id,
t3.vod_name
</select>
</mapper>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!