Merge remote-tracking branch 'remotes/origin/feature/v4-siSchemeAddPaymentCycle-0202' into release/2.6.1.2301.02

This commit is contained in:
sy 2023-02-09 17:24:29 +08:00
commit ba267d9dce
7 changed files with 535 additions and 66 deletions

View File

@ -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);

View File

@ -79,6 +79,9 @@ public class SISchemeBiz {
.insuranceName(item.getInsuranceName())
.paymentScope(e.getDefaultLabel())
.rententionRule(String.valueOf(RententionRuleEnum.ROUND.getValue()))
.cycleSetting("000000000000")
.paymentCycle("0")
.accountType("0")
.build();
if (Objects.equals(item.getDataType(), DataTypeEnum.SYSTEM.getValue())) {
insuranceSchemeDetailDTO.setIsPayment(true);
@ -98,6 +101,21 @@ public class SISchemeBiz {
if (insuranceSchemeDetailPO.getIsPayment() != null) {
insuranceSchemeDetailDTO.setIsPayment(Objects.equals(insuranceSchemeDetailPO.getIsPayment(), IsPaymentEnum.YES.getValue()));
}
if (insuranceSchemeDetailPO.getPaymentCycle() != null) {
insuranceSchemeDetailDTO.setPaymentCycle(insuranceSchemeDetailPO.getPaymentCycle() + "");
} else {
insuranceSchemeDetailDTO.setPaymentCycle("0");
}
if (insuranceSchemeDetailPO.getAccountType() != null) {
insuranceSchemeDetailDTO.setAccountType(insuranceSchemeDetailPO.getAccountType() + "");
} else {
insuranceSchemeDetailDTO.setAccountType("0");
}
if (insuranceSchemeDetailPO.getCycleSetting() == null) {
insuranceSchemeDetailDTO.setCycleSetting("000000000000");
} else {
insuranceSchemeDetailDTO.setCycleSetting(insuranceSchemeDetailPO.getCycleSetting());
}
if (StringUtils.isNotBlank(insuranceSchemeDetailPO.getUpperLimit())) {
BigDecimal bigDecimal = new BigDecimal(insuranceSchemeDetailPO.getUpperLimit());
insuranceSchemeDetailDTO.setUpperLimit(numberCheck(bigDecimal.toPlainString()) ? null : bigDecimal);

View File

@ -72,6 +72,9 @@ public class InsuranceSchemeBO {
.upperLimit(item.getUpperLimit() != null ? item.getUpperLimit().toString() : "0.000")
.paymentProportion(item.getPaymentProportion() != null ? item.getPaymentProportion().toString() : "0.0000")
.rententionRule(item.getRententionRule() != null ? Integer.valueOf(item.getRententionRule()) : null)
.paymentCycle(Integer.parseInt(item.getPaymentCycle()))
.cycleSetting(item.getCycleSetting())
.accountType(Integer.parseInt(item.getAccountType()))
.updateTime(new Date())
.validNum(item.getValidNum())
.build()

View File

@ -93,4 +93,19 @@ public class InsuranceSchemeDetailDTO {
* 进位规则
*/
private String rententionRule;
/**
* 缴纳周期
*/
private String paymentCycle;
/**
* 核算方式
*/
private String accountType;
/**
* 缴纳周期规则设置
*/
private String cycleSetting;
}

View File

@ -90,6 +90,21 @@ public class InsuranceSchemeDetailPO {
*/
private Integer rententionRule;
/**
* 缴纳周期0不进行周期缴纳1进行周期缴纳
*/
private Integer paymentCycle;
/**
* 核算方式
*/
private Integer accountType;
/**
* 缴纳周期规则设置
*/
private String cycleSetting;
/**
* 创建人id
*/

View File

@ -15,6 +15,9 @@
<result column="fixed_cost" property="fixedCost"/>
<result column="valid_num" property="validNum"/>
<result column="rentention_rule" property="rententionRule"/>
<result column="payment_cycle" property="paymentCycle"/>
<result column="account_type" property="accountType"/>
<result column="cycle_setting" property="cycleSetting"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
<result column="creator" property="creator"/>
@ -37,6 +40,9 @@
, t.fixed_cost
, t.valid_num
, t.rentention_rule
, t.payment_cycle
, t.account_type
, t.cycle_setting
, t.create_time
, t.update_time
, t.creator
@ -122,6 +128,9 @@
fixed_cost,
valid_num,
rentention_rule,
payment_cycle,
account_type,
cycle_setting,
create_time,
update_time,
creator,
@ -141,6 +150,9 @@
#{fixedCost},
#{validNum},
#{rententionRule},
#{paymentCycle},
#{accountType},
#{cycleSetting},
#{createTime},
#{updateTime},
#{creator},
@ -168,6 +180,9 @@
fixed_cost,
valid_num,
rentention_rule,
payment_cycle,
account_type,
cycle_setting,
create_time,
update_time,
creator,
@ -187,6 +202,9 @@
#{fixedCost},
#{validNum},
#{rententionRule},
#{paymentCycle},
#{accountType},
#{cycleSetting},
#{createTime},
#{updateTime},
#{creator},

View File

@ -33,6 +33,7 @@ import javax.ws.rs.core.Response;
import javax.ws.rs.core.StreamingOutput;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.time.LocalDate;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@ -200,6 +201,8 @@ public class SISchemeController {
} else {
fileName = SalaryI18nUtil.getI18nLabel(85368, "社保福利档案导出");
}
fileName = fileName + LocalDate.now();
try {
fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8");
} catch (UnsupportedEncodingException e) {
@ -278,6 +281,8 @@ public class SISchemeController {
} else {
fileName = SalaryI18nUtil.getI18nLabel(85368, "社保福利档案导入模板");
}
fileName = fileName + LocalDate.now();
try {
fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8");
} catch (UnsupportedEncodingException e) {