Merge branch 'release/个税版本' into release/个税&业务线
This commit is contained in:
commit
0b27d47d30
|
|
@ -9,18 +9,29 @@ import com.engine.salary.biz.SalarySobItemGroupBiz;
|
||||||
import com.engine.salary.biz.SalarySobItemHideBiz;
|
import com.engine.salary.biz.SalarySobItemHideBiz;
|
||||||
import com.engine.salary.config.SalaryElogConfig;
|
import com.engine.salary.config.SalaryElogConfig;
|
||||||
import com.engine.salary.constant.SalaryDefaultTenantConstant;
|
import com.engine.salary.constant.SalaryDefaultTenantConstant;
|
||||||
|
import com.engine.salary.entity.datacollection.AddUpDeduction;
|
||||||
|
import com.engine.salary.entity.datacollection.AddUpSituation;
|
||||||
|
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
|
||||||
|
import com.engine.salary.entity.datacollection.dto.AttendQuoteDataDTO;
|
||||||
|
import com.engine.salary.entity.datacollection.dto.AttendQuoteFieldListDTO;
|
||||||
|
import com.engine.salary.entity.datacollection.po.OtherDeductionPO;
|
||||||
|
import com.engine.salary.entity.datacollection.po.VariableItemPO;
|
||||||
|
import com.engine.salary.entity.salaryacct.bo.CalculateFormulaVarBO;
|
||||||
|
import com.engine.salary.entity.salaryacct.bo.SalaryAcctCalculateBO;
|
||||||
import com.engine.salary.entity.salaryacct.bo.SalaryAcctCalculatePriorityBO;
|
import com.engine.salary.entity.salaryacct.bo.SalaryAcctCalculatePriorityBO;
|
||||||
import com.engine.salary.entity.salaryacct.bo.SalaryAcctConfig;
|
import com.engine.salary.entity.salaryacct.bo.SalaryAcctConfig;
|
||||||
|
import com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO;
|
||||||
|
import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO;
|
||||||
import com.engine.salary.entity.salaryacct.po.SalaryAcctResultPO;
|
import com.engine.salary.entity.salaryacct.po.SalaryAcctResultPO;
|
||||||
import com.engine.salary.entity.salaryarchive.config.ArchiveFieldConfig;
|
import com.engine.salary.entity.salaryarchive.dto.SalaryArchiveDataDTO;
|
||||||
import com.engine.salary.entity.salaryformula.ExpressFormula;
|
import com.engine.salary.entity.salaryformula.ExpressFormula;
|
||||||
import com.engine.salary.entity.salaryformula.po.FormulaVar;
|
|
||||||
import com.engine.salary.entity.salaryformula.config.FormluaConfig;
|
import com.engine.salary.entity.salaryformula.config.FormluaConfig;
|
||||||
import com.engine.salary.entity.salaryformula.po.FormulaPO;
|
import com.engine.salary.entity.salaryformula.po.FormulaPO;
|
||||||
import com.engine.salary.entity.salaryformula.po.FormulaVar;
|
import com.engine.salary.entity.salaryformula.po.FormulaVar;
|
||||||
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
|
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
|
||||||
import com.engine.salary.entity.salarysob.bo.SalarySobItemAggregateBO;
|
import com.engine.salary.entity.salarysob.bo.SalarySobItemAggregateBO;
|
||||||
import com.engine.salary.entity.salarysob.dto.SalaryItemTopologyDTO;
|
import com.engine.salary.entity.salarysob.dto.SalaryItemTopologyDTO;
|
||||||
|
import com.engine.salary.entity.salarysob.dto.SalarySobCycleDTO;
|
||||||
import com.engine.salary.entity.salarysob.dto.SalarySobItemAggregateDTO;
|
import com.engine.salary.entity.salarysob.dto.SalarySobItemAggregateDTO;
|
||||||
import com.engine.salary.entity.salarysob.dto.SalarySobItemFormDTO;
|
import com.engine.salary.entity.salarysob.dto.SalarySobItemFormDTO;
|
||||||
import com.engine.salary.entity.salarysob.param.SalaryItemTopologyQueryParam;
|
import com.engine.salary.entity.salarysob.param.SalaryItemTopologyQueryParam;
|
||||||
|
|
@ -30,6 +41,7 @@ import com.engine.salary.entity.taxagent.param.TaxAgentQueryParam;
|
||||||
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
|
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
|
||||||
import com.engine.salary.enums.OperateTypeEnum;
|
import com.engine.salary.enums.OperateTypeEnum;
|
||||||
import com.engine.salary.enums.SalaryValueTypeEnum;
|
import com.engine.salary.enums.SalaryValueTypeEnum;
|
||||||
|
import com.engine.salary.enums.salaryaccounting.SalaryAcctRecordStatusEnum;
|
||||||
import com.engine.salary.enums.salaryformula.SalaryFormulaReferenceEnum;
|
import com.engine.salary.enums.salaryformula.SalaryFormulaReferenceEnum;
|
||||||
import com.engine.salary.enums.salaryformula.SalarySQLReferenceEnum;
|
import com.engine.salary.enums.salaryformula.SalarySQLReferenceEnum;
|
||||||
import com.engine.salary.enums.auth.AuthFilterTypeEnum;
|
import com.engine.salary.enums.auth.AuthFilterTypeEnum;
|
||||||
|
|
@ -46,11 +58,13 @@ import com.engine.salary.util.valid.ValidUtil;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
|
import org.apache.commons.collections4.MapUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.commons.lang3.math.NumberUtils;
|
import org.apache.commons.lang3.math.NumberUtils;
|
||||||
import weaver.general.BaseBean;
|
import weaver.general.BaseBean;
|
||||||
import weaver.hrm.User;
|
import weaver.hrm.User;
|
||||||
|
|
||||||
|
import java.time.Month;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
@ -121,6 +135,59 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
|
||||||
}
|
}
|
||||||
// private LoggerTemplate salarySobLoggerTemplate;
|
// private LoggerTemplate salarySobLoggerTemplate;
|
||||||
|
|
||||||
|
private SalaryAcctEmployeeService getSalaryAcctEmployeeService(User user) {
|
||||||
|
return ServiceUtil.getService(SalaryAcctEmployeeServiceImpl.class, user);
|
||||||
|
}
|
||||||
|
|
||||||
|
private SalaryAcctRecordService getSalaryAcctRecordService(User user) {
|
||||||
|
return ServiceUtil.getService(SalaryAcctRecordServiceImpl.class, user);
|
||||||
|
}
|
||||||
|
|
||||||
|
private SalarySobService getSalarySobService(User user) {
|
||||||
|
return ServiceUtil.getService(SalarySobServiceImpl.class, user);
|
||||||
|
}
|
||||||
|
|
||||||
|
private SIAccountService getSIAccountService(User user) {
|
||||||
|
return ServiceUtil.getService(SIAccountServiceImpl.class, user);
|
||||||
|
}
|
||||||
|
|
||||||
|
private AttendQuoteFieldService getAttendQuoteFieldService(User user) {
|
||||||
|
return ServiceUtil.getService(AttendQuoteFieldServiceImpl.class, user);
|
||||||
|
}
|
||||||
|
|
||||||
|
private VariableItemService getVariableItemService(User user) {
|
||||||
|
return ServiceUtil.getService(VariableItemServiceImpl.class, user);
|
||||||
|
}
|
||||||
|
|
||||||
|
private SalaryEmployeeService getSalaryEmployeeService(User user) {
|
||||||
|
return ServiceUtil.getService(SalaryEmployeeServiceImpl.class, user);
|
||||||
|
}
|
||||||
|
|
||||||
|
private SalaryArchiveService getSalaryArchiveService(User user) {
|
||||||
|
return ServiceUtil.getService(SalaryArchiveServiceImpl.class, user);
|
||||||
|
}
|
||||||
|
|
||||||
|
private AddUpSituationService getAddUpSituationService(User user) {
|
||||||
|
return ServiceUtil.getService(AddUpSituationServiceImpl.class, user);
|
||||||
|
}
|
||||||
|
|
||||||
|
private AddUpDeductionService getAddUpDeductionService(User user) {
|
||||||
|
return ServiceUtil.getService(AddUpDeductionServiceImpl.class, user);
|
||||||
|
}
|
||||||
|
|
||||||
|
private OtherDeductionService getOtherDeductionService(User user) {
|
||||||
|
return ServiceUtil.getService(OtherDeductionServiceImpl.class, user);
|
||||||
|
}
|
||||||
|
|
||||||
|
private AttendQuoteDataService getAttendQuoteDataService(User user) {
|
||||||
|
return ServiceUtil.getService(AttendQuoteDataServiceImpl.class, user);
|
||||||
|
}
|
||||||
|
|
||||||
|
private VariableArchiveService getVariableArchiveService(User user) {
|
||||||
|
return ServiceUtil.getService(VariableArchiveServiceImpl.class, user);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<SalarySobItemPO> list() {
|
public List<SalarySobItemPO> list() {
|
||||||
return salarySobItemMapper.listAll();
|
return salarySobItemMapper.listAll();
|
||||||
|
|
@ -623,7 +690,7 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
|
||||||
}
|
}
|
||||||
salarySobItemPO.setFormula(formulaPO);
|
salarySobItemPO.setFormula(formulaPO);
|
||||||
}
|
}
|
||||||
if(SalaryEntityUtil.isNotNullOrEmpty(salarySobItemPO.getSalaryItemId())){
|
if (SalaryEntityUtil.isNotNullOrEmpty(salarySobItemPO.getSalaryItemId())) {
|
||||||
SalaryItemPO salaryItemPO = itemIdMap.get(salarySobItemPO.getSalaryItemId());
|
SalaryItemPO salaryItemPO = itemIdMap.get(salarySobItemPO.getSalaryItemId());
|
||||||
salarySobItemPO.setSalaryItem(salaryItemPO);
|
salarySobItemPO.setSalaryItem(salaryItemPO);
|
||||||
}
|
}
|
||||||
|
|
@ -671,7 +738,7 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
|
||||||
salarySobItemFormDTO
|
salarySobItemFormDTO
|
||||||
.setId(salarySobItemPO.getId())
|
.setId(salarySobItemPO.getId())
|
||||||
.setName(salaryItemPO.getName())
|
.setName(salaryItemPO.getName())
|
||||||
.setItemHide(salarySobItemPO.getItemHide()==null?0:Integer.parseInt(salarySobItemPO.getItemHide().toString()))
|
.setItemHide(salarySobItemPO.getItemHide() == null ? 0 : Integer.parseInt(salarySobItemPO.getItemHide().toString()))
|
||||||
.setDataType(salaryItemPO.getDataType())
|
.setDataType(salaryItemPO.getDataType())
|
||||||
.setRoundingMode(salarySobItemPO.getRoundingMode() == null ? salaryItemPO.getRoundingMode() : salarySobItemPO.getRoundingMode())
|
.setRoundingMode(salarySobItemPO.getRoundingMode() == null ? salaryItemPO.getRoundingMode() : salarySobItemPO.getRoundingMode())
|
||||||
.setPattern(salarySobItemPO.getPattern() == null ? salaryItemPO.getPattern() : salarySobItemPO.getPattern())
|
.setPattern(salarySobItemPO.getPattern() == null ? salaryItemPO.getPattern() : salarySobItemPO.getPattern())
|
||||||
|
|
@ -720,7 +787,7 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
|
||||||
salaryItemTopologyDTO.setSalaryItemId(salaryItemPO.getId());
|
salaryItemTopologyDTO.setSalaryItemId(salaryItemPO.getId());
|
||||||
salaryItemTopologyDTO.setSalaryItemName(salaryItemPO.getName());
|
salaryItemTopologyDTO.setSalaryItemName(salaryItemPO.getName());
|
||||||
salaryItemTopologyDTO.setFormula(expressFormula);
|
salaryItemTopologyDTO.setFormula(expressFormula);
|
||||||
salaryItemTopologyDTO.setResult(topologyData.getResultItemMap().getOrDefault(salaryItemPO.getId(), ""));
|
salaryItemTopologyDTO.setResult(topologyData.getResultItemMap().getOrDefault(SalaryFormulaReferenceEnum.SALARY_ITEM.getValue() + "_" + salaryItemPO.getCode(), ""));
|
||||||
|
|
||||||
topology(salaryItemTopologyDTO, topologyData);
|
topology(salaryItemTopologyDTO, topologyData);
|
||||||
|
|
||||||
|
|
@ -761,7 +828,8 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
|
||||||
for (int i = 0; i < parameters.size(); i++) {
|
for (int i = 0; i < parameters.size(); i++) {
|
||||||
FormulaVar formulaVar = parameters.get(i);
|
FormulaVar formulaVar = parameters.get(i);
|
||||||
String source = formulaVar.getSource();
|
String source = formulaVar.getSource();
|
||||||
String fieldId = formulaVar.getFieldId().replace(source + "_", "");
|
String fieldId = formulaVar.getFieldId();
|
||||||
|
String code = fieldId.replace(source + "_", "");
|
||||||
String name = formulaVar.getName();
|
String name = formulaVar.getName();
|
||||||
String fieldName = formulaVar.getFieldName();
|
String fieldName = formulaVar.getFieldName();
|
||||||
//是否是薪资项目
|
//是否是薪资项目
|
||||||
|
|
@ -779,26 +847,26 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
|
||||||
}
|
}
|
||||||
|
|
||||||
ExpressFormula expressFormula;
|
ExpressFormula expressFormula;
|
||||||
if (salarySobItemCodeMap.containsKey(fieldId)) {
|
if (salarySobItemCodeMap.containsKey(code)) {
|
||||||
// 如果薪资账套下重新定义了薪资项目的公式,则使用薪资账套下的公式,否则使用薪资项目本身的公式
|
// 如果薪资账套下重新定义了薪资项目的公式,则使用薪资账套下的公式,否则使用薪资项目本身的公式
|
||||||
expressFormula = expressFormulaIdMap.get(salarySobItemCodeMap.get(fieldId).getFormulaId());
|
expressFormula = expressFormulaIdMap.get(salarySobItemCodeMap.get(code).getFormulaId());
|
||||||
} else if (salaryItemCodeMap.containsKey(fieldId)) {
|
} else if (salaryItemCodeMap.containsKey(code)) {
|
||||||
expressFormula = expressFormulaIdMap.get(salaryItemCodeMap.get(fieldId).getFormulaId());
|
expressFormula = expressFormulaIdMap.get(salaryItemCodeMap.get(code).getFormulaId());
|
||||||
} else {
|
} else {
|
||||||
expressFormula = null;
|
expressFormula = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
SalaryItemPO salaryItemChild = isSalaryItemVar ? salaryItemCodeMap.get(fieldId) : new SalaryItemPO();
|
SalaryItemPO salaryItemChild = isSalaryItemVar ? salaryItemCodeMap.get(code) : new SalaryItemPO();
|
||||||
|
|
||||||
SalaryItemTopologyDTO salaryItemTopologyChild = new SalaryItemTopologyDTO();
|
SalaryItemTopologyDTO salaryItemTopologyChild = new SalaryItemTopologyDTO();
|
||||||
salaryItemTopologyChild.setSalaryItemId(isSalaryItemVar ? salaryItemChild.getId() : null);
|
salaryItemTopologyChild.setSalaryItemId(isSalaryItemVar ? salaryItemChild.getId() : null);
|
||||||
salaryItemTopologyChild.setSalaryItemName(isSalaryItemVar ? salaryItemChild.getName() : fieldName);
|
salaryItemTopologyChild.setSalaryItemName(isSalaryItemVar ? salaryItemChild.getName() : fieldName);
|
||||||
salaryItemTopologyChild.setFormula(expressFormula);
|
salaryItemTopologyChild.setFormula(expressFormula);
|
||||||
salaryItemTopologyChild.setResult(isSalaryItemVar ? topologyData.getResultItemMap().getOrDefault(salaryItemChild.getId(), "") : "");
|
salaryItemTopologyChild.setResult(topologyData.getResultItemMap().getOrDefault(fieldId, ""));
|
||||||
salaryItemTopologyDTOChildren.add(salaryItemTopologyChild);
|
salaryItemTopologyDTOChildren.add(salaryItemTopologyChild);
|
||||||
|
|
||||||
if (isSalaryItemVar) {
|
if (isSalaryItemVar) {
|
||||||
SalaryItemPO salaryItemChildChild = salaryItemCodeMap.get(fieldId);
|
SalaryItemPO salaryItemChildChild = salaryItemCodeMap.get(code);
|
||||||
SalaryValueTypeEnum salaryValueTypeEnum = SalaryValueTypeEnum.parseByValue(salaryItemChildChild.getValueType());
|
SalaryValueTypeEnum salaryValueTypeEnum = SalaryValueTypeEnum.parseByValue(salaryItemChildChild.getValueType());
|
||||||
if (salaryValueTypeEnum != SalaryValueTypeEnum.INPUT) {
|
if (salaryValueTypeEnum != SalaryValueTypeEnum.INPUT) {
|
||||||
topologyData.setSalaryItemId(salaryItemChildChild.getId());
|
topologyData.setSalaryItemId(salaryItemChildChild.getId());
|
||||||
|
|
@ -843,9 +911,126 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
|
||||||
//薪资结果
|
//薪资结果
|
||||||
Long acctEmpId = param.getAcctEmpId();
|
Long acctEmpId = param.getAcctEmpId();
|
||||||
if (acctEmpId != null) {
|
if (acctEmpId != null) {
|
||||||
List<SalaryAcctResultPO> results = getSalaryAcctResultService(user).listBySalaryAcctEmployeeId(acctEmpId);
|
SalaryAcctEmployeePO acctEmployeePO = getSalaryAcctEmployeeService(user).getById(acctEmpId);
|
||||||
Map<Long, String> resultItemMap = SalaryEntityUtil.convert2Map(results, SalaryAcctResultPO::getSalaryItemId, SalaryAcctResultPO::getResultValue);
|
List<SalaryAcctEmployeePO> acctEmployeePOS = new ArrayList<>();
|
||||||
topologyData.setResultItemMap(resultItemMap);
|
acctEmployeePOS.add(acctEmployeePO);
|
||||||
|
|
||||||
|
Long salaryAcctRecordId = acctEmployeePO.getSalaryAcctRecordId();
|
||||||
|
|
||||||
|
// 1、查询薪资核算记录
|
||||||
|
SalaryAcctRecordPO salaryAcctRecordPO = getSalaryAcctRecordService(user).getById(salaryAcctRecordId);
|
||||||
|
if (Objects.isNull(salaryAcctRecordPO)) {
|
||||||
|
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98747, "薪资核算记录不存在或已被删除"));
|
||||||
|
}
|
||||||
|
//查询对应账套
|
||||||
|
SalarySobPO salarySobPO = getSalarySobService(user).getById(salaryAcctRecordPO.getSalarySobId());
|
||||||
|
if (Objects.isNull(salarySobPO)) {
|
||||||
|
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98747, "薪资账套不存在或已被删除"));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 不是查询薪资账套下实时的薪资项目,而是查询发起薪资核算时存储的薪资项目快照
|
||||||
|
SalaryAcctConfig salaryAcctSobConfig = getSalaryAcctSobConfigService(user).getSalaryAcctConfig(salaryAcctRecordId);
|
||||||
|
|
||||||
|
// 1.1、如果薪资核算记录已经归档了,就不能继续核算
|
||||||
|
if (!Objects.equals(salaryAcctRecordPO.getStatus(), SalaryAcctRecordStatusEnum.NOT_ARCHIVED.getValue())) {
|
||||||
|
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(99148, "当前薪资核算记录已归档,请重新打开后再进行核算"));
|
||||||
|
}
|
||||||
|
// 2、查询薪资核算记录的薪资周期、考勤周期等
|
||||||
|
SalarySobCycleDTO salarySobCycleDTO = getSalaryAcctRecordService(user).getSalarySobCycleById(salaryAcctRecordId);
|
||||||
|
// 3、查询薪资核算记录所用薪资账套的薪资项目副本
|
||||||
|
List<SalarySobItemPO> salarySobItemPOS = salaryAcctSobConfig.getSalarySobItems();
|
||||||
|
if (CollectionUtils.isEmpty(salarySobItemPOS)) {
|
||||||
|
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(99151, "当前所用的薪资账套未选择任何薪资项目,无法核算"));
|
||||||
|
}
|
||||||
|
// 回算薪资项目
|
||||||
|
List<SalarySobBackItemPO> salarySobBackItems = Collections.emptyList();
|
||||||
|
if (Objects.equals(salaryAcctRecordPO.getBackCalcStatus(), 1)) {
|
||||||
|
salarySobBackItems = salaryAcctSobConfig.getSalarySobBackItems();
|
||||||
|
}
|
||||||
|
// 4、查询当前租户的所有薪资项目
|
||||||
|
List<SalaryItemPO> salaryItemPOS = getSalaryItemService(user).listAll();
|
||||||
|
// 6、查询社保福利的所有字段
|
||||||
|
Map<String, String> welfareColumns = getSIAccountService(user).welfareColumns();
|
||||||
|
// 7、查询考勤引用的所有字段
|
||||||
|
List<AttendQuoteFieldListDTO> attendQuoteFieldListDTOS = getAttendQuoteFieldService(user).listAll();
|
||||||
|
List<VariableItemPO> variableItemPOS = getVariableItemService(user).listAll();
|
||||||
|
|
||||||
|
// 8、查询公式详情
|
||||||
|
Set<Long> formulaIds = SalaryEntityUtil.properties(salarySobItemPOS, SalarySobItemPO::getFormulaId);
|
||||||
|
formulaIds.addAll(SalaryEntityUtil.properties(salaryItemPOS, SalaryItemPO::getFormulaId));
|
||||||
|
formulaIds.addAll(SalaryEntityUtil.properties(salarySobBackItems, SalarySobBackItemPO::getFormulaId));
|
||||||
|
List<ExpressFormula> formulas = getSalaryFormulaService(user).listExpressFormula(formulaIds);
|
||||||
|
// 本次运算的回算薪资项目所涉及的变量
|
||||||
|
// Set<String> issuedFieldIds = getIssuedFieldIds(salarySobBackItems);
|
||||||
|
|
||||||
|
// 10、根据id查询其他合并计税的薪资核算记录
|
||||||
|
List<SalaryAcctRecordPO> otherSalaryAcctRecordPOS = getSalaryAcctRecordService(user).listById4OtherConsolidatedTax(salaryAcctRecordPO.getId());
|
||||||
|
|
||||||
|
// 12.3、生成本次运算的key
|
||||||
|
String calculateKey = UUID.randomUUID().toString();
|
||||||
|
// 12.5、多线程运算,运算结果存放在临时表中
|
||||||
|
SalaryAcctCalculateBO salaryAcctCalculateBO = new SalaryAcctCalculateBO()
|
||||||
|
.setSalaryAcctRecordPO(salaryAcctRecordPO)
|
||||||
|
.setSalarySobPO(salarySobPO)
|
||||||
|
.setSalarySobCycleDTO(salarySobCycleDTO)
|
||||||
|
.setOtherSalaryAcctRecordPOS(otherSalaryAcctRecordPOS)
|
||||||
|
.setSalarySobItemPOS(salarySobItemPOS)
|
||||||
|
.setSalaryItemIdWithPriorityList(new ArrayList<>())
|
||||||
|
.setExpressFormulas(formulas)
|
||||||
|
.setSalaryItemPOS(salaryItemPOS)
|
||||||
|
.setSalarySobAdjustRulePOS(new ArrayList<>())
|
||||||
|
.setWelfareColumns(MapUtils.emptyIfNull(welfareColumns))
|
||||||
|
.setAttendQuoteFieldListDTOS(attendQuoteFieldListDTOS)
|
||||||
|
.setSalaryAcctEmployeePOS(acctEmployeePOS)
|
||||||
|
.setIssuedFieldIds(new HashSet<>())
|
||||||
|
.setResults(null)
|
||||||
|
.setCalculateKey(calculateKey)
|
||||||
|
.setVariableItems(variableItemPOS)
|
||||||
|
.setTaxDeclarationFunction(null)
|
||||||
|
.setTaxIds(null);
|
||||||
|
|
||||||
|
|
||||||
|
List<Long> employeeIds = Collections.singletonList(acctEmployeePO.getEmployeeId());
|
||||||
|
List<DataCollectionEmployee> simpleEmployees = getSalaryEmployeeService(user).getEmployeeByIdsAll(employeeIds);
|
||||||
|
Long taxAgentId = salaryAcctCalculateBO.getSalarySobPO().getTaxAgentId();
|
||||||
|
List<SalaryArchiveDataDTO> salaryArchiveData = getSalaryArchiveService(user).getSalaryArchiveData(salarySobCycleDTO.getSalaryCycle(), employeeIds, taxAgentId);
|
||||||
|
List<AddUpSituation> addUpSituationPOS;
|
||||||
|
if (salarySobCycleDTO.getTaxCycle().getMonth() == Month.JANUARY) {
|
||||||
|
// 3.1、如果当前税款所属期是本年度第一个税款所属期,就不需要查询往期累计情况
|
||||||
|
addUpSituationPOS = Collections.emptyList();
|
||||||
|
} else {
|
||||||
|
addUpSituationPOS = getAddUpSituationService(user).getAddUpSituationList(salarySobCycleDTO.getTaxCycle().plusMonths(-1), employeeIds);
|
||||||
|
}
|
||||||
|
List<AddUpDeduction> addUpDeductionPOS = getAddUpDeductionService(user).getAddUpDeductionList(salarySobCycleDTO.getTaxCycle(), employeeIds, taxAgentId);
|
||||||
|
List<OtherDeductionPO> otherDeductionPOS = getOtherDeductionService(user).getOtherDeductionList(salarySobCycleDTO.getTaxCycle(), employeeIds, taxAgentId);
|
||||||
|
List<Map<String, Object>> welfareData = new ArrayList<>();
|
||||||
|
welfareData.addAll(getSIAccountService(user).welfareData(salarySobCycleDTO.getSocialSecurityCycle().toString(), employeeIds, taxAgentId));
|
||||||
|
List<AttendQuoteDataDTO> attendQuoteDataDTOS = getAttendQuoteDataService(user).getAttendQuoteData(salarySobCycleDTO.getSalaryMonth(), salarySobCycleDTO.getSalarySobId(), employeeIds);
|
||||||
|
List<Long> salaryAcctEmployeeIds = SalaryEntityUtil.properties(salaryAcctCalculateBO.getSalaryAcctEmployeePOS(), SalaryAcctEmployeePO::getId, Collectors.toList());
|
||||||
|
List<SalaryAcctResultPO> salaryAcctResultPOS = getSalaryAcctResultService(user).listBySalaryAcctEmployeeIds(salaryAcctEmployeeIds);
|
||||||
|
Map<String, String> empItemValueMap = SalaryEntityUtil.convert2Map(salaryAcctResultPOS, p -> p.getSalaryAcctEmpId() + "_" + p.getSalaryItemId(), SalaryAcctResultPO::getResultValue);
|
||||||
|
List<Map<String, Object>> variableArchiveList = getVariableArchiveService(user).listBySalaryMonthAndEmployeeIds(salarySobCycleDTO.getSalaryMonth(), employeeIds, taxAgentId);
|
||||||
|
Map<String, List<SalaryAcctResultPO>> collect = salaryAcctResultPOS.stream().collect(Collectors.groupingBy(k -> k.getEmployeeId() + "-" + k.getTaxAgentId() + "-" + k.getSalaryItemId()));
|
||||||
|
Map<String, String> salaryAcctResultPOMap = new HashMap<>();
|
||||||
|
for (Map.Entry<String, List<SalaryAcctResultPO>> et : collect.entrySet()) {
|
||||||
|
salaryAcctResultPOMap.put(et.getKey(), et.getValue().get(0).getOriginResultValue());
|
||||||
|
}
|
||||||
|
Set<Long> otherSalaryAcctRecordIds = SalaryEntityUtil.properties(salaryAcctCalculateBO.getOtherSalaryAcctRecordPOS(), SalaryAcctRecordPO::getId);
|
||||||
|
List<SalaryAcctResultPO> otherSalaryAcctResultPOS = getSalaryAcctResultService(user).listBySalaryAcctRecordIdsAndEmployeeIds(otherSalaryAcctRecordIds, employeeIds);
|
||||||
|
Map<String, List<SalaryAcctResultPO>> otherSalaryAcctResultPOMap = SalaryEntityUtil.group2Map(otherSalaryAcctResultPOS, e -> e.getEmployeeId() + "_" + e.getTaxAgentId());
|
||||||
|
List<SalaryAcctEmployeePO> otherSalaryAcctEmployeePOS = getSalaryAcctEmployeeService(user).listBySalaryAcctRecordIdsAndEmployeeIds(otherSalaryAcctRecordIds, employeeIds);
|
||||||
|
Map<String, List<SalaryAcctEmployeePO>> otherSalaryAcctEmployeePOMap = SalaryEntityUtil.group2Map(otherSalaryAcctEmployeePOS, salaryAcctEmployeePO -> salaryAcctEmployeePO.getEmployeeId() + "_" + salaryAcctEmployeePO.getTaxAgentId());
|
||||||
|
// List<SalaryAcctResultPO> lastMonthResultPOS = getSalaryAcctResultService(user).listBySobSalaryMonth(SalaryDateUtil.toDate(salarySobCycleDTO.getSalaryMonth().minusMonths(1), 1), salaryAcctCalculateBO.getSalarySobPO().getId(), employeeIds);
|
||||||
|
CalculateFormulaVarBO calculateFormulaVarBO = new CalculateFormulaVarBO(simpleEmployees, salaryArchiveData, addUpSituationPOS, addUpDeductionPOS, otherDeductionPOS, welfareData, attendQuoteDataDTOS, salaryAcctResultPOS, variableArchiveList);
|
||||||
|
Map<String, List<CalculateFormulaVarBO.FormulaVarValue>> formulaVarMap = calculateFormulaVarBO.convert2FormulaVar(salaryAcctCalculateBO);
|
||||||
|
|
||||||
|
Map<String, String> resultMap = new HashMap<>();
|
||||||
|
formulaVarMap.entrySet().forEach(e -> {
|
||||||
|
e.getValue().forEach(f -> {
|
||||||
|
resultMap.put(f.getFieldId(), f.getFieldValue());
|
||||||
|
});
|
||||||
|
});
|
||||||
|
topologyData.setResultItemMap(resultMap);
|
||||||
} else {
|
} else {
|
||||||
topologyData.setResultItemMap(new HashMap<>());
|
topologyData.setResultItemMap(new HashMap<>());
|
||||||
}
|
}
|
||||||
|
|
@ -879,7 +1064,7 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
|
||||||
/**
|
/**
|
||||||
* 核算结果
|
* 核算结果
|
||||||
*/
|
*/
|
||||||
Map<Long, String> resultItemMap;
|
Map<String, String> resultItemMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue