From 3dd8db37dc12fea3d0d955ea3e18f5f9f54b3e85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com> Date: Mon, 3 Nov 2025 13:35:06 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B4=A6=E5=A5=97sql=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E7=9A=84=E4=BA=BA=E5=91=98=E8=8C=83=E5=9B=B4=E6=8E=A5=E5=85=A5?= =?UTF-8?q?=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/SalaryEmployeeServiceImpl.java | 33 +++++++++++-------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/src/com/engine/salary/service/impl/SalaryEmployeeServiceImpl.java b/src/com/engine/salary/service/impl/SalaryEmployeeServiceImpl.java index cf04d1e76..7c0d23b2d 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; @@ -174,7 +175,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()); @@ -418,20 +419,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));