From 93b423e75121d3cf73f58d62b7ff691d3752de1a Mon Sep 17 00:00:00 2001 From: Administrator Date: Fri, 17 Dec 2021 18:26:14 +0800 Subject: [PATCH] 审计功能 --- src/main/java/com/subsidy/controller/AdministerController.java | 6 ++++-- src/main/java/com/subsidy/controller/OprAdmDictController.java | 39 +++++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/controller/OprMemDictController.java | 40 ++++++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/dto/opr/GetHistoryDTO.java | 18 ++++++++++++++++++ src/main/java/com/subsidy/mapper/OprAdmDictMapper.java | 33 +++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/mapper/OprMemDictMapper.java | 22 ++++++++++++++++++++++ src/main/java/com/subsidy/mapper/VodDictMapper.java | 2 +- src/main/java/com/subsidy/model/OprAdmDictDO.java | 43 +++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/model/OprMemDictDO.java | 43 +++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/service/OprAdmDictService.java | 21 +++++++++++++++++++++ src/main/java/com/subsidy/service/OprMemDictService.java | 21 +++++++++++++++++++++ src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java | 107 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------- src/main/java/com/subsidy/service/impl/ClassHourDictServiceImpl.java | 11 ++++++++++- src/main/java/com/subsidy/service/impl/ExerciseDictServiceImpl.java | 8 ++++---- src/main/java/com/subsidy/service/impl/MemberServiceImpl.java | 48 ++++++++++++++++++++++++++++++++++++++++++++---- src/main/java/com/subsidy/service/impl/OprAdmDictServiceImpl.java | 30 ++++++++++++++++++++++++++++++ src/main/java/com/subsidy/service/impl/OprMemDictServiceImpl.java | 31 +++++++++++++++++++++++++++++++ src/main/java/com/subsidy/util/DateFormatUtil.java | 12 ++++++++++++ src/main/java/com/subsidy/vo/administer/UserRoleVO.java | 2 ++ src/main/java/com/subsidy/vo/opr/GetHistoryVO.java | 20 ++++++++++++++++++++ src/main/resources/application-dev.properties | 2 +- src/main/resources/application-prod.properties | 8 ++++---- src/main/resources/application.properties | 2 +- src/main/resources/code.properties | 6 ++++++ src/main/resources/mapper/MemberMapper.xml | 4 ++-- src/main/resources/mapper/OprAdmDictMapper.xml | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/resources/mapper/OprMemDictMapper.xml | 47 +++++++++++++++++++++++++++++++++++++++++++++++ src/main/resources/mapper/VodDictMapper.xml | 1 + 28 files changed, 646 insertions(+), 48 deletions(-) create mode 100644 src/main/java/com/subsidy/controller/OprAdmDictController.java create mode 100644 src/main/java/com/subsidy/controller/OprMemDictController.java create mode 100644 src/main/java/com/subsidy/dto/opr/GetHistoryDTO.java create mode 100644 src/main/java/com/subsidy/mapper/OprAdmDictMapper.java create mode 100644 src/main/java/com/subsidy/mapper/OprMemDictMapper.java create mode 100644 src/main/java/com/subsidy/model/OprAdmDictDO.java create mode 100644 src/main/java/com/subsidy/model/OprMemDictDO.java create mode 100644 src/main/java/com/subsidy/service/OprAdmDictService.java create mode 100644 src/main/java/com/subsidy/service/OprMemDictService.java create mode 100644 src/main/java/com/subsidy/service/impl/OprAdmDictServiceImpl.java create mode 100644 src/main/java/com/subsidy/service/impl/OprMemDictServiceImpl.java create mode 100644 src/main/java/com/subsidy/vo/opr/GetHistoryVO.java create mode 100644 src/main/resources/mapper/OprAdmDictMapper.xml create mode 100644 src/main/resources/mapper/OprMemDictMapper.xml diff --git a/src/main/java/com/subsidy/controller/AdministerController.java b/src/main/java/com/subsidy/controller/AdministerController.java index bce4b88..11322d7 100644 --- a/src/main/java/com/subsidy/controller/AdministerController.java +++ b/src/main/java/com/subsidy/controller/AdministerController.java @@ -103,14 +103,14 @@ 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)); } @PostMapping("exportClassDetail") @ApiOperation("** 班级管理--班级成员--导出 id 班级id userName") -// @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) + //@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) public void exportClassDetail(@RequestBody ClassDetailDTO classDetailDTO)throws Exception{ classDetailDTO.setFlag(true); administerService.exportClassDetail(classDetailDTO); @@ -200,4 +200,6 @@ public class AdministerController { return ResponseData.generateCreatedResponse(0,administerService.importMember(companyId,file)); } + + } diff --git a/src/main/java/com/subsidy/controller/OprAdmDictController.java b/src/main/java/com/subsidy/controller/OprAdmDictController.java new file mode 100644 index 0000000..0bf6cc3 --- /dev/null +++ b/src/main/java/com/subsidy/controller/OprAdmDictController.java @@ -0,0 +1,39 @@ +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; + +/** + *

+ * 审计表 前端控制器 + *

+ * + * @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)); + } + +} diff --git a/src/main/java/com/subsidy/controller/OprMemDictController.java b/src/main/java/com/subsidy/controller/OprMemDictController.java new file mode 100644 index 0000000..c2215ae --- /dev/null +++ b/src/main/java/com/subsidy/controller/OprMemDictController.java @@ -0,0 +1,40 @@ +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; + +/** + *

+ * 审计表 前端控制器 + *

+ * + * @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)); + } + +} diff --git a/src/main/java/com/subsidy/dto/opr/GetHistoryDTO.java b/src/main/java/com/subsidy/dto/opr/GetHistoryDTO.java new file mode 100644 index 0000000..de3e498 --- /dev/null +++ b/src/main/java/com/subsidy/dto/opr/GetHistoryDTO.java @@ -0,0 +1,18 @@ +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; + +} diff --git a/src/main/java/com/subsidy/mapper/OprAdmDictMapper.java b/src/main/java/com/subsidy/mapper/OprAdmDictMapper.java new file mode 100644 index 0000000..774ba82 --- /dev/null +++ b/src/main/java/com/subsidy/mapper/OprAdmDictMapper.java @@ -0,0 +1,33 @@ +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; + +/** + *

+ * 审计表 Mapper 接口 + *

+ * + * @author DengMin + * @since 2021-12-13 + */ +@Repository +public interface OprAdmDictMapper extends BaseMapper { + + /** + * 查看管理员的登录审计 + */ + IPage getHistory(IPage page,String userName,String startDate,String endDate); + + /** + * 查看某为成员最近登录情况 五天超过次数 + */ + List getLoginInfo(Long userId); + + +} diff --git a/src/main/java/com/subsidy/mapper/OprMemDictMapper.java b/src/main/java/com/subsidy/mapper/OprMemDictMapper.java new file mode 100644 index 0000000..0719384 --- /dev/null +++ b/src/main/java/com/subsidy/mapper/OprMemDictMapper.java @@ -0,0 +1,22 @@ +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; + +/** + *

+ * 审计表 Mapper 接口 + *

+ * + * @author DengMin + * @since 2021-12-13 + */ +@Repository +public interface OprMemDictMapper extends BaseMapper { + + IPage getHistory(IPage page,String userName,String startDate,String endDate); + +} diff --git a/src/main/java/com/subsidy/mapper/VodDictMapper.java b/src/main/java/com/subsidy/mapper/VodDictMapper.java index 08ca4b5..72fcae5 100644 --- a/src/main/java/com/subsidy/mapper/VodDictMapper.java +++ b/src/main/java/com/subsidy/mapper/VodDictMapper.java @@ -33,5 +33,5 @@ public interface VodDictMapper extends BaseMapper { /** * 获取某课程下,学习人数和平均学习时长 */ - ClassVodCompleteInfoVO classVodCompleteInfo(Long classId, List memberIds,String vodName); + ClassVodCompleteInfoVO classVodCompleteInfo(Long classId, Long vodId,List memberIds,String vodName); } diff --git a/src/main/java/com/subsidy/model/OprAdmDictDO.java b/src/main/java/com/subsidy/model/OprAdmDictDO.java new file mode 100644 index 0000000..8ece55c --- /dev/null +++ b/src/main/java/com/subsidy/model/OprAdmDictDO.java @@ -0,0 +1,43 @@ +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; + +/** + *

+ * 审计表 + *

+ * + * @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; + +} diff --git a/src/main/java/com/subsidy/model/OprMemDictDO.java b/src/main/java/com/subsidy/model/OprMemDictDO.java new file mode 100644 index 0000000..252bbc1 --- /dev/null +++ b/src/main/java/com/subsidy/model/OprMemDictDO.java @@ -0,0 +1,43 @@ +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; + +/** + *

+ * 审计表 + *

+ * + * @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; + +} diff --git a/src/main/java/com/subsidy/service/OprAdmDictService.java b/src/main/java/com/subsidy/service/OprAdmDictService.java new file mode 100644 index 0000000..092b88c --- /dev/null +++ b/src/main/java/com/subsidy/service/OprAdmDictService.java @@ -0,0 +1,21 @@ +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; + +/** + *

+ * 审计表 服务类 + *

+ * + * @author DengMin + * @since 2021-12-13 + */ +public interface OprAdmDictService extends IService { + + IPage getHistory(GetHistoryDTO getHistoryDTO); + +} diff --git a/src/main/java/com/subsidy/service/OprMemDictService.java b/src/main/java/com/subsidy/service/OprMemDictService.java new file mode 100644 index 0000000..294ac35 --- /dev/null +++ b/src/main/java/com/subsidy/service/OprMemDictService.java @@ -0,0 +1,21 @@ +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; + +/** + *

+ * 审计表 服务类 + *

+ * + * @author DengMin + * @since 2021-12-13 + */ +public interface OprMemDictService extends IService { + + IPage getHistory(GetHistoryDTO getHistoryDTO); + +} diff --git a/src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java b/src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java index 84a990a..56d92ad 100644 --- a/src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java @@ -14,7 +14,6 @@ import com.subsidy.model.*; import com.subsidy.service.AdministerService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.subsidy.util.*; -import com.subsidy.util.excel.ExcelColumn; import com.subsidy.util.excel.ExcelUtil; import com.subsidy.vo.administer.*; import com.subsidy.vo.classdict.ClassDetailVO; @@ -49,7 +48,6 @@ import org.springframework.web.multipart.MultipartFile; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletResponse; import java.io.*; -import java.lang.reflect.Member; import java.math.BigDecimal; import java.nio.charset.StandardCharsets; import java.text.ParseException; @@ -109,6 +107,9 @@ public class AdministerServiceImpl extends ServiceImpl 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 (administerDO.getPassword().equals(administerDO1.getPassword())) { 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); return loginVO; } 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 { throw new HttpException(10011); @@ -347,26 +399,25 @@ public class AdministerServiceImpl extends ServiceImpl getMaxScoreVOS = exerciseDoneResultMapper.getMaxScore(classDictDO.getId(),classDetailVO.getId()); + List getMaxScoreVOS = exerciseDoneResultMapper.getMaxScore(classDictDO.getId(), classDetailVO.getId()); classDetailVO.setGetMaxScoreVOS(getMaxScoreVOS); Boolean flag = true; - if (getMaxScoreVOS.size()>0){ - for (GetMaxScoreVO getMaxScoreVO : getMaxScoreVOS){ - if (getMaxScoreVO.getScore()<60){ + if (getMaxScoreVOS.size() > 0) { + for (GetMaxScoreVO getMaxScoreVO : getMaxScoreVOS) { + if (getMaxScoreVO.getScore() < 60) { flag = false; } } - }else { - flag = false; + } else { + flag = false; } - - if (flag){ + if (flag && i == vodDictDOS.size()) { classDetailVO.setResult("合格"); - }else { + } else { classDetailVO.setResult("不合格"); } @@ -393,7 +444,7 @@ public class AdministerServiceImpl extends ServiceImpl exportClassDetail(ClassDetailDTO classDetailDTO) throws Exception { - Page pager = new Page(1, 10000000); + Page pager = new Page(1, -1L); IPage classDetailVOIPage = this.baseMapper.classMembers(pager, classDetailDTO.getId(), classDetailDTO.getUserName()); List classDetailVOS = classDetailVOIPage.getRecords(); @@ -435,29 +486,29 @@ public class AdministerServiceImpl extends ServiceImpl getMaxScoreVOS = exerciseDoneResultMapper.getMaxScore(classDictDO.getId(),classDetailVO.getId()); + List getMaxScoreVOS = exerciseDoneResultMapper.getMaxScore(classDictDO.getId(), classDetailVO.getId()); classDetailVO.setGetMaxScoreVOS(getMaxScoreVOS); Boolean flag = true; StringBuilder stringBuilder = new StringBuilder(); - if (getMaxScoreVOS.size()>0){ - for (GetMaxScoreVO getMaxScoreVO : getMaxScoreVOS){ - stringBuilder.append(getMaxScoreVO.getPaperName()+":"+getMaxScoreVO.getScore()); - if (getMaxScoreVO.getScore()<60){ + if (getMaxScoreVOS.size() > 0) { + for (GetMaxScoreVO getMaxScoreVO : getMaxScoreVOS) { + stringBuilder.append(getMaxScoreVO.getPaperName() + ":" + getMaxScoreVO.getScore()); + if (getMaxScoreVO.getScore() < 60) { flag = false; } stringBuilder.append(" "); } - }else { + } else { flag = false; } - if (flag){ + if (flag && i == vodDictDOS.size()) { classDetailVO.setResult("合格"); - }else { + } else { classDetailVO.setResult("不合格"); } @@ -558,7 +609,7 @@ public class AdministerServiceImpl extends ServiceImpl exportSignDetail(ClassDetailDTO classDetailDTO) throws Exception { - Page pager = new Page(1, 1000000); + Page pager = new Page(1, -1L); IPage classSignVOIPage = this.baseMapper.classSign(pager, classDetailDTO.getId(), classDetailDTO.getUserName()); List classSignVOS = classSignVOIPage.getRecords(); @@ -661,7 +712,7 @@ public class AdministerServiceImpl extends ServiceImpl exportExerciseTest(ClassDetailDTO classDetailDTO) throws Exception { - Page pager = new Page(0, 1000000); + Page pager = new Page(0, -1L); IPage exerciseTestVOIPage = this.baseMapper.exerciseTest(pager, classDetailDTO.getId(), classDetailDTO.getUserName()); List exerciseTestVOS = exerciseTestVOIPage.getRecords(); @@ -708,7 +759,7 @@ public class AdministerServiceImpl extends ServiceImpl 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()); List answerRecordVOS = iPage.getRecords(); @@ -728,11 +779,11 @@ public class AdministerServiceImpl extends ServiceImpl memberIds = classMemberMappingMapper.getClassMembers(classVodInfoDTO.getClassId()); - List vodDictDOS = vodDictMapper.getCourseVods(classVodInfoDTO.getCourseId(),classVodInfoDTO.getVodName()); + List vodDictDOS = vodDictMapper.getCourseVods(classVodInfoDTO.getCourseId(), classVodInfoDTO.getVodName()); 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.setVodName(vodDictDO.getVodName()); classVodInfoVO.setStudyCnt(classVodCompleteInfoVO.getCnt()); @@ -897,9 +948,9 @@ public class AdministerServiceImpl extends ServiceImpl 0) { String usernames = userName(accountName, 0, companyId); - memberDO1.setAccountName(usernames.replace("u:","v")); + memberDO1.setAccountName(usernames.replace("u:", "v")); } else { - memberDO1.setAccountName(accountName.replace("u:","v")); + memberDO1.setAccountName(accountName.replace("u:", "v")); } } catch (BadHanyuPinyinOutputFormatCombination ex) { diff --git a/src/main/java/com/subsidy/service/impl/ClassHourDictServiceImpl.java b/src/main/java/com/subsidy/service/impl/ClassHourDictServiceImpl.java index df43ee0..61bb337 100644 --- a/src/main/java/com/subsidy/service/impl/ClassHourDictServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/ClassHourDictServiceImpl.java @@ -1,9 +1,11 @@ package com.subsidy.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.subsidy.mapper.MemberMapper; import com.subsidy.mapper.VodPlayHistoryMapper; import com.subsidy.model.ClassHourDictDO; import com.subsidy.mapper.ClassHourDictMapper; +import com.subsidy.model.MemberDO; import com.subsidy.model.VodPlayHistoryDO; import com.subsidy.service.ClassHourDictService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @@ -32,6 +34,9 @@ public class ClassHourDictServiceImpl extends ServiceImpl() .lambda() @@ -62,10 +67,14 @@ public class ClassHourDictServiceImpl extends ServiceImpl() .lambda() - .eq(ClassHourDictDO::getStatus,1)); + .eq(ClassHourDictDO::getStatus,1) + .eq(ClassHourDictDO::getCompanyId,memberDO.getCompanyId())); if (null == classHourDictDO){ pollingGetVO.setBool(false); return pollingGetVO; diff --git a/src/main/java/com/subsidy/service/impl/ExerciseDictServiceImpl.java b/src/main/java/com/subsidy/service/impl/ExerciseDictServiceImpl.java index da9c4d1..8f24136 100644 --- a/src/main/java/com/subsidy/service/impl/ExerciseDictServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/ExerciseDictServiceImpl.java @@ -135,10 +135,10 @@ public class ExerciseDictServiceImpl extends ServiceImpl() - .lambda() - .eq(ExerciseDoneResultDO::getMemberId, submitDTO.getMemberId()) - .eq(ExerciseDoneResultDO::getCourseId, submitDTO.getCourseId())); + //exerciseDoneResultMapper.delete(new QueryWrapper() + // .lambda() + // .eq(ExerciseDoneResultDO::getMemberId, submitDTO.getMemberId()) + // .eq(ExerciseDoneResultDO::getCourseId, submitDTO.getCourseId())); exerciseDoneResultMapper.insert(exerciseDoneResultDO); diff --git a/src/main/java/com/subsidy/service/impl/MemberServiceImpl.java b/src/main/java/com/subsidy/service/impl/MemberServiceImpl.java index 0cd2edd..8ec6a5c 100644 --- a/src/main/java/com/subsidy/service/impl/MemberServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/MemberServiceImpl.java @@ -80,6 +80,9 @@ public class MemberServiceImpl extends ServiceImpl imple @Autowired private ClassHourDictMapper classHourDictMapper; + @Autowired + private OprMemDictMapper oprMemDictMapper; + public IPage getAll(GetAllDTO getAllDTO) { Page pager = new Page(getAllDTO.getPageNum(), getAllDTO.getPageSize()); IPage iPage = this.baseMapper.getMembers(pager, getAllDTO.getDepartmentId(), getAllDTO.getUserName(), getAllDTO.getStatus()); @@ -205,6 +208,11 @@ public class MemberServiceImpl extends ServiceImpl imple } if ("冻结".equals(memberDO.getStatus())) { + OprMemDictDO oprMemDictDO = new OprMemDictDO(); + oprMemDictDO.setUserId(memberDO.getId()); + oprMemDictDO.setOprType("登录"); + oprMemDictDO.setResult(0); + oprMemDictMapper.insert(oprMemDictDO); throw new HttpException(10013); } @@ -221,22 +229,54 @@ public class MemberServiceImpl extends ServiceImpl imple .eq(SmsVerifyCodeDO::getVerifyCode, verifyCodeDTO.getVerifyCode()) .gt(SmsVerifyCodeDO::getCreateDate, LocalDateTime.now().minusMinutes(30L))); if (smsCodeDO == null) { + OprMemDictDO oprMemDictDO = new OprMemDictDO(); + oprMemDictDO.setUserId(memberDO.getId()); + oprMemDictDO.setOprType("登录"); + oprMemDictDO.setResult(0); + oprMemDictMapper.insert(oprMemDictDO); throw new HttpException(70010); } + OprMemDictDO oprMemDictDO = new OprMemDictDO(); + oprMemDictDO.setUserId(memberDO.getId()); + oprMemDictDO.setOprType("登录"); + oprMemDictDO.setResult(1); + oprMemDictMapper.insert(oprMemDictDO); + return userRoleVO; } public UserRoleVO passwordLogin(PasswordLoginDTO passwordLoginDTO) { UserRoleVO userRoleVO = this.baseMapper.passwordLogin(passwordLoginDTO); if (userRoleVO == null) { - throw new HttpException(10004); + throw new HttpException(10017); } - if ("冻结".equals(userRoleVO.getStatus())) { - throw new HttpException(10014); + if (!userRoleVO.getPassword().equals(passwordLoginDTO.getPassword())){ + 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); } + + 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; } diff --git a/src/main/java/com/subsidy/service/impl/OprAdmDictServiceImpl.java b/src/main/java/com/subsidy/service/impl/OprAdmDictServiceImpl.java new file mode 100644 index 0000000..ce9fb6a --- /dev/null +++ b/src/main/java/com/subsidy/service/impl/OprAdmDictServiceImpl.java @@ -0,0 +1,30 @@ +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; + +/** + *

+ * 审计表 服务实现类 + *

+ * + * @author DengMin + * @since 2021-12-13 + */ +@Service +public class OprAdmDictServiceImpl extends ServiceImpl implements OprAdmDictService { + + + public IPage getHistory(GetHistoryDTO getHistoryDTO){ + Page pager = new Page(getHistoryDTO.getPageNum(), getHistoryDTO.getPageSize()); + return this.baseMapper.getHistory(pager,getHistoryDTO.getUserName(),getHistoryDTO.getStartDate(),getHistoryDTO.getEndDate()); + } + +} diff --git a/src/main/java/com/subsidy/service/impl/OprMemDictServiceImpl.java b/src/main/java/com/subsidy/service/impl/OprMemDictServiceImpl.java new file mode 100644 index 0000000..b41bfcb --- /dev/null +++ b/src/main/java/com/subsidy/service/impl/OprMemDictServiceImpl.java @@ -0,0 +1,31 @@ +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; + +/** + *

+ * 审计表 服务实现类 + *

+ * + * @author DengMin + * @since 2021-12-13 + */ +@Service +public class OprMemDictServiceImpl extends ServiceImpl implements OprMemDictService { + + + public IPage getHistory(GetHistoryDTO getHistoryDTO){ + Page pager = new Page(getHistoryDTO.getPageNum(), getHistoryDTO.getPageSize()); + return this.baseMapper.getHistory(pager,getHistoryDTO.getUserName(),getHistoryDTO.getStartDate(),getHistoryDTO.getEndDate()); + } + + +} diff --git a/src/main/java/com/subsidy/util/DateFormatUtil.java b/src/main/java/com/subsidy/util/DateFormatUtil.java index fc5aced..5e9bc25 100644 --- a/src/main/java/com/subsidy/util/DateFormatUtil.java +++ b/src/main/java/com/subsidy/util/DateFormatUtil.java @@ -1,6 +1,9 @@ package com.subsidy.util; import java.text.SimpleDateFormat; +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.time.ZonedDateTime; import java.util.Date; /** @@ -73,4 +76,13 @@ public class DateFormatUtil { SimpleDateFormat sdf = new SimpleDateFormat("s m H d M ? yyyy"); 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()); + } } diff --git a/src/main/java/com/subsidy/vo/administer/UserRoleVO.java b/src/main/java/com/subsidy/vo/administer/UserRoleVO.java index fe920d2..50b084b 100644 --- a/src/main/java/com/subsidy/vo/administer/UserRoleVO.java +++ b/src/main/java/com/subsidy/vo/administer/UserRoleVO.java @@ -17,5 +17,7 @@ public class UserRoleVO { private Integer firstLogin; + private String password; + } diff --git a/src/main/java/com/subsidy/vo/opr/GetHistoryVO.java b/src/main/java/com/subsidy/vo/opr/GetHistoryVO.java new file mode 100644 index 0000000..bb53071 --- /dev/null +++ b/src/main/java/com/subsidy/vo/opr/GetHistoryVO.java @@ -0,0 +1,20 @@ +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; + +} diff --git a/src/main/resources/application-dev.properties b/src/main/resources/application-dev.properties index 63a43af..6ff748a 100644 --- a/src/main/resources/application-dev.properties +++ b/src/main/resources/application-dev.properties @@ -1,7 +1,7 @@ # 本地环境配置 # 数据源配置 -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.driver-class-name=com.mysql.cj.jdbc.Driver #spring.datasource.username=ykadmin_new diff --git a/src/main/resources/application-prod.properties b/src/main/resources/application-prod.properties index 9fb27c2..2f61ade 100644 --- a/src/main/resources/application-prod.properties +++ b/src/main/resources/application-prod.properties @@ -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-request-size=4098KB -wechat.appId= wx7785293ff5e31f14 -wechat.appSecret= 25d57cad61fc1b45b3afa46d4c35e8f6 -wechat.msgUrl= https://teachai.youkehulian.com/login -wechat.templateId= Z1HNPLOrKiHEjfR1KMP-cC-uH3BWqDJIHv365Ev20yQ +#wechat.appId= wx7785293ff5e31f14 +#wechat.appSecret= 25d57cad61fc1b45b3afa46d4c35e8f6 +#wechat.msgUrl= https://teachai.youkehulian.com/login +#wechat.templateId= Z1HNPLOrKiHEjfR1KMP-cC-uH3BWqDJIHv365Ev20yQ diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 7b7f0e5..f65f337 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,5 +1,5 @@ # 环境配置 -spring.profiles.active=prod +spring.profiles.active=dev # 端口号 spring.server.port=23454 #嵌入tomcat配置 diff --git a/src/main/resources/code.properties b/src/main/resources/code.properties index 16a5cfe..bada075 100644 --- a/src/main/resources/code.properties +++ b/src/main/resources/code.properties @@ -9,6 +9,12 @@ meishu.code-message[10011]=成员信息不存在 meishu.code-message[10013]=账户已冻结,请联系账户管理员 meishu.code-message[10014]=该成员已存在,请勿重复添加 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]=该课程已存在 diff --git a/src/main/resources/mapper/MemberMapper.xml b/src/main/resources/mapper/MemberMapper.xml index 4615c75..3086014 100644 --- a/src/main/resources/mapper/MemberMapper.xml +++ b/src/main/resources/mapper/MemberMapper.xml @@ -31,13 +31,13 @@ t.user_name, t.image, t.status, - t.first_login + t.first_login, + t.password FROM member t WHERE t.delete_date IS NULL AND t.account_name = #{accountName} - AND t.PASSWORD = #{password} AND t.company_id =#{companyId} diff --git a/src/main/resources/mapper/OprAdmDictMapper.xml b/src/main/resources/mapper/OprAdmDictMapper.xml new file mode 100644 index 0000000..2c8ab78 --- /dev/null +++ b/src/main/resources/mapper/OprAdmDictMapper.xml @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + create_date, + update_date, + delete_date, + id, user_id, opr_type + + + + + + + + diff --git a/src/main/resources/mapper/OprMemDictMapper.xml b/src/main/resources/mapper/OprMemDictMapper.xml new file mode 100644 index 0000000..209e10d --- /dev/null +++ b/src/main/resources/mapper/OprMemDictMapper.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + create_date, + update_date, + delete_date, + id, user_id, opr_type + + + + diff --git a/src/main/resources/mapper/VodDictMapper.xml b/src/main/resources/mapper/VodDictMapper.xml index 1220b42..1529800 100644 --- a/src/main/resources/mapper/VodDictMapper.xml +++ b/src/main/resources/mapper/VodDictMapper.xml @@ -65,6 +65,7 @@ vod_play_history t WHERE t.class_id = #{classId} + and t.vod_id = #{vodId} AND t.member_id IN #{id} -- libgit2 0.25.0