| | |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.Optional; |
| | | |
| | | import static cn.hutool.core.util.ObjectUtil.isNull; |
| | |
| | | break; |
| | | case 3: |
| | | //街道 |
| | | targetId = systemUser.getStreetCode(); |
| | | targetId = systemUser.getStreetId().toString(); |
| | | break; |
| | | case 4: |
| | | //社区 |
| | | targetId = systemUser.getCommunityCode(); |
| | | targetId = systemUser.getCommunityId().toString(); |
| | | break; |
| | | } |
| | | isSuperior = 1; |
| | |
| | | ComplaintProgress complaintProgress = BeanUtil.copyProperties(dto, ComplaintProgress.class); |
| | | complaintProgress.setCreateTime(new Date()); |
| | | complaintProgress.setCreateBy(loginUserInfoVO.getUserId()); |
| | | complaintProgress.setCreateByName(loginUserInfoVO.getName()); |
| | | complaintProgress.setCreateByName(loginUserInfoVO.getNickName()); |
| | | complaintProgressService.save(complaintProgress); |
| | | } |
| | | |
| | |
| | | SystemUser adminUser = systemUserService.getOne(new LambdaQueryWrapper<SystemUser>() |
| | | .eq(SystemUser::getPhone, phone) |
| | | .eq(SystemUser::getIsAdmin, 1) |
| | | .eq(SystemUser::getStatus, 3) |
| | | .ne(SystemUser::getStatus, 3) |
| | | .last("LIMIT 1")); |
| | | |
| | | Long superiorId; |
| | | int reportType; |
| | | if (adminUser == null) { |
| | | superiorId = loginUserInfoVO.getCommunityId(); |
| | | if (Objects.isNull(superiorId)){ |
| | | throw new ServiceException("上报失败,请绑定社区"); |
| | | } |
| | | reportType = ReportTypeEnum.COMMUNITY.getCode(); |
| | | } else { |
| | | int accountLevel = adminUser.getAccountLevel(); // 改为基本类型 |
| | |
| | | |
| | | // 使用基本类型比较并补充默认分支 |
| | | if (accountLevel == ReportTypeEnum.COMMUNITY.getCode()) { |
| | | superiorId = Long.parseLong(adminUser.getStreetCode()); |
| | | superiorId = Long.parseLong(adminUser.getStreetId()); |
| | | } else if (accountLevel == ReportTypeEnum.STREET.getCode()) { |
| | | superiorId = Long.parseLong(adminUser.getDistrictsCode()); |
| | | } else if (accountLevel == ReportTypeEnum.DISTRICT.getCode()) { |
| | |
| | | SystemUser adminUser = systemUserService.getOne(new LambdaQueryWrapper<SystemUser>() |
| | | .eq(SystemUser::getPhone, phone) |
| | | .eq(SystemUser::getIsAdmin, 1) |
| | | .eq(SystemUser::getStatus, 3) |
| | | .ne(SystemUser::getStatus, 3) |
| | | .last("LIMIT 1")); |
| | | |
| | | if (adminUser == null) { |
| | | throw new ServiceException("无权下派"); |
| | | } |
| | | |
| | | |
| | | long superiorId; |
| | | int reportType; |
| | | int accountLevel = adminUser.getAccountLevel(); // 改为基本类型 |
| | | if (accountLevel == 1) { |
| | | throw new ServiceException("市级账号,无法上报!"); |
| | | if (accountLevel == 4) { |
| | | throw new ServiceException("社区账号,无法下派!"); |
| | | } |
| | | reportType = accountLevel - 1; |
| | | |
| | | // 使用基本类型比较并补充默认分支 |
| | | if (accountLevel == ReportTypeEnum.STREET.getCode()) { |
| | | superiorId = Long.parseLong(adminUser.getCommunityCode()); |
| | | superiorId = adminUser.getCommunityId().longValue(); |
| | | } else if (accountLevel == ReportTypeEnum.DISTRICT.getCode()) { |
| | | superiorId = Long.parseLong(adminUser.getStreetCode()); |
| | | superiorId = Long.parseLong(adminUser.getStreetId()); |
| | | } else if (accountLevel == ReportTypeEnum.CITY.getCode()) { |
| | | superiorId = Long.parseLong(adminUser.getDistrictsCode()); |
| | | } else { |
| | | // 处理未预期的账号等级 |
| | | throw new ServiceException("未知的账号等级"); |
| | | throw new ServiceException("未知的账号等级2"); |
| | | } |
| | | |
| | | Long superiorOrgId; |
| | | Complaint complaint = getById(dto.getComplaintId()); |
| | | complaint.setReportType(reportType); |
| | | superiorOrgId = complaint.getSuperiorId(); |
| | | complaint.setReportType(accountLevel - 1); |
| | | complaint.setSuperiorId(superiorId); |
| | | updateById(complaint); |
| | | |
| | | // 添加流转记录 |
| | | complaintFlowService.createFlow(dto.getComplaintId(), 1, loginUserInfoVO.getUserId()); |
| | | complaintFlowService.createFlow(dto.getComplaintId(), superiorOrgId, accountLevel, 1, loginUserInfoVO.getUserId()); |
| | | } |
| | | |
| | | @Override |
| | | public void reportAudit(ComplaintReporAuditDTO complaintReporAuditDTO, LoginUserInfoVO loginUserInfoVO) { |
| | | |
| | | complaintAuditRecordService.audit(complaintReporAuditDTO.getId(), loginUserInfoVO.getUserId(), |
| | | complaintReporAuditDTO.getAuditResult(), complaintReporAuditDTO.getRejectReason()); |
| | | |
| | | // 添加流转记录 |
| | | ComplaintAuditRecord complaintAuditRecord = complaintAuditRecordService.getById(complaintReporAuditDTO.getId()); |
| | | complaintFlowService.createFlow(complaintAuditRecord.getComplaintId(), 0, loginUserInfoVO.getUserId()); |
| | | Complaint complaint = getById(complaintAuditRecord.getComplaintId()); |
| | | Long superiorId = null; |
| | | if (Objects.nonNull(complaint)) { |
| | | superiorId = complaint.getCreateBy(); |
| | | if (Objects.nonNull(complaint.getSuperiorId())) { |
| | | superiorId = complaint.getSuperiorId(); |
| | | } |
| | | complaintFlowService.createFlow(complaintAuditRecord.getComplaintId(), superiorId,complaint.getReportType(),0, loginUserInfoVO.getUserId()); |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | SystemUser adminUser = systemUserService.getOne(new LambdaQueryWrapper<SystemUser>() |
| | | .eq(SystemUser::getPhone, phone) |
| | | .eq(SystemUser::getIsAdmin, 1) |
| | | .eq(SystemUser::getStatus, 3) |
| | | .ne(SystemUser::getStatus, 3) |
| | | .last("LIMIT 1")); |
| | | |
| | | if (adminUser == null) { |
| | | throw new ServiceException("无权下派"); |
| | | } |
| | | int accountLevel = adminUser.getAccountLevel(); // 改为基本类型 |
| | | if (accountLevel == 1) { |
| | | /* if (accountLevel == 1) { |
| | | throw new ServiceException("市级账号,无法上报!"); |
| | | } |
| | | }*/ |
| | | |
| | | // 使用基本类型比较并补充默认分支 |
| | | List<DispatchVO> dispatchVOList = new ArrayList<>(); |
| | |
| | | } |
| | | } else if (accountLevel == ReportTypeEnum.CITY.getCode()) { |
| | | List<BcRegion> list = bcRegionService.list(new LambdaQueryWrapper<BcRegion>() |
| | | .eq(BcRegion::getHierarchyOrder, 3)); |
| | | .eq(BcRegion::getHierarchyOrder, 3).eq(BcRegion::getParentId, 510400));//获取攀枝花市下的区县 |
| | | for (BcRegion region : list) { |
| | | DispatchVO dispatchVO = new DispatchVO(); |
| | | dispatchVO.setId(Long.valueOf(region.getRegionCode())); |
| | |
| | | break; |
| | | case 3: |
| | | //街道 |
| | | targetId = systemUser.getStreetCode(); |
| | | targetId = systemUser.getStreetId().toString(); |
| | | break; |
| | | case 4: |
| | | //社区 |
| | | targetId = systemUser.getCommunityCode(); |
| | | targetId = systemUser.getCommunityId().toString(); |
| | | break; |
| | | } |
| | | isSuperior = 1; |