| | |
| | | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import cn.idev.excel.EasyExcel; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | |
| | | import com.panzhihua.sangeshenbian.model.vo.ComplaintVO; |
| | | import com.panzhihua.sangeshenbian.service.ISystemUserService; |
| | | import com.panzhihua.sangeshenbian.utils.FileUtil; |
| | | import com.panzhihua.sangeshenbian.warpper.IdentityInformationVO; |
| | | import com.panzhihua.sangeshenbian.warpper.MgtComplaintQuery; |
| | | import com.panzhihua.sangeshenbian.warpper.PermissionsVO; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.context.annotation.Lazy; |
| | |
| | | private final IComplaintCommentService complaintCommentService; |
| | | private final HttpServletResponse response; |
| | | private final IPartyMemberService partyMemberService; |
| | | private final IdentityInformationService identityInformationService; |
| | | private final RedisUtils redisUtils; |
| | | |
| | | @Override |
| | |
| | | complaint.setSerialNumber(serialNumber); |
| | | Optional<SystemUser> systemUserOpt = systemUserService.getSystemUserAdminByPhone(loginUserInfoVO.getPhone()); |
| | | Integer accountLevel = 5; |
| | | //获取当前身份,1=党员,2=管理员 |
| | | Integer identity = (Integer) redisUtils.get("identity:" + loginUserInfoVO.getPhone()); |
| | | //获取当前身份 |
| | | IdentityInformationVO identityInformationVO = identityInformationService.getIdentityInformationVO(loginUserInfoVO); |
| | | //1=党员,2=管理员 |
| | | Integer identity = identityInformationVO.getIdentity(); |
| | | if (systemUserOpt.isPresent() && null != identity && identity == 2) { |
| | | SystemUser systemUser = systemUserOpt.get(); |
| | | accountLevel = systemUser.getAccountLevel(); |
| | |
| | | } |
| | | } |
| | | //有审核数据,且正在办理 |
| | | if(null != one && (vo.getStatus() == 0 || vo.getStatus() == 1 || vo.getStatus() == 2)){ |
| | | if(null != one && (vo.getStatus() == 0 || vo.getStatus() == 1 || vo.getStatus() == 2 || vo.getStatus() == 6)){ |
| | | //区分是上报数据还是下派数据 |
| | | if(one.getAuditType() == 2){ |
| | | //判断当前审核状态 |
| | |
| | | } |
| | | } |
| | | }else{ |
| | | //审核状态为待审核,需要授权审核按钮 |
| | | if((one.getAuditStatus() == 5 || one.getAuditStatus() == 7) && systemUserByPhone.isPresent()){ |
| | | SystemUser systemUser = systemUserByPhone.get(); |
| | | String targetId = ""; |
| | | Integer accountLevel = 5; |
| | | //获取当前身份,1=党员,2=管理员 |
| | | Integer identity = (Integer) redisUtils.get("identity:" + systemUser.getPhone()); |
| | | if(2 == identity){ |
| | | accountLevel = systemUser.getAccountLevel(); |
| | | switch (accountLevel) { |
| | | case 1: |
| | | //市级 |
| | | targetId = "510400"; |
| | | break; |
| | | case 2: |
| | | //区县级 |
| | | targetId = systemUser.getDistrictsCode(); |
| | | break; |
| | | case 3: |
| | | //街道 |
| | | targetId = systemUser.getStreetId().toString(); |
| | | break; |
| | | case 4: |
| | | //社区 |
| | | targetId = systemUser.getCommunityId().toString(); |
| | | break; |
| | | case 5: |
| | | //党员 |
| | | PartyMember partyMember = partyMemberService.getPartyMemberByPhone(systemUser.getPhone()); |
| | | targetId = partyMember.getId().toString(); |
| | | break; |
| | | } |
| | | |
| | | ComplaintAuditRecord one2 = complaintAuditRecordService.getOne(new LambdaQueryWrapper<ComplaintAuditRecord>().eq(ComplaintAuditRecord::getComplaintId, vo.getId()) |
| | | .eq(ComplaintAuditRecord::getLatestFlag, 1)); |
| | | Integer isAdmin = systemUserByPhone.get().getIsAdmin(); |
| | | if(one2.getReportType().equals(accountLevel) && one2.getSuperiorId().toString().equals(targetId) && 1 == isAdmin){ |
| | | vo.setAuditButtonStatus(0); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //没有审核通过,则需要查询上一条审核通过的数据,如果没有则给到添加诉求的人 |
| | | ComplaintAuditRecord one1 = complaintAuditRecordService.getOne(new LambdaQueryWrapper<ComplaintAuditRecord>().eq(ComplaintAuditRecord::getComplaintId, vo.getId()) |
| | | .eq(ComplaintAuditRecord::getAuditType, 2).eq(ComplaintAuditRecord::getAuditStatus, 1).orderByDesc(ComplaintAuditRecord::getSort).last(" limit 0, 1")); |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | //有审核数据,且为审核中 |
| | | //审核状态为待审核,需要授权审核按钮 |
| | | if(null != one && (vo.getStatus() == 5 || vo.getStatus() == 7) && systemUserByPhone.isPresent()){ |
| | | SystemUser systemUser = systemUserByPhone.get(); |
| | | String targetId = ""; |
| | | Integer accountLevel = 5; |
| | | //获取当前身份,1=党员,2=管理员 |
| | | Integer identity = (Integer) redisUtils.get("identity:" + systemUser.getPhone()); |
| | | if(2 == identity){ |
| | | accountLevel = systemUser.getAccountLevel(); |
| | | switch (accountLevel) { |
| | | case 1: |
| | | //市级 |
| | | targetId = "510400"; |
| | | break; |
| | | case 2: |
| | | //区县级 |
| | | targetId = systemUser.getDistrictsCode(); |
| | | break; |
| | | case 3: |
| | | //街道 |
| | | targetId = systemUser.getStreetId().toString(); |
| | | break; |
| | | case 4: |
| | | //社区 |
| | | targetId = systemUser.getCommunityId().toString(); |
| | | break; |
| | | case 5: |
| | | //党员 |
| | | PartyMember partyMember = partyMemberService.getPartyMemberByPhone(systemUser.getPhone()); |
| | | targetId = partyMember.getId().toString(); |
| | | break; |
| | | } |
| | | |
| | | ComplaintAuditRecord one2 = complaintAuditRecordService.getOne(new LambdaQueryWrapper<ComplaintAuditRecord>().eq(ComplaintAuditRecord::getComplaintId, vo.getId()) |
| | | .eq(ComplaintAuditRecord::getLatestFlag, 1)); |
| | | Integer isAdmin = systemUserByPhone.get().getIsAdmin(); |
| | | if(one2.getReportType().equals(accountLevel) && one2.getSuperiorId().toString().equals(targetId) && 1 == isAdmin){ |
| | | vo.setAuditButtonStatus(0); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | //状态为已办结,判断评价按钮 |
| | | int count = complaintCommentService.count(new LambdaQueryWrapper<ComplaintComment>().eq(ComplaintComment::getComplaintId, vo.getId()).eq(ComplaintComment::getDelFlag, 0)); |
| | |
| | | List<ComplaintProgress> list = complaintProgressService.lambdaQuery().eq(ComplaintProgress::getComplaintId, id) |
| | | .orderByAsc(ComplaintProgress::getCreateTime).list(); |
| | | detail.setComplaintProgresses(list); |
| | | detail.setAuditButtonStatus(1); |
| | | detail.setEvaluateButtonStatus(1); |
| | | if((detail.getStatus() == 5 || detail.getStatus() == 7) && systemUserByPhone.isPresent()){ |
| | | ComplaintAuditRecord one = complaintAuditRecordService.getOne(new LambdaQueryWrapper<ComplaintAuditRecord>().eq(ComplaintAuditRecord::getComplaintId, detail.getId()) |
| | | .eq(ComplaintAuditRecord::getLatestFlag, 1)); |
| | | Integer isAdmin = systemUserByPhone.get().getIsAdmin(); |
| | | if(one.getReportType().equals(accountLevel) && one.getSuperiorId().toString().equals(targetId) && 1 == isAdmin){ |
| | | detail.setAuditButtonStatus(0); |
| | | } |
| | | } |
| | | // detail.setAuditButtonStatus(1); |
| | | // detail.setEvaluateButtonStatus(1); |
| | | // if((detail.getStatus() == 5 || detail.getStatus() == 7) && systemUserByPhone.isPresent()){ |
| | | // ComplaintAuditRecord one = complaintAuditRecordService.getOne(new LambdaQueryWrapper<ComplaintAuditRecord>().eq(ComplaintAuditRecord::getComplaintId, detail.getId()) |
| | | // .eq(ComplaintAuditRecord::getLatestFlag, 1)); |
| | | // Integer isAdmin = systemUserByPhone.get().getIsAdmin(); |
| | | // if(one.getReportType().equals(accountLevel) && one.getSuperiorId().toString().equals(targetId) && 1 == isAdmin){ |
| | | // detail.setAuditButtonStatus(0); |
| | | // } |
| | | // } |
| | | |
| | | |
| | | buttonPermission(detail, systemUserByPhone); |
| | |
| | | .ne(SystemUser::getStatus, 3) |
| | | .last("LIMIT 1")); |
| | | |
| | | IdentityInformationVO identityInformationVO = identityInformationService.getIdentityInformationVO(loginUserInfoVO); |
| | | if (CollectionUtil.isEmpty(identityInformationVO.getPermissions())) { |
| | | throw new ServiceException("请先完成认证"); |
| | | } |
| | | |
| | | Long superiorId; |
| | | int reportType; |
| | | if (adminUser == null) { |
| | | superiorId = loginUserInfoVO.getCommunityId(); |
| | | if (Objects.isNull(superiorId)) { |
| | | throw new ServiceException("上报失败,请绑定社区"); |
| | | } |
| | | reportType = ReportTypeEnum.COMMUNITY.getCode(); |
| | | PartyMember partyMember = partyMemberService.getPartyMemberByPhone(phone); |
| | | superiorId = partyMember.getCommunityId(); |
| | | reportType = 4; |
| | | } else { |
| | | int accountLevel = adminUser.getAccountLevel(); // 改为基本类型 |
| | | if (accountLevel == 1) { |
| | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void saveDelay(ComplaintDelayDTO dto, LoginUserInfoVO loginUserInfoVO) { |
| | | IdentityInformationVO identityInformationVO = identityInformationService.getIdentityInformationVO(loginUserInfoVO); |
| | | List<PermissionsVO> permissions = identityInformationVO.getPermissions(); |
| | | |
| | | if (CollectionUtil.isEmpty(permissions)){ |
| | | throw new ServiceException("请先完成认证"); |
| | | } |
| | | |
| | | SystemUser systemUser = systemUserService.getSystemUserAdminByPhone(loginUserInfoVO.getPhone()).orElse(null); |
| | | Long superiorId; |
| | | int reportType; |
| | | if (systemUser == null) { |
| | | superiorId = loginUserInfoVO.getCommunityId(); |
| | | if (identityInformationVO.getIdentity() == 1) { |
| | | PartyMember partyMember = partyMemberService.getPartyMemberByPhone(loginUserInfoVO.getPhone()); |
| | | superiorId = partyMember.getCommunityId(); |
| | | if (Objects.isNull(superiorId)) { |
| | | throw new ServiceException("延期申请失败,请绑定社区"); |
| | | } |
| | | reportType = ReportTypeEnum.COMMUNITY.getCode(); |
| | | } else { |
| | | } else if (identityInformationVO.getIdentity() == 2){ |
| | | int accountLevel = systemUser.getAccountLevel(); // 改为基本类型 |
| | | if (accountLevel == 1) { |
| | | throw new ServiceException("市级账号,无法延期申请!"); |
| | |
| | | // 处理未预期的账号等级 |
| | | throw new ServiceException("未知的账号等级"); |
| | | } |
| | | }else { |
| | | throw new ServiceException("无权申请"); |
| | | } |
| | | |
| | | // 清除最新记录 |