|
|
|
|
@ -388,11 +388,11 @@ public class SIAccountBiz extends Service {
|
|
|
|
|
insuranceAccountDetailPO.setPaymentOrganization(paymentOrganization);
|
|
|
|
|
|
|
|
|
|
//核算社保
|
|
|
|
|
accountSocial(insuranceAccountDetailPO, v, tenantKey);
|
|
|
|
|
accountSocial(insuranceAccountDetailPO, v, billMonth, tenantKey);
|
|
|
|
|
//核算公积金
|
|
|
|
|
accountFund(insuranceAccountDetailPO, v, tenantKey);
|
|
|
|
|
accountFund(insuranceAccountDetailPO, v, billMonth, tenantKey);
|
|
|
|
|
//核算其他福利
|
|
|
|
|
accountOther(insuranceAccountDetailPO, v, tenantKey);
|
|
|
|
|
accountOther(insuranceAccountDetailPO, v, billMonth, tenantKey);
|
|
|
|
|
//计算合计
|
|
|
|
|
account(insuranceAccountDetailPO);
|
|
|
|
|
//临时表PO
|
|
|
|
|
@ -524,7 +524,7 @@ public class SIAccountBiz extends Service {
|
|
|
|
|
return insuranceAccountDetailPO;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public InsuranceAccountDetailPO accountOther(InsuranceAccountDetailPO insuranceAccountDetailPO, InsuranceArchivesAccountPO accountPO, String tenantKey) {
|
|
|
|
|
public InsuranceAccountDetailPO accountOther(InsuranceAccountDetailPO insuranceAccountDetailPO, InsuranceArchivesAccountPO accountPO, String billMonth, String tenantKey) {
|
|
|
|
|
if (accountPO.getOther() != null) {
|
|
|
|
|
InsuranceArchivesOtherSchemePO otherPO = accountPO.getOther();
|
|
|
|
|
insuranceAccountDetailPO.setOtherPayOrg(otherPO.getPaymentOrganization());
|
|
|
|
|
@ -536,8 +536,10 @@ public class SIAccountBiz extends Service {
|
|
|
|
|
List<InsuranceSchemeDetailPO> detailPOS = MapperProxyFactory.getProxy(InsuranceSchemeDetailMapper.class).queryListBySchemeId(otherPO.getOtherSchemeId());
|
|
|
|
|
encryptUtil.decryptList(detailPOS, InsuranceSchemeDetailPO.class);
|
|
|
|
|
//方案中包含的需要缴纳其他的个人福利
|
|
|
|
|
int monthIndex = Integer.parseInt(billMonth.split("-")[1]) - 1;
|
|
|
|
|
Map<Long, InsuranceSchemeDetailPO> otherPerson = detailPOS.stream()
|
|
|
|
|
.filter(item -> Objects.equals(IsPaymentEnum.YES.getValue(), item.getIsPayment()) && item.getPaymentScope() == PaymentScopeEnum.SCOPE_PERSON.getValue())
|
|
|
|
|
.filter(item -> Objects.equals(IsPaymentEnum.YES.getValue(), item.getIsPayment()) && Objects.equals(item.getPaymentScope(), PaymentScopeEnum.SCOPE_PERSON.getValue())
|
|
|
|
|
&& (item.getPaymentCycle() == null || item.getPaymentCycle() == 0 || (item.getPaymentCycle() == 1 && String.valueOf(item.getCycleSetting().charAt(monthIndex)).equals("1"))))
|
|
|
|
|
.collect(
|
|
|
|
|
Collectors.toMap(InsuranceSchemeDetailPO::getInsuranceId, Function.identity()));
|
|
|
|
|
//档案中包含的基数信息
|
|
|
|
|
@ -551,6 +553,8 @@ public class SIAccountBiz extends Service {
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
//判断核算周期、核算月、福利起始缴纳月的关系
|
|
|
|
|
checkCycleSettingWithStartMonth(otherPerson, billMonth, otherPO.getOtherStartTime());
|
|
|
|
|
|
|
|
|
|
List<BigDecimal> otherPer = new ArrayList<>();
|
|
|
|
|
Map<String, String> otherPerJsonMap = new HashMap<>();
|
|
|
|
|
@ -560,7 +564,29 @@ public class SIAccountBiz extends Service {
|
|
|
|
|
BigDecimal paymentNum = new BigDecimal(StringUtils.isBlank(archivesPerson.get(String.valueOf(e))) ? "0" : archivesPerson.get(String.valueOf(e)));
|
|
|
|
|
BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost());
|
|
|
|
|
Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum();
|
|
|
|
|
BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
|
|
|
|
|
// BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
|
|
|
|
|
BigDecimal result = new BigDecimal("0");
|
|
|
|
|
if (po.getPaymentCycle() != null && po.getPaymentCycle() == 1) {
|
|
|
|
|
int monthValue = 1;
|
|
|
|
|
for (int i = monthIndex - 1; i >= 0; i--) {
|
|
|
|
|
String cycleValue = po.getCycleSetting().charAt(i) + "";
|
|
|
|
|
if (Integer.parseInt(cycleValue) == 1) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
monthValue++;
|
|
|
|
|
}
|
|
|
|
|
if (po.getAccountType() == 1) {
|
|
|
|
|
paymentNum = paymentNum.multiply(new BigDecimal(monthValue));
|
|
|
|
|
fixedCost = fixedCost.multiply(new BigDecimal(monthValue));
|
|
|
|
|
result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
|
|
|
|
|
} else {
|
|
|
|
|
for (int i = 0; i < monthValue; i++) {
|
|
|
|
|
result = result.add(SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
|
|
|
|
|
}
|
|
|
|
|
otherPerJsonMap.put(String.valueOf(e), result.toPlainString());
|
|
|
|
|
otherPer.add(result);
|
|
|
|
|
});
|
|
|
|
|
@ -574,7 +600,8 @@ public class SIAccountBiz extends Service {
|
|
|
|
|
//方案中包含的需要缴纳公积金的单位福利
|
|
|
|
|
Map<Long, InsuranceSchemeDetailPO> otherCom = detailPOS.stream()
|
|
|
|
|
.filter(
|
|
|
|
|
item -> Objects.equals(IsPaymentEnum.YES.getValue(), item.getIsPayment()) && item.getPaymentScope() == PaymentScopeEnum.SCOPE_COMPANY.getValue())
|
|
|
|
|
item -> Objects.equals(IsPaymentEnum.YES.getValue(), item.getIsPayment()) && Objects.equals(item.getPaymentScope(), PaymentScopeEnum.SCOPE_COMPANY.getValue())
|
|
|
|
|
&& (item.getPaymentCycle() == null || item.getPaymentCycle() == 0 || (item.getPaymentCycle() == 1 && String.valueOf(item.getCycleSetting().charAt(monthIndex)).equals("1"))))
|
|
|
|
|
.collect(
|
|
|
|
|
Collectors.toMap(InsuranceSchemeDetailPO::getInsuranceId, Function.identity()));
|
|
|
|
|
//档案中包含的基数信息
|
|
|
|
|
@ -588,6 +615,8 @@ public class SIAccountBiz extends Service {
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
//判断核算周期、核算月、福利起始缴纳月的关系
|
|
|
|
|
checkCycleSettingWithStartMonth(otherCom, billMonth, otherPO.getOtherStartTime());
|
|
|
|
|
|
|
|
|
|
List<BigDecimal> otherComList = new ArrayList<>();
|
|
|
|
|
Map<String, String> otherComJsonMap = new HashMap<>();
|
|
|
|
|
@ -597,7 +626,29 @@ public class SIAccountBiz extends Service {
|
|
|
|
|
BigDecimal paymentNum = new BigDecimal(StringUtils.isBlank(archivesCom.get(String.valueOf(e))) ? "0" : archivesCom.get(String.valueOf(e)));
|
|
|
|
|
BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost());
|
|
|
|
|
Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum();
|
|
|
|
|
BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
|
|
|
|
|
// BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
|
|
|
|
|
BigDecimal result = new BigDecimal("0");
|
|
|
|
|
if (Objects.equals(po.getPaymentCycle(), 1)) {
|
|
|
|
|
int monthValue = 1;
|
|
|
|
|
for (int i = monthIndex - 1; i >= 0; i--) {
|
|
|
|
|
String cycleValue = po.getCycleSetting().charAt(i) + "";
|
|
|
|
|
if (Integer.parseInt(cycleValue) == 1) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
monthValue++;
|
|
|
|
|
}
|
|
|
|
|
if (po.getAccountType() == 1) {
|
|
|
|
|
paymentNum = paymentNum.multiply(new BigDecimal(monthValue));
|
|
|
|
|
fixedCost = fixedCost.multiply(new BigDecimal(monthValue));
|
|
|
|
|
result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
|
|
|
|
|
} else {
|
|
|
|
|
for (int i = 0; i < monthValue; i++) {
|
|
|
|
|
result = result.add(SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
|
|
|
|
|
}
|
|
|
|
|
otherComJsonMap.put(String.valueOf(e), result.toPlainString());
|
|
|
|
|
otherComList.add(result);
|
|
|
|
|
});
|
|
|
|
|
@ -613,7 +664,7 @@ public class SIAccountBiz extends Service {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public InsuranceAccountDetailPO accountFund(InsuranceAccountDetailPO insuranceAccountDetailPO, InsuranceArchivesAccountPO accountPO, String tenantKey) {
|
|
|
|
|
public InsuranceAccountDetailPO accountFund(InsuranceAccountDetailPO insuranceAccountDetailPO, InsuranceArchivesAccountPO accountPO, String billMonth, String tenantKey) {
|
|
|
|
|
if (accountPO.getFund() != null) {
|
|
|
|
|
InsuranceArchivesFundSchemePO fundPO = accountPO.getFund();
|
|
|
|
|
insuranceAccountDetailPO.setFundPayOrg(fundPO.getPaymentOrganization());
|
|
|
|
|
@ -627,8 +678,10 @@ public class SIAccountBiz extends Service {
|
|
|
|
|
List<InsuranceSchemeDetailPO> detailPOS = MapperProxyFactory.getProxy(InsuranceSchemeDetailMapper.class).queryListBySchemeId(fundPO.getFundSchemeId());
|
|
|
|
|
encryptUtil.decryptList(detailPOS, InsuranceSchemeDetailPO.class);
|
|
|
|
|
//方案中包含的需要缴纳社保的个人福利
|
|
|
|
|
int monthIndex = Integer.parseInt(billMonth.split("-")[1]) - 1;
|
|
|
|
|
Map<Long, InsuranceSchemeDetailPO> fundperson = detailPOS.stream()
|
|
|
|
|
.filter(item -> IsPaymentEnum.YES.getValue() == item.getIsPayment() && item.getPaymentScope() == PaymentScopeEnum.SCOPE_PERSON.getValue())
|
|
|
|
|
.filter(item -> Objects.equals(IsPaymentEnum.YES.getValue(), item.getIsPayment()) && Objects.equals(item.getPaymentScope(), PaymentScopeEnum.SCOPE_PERSON.getValue())
|
|
|
|
|
&& (item.getPaymentCycle() == null || item.getPaymentCycle() == 0 || (item.getPaymentCycle() == 1 && String.valueOf(item.getCycleSetting().charAt(monthIndex)).equals("1"))))
|
|
|
|
|
.collect(
|
|
|
|
|
Collectors.toMap(InsuranceSchemeDetailPO::getInsuranceId, Function.identity()));
|
|
|
|
|
//档案中包含的基数信息
|
|
|
|
|
@ -642,6 +695,8 @@ public class SIAccountBiz extends Service {
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
//判断核算周期、核算月、福利起始缴纳月的关系
|
|
|
|
|
checkCycleSettingWithStartMonth(fundperson, billMonth, fundPO.getFundStartTime());
|
|
|
|
|
|
|
|
|
|
List<BigDecimal> fundPer = new ArrayList<>();
|
|
|
|
|
Map<String, String> fundPerJsonMap = new HashMap<>();
|
|
|
|
|
@ -651,7 +706,29 @@ public class SIAccountBiz extends Service {
|
|
|
|
|
BigDecimal paymentNum = new BigDecimal(StringUtils.isBlank(archivesPerson.get(String.valueOf(e))) ? "0" : archivesPerson.get(String.valueOf(e)));
|
|
|
|
|
BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost());
|
|
|
|
|
Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum();
|
|
|
|
|
BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
|
|
|
|
|
// BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
|
|
|
|
|
BigDecimal result = new BigDecimal("0");
|
|
|
|
|
if (Objects.equals(po.getPaymentCycle(), 1)) {
|
|
|
|
|
int monthValue = 1;
|
|
|
|
|
for (int i = monthIndex - 1; i >= 0; i--) {
|
|
|
|
|
String cycleValue = po.getCycleSetting().charAt(i) + "";
|
|
|
|
|
if (Integer.parseInt(cycleValue) == 1) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
monthValue++;
|
|
|
|
|
}
|
|
|
|
|
if (po.getAccountType() == 1) {
|
|
|
|
|
paymentNum = paymentNum.multiply(new BigDecimal(monthValue));
|
|
|
|
|
fixedCost = fixedCost.multiply(new BigDecimal(monthValue));
|
|
|
|
|
result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
|
|
|
|
|
} else {
|
|
|
|
|
for (int i = 0; i < monthValue; i++) {
|
|
|
|
|
result = result.add(SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
|
|
|
|
|
}
|
|
|
|
|
fundPerJsonMap.put(String.valueOf(e), result.toPlainString());
|
|
|
|
|
fundPer.add(result);
|
|
|
|
|
});
|
|
|
|
|
@ -664,7 +741,8 @@ public class SIAccountBiz extends Service {
|
|
|
|
|
|
|
|
|
|
//方案中包含的需要缴纳公积金的单位福利
|
|
|
|
|
Map<Long, InsuranceSchemeDetailPO> fundCom = detailPOS.stream()
|
|
|
|
|
.filter(item -> IsPaymentEnum.YES.getValue() == item.getIsPayment() && item.getPaymentScope() == PaymentScopeEnum.SCOPE_COMPANY.getValue())
|
|
|
|
|
.filter(item -> Objects.equals(IsPaymentEnum.YES.getValue(), item.getIsPayment()) && Objects.equals(item.getPaymentScope(), PaymentScopeEnum.SCOPE_COMPANY.getValue())
|
|
|
|
|
&& (item.getPaymentCycle() == null || item.getPaymentCycle() == 0 || (item.getPaymentCycle() == 1 && String.valueOf(item.getCycleSetting().charAt(monthIndex)).equals("1"))))
|
|
|
|
|
.collect(
|
|
|
|
|
Collectors.toMap(InsuranceSchemeDetailPO::getInsuranceId, Function.identity()));
|
|
|
|
|
//档案中包含的基数信息
|
|
|
|
|
@ -678,6 +756,8 @@ public class SIAccountBiz extends Service {
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
//判断核算周期、核算月、福利起始缴纳月的关系
|
|
|
|
|
checkCycleSettingWithStartMonth(fundCom, billMonth, fundPO.getFundStartTime());
|
|
|
|
|
|
|
|
|
|
List<BigDecimal> fundComList = new ArrayList<>();
|
|
|
|
|
Map<String, String> fundComJsonMap = new HashMap<>();
|
|
|
|
|
@ -687,8 +767,29 @@ public class SIAccountBiz extends Service {
|
|
|
|
|
BigDecimal paymentNum = new BigDecimal(StringUtils.isBlank(archivesCom.get(String.valueOf(e))) ? "0" : archivesCom.get(String.valueOf(e)));
|
|
|
|
|
BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost());
|
|
|
|
|
Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum();
|
|
|
|
|
BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
|
|
|
|
|
;
|
|
|
|
|
// BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
|
|
|
|
|
BigDecimal result = new BigDecimal("0");
|
|
|
|
|
if (Objects.equals(po.getPaymentCycle(), 1)) {
|
|
|
|
|
int monthValue = 1;
|
|
|
|
|
for (int i = monthIndex - 1; i >= 0; i--) {
|
|
|
|
|
String cycleValue = po.getCycleSetting().charAt(i) + "";
|
|
|
|
|
if (Integer.parseInt(cycleValue) == 1) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
monthValue++;
|
|
|
|
|
}
|
|
|
|
|
if (po.getAccountType() == 1) {
|
|
|
|
|
paymentNum = paymentNum.multiply(new BigDecimal(monthValue));
|
|
|
|
|
fixedCost = fixedCost.multiply(new BigDecimal(monthValue));
|
|
|
|
|
result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
|
|
|
|
|
} else {
|
|
|
|
|
for (int i = 0; i < monthValue; i++) {
|
|
|
|
|
result = result.add(SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
|
|
|
|
|
}
|
|
|
|
|
fundComJsonMap.put(String.valueOf(e), result.toPlainString());
|
|
|
|
|
fundComList.add(result);
|
|
|
|
|
});
|
|
|
|
|
@ -705,7 +806,7 @@ public class SIAccountBiz extends Service {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public InsuranceAccountDetailPO accountSocial(InsuranceAccountDetailPO insuranceAccountDetailPO, InsuranceArchivesAccountPO accountPO, String tenantKey) {
|
|
|
|
|
public InsuranceAccountDetailPO accountSocial(InsuranceAccountDetailPO insuranceAccountDetailPO, InsuranceArchivesAccountPO accountPO, String billMonth, String tenantKey) {
|
|
|
|
|
if (accountPO.getSocial() != null) {
|
|
|
|
|
InsuranceArchivesSocialSchemePO socialPO = accountPO.getSocial();
|
|
|
|
|
insuranceAccountDetailPO.setSocialPayOrg(socialPO.getPaymentOrganization());
|
|
|
|
|
@ -718,8 +819,13 @@ public class SIAccountBiz extends Service {
|
|
|
|
|
List<InsuranceSchemeDetailPO> detailPOS = MapperProxyFactory.getProxy(InsuranceSchemeDetailMapper.class).queryListBySchemeId(socialPO.getSocialSchemeId());
|
|
|
|
|
encryptUtil.decryptList(detailPOS, InsuranceSchemeDetailPO.class);
|
|
|
|
|
//方案中包含的需要缴纳社保的个人福利
|
|
|
|
|
int monthIndex = Integer.parseInt(billMonth.split("-")[1]) - 1;
|
|
|
|
|
Map<Long, InsuranceSchemeDetailPO> schemeperson = detailPOS.stream()
|
|
|
|
|
.filter(item -> Objects.equals(IsPaymentEnum.YES.getValue(), item.getIsPayment()) && Objects.equals(item.getPaymentScope(), PaymentScopeEnum.SCOPE_PERSON.getValue()))
|
|
|
|
|
.filter(item ->
|
|
|
|
|
Objects.equals(IsPaymentEnum.YES.getValue(), item.getIsPayment()) &&
|
|
|
|
|
Objects.equals(item.getPaymentScope(), PaymentScopeEnum.SCOPE_PERSON.getValue()) &&
|
|
|
|
|
(item.getPaymentCycle() == null || item.getPaymentCycle() == 0 || (item.getPaymentCycle() == 1 && String.valueOf(item.getCycleSetting().charAt(monthIndex)).equals("1")))
|
|
|
|
|
)
|
|
|
|
|
.collect(
|
|
|
|
|
Collectors.toMap(InsuranceSchemeDetailPO::getInsuranceId, Function.identity()));
|
|
|
|
|
//档案中包含的基数信息
|
|
|
|
|
@ -733,16 +839,40 @@ public class SIAccountBiz extends Service {
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
//判断核算周期、核算月、福利起始缴纳月的关系
|
|
|
|
|
checkCycleSettingWithStartMonth(schemeperson, billMonth, socialPO.getSocialStartTime());
|
|
|
|
|
|
|
|
|
|
List<BigDecimal> socialPer = new ArrayList<>();
|
|
|
|
|
Map<String, String> socialPerJsonMap = new HashMap<>();
|
|
|
|
|
needArchivesPerson.stream().forEach(e -> {
|
|
|
|
|
needArchivesPerson.forEach(e -> {
|
|
|
|
|
InsuranceSchemeDetailPO po = schemeperson.get(e);
|
|
|
|
|
BigDecimal paymentProportion = new BigDecimal(StringUtils.isBlank(po.getPaymentProportion()) ? "0" : po.getPaymentProportion()).divide(new BigDecimal("100"));
|
|
|
|
|
BigDecimal paymentNum = new BigDecimal(StringUtils.isBlank(archivesPerson.get(String.valueOf(e))) ? "0" : archivesPerson.get(String.valueOf(e)));
|
|
|
|
|
BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost());
|
|
|
|
|
Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum();
|
|
|
|
|
BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
|
|
|
|
|
// BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
|
|
|
|
|
BigDecimal result = new BigDecimal("0");
|
|
|
|
|
if (Objects.equals(po.getPaymentCycle(), 1)) {
|
|
|
|
|
int monthValue = 1;
|
|
|
|
|
for (int i = monthIndex - 1; i >= 0; i--) {
|
|
|
|
|
String cycleValue = po.getCycleSetting().charAt(i) + "";
|
|
|
|
|
if (Integer.parseInt(cycleValue) == 1) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
monthValue++;
|
|
|
|
|
}
|
|
|
|
|
if (po.getAccountType() == 1) {
|
|
|
|
|
paymentNum = paymentNum.multiply(new BigDecimal(monthValue));
|
|
|
|
|
fixedCost = fixedCost.multiply(new BigDecimal(monthValue));
|
|
|
|
|
result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
|
|
|
|
|
} else {
|
|
|
|
|
for (int i = 0; i < monthValue; i++) {
|
|
|
|
|
result = result.add(SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
|
|
|
|
|
}
|
|
|
|
|
socialPerJsonMap.put(String.valueOf(e), result.toPlainString());
|
|
|
|
|
socialPer.add(result);
|
|
|
|
|
});
|
|
|
|
|
@ -755,7 +885,8 @@ public class SIAccountBiz extends Service {
|
|
|
|
|
|
|
|
|
|
//方案中包含的需要缴纳社保的单位福利
|
|
|
|
|
Map<Long, InsuranceSchemeDetailPO> schemeCom = detailPOS.stream()
|
|
|
|
|
.filter(item -> IsPaymentEnum.YES.getValue() == item.getIsPayment() && item.getPaymentScope() == PaymentScopeEnum.SCOPE_COMPANY.getValue())
|
|
|
|
|
.filter(item -> Objects.equals(IsPaymentEnum.YES.getValue(), item.getIsPayment()) && Objects.equals(item.getPaymentScope(), PaymentScopeEnum.SCOPE_COMPANY.getValue()) &&
|
|
|
|
|
(item.getPaymentCycle() == null || item.getPaymentCycle() == 0 || (item.getPaymentCycle() == 1 && String.valueOf(item.getCycleSetting().charAt(monthIndex)).equals("1"))))
|
|
|
|
|
.collect(
|
|
|
|
|
Collectors.toMap(InsuranceSchemeDetailPO::getInsuranceId, Function.identity()));
|
|
|
|
|
//档案中包含的基数信息
|
|
|
|
|
@ -769,6 +900,8 @@ public class SIAccountBiz extends Service {
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
//判断核算周期、核算月、福利起始缴纳月的关系
|
|
|
|
|
checkCycleSettingWithStartMonth(schemeCom, billMonth, socialPO.getSocialStartTime());
|
|
|
|
|
|
|
|
|
|
List<BigDecimal> socialCom = new ArrayList<>();
|
|
|
|
|
Map<String, String> sociaComJsonMap = new HashMap<>();
|
|
|
|
|
@ -778,7 +911,29 @@ public class SIAccountBiz extends Service {
|
|
|
|
|
BigDecimal paymentNum = new BigDecimal(StringUtils.isBlank(archivesCom.get(String.valueOf(e))) ? "0" : archivesCom.get(String.valueOf(e)));
|
|
|
|
|
BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost());
|
|
|
|
|
Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum();
|
|
|
|
|
BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
|
|
|
|
|
// BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
|
|
|
|
|
BigDecimal result = new BigDecimal("0");
|
|
|
|
|
if (Objects.equals(po.getPaymentCycle(), 1)) {
|
|
|
|
|
int monthValue = 1;
|
|
|
|
|
for (int i = monthIndex - 1; i >= 0; i--) {
|
|
|
|
|
String cycleValue = po.getCycleSetting().charAt(i) + "";
|
|
|
|
|
if (Integer.parseInt(cycleValue) == 1) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
monthValue++;
|
|
|
|
|
}
|
|
|
|
|
if (po.getAccountType() == 1) {
|
|
|
|
|
paymentNum = paymentNum.multiply(new BigDecimal(monthValue));
|
|
|
|
|
fixedCost = fixedCost.multiply(new BigDecimal(monthValue));
|
|
|
|
|
result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
|
|
|
|
|
} else {
|
|
|
|
|
for (int i = 0; i < monthValue; i++) {
|
|
|
|
|
result = result.add(SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
|
|
|
|
|
}
|
|
|
|
|
sociaComJsonMap.put(String.valueOf(e), result.toPlainString());
|
|
|
|
|
socialCom.add(result);
|
|
|
|
|
|
|
|
|
|
@ -795,6 +950,29 @@ public class SIAccountBiz extends Service {
|
|
|
|
|
return insuranceAccountDetailPO;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 对于核算月和福利起始缴纳月处于同年时,要避免根据周期缴纳福利费用时,可能出现的多余费用缴纳情况
|
|
|
|
|
* @param schemeDetail 福利方案明细
|
|
|
|
|
* @param billMonth 核算月
|
|
|
|
|
* @param startMonth 福利起始缴纳月
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public Map<Long, InsuranceSchemeDetailPO> checkCycleSettingWithStartMonth(Map<Long, InsuranceSchemeDetailPO> schemeDetail, String billMonth, String startMonth) {
|
|
|
|
|
String billYear = billMonth.substring(0,4);
|
|
|
|
|
if (StringUtils.isNotBlank(startMonth) && billYear.equals(startMonth.substring(0,4))) {
|
|
|
|
|
int startMonthIndex = Integer.parseInt(startMonth.split("-")[1]) - 1;
|
|
|
|
|
schemeDetail.forEach((k, v) -> {
|
|
|
|
|
if (v.getPaymentCycle() != null && v.getPaymentCycle().equals(1) && startMonthIndex != 0) {
|
|
|
|
|
StringBuilder newCycleSetting = new StringBuilder(v.getCycleSetting());
|
|
|
|
|
newCycleSetting.setCharAt(startMonthIndex - 1, '1');
|
|
|
|
|
v.setCycleSetting(newCycleSetting.toString());
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return schemeDetail;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void batchSaveAccountInspectDetail(List<InsuranceAccountDetailPO> list, String billMonth, String tenantKey) {
|
|
|
|
|
List<InsuranceAccountInspectPO> insuranceAccountInspectAllPOS = accountInspect(list, true);
|
|
|
|
|
batchDelInspectDetail(insuranceAccountInspectAllPOS);
|
|
|
|
|
@ -1103,17 +1281,17 @@ public class SIAccountBiz extends Service {
|
|
|
|
|
if (accountPO.getOther() != null) {
|
|
|
|
|
accountPO.getOther().setOtherPaymentBaseString(baseParam.getOtherPaymentBaseString());
|
|
|
|
|
}
|
|
|
|
|
accountSocial(insuranceAccountDetailPO, accountPO);
|
|
|
|
|
accountFund(insuranceAccountDetailPO, accountPO);
|
|
|
|
|
accountOther(insuranceAccountDetailPO, accountPO);
|
|
|
|
|
accountSocial(insuranceAccountDetailPO, accountPO, baseParam.getSupplementaryMonth());
|
|
|
|
|
accountFund(insuranceAccountDetailPO, accountPO, baseParam.getSupplementaryMonth());
|
|
|
|
|
accountOther(insuranceAccountDetailPO, accountPO, baseParam.getSupplementaryMonth());
|
|
|
|
|
} else if ("3".equals(baseParam.getSupplementType())) {
|
|
|
|
|
accountSocialByData(insuranceAccountDetailPO, baseParam);
|
|
|
|
|
accountFundByData(insuranceAccountDetailPO, baseParam);
|
|
|
|
|
accountOtherByData(insuranceAccountDetailPO, baseParam);
|
|
|
|
|
} else {
|
|
|
|
|
accountSocial(insuranceAccountDetailPO, accountPO);
|
|
|
|
|
accountFund(insuranceAccountDetailPO, accountPO);
|
|
|
|
|
accountOther(insuranceAccountDetailPO, accountPO);
|
|
|
|
|
accountSocial(insuranceAccountDetailPO, accountPO, baseParam.getSupplementaryMonth());
|
|
|
|
|
accountFund(insuranceAccountDetailPO, accountPO, baseParam.getSupplementaryMonth());
|
|
|
|
|
accountOther(insuranceAccountDetailPO, accountPO, baseParam.getSupplementaryMonth());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return account(insuranceAccountDetailPO);
|
|
|
|
|
@ -1123,11 +1301,11 @@ public class SIAccountBiz extends Service {
|
|
|
|
|
if (accountPO.getSocial() != null) {
|
|
|
|
|
accountPO.getSocial().setSocialPaymentBaseString(baseParam.getSocialPaymentBaseString());
|
|
|
|
|
}
|
|
|
|
|
accountSocial(insuranceAccountDetailPO, accountPO);
|
|
|
|
|
accountSocial(insuranceAccountDetailPO, accountPO, baseParam.getSupplementaryMonth());
|
|
|
|
|
} else if ("3".equals(baseParam.getSupplementType())) {
|
|
|
|
|
accountSocialByData(insuranceAccountDetailPO, baseParam);
|
|
|
|
|
} else {
|
|
|
|
|
accountSocial(insuranceAccountDetailPO, accountPO);
|
|
|
|
|
accountSocial(insuranceAccountDetailPO, accountPO, baseParam.getSupplementaryMonth());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
@ -1149,11 +1327,11 @@ public class SIAccountBiz extends Service {
|
|
|
|
|
if (accountPO.getSocial() != null) {
|
|
|
|
|
accountPO.getSocial().setSocialPaymentBaseString(baseParam.getSocialPaymentBaseString());
|
|
|
|
|
}
|
|
|
|
|
accountEndowmentInsurance(insuranceAccountDetailPO, accountPO, ids);
|
|
|
|
|
accountEndowmentInsurance(insuranceAccountDetailPO, accountPO, ids, baseParam.getSupplementaryMonth());
|
|
|
|
|
} else if ("3".equals(baseParam.getSupplementType())) {
|
|
|
|
|
accountEndowmentInsuranceByData(insuranceAccountDetailPO, baseParam, ids);
|
|
|
|
|
} else {
|
|
|
|
|
accountEndowmentInsurance(insuranceAccountDetailPO, accountPO, ids);
|
|
|
|
|
accountEndowmentInsurance(insuranceAccountDetailPO, accountPO, ids, baseParam.getSupplementaryMonth());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
@ -1162,11 +1340,11 @@ public class SIAccountBiz extends Service {
|
|
|
|
|
if (accountPO.getFund() != null) {
|
|
|
|
|
accountPO.getFund().setFundPaymentBaseString(baseParam.getFundPaymentBaseString());
|
|
|
|
|
}
|
|
|
|
|
accountFund(insuranceAccountDetailPO, accountPO);
|
|
|
|
|
accountFund(insuranceAccountDetailPO, accountPO, baseParam.getSupplementaryMonth());
|
|
|
|
|
} else if ("3".equals(baseParam.getSupplementType())) {
|
|
|
|
|
accountFundByData(insuranceAccountDetailPO, baseParam);
|
|
|
|
|
} else {
|
|
|
|
|
accountFund(insuranceAccountDetailPO, accountPO);
|
|
|
|
|
accountFund(insuranceAccountDetailPO, accountPO, baseParam.getSupplementaryMonth());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
@ -1176,11 +1354,11 @@ public class SIAccountBiz extends Service {
|
|
|
|
|
if (accountPO.getOther() != null) {
|
|
|
|
|
accountPO.getOther().setOtherPaymentBaseString(baseParam.getOtherPaymentBaseString());
|
|
|
|
|
}
|
|
|
|
|
accountOther(insuranceAccountDetailPO, accountPO);
|
|
|
|
|
accountOther(insuranceAccountDetailPO, accountPO, baseParam.getSupplementaryMonth());
|
|
|
|
|
} else if ("3".equals(baseParam.getSupplementType())) {
|
|
|
|
|
accountOtherByData(insuranceAccountDetailPO, baseParam);
|
|
|
|
|
} else {
|
|
|
|
|
accountOther(insuranceAccountDetailPO, accountPO);
|
|
|
|
|
accountOther(insuranceAccountDetailPO, accountPO, baseParam.getSupplementaryMonth());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
@ -1189,18 +1367,21 @@ public class SIAccountBiz extends Service {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public InsuranceAccountDetailPO accountOther(InsuranceAccountDetailPO insuranceAccountDetailPO, InsuranceArchivesAccountPO accountPO) {
|
|
|
|
|
public InsuranceAccountDetailPO accountOther(InsuranceAccountDetailPO insuranceAccountDetailPO, InsuranceArchivesAccountPO accountPO, String billMonth) {
|
|
|
|
|
if (accountPO.getOther() != null) {
|
|
|
|
|
InsuranceArchivesOtherSchemePO otherPO = accountPO.getOther();
|
|
|
|
|
insuranceAccountDetailPO.setOtherPayOrg(otherPO.getPaymentOrganization());
|
|
|
|
|
insuranceAccountDetailPO.setOtherSchemeId(otherPO.getOtherSchemeId());
|
|
|
|
|
insuranceAccountDetailPO.setOtherPaymentBaseString(otherPO.getOtherPaymentBaseString());
|
|
|
|
|
if ((Objects.equals(NonPaymentEnum.YES.getValue(), otherPO.getNonPayment()) || otherPO.getNonPayment() == null) && otherPO.getOtherSchemeId() != null) {
|
|
|
|
|
//判断是否在起始缴纳月和最后缴纳月之间
|
|
|
|
|
Boolean inDataRange = SalaryDateUtil.monthInRange(billMonth, otherPO.getOtherStartTime(), otherPO.getOtherEndTime());
|
|
|
|
|
if ((Objects.equals(NonPaymentEnum.YES.getValue(), otherPO.getNonPayment()) || otherPO.getNonPayment() == null) && otherPO.getOtherSchemeId() != null && inDataRange) {
|
|
|
|
|
List<InsuranceSchemeDetailPO> detailPOS = MapperProxyFactory.getProxy(InsuranceSchemeDetailMapper.class).queryListBySchemeId(otherPO.getOtherSchemeId());
|
|
|
|
|
encryptUtil.decryptList(detailPOS, InsuranceSchemeDetailPO.class);
|
|
|
|
|
//方案中包含的需要缴纳其他的个人福利
|
|
|
|
|
int monthIndex = Integer.parseInt(billMonth.split("-")[1]) - 1;
|
|
|
|
|
Map<Long, InsuranceSchemeDetailPO> otherPerson = detailPOS.stream()
|
|
|
|
|
.filter(item -> Objects.equals(IsPaymentEnum.YES.getValue(), item.getIsPayment()) && item.getPaymentScope() == PaymentScopeEnum.SCOPE_PERSON.getValue())
|
|
|
|
|
.filter(item -> Objects.equals(IsPaymentEnum.YES.getValue(), item.getIsPayment()) && Objects.equals(item.getPaymentScope(), PaymentScopeEnum.SCOPE_PERSON.getValue()) && (item.getPaymentCycle() == null || item.getPaymentCycle() == 0 || (item.getPaymentCycle() == 1 && String.valueOf(item.getCycleSetting().charAt(monthIndex)).equals("1"))))
|
|
|
|
|
.collect(
|
|
|
|
|
Collectors.toMap(InsuranceSchemeDetailPO::getInsuranceId, Function.identity()));
|
|
|
|
|
//档案中包含的基数信息
|
|
|
|
|
@ -1214,6 +1395,8 @@ public class SIAccountBiz extends Service {
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
//判断核算周期、核算月、福利起始缴纳月的关系
|
|
|
|
|
checkCycleSettingWithStartMonth(otherPerson, billMonth, otherPO.getOtherStartTime());
|
|
|
|
|
|
|
|
|
|
List<BigDecimal> otherPer = new ArrayList<>();
|
|
|
|
|
Map<String, String> otherPerJsonMap = new HashMap<>();
|
|
|
|
|
@ -1223,8 +1406,30 @@ public class SIAccountBiz extends Service {
|
|
|
|
|
BigDecimal paymentNum = new BigDecimal(StringUtils.isBlank(archivesPerson.get(String.valueOf(e))) ? "0" : archivesPerson.get(String.valueOf(e)));
|
|
|
|
|
BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost());
|
|
|
|
|
Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum();
|
|
|
|
|
BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
|
|
|
|
|
;
|
|
|
|
|
// BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
|
|
|
|
|
BigDecimal result = new BigDecimal("0");
|
|
|
|
|
if (po.getPaymentCycle() != null && po.getPaymentCycle() == 1) {
|
|
|
|
|
int monthValue = 1;
|
|
|
|
|
for (int i = monthIndex - 1; i >= 0; i--) {
|
|
|
|
|
String cycleValue = po.getCycleSetting().charAt(i) + "";
|
|
|
|
|
if (Integer.parseInt(cycleValue) == 1) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
monthValue++;
|
|
|
|
|
}
|
|
|
|
|
if (po.getAccountType() == 1) {
|
|
|
|
|
paymentNum = paymentNum.multiply(new BigDecimal(monthValue));
|
|
|
|
|
fixedCost = fixedCost.multiply(new BigDecimal(monthValue));
|
|
|
|
|
result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
|
|
|
|
|
} else {
|
|
|
|
|
for (int i = 0; i < monthValue; i++) {
|
|
|
|
|
result = result.add(SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
otherPerJsonMap.put(String.valueOf(e), result.toPlainString());
|
|
|
|
|
otherPer.add(result);
|
|
|
|
|
});
|
|
|
|
|
@ -1238,7 +1443,7 @@ public class SIAccountBiz extends Service {
|
|
|
|
|
//方案中包含的需要缴纳公积金的单位福利
|
|
|
|
|
Map<Long, InsuranceSchemeDetailPO> otherCom = detailPOS.stream()
|
|
|
|
|
.filter(
|
|
|
|
|
item -> Objects.equals(IsPaymentEnum.YES.getValue(), item.getIsPayment()) && item.getPaymentScope() == PaymentScopeEnum.SCOPE_COMPANY.getValue())
|
|
|
|
|
item -> Objects.equals(IsPaymentEnum.YES.getValue(), item.getIsPayment()) && Objects.equals(item.getPaymentScope(), PaymentScopeEnum.SCOPE_COMPANY.getValue()) && (item.getPaymentCycle() == null || item.getPaymentCycle() == 0 || (item.getPaymentCycle() == 1 && String.valueOf(item.getCycleSetting().charAt(monthIndex)).equals("1"))))
|
|
|
|
|
.collect(
|
|
|
|
|
Collectors.toMap(InsuranceSchemeDetailPO::getInsuranceId, Function.identity()));
|
|
|
|
|
//档案中包含的基数信息
|
|
|
|
|
@ -1252,6 +1457,8 @@ public class SIAccountBiz extends Service {
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
//判断核算周期、核算月、福利起始缴纳月的关系
|
|
|
|
|
checkCycleSettingWithStartMonth(otherCom, billMonth, otherPO.getOtherStartTime());
|
|
|
|
|
|
|
|
|
|
List<BigDecimal> otherComList = new ArrayList<>();
|
|
|
|
|
Map<String, String> otherComJsonMap = new HashMap<>();
|
|
|
|
|
@ -1261,8 +1468,30 @@ public class SIAccountBiz extends Service {
|
|
|
|
|
BigDecimal paymentNum = new BigDecimal(StringUtils.isBlank(archivesCom.get(String.valueOf(e))) ? "0" : archivesCom.get(String.valueOf(e)));
|
|
|
|
|
BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost());
|
|
|
|
|
Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum();
|
|
|
|
|
BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
|
|
|
|
|
;
|
|
|
|
|
// BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
|
|
|
|
|
BigDecimal result = new BigDecimal("0");
|
|
|
|
|
if (Objects.equals(po.getPaymentCycle(), 1)) {
|
|
|
|
|
int monthValue = 1;
|
|
|
|
|
for (int i = monthIndex - 1; i >= 0; i--) {
|
|
|
|
|
String cycleValue = po.getCycleSetting().charAt(i) + "";
|
|
|
|
|
if (Integer.parseInt(cycleValue) == 1) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
monthValue++;
|
|
|
|
|
}
|
|
|
|
|
if (po.getAccountType() == 1) {
|
|
|
|
|
paymentNum = paymentNum.multiply(new BigDecimal(monthValue));
|
|
|
|
|
fixedCost = fixedCost.multiply(new BigDecimal(monthValue));
|
|
|
|
|
result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
|
|
|
|
|
} else {
|
|
|
|
|
for (int i = 0; i < monthValue; i++) {
|
|
|
|
|
result = result.add(SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
otherComJsonMap.put(String.valueOf(e), result.toPlainString());
|
|
|
|
|
otherComList.add(result);
|
|
|
|
|
});
|
|
|
|
|
@ -1277,7 +1506,7 @@ public class SIAccountBiz extends Service {
|
|
|
|
|
return insuranceAccountDetailPO;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public InsuranceAccountDetailPO accountFund(InsuranceAccountDetailPO insuranceAccountDetailPO, InsuranceArchivesAccountPO accountPO) {
|
|
|
|
|
public InsuranceAccountDetailPO accountFund(InsuranceAccountDetailPO insuranceAccountDetailPO, InsuranceArchivesAccountPO accountPO, String billMonth) {
|
|
|
|
|
if (accountPO.getFund() != null) {
|
|
|
|
|
InsuranceArchivesFundSchemePO fundPO = accountPO.getFund();
|
|
|
|
|
insuranceAccountDetailPO.setFundPayOrg(fundPO.getPaymentOrganization());
|
|
|
|
|
@ -1285,12 +1514,15 @@ public class SIAccountBiz extends Service {
|
|
|
|
|
insuranceAccountDetailPO.setSupplementFundAccount(fundPO.getSupplementFundAccount());
|
|
|
|
|
insuranceAccountDetailPO.setFundSchemeId(fundPO.getFundSchemeId());
|
|
|
|
|
insuranceAccountDetailPO.setFundPaymentBaseString(fundPO.getFundPaymentBaseString());
|
|
|
|
|
if ((NonPaymentEnum.YES.getValue() == fundPO.getNonPayment() || fundPO.getNonPayment() == null) && fundPO.getFundSchemeId() != null) {
|
|
|
|
|
//判断是否在起始缴纳月和最后缴纳月之间
|
|
|
|
|
Boolean inDataRange = SalaryDateUtil.monthInRange(billMonth, fundPO.getFundStartTime(), fundPO.getFundEndTime());
|
|
|
|
|
if ((Objects.equals(NonPaymentEnum.YES.getValue(), fundPO.getNonPayment()) || fundPO.getNonPayment() == null) && fundPO.getFundSchemeId() != null && inDataRange) {
|
|
|
|
|
List<InsuranceSchemeDetailPO> detailPOS = MapperProxyFactory.getProxy(InsuranceSchemeDetailMapper.class).queryListBySchemeId(fundPO.getFundSchemeId());
|
|
|
|
|
encryptUtil.decryptList(detailPOS, InsuranceSchemeDetailPO.class);
|
|
|
|
|
//方案中包含的需要缴纳社保的个人福利
|
|
|
|
|
int monthIndex = Integer.parseInt(billMonth.split("-")[1]) - 1;
|
|
|
|
|
Map<Long, InsuranceSchemeDetailPO> fundperson = detailPOS.stream()
|
|
|
|
|
.filter(item -> IsPaymentEnum.YES.getValue() == item.getIsPayment() && item.getPaymentScope() == PaymentScopeEnum.SCOPE_PERSON.getValue())
|
|
|
|
|
.filter(item -> Objects.equals(IsPaymentEnum.YES.getValue(), item.getIsPayment()) && Objects.equals(item.getPaymentScope(), PaymentScopeEnum.SCOPE_PERSON.getValue()) && (item.getPaymentCycle() == null || item.getPaymentCycle() == 0 || (item.getPaymentCycle() == 1 && String.valueOf(item.getCycleSetting().charAt(monthIndex)).equals("1"))))
|
|
|
|
|
.collect(
|
|
|
|
|
Collectors.toMap(InsuranceSchemeDetailPO::getInsuranceId, Function.identity()));
|
|
|
|
|
//档案中包含的基数信息
|
|
|
|
|
@ -1304,6 +1536,8 @@ public class SIAccountBiz extends Service {
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
//判断核算周期、核算月、福利起始缴纳月的关系
|
|
|
|
|
checkCycleSettingWithStartMonth(fundperson, billMonth, fundPO.getFundStartTime());
|
|
|
|
|
|
|
|
|
|
List<BigDecimal> fundPer = new ArrayList<>();
|
|
|
|
|
Map<String, String> fundPerJsonMap = new HashMap<>();
|
|
|
|
|
@ -1313,8 +1547,30 @@ public class SIAccountBiz extends Service {
|
|
|
|
|
BigDecimal paymentNum = new BigDecimal(StringUtils.isBlank(archivesPerson.get(String.valueOf(e))) ? "0" : archivesPerson.get(String.valueOf(e)));
|
|
|
|
|
BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost());
|
|
|
|
|
Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum();
|
|
|
|
|
BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
|
|
|
|
|
;
|
|
|
|
|
// BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
|
|
|
|
|
BigDecimal result = new BigDecimal("0");
|
|
|
|
|
if (Objects.equals(po.getPaymentCycle(), 1)) {
|
|
|
|
|
int monthValue = 1;
|
|
|
|
|
for (int i = monthIndex - 1; i >= 0; i--) {
|
|
|
|
|
String cycleValue = po.getCycleSetting().charAt(i) + "";
|
|
|
|
|
if (Integer.parseInt(cycleValue) == 1) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
monthValue++;
|
|
|
|
|
}
|
|
|
|
|
if (po.getAccountType() == 1) {
|
|
|
|
|
paymentNum = paymentNum.multiply(new BigDecimal(monthValue));
|
|
|
|
|
fixedCost = fixedCost.multiply(new BigDecimal(monthValue));
|
|
|
|
|
result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
|
|
|
|
|
} else {
|
|
|
|
|
for (int i = 0; i < monthValue; i++) {
|
|
|
|
|
result = result.add(SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fundPerJsonMap.put(String.valueOf(e), result.toPlainString());
|
|
|
|
|
fundPer.add(result);
|
|
|
|
|
});
|
|
|
|
|
@ -1327,7 +1583,7 @@ public class SIAccountBiz extends Service {
|
|
|
|
|
|
|
|
|
|
//方案中包含的需要缴纳公积金的单位福利
|
|
|
|
|
Map<Long, InsuranceSchemeDetailPO> fundCom = detailPOS.stream()
|
|
|
|
|
.filter(item -> IsPaymentEnum.YES.getValue() == item.getIsPayment() && item.getPaymentScope() == PaymentScopeEnum.SCOPE_COMPANY.getValue())
|
|
|
|
|
.filter(item -> Objects.equals(IsPaymentEnum.YES.getValue(), item.getIsPayment()) && Objects.equals(item.getPaymentScope(), PaymentScopeEnum.SCOPE_COMPANY.getValue()) && (item.getPaymentCycle() == null || item.getPaymentCycle() == 0 || (item.getPaymentCycle() == 1 && String.valueOf(item.getCycleSetting().charAt(monthIndex)).equals("1"))))
|
|
|
|
|
.collect(
|
|
|
|
|
Collectors.toMap(InsuranceSchemeDetailPO::getInsuranceId, Function.identity()));
|
|
|
|
|
//档案中包含的基数信息
|
|
|
|
|
@ -1341,6 +1597,8 @@ public class SIAccountBiz extends Service {
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
//判断核算周期、核算月、福利起始缴纳月的关系
|
|
|
|
|
checkCycleSettingWithStartMonth(fundCom, billMonth, fundPO.getFundStartTime());
|
|
|
|
|
|
|
|
|
|
List<BigDecimal> fundComList = new ArrayList<>();
|
|
|
|
|
Map<String, String> fundComJsonMap = new HashMap<>();
|
|
|
|
|
@ -1350,7 +1608,30 @@ public class SIAccountBiz extends Service {
|
|
|
|
|
BigDecimal paymentNum = new BigDecimal(StringUtils.isBlank(archivesCom.get(String.valueOf(e))) ? "0" : archivesCom.get(String.valueOf(e)));
|
|
|
|
|
BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost());
|
|
|
|
|
Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum();
|
|
|
|
|
BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
|
|
|
|
|
// BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
|
|
|
|
|
BigDecimal result = new BigDecimal("0");
|
|
|
|
|
if (Objects.equals(po.getPaymentCycle(), 1)) {
|
|
|
|
|
int monthValue = 1;
|
|
|
|
|
for (int i = monthIndex - 1; i >= 0; i--) {
|
|
|
|
|
String cycleValue = po.getCycleSetting().charAt(i) + "";
|
|
|
|
|
if (Integer.parseInt(cycleValue) == 1) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
monthValue++;
|
|
|
|
|
}
|
|
|
|
|
if (po.getAccountType() == 1) {
|
|
|
|
|
paymentNum = paymentNum.multiply(new BigDecimal(monthValue));
|
|
|
|
|
fixedCost = fixedCost.multiply(new BigDecimal(monthValue));
|
|
|
|
|
result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
|
|
|
|
|
} else {
|
|
|
|
|
for (int i = 0; i < monthValue; i++) {
|
|
|
|
|
result = result.add(SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fundComJsonMap.put(String.valueOf(e), result.toPlainString());
|
|
|
|
|
fundComList.add(result);
|
|
|
|
|
});
|
|
|
|
|
@ -1366,19 +1647,26 @@ public class SIAccountBiz extends Service {
|
|
|
|
|
return insuranceAccountDetailPO;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public InsuranceAccountDetailPO accountSocial(InsuranceAccountDetailPO insuranceAccountDetailPO, InsuranceArchivesAccountPO accountPO) {
|
|
|
|
|
public InsuranceAccountDetailPO accountSocial(InsuranceAccountDetailPO insuranceAccountDetailPO, InsuranceArchivesAccountPO accountPO, String billMonth) {
|
|
|
|
|
if (accountPO.getSocial() != null) {
|
|
|
|
|
InsuranceArchivesSocialSchemePO socialPO = accountPO.getSocial();
|
|
|
|
|
insuranceAccountDetailPO.setSocialPayOrg(socialPO.getPaymentOrganization());
|
|
|
|
|
insuranceAccountDetailPO.setSocialAccount(socialPO.getSocialAccount());
|
|
|
|
|
insuranceAccountDetailPO.setSocialSchemeId(socialPO.getSocialSchemeId());
|
|
|
|
|
insuranceAccountDetailPO.setSocialPaymentBaseString(socialPO.getSocialPaymentBaseString());
|
|
|
|
|
if ((NonPaymentEnum.YES.getValue() == socialPO.getNonPayment() || socialPO.getNonPayment() == null) && socialPO.getSocialSchemeId() != null) {
|
|
|
|
|
//判断是否在起始缴纳月和最后缴纳月之间
|
|
|
|
|
Boolean inDataRange = SalaryDateUtil.monthInRange(billMonth, socialPO.getSocialStartTime(), socialPO.getSocialEndTime());
|
|
|
|
|
if ((Objects.equals(NonPaymentEnum.YES.getValue(), socialPO.getNonPayment()) || socialPO.getNonPayment() == null) && socialPO.getSocialSchemeId() != null && inDataRange) {
|
|
|
|
|
List<InsuranceSchemeDetailPO> detailPOS = MapperProxyFactory.getProxy(InsuranceSchemeDetailMapper.class).queryListBySchemeId(socialPO.getSocialSchemeId());
|
|
|
|
|
encryptUtil.decryptList(detailPOS, InsuranceSchemeDetailPO.class);
|
|
|
|
|
//方案中包含的需要缴纳社保的个人福利
|
|
|
|
|
int monthIndex = Integer.parseInt(billMonth.split("-")[1]) - 1;
|
|
|
|
|
Map<Long, InsuranceSchemeDetailPO> schemeperson = detailPOS.stream()
|
|
|
|
|
.filter(item -> IsPaymentEnum.YES.getValue() == item.getIsPayment() && item.getPaymentScope() == PaymentScopeEnum.SCOPE_PERSON.getValue())
|
|
|
|
|
.filter(item ->
|
|
|
|
|
Objects.equals(IsPaymentEnum.YES.getValue(), item.getIsPayment()) &&
|
|
|
|
|
Objects.equals(item.getPaymentScope(), PaymentScopeEnum.SCOPE_PERSON.getValue()) &&
|
|
|
|
|
(item.getPaymentCycle() == null || item.getPaymentCycle() == 0 || (item.getPaymentCycle() == 1 && String.valueOf(item.getCycleSetting().charAt(monthIndex)).equals("1")))
|
|
|
|
|
)
|
|
|
|
|
.collect(
|
|
|
|
|
Collectors.toMap(InsuranceSchemeDetailPO::getInsuranceId, Function.identity()));
|
|
|
|
|
//档案中包含的基数信息
|
|
|
|
|
@ -1392,15 +1680,40 @@ public class SIAccountBiz extends Service {
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
//判断核算周期、核算月、福利起始缴纳月的关系
|
|
|
|
|
checkCycleSettingWithStartMonth(schemeperson, billMonth, socialPO.getSocialStartTime());
|
|
|
|
|
|
|
|
|
|
List<BigDecimal> socialPer = new ArrayList<>();
|
|
|
|
|
Map<String, String> socialPerJsonMap = new HashMap<>();
|
|
|
|
|
needArchivesPerson.stream().forEach(e -> {
|
|
|
|
|
needArchivesPerson.forEach(e -> {
|
|
|
|
|
InsuranceSchemeDetailPO po = schemeperson.get(e);
|
|
|
|
|
BigDecimal paymentProportion = new BigDecimal(StringUtils.isBlank(po.getPaymentProportion()) ? "0" : po.getPaymentProportion()).divide(new BigDecimal("100"));
|
|
|
|
|
BigDecimal paymentNum = new BigDecimal(StringUtils.isBlank(archivesPerson.get(String.valueOf(e))) ? "0" : archivesPerson.get(String.valueOf(e)));
|
|
|
|
|
BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost());
|
|
|
|
|
Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum();
|
|
|
|
|
BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
|
|
|
|
|
// BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
|
|
|
|
|
BigDecimal result = new BigDecimal("0");
|
|
|
|
|
if (Objects.equals(po.getPaymentCycle(), 1)) {
|
|
|
|
|
int monthValue = 1;
|
|
|
|
|
for (int i = monthIndex - 1; i >= 0; i--) {
|
|
|
|
|
String cycleValue = po.getCycleSetting().charAt(i) + "";
|
|
|
|
|
if (Integer.parseInt(cycleValue) == 1) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
monthValue++;
|
|
|
|
|
}
|
|
|
|
|
if (po.getAccountType() == 1) {
|
|
|
|
|
paymentNum = paymentNum.multiply(new BigDecimal(monthValue));
|
|
|
|
|
fixedCost = fixedCost.multiply(new BigDecimal(monthValue));
|
|
|
|
|
result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
|
|
|
|
|
} else {
|
|
|
|
|
for (int i = 0; i < monthValue; i++) {
|
|
|
|
|
result = result.add(SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
socialPerJsonMap.put(String.valueOf(e), result.toPlainString());
|
|
|
|
|
socialPer.add(result);
|
|
|
|
|
@ -1414,7 +1727,8 @@ public class SIAccountBiz extends Service {
|
|
|
|
|
|
|
|
|
|
//方案中包含的需要缴纳社保的单位福利
|
|
|
|
|
Map<Long, InsuranceSchemeDetailPO> schemeCom = detailPOS.stream()
|
|
|
|
|
.filter(item -> IsPaymentEnum.YES.getValue() == item.getIsPayment() && item.getPaymentScope() == PaymentScopeEnum.SCOPE_COMPANY.getValue())
|
|
|
|
|
.filter(item -> Objects.equals(IsPaymentEnum.YES.getValue(), item.getIsPayment()) && Objects.equals(item.getPaymentScope(), PaymentScopeEnum.SCOPE_COMPANY.getValue()) &&
|
|
|
|
|
(item.getPaymentCycle() == null || item.getPaymentCycle() == 0 || (item.getPaymentCycle() == 1 && String.valueOf(item.getCycleSetting().charAt(monthIndex)).equals("1"))))
|
|
|
|
|
.collect(
|
|
|
|
|
Collectors.toMap(InsuranceSchemeDetailPO::getInsuranceId, Function.identity()));
|
|
|
|
|
//档案中包含的基数信息
|
|
|
|
|
@ -1428,6 +1742,8 @@ public class SIAccountBiz extends Service {
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
//判断核算周期、核算月、福利起始缴纳月的关系
|
|
|
|
|
checkCycleSettingWithStartMonth(schemeCom, billMonth, socialPO.getSocialStartTime());
|
|
|
|
|
|
|
|
|
|
List<BigDecimal> socialCom = new ArrayList<>();
|
|
|
|
|
Map<String, String> sociaComJsonMap = new HashMap<>();
|
|
|
|
|
@ -1437,7 +1753,30 @@ public class SIAccountBiz extends Service {
|
|
|
|
|
BigDecimal paymentNum = new BigDecimal(StringUtils.isBlank(archivesCom.get(String.valueOf(e))) ? "0" : archivesCom.get(String.valueOf(e)));
|
|
|
|
|
BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost());
|
|
|
|
|
Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum();
|
|
|
|
|
BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
|
|
|
|
|
// BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
|
|
|
|
|
BigDecimal result = new BigDecimal("0");
|
|
|
|
|
if (Objects.equals(po.getPaymentCycle(), 1)) {
|
|
|
|
|
int monthValue = 1;
|
|
|
|
|
for (int i = monthIndex - 1; i >= 0; i--) {
|
|
|
|
|
String cycleValue = po.getCycleSetting().charAt(i) + "";
|
|
|
|
|
if (Integer.parseInt(cycleValue) == 1) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
monthValue++;
|
|
|
|
|
}
|
|
|
|
|
if (po.getAccountType() == 1) {
|
|
|
|
|
paymentNum = paymentNum.multiply(new BigDecimal(monthValue));
|
|
|
|
|
fixedCost = fixedCost.multiply(new BigDecimal(monthValue));
|
|
|
|
|
result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
|
|
|
|
|
} else {
|
|
|
|
|
for (int i = 0; i < monthValue; i++) {
|
|
|
|
|
result = result.add(SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sociaComJsonMap.put(String.valueOf(e), result.toPlainString());
|
|
|
|
|
socialCom.add(result);
|
|
|
|
|
|
|
|
|
|
@ -1454,19 +1793,25 @@ public class SIAccountBiz extends Service {
|
|
|
|
|
return insuranceAccountDetailPO;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public InsuranceAccountDetailPO accountEndowmentInsurance(InsuranceAccountDetailPO insuranceAccountDetailPO, InsuranceArchivesAccountPO accountPO, List<Long> categoryIds) {
|
|
|
|
|
public InsuranceAccountDetailPO accountEndowmentInsurance(InsuranceAccountDetailPO insuranceAccountDetailPO, InsuranceArchivesAccountPO accountPO, List<Long> categoryIds, String billMonth) {
|
|
|
|
|
if (accountPO.getSocial() != null) {
|
|
|
|
|
InsuranceArchivesSocialSchemePO socialPO = accountPO.getSocial();
|
|
|
|
|
insuranceAccountDetailPO.setSocialPayOrg(socialPO.getPaymentOrganization());
|
|
|
|
|
insuranceAccountDetailPO.setSocialAccount(socialPO.getSocialAccount());
|
|
|
|
|
insuranceAccountDetailPO.setSocialSchemeId(socialPO.getSocialSchemeId());
|
|
|
|
|
insuranceAccountDetailPO.setSocialPaymentBaseString(socialPO.getSocialPaymentBaseString());
|
|
|
|
|
if ((NonPaymentEnum.YES.getValue() == socialPO.getNonPayment() || socialPO.getNonPayment() == null) && socialPO.getSocialSchemeId() != null) {
|
|
|
|
|
//判断是否在起始缴纳月和最后缴纳月之间
|
|
|
|
|
Boolean inDataRange = SalaryDateUtil.monthInRange(billMonth, socialPO.getSocialStartTime(), socialPO.getSocialEndTime());
|
|
|
|
|
|
|
|
|
|
if ((Objects.equals(NonPaymentEnum.YES.getValue(), socialPO.getNonPayment()) || socialPO.getNonPayment() == null) && socialPO.getSocialSchemeId() != null && inDataRange) {
|
|
|
|
|
List<InsuranceSchemeDetailPO> detailPOS = MapperProxyFactory.getProxy(InsuranceSchemeDetailMapper.class).queryListBySchemeId(socialPO.getSocialSchemeId());
|
|
|
|
|
encryptUtil.decryptList(detailPOS, InsuranceSchemeDetailPO.class);
|
|
|
|
|
//方案中包含的需要缴纳社保的个人福利
|
|
|
|
|
int monthIndex = Integer.parseInt(billMonth.split("-")[1]) - 1;
|
|
|
|
|
Map<Long, InsuranceSchemeDetailPO> schemeperson = detailPOS.stream()
|
|
|
|
|
.filter(item -> IsPaymentEnum.YES.getValue() == item.getIsPayment() && item.getPaymentScope() == PaymentScopeEnum.SCOPE_PERSON.getValue())
|
|
|
|
|
.filter(item -> Objects.equals(IsPaymentEnum.YES.getValue(), item.getIsPayment())
|
|
|
|
|
&& Objects.equals(item.getPaymentScope(), PaymentScopeEnum.SCOPE_PERSON.getValue())
|
|
|
|
|
&& (item.getPaymentCycle() == null || item.getPaymentCycle() == 0 || (item.getPaymentCycle() == 1 && String.valueOf(item.getCycleSetting().charAt(monthIndex)).equals("1"))))
|
|
|
|
|
.collect(
|
|
|
|
|
Collectors.toMap(InsuranceSchemeDetailPO::getInsuranceId, Function.identity()));
|
|
|
|
|
//档案中包含的基数信息
|
|
|
|
|
@ -1476,23 +1821,47 @@ public class SIAccountBiz extends Service {
|
|
|
|
|
if (archivesPerson != null) {
|
|
|
|
|
categoryIds.forEach(item -> {
|
|
|
|
|
if (archivesPerson.containsKey(String.valueOf(item)) && schemeperson.containsKey(item)) {
|
|
|
|
|
if (StringUtils.isNotBlank(archivesPerson.get(item))) {
|
|
|
|
|
if (StringUtils.isNotBlank(archivesPerson.get(String.valueOf(item)))) {
|
|
|
|
|
needArchivesPerson.add(item);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
//判断核算周期、核算月、福利起始缴纳月的关系
|
|
|
|
|
checkCycleSettingWithStartMonth(schemeperson, billMonth, socialPO.getSocialStartTime());
|
|
|
|
|
|
|
|
|
|
List<BigDecimal> socialPer = new ArrayList<>();
|
|
|
|
|
Map<String, String> socialPerJsonMap = new HashMap<>();
|
|
|
|
|
needArchivesPerson.stream().forEach(e -> {
|
|
|
|
|
needArchivesPerson.forEach(e -> {
|
|
|
|
|
InsuranceSchemeDetailPO po = schemeperson.get(e);
|
|
|
|
|
BigDecimal paymentProportion = new BigDecimal(po.getPaymentProportion()).divide(new BigDecimal("100"));
|
|
|
|
|
BigDecimal paymentNum = new BigDecimal(archivesPerson.get(String.valueOf(e)));
|
|
|
|
|
BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost());
|
|
|
|
|
Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum();
|
|
|
|
|
BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
|
|
|
|
|
// BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
|
|
|
|
|
BigDecimal result = new BigDecimal("0");
|
|
|
|
|
if (Objects.equals(po.getPaymentCycle(), 1)) {
|
|
|
|
|
int monthValue = 1;
|
|
|
|
|
for (int i = monthIndex - 1; i >= 0; i--) {
|
|
|
|
|
String cycleValue = po.getCycleSetting().charAt(i) + "";
|
|
|
|
|
if (Integer.parseInt(cycleValue) == 1) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
monthValue++;
|
|
|
|
|
}
|
|
|
|
|
if (po.getAccountType() == 1) {
|
|
|
|
|
paymentNum = paymentNum.multiply(new BigDecimal(monthValue));
|
|
|
|
|
fixedCost = fixedCost.multiply(new BigDecimal(monthValue));
|
|
|
|
|
result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
|
|
|
|
|
} else {
|
|
|
|
|
for (int i = 0; i < monthValue; i++) {
|
|
|
|
|
result = result.add(SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
|
|
|
|
|
}
|
|
|
|
|
socialPerJsonMap.put(String.valueOf(e), result.toPlainString());
|
|
|
|
|
socialPer.add(result);
|
|
|
|
|
});
|
|
|
|
|
@ -1505,7 +1874,8 @@ public class SIAccountBiz extends Service {
|
|
|
|
|
|
|
|
|
|
//方案中包含的需要缴纳社保的单位福利
|
|
|
|
|
Map<Long, InsuranceSchemeDetailPO> schemeCom = detailPOS.stream()
|
|
|
|
|
.filter(item -> IsPaymentEnum.YES.getValue() == item.getIsPayment() && item.getPaymentScope() == PaymentScopeEnum.SCOPE_COMPANY.getValue())
|
|
|
|
|
.filter(item -> Objects.equals(IsPaymentEnum.YES.getValue(), item.getIsPayment()) && Objects.equals(item.getPaymentScope(), PaymentScopeEnum.SCOPE_COMPANY.getValue()) &&
|
|
|
|
|
(item.getPaymentCycle() == null || item.getPaymentCycle() == 0 || (item.getPaymentCycle() == 1 && String.valueOf(item.getCycleSetting().charAt(monthIndex)).equals("1"))))
|
|
|
|
|
.collect(
|
|
|
|
|
Collectors.toMap(InsuranceSchemeDetailPO::getInsuranceId, Function.identity()));
|
|
|
|
|
//档案中包含的基数信息
|
|
|
|
|
@ -1515,12 +1885,14 @@ public class SIAccountBiz extends Service {
|
|
|
|
|
if (archivesCom != null) {
|
|
|
|
|
categoryIds.forEach(item -> {
|
|
|
|
|
if (archivesCom.containsKey(String.valueOf(item)) && schemeCom.containsKey(item)) {
|
|
|
|
|
if (StringUtils.isNotBlank(archivesCom.get(item))) {
|
|
|
|
|
if (StringUtils.isNotBlank(archivesCom.get(String.valueOf(item)))) {
|
|
|
|
|
needArchivesCom.add(item);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
//判断核算周期、核算月、福利起始缴纳月的关系
|
|
|
|
|
checkCycleSettingWithStartMonth(schemeCom, billMonth, socialPO.getSocialStartTime());
|
|
|
|
|
|
|
|
|
|
// archivesCom.forEach((id, value) -> {
|
|
|
|
|
// if (schemeCom.containsKey(Long.valueOf(id))) {
|
|
|
|
|
@ -1531,13 +1903,36 @@ public class SIAccountBiz extends Service {
|
|
|
|
|
|
|
|
|
|
List<BigDecimal> socialCom = new ArrayList<>();
|
|
|
|
|
Map<String, String> sociaComJsonMap = new HashMap<>();
|
|
|
|
|
needArchivesCom.stream().forEach(e -> {
|
|
|
|
|
needArchivesCom.forEach(e -> {
|
|
|
|
|
InsuranceSchemeDetailPO po = schemeCom.get(e);
|
|
|
|
|
BigDecimal paymentProportion = new BigDecimal(po.getPaymentProportion()).divide(new BigDecimal("100"));
|
|
|
|
|
BigDecimal paymentNum = SalaryEntityUtil.string2BigDecimalDefault0(archivesCom.get(String.valueOf(e)));
|
|
|
|
|
BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost());
|
|
|
|
|
Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum();
|
|
|
|
|
BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
|
|
|
|
|
// BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
|
|
|
|
|
BigDecimal result = new BigDecimal("0");
|
|
|
|
|
if (Objects.equals(po.getPaymentCycle(), 1)) {
|
|
|
|
|
int monthValue = 1;
|
|
|
|
|
for (int i = monthIndex - 1; i >= 0; i--) {
|
|
|
|
|
String cycleValue = po.getCycleSetting().charAt(i) + "";
|
|
|
|
|
if (Integer.parseInt(cycleValue) == 1) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
monthValue++;
|
|
|
|
|
}
|
|
|
|
|
if (po.getAccountType() == 1) {
|
|
|
|
|
paymentNum = paymentNum.multiply(new BigDecimal(monthValue));
|
|
|
|
|
fixedCost = fixedCost.multiply(new BigDecimal(monthValue));
|
|
|
|
|
result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
|
|
|
|
|
} else {
|
|
|
|
|
for (int i = 0; i < monthValue; i++) {
|
|
|
|
|
result = result.add(SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sociaComJsonMap.put(String.valueOf(e), result.toPlainString());
|
|
|
|
|
socialCom.add(result);
|
|
|
|
|
|
|
|
|
|
|