From 9c6e7f46b5cfb4dfc8355dfba91074301b57482a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com> Date: Thu, 13 Feb 2025 15:17:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=9A=E5=8A=A1=E7=BA=BF=E5=88=86=E6=9D=83;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/SalaryStatisticsPushServiceImpl.java | 36 ++++++++----------- 1 file changed, 14 insertions(+), 22 deletions(-) diff --git a/src/com/engine/salary/report/service/impl/SalaryStatisticsPushServiceImpl.java b/src/com/engine/salary/report/service/impl/SalaryStatisticsPushServiceImpl.java index 25f724899..9f37a181f 100644 --- a/src/com/engine/salary/report/service/impl/SalaryStatisticsPushServiceImpl.java +++ b/src/com/engine/salary/report/service/impl/SalaryStatisticsPushServiceImpl.java @@ -108,12 +108,9 @@ public class SalaryStatisticsPushServiceImpl extends Service implements SalarySt private List> buildReportIdsOptions(Long employeeId) { List> reportIdsOptions = new ArrayList<>(); List reportPOS = getSalaryStatisticsReportService(user).listAll(); - Boolean needAuth = getTaxAgentService(user).isNeedAuth((long) user.getUID()); - if (needAuth) { - // 只能够分享创建人是本人的报表 - reportPOS = reportPOS.stream().filter(po -> po.getCreator().compareTo(employeeId) == 0).collect(Collectors.toList()); - } - reportPOS.forEach( po -> { + // 只能够分享创建人是本人的报表 + reportPOS = reportPOS.stream().filter(po -> po.getCreator().compareTo(employeeId) == 0).collect(Collectors.toList()); + reportPOS.forEach(po -> { Map option = new HashMap<>(); option.put("id", po.getId().toString()); option.put("reportName", po.getReportName()); @@ -129,10 +126,6 @@ public class SalaryStatisticsPushServiceImpl extends Service implements SalarySt if (Objects.isNull(salaryStatisticsPushPO)) { throw new SalaryRunTimeException("该分享记录不存在"); } - Boolean needAuth = getTaxAgentService(user).isNeedAuth((long) user.getUID()); - if (needAuth && salaryStatisticsPushPO.getCreator().compareTo(Long.valueOf(user.getUID())) != 0) { - throw new SalaryRunTimeException("无权查看该分享记录"); - } SalaryStatisticsPushDetail result = new SalaryStatisticsPushDetail(); result.setDetailForm(buildDetailForm(salaryStatisticsPushPO)); result.setDetailTable(buildDetailTable(param)); @@ -279,10 +272,10 @@ public class SalaryStatisticsPushServiceImpl extends Service implements SalarySt List salaryStatisticsPushDetailPOS = getSalaryStatisticsPushDetailService(user).queryPushDetailPOByBatchIds(batchId); salaryStatisticsPushDetailPOS.stream().filter(po -> Objects.equals(po.getPushStatus(), "true") && !(Objects.equals(po.getRebackStatus(), "true")) && Objects.equals(uid, po.getEmployeeId())) .collect(Collectors.toList()).forEach(e -> { - e.setViewStatus("true"); - e.setUpdateTime(new Date()); - getSalaryStatisticsPushDetailService(user).updateIgnoreNull(e); - }); + e.setViewStatus("true"); + e.setUpdateTime(new Date()); + getSalaryStatisticsPushDetailService(user).updateIgnoreNull(e); + }); } // @Override @@ -342,7 +335,6 @@ public class SalaryStatisticsPushServiceImpl extends Service implements SalarySt } - // public CancleMessageEntity buildCancelMessageEntity(SalaryStatisticsPushDetailPO po, Long employeeId, String tenantKey) { // SalaryStatisticsPushPO pushPO = salaryStatisticsPushMapper.selectById(po.getBatchId()); // CancleMessageEntity cancleMessageEntity = new CancleMessageEntity(); @@ -650,7 +642,7 @@ public class SalaryStatisticsPushServiceImpl extends Service implements SalarySt Boolean needAuth = getTaxAgentService(user).isNeedAuth((long) user.getUID()); List salaryStatisticsPushPOS; if (needAuth) { - salaryStatisticsPushPOS = getSalaryStatisticsPushMapper().listSome(SalaryStatisticsPushPO.builder().creator(Long.valueOf(user.getUID())).build()); + salaryStatisticsPushPOS = getSalaryStatisticsPushMapper().listSome(SalaryStatisticsPushPO.builder().creator((long) user.getUID()).build()); } else { salaryStatisticsPushPOS = getSalaryStatisticsPushMapper().listSome(SalaryStatisticsPushPO.builder().build()); } @@ -729,7 +721,7 @@ public class SalaryStatisticsPushServiceImpl extends Service implements SalarySt return Collections.emptyList(); } List pushList = new ArrayList<>(); - List> partition = Lists.partition((List)batchIds, 1000); + List> partition = Lists.partition((List) batchIds, 1000); partition.forEach(ids -> { pushList.addAll(getSalaryStatisticsPushMapper().listSome(SalaryStatisticsPushPO.builder().ids(ids).build())); }); @@ -739,13 +731,13 @@ public class SalaryStatisticsPushServiceImpl extends Service implements SalarySt @Override public List getPushListByReportIdAndIds(Long reportId, List ids) { List pushList = getSalaryStatisticsPushMapper().listByReportIdAndIds(reportId.toString(), ids); - pushList = pushList.stream().filter( push -> { + pushList = pushList.stream().filter(push -> { return Arrays.asList(push.getReportIds().split(",")).contains(reportId.toString()); }).collect(Collectors.toList()); return pushList; } - List filterReportByTime(List pushList){ + List filterReportByTime(List pushList) { // 报表分享时间校验 String formatLocalDateTime = SalaryDateUtil.getFormatLocalDate(LocalDateTime.now()); List result = pushList.stream().filter(pushPO -> { @@ -763,14 +755,14 @@ public class SalaryStatisticsPushServiceImpl extends Service implements SalarySt List successPushDetailList = getSalaryStatisticsPushDetailService(user).getSuccessPushDetailListByReceiver(uid); // 根据报表id,分享批次id查询分享批次信息 List batchIds = successPushDetailList.stream().map(SalaryStatisticsPushDetailPO::getBatchId).collect(Collectors.toList()); - List pushList= getPushListByReportIdAndIds(reportId,batchIds); + List pushList = getPushListByReportIdAndIds(reportId, batchIds); if (CollectionUtils.isEmpty(pushList)) { - throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0,"暂无权限查看该报表")); + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "暂无权限查看该报表")); } // 校验是否在分享的有效时间内 pushList = filterReportByTime(pushList); if (CollectionUtils.isEmpty(pushList)) { - throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0,"该报表的分享不在有效期内,无法查看")); + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "该报表的分享不在有效期内,无法查看")); } return pushList; }