Commit 01ce233f authored by hongguangwu's avatar hongguangwu

每个险种一个起缴时间

parent 5ce087f7
...@@ -26,15 +26,12 @@ import com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner; ...@@ -26,15 +26,12 @@ import com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner;
import com.yifu.cloud.plus.v1.yifu.social.entity.TForecastLibrary; import com.yifu.cloud.plus.v1.yifu.social.entity.TForecastLibrary;
import com.yifu.cloud.plus.v1.yifu.social.service.TForecastLibraryService; import com.yifu.cloud.plus.v1.yifu.social.service.TForecastLibraryService;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpHeaders;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.List;
/** /**
...@@ -47,7 +44,6 @@ import java.util.List; ...@@ -47,7 +44,6 @@ import java.util.List;
@RequiredArgsConstructor @RequiredArgsConstructor
@RequestMapping("/tforecastlibrary") @RequestMapping("/tforecastlibrary")
@Tag(name = "预估费用管理") @Tag(name = "预估费用管理")
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
public class TForecastLibraryController { public class TForecastLibraryController {
private final TForecastLibraryService tForecastLibraryService; private final TForecastLibraryService tForecastLibraryService;
......
...@@ -777,11 +777,11 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap ...@@ -777,11 +777,11 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
private void initLibrayOfPersonal(TForecastLibrary library, TSocialFundInfo socialInfo private void initLibrayOfPersonal(TForecastLibrary library, TSocialFundInfo socialInfo
, SysBaseSetInfo sysBaseSetInfo, TForecastLibrary historyLibrary) { , SysBaseSetInfo sysBaseSetInfo, TForecastLibrary historyLibrary) {
// 个人养老基数 // 个人养老基数
BigDecimal personalPersionBase = BigDecimal.ZERO; BigDecimal personalPersionBase;
// 个人医疗基数 // 个人医疗基数
BigDecimal personalMedicalBase = BigDecimal.ZERO; BigDecimal personalMedicalBase;
// 个人失业基数 // 个人失业基数
BigDecimal personalUnemploymentBase = BigDecimal.ZERO; BigDecimal personalUnemploymentBase;
// 个人养老比例 // 个人养老比例
BigDecimal personalPersionPro = BigDecimal.ZERO; BigDecimal personalPersionPro = BigDecimal.ZERO;
// 个人医疗比例 // 个人医疗比例
...@@ -822,8 +822,6 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap ...@@ -822,8 +822,6 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
personalMedicalPro = socialInfo.getPersonalMedicalPer(); personalMedicalPro = socialInfo.getPersonalMedicalPer();
personalUnemploymentPro = socialInfo.getPersonalUnemploymentPer(); personalUnemploymentPro = socialInfo.getPersonalUnemploymentPer();
} }
}
personalPersionMoney = BigDecimalUtils.safeMultiply(personalPersionBase, personalPersionPro, personalPersionMoney = BigDecimalUtils.safeMultiply(personalPersionBase, personalPersionPro,
CommonConstants.ONE_OF_PERCENT); CommonConstants.ONE_OF_PERCENT);
personalMedicalMoney = BigDecimalUtils.safeMultiply(personalMedicalBase, personalMedicalPro, personalMedicalMoney = BigDecimalUtils.safeMultiply(personalMedicalBase, personalMedicalPro,
...@@ -831,31 +829,40 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap ...@@ -831,31 +829,40 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
personalUnemploymentMoney = BigDecimalUtils.safeMultiply(personalUnemploymentBase, personalUnemploymentPro, personalUnemploymentMoney = BigDecimalUtils.safeMultiply(personalUnemploymentBase, personalUnemploymentPro,
CommonConstants.ONE_OF_PERCENT); CommonConstants.ONE_OF_PERCENT);
if (library.getSocialPayMonth() != null) {
int libraryPayMonth = Integer.parseInt(library.getSocialPayMonth());
if (socialInfo.getPensionStart() != null && libraryPayMonth >= DateUtil.formatDateInt(socialInfo.getPensionStart())) {
library.setPersonalPensionBase(personalPersionBase); library.setPersonalPensionBase(personalPersionBase);
library.setPersonalMedicalBase(personalMedicalBase);
library.setPersonalUnemploymentBase(personalUnemploymentBase);
library.setPersonalPersionPro(personalPersionPro); library.setPersonalPersionPro(personalPersionPro);
library.setPersonalPensionFee(personalPersionMoney);
}
if (socialInfo.getMedicalStart() != null && libraryPayMonth >= DateUtil.formatDateInt(socialInfo.getMedicalStart())) {
library.setPersonalMedicalBase(personalMedicalBase);
library.setPersonalMedicalPro(personalMedicalPro); library.setPersonalMedicalPro(personalMedicalPro);
library.setPersonalUnemploymentPro(personalUnemploymentPro);
library.setPersonalMedicalFee(personalMedicalMoney); library.setPersonalMedicalFee(personalMedicalMoney);
library.setPersonalPensionFee(personalPersionMoney); }
if (socialInfo.getUnemployStart() != null && libraryPayMonth >= DateUtil.formatDateInt(socialInfo.getUnemployStart())) {
library.setPersonalUnemploymentBase(personalUnemploymentBase);
library.setPersonalUnemploymentPro(personalUnemploymentPro);
library.setPersonalUnemploymentFee(personalUnemploymentMoney); library.setPersonalUnemploymentFee(personalUnemploymentMoney);
} }
}
}
}
private void initLibraryOfUnit(TForecastLibrary library, TSocialFundInfo socialInfo private void initLibraryOfUnit(TForecastLibrary library, TSocialFundInfo socialInfo
, SysBaseSetInfo sysBaseSetInfo, TForecastLibrary historyLibrary) { , SysBaseSetInfo sysBaseSetInfo, TForecastLibrary historyLibrary) {
// 单位养老基数 // 单位养老基数
BigDecimal unitPersionBase = BigDecimal.ZERO; BigDecimal unitPersionBase;
// 单位医疗基数 // 单位医疗基数
BigDecimal unitMedicalBase = BigDecimal.ZERO; BigDecimal unitMedicalBase;
// 单位失业基数 // 单位失业基数
BigDecimal unitUnemploymentBase = BigDecimal.ZERO; BigDecimal unitUnemploymentBase;
// 单位工伤基数 // 单位工伤基数
BigDecimal unitInjuryBase = BigDecimal.ZERO; BigDecimal unitInjuryBase;
// 单位生育基数 // 单位生育基数
BigDecimal unitBirthBase = BigDecimal.ZERO; BigDecimal unitBirthBase;
// 单位养老比例 // 单位养老比例
BigDecimal unitPersionPro = BigDecimal.ZERO; BigDecimal unitPersionPro = BigDecimal.ZERO;
...@@ -918,8 +925,6 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap ...@@ -918,8 +925,6 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
unitInjuryPro = socialInfo.getUnitWorkUnjuryPer(); unitInjuryPro = socialInfo.getUnitWorkUnjuryPer();
unitBirthPro = socialInfo.getUnitBirthPer(); unitBirthPro = socialInfo.getUnitBirthPer();
} }
}
unitPersionMoney = BigDecimalUtils.safeMultiply(unitPersionBase, unitPersionPro, unitPersionMoney = BigDecimalUtils.safeMultiply(unitPersionBase, unitPersionPro,
CommonConstants.ONE_OF_PERCENT); CommonConstants.ONE_OF_PERCENT);
unitMedicalMoney = BigDecimalUtils.safeMultiply(unitMedicalBase, unitMedicalPro, unitMedicalMoney = BigDecimalUtils.safeMultiply(unitMedicalBase, unitMedicalPro,
...@@ -931,23 +936,35 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap ...@@ -931,23 +936,35 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
unitBirthMoney = BigDecimalUtils.safeMultiply(unitBirthBase, unitBirthPro, unitBirthMoney = BigDecimalUtils.safeMultiply(unitBirthBase, unitBirthPro,
CommonConstants.ONE_OF_PERCENT); CommonConstants.ONE_OF_PERCENT);
if (library.getSocialPayMonth() != null) {
int libraryPayMonth = Integer.parseInt(library.getSocialPayMonth());
if (socialInfo.getPensionStart() != null && libraryPayMonth >= DateUtil.formatDateInt(socialInfo.getPensionStart())) {
library.setUnitPensionBase(unitPersionBase); library.setUnitPensionBase(unitPersionBase);
library.setUnitMedicalBase(unitMedicalBase);
library.setUnitUnemploymentBase(unitUnemploymentBase);
library.setUnitInjuryBase(unitInjuryBase);
library.setUnitBirthBase(unitBirthBase);
library.setUnitPersionPro(unitPersionPro); library.setUnitPersionPro(unitPersionPro);
library.setUnitPensionFee(unitPersionMoney);
}
if (socialInfo.getMedicalStart() != null && libraryPayMonth >= DateUtil.formatDateInt(socialInfo.getMedicalStart())) {
library.setUnitMedicalBase(unitMedicalBase);
library.setUnitMedicalPro(unitMedicalPro); library.setUnitMedicalPro(unitMedicalPro);
library.setUnitMedicalFee(unitMedicalMoney);
}
if (socialInfo.getUnemployStart() != null && libraryPayMonth >= DateUtil.formatDateInt(socialInfo.getUnemployStart())) {
library.setUnitUnemploymentBase(unitUnemploymentBase);
library.setUnitUnemploymentPro(unitUnemploymentPro); library.setUnitUnemploymentPro(unitUnemploymentPro);
library.setUnitUnemploymentFee(unitUnemploymentMoney);
}
if (socialInfo.getWorkInjuryStart() != null && libraryPayMonth >= DateUtil.formatDateInt(socialInfo.getWorkInjuryStart())) {
library.setUnitInjuryBase(unitInjuryBase);
library.setUnitInjuryPro(unitInjuryPro); library.setUnitInjuryPro(unitInjuryPro);
library.setUnitWorkInjuryFee(unitInjuryMoney);
}
if (socialInfo.getBirthStart() != null && libraryPayMonth >= DateUtil.formatDateInt(socialInfo.getBirthStart())) {
library.setUnitBirthBase(unitBirthBase);
library.setUnitBirthPro(unitBirthPro); library.setUnitBirthPro(unitBirthPro);
library.setUnitPensionFee(unitPersionMoney);
library.setUnitMedicalFee(unitMedicalMoney);
library.setUnitUnemploymentFee(unitUnemploymentMoney);
library.setUnitBirthFee(unitBirthMoney); library.setUnitBirthFee(unitBirthMoney);
library.setUnitWorkInjuryFee(unitInjuryMoney); }
}
}
} }
/** /**
...@@ -1559,7 +1576,10 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap ...@@ -1559,7 +1576,10 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
return R.failed("同步预估库,doMonth格式错误:" + doMonth); return R.failed("同步预估库,doMonth格式错误:" + doMonth);
} }
} else { } else {
monthDiff = DateUtil.getMonthDiff(socialFundInfo.getSocialStartDate(), new Date()) + 2; // 获取最小的起缴月
Date minStartDate = this.getMinDate(socialFundInfo);
// 再计算月份
monthDiff = DateUtil.getMonthDiff(minStartDate, new Date()) + 2;
} }
List<String> payMonthList = new ArrayList<>(); List<String> payMonthList = new ArrayList<>();
for (int i = 0; i < monthDiff; i++) { for (int i = 0; i < monthDiff; i++) {
...@@ -1648,6 +1668,33 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap ...@@ -1648,6 +1668,33 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
} }
} }
/**
* @param socialFundInfo
* @Description: 获取最小起缴日
* @Author: hgw
* @Date: 2022/7/29 11:06
* @return: java.util.Date
**/
private Date getMinDate(TSocialFundInfo socialFundInfo) {
Date minStartDate = socialFundInfo.getSocialStartDate();
if (socialFundInfo.getUnitPersionMoney() != null && socialFundInfo.getPensionStart() != null && socialFundInfo.getPensionStart().before(minStartDate)) {
minStartDate = socialFundInfo.getPensionStart();
}
if (socialFundInfo.getUnitMedicalMoney() != null && socialFundInfo.getMedicalStart() != null && socialFundInfo.getMedicalStart().before(minStartDate)) {
minStartDate = socialFundInfo.getMedicalStart();
}
if (socialFundInfo.getUnitUnemploymentMoney() != null && socialFundInfo.getUnemployStart() != null && socialFundInfo.getUnemployStart().before(minStartDate)) {
minStartDate = socialFundInfo.getUnemployStart();
}
if (socialFundInfo.getUnitInjuryMoney() != null && socialFundInfo.getWorkInjuryStart() != null && socialFundInfo.getWorkInjuryStart().before(minStartDate)) {
minStartDate = socialFundInfo.getWorkInjuryStart();
}
if (socialFundInfo.getUnitBirthMoney() != null && socialFundInfo.getBirthStart() != null && socialFundInfo.getBirthStart().before(minStartDate)) {
minStartDate = socialFundInfo.getBirthStart();
}
return minStartDate;
}
/** /**
* @Description: 核心刷新 * @Description: 核心刷新
* @Author: hgw * @Author: hgw
...@@ -1666,10 +1713,12 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap ...@@ -1666,10 +1713,12 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
String sfMapKey; String sfMapKey;
TForecastLibrary tForecastLibrary; TForecastLibrary tForecastLibrary;
String diffType; String diffType;
Date minStartDate;
for (String payMonth : payMonthList) { for (String payMonth : payMonthList) {
//封装社保预估数据 //封装社保预估数据
if (Common.isNotNull(socialInfoList)) { if (Common.isNotNull(socialInfoList)) {
for (TSocialFundInfo tSocialInfo : socialInfoList) { for (TSocialFundInfo tSocialInfo : socialInfoList) {
minStartDate = this.getMinDate(tSocialInfo);
createMonth = ServiceUtil.initCreateMonth(tSocialInfo.getCreateTime(), payMonth); createMonth = ServiceUtil.initCreateMonth(tSocialInfo.getCreateTime(), payMonth);
sfMapKey = this.getMapKey(tSocialInfo.getEmpIdcard(), tSocialInfo.getSettleDomain(), payMonth, createMonth); sfMapKey = this.getMapKey(tSocialInfo.getEmpIdcard(), tSocialInfo.getSettleDomain(), payMonth, createMonth);
...@@ -1685,12 +1734,12 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap ...@@ -1685,12 +1734,12 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
continue; continue;
} }
//起缴月份在要生成的月份前不处理 || 截止月份在要生成的月份后不处理 //起缴月份在要生成的月份前不处理 || 截止月份在要生成的月份后不处理
if (Integer.parseInt(payMonth) < DateUtil.formatDateInt(tSocialInfo.getSocialStartDate()) if (Integer.parseInt(payMonth) < DateUtil.formatDateInt(minStartDate)
|| (Common.isNotNull(tSocialInfo.getSocialReduceDate()) || (Common.isNotNull(tSocialInfo.getSocialReduceDate())
&& Integer.parseInt(payMonth) > DateUtil.formatDateInt(tSocialInfo.getSocialReduceDate()))) { && Integer.parseInt(payMonth) > DateUtil.formatDateInt(tSocialInfo.getSocialReduceDate()))) {
continue; continue;
} }
flag = CommonConstants.ZERO_STRING.equals(tSocialInfo.getCanOverpay()) && (null == tSocialInfo.getOverpayNumber() || null == tSocialInfo.getHaveThisMonth() || null == tSocialInfo.getSocialStartDate()); flag = CommonConstants.ZERO_STRING.equals(tSocialInfo.getCanOverpay()) && (null == tSocialInfo.getOverpayNumber() || null == tSocialInfo.getHaveThisMonth() || null == minStartDate);
if (flag) { if (flag) {
return R.failed("员工" + tSocialInfo.getEmpName() + ":" + tSocialInfo.getEmpIdcard() + SocialConstants.SOCIAL_SET_ERROR); return R.failed("员工" + tSocialInfo.getEmpName() + ":" + tSocialInfo.getEmpIdcard() + SocialConstants.SOCIAL_SET_ERROR);
} else { } else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment