Commit d77a75d1 authored by hongguangwu's avatar hongguangwu

判空

parent 8c6f0072
......@@ -86,7 +86,7 @@ public interface TForecastLibraryService extends IService<TForecastLibrary> {
* @Date: 2022/7/26 19:02
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
R<String> updateForecastLibaryByDispatchReduce(TSocialFundInfo socialFundInfo);
R<String> updateForecastLibaryByDispatchReduce(TSocialFundInfo socialFundInfo, int forecastFlag);
/**
* @Description: 基数变更,同步社保公积金查询、预估库
......
......@@ -2487,7 +2487,10 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
TAuditInfo auditInfo;
TSocialFundInfo sf = null;
Date now = new Date();
// 预估库同步社保还是公积金的标志,0:全部;1仅社保;2仅公积金
int forecastFlag;
for (TDispatchInfo dis : dispatchs) {
forecastFlag = getForecastFlag(dis);
auditInfo = new TAuditInfo();
remarkTemp = "";
if (Common.isNotNull(socialFundMap)){
......@@ -2662,7 +2665,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
if (CommonConstants.dingleDigitStrArray[0].equals(dis.getType())
&& CommonConstants.ONE_INT == flag.intValue()){
// 更新预估数据
forecastLibraryService.updateForecastLibaryByDispatchReduce(sf);
forecastLibraryService.updateForecastLibaryByDispatchReduce(sf, forecastFlag);
// 更新人员档案和项目档案的社保公积金状态
UpProjectSocialFundVo vo = new UpProjectSocialFundVo();
if (Common.isNotNull(dis.getSocialId())){
......@@ -2769,6 +2772,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
/**
* 社保派单批量办理
* @param typeSub 0社保办理;1公积金办理
* @param idsList
* @param user
* @param flag 0审核通过; 1审核不通过
......@@ -2801,7 +2805,14 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
TSocialFundInfo sf = null;
Date now = new Date();
StringBuilder temp = new StringBuilder();
// 预估库同步社保还是公积金的标志,0:全部;1仅社保;2仅公积金
int forecastFlag = CommonConstants.ZERO_INT;
for (TDispatchInfo dis : disList) {
if (CommonConstants.ZERO_STRING.equals(typeSub)) {
forecastFlag = CommonConstants.ONE_INT;
} else if (CommonConstants.ONE_STRING.equals(typeSub)) {
forecastFlag = CommonConstants.TWO_INT;
}
auditInfo = new TAuditInfo();
if (Common.isNotNull(socialFundMap)){
sf = socialFundMap.get(dis.getEmpIdcard());
......@@ -3066,14 +3077,14 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
// 办理失败
if (CommonConstants.ONE_INT == flag){
// 派增办理,全部失败 同步预估库数据
forecastLibraryService.updateForecastLibaryByDispatchReduce(sf);
forecastLibraryService.updateForecastLibaryByDispatchReduce(sf, forecastFlag);
}
// 2.派减办理成功 处理预估
if (CommonConstants.ONE_STRING.equals(dis.getType())
&& CommonConstants.ZERO_INT == flag){
// 同步预估库数据
forecastLibraryService.updateForecastLibaryByDispatchReduce(sf);
forecastLibraryService.updateForecastLibaryByDispatchReduce(sf, forecastFlag);
}
}
UpProjectSocialFundVo vo = new UpProjectSocialFundVo();
......@@ -3101,6 +3112,27 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
return errorList;
}
/**
* @param dis
* @Description: 获取办理/审核时,要变更的预估库的种类
* @Author: hgw
* @Date: 2022/8/9 11:24
* @return: int
**/
private int getForecastFlag(TDispatchInfo dis) {
int forecastFlag;
forecastFlag = CommonConstants.ZERO_INT;
if (Common.isNotNull(dis.getSocialId())) {
forecastFlag = CommonConstants.ONE_INT;
if (Common.isNotNull(dis.getFundId())) {
forecastFlag = CommonConstants.ZERO_INT;
}
} else if (Common.isNotNull(dis.getFundId())) {
forecastFlag = CommonConstants.TWO_INT;
}
return forecastFlag;
}
private void initSocialFundStatus(TSocialInfo socialInfo, TProvidentFund providentFund, UpProjectSocialFundVo vo, TSocialFundInfo sf) {
if (Common.isNotNull(socialInfo)){
// 办理失败或审核不通过
......
......@@ -1485,28 +1485,30 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
@Override
public R<String> updateForecastLibaryByDispatchReduce(TSocialFundInfo socialFundInfo) {
public R<String> updateForecastLibaryByDispatchReduce(TSocialFundInfo socialFundInfo, int forecastFlag) {
String empIdCard = socialFundInfo.getEmpIdcard();
if (Common.isNotNull(empIdCard)) {
Date minStartDate = this.getMinSocialDate(socialFundInfo);
BigDecimal zero = BigDecimal.ZERO;
// 查询已经生成的预估数据
List<TForecastLibrary> socialLibraryList = baseMapper.selectList(Wrappers.<TForecastLibrary>query().lambda()
.eq(TForecastLibrary::getEmpIdcard, empIdCard)
.eq(TForecastLibrary::getDataType, CommonConstants.ZERO_INT));
if (Common.isNotNull(socialLibraryList)) {
// 社保
Date socialReduceDate = socialFundInfo.getSocialReduceDate();
for (TForecastLibrary library : socialLibraryList) {
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 (forecastFlag == CommonConstants.ZERO_INT || forecastFlag == CommonConstants.ONE_INT) {
// 查询已经生成的预估数据
List<TForecastLibrary> socialLibraryList = baseMapper.selectList(Wrappers.<TForecastLibrary>query().lambda()
.eq(TForecastLibrary::getEmpIdcard, empIdCard)
.eq(TForecastLibrary::getDataType, CommonConstants.ZERO_INT));
if (Common.isNotNull(socialLibraryList)) {
// 社保
Date socialReduceDate = socialFundInfo.getSocialReduceDate();
for (TForecastLibrary library : socialLibraryList) {
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);
}
}
}
}
......@@ -1514,22 +1516,24 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
}
// 公积金
List<TForecastLibrary> fundLibraryList = baseMapper.selectList(Wrappers.<TForecastLibrary>query().lambda()
.eq(TForecastLibrary::getEmpIdcard, empIdCard)
.eq(TForecastLibrary::getDataType, CommonConstants.ONE_INT));
if (Common.isNotNull(fundLibraryList)) {
minStartDate = socialFundInfo.getProvidentStart();
Date fundReduceDate = socialFundInfo.getFundReduceDate();
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);
if (forecastFlag == CommonConstants.ZERO_INT || forecastFlag == CommonConstants.TWO_INT) {
List<TForecastLibrary> fundLibraryList = baseMapper.selectList(Wrappers.<TForecastLibrary>query().lambda()
.eq(TForecastLibrary::getEmpIdcard, empIdCard)
.eq(TForecastLibrary::getDataType, CommonConstants.ONE_INT));
if (Common.isNotNull(fundLibraryList)) {
minStartDate = socialFundInfo.getProvidentStart();
Date fundReduceDate = socialFundInfo.getFundReduceDate();
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);
}
}
}
}
......
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