二开,标记数据获取上个月的值

This commit is contained in:
钱涛 2025-06-18 15:42:43 +08:00
parent 26f1d5b0b3
commit db2b80cddf
1 changed files with 16 additions and 1 deletions

View File

@ -193,10 +193,19 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc
// 查询上个薪资所属月核算人员薪资数据
sw.start("查询上个薪资所属月核算人员薪资数据");
List<SalaryAcctResultPO> lastMonthResultPOS = getSalaryAcctResultService(user).listBySobSalaryMonth(SalaryDateUtil.toDate(salarySobCycleDTO.getSalaryMonth().minusMonths(1), 1), salaryAcctCalculateBO.getSalarySobPO().getId(), employeeIds);
Map<String, String> lastMonthResultMap = SalaryEntityUtil.convert2Map(lastMonthResultPOS, e -> e.getEmployeeId() + "_" + e.getTaxAgentId() + "_" + e.getSalaryItemId(), SalaryAcctResultPO::getResultValue);
//查询上个月标记数据赋值到本月锁定并标记
// SalaryAcctEmployeeQueryParam salaryAcctEmployeeQueryParam = SalaryAcctEmployeeQueryParam.builder()
// .salaryMonths(Sets.newHashSet(SalaryDateUtil.toDate(salarySobCycleDTO.getSalaryMonth().minusMonths(1), 1)))
// .salarySobIds(Collections.singleton(salaryAcctCalculateBO.getSalarySobPO().getId()))
// .employeeIds(employeeIds).build();
// List<SalaryAcctEmployeePO> lastMonthEmployeePOS = getSalaryAcctEmployeeService(user).listByParam(salaryAcctEmployeeQueryParam);
// Map<String, List<Long>> lastMonthEmpMarkItemsMap = SalaryEntityUtil.convert2Map(lastMonthEmployeePOS, e -> e.getEmployeeId() + "_" + e.getTaxAgentId(), SalaryAcctEmployeePO::getMarkItems);
sw.stop();
// 10转换成公式编辑器中的变量
sw.start("转换成公式编辑器中的变量");
CalculateFormulaVarBO calculateFormulaVarBO = new CalculateFormulaVarBO(simpleEmployees, salaryArchiveData, addUpSituationPOS, addUpDeductionPOS, otherDeductionPOS, welfareData, attendQuoteDataDTOS, salaryAcctResultPOS, variableArchiveList,lastMonthResultPOS);
CalculateFormulaVarBO calculateFormulaVarBO = new CalculateFormulaVarBO(simpleEmployees, salaryArchiveData, addUpSituationPOS, addUpDeductionPOS, otherDeductionPOS, welfareData, attendQuoteDataDTOS, salaryAcctResultPOS, variableArchiveList, lastMonthResultPOS);
Map<String, List<CalculateFormulaVarBO.FormulaVarValue>> formulaVarMap = calculateFormulaVarBO.convert2FormulaVar(salaryAcctCalculateBO);
sw.stop();
sw.start("数据结构准备");
@ -217,6 +226,7 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc
for (SalaryAcctEmployeePO salaryAcctEmployeePO : salaryAcctCalculateBO.getSalaryAcctEmployeePOS()) {
Long salaryAcctEmployeePOId = salaryAcctEmployeePO.getId();
List<Long> lockItems = salaryAcctEmployeePO.getLockItems();
List<Long> markItems = salaryAcctEmployeePO.getMarkItems();
//1 获取当前薪资核算人员的公式中的变量的值
List<CalculateFormulaVarBO.FormulaVarValue> formulaVarValues = formulaVarMap.get(salaryAcctEmployeePO.getEmployeeId() + "_" + salaryAcctEmployeePO.getTaxAgentId());
//2 人员信息
@ -280,6 +290,11 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc
// 处理小数点
resultValue = SalaryAcctFormulaBO.roundResultValue(resultValue, salaryItemPO, salarySobBackItems, salarySobBackItemMap, salaryItemIdKeySalarySobItemPOMap);
//如果标记了取上个月标记的值
if (markItems != null && markItems.contains(salaryItemId)) {
resultValue = lastMonthResultMap.getOrDefault(salaryAcctEmployeePO.getEmployeeId() + "_" + salaryAcctEmployeePO.getTaxAgentId() + "_" + salaryItemId, StringUtils.EMPTY);
}
//是否锁定
if (lockItems != null && lockItems.contains(salaryItemId)) {
resultValue = empItemValueMap.getOrDefault(salaryAcctEmployeePOId + "_" + salaryItemId, StringUtils.EMPTY);