diff --git a/resource/wiki/删除档案.txt b/resource/wiki/删除档案.txt index 22d1976b0..a9aab191b 100644 --- a/resource/wiki/删除档案.txt +++ b/resource/wiki/删除档案.txt @@ -46,11 +46,13 @@ update hrsa_other_archives set delete_type=3; update hrsa_tax_agent_emp set delete_type=3; --- 删除核算记录和工资单信息 -update hrsa_salary_acct_record set delete_type=3 where delete_type=0; -update hrsa_salary_acct_emp set delete_type=3 where delete_type=0; -update hrsa_salary_acct_result set delete_type=3 where delete_type=0; -update hrsa_salary_send set delete_type=3 where delete_type=0; -update hrsa_salary_send_info set delete_type=3 where delete_type=0; +-- 删除核算记录 +update hrsa_salary_acct_record set delete_type=3 where delete_type=0 and id= 核算记录id; +update hrsa_salary_acct_emp set delete_type=3 where delete_type=0 and salary_acct_record_id=核算记录id; +update hrsa_salary_acct_result set delete_type=3 where delete_type=0 and salary_acct_record_id = 核算记录id; + +--删除工资单信息 +update hrsa_salary_send set delete_type=3 where delete_type=0 and salary_accounting_id = 核算记录id; +update hrsa_salary_send_info set delete_type=3 where delete_type=0 and salary_acct_record_id = 核算记录id; diff --git a/src/com/engine/salary/service/impl/SIAccountServiceImpl.java b/src/com/engine/salary/service/impl/SIAccountServiceImpl.java index 8d97dbeaf..126873d58 100644 --- a/src/com/engine/salary/service/impl/SIAccountServiceImpl.java +++ b/src/com/engine/salary/service/impl/SIAccountServiceImpl.java @@ -1666,7 +1666,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { // Long taxAgentId = 0L; List list = new ArrayList<>(); - + String username = (String) map.getOrDefault("姓名", ""); String billMonth = (String) map.getOrDefault("账单月份", ""); String taxAgentName = (String) map.getOrDefault("个税扣缴义务人", ""); String supplementaryMonth = (String) map.getOrDefault("补缴月份", ""); @@ -1770,11 +1770,11 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { //校验补缴人员是否存在福利档案基础信息,并且runStatus处于正在缴纳或者待减员 InsuranceArchivesBaseInfoPO insuranceBaseInfo = getInsuranceBaseInfoMapper().getOneByEmployeeIdAndPayOrg(paymentOrganization, employeeId); if (insuranceBaseInfo == null || !(insuranceBaseInfo.getRunStatus().equals(EmployeeStatusEnum.STAY_DEL.getValue()) || insuranceBaseInfo.getRunStatus().equals(EmployeeStatusEnum.PAYING.getValue())) ) { - throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "补缴人员中存在未设置福利档案人员或相关人员不在福利在缴人员中,不可新建补缴信息!")); + throw new SalaryRunTimeException(username + SalaryI18nUtil.getI18nLabel(0, "补缴未设置福利档案人员或不在福利在缴人员中,不可新建补缴信息!")); } List empIdsInPayMonthRange = listCanPayEmpIds(paymentOrganization, billMonth.substring(0, 7)); if (!empIdsInPayMonthRange.contains(employeeId)) { - throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(99920, "无核算人员")); + throw new SalaryRunTimeException(username + SalaryI18nUtil.getI18nLabel(99920, "无核算人员")); } DataCollectionEmployee employee = getSalaryEmployeeService(user).getEmployeeById(employeeId); // 封装InsuranceAccountDetailPO diff --git a/src/com/engine/salary/service/impl/SalaryAcctResultServiceImpl.java b/src/com/engine/salary/service/impl/SalaryAcctResultServiceImpl.java index b2d1c9847..1b78e42d4 100644 --- a/src/com/engine/salary/service/impl/SalaryAcctResultServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryAcctResultServiceImpl.java @@ -339,14 +339,25 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe if (CollectionUtils.isNotEmpty(otherConditions)) { List items = SalaryEntityUtil.properties(otherConditions, SalaryAcctResultQueryParam.OtherCondition::getItemId, Collectors.toList()); List list = listBySalaryAcctRecordIdsAndSalaryItemIds(Collections.singletonList(queryParam.getSalaryAcctRecordId()), items); - for (int i = 0; i < otherConditions.size(); i++) { - SalaryAcctResultQueryParam.OtherCondition otherCondition = otherConditions.get(i); - Long itemId = otherCondition.getItemId(); - FilterEnum filter = otherCondition.getFilter(); - List params = otherCondition.getParams(); - list = list.stream().filter(a -> Objects.equals(a.getSalaryItemId(), itemId)).filter(a -> filter.filter(params).test(a.getResultValue())).collect(Collectors.toList()); + Map> acctEmpResultsMap = SalaryEntityUtil.group2Map(list, SalaryAcctResultPO::getSalaryAcctEmpId); + Set removeAcctEmpIds = new HashSet<>(); + for (Long acctEmpId : acctEmpResultsMap.keySet()) { + List acctEmpResults = acctEmpResultsMap.get(acctEmpId); + //如果有一个条件不成立就删除 + for (int i = 0; i < otherConditions.size(); i++) { + SalaryAcctResultQueryParam.OtherCondition otherCondition = otherConditions.get(i); + Long itemId = otherCondition.getItemId(); + FilterEnum filter = otherCondition.getFilter(); + List params = otherCondition.getParams(); + for (SalaryAcctResultPO po : acctEmpResults) { + if(Objects.equals(po.getSalaryItemId(), itemId) && !filter.filter(params).test(po.getResultValue())){ + removeAcctEmpIds.add(po.getSalaryAcctEmpId()); + } + } + } } - List salaryAcctEmpId = SalaryEntityUtil.properties(list, SalaryAcctResultPO::getSalaryAcctEmpId, Collectors.toList()); + acctEmpResultsMap.keySet().removeAll(removeAcctEmpIds); + List salaryAcctEmpId = Lists.newArrayList(acctEmpResultsMap.keySet()); if (CollectionUtils.isEmpty(salaryAcctEmpId)) { //条件不满足直接返回空列表 diff --git a/src/com/engine/salary/service/impl/SalaryEmployeeServiceImpl.java b/src/com/engine/salary/service/impl/SalaryEmployeeServiceImpl.java index 6af87b45c..154da1d18 100644 --- a/src/com/engine/salary/service/impl/SalaryEmployeeServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryEmployeeServiceImpl.java @@ -1,5 +1,6 @@ package com.engine.salary.service.impl; +import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.NumberUtil; import com.alibaba.fastjson.JSON; import com.api.formmode.mybatis.util.SqlProxyHandle; @@ -173,7 +174,7 @@ public class SalaryEmployeeServiceImpl extends Service implements SalaryEmployee } //外部人员 - if(hasExtEmp){ + if (hasExtEmp) { List salarySobExtRangePOS = getSalarySobExtRangeService(user).listBySalarySobId(salarySobId); if (CollectionUtils.isNotEmpty(salarySobExtRangePOS)) { List ids = SalaryEntityUtil.properties(salarySobExtRangePOS, SalarySobExtRangePO::getTargetId, Collectors.toList()); @@ -417,20 +418,24 @@ public class SalaryEmployeeServiceImpl extends Service implements SalaryEmployee result.addAll(employBiz.listByVirtualParams(virtualParams)); - List empIds = new ArrayList<>(); - includeQueryParams.stream() - .filter(param -> param.getTargetType().equals(TargetTypeEnum.SQL.name())) - .forEach(param -> { - String sql = param.getTarget(); - RecordSet rs = new RecordSet(); - if (rs.execute(sql)) { - while (rs.next()) { - empIds.add((long) rs.getInt("id")); - } + for (SalarySobRangeEmpQueryParam param:includeQueryParams) { + if(param.getTargetType().equals(TargetTypeEnum.SQL.name())){ + List empIds = new ArrayList<>(); + String sql = param.getTarget(); + RecordSet rs = new RecordSet(); + if (rs.execute(sql)) { + while (rs.next()) { + empIds.add((long) rs.getInt("id")); } - }); - List employees = getSalaryEmployeeService(user).getEmployeeByIdsAll(empIds); - result.addAll(employees); + } + if(CollUtil.isNotEmpty(empIds)){ + Collection employeeStatus = param.getEmployeeStatus(); + List employeeByIdsAll = getSalaryEmployeeService(user).getEmployeeByIdsAll(empIds); + List collect = employeeByIdsAll.stream().filter(e -> employeeStatus.contains(e.getStatus())).collect(Collectors.toList()); + result.addAll(collect); + } + } + } // 从hrmresource和hrmresourcevirtual可能获取到重复人员数据,需要根据人员id去重 result = result.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparingLong(DataCollectionEmployee::getEmployeeId))), ArrayList::new));