Commit 81f6ef12 authored by hongguangwu's avatar hongguangwu

预估库逻辑变更

parent 291d1220
...@@ -412,25 +412,25 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap ...@@ -412,25 +412,25 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
**/ **/
private void getChangeReduceData(TSocialFundInfo socialFund, TForecastLibrary libraryOld) { private void getChangeReduceData(TSocialFundInfo socialFund, TForecastLibrary libraryOld) {
//单位社保 //单位社保
libraryOld.setUnitPensionFee(BigDecimalUtils.safeSubtract(socialFund.getUnitPersionMoney(), libraryOld.getUnitPensionFee())); libraryOld.setUnitPensionFee(BigDecimalUtils.safeSubtract( false, socialFund.getUnitPersionMoney(), libraryOld.getUnitPensionFee()));
libraryOld.setUnitMedicalFee(BigDecimalUtils.safeSubtract(socialFund.getUnitMedicalMoney(), libraryOld.getUnitMedicalFee())); libraryOld.setUnitMedicalFee(BigDecimalUtils.safeSubtract( false, socialFund.getUnitMedicalMoney(), libraryOld.getUnitMedicalFee()));
libraryOld.setUnitBirthFee(BigDecimalUtils.safeSubtract(socialFund.getUnitBirthMoney(), libraryOld.getUnitBirthFee())); libraryOld.setUnitBirthFee(BigDecimalUtils.safeSubtract( false, socialFund.getUnitBirthMoney(), libraryOld.getUnitBirthFee()));
libraryOld.setUnitWorkInjuryFee(BigDecimalUtils.safeSubtract(socialFund.getUnitInjuryMoney(), libraryOld.getUnitWorkInjuryFee())); libraryOld.setUnitWorkInjuryFee(BigDecimalUtils.safeSubtract( false, socialFund.getUnitInjuryMoney(), libraryOld.getUnitWorkInjuryFee()));
libraryOld.setUnitUnemploymentFee(BigDecimalUtils.safeSubtract(socialFund.getUnitUnemploymentMoney(), libraryOld.getUnitUnemploymentFee())); libraryOld.setUnitUnemploymentFee(BigDecimalUtils.safeSubtract( false, socialFund.getUnitUnemploymentMoney(), libraryOld.getUnitUnemploymentFee()));
libraryOld.setUnitBitailmentFee(BigDecimalUtils.safeSubtract(socialFund.getUnitBigailmentMoney(), libraryOld.getUnitBitailmentFee())); libraryOld.setUnitBitailmentFee(BigDecimalUtils.safeSubtract( false, socialFund.getUnitBigailmentMoney(), libraryOld.getUnitBitailmentFee()));
libraryOld.setUnitInterestFee(BigDecimalUtils.safeSubtract(socialFund.getUnitInterestFee(), libraryOld.getUnitInterestFee())); libraryOld.setUnitInterestFee(BigDecimalUtils.safeSubtract( false, socialFund.getUnitInterestFee(), libraryOld.getUnitInterestFee()));
libraryOld.setUnitSocialSum(BigDecimalUtils.safeSubtract(socialFund.getUnitSocialSum(), libraryOld.getUnitSocialSum())); libraryOld.setUnitSocialSum(BigDecimalUtils.safeSubtract( false, socialFund.getUnitSocialSum(), libraryOld.getUnitSocialSum()));
// 个人社保 // 个人社保
libraryOld.setPersonalPensionFee(BigDecimalUtils.safeSubtract(socialFund.getPersonalPersionMoney(), libraryOld.getPersonalPensionFee())); libraryOld.setPersonalPensionFee(BigDecimalUtils.safeSubtract( false, socialFund.getPersonalPersionMoney(), libraryOld.getPersonalPensionFee()));
libraryOld.setPersonalMedicalFee(BigDecimalUtils.safeSubtract(socialFund.getPersonalMedicalMoney(), libraryOld.getPersonalMedicalFee())); libraryOld.setPersonalMedicalFee(BigDecimalUtils.safeSubtract( false, socialFund.getPersonalMedicalMoney(), libraryOld.getPersonalMedicalFee()));
libraryOld.setPersonalUnemploymentFee(BigDecimalUtils.safeSubtract(socialFund.getPersonalUnemploymentMoney(), libraryOld.getPersonalUnemploymentFee())); libraryOld.setPersonalUnemploymentFee(BigDecimalUtils.safeSubtract( false, socialFund.getPersonalUnemploymentMoney(), libraryOld.getPersonalUnemploymentFee()));
libraryOld.setPersonalInterestFee(BigDecimalUtils.safeSubtract(socialFund.getPersonalUnemploymentMoney(), libraryOld.getPersonalUnemploymentFee())); libraryOld.setPersonalInterestFee(BigDecimalUtils.safeSubtract( false, socialFund.getPersonalUnemploymentMoney(), libraryOld.getPersonalUnemploymentFee()));
libraryOld.setPersonalBigailmentFee(BigDecimalUtils.safeSubtract(socialFund.getPersonalBigailmentMoney(), libraryOld.getPersonalBigailmentFee())); libraryOld.setPersonalBigailmentFee(BigDecimalUtils.safeSubtract( false, socialFund.getPersonalBigailmentMoney(), libraryOld.getPersonalBigailmentFee()));
libraryOld.setPersonalSocialSum(BigDecimalUtils.safeSubtract(socialFund.getPersonalSocialSum(), libraryOld.getPersonalSocialSum())); libraryOld.setPersonalSocialSum(BigDecimalUtils.safeSubtract( false, socialFund.getPersonalSocialSum(), libraryOld.getPersonalSocialSum()));
// 单位公积金 // 单位公积金
libraryOld.setUnitFundSum(BigDecimalUtils.safeSubtract(socialFund.getUnitFundSum(), libraryOld.getUnitFundSum())); libraryOld.setUnitFundSum(BigDecimalUtils.safeSubtract( false, socialFund.getUnitFundSum(), libraryOld.getUnitFundSum()));
// 个人公积金 // 个人公积金
libraryOld.setPersonalFundSum(BigDecimalUtils.safeSubtract(socialFund.getPersonalFundSum(), libraryOld.getPersonalFundSum())); libraryOld.setPersonalFundSum(BigDecimalUtils.safeSubtract( false, socialFund.getPersonalFundSum(), libraryOld.getPersonalFundSum()));
} }
...@@ -1489,38 +1489,50 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap ...@@ -1489,38 +1489,50 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
@Override @Override
public R<String> updateForecastLibaryByDispatchReduce(TSocialFundInfo socialFundInfo) { public R<String> updateForecastLibaryByDispatchReduce(TSocialFundInfo socialFundInfo) {
String empIdCard = socialFundInfo.getEmpIdcard(); String empIdCard = socialFundInfo.getEmpIdcard();
Date socialReduceDate = socialFundInfo.getSocialReduceDate();
Date fundReduceDate = socialFundInfo.getFundReduceDate();
if (socialReduceDate == null && fundReduceDate == null) {
return R.failed("社保、公积金减少日期不能都为空!");
}
// 查询已经生成的预估数据
List<TForecastLibrary> socialLibraryList = null;
List<TForecastLibrary> fundLibraryList = null;
if (Common.isNotNull(empIdCard)) { if (Common.isNotNull(empIdCard)) {
Date minStartDate = this.getMinSocialDate(socialFundInfo);
BigDecimal zero = BigDecimal.ZERO; BigDecimal zero = BigDecimal.ZERO;
if (socialReduceDate != null) { // 查询已经生成的预估数据
socialLibraryList = baseMapper.selectList(Wrappers.<TForecastLibrary>query().lambda() List<TForecastLibrary> socialLibraryList = baseMapper.selectList(Wrappers.<TForecastLibrary>query().lambda()
.eq(TForecastLibrary::getEmpIdcard, empIdCard) .eq(TForecastLibrary::getEmpIdcard, empIdCard)
.eq(TForecastLibrary::getDataType, CommonConstants.ZERO_INT)); .eq(TForecastLibrary::getDataType, CommonConstants.ZERO_INT));
if (Common.isNotNull(socialLibraryList)) { if (Common.isNotNull(socialLibraryList)) {
for (TForecastLibrary library : socialLibraryList) { // 社保
// 存在社保派减且处于派减期间内,未被预估结算,工资结算引用则清空相关数据 Date socialReduceDate = socialFundInfo.getSocialReduceDate();
if (Common.isNotNull(library.getSocialPayMonth()) && DateUtil.formatDateInt(socialReduceDate) < Integer.parseInt(library.getSocialPayMonth())) { for (TForecastLibrary library : socialLibraryList) {
this.calculateType(zero, library); if (Common.isNotNull(library.getSocialPayMonth())) {
if (socialReduceDate != null) {
// 存在社保派减且处于派减期间内,未被预估结算,工资结算引用则清空相关数据
if (DateUtil.formatDateInt(socialReduceDate) < Integer.parseInt(library.getSocialPayMonth())) {
this.calculateSocialType(zero, library);
}
} else {
if (DateUtil.formatDateInt(minStartDate) <= Integer.parseInt(library.getSocialPayMonth())) {
this.calculateSocialType(zero, library);
}
} }
} }
} }
} }
if (socialReduceDate != null) {
fundLibraryList = baseMapper.selectList(Wrappers.<TForecastLibrary>query().lambda() // 公积金
.eq(TForecastLibrary::getEmpIdcard, empIdCard) List<TForecastLibrary> fundLibraryList = baseMapper.selectList(Wrappers.<TForecastLibrary>query().lambda()
.eq(TForecastLibrary::getDataType, CommonConstants.ONE_INT)); .eq(TForecastLibrary::getEmpIdcard, empIdCard)
if (Common.isNotNull(fundLibraryList)) { .eq(TForecastLibrary::getDataType, CommonConstants.ONE_INT));
for (TForecastLibrary library : fundLibraryList) { if (Common.isNotNull(fundLibraryList)) {
// 存在社保派减且处于派减期间内,未被预估结算,工资结算引用则清空相关数据 minStartDate = socialFundInfo.getProvidentStart();
if (Common.isNotNull(library.getProvidentPayMonth()) && DateUtil.formatDateInt(fundReduceDate) < Integer.parseInt(library.getProvidentPayMonth())) { Date fundReduceDate = socialFundInfo.getFundReduceDate();
this.calculateType(zero, library); for (TForecastLibrary library : fundLibraryList) {
if (Common.isNotNull(library.getProvidentPayMonth())) {
if (fundReduceDate != null) {
// 存在社保派减且处于派减期间内,未被预估结算,工资结算引用则清空相关数据
if (DateUtil.formatDateInt(fundReduceDate) < Integer.parseInt(library.getProvidentPayMonth())) {
this.calculateFundType(zero, library);
}
} else {
if (DateUtil.formatDateInt(minStartDate) <= Integer.parseInt(library.getProvidentPayMonth())) {
this.calculateFundType(zero, library);
}
} }
} }
} }
...@@ -1529,31 +1541,45 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap ...@@ -1529,31 +1541,45 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
return R.ok(); return R.ok();
} }
private void calculateType(BigDecimal zero, TForecastLibrary library) { private void calculateSocialType(BigDecimal zero, TForecastLibrary library) {
if (library.getDataPush() == CommonConstants.ONE_INT) { if (library.getDataPush() == CommonConstants.ONE_INT) {
// 加负数 // 加负数
TForecastLibrary negateLib = new TForecastLibrary(); TForecastLibrary negateLib = new TForecastLibrary();
BeanUtil.copyProperties(library, negateLib); BeanUtil.copyProperties(library, negateLib);
negateLib.setUnitPensionFee(BigDecimalUtils.safeSubtract(zero, library.getUnitPensionFee())); negateLib.setUnitPensionFee(BigDecimalUtils.safeSubtract( false, zero, library.getUnitPensionFee()));
negateLib.setUnitMedicalFee(BigDecimalUtils.safeSubtract(zero, library.getUnitMedicalFee())); negateLib.setUnitMedicalFee(BigDecimalUtils.safeSubtract( false, zero, library.getUnitMedicalFee()));
negateLib.setUnitBirthFee(BigDecimalUtils.safeSubtract(zero, library.getUnitBirthFee())); negateLib.setUnitBirthFee(BigDecimalUtils.safeSubtract( false, zero, library.getUnitBirthFee()));
negateLib.setUnitWorkInjuryFee(BigDecimalUtils.safeSubtract(zero, library.getUnitWorkInjuryFee())); negateLib.setUnitWorkInjuryFee(BigDecimalUtils.safeSubtract( false, zero, library.getUnitWorkInjuryFee()));
negateLib.setUnitUnemploymentFee(BigDecimalUtils.safeSubtract(zero, library.getUnitUnemploymentFee())); negateLib.setUnitUnemploymentFee(BigDecimalUtils.safeSubtract( false, zero, library.getUnitUnemploymentFee()));
negateLib.setUnitBitailmentFee(BigDecimalUtils.safeSubtract(zero, library.getUnitBitailmentFee())); negateLib.setUnitBitailmentFee(BigDecimalUtils.safeSubtract( false, zero, library.getUnitBitailmentFee()));
negateLib.setUnitInterestFee(BigDecimalUtils.safeSubtract(zero, library.getUnitInterestFee())); negateLib.setUnitInterestFee(BigDecimalUtils.safeSubtract( false, zero, library.getUnitInterestFee()));
negateLib.setUnitSocialSum(BigDecimalUtils.safeSubtract(zero, library.getUnitSocialSum())); negateLib.setUnitSocialSum(BigDecimalUtils.safeSubtract( false, zero, library.getUnitSocialSum()));
// 个人社保 // 个人社保
negateLib.setPersonalPensionFee(BigDecimalUtils.safeSubtract(zero, library.getPersonalPensionFee())); negateLib.setPersonalPensionFee(BigDecimalUtils.safeSubtract( false, zero, library.getPersonalPensionFee()));
negateLib.setPersonalMedicalFee(BigDecimalUtils.safeSubtract(zero, library.getPersonalMedicalFee())); negateLib.setPersonalMedicalFee(BigDecimalUtils.safeSubtract( false, zero, library.getPersonalMedicalFee()));
negateLib.setPersonalUnemploymentFee(BigDecimalUtils.safeSubtract(zero, library.getPersonalUnemploymentFee())); negateLib.setPersonalUnemploymentFee(BigDecimalUtils.safeSubtract( false, zero, library.getPersonalUnemploymentFee()));
negateLib.setPersonalInterestFee(BigDecimalUtils.safeSubtract(zero, library.getPersonalUnemploymentFee())); negateLib.setPersonalInterestFee(BigDecimalUtils.safeSubtract( false, zero, library.getPersonalUnemploymentFee()));
negateLib.setPersonalBigailmentFee(BigDecimalUtils.safeSubtract(zero, library.getPersonalBigailmentFee())); negateLib.setPersonalBigailmentFee(BigDecimalUtils.safeSubtract( false, zero, library.getPersonalBigailmentFee()));
negateLib.setPersonalSocialSum(BigDecimalUtils.safeSubtract(zero, library.getPersonalSocialSum())); negateLib.setPersonalSocialSum(BigDecimalUtils.safeSubtract( false, zero, library.getPersonalSocialSum()));
negateLib.setSumAll(BigDecimalUtils.safeSubtract( false, zero, library.getSumAll()));
negateLib.setDiffType(SocialConstants.DIFF_TYPE_TWO);
baseMapper.insert(negateLib);
} else {
// 删除
baseMapper.deleteById(library.getId());
}
}
private void calculateFundType(BigDecimal zero, TForecastLibrary library) {
if (library.getDataPush() == CommonConstants.ONE_INT) {
// 加负数
TForecastLibrary negateLib = new TForecastLibrary();
BeanUtil.copyProperties(library, negateLib);
// 单位公积金 // 单位公积金
negateLib.setUnitFundSum(BigDecimalUtils.safeSubtract(zero, library.getUnitFundSum())); negateLib.setUnitFundSum(BigDecimalUtils.safeSubtract(false, zero, library.getUnitFundSum()));
// 个人公积金 // 个人公积金
negateLib.setPersonalFundSum(BigDecimalUtils.safeSubtract(zero, library.getPersonalFundSum())); negateLib.setPersonalFundSum(BigDecimalUtils.safeSubtract(false, zero, library.getPersonalFundSum()));
negateLib.setSumAll(BigDecimalUtils.safeSubtract(zero, library.getSumAll())); negateLib.setSumAll(BigDecimalUtils.safeSubtract(false, zero, library.getSumAll()));
negateLib.setDiffType(SocialConstants.DIFF_TYPE_TWO); negateLib.setDiffType(SocialConstants.DIFF_TYPE_TWO);
baseMapper.insert(negateLib); baseMapper.insert(negateLib);
} else { } else {
...@@ -1721,6 +1747,32 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap ...@@ -1721,6 +1747,32 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
return minStartDate; return minStartDate;
} }
private Date getMinSocialDate(TSocialFundInfo socialFundInfo) {
Date minStartDate = null;
if (socialFundInfo.getSocialStartDate() != null) {
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();
}
}
if (null == minStartDate) {
minStartDate = new Date();
}
return minStartDate;
}
/** /**
* @Description: 核心刷新 * @Description: 核心刷新
* @Author: hgw * @Author: hgw
...@@ -1753,7 +1805,6 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap ...@@ -1753,7 +1805,6 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
diffType = SocialConstants.DIFF_TYPE_ONE; diffType = SocialConstants.DIFF_TYPE_ONE;
if (null != tForecastLibrary) { if (null != tForecastLibrary) {
diffType = SocialConstants.DIFF_TYPE_TWO; diffType = SocialConstants.DIFF_TYPE_TWO;
this.getChangeReduceData(tSocialInfo, tForecastLibrary);
} else if (CommonConstants.dingleDigitStrArray[5].equals(tSocialInfo.getSocialStatus()) } else if (CommonConstants.dingleDigitStrArray[5].equals(tSocialInfo.getSocialStatus())
|| CommonConstants.dingleDigitStrArray[10].equals(tSocialInfo.getSocialStatus())) { || CommonConstants.dingleDigitStrArray[10].equals(tSocialInfo.getSocialStatus())) {
// 5 办理失败 10 审核不通过,且无推送数据,不新增 // 5 办理失败 10 审核不通过,且无推送数据,不新增
...@@ -1772,6 +1823,9 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap ...@@ -1772,6 +1823,9 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
historyLibrary = socialHistoryMap.get(sfMapKey); historyLibrary = socialHistoryMap.get(sfMapKey);
// 初始化社保 // 初始化社保
initSocialLibary(diffType, payMonth, saveLibraryMap, tSocialInfo, isReduceFund, agentConfigHashMap, tForecastLibrary, sfMapKey, historyLibrary); initSocialLibary(diffType, payMonth, saveLibraryMap, tSocialInfo, isReduceFund, agentConfigHashMap, tForecastLibrary, sfMapKey, historyLibrary);
if (null != tForecastLibrary) {
this.getChangeReduceData(tSocialInfo, tForecastLibrary);
}
} }
} }
} }
...@@ -1785,7 +1839,6 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap ...@@ -1785,7 +1839,6 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
diffType = SocialConstants.DIFF_TYPE_ONE; diffType = SocialConstants.DIFF_TYPE_ONE;
if (null != tForecastLibrary) { if (null != tForecastLibrary) {
diffType = SocialConstants.DIFF_TYPE_TWO; diffType = SocialConstants.DIFF_TYPE_TWO;
this.getChangeReduceData(providentFund, tForecastLibrary);
} else if (CommonConstants.dingleDigitStrArray[4].equals(providentFund.getFundStatus()) } else if (CommonConstants.dingleDigitStrArray[4].equals(providentFund.getFundStatus())
|| CommonConstants.dingleDigitStrArray[9].equals(providentFund.getFundStatus())) { || CommonConstants.dingleDigitStrArray[9].equals(providentFund.getFundStatus())) {
// 4办理失败9 审核不通过,且无推送数据,不新增 // 4办理失败9 审核不通过,且无推送数据,不新增
...@@ -1804,6 +1857,9 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap ...@@ -1804,6 +1857,9 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
historyLibrary = fundHistoryMap.get(sfMapKey); historyLibrary = fundHistoryMap.get(sfMapKey);
// 初始化公积金 // 初始化公积金
initFundLibary(diffType, payMonth, saveLibraryMap, providentFund, isReduceSocial, tForecastLibrary, sfMapKey, historyLibrary); initFundLibary(diffType, payMonth, saveLibraryMap, providentFund, isReduceSocial, tForecastLibrary, sfMapKey, historyLibrary);
if (null != tForecastLibrary) {
this.getChangeReduceData(providentFund, tForecastLibrary);
}
} }
} }
......
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