springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/model/vo/ComplaintVO.java
@@ -24,6 +24,9 @@ @ApiModelProperty(value = "上报人") private String reporter; @ApiModelProperty(value = "上报人联系方式") private String reporterPhone; @ApiModelProperty(value = "所属部门") private String departmentName; springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/IdentityInformationService.java
@@ -11,9 +11,9 @@ * @return 身份信息 */ IdentityInformation getIdentityInformation(LoginUserInfoVO loginUserInfo); // // /** // * 获取当前选中的身份信息 // */ // IdentityInformation getCurrentIdentityInformation(LoginUserInfoVO loginUserInfo); /** * 获取当前选中的身份信息 */ IdentityInformation getCurrentIdentityInformation(LoginUserInfoVO loginUserInfo); } springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/ComplaintServiceImpl.java
@@ -96,13 +96,9 @@ complaint.setSerialNumber(serialNumber); Integer accountLevel = 5; //获取当前身份 IdentityInformation identityInformationVO = identityInformationService.getIdentityInformation(loginUserInfoVO); IdentityInformation identityInformationVO = identityInformationService.getCurrentIdentityInformation(loginUserInfoVO); //1=党员,2=管理员 SystemUser systemUser = identityInformationVO.getSystemUser(); List<PermissionsVO> permissions = identityInformationVO.getPermissions(); if (permissions.isEmpty()) { throw new ServiceException("请先完善个人信息"); } Integer identity = identityInformationVO.getIdentity(); if (identity == 2) { accountLevel = systemUser.getAccountLevel(); @@ -185,10 +181,7 @@ Long targetId = null; Integer accountLevel = 5; //获取当前身份,1=党员,2=管理员 IdentityInformation identityInformation = identityInformationService.getIdentityInformation(loginUserInfoVO); if (CollectionUtil.isEmpty(identityInformation.getPermissions())) { throw new ServiceException("请先完善个人信息"); } IdentityInformation identityInformation = identityInformationService.getCurrentIdentityInformation(loginUserInfoVO); Integer identity = identityInformation.getIdentity(); //上级 if (systemUserByPhone.isPresent() && null != identity && identity == 2) { @@ -368,7 +361,7 @@ String targetId = ""; Integer accountLevel = 5; //获取当前身份,1=党员,2=管理员 IdentityInformation identityInformation = identityInformationService.getIdentityInformation(loginUserInfo); IdentityInformation identityInformation = identityInformationService.getCurrentIdentityInformation(loginUserInfo); if (2 == identityInformation.getIdentity()) { accountLevel = systemUser.getAccountLevel(); switch (accountLevel) { @@ -436,10 +429,7 @@ String targetId = ""; Integer accountLevel = 5; //获取当前身份,1=党员,2=管理员 IdentityInformation identityInformation = identityInformationService.getIdentityInformation(loginUserInfoVO); if (CollectionUtil.isEmpty(identityInformation.getPermissions())) { throw new ServiceException("身份信息异常"); } IdentityInformation identityInformation = identityInformationService.getCurrentIdentityInformation(loginUserInfoVO); Integer identity = identityInformation.getIdentity(); //上级 if (systemUserByPhone.isPresent() && identity == 2) { @@ -581,16 +571,8 @@ @Transactional(rollbackFor = Exception.class) public void saveReport(ComplaintReportDTO dto, LoginUserInfoVO loginUserInfoVO) { String phone = loginUserInfoVO.getPhone(); SystemUser adminUser = systemUserService.getOne(new LambdaQueryWrapper<SystemUser>() .eq(SystemUser::getPhone, phone) .eq(SystemUser::getIsAdmin, 1) .ne(SystemUser::getStatus, 3) .last("LIMIT 1")); IdentityInformation identityInformationVO = identityInformationService.getIdentityInformation(loginUserInfoVO); if (CollectionUtil.isEmpty(identityInformationVO.getPermissions())) { throw new ServiceException("请先完成认证"); } IdentityInformation identityInformationVO = identityInformationService.getCurrentIdentityInformation(loginUserInfoVO); SystemUser adminUser = identityInformationVO.getSystemUser(); Long superiorId; int reportType; @@ -682,11 +664,7 @@ @Override @Transactional(rollbackFor = Exception.class) public void saveDispatch(ComplaintDispatch dto, LoginUserInfoVO loginUserInfoVO) { IdentityInformation identityInformation = identityInformationService.getIdentityInformation(loginUserInfoVO); List<PermissionsVO> permissions = identityInformation.getPermissions(); if (CollectionUtil.isEmpty(permissions)) { throw new ServiceException("请先完成认证"); } IdentityInformation identityInformation = identityInformationService.getCurrentIdentityInformation(loginUserInfoVO); if (identityInformation.getIdentity() != 2) { throw new ServiceException("无权下派"); } @@ -754,11 +732,7 @@ @Transactional(rollbackFor = Exception.class) public void reportAudit(ComplaintReporAuditDTO complaintReporAuditDTO, LoginUserInfoVO loginUserInfoVO) { IdentityInformation identityInformation = identityInformationService.getIdentityInformation(loginUserInfoVO); List<PermissionsVO> permissions = identityInformation.getPermissions(); if (CollectionUtil.isEmpty(permissions)) { throw new ServiceException("请先完成认证"); } IdentityInformation identityInformation = identityInformationService.getCurrentIdentityInformation(loginUserInfoVO); SystemUser systemUser = identityInformation.getSystemUser(); if (systemUser == null || identityInformation.getIdentity() != 2) { @@ -810,12 +784,7 @@ @Override @Transactional(rollbackFor = Exception.class) public void saveDelay(ComplaintDelayDTO dto, LoginUserInfoVO loginUserInfoVO) { IdentityInformation identityInformation = identityInformationService.getIdentityInformation(loginUserInfoVO); List<PermissionsVO> permissions = identityInformation.getPermissions(); if (CollectionUtil.isEmpty(permissions)) { throw new ServiceException("请先完成认证"); } IdentityInformation identityInformation = identityInformationService.getCurrentIdentityInformation(loginUserInfoVO); SystemUser systemUser = systemUserService.getSystemUserAdminByPhone(loginUserInfoVO.getPhone()).orElse(null); Long superiorId; @@ -876,11 +845,7 @@ @Override public void delayAudit(ComplaintDelayAuditDTO dto, LoginUserInfoVO loginUserInfoVO) { IdentityInformation identityInformation = identityInformationService.getIdentityInformation(loginUserInfoVO); List<PermissionsVO> permissions = identityInformation.getPermissions(); if (CollectionUtil.isEmpty(permissions)) { throw new ServiceException("请先完成认证"); } IdentityInformation identityInformation = identityInformationService.getCurrentIdentityInformation(loginUserInfoVO); SystemUser systemUser = identityInformation.getSystemUser(); if (identityInformation.getIdentity() != 2 || systemUser == null) { throw new ServiceException("无权审核"); @@ -938,7 +903,7 @@ @Override public List<DispatchVO> getDispatchList(LoginUserInfoVO loginUserInfoVO) { IdentityInformation identityInformation = identityInformationService.getIdentityInformation(loginUserInfoVO); IdentityInformation identityInformation = identityInformationService.getCurrentIdentityInformation(loginUserInfoVO); SystemUser adminUser = identityInformation.getSystemUser(); @@ -995,12 +960,8 @@ */ @Override public Page<ComplaintTodoVO> getTodoList(BasePage basePage, LoginUserInfoVO loginUserInfo) { IdentityInformation identityInformation = identityInformationService.getIdentityInformation(loginUserInfo); List<PermissionsVO> permissions = identityInformation.getPermissions(); IdentityInformation identityInformation = identityInformationService.getCurrentIdentityInformation(loginUserInfo); SystemUser systemUser = identityInformation.getSystemUser(); if (permissions.isEmpty()) { throw new ServiceException("无权限"); } String targetId = ""; int isSuperior = 0; //上级 springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/IdentityInformationServiceImpl.java
@@ -1,6 +1,8 @@ package com.panzhihua.sangeshenbian.service.impl; import cn.hutool.core.collection.CollectionUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.panzhihua.common.exceptions.ServiceException; import com.panzhihua.common.model.vos.LoginUserInfoVO; import com.panzhihua.common.redis.RedisUtils; import com.panzhihua.sangeshenbian.model.entity.PartyMember; @@ -31,10 +33,15 @@ .eq(PartyMember::getDelFlag, 0)); // 获取管理员信息 SystemUser systemUser = systemUserService.getSystemUserAdminByPhone(loginUserInfo.getPhone()).orElse(null); SystemUser systemUser = systemUserService.lambdaQuery() .eq(SystemUser::getPhone, loginUserInfo.getPhone()) .eq(SystemUser::getIsAdmin, 1).last("LIMIT 1") .one(); // 获取身份 Integer identity = (Integer) redisUtils.get("identity:" + loginUserInfo.getPhone()); // 权限列表 List<PermissionsVO> permissions = new ArrayList<>(); IdentityInformation identityInformationVO = new IdentityInformation(); identityInformationVO.setPartyMember(partyMember); identityInformationVO.setSystemUser(systemUser); @@ -43,13 +50,8 @@ Integer isConfirm = (Integer) redisUtils.get("confirmContent:" + loginUserInfo.getPhone()); identityInformationVO.setIsConfirmContent(isConfirm != null && isConfirm == 1); if (partyMember != null) { identityInformationVO.setIsFrozen(partyMember.getFreezeStatus() == 1); } if (systemUser != null) { identityInformationVO.setIsFrozen(systemUser.getStatus() == 2); } // 获取当前身份 if (identity == null && systemUser != null) { identityInformationVO.setIdentity(2); redisUtils.set("identity:" + loginUserInfo.getPhone(), 2); @@ -60,6 +62,8 @@ identityInformationVO.setIdentity(identity); } // 获取是否冻结 if (identityInformationVO.getIdentity() != null) { if (identityInformationVO.getIdentity() == 1) { identityInformationVO.setIsFrozen(partyMember != null && partyMember.getFreezeStatus() == 1); @@ -70,11 +74,14 @@ identityInformationVO.setIsFrozen(false); } // 是否认证党员 identityInformationVO.setIsPartymember(partyMember != null && partyMember.getAuditStatus().equals(1)); // 是否确认党员信息 identityInformationVO.setIsConfirm(partyMember != null && partyMember.getIsConfirm() == 1); // 党员审核状态 identityInformationVO.setAuditStatus(partyMember == null ? null : partyMember.getAuditStatus()); // 封装管理员信息 if (systemUser != null) { Integer accountLevel = systemUser.getAccountLevel(); String districts = systemUser.getDistricts(); @@ -97,6 +104,7 @@ permissions.add(adminPermissions); } // 封装党员信息 if (partyMember != null) { PermissionsVO partyMemberPermissions = new PermissionsVO(); partyMemberPermissions.setIdentity(1); @@ -108,18 +116,29 @@ return identityInformationVO; } // @Override // public IdentityInformation getCurrentIdentityInformation(LoginUserInfoVO loginUserInfo) { // if (identity == null && systemUser != null) { // identityInformationVO.setIdentity(2); // redisUtils.set("identity:" + loginUserInfo.getPhone(), 2); // }else if (identity == null && partyMember != null){ // identityInformationVO.setIdentity(1); // redisUtils.set("identity:" + loginUserInfo.getPhone(), 1); // } // else { // identityInformationVO.setIdentity(identity); // } // return null; // } @Override public IdentityInformation getCurrentIdentityInformation(LoginUserInfoVO loginUserInfo) { IdentityInformation identityInformation = getIdentityInformation(loginUserInfo); Boolean isFrozen = identityInformation.getIsFrozen(); if (isFrozen) { throw new ServiceException("您的账号已被冻结,请联系管理员"); } List<PermissionsVO> permissions = identityInformation.getPermissions(); if (CollectionUtil.isEmpty(permissions)){ throw new ServiceException("请先完成认证"); } SystemUser systemUser = identityInformation.getSystemUser(); if (systemUser == null && identityInformation.getIdentity() == 2) { throw new ServiceException("管理员信息不存在"); } PartyMember partyMember = identityInformation.getPartyMember(); if (partyMember == null && identityInformation.getIdentity() == 1) { throw new ServiceException("党员信息不存在"); } return identityInformation; } } springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/resources/mapper/ComplaintMapper.xml
@@ -198,6 +198,7 @@ scar.create_time AS reportTime, scar.system_user_id, scar.reporter, su2.phone reporterPhone, scar.department_name, scar.department_id, scar.comment, @@ -210,6 +211,7 @@ FROM sgsb_complaint sc LEFT JOIN sys_user su ON su.user_id = sc.create_by LEFT JOIN sgsb_complaint_audit_record scar ON scar.complaint_id = sc.id and scar.latest_flag = 1 LEFT JOIN sys_user su2 ON su2.user_id = scar.create_by <where> sc.id = #{id} </where> @@ -313,7 +315,7 @@ AND t.report_user_name LIKE CONCAT('%',#{query.reportUserName},'%') </if> <if test="query.reportUserPhone != null and query.reportUserPhone!=''"> AND t.report_user_phone LIKE CONCAT('%',#{query.phone},'%') AND t.report_user_phone LIKE CONCAT('%',#{query.reportUserPhone},'%') </if> <if test="query.name != null and query.name!=''"> AND t.name LIKE CONCAT('%',#{query.name},'%')