From a688ca8b5294151f36d742e4ede7f2659deba8ed 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 14:23:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=9A=E5=8A=A1=E7=BA=BF=E5=88=86=E6=9D=83;?= =?UTF-8?q?=20=E8=B0=83=E8=96=AA=E8=AE=B0=E5=BD=95=E5=A4=9A=E8=AF=AD?= =?UTF-8?q?=E8=A8=80;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/SalaryItemAdjustRecordListDTO.java | 3 ++ .../service/impl/SIAccountServiceImpl.java | 50 ------------------- .../service/impl/SIExportServiceImpl.java | 19 +------ .../service/impl/SISchemeServiceImpl.java | 20 ++++---- .../impl/SalaryArchiveItemServiceImpl.java | 24 +++------ .../impl/SalarySobItemServiceImpl.java | 13 ++--- 6 files changed, 27 insertions(+), 102 deletions(-) diff --git a/src/com/engine/salary/entity/salaryarchive/dto/SalaryItemAdjustRecordListDTO.java b/src/com/engine/salary/entity/salaryarchive/dto/SalaryItemAdjustRecordListDTO.java index ede032ccb..db2b4cb2b 100644 --- a/src/com/engine/salary/entity/salaryarchive/dto/SalaryItemAdjustRecordListDTO.java +++ b/src/com/engine/salary/entity/salaryarchive/dto/SalaryItemAdjustRecordListDTO.java @@ -1,6 +1,7 @@ package com.engine.salary.entity.salaryarchive.dto; import com.engine.salary.annotation.Encrypt; +import com.engine.salary.annotation.I18n; import com.engine.salary.annotation.TableTitle; import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonIgnore; @@ -42,6 +43,7 @@ public class SalaryItemAdjustRecordListDTO { private String username; @TableTitle(title = "部门", dataIndex = "departmentName", key = "departmentName") + @I18n private String departmentName; @TableTitle(title = "员工状态", dataIndex = "employeeStatus", key = "employeeStatus") @@ -66,6 +68,7 @@ public class SalaryItemAdjustRecordListDTO { private Date effectiveTime; @TableTitle(title = "操作人", dataIndex = "operator", key = "operator") + @I18n private String operator; @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") diff --git a/src/com/engine/salary/service/impl/SIAccountServiceImpl.java b/src/com/engine/salary/service/impl/SIAccountServiceImpl.java index 895446f5d..54c15e545 100644 --- a/src/com/engine/salary/service/impl/SIAccountServiceImpl.java +++ b/src/com/engine/salary/service/impl/SIAccountServiceImpl.java @@ -398,19 +398,6 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { Long employeeId = (long) user.getUID(); Map datas = new HashMap<>(); - // 分权逻辑 - Boolean needAuth = getTaxAgentService(user).isNeedAuth((long) user.getUID()); - if (needAuth) { - Collection taxAgentPOS = getTaxAgentService(user).listAllTaxAgents((long) user.getUID()); - List taxAgents = taxAgentPOS.stream().map(TaxAgentPO::getId).collect(Collectors.toList()); - if (CollectionUtils.isEmpty(taxAgents)) { - //防止普通用户查询 - queryParam.setTaxAgents(Collections.singletonList(-1L)); - } else { - queryParam.setTaxAgents(taxAgents); - } - } - //退差列表 queryParam.setPaymentStatus(PaymentStatusEnum.RECESSION.getValue()); @@ -458,19 +445,6 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { Long employeeId = (long) user.getUID(); Map datas = new HashMap<>(); - // 分权逻辑 - Boolean needAuth = getTaxAgentService(user).isNeedAuth((long) user.getUID()); - if (needAuth) { - Collection taxAgentPOS = getTaxAgentService(user).listAllTaxAgents((long) user.getUID()); - List taxAgents = taxAgentPOS.stream().map(TaxAgentPO::getId).collect(Collectors.toList()); - if (CollectionUtils.isEmpty(taxAgents)) { - //防止普通用户查询 - queryParam.setTaxAgents(Collections.singletonList(-1L)); - } else { - queryParam.setTaxAgents(taxAgents); - } - } - //补差列表 queryParam.setPaymentStatus(PaymentStatusEnum.BALANCE.getValue()); @@ -4223,18 +4197,6 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { Long employeeId = (long) user.getUID(); Map datas = new HashMap<>(); queryParam.setPageSize(10000000); - // 分权逻辑 - Boolean needAuth = getTaxAgentService(user).isNeedAuth((long) user.getUID()); - if (needAuth) { - Collection taxAgentPOS = getTaxAgentService(user).listAllTaxAgents((long) user.getUID()); - List taxAgents = taxAgentPOS.stream().map(TaxAgentPO::getId).collect(Collectors.toList()); - if (CollectionUtils.isEmpty(taxAgents)) { - //防止普通用户查询 - queryParam.setTaxAgents(Collections.singletonList(-1L)); - } else { - queryParam.setTaxAgents(taxAgents); - } - } //退差列表 queryParam.setPaymentStatus(PaymentStatusEnum.RECESSION.getValue()); @@ -4261,18 +4223,6 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { Long employeeId = (long) user.getUID(); Map datas = new HashMap<>(); queryParam.setPageSize(10000000); - // 分权逻辑 - Boolean needAuth = getTaxAgentService(user).isNeedAuth((long) user.getUID()); - if (needAuth) { - Collection taxAgentPOS = getTaxAgentService(user).listAllTaxAgents((long) user.getUID()); - List taxAgents = taxAgentPOS.stream().map(TaxAgentPO::getId).collect(Collectors.toList()); - if (CollectionUtils.isEmpty(taxAgents)) { - //防止普通用户查询 - queryParam.setTaxAgents(Collections.singletonList(-1L)); - } else { - queryParam.setTaxAgents(taxAgents); - } - } //补差列表 queryParam.setPaymentStatus(PaymentStatusEnum.BALANCE.getValue()); diff --git a/src/com/engine/salary/service/impl/SIExportServiceImpl.java b/src/com/engine/salary/service/impl/SIExportServiceImpl.java index c0f281ae9..27b51eb3f 100644 --- a/src/com/engine/salary/service/impl/SIExportServiceImpl.java +++ b/src/com/engine/salary/service/impl/SIExportServiceImpl.java @@ -5,8 +5,8 @@ import com.alibaba.fastjson.TypeReference; import com.cloudstore.eccom.pc.table.WeaTableColumn; import com.engine.common.util.ServiceUtil; import com.engine.core.impl.Service; -import com.engine.salary.config.SalaryElogConfig; import com.engine.hrmelog.entity.dto.LoggerContext; +import com.engine.salary.config.SalaryElogConfig; import com.engine.salary.encrypt.EncryptUtil; import com.engine.salary.entity.siaccount.dto.InsuranceAccountViewListDTO; import com.engine.salary.entity.siaccount.param.InsuranceAccountDetailParam; @@ -39,11 +39,10 @@ import com.engine.salary.util.SalaryI18nUtil; import com.engine.salary.util.db.MapperProxyFactory; import com.engine.salary.util.excel.ExcelUtil; import com.engine.salary.util.excel.ExcelUtilPlus; -import org.springframework.beans.BeanUtils; -import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.MapUtils; import org.apache.commons.lang3.StringUtils; import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.springframework.beans.BeanUtils; import weaver.general.BaseBean; import weaver.hrm.User; @@ -176,20 +175,6 @@ public class SIExportServiceImpl extends Service implements SIExportService { //非系统人员核算明细 List extAccountExportPOS = getInsuranceExportMapper().exportExtAccount(paymentStatus, param); accountExportPOS.addAll(extAccountExportPOS); - // 分权逻辑 - Boolean needAuth = getTaxAgentService(user).isNeedAuth((long) user.getUID()); - if (needAuth) { - Collection taxAgentPOS = getTaxAgentService(user).listAllTaxAgents((long) user.getUID()); - List taxAgents = taxAgentPOS.stream().map(TaxAgentPO::getId).collect(Collectors.toList()); - if (CollectionUtils.isEmpty(taxAgents)) { - //防止普通用户查询 - accountExportPOS = new ArrayList<>(); - param = new InsuranceExportParam(); - } else { - accountExportPOS.stream().filter(f -> taxAgents.contains(f.getPaymentOrganization())).collect(Collectors.toList()); - param.setTaxAgents(taxAgents); - } - } } else { accountExportPOS = getInsuranceExportMapper().exportAccount(paymentStatus, param); //非系统人员核算明细 diff --git a/src/com/engine/salary/service/impl/SISchemeServiceImpl.java b/src/com/engine/salary/service/impl/SISchemeServiceImpl.java index 11dc2a7c0..48111689d 100644 --- a/src/com/engine/salary/service/impl/SISchemeServiceImpl.java +++ b/src/com/engine/salary/service/impl/SISchemeServiceImpl.java @@ -28,7 +28,6 @@ import com.engine.salary.entity.sischeme.po.InsuranceSchemeDetailPO; import com.engine.salary.entity.sischeme.po.InsuranceSchemePO; import com.engine.salary.entity.sischeme.vo.InsuranceSchemeFormVO; import com.engine.salary.entity.sischeme.vo.SISchemeTableVO; -import com.engine.salary.entity.taxagent.dto.TaxAgentEmployeeDTO; import com.engine.salary.entity.taxagent.dto.TaxAgentManageRangeEmployeeDTO; import com.engine.salary.entity.taxagent.param.TaxAgentManageRangeSaveParam; import com.engine.salary.entity.taxagent.param.TaxAgentQueryParam; @@ -54,6 +53,8 @@ import com.engine.salary.mapper.sischeme.InsuranceSchemeMapper; import com.engine.salary.mapper.sys.SalarySysConfMapper; import com.engine.salary.mapper.taxagent.TaxAgentMapper; import com.engine.salary.service.*; +import com.engine.salary.service.auth.AuthService; +import com.engine.salary.service.auth.AuthServiceImpl; import com.engine.salary.sys.entity.po.SalarySysConfPO; import com.engine.salary.sys.entity.vo.OrderRuleVO; import com.engine.salary.sys.enums.OpenEnum; @@ -179,6 +180,10 @@ public class SISchemeServiceImpl extends Service implements SISchemeService { return MapperProxyFactory.getProxy(EmployMapper.class); } + public AuthService getAuthService(User user) { + return ServiceUtil.getService(AuthServiceImpl.class, user); + } + @Override public Map getForm(Map params) { Map apidatas = new HashMap<>(16); @@ -356,16 +361,9 @@ public class SISchemeServiceImpl extends Service implements SISchemeService { OrderRuleVO orderRule = getSalarySysConfService(user).orderRule(); param.setOrderRule(orderRule); - Boolean needAuth = getTaxAgentService().isNeedAuth(currentEmployeeId); - if (needAuth) { - List taxAgentEmployeeDTOS = getTaxAgentService().listTaxAgentAndEmployee(currentEmployeeId); -// Set employeeIds = SalaryEntityUtil.properties(taxAgentEmployeeDTOS, TaxAgentEmployeeDTO::getEmployeeId); - Set taxAgentIds = SalaryEntityUtil.properties(taxAgentEmployeeDTOS, TaxAgentEmployeeDTO::getTaxAgentId); - List list = getSocialSchemeMapper().queryEmployeeList(param); - return list.stream().filter(f -> taxAgentIds.contains(f.getPaymentOrganization())).collect(Collectors.toList()); - } - - return getSocialSchemeMapper().queryEmployeeList(param); + List list = getSocialSchemeMapper().queryEmployeeList(param); + list = getAuthService(user).auth(list, AuthFilterTypeEnum.QUERY_DATA, InsuranceArchivesEmployeePO.class); + return list; } @Override diff --git a/src/com/engine/salary/service/impl/SalaryArchiveItemServiceImpl.java b/src/com/engine/salary/service/impl/SalaryArchiveItemServiceImpl.java index 9e353083e..0f69eb7d4 100644 --- a/src/com/engine/salary/service/impl/SalaryArchiveItemServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryArchiveItemServiceImpl.java @@ -12,6 +12,7 @@ import com.engine.salary.config.SalaryElogConfig; import com.engine.salary.constant.SalaryDefaultTenantConstant; import com.engine.salary.entity.datacollection.DataCollectionEmployee; import com.engine.salary.entity.salaryarchive.config.ArchiveFieldConfig; +import com.engine.salary.entity.salaryarchive.dto.SalaryArchiveListDTO; import com.engine.salary.entity.salaryarchive.dto.SalaryItemAdjustRecordListDTO; import com.engine.salary.entity.salaryarchive.param.*; import com.engine.salary.entity.salaryarchive.po.SalaryArchiveItemPO; @@ -20,6 +21,7 @@ import com.engine.salary.entity.salaryitem.param.SalaryItemSearchParam; import com.engine.salary.entity.salaryitem.po.SalaryItemPO; import com.engine.salary.entity.taxagent.po.TaxAgentPO; import com.engine.salary.enums.UserStatusEnum; +import com.engine.salary.enums.auth.AuthFilterTypeEnum; import com.engine.salary.enums.datacollection.UseEmployeeTypeEnum; import com.engine.salary.enums.salaryarchive.SalaryArchiveFieldTypeEnum; import com.engine.salary.enums.salaryarchive.SalaryArchiveItemAdjustReasonEnum; @@ -678,22 +680,11 @@ public class SalaryArchiveItemServiceImpl extends Service implements SalaryArchi // 获取所有可被引用的薪资项目 List salaryItemList = getCanAdjustSalaryItems(); List salaryItemIds = salaryItemList.stream().map(SalaryItemPO::getId).collect(Collectors.toList()); - // 获取记录 - long currentEmployeeId = user.getUID(); - //是否开启分权 - Boolean needAuth = getTaxAgentService(user).isNeedAuth(currentEmployeeId); - if (needAuth) { - Collection taxAgentPOS = getTaxAgentService(user).listAllTaxAgentsAsAdmin(currentEmployeeId); - List taxAgentIds = SalaryEntityUtil.properties(taxAgentPOS, TaxAgentPO::getId, Collectors.toList()); - - if (CollectionUtils.isEmpty(taxAgentIds)) { -// return new PageInfo(); - } - - List salaryArchives = getSalaryArchiveService(user).listSome(SalaryArchivePO.builder().taxAgentIds(taxAgentIds).build()); - List salaryArchiveIds = SalaryEntityUtil.properties(salaryArchives, SalaryArchivePO::getId, Collectors.toList()); - queryParam.setSalaryArchiveIds(salaryArchiveIds); - } + //分权 + SalaryArchiveQueryParam archiveQueryParam = new SalaryArchiveQueryParam(); + archiveQueryParam.setFilterType(AuthFilterTypeEnum.QUERY_DATA); + List salaryArchiveIds = getSalaryArchiveService(user).list(archiveQueryParam).stream().map(SalaryArchiveListDTO::getId).collect(Collectors.toList()); + queryParam.setSalaryArchiveIds(salaryArchiveIds); List employeeList = getSalaryEmployeeService(user).listAll(UseEmployeeTypeEnum.ALL); Map employeeMap = SalaryEntityUtil.convert2Map(employeeList, DataCollectionEmployee::getEmployeeId); @@ -718,6 +709,7 @@ public class SalaryArchiveItemServiceImpl extends Service implements SalaryArchi ; }) .collect(Collectors.toList()); + SalaryI18nUtil.i18nList(listResult); List listAll = salaryArchiveItemMapper.salaryItemAdjustRecordList(SalaryItemAdjustRecordQueryParam.builder().build(), salaryItemIds); diff --git a/src/com/engine/salary/service/impl/SalarySobItemServiceImpl.java b/src/com/engine/salary/service/impl/SalarySobItemServiceImpl.java index ee8d70180..9f68de3ae 100644 --- a/src/com/engine/salary/service/impl/SalarySobItemServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalarySobItemServiceImpl.java @@ -180,15 +180,12 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe Set backCalcItemIds = SalaryEntityUtil.properties(salarySobBackItems, SalarySobBackItemPO::getSalaryItemId); salaryItemIds.addAll(backCalcItemIds); - Boolean needAuth = getTaxAgentService(user).isNeedAuth((long) user.getUID()); - final Set ids = new HashSet(); - if (needAuth) { - Set collect = getTaxAgentService(user).listAllTaxAgents((long) user.getUID()) - .stream().map(TaxAgentPO::getId).collect(Collectors.toSet()); - ids.addAll(collect); - } + //账套项目分权 + TaxAgentQueryParam param = TaxAgentQueryParam.builder().build(); + param.setFilterType(AuthFilterTypeEnum.QUERY_DATA); + Set ids = getTaxAgentService(user).listAuth(param).stream().map(TaxAgentPO::getId).collect(Collectors.toSet()); List salaryItemPOS = getSalaryItemService(user).listByIds(salaryItemIds).stream() - .filter(po -> Boolean.FALSE.equals(needAuth) || getSalaryItemService(user).filterInRange(ids, po)) + .filter(po -> getSalaryItemService(user).filterInRange(ids, po)) .collect(Collectors.toList()); //获取系统值