昂立需求调整
This commit is contained in:
parent
6e6fde89cb
commit
ffef539f2e
|
|
@ -11,6 +11,7 @@ import com.engine.salary.util.page.PageInfo;
|
|||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
|
@ -119,6 +120,14 @@ public interface SalaryArchiveItemService {
|
|||
*/
|
||||
List<SalaryArchiveItemPO> getCurrentEffectiveItemList(Collection<Long> salaryArchivesIds, Collection<Long> salaryItemIds);
|
||||
|
||||
/**
|
||||
* 获取薪资档案对应日期所生效的薪资项目
|
||||
*
|
||||
* @param salaryArchivesIds
|
||||
* @return
|
||||
*/
|
||||
List<SalaryArchiveItemPO> getCurrentEffectiveItemListByDate(Collection<Long> salaryArchivesIds, Collection<Long> salaryItemIds, Date date);
|
||||
|
||||
|
||||
/**
|
||||
* 获取薪资档案对应的当前生效的薪资项目忽略值
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.util.*;
|
||||
|
|
@ -780,33 +781,53 @@ public class SalaryAcctEmployeeServiceImpl extends Service implements SalaryAcct
|
|||
}
|
||||
SalarySobCycleDTO salarySobCycleById = getSalaryAcctRecordService(user).getSalarySobCycleById(queryParam.getSalaryAcctRecordId());
|
||||
LocalDateRange salaryCycle = salarySobCycleById.getSalaryCycle();
|
||||
// 获取薪资周期内发生过调薪的人
|
||||
List<SalaryAcctEmployeePO> salaryAcctEmployeePOS = getSalaryAcctEmployeeMapper().listPage(queryParam);
|
||||
List<Long> employeeIds = salaryAcctEmployeePOS.stream().map(SalaryAcctEmployeePO::getEmployeeId).collect(Collectors.toList());
|
||||
|
||||
// 获取薪资周期内发生过调薪的人 20240606逻辑变更,查建模台账
|
||||
// List<SalaryAcctEmployeePO> salaryAcctEmployeePOS = getSalaryAcctEmployeeMapper().listPage(queryParam);
|
||||
// List<Long> employeeIds = salaryAcctEmployeePOS.stream().map(SalaryAcctEmployeePO::getEmployeeId).collect(Collectors.toList());
|
||||
// SalarySobPO salarySobPO = getSalarySobService(user).getById(salaryAcctRecordPO.getSalarySobId());
|
||||
// TaxAgentPO taxAgentPO = getTaxAgentService(user).getById(salarySobPO.getTaxAgentId());
|
||||
// List<SalaryArchivePO> salaryArchivePOList = getSalaryArchiveService(user).listSome(SalaryArchivePO.builder().taxAgentId(salarySobPO.getTaxAgentId()).employeeIds(employeeIds).build());
|
||||
// List<Long> salaryArchiveIds = salaryArchivePOList.stream().map(SalaryArchivePO::getId).collect(Collectors.toList());
|
||||
// List<Long> adjustSalaryArchiveIds = getSalaryArchiveItemService(user).listArchiveIdByEffectiveTimeAndArchiveIds(salaryCycle, salaryArchiveIds);
|
||||
|
||||
// 获取薪资周期内发生过调薪的人 20240606逻辑变更,查建模台账
|
||||
SalarySobPO salarySobPO = getSalarySobService(user).getById(salaryAcctRecordPO.getSalarySobId());
|
||||
TaxAgentPO taxAgentPO = getTaxAgentService(user).getById(salarySobPO.getTaxAgentId());
|
||||
List<SalaryArchivePO> salaryArchivePOList = getSalaryArchiveService(user).listSome(SalaryArchivePO.builder().taxAgentId(salarySobPO.getTaxAgentId()).employeeIds(employeeIds).build());
|
||||
List<Long> salaryArchiveIds = salaryArchivePOList.stream().map(SalaryArchivePO::getId).collect(Collectors.toList());
|
||||
List<Long> adjustSalaryArchiveIds = getSalaryArchiveItemService(user).listArchiveIdByEffectiveTimeAndArchiveIds(salaryCycle, salaryArchiveIds);
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.execute("select distinct xm from uf_txtzbd where dxsxy='" + SalaryDateUtil.getFormatYearMonth(salaryAcctRecordPO.getSalaryMonth()) + "'" );
|
||||
List<Long> adjustEmpIds = new ArrayList<>();
|
||||
while (rs.next()) {
|
||||
adjustEmpIds.add(Long.valueOf(rs.getInt("xm")));
|
||||
}
|
||||
|
||||
// 查询本次薪资核算人员
|
||||
List<SalaryAcctEmployeePO> salaryAcctEmployeePOS = getSalaryAcctEmployeeMapper().listPage(queryParam);
|
||||
List<Long> employeeIds = salaryAcctEmployeePOS.stream().map(SalaryAcctEmployeePO::getEmployeeId).collect(Collectors.toList());
|
||||
adjustEmpIds = adjustEmpIds.stream().filter(id -> employeeIds.contains(id)).collect(Collectors.toList());
|
||||
|
||||
List<SalaryArchivePO> salaryArchivePOList = new ArrayList<>();
|
||||
if (CollectionUtils.isNotEmpty(adjustEmpIds)) {
|
||||
salaryArchivePOList.addAll(getSalaryArchiveService(user).listSome(SalaryArchivePO.builder().employeeIds(adjustEmpIds).taxAgentId(salarySobPO.getTaxAgentId()).build()));
|
||||
}
|
||||
|
||||
List<Map<String, Object>> resultList = new ArrayList<>();
|
||||
PageInfo<Long> archiveIdPageInfo = new PageInfo<>();
|
||||
PageInfo<SalaryArchivePO> salaryArchivePOPageInfo = new PageInfo<>();
|
||||
// 获取所有可被引用的薪资项目
|
||||
List<SalaryItemPO> salaryItems = getSalaryArchiveItemService(user).getCanAdjustSalaryItems();
|
||||
if (CollectionUtils.isNotEmpty(adjustSalaryArchiveIds)) {
|
||||
if (CollectionUtils.isNotEmpty(salaryArchivePOList)) {
|
||||
// 分页
|
||||
archiveIdPageInfo = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), adjustSalaryArchiveIds);
|
||||
|
||||
// 获取薪资档案信息
|
||||
salaryArchivePOList = getSalaryArchiveService(user).listSome(SalaryArchivePO.builder().ids(archiveIdPageInfo.getList()).build());
|
||||
salaryArchivePOPageInfo = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), salaryArchivePOList);
|
||||
List<Long> salaryArchiveIds = salaryArchivePOPageInfo.getList().stream().map(SalaryArchivePO::getId).collect(Collectors.toList());
|
||||
// 获取人员信息
|
||||
Map<Long, DataCollectionEmployee> employeeMap = SalaryEntityUtil.convert2Map(getSalaryEmployeeService(user).listByIds(employeeIds), DataCollectionEmployee::getEmployeeId);
|
||||
Map<Long, DataCollectionEmployee> employeeMap = SalaryEntityUtil.convert2Map(getSalaryEmployeeService(user).listByIds(adjustEmpIds), DataCollectionEmployee::getEmployeeId);
|
||||
List<Long> salaryItemIds = salaryItems.stream().map(SalaryItemPO::getId).collect(Collectors.toList());
|
||||
// 获取当前生效的薪资项目
|
||||
List<SalaryArchiveItemPO> salaryArchiveItemCurrentList = getSalaryArchiveItemService(user).getCurrentEffectiveItemList(archiveIdPageInfo.getList(), salaryItemIds);
|
||||
List<SalaryArchiveItemPO> salaryArchiveItemCurrentList = getSalaryArchiveItemService(user).getCurrentEffectiveItemListByDate(salaryArchiveIds, salaryItemIds, salaryCycle.getEndDate());
|
||||
// List<SalaryArchiveItemPO> salaryArchiveItemCurrentList = getSalaryArchiveItemService(user).getCurrentEffectiveItemList(salaryArchiveIds, salaryItemIds);
|
||||
Map<Long, List<SalaryArchiveItemPO>> groupByArchiveId = SalaryEntityUtil.group2Map(salaryArchiveItemCurrentList, SalaryArchiveItemPO::getSalaryArchiveId);
|
||||
|
||||
for (SalaryArchivePO po : salaryArchivePOList) {
|
||||
for (SalaryArchivePO po : salaryArchivePOPageInfo.getList()) {
|
||||
DataCollectionEmployee employee = employeeMap.get(po.getEmployeeId());
|
||||
HashMap<String, Object> valueMap = new HashMap<>();
|
||||
valueMap.put("userName", employee == null ? "" : employee.getUsername());
|
||||
|
|
@ -841,7 +862,7 @@ public class SalaryAcctEmployeeServiceImpl extends Service implements SalaryAcct
|
|||
}
|
||||
|
||||
resultPageInfo.setList(resultList);
|
||||
resultPageInfo.setTotal(archiveIdPageInfo.getTotal());
|
||||
resultPageInfo.setTotal(salaryArchivePOPageInfo.getTotal());
|
||||
resultPageInfo.setPageSize(queryParam.getPageSize());
|
||||
resultPageInfo.setPageNum(queryParam.getCurrent());
|
||||
resultPageInfo.setColumns(columns);
|
||||
|
|
|
|||
|
|
@ -151,6 +151,17 @@ public class SalaryArchiveItemServiceImpl extends Service implements SalaryArchi
|
|||
.collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(f -> f.getSalaryArchiveId() + "-" + f.getSalaryItemId()))), ArrayList::new));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SalaryArchiveItemPO> getCurrentEffectiveItemListByDate(Collection<Long> salaryArchivesIds, Collection<Long> salaryItemIds, Date date) {
|
||||
// 没有薪资项目时,给个不存在的,否则加载所有不合理
|
||||
salaryItemIds = CollectionUtils.isEmpty(salaryItemIds) ? Collections.singletonList(0L) : salaryItemIds;
|
||||
// 薪资档案id
|
||||
List<Long> salaryArchiveIds = CollectionUtils.isEmpty(salaryArchivesIds) ? Collections.singletonList(0L) : (List<Long>) salaryArchivesIds;
|
||||
List<SalaryArchiveItemPO> salaryArchiveItems = this.getEffectiveItemListByDate(salaryArchiveIds, salaryItemIds, date);
|
||||
return salaryArchiveItems.stream()
|
||||
.collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(f -> f.getSalaryArchiveId() + "-" + f.getSalaryItemId()))), ArrayList::new));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前已生效列表
|
||||
*
|
||||
|
|
@ -171,6 +182,19 @@ public class SalaryArchiveItemServiceImpl extends Service implements SalaryArchi
|
|||
return salaryArchiveItems;
|
||||
}
|
||||
|
||||
private List<SalaryArchiveItemPO> getEffectiveItemListByDate(Collection<Long> salaryArchiveIds, Collection<Long> salaryItemIds, Date date) {
|
||||
List<SalaryArchiveItemPO> salaryArchiveItems = Lists.newArrayList();
|
||||
List<List<Long>> partition = Lists.partition(Lists.newArrayList(salaryArchiveIds), 999);
|
||||
partition.forEach(part -> salaryArchiveItems.addAll(
|
||||
salaryArchiveItemMapper.getEffectiveSalaryItems(SalaryArchiveItemQueryParam.builder()
|
||||
.salaryArchivesIds(part)
|
||||
.salaryItemIds(salaryItemIds)
|
||||
.effectiveTime(date).build()))
|
||||
);
|
||||
// 解密
|
||||
return salaryArchiveItems;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String, List<SalaryArchiveItemPO>> getEffectiveItemListMap(Collection<Long> salaryArchiveIds, boolean isNoNeedSalaryItem, Collection<Long> salaryItemIds) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue