diff --git a/src/com/engine/salary/service/impl/SalaryAcctRecordServiceImpl.java b/src/com/engine/salary/service/impl/SalaryAcctRecordServiceImpl.java index 08c6cabfa..0c4ce8e4a 100644 --- a/src/com/engine/salary/service/impl/SalaryAcctRecordServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryAcctRecordServiceImpl.java @@ -673,7 +673,7 @@ public class SalaryAcctRecordServiceImpl extends Service implements SalaryAcctRe List needUpdateSalaryAcctRecordIds = selfSalaryAcctRecordPOS.stream().filter(po -> po.getTaxCycle().equals(salaryAcctRecordPO.getTaxCycle())) .map(SalaryAcctRecordPO::getId).collect(Collectors.toList()); if (Objects.equals(salaryAcctRecordPO.getStatus(), SalaryAcctRecordStatusEnum.DECLARED.getValue())) { - if (needUpdateSalaryAcctRecordIds != null && needUpdateSalaryAcctRecordIds.size() > 0) { + if (needUpdateSalaryAcctRecordIds.size() > 0) { // 更新薪资核算记录的状态 updateStatusByIds(needUpdateSalaryAcctRecordIds, SalaryAcctRecordStatusEnum.ARCHIVED); } diff --git a/src/com/engine/salary/service/impl/SalaryAcctResultServiceImpl.java b/src/com/engine/salary/service/impl/SalaryAcctResultServiceImpl.java index 36f19b6f6..9a38cf9ed 100644 --- a/src/com/engine/salary/service/impl/SalaryAcctResultServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryAcctResultServiceImpl.java @@ -28,7 +28,6 @@ import com.engine.salary.entity.salaryformula.ExpressFormula; import com.engine.salary.entity.salaryitem.po.SalaryItemPO; import com.engine.salary.entity.salarysob.dto.*; import com.engine.salary.entity.salarysob.po.*; -import com.engine.salary.entity.taxagent.po.TaxAgentAdminPO; import com.engine.salary.entity.taxagent.po.TaxAgentPO; import com.engine.salary.enums.OperateTypeEnum; import com.engine.salary.enums.UserStatusEnum; @@ -1107,17 +1106,17 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe @Override public Boolean checkAuth(Long salaryAcctRecordId) { // 获取该核算记录的个税扣缴义务 - SalaryAcctRecordPO recordPO = getSalaryAcctRecordService(user).getById(salaryAcctRecordId); - if (Objects.isNull(recordPO)) { - return false; - } - SalarySobPO salarySobPO = getSalarySobService(user).getById(recordPO.getSalarySobId()); - Long taxAgentId = salarySobPO.getTaxAgentId(); - List adminTaxAgentList = getTaxAgentAdminService(user).listByEmployeeId(Long.valueOf(user.getUID())); - Optional canOperate = adminTaxAgentList.stream().filter(po -> NumberUtils.compare(taxAgentId, po.getTaxAgentId()) == 0).findFirst(); - if (!canOperate.isPresent()) { - return false; - } +// SalaryAcctRecordPO recordPO = getSalaryAcctRecordService(user).getById(salaryAcctRecordId); +// if (Objects.isNull(recordPO)) { +// return false; +// } +// SalarySobPO salarySobPO = getSalarySobService(user).getById(recordPO.getSalarySobId()); +// Long taxAgentId = salarySobPO.getTaxAgentId(); +// List adminTaxAgentList = getTaxAgentAdminService(user).listByEmployeeId((long) user.getUID()); +// Optional canOperate = adminTaxAgentList.stream().filter(po -> NumberUtils.compare(taxAgentId, po.getTaxAgentId()) == 0).findFirst(); +// if (!canOperate.isPresent()) { +// return false; +// } return true; } diff --git a/src/com/engine/salary/service/impl/SalaryItemServiceImpl.java b/src/com/engine/salary/service/impl/SalaryItemServiceImpl.java index 2fe2faa6b..3a21abcaa 100644 --- a/src/com/engine/salary/service/impl/SalaryItemServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryItemServiceImpl.java @@ -1,5 +1,6 @@ package com.engine.salary.service.impl; +import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.util.NumberUtil; import cn.hutool.core.util.StrUtil; import com.api.formmode.mybatis.util.SqlProxyHandle; @@ -457,12 +458,12 @@ public class SalaryItemServiceImpl extends Service implements SalaryItemService // 查询所有启用的薪资账套 List salarySobItemList = getSalarySobItemService(user).listBySalaryItemIds(Collections.singleton(salaryItemId)); Set salarySobIds = SalaryEntityUtil.properties(salarySobItemList, SalarySobItemPO::getSalarySobId); - List salarySobs = getSalarySobService(user).listByIds(salarySobIds); + List salarySobs = getSalarySobService(user).listByIdsWithTax(salarySobIds); // 获取能够管理的义务人 - Boolean isChief = getTaxAgentService(user).isChief(Long.valueOf(user.getUID())); + Boolean isChief = getTaxAgentService(user).isChief((long) user.getUID()); if (!isChief) { - Set taxAgentIds = SalaryEntityUtil.properties(getTaxAgentService(user).listAllTaxAgentsAsAdmin(Long.valueOf(user.getUID())), TaxAgentPO::getId); - salarySobs = salarySobs.stream().filter(sob -> taxAgentIds.contains(sob.getTaxAgentId())).collect(Collectors.toList()); + Set taxAgentIds = SalaryEntityUtil.properties(getTaxAgentService(user).listAllTaxAgentsAsAdmin((long) user.getUID()), TaxAgentPO::getId); + salarySobs = salarySobs.stream().filter(sob -> CollectionUtil.intersection(taxAgentIds, sob.getTaxAgentIds()).size() > 0).collect(Collectors.toList()); } return salarySobs.stream().map(m -> { Map map = new HashMap<>(); diff --git a/src/com/engine/salary/service/impl/SalarySendServiceImpl.java b/src/com/engine/salary/service/impl/SalarySendServiceImpl.java index c4df714b2..120cbd78a 100644 --- a/src/com/engine/salary/service/impl/SalarySendServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalarySendServiceImpl.java @@ -638,10 +638,10 @@ public class SalarySendServiceImpl extends Service implements SalarySendService } } - TaxAgentPO taxAgentPO = getTaxAgentService(user).getById(salarySendInfo.getTaxAgentId()); DataCollectionEmployee simpleEmployee = getSalaryEmployeeService(user).getEmployeeById(salarySendInfo.getEmployeeId()); SalaryAcctEmployeePO acctEmployeePO = getSalaryAcctEmployeeService(user).getById(salaryAcctResultPOS.get(0).getSalaryAcctEmpId()); SalaryAcctEmployeeBO.copyAcctEmp(simpleEmployee, acctEmployeePO); + TaxAgentPO taxAgentPO = getTaxAgentService(user).getById(acctEmployeePO.getTaxAgentId()); buildEmployeeInfo(employeeInformation, simpleEmployee, taxAgentPO.getName(), SalaryAcctResultBO.buildEmployeeFieldName()); map.put("employeeInformation", employeeInformation); map.put("salaryGroups", itemSetListDTOS); diff --git a/src/com/engine/salary/service/impl/SalarySobServiceImpl.java b/src/com/engine/salary/service/impl/SalarySobServiceImpl.java index 09f3ac3b8..414f5cafd 100644 --- a/src/com/engine/salary/service/impl/SalarySobServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalarySobServiceImpl.java @@ -295,7 +295,8 @@ public class SalarySobServiceImpl extends Service implements SalarySobService { build.setName(name); } if (queryParam.getTaxAgentId() != null) { - build.setTaxAgentId(queryParam.getTaxAgentId()); + List sobTaxLinkPOS = getSobTaxLinkMapper().listSome(SobTaxLinkPO.builder().taxAgentId(queryParam.getTaxAgentId()).build()); + build.setIds(sobTaxLinkPOS.stream().map(SobTaxLinkPO::getTaxAgentId).collect(Collectors.toList())); } List list = salarySobMapper.listSome(build); diff --git a/src/com/engine/salary/service/impl/TaxDeclarationServiceImpl.java b/src/com/engine/salary/service/impl/TaxDeclarationServiceImpl.java index 3327328ec..2a064fea4 100644 --- a/src/com/engine/salary/service/impl/TaxDeclarationServiceImpl.java +++ b/src/com/engine/salary/service/impl/TaxDeclarationServiceImpl.java @@ -282,8 +282,8 @@ public class TaxDeclarationServiceImpl extends Service implements TaxDeclaration @Override public void delete(SalaryAcctRecordPO salaryAcctRecordPO) { - SalarySobPO sobPO = getSalarySobService(user).getById(salaryAcctRecordPO.getSalarySobId()); - if (sobPO == null || sobPO.getTaxAgentId() == null) { + SalarySobPO sobPO = getSalarySobService(user).getByIdWithTax(salaryAcctRecordPO.getSalarySobId()); + if (sobPO == null) { throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(84026, "账套信息异常")); } @@ -292,18 +292,20 @@ public class TaxDeclarationServiceImpl extends Service implements TaxDeclaration if (Objects.isNull(taxCycleDateRange)) { throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(84026, "参数错误")); } - List taxDeclarationPOS = listByTaxCycleAndTaxAgentIds(SalaryDateUtil.localDate2YearMonth(salaryAcctRecordPO.getTaxCycle()), Collections.singleton(sobPO.getTaxAgentId())); + sobPO.getTaxAgentIds().forEach(taxAgentId -> { + List taxDeclarationPOS = listByTaxCycleAndTaxAgentIds(SalaryDateUtil.localDate2YearMonth(salaryAcctRecordPO.getTaxCycle()), Collections.singleton(taxAgentId)); - Set taxDeclarationIds = SalaryEntityUtil.properties(taxDeclarationPOS, TaxDeclarationPO::getId); - if (CollectionUtils.isNotEmpty(taxDeclarationIds)) { - // 删除个税申报表 - getTaxDeclarationMapper().deleteByIds(taxDeclarationIds); - // 删除个税申报表详情 - getTaxDeclarationDetailService(user).deleteByTaxDeclarationIds(taxDeclarationIds); - } + Set taxDeclarationIds = SalaryEntityUtil.properties(taxDeclarationPOS, TaxDeclarationPO::getId); + if (CollectionUtils.isNotEmpty(taxDeclarationIds)) { + // 删除个税申报表 + getTaxDeclarationMapper().deleteByIds(taxDeclarationIds); + // 删除个税申报表详情 + getTaxDeclarationDetailService(user).deleteByTaxDeclarationIds(taxDeclarationIds); + } - // 删除往期累计情况 - getAddUpSituationService(user).deleteAddUpSituationList(salaryAcctRecordPO.getTaxCycle(), sobPO.getTaxAgentId()); + // 删除往期累计情况 + getAddUpSituationService(user).deleteAddUpSituationList(salaryAcctRecordPO.getTaxCycle(), taxAgentId); + }); }