Commit 5442fbe9 authored by huyuchen's avatar huyuchen

ekp推送接口修改

parent 925aa299
......@@ -317,6 +317,13 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
, fundHistoryMap, socialPushMap, fundPushMap, saveLibraryMap, isReduceSocial, isReduceFund, false);
if (coreR != null) return coreR;
boolean isSaveAndUpdate = false;
TSocialFundInfo socialFundInfo;
TSocialFundInfo socialFundInfoF;
List<TForecastLibrary> libraryFundInfoListSocial = new ArrayList<>();
List<TForecastLibrary> libraryFundInfoListFund = new ArrayList<>();
for (TForecastLibrary library : saveLibraryMap.values()) {
if (Common.isEmpty(library.getSocialId()) && Common.isEmpty(library.getProvidentId())) {
continue;
......@@ -333,31 +340,41 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
}
}
//生成社保收入
TSocialFundInfo socialFundInfo = socialFundInfoMapper.selectOne(Wrappers.<TSocialFundInfo>query().lambda()
.eq(TSocialFundInfo::getEmpIdcard, empIdCard)
.eq(TSocialFundInfo::getSettleDomain, library.getSettleDomainId())
.eq(TSocialFundInfo::getSocialHousehold, library.getSocialHousehold()));
if (Common.isNotNull(socialFundInfo)) {
if (Common.isNotNull(socialFundInfo.getSocialId())
&& CommonConstants.FOUR_STRING.equals(socialFundInfo.getSocialStatus())
|| CommonConstants.THREE_STRING.equals(socialFundInfo.getSocialStatus())) {
//办理成功生成收入
createIncomeInfo(library);
socialFundInfo = socialFundInfoMapper.selectOne(Wrappers.<TSocialFundInfo>query().lambda()
.eq(TSocialFundInfo::getEmpIdcard, empIdCard)
.eq(TSocialFundInfo::getSettleDomain, library.getSettleDomainId())
.eq(TSocialFundInfo::getSocialHousehold, library.getSocialHousehold()));
if (Common.isNotNull(socialFundInfo) && Common.isNotNull(socialFundInfo.getSocialId())
&& CommonConstants.FOUR_STRING.equals(socialFundInfo.getSocialStatus())
|| CommonConstants.THREE_STRING.equals(socialFundInfo.getSocialStatus())) {
//办理成功生成收入
createIncomeInfo(library);
if (CommonConstants.ZERO_INT == library.getDataPush()) {
libraryFundInfoListSocial.add(library);
}
}
//生成公积金收入
TSocialFundInfo socialFundInfoF = socialFundInfoMapper.selectOne(Wrappers.<TSocialFundInfo>query().lambda()
socialFundInfoF = socialFundInfoMapper.selectOne(Wrappers.<TSocialFundInfo>query().lambda()
.eq(TSocialFundInfo::getEmpIdcard, empIdCard)
.eq(TSocialFundInfo::getSettleDomain, library.getSettleDomainId())
.eq(TSocialFundInfo::getProvidentHousehold, library.getProvidentHousehold()));
if (Common.isNotNull(socialFundInfoF)) {
if (Common.isNotNull(socialFundInfoF.getFundId())
&& CommonConstants.THREE_STRING.equals(socialFundInfoF.getFundStatus())) {
//办理成功生成收入
createIncomeInfo(library);
if (Common.isNotNull(socialFundInfoF) && Common.isNotNull(socialFundInfoF.getFundId())
&& CommonConstants.THREE_STRING.equals(socialFundInfoF.getFundStatus())) {
//办理成功生成收入
createIncomeInfo(library);
if (CommonConstants.ZERO_INT == library.getDataPush()) {
libraryFundInfoListFund.add(library);
}
}
}
//推送社保明细
if (Common.isNotNull(libraryFundInfoListSocial)) {
pushForecastInfo(libraryFundInfoListSocial);
}
//推送公积金明细
if (Common.isNotNull(libraryFundInfoListFund)) {
pushForecastFundInfo(libraryFundInfoListFund);
}
if (isSaveAndUpdate) {
return R.ok(null, "执行成功!");
} else {
......@@ -1498,6 +1515,8 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
@Override
public R<String> updateForecastLibaryByDispatchReduce(TSocialFundInfo socialFundInfo, int forecastFlag) {
String empIdCard = socialFundInfo.getEmpIdcard();
List<TForecastLibrary> libraryFundInfoListSocial = new ArrayList<>();
List<TForecastLibrary> libraryFundInfoListFund = new ArrayList<>();
if (Common.isNotNull(empIdCard)) {
Date minStartDate = this.getMinSocialDate(socialFundInfo);
BigDecimal zero = BigDecimal.ZERO;
......@@ -1514,11 +1533,11 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
if (socialReduceDate != null) {
// 存在社保派减且处于派减期间内,未被预估结算,工资结算引用则清空相关数据
if (DateUtil.formatDateInt(socialReduceDate) <= Integer.parseInt(library.getSocialPayMonth())) {
this.calculateSocialType(zero, library);
this.calculateSocialType(zero, library, libraryFundInfoListSocial);
}
} else {
if (DateUtil.formatDateInt(minStartDate) <= Integer.parseInt(library.getSocialPayMonth())) {
this.calculateSocialType(zero, library);
this.calculateSocialType(zero, library, libraryFundInfoListSocial);
}
}
}
......@@ -1539,22 +1558,30 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
if (fundReduceDate != null) {
// 存在社保派减且处于派减期间内,未被预估结算,工资结算引用则清空相关数据
if (DateUtil.formatDateInt(fundReduceDate) <= Integer.parseInt(library.getProvidentPayMonth())) {
this.calculateFundType(zero, library);
this.calculateFundType(zero, library,libraryFundInfoListFund);
}
} else {
if (DateUtil.formatDateInt(minStartDate) <= Integer.parseInt(library.getProvidentPayMonth())) {
this.calculateFundType(zero, library);
this.calculateFundType(zero, library,libraryFundInfoListFund);
}
}
}
}
}
}
//推送社保明细
if (Common.isNotNull(libraryFundInfoListSocial)) {
pushForecastInfo(libraryFundInfoListSocial);
}
//推送公积金明细
if (Common.isNotNull(libraryFundInfoListFund)) {
pushForecastFundInfo(libraryFundInfoListFund);
}
}
return R.ok();
}
private void calculateSocialType(BigDecimal zero, TForecastLibrary library) {
private void calculateSocialType(BigDecimal zero, TForecastLibrary library,List<TForecastLibrary> libraryFundInfoListSocial) {
if (library.getDataPush() == CommonConstants.ONE_INT || CommonConstants.ONE_STRING.equals(library.getSalarySocialFlag())) {
// 加负数
TForecastLibrary negateLib = new TForecastLibrary();
......@@ -1580,6 +1607,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
negateLib.setSumAll(BigDecimalUtils.safeSubtract(false, zero, library.getSumAll()));
negateLib.setDiffType(SocialConstants.DIFF_TYPE_TWO);
baseMapper.insert(negateLib);
libraryFundInfoListSocial.add(negateLib);
} else {
// 删除
baseMapper.deleteById(library.getId());
......@@ -1603,7 +1631,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
}
}
private void calculateFundType(BigDecimal zero, TForecastLibrary library) {
private void calculateFundType(BigDecimal zero, TForecastLibrary library, List<TForecastLibrary> libraryFundInfoListFund) {
if (library.getDataPush() == CommonConstants.ONE_INT || CommonConstants.ONE_STRING.equals(library.getSalaryFundFlag())) {
// 加负数
TForecastLibrary negateLib = new TForecastLibrary();
......@@ -1617,7 +1645,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
negateLib.setPersonalFundSum(BigDecimalUtils.safeSubtract(false, zero, library.getPersonalFundSum()));
negateLib.setSumAll(BigDecimalUtils.safeSubtract(false, zero, library.getSumAll()));
negateLib.setDiffType(SocialConstants.DIFF_TYPE_TWO);
baseMapper.insert(negateLib);
libraryFundInfoListFund.add(negateLib);
} else {
// 删除
baseMapper.deleteById(library.getId());
......@@ -2192,13 +2220,15 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
isSaveAndUpdate = true;
}
List<TForecastLibrary> libraryFundInfoListSocial = new ArrayList<>();
List<TForecastLibrary> libraryFundInfoListFund = new ArrayList<>();
//社保收入
if (Common.isNotNull(socialFundInfo.getSocialId())
&& CommonConstants.FOUR_STRING.equals(socialFundInfo.getSocialStatus())
|| CommonConstants.THREE_STRING.equals(socialFundInfo.getSocialStatus())) {
//获取所有的预估数据
List<TForecastLibrary> librarySocialInfoList = null;
List<TForecastLibrary> librarySocialInfoList;
librarySocialInfoList = baseMapper.selectList(Wrappers.<TForecastLibrary>query().lambda()
.eq(TForecastLibrary::getEmpIdcard, empIdCard)
.eq(TForecastLibrary::getSettleDomainId, socialFundInfo.getSettleDomain())
......@@ -2208,6 +2238,9 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
for (TForecastLibrary library : librarySocialInfoList) {
//办理成功生成收入
createIncomeInfo(library);
if (CommonConstants.ZERO_INT == library.getDataPush()) {
libraryFundInfoListSocial.add(library);
}
}
}
}
......@@ -2217,7 +2250,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
&& CommonConstants.THREE_STRING.equals(socialFundInfo.getFundStatus())) {
//获取所有的预估数据
List<TForecastLibrary> libraryFundInfoList = null;
List<TForecastLibrary> libraryFundInfoList;
libraryFundInfoList = baseMapper.selectList(Wrappers.<TForecastLibrary>query().lambda()
.eq(TForecastLibrary::getEmpIdcard, empIdCard)
.eq(TForecastLibrary::getSettleDomainId, socialFundInfo.getSettleDomain())
......@@ -2227,9 +2260,20 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
for (TForecastLibrary library : libraryFundInfoList) {
//办理成功生成收入
createIncomeInfo(library);
if (CommonConstants.ZERO_INT == library.getDataPush()) {
libraryFundInfoListFund.add(library);
}
}
}
}
//推送社保明细
if (Common.isNotNull(libraryFundInfoListSocial)) {
pushForecastInfo(libraryFundInfoListSocial);
}
//推送公积金明细
if (Common.isNotNull(libraryFundInfoListFund)) {
pushForecastFundInfo(libraryFundInfoListFund);
}
if (isSaveAndUpdate) {
return R.ok(null, "执行成功!");
} 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