Commit 93b423e7 by 涂亚平

审计功能

1 parent 62afc730
Showing with 646 additions and 48 deletions
...@@ -103,14 +103,14 @@ public class AdministerController { ...@@ -103,14 +103,14 @@ 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));
} }
@PostMapping("exportClassDetail") @PostMapping("exportClassDetail")
@ApiOperation("** 班级管理--班级成员--导出 id 班级id userName") @ApiOperation("** 班级管理--班级成员--导出 id 班级id userName")
// @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) //@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public void exportClassDetail(@RequestBody ClassDetailDTO classDetailDTO)throws Exception{ public void exportClassDetail(@RequestBody ClassDetailDTO classDetailDTO)throws Exception{
classDetailDTO.setFlag(true); classDetailDTO.setFlag(true);
administerService.exportClassDetail(classDetailDTO); administerService.exportClassDetail(classDetailDTO);
...@@ -200,4 +200,6 @@ public class AdministerController { ...@@ -200,4 +200,6 @@ public class AdministerController {
return ResponseData.generateCreatedResponse(0,administerService.importMember(companyId,file)); return ResponseData.generateCreatedResponse(0,administerService.importMember(companyId,file));
} }
} }
package com.subsidy.controller;
import com.subsidy.common.ResponseData;
import com.subsidy.common.ResponseVO;
import com.subsidy.dto.opr.GetHistoryDTO;
import com.subsidy.service.OprAdmDictService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;
/**
* <p>
* 审计表 前端控制器
* </p>
*
* @author DengMin
* @since 2021-12-13
*/
@RestController
@Api(tags = "后台审计表")
@RequestMapping("/oprAdm")
public class OprAdmDictController {
@Autowired
private OprAdmDictService oprAdmDictService;
@PostMapping("getHistory")
@ApiOperation("获取后台用户审计 {pageSize pageNum userName startDate endDate}")
public ResponseVO getHistory(@RequestBody GetHistoryDTO getHistoryDTO){
return ResponseData.generateCreatedResponse(0,oprAdmDictService.getHistory(getHistoryDTO));
}
}
package com.subsidy.controller;
import com.subsidy.common.ResponseData;
import com.subsidy.common.ResponseVO;
import com.subsidy.dto.opr.GetHistoryDTO;
import com.subsidy.service.OprMemDictService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;
/**
* <p>
* 审计表 前端控制器
* </p>
*
* @author DengMin
* @since 2021-12-13
*/
@RestController
@Api(tags = "学员审计表")
@RequestMapping("/oprMem")
public class OprMemDictController {
@Autowired
private OprMemDictService oprMemDictService;
@PostMapping("getHistory")
@ApiOperation("获取学员审计 {pageSize pageNum userName startDate endDate}")
public ResponseVO getHistory(@RequestBody GetHistoryDTO getHistoryDTO){
return ResponseData.generateCreatedResponse(0,oprMemDictService.getHistory(getHistoryDTO));
}
}
package com.subsidy.dto.opr;
import lombok.Data;
@Data
public class GetHistoryDTO {
private Integer pageNum;
private Integer pageSize;
private String userName;
private String startDate;
private String endDate;
}
package com.subsidy.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.subsidy.model.OprAdmDictDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.subsidy.vo.opr.GetHistoryVO;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* <p>
* 审计表 Mapper 接口
* </p>
*
* @author DengMin
* @since 2021-12-13
*/
@Repository
public interface OprAdmDictMapper extends BaseMapper<OprAdmDictDO> {
/**
* 查看管理员的登录审计
*/
IPage<GetHistoryVO> getHistory(IPage page,String userName,String startDate,String endDate);
/**
* 查看某为成员最近登录情况 五天超过次数
*/
List<OprAdmDictDO> getLoginInfo(Long userId);
}
package com.subsidy.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.subsidy.model.OprMemDictDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.subsidy.vo.opr.GetHistoryVO;
import org.springframework.stereotype.Repository;
/**
* <p>
* 审计表 Mapper 接口
* </p>
*
* @author DengMin
* @since 2021-12-13
*/
@Repository
public interface OprMemDictMapper extends BaseMapper<OprMemDictDO> {
IPage<GetHistoryVO> getHistory(IPage page,String userName,String startDate,String endDate);
}
...@@ -33,5 +33,5 @@ public interface VodDictMapper extends BaseMapper<VodDictDO> { ...@@ -33,5 +33,5 @@ public interface VodDictMapper extends BaseMapper<VodDictDO> {
/** /**
* 获取某课程下,学习人数和平均学习时长 * 获取某课程下,学习人数和平均学习时长
*/ */
ClassVodCompleteInfoVO classVodCompleteInfo(Long classId, List<Long> memberIds,String vodName); ClassVodCompleteInfoVO classVodCompleteInfo(Long classId, Long vodId,List<Long> memberIds,String vodName);
} }
package com.subsidy.model;
import com.subsidy.util.BaseModel;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 审计表
* </p>
*
* @author DengMin
* @since 2021-12-13
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("opr_adm_dict")
public class OprAdmDictDO extends BaseModel {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 用户id
*/
private Long userId;
/**
* 操作类型
*/
private String oprType;
/**
* 登录结果
*/
private Integer result;
}
package com.subsidy.model;
import com.subsidy.util.BaseModel;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 审计表
* </p>
*
* @author DengMin
* @since 2021-12-13
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("opr_mem_dict")
public class OprMemDictDO extends BaseModel {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 用户id
*/
private Long userId;
/**
* 操作类型
*/
private String oprType;
/**
* 登录结果
*/
private Integer result;
}
package com.subsidy.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.subsidy.dto.opr.GetHistoryDTO;
import com.subsidy.model.OprAdmDictDO;
import com.baomidou.mybatisplus.extension.service.IService;
import com.subsidy.vo.opr.GetHistoryVO;
/**
* <p>
* 审计表 服务类
* </p>
*
* @author DengMin
* @since 2021-12-13
*/
public interface OprAdmDictService extends IService<OprAdmDictDO> {
IPage<GetHistoryVO> getHistory(GetHistoryDTO getHistoryDTO);
}
package com.subsidy.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.subsidy.dto.opr.GetHistoryDTO;
import com.subsidy.model.OprMemDictDO;
import com.baomidou.mybatisplus.extension.service.IService;
import com.subsidy.vo.opr.GetHistoryVO;
/**
* <p>
* 审计表 服务类
* </p>
*
* @author DengMin
* @since 2021-12-13
*/
public interface OprMemDictService extends IService<OprMemDictDO> {
IPage<GetHistoryVO> getHistory(GetHistoryDTO getHistoryDTO);
}
...@@ -14,7 +14,6 @@ import com.subsidy.model.*; ...@@ -14,7 +14,6 @@ import com.subsidy.model.*;
import com.subsidy.service.AdministerService; import com.subsidy.service.AdministerService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.util.*; import com.subsidy.util.*;
import com.subsidy.util.excel.ExcelColumn;
import com.subsidy.util.excel.ExcelUtil; import com.subsidy.util.excel.ExcelUtil;
import com.subsidy.vo.administer.*; import com.subsidy.vo.administer.*;
import com.subsidy.vo.classdict.ClassDetailVO; import com.subsidy.vo.classdict.ClassDetailVO;
...@@ -49,7 +48,6 @@ import org.springframework.web.multipart.MultipartFile; ...@@ -49,7 +48,6 @@ import org.springframework.web.multipart.MultipartFile;
import javax.servlet.ServletOutputStream; import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.*; import java.io.*;
import java.lang.reflect.Member;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.text.ParseException; import java.text.ParseException;
...@@ -109,6 +107,9 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis ...@@ -109,6 +107,9 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
@Autowired @Autowired
private VodDictMapper vodDictMapper; private VodDictMapper vodDictMapper;
@Autowired
private OprAdmDictMapper oprAdmDictMapper;
public LoginVO login(AdministerDO administerDO) { public LoginVO login(AdministerDO administerDO) {
LoginVO loginVO = new LoginVO(); LoginVO loginVO = new LoginVO();
...@@ -117,13 +118,64 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis ...@@ -117,13 +118,64 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
.lambda() .lambda()
.eq(AdministerDO::getAccountName, administerDO.getAccountName())); .eq(AdministerDO::getAccountName, administerDO.getAccountName()));
/**
* 最近5次都输入失败,5分钟后再验证
*/
List<OprAdmDictDO> oprAdmDictDOS = oprAdmDictMapper.getLoginInfo(administerDO1.getId());
boolean flag = false;
for (int i = 0; i < oprAdmDictDOS.size(); i++) {
if (oprAdmDictDOS.get(i).getResult() == 1) {
flag = true;
break;
}
}
if (!flag && oprAdmDictDOS.size() >= 4) {
throw new HttpException(10016);
}
if (null != administerDO1) { if (null != administerDO1) {
if (administerDO.getPassword().equals(administerDO1.getPassword())) { if (administerDO.getPassword().equals(administerDO1.getPassword())) {
String token = JwtUtil.generateToken(administerDO1.getId(), ConstantUtils.ADMINISTER_TERMINATE); String token = JwtUtil.generateToken(administerDO1.getId(), ConstantUtils.ADMINISTER_TERMINATE);
//登录成功,记录日志
OprAdmDictDO oprAdmDictDO = new OprAdmDictDO();
oprAdmDictDO.setUserId(administerDO1.getId());
oprAdmDictDO.setOprType("登录");
oprAdmDictDO.setResult(1);
oprAdmDictMapper.insert(oprAdmDictDO);
loginVO.setToken(token); loginVO.setToken(token);
return loginVO; return loginVO;
} else { } else {
throw new HttpException(10004); //登录失败,记录日志
OprAdmDictDO oprAdmDictDO = new OprAdmDictDO();
oprAdmDictDO.setUserId(administerDO1.getId());
oprAdmDictDO.setOprType("登录");
oprAdmDictDO.setResult(0);
oprAdmDictMapper.insert(oprAdmDictDO);
int i = 0;
for (OprAdmDictDO oad : oprAdmDictDOS) {
if (oad.getResult() == 1) {
break;
}
i++;
}
if (i == 0 ) {
throw new HttpException(10024);
} else if (i == 1) {
throw new HttpException(10023);
} else if (i == 2) {
throw new HttpException(10022);
} else if (i ==3){
throw new HttpException(10021);
}else {
throw new HttpException(10016);
}
} }
} else { } else {
throw new HttpException(10011); throw new HttpException(10011);
...@@ -347,26 +399,25 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis ...@@ -347,26 +399,25 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
classDetailVO.setStudyVodCounts(i); classDetailVO.setStudyVodCounts(i);
//学生测试完成情况 多套卷子各返回最高成绩 //学生测试完成情况 多套卷子各返回最高成绩
List<GetMaxScoreVO> getMaxScoreVOS = exerciseDoneResultMapper.getMaxScore(classDictDO.getId(),classDetailVO.getId()); List<GetMaxScoreVO> getMaxScoreVOS = exerciseDoneResultMapper.getMaxScore(classDictDO.getId(), classDetailVO.getId());
classDetailVO.setGetMaxScoreVOS(getMaxScoreVOS); classDetailVO.setGetMaxScoreVOS(getMaxScoreVOS);
Boolean flag = true; Boolean flag = true;
if (getMaxScoreVOS.size()>0){ if (getMaxScoreVOS.size() > 0) {
for (GetMaxScoreVO getMaxScoreVO : getMaxScoreVOS){ for (GetMaxScoreVO getMaxScoreVO : getMaxScoreVOS) {
if (getMaxScoreVO.getScore()<60){ if (getMaxScoreVO.getScore() < 60) {
flag = false; flag = false;
} }
} }
}else { } else {
flag = false; flag = false;
} }
if (flag && i == vodDictDOS.size()) {
if (flag){
classDetailVO.setResult("合格"); classDetailVO.setResult("合格");
}else { } else {
classDetailVO.setResult("不合格"); classDetailVO.setResult("不合格");
} }
...@@ -393,7 +444,7 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis ...@@ -393,7 +444,7 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
} }
public List<ClassDetailVO> exportClassDetail(ClassDetailDTO classDetailDTO) throws Exception { public List<ClassDetailVO> exportClassDetail(ClassDetailDTO classDetailDTO) throws Exception {
Page pager = new Page(1, 10000000); Page pager = new Page(1, -1L);
IPage<ClassDetailVO> classDetailVOIPage = this.baseMapper.classMembers(pager, classDetailDTO.getId(), classDetailDTO.getUserName()); IPage<ClassDetailVO> classDetailVOIPage = this.baseMapper.classMembers(pager, classDetailDTO.getId(), classDetailDTO.getUserName());
List<ClassDetailVO> classDetailVOS = classDetailVOIPage.getRecords(); List<ClassDetailVO> classDetailVOS = classDetailVOIPage.getRecords();
...@@ -435,29 +486,29 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis ...@@ -435,29 +486,29 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
classDetailVO.setClassProcess(i + "/" + vodDictDOS.size()); classDetailVO.setClassProcess(i + "/" + vodDictDOS.size());
//学生测试完成情况 多套卷子各返回最高成绩 //学生测试完成情况 多套卷子各返回最高成绩
List<GetMaxScoreVO> getMaxScoreVOS = exerciseDoneResultMapper.getMaxScore(classDictDO.getId(),classDetailVO.getId()); List<GetMaxScoreVO> getMaxScoreVOS = exerciseDoneResultMapper.getMaxScore(classDictDO.getId(), classDetailVO.getId());
classDetailVO.setGetMaxScoreVOS(getMaxScoreVOS); classDetailVO.setGetMaxScoreVOS(getMaxScoreVOS);
Boolean flag = true; Boolean flag = true;
StringBuilder stringBuilder = new StringBuilder(); StringBuilder stringBuilder = new StringBuilder();
if (getMaxScoreVOS.size()>0){ if (getMaxScoreVOS.size() > 0) {
for (GetMaxScoreVO getMaxScoreVO : getMaxScoreVOS){ for (GetMaxScoreVO getMaxScoreVO : getMaxScoreVOS) {
stringBuilder.append(getMaxScoreVO.getPaperName()+":"+getMaxScoreVO.getScore()); stringBuilder.append(getMaxScoreVO.getPaperName() + ":" + getMaxScoreVO.getScore());
if (getMaxScoreVO.getScore()<60){ if (getMaxScoreVO.getScore() < 60) {
flag = false; flag = false;
} }
stringBuilder.append(" "); stringBuilder.append(" ");
} }
}else { } else {
flag = false; flag = false;
} }
if (flag){ if (flag && i == vodDictDOS.size()) {
classDetailVO.setResult("合格"); classDetailVO.setResult("合格");
}else { } else {
classDetailVO.setResult("不合格"); classDetailVO.setResult("不合格");
} }
...@@ -558,7 +609,7 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis ...@@ -558,7 +609,7 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
} }
public List<ClassSignVO> exportSignDetail(ClassDetailDTO classDetailDTO) throws Exception { public List<ClassSignVO> exportSignDetail(ClassDetailDTO classDetailDTO) throws Exception {
Page pager = new Page(1, 1000000); Page pager = new Page(1, -1L);
IPage<ClassSignVO> classSignVOIPage = this.baseMapper.classSign(pager, classDetailDTO.getId(), classDetailDTO.getUserName()); IPage<ClassSignVO> classSignVOIPage = this.baseMapper.classSign(pager, classDetailDTO.getId(), classDetailDTO.getUserName());
List<ClassSignVO> classSignVOS = classSignVOIPage.getRecords(); List<ClassSignVO> classSignVOS = classSignVOIPage.getRecords();
...@@ -661,7 +712,7 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis ...@@ -661,7 +712,7 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
} }
public List<ExerciseTestVO> exportExerciseTest(ClassDetailDTO classDetailDTO) throws Exception { public List<ExerciseTestVO> exportExerciseTest(ClassDetailDTO classDetailDTO) throws Exception {
Page pager = new Page(0, 1000000); Page pager = new Page(0, -1L);
IPage<ExerciseTestVO> exerciseTestVOIPage = this.baseMapper.exerciseTest(pager, classDetailDTO.getId(), classDetailDTO.getUserName()); IPage<ExerciseTestVO> exerciseTestVOIPage = this.baseMapper.exerciseTest(pager, classDetailDTO.getId(), classDetailDTO.getUserName());
List<ExerciseTestVO> exerciseTestVOS = exerciseTestVOIPage.getRecords(); List<ExerciseTestVO> exerciseTestVOS = exerciseTestVOIPage.getRecords();
...@@ -708,7 +759,7 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis ...@@ -708,7 +759,7 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
} }
public List<AnswerRecordVO> exportAnswerRecord(ClassDetailDTO classDetailDTO) throws Exception { public List<AnswerRecordVO> exportAnswerRecord(ClassDetailDTO classDetailDTO) throws Exception {
Page pager = new Page(1, 1000000); Page pager = new Page(1, -1L);
IPage iPage = this.baseMapper.answerRecord(pager, classDetailDTO.getId(), classDetailDTO.getUserName()); IPage iPage = this.baseMapper.answerRecord(pager, classDetailDTO.getId(), classDetailDTO.getUserName());
List<AnswerRecordVO> answerRecordVOS = iPage.getRecords(); List<AnswerRecordVO> answerRecordVOS = iPage.getRecords();
...@@ -728,11 +779,11 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis ...@@ -728,11 +779,11 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
//获取班级成员 //获取班级成员
List<Long> memberIds = classMemberMappingMapper.getClassMembers(classVodInfoDTO.getClassId()); List<Long> memberIds = classMemberMappingMapper.getClassMembers(classVodInfoDTO.getClassId());
List<VodDictDO> vodDictDOS = vodDictMapper.getCourseVods(classVodInfoDTO.getCourseId(),classVodInfoDTO.getVodName()); List<VodDictDO> vodDictDOS = vodDictMapper.getCourseVods(classVodInfoDTO.getCourseId(), classVodInfoDTO.getVodName());
for (VodDictDO vodDictDO : vodDictDOS) { for (VodDictDO vodDictDO : vodDictDOS) {
//获取这个视频的学习人数和平均学习时长 //获取这个视频的学习人数和平均学习时长
ClassVodCompleteInfoVO classVodCompleteInfoVO = vodDictMapper.classVodCompleteInfo(classVodInfoDTO.getClassId(), memberIds,classVodInfoDTO.getVodName()); ClassVodCompleteInfoVO classVodCompleteInfoVO = vodDictMapper.classVodCompleteInfo(classVodInfoDTO.getClassId(), vodDictDO.getId(),memberIds, classVodInfoDTO.getVodName());
ClassVodInfoVO classVodInfoVO = new ClassVodInfoVO(); ClassVodInfoVO classVodInfoVO = new ClassVodInfoVO();
classVodInfoVO.setVodName(vodDictDO.getVodName()); classVodInfoVO.setVodName(vodDictDO.getVodName());
classVodInfoVO.setStudyCnt(classVodCompleteInfoVO.getCnt()); classVodInfoVO.setStudyCnt(classVodCompleteInfoVO.getCnt());
...@@ -897,9 +948,9 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis ...@@ -897,9 +948,9 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
.eq(MemberDO::getCompanyId, companyId)); .eq(MemberDO::getCompanyId, companyId));
if (memberDOS.size() > 0) { if (memberDOS.size() > 0) {
String usernames = userName(accountName, 0, companyId); String usernames = userName(accountName, 0, companyId);
memberDO1.setAccountName(usernames.replace("u:","v")); memberDO1.setAccountName(usernames.replace("u:", "v"));
} else { } else {
memberDO1.setAccountName(accountName.replace("u:","v")); memberDO1.setAccountName(accountName.replace("u:", "v"));
} }
} catch (BadHanyuPinyinOutputFormatCombination ex) { } catch (BadHanyuPinyinOutputFormatCombination ex) {
......
package com.subsidy.service.impl; package com.subsidy.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.subsidy.mapper.MemberMapper;
import com.subsidy.mapper.VodPlayHistoryMapper; import com.subsidy.mapper.VodPlayHistoryMapper;
import com.subsidy.model.ClassHourDictDO; import com.subsidy.model.ClassHourDictDO;
import com.subsidy.mapper.ClassHourDictMapper; import com.subsidy.mapper.ClassHourDictMapper;
import com.subsidy.model.MemberDO;
import com.subsidy.model.VodPlayHistoryDO; import com.subsidy.model.VodPlayHistoryDO;
import com.subsidy.service.ClassHourDictService; import com.subsidy.service.ClassHourDictService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
...@@ -32,6 +34,9 @@ public class ClassHourDictServiceImpl extends ServiceImpl<ClassHourDictMapper, C ...@@ -32,6 +34,9 @@ public class ClassHourDictServiceImpl extends ServiceImpl<ClassHourDictMapper, C
@Autowired @Autowired
private VodPlayHistoryMapper vodPlayHistoryMapper; private VodPlayHistoryMapper vodPlayHistoryMapper;
@Autowired
private MemberMapper memberMapper;
public ClassHourDictDO getSetting(ClassHourDictDO classHourDictDO) { public ClassHourDictDO getSetting(ClassHourDictDO classHourDictDO) {
ClassHourDictDO classHourDictDO1 = this.baseMapper.selectOne(new QueryWrapper<ClassHourDictDO>() ClassHourDictDO classHourDictDO1 = this.baseMapper.selectOne(new QueryWrapper<ClassHourDictDO>()
.lambda() .lambda()
...@@ -62,10 +67,14 @@ public class ClassHourDictServiceImpl extends ServiceImpl<ClassHourDictMapper, C ...@@ -62,10 +67,14 @@ public class ClassHourDictServiceImpl extends ServiceImpl<ClassHourDictMapper, C
PollingGetVO pollingGetVO = new PollingGetVO(); PollingGetVO pollingGetVO = new PollingGetVO();
MemberDO memberDO = memberMapper.selectById(vodPlayHistoryDO.getMemberId());
//查看系统设定的时长 //查看系统设定的时长
ClassHourDictDO classHourDictDO = classHourDictMapper.selectOne(new QueryWrapper<ClassHourDictDO>() ClassHourDictDO classHourDictDO = classHourDictMapper.selectOne(new QueryWrapper<ClassHourDictDO>()
.lambda() .lambda()
.eq(ClassHourDictDO::getStatus,1)); .eq(ClassHourDictDO::getStatus,1)
.eq(ClassHourDictDO::getCompanyId,memberDO.getCompanyId()));
if (null == classHourDictDO){ if (null == classHourDictDO){
pollingGetVO.setBool(false); pollingGetVO.setBool(false);
return pollingGetVO; return pollingGetVO;
......
...@@ -135,10 +135,10 @@ public class ExerciseDictServiceImpl extends ServiceImpl<ExerciseDictMapper, Exe ...@@ -135,10 +135,10 @@ public class ExerciseDictServiceImpl extends ServiceImpl<ExerciseDictMapper, Exe
exerciseDoneResultDO.setResult("不合格"); exerciseDoneResultDO.setResult("不合格");
} }
exerciseDoneResultMapper.delete(new QueryWrapper<ExerciseDoneResultDO>() //exerciseDoneResultMapper.delete(new QueryWrapper<ExerciseDoneResultDO>()
.lambda() // .lambda()
.eq(ExerciseDoneResultDO::getMemberId, submitDTO.getMemberId()) // .eq(ExerciseDoneResultDO::getMemberId, submitDTO.getMemberId())
.eq(ExerciseDoneResultDO::getCourseId, submitDTO.getCourseId())); // .eq(ExerciseDoneResultDO::getCourseId, submitDTO.getCourseId()));
exerciseDoneResultMapper.insert(exerciseDoneResultDO); exerciseDoneResultMapper.insert(exerciseDoneResultDO);
......
...@@ -80,6 +80,9 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple ...@@ -80,6 +80,9 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
@Autowired @Autowired
private ClassHourDictMapper classHourDictMapper; private ClassHourDictMapper classHourDictMapper;
@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());
...@@ -205,6 +208,11 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple ...@@ -205,6 +208,11 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
} }
if ("冻结".equals(memberDO.getStatus())) { if ("冻结".equals(memberDO.getStatus())) {
OprMemDictDO oprMemDictDO = new OprMemDictDO();
oprMemDictDO.setUserId(memberDO.getId());
oprMemDictDO.setOprType("登录");
oprMemDictDO.setResult(0);
oprMemDictMapper.insert(oprMemDictDO);
throw new HttpException(10013); throw new HttpException(10013);
} }
...@@ -221,22 +229,54 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple ...@@ -221,22 +229,54 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
.eq(SmsVerifyCodeDO::getVerifyCode, verifyCodeDTO.getVerifyCode()) .eq(SmsVerifyCodeDO::getVerifyCode, verifyCodeDTO.getVerifyCode())
.gt(SmsVerifyCodeDO::getCreateDate, LocalDateTime.now().minusMinutes(30L))); .gt(SmsVerifyCodeDO::getCreateDate, LocalDateTime.now().minusMinutes(30L)));
if (smsCodeDO == null) { if (smsCodeDO == null) {
OprMemDictDO oprMemDictDO = new OprMemDictDO();
oprMemDictDO.setUserId(memberDO.getId());
oprMemDictDO.setOprType("登录");
oprMemDictDO.setResult(0);
oprMemDictMapper.insert(oprMemDictDO);
throw new HttpException(70010); throw new HttpException(70010);
} }
OprMemDictDO oprMemDictDO = new OprMemDictDO();
oprMemDictDO.setUserId(memberDO.getId());
oprMemDictDO.setOprType("登录");
oprMemDictDO.setResult(1);
oprMemDictMapper.insert(oprMemDictDO);
return userRoleVO; return userRoleVO;
} }
public UserRoleVO passwordLogin(PasswordLoginDTO passwordLoginDTO) { public UserRoleVO passwordLogin(PasswordLoginDTO passwordLoginDTO) {
UserRoleVO userRoleVO = this.baseMapper.passwordLogin(passwordLoginDTO); UserRoleVO userRoleVO = this.baseMapper.passwordLogin(passwordLoginDTO);
if (userRoleVO == null) { if (userRoleVO == null) {
throw new HttpException(10004); throw new HttpException(10017);
} }
if ("冻结".equals(userRoleVO.getStatus())) { if (!userRoleVO.getPassword().equals(passwordLoginDTO.getPassword())){
throw new HttpException(10014); OprMemDictDO oprMemDictDO = new OprMemDictDO();
oprMemDictDO.setUserId(userRoleVO.getId());
oprMemDictDO.setOprType("登录");
oprMemDictDO.setResult(0);
oprMemDictMapper.insert(oprMemDictDO);
throw new HttpException(10016);
} }
if (0 == userRoleVO.getFirstLogin()) {
if (0==userRoleVO.getFirstLogin()){
OprMemDictDO oprMemDictDO = new OprMemDictDO();
oprMemDictDO.setUserId(userRoleVO.getId());
oprMemDictDO.setOprType("登录");
oprMemDictDO.setResult(0);
oprMemDictMapper.insert(oprMemDictDO);
throw new HttpException(10015); throw new HttpException(10015);
} }
if ("冻结".equals(userRoleVO.getStatus())) {
throw new HttpException(10014);
}
OprMemDictDO oprMemDictDO = new OprMemDictDO();
oprMemDictDO.setUserId(userRoleVO.getId());
oprMemDictDO.setOprType("登录");
oprMemDictDO.setResult(1);
oprMemDictMapper.insert(oprMemDictDO);
return userRoleVO; return userRoleVO;
} }
......
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.model.OprAdmDictDO;
import com.subsidy.mapper.OprAdmDictMapper;
import com.subsidy.service.OprAdmDictService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.vo.opr.GetHistoryVO;
import org.springframework.stereotype.Service;
/**
* <p>
* 审计表 服务实现类
* </p>
*
* @author DengMin
* @since 2021-12-13
*/
@Service
public class OprAdmDictServiceImpl extends ServiceImpl<OprAdmDictMapper, OprAdmDictDO> implements OprAdmDictService {
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());
}
}
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.model.OprMemDictDO;
import com.subsidy.mapper.OprMemDictMapper;
import com.subsidy.service.OprMemDictService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.vo.opr.GetHistoryVO;
import org.springframework.stereotype.Service;
/**
* <p>
* 审计表 服务实现类
* </p>
*
* @author DengMin
* @since 2021-12-13
*/
@Service
public class OprMemDictServiceImpl extends ServiceImpl<OprMemDictMapper, OprMemDictDO> implements OprMemDictService {
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());
}
}
package com.subsidy.util; package com.subsidy.util;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.Date; import java.util.Date;
/** /**
...@@ -73,4 +76,13 @@ public class DateFormatUtil { ...@@ -73,4 +76,13 @@ public class DateFormatUtil {
SimpleDateFormat sdf = new SimpleDateFormat("s m H d M ? yyyy"); SimpleDateFormat sdf = new SimpleDateFormat("s m H d M ? yyyy");
return sdf.format(date); return sdf.format(date);
} }
public static Date localDateTimeToDate(LocalDateTime dateTime) {
if(dateTime == null) {
return null;
}
ZoneId zoneId = ZoneId.systemDefault();
ZonedDateTime zdt = dateTime.atZone(zoneId);
return Date.from(zdt.toInstant());
}
} }
...@@ -17,5 +17,7 @@ public class UserRoleVO { ...@@ -17,5 +17,7 @@ public class UserRoleVO {
private Integer firstLogin; private Integer firstLogin;
private String password;
} }
package com.subsidy.vo.opr;
import lombok.Data;
@Data
public class GetHistoryVO {
private Integer id;
private String userName;
private String companyName;
private String oprType;
private String createDate;
private String result;
}
# 本地环境配置 # 本地环境配置
# 数据源配置 # 数据源配置
spring.datasource.url=jdbc:mysql://116.62.57.92:3306/subsidy_test?autoReconnect=true&useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8 spring.datasource.url=jdbc:mysql://47.97.19.66:3306/subsidy?autoReconnect=true&useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
#spring.datasource.username=ykadmin_new #spring.datasource.username=ykadmin_new
......
...@@ -27,7 +27,7 @@ mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl ...@@ -27,7 +27,7 @@ mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
spring.servlet.multipart.max-file-size=2048KB spring.servlet.multipart.max-file-size=2048KB
spring.servlet.multipart.max-request-size=4098KB spring.servlet.multipart.max-request-size=4098KB
wechat.appId= wx7785293ff5e31f14 #wechat.appId= wx7785293ff5e31f14
wechat.appSecret= 25d57cad61fc1b45b3afa46d4c35e8f6 #wechat.appSecret= 25d57cad61fc1b45b3afa46d4c35e8f6
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.profiles.active=prod spring.profiles.active=dev
# 端口号 # 端口号
spring.server.port=23454 spring.server.port=23454
#嵌入tomcat配置 #嵌入tomcat配置
......
...@@ -9,6 +9,12 @@ meishu.code-message[10011]=成员信息不存在 ...@@ -9,6 +9,12 @@ meishu.code-message[10011]=成员信息不存在
meishu.code-message[10013]=账户已冻结,请联系账户管理员 meishu.code-message[10013]=账户已冻结,请联系账户管理员
meishu.code-message[10014]=该成员已存在,请勿重复添加 meishu.code-message[10014]=该成员已存在,请勿重复添加
meishu.code-message[10015]=首次登录请使用验证码登录 meishu.code-message[10015]=首次登录请使用验证码登录
meishu.code-message[10016]=密码输入错误,请稍后再试
meishu.code-message[10017]=该公司不存在该员工
meishu.code-message[10021]=密码输入错误,您还可以输入1次密码
meishu.code-message[10022]=密码输入错误,您还可以输入2次密码
meishu.code-message[10023]=密码输入错误,您还可以输入3次密码
meishu.code-message[10024]=密码输入错误,您还可以输入4次密码
meishu.code-message[20001]=该课程已存在 meishu.code-message[20001]=该课程已存在
......
...@@ -31,13 +31,13 @@ ...@@ -31,13 +31,13 @@
t.user_name, t.user_name,
t.image, t.image,
t.status, t.status,
t.first_login t.first_login,
t.password
FROM FROM
member t member t
WHERE WHERE
t.delete_date IS NULL t.delete_date IS NULL
AND t.account_name = #{accountName} AND t.account_name = #{accountName}
AND t.PASSWORD = #{password}
AND t.company_id =#{companyId} AND t.company_id =#{companyId}
</select> </select>
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.subsidy.mapper.OprAdmDictMapper">
<!-- 通用查询映射结果 -->
<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" />
<result column="delete_date" property="deleteDate" />
<result column="user_id" property="userId" />
<result column="opr_type" property="oprType" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
create_date,
update_date,
delete_date,
id, user_id, opr_type
</sql>
<select id="getHistory" resultType="com.subsidy.vo.opr.GetHistoryVO">
SELECT
t.id,
t2.account_name as userName,
t3.company_name,
t.opr_type,
t.create_date,
t.result
FROM
opr_adm_dict t
LEFT JOIN administer t2 ON t.user_id = t2.id
LEFT JOIN company_dict t3 ON t2.company_id = t3.id
WHERE
t.delete_date IS NULL
AND t2.delete_date IS NULL
AND t3.delete_date IS NULL
<if test="userName != null and userName !=''">
and t2.account_name like concat('%',#{userName} ,'%')
</if>
AND DATE_FORMAT( t.create_date, '%Y-%m-%d' ) BETWEEN DATE_FORMAT( #{startDate}, '%Y-%m-%d' )
AND DATE_FORMAT( #{endDate}, '%Y-%m-%d' )
ORDER BY
t.create_date DESC
</select>
<select id="getLoginInfo" parameterType="long" resultType="com.subsidy.model.OprAdmDictDO">
SELECT
*
FROM
(
SELECT
*
FROM
opr_adm_dict t
where t.delete_date is null
and t.user_id = #{userId}
and DATE_FORMAT(t.create_date,'%Y-%m-%d') =DATE_FORMAT(now(), '%Y-%m-%d')
and TIMESTAMPDIFF(SECOND,t.create_date,now()) &lt;= 300
ORDER BY
t.create_date DESC
LIMIT 5)t2
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.subsidy.mapper.OprMemDictMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.subsidy.model.OprMemDictDO">
<id column="id" property="id" />
<result column="create_date" property="createDate" />
<result column="update_date" property="updateDate" />
<result column="delete_date" property="deleteDate" />
<result column="user_id" property="userId" />
<result column="opr_type" property="oprType" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
create_date,
update_date,
delete_date,
id, user_id, opr_type
</sql>
<select id="getHistory" resultType="com.subsidy.vo.opr.GetHistoryVO">
SELECT
t.id,
t2.user_name,
t3.company_name,
t.opr_type,
t.create_date,
t.result
FROM
opr_mem_dict t
LEFT JOIN member t2 ON t.user_id = t2.id
LEFT JOIN company_dict t3 ON t2.company_id = t3.id
WHERE
t.delete_date IS NULL
AND t2.delete_date IS NULL
AND t3.delete_date IS NULL
<if test="userName != null and userName !=''">
and t2.user_name like concat('%',#{userName} ,'%')
</if>
AND DATE_FORMAT( t.create_date, '%Y-%m-%d' ) BETWEEN DATE_FORMAT( #{startDate}, '%Y-%m-%d' )
AND DATE_FORMAT( #{endDate}, '%Y-%m-%d' )
ORDER BY
t.create_date DESC
</select>
</mapper>
...@@ -65,6 +65,7 @@ ...@@ -65,6 +65,7 @@
vod_play_history t vod_play_history t
WHERE WHERE
t.class_id = #{classId} t.class_id = #{classId}
and t.vod_id = #{vodId}
AND t.member_id IN AND t.member_id IN
<foreach collection="memberIds" item="id" index="index" open="(" close=")" separator=","> <foreach collection="memberIds" item="id" index="index" open="(" close=")" separator=",">
#{id} #{id}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!