Commit 11785e0f authored by hongguangwu's avatar hongguangwu

派单不同月份的社保公积金预估明细优化;

parent 4ec4186c
......@@ -17,7 +17,7 @@
package com.yifu.cloud.plus.v1.yifu.social.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.EasyExcelFactory;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.write.metadata.WriteSheet;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
......@@ -43,7 +43,10 @@ import com.yifu.cloud.plus.v1.yifu.salary.vo.TPaymentVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.UpdateSocialFoundVo;
import com.yifu.cloud.plus.v1.yifu.social.constants.SocialConstants;
import com.yifu.cloud.plus.v1.yifu.social.entity.*;
import com.yifu.cloud.plus.v1.yifu.social.mapper.*;
import com.yifu.cloud.plus.v1.yifu.social.mapper.SysBaseSetInfoMapper;
import com.yifu.cloud.plus.v1.yifu.social.mapper.TAgentConfigMapper;
import com.yifu.cloud.plus.v1.yifu.social.mapper.TForecastLibraryMapper;
import com.yifu.cloud.plus.v1.yifu.social.mapper.TSocialFundInfoMapper;
import com.yifu.cloud.plus.v1.yifu.social.service.TForecastLibraryService;
import com.yifu.cloud.plus.v1.yifu.social.service.TIncomeDetailService;
import com.yifu.cloud.plus.v1.yifu.social.service.TIncomeService;
......@@ -120,10 +123,10 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
response.setHeader(CommonConstants.CONTENT_DISPOSITION, CommonConstants.ATTACHMENT_FILENAME + URLEncoder.encode(fileName, "UTF-8"));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
//EasyExcel.write(out, TEmpBadRecord.class).sheet("预估费用").doWrite(list)
ExcelWriter excelWriter = EasyExcel.write(out, TForecastLibraryExportVo.class).includeColumnFiledNames(searchVo.getExportFields()).build();
ExcelWriter excelWriter = EasyExcelFactory.write(out, TForecastLibraryExportVo.class).includeColumnFiledNames(searchVo.getExportFields()).build();
int index = 0;
if (count > CommonConstants.ZERO_INT) {
for (int i = 0; i <= count; ) {
for (int i = 0; i <= count; i += CommonConstants.EXCEL_EXPORT_LIMIT) {
// 获取实际记录
searchVo.setLimitStart(i);
searchVo.setLimitEnd(CommonConstants.EXCEL_EXPORT_LIMIT);
......@@ -135,17 +138,16 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
}
}
if (Common.isNotNull(list)) {
WriteSheet writeSheet = EasyExcel.writerSheet("预估费用" + index).build();
WriteSheet writeSheet = EasyExcelFactory.writerSheet("预估费用" + index).build();
excelWriter.write(list, writeSheet);
index++;
}
i = i + CommonConstants.EXCEL_EXPORT_LIMIT;
if (Common.isNotNull(list)) {
list.clear();
}
}
} else {
WriteSheet writeSheet = EasyExcel.writerSheet("预估费用" + index).build();
WriteSheet writeSheet = EasyExcelFactory.writerSheet("预估费用" + index).build();
excelWriter.write(list, writeSheet);
}
if (Common.isNotNull(list)) {
......@@ -178,7 +180,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
return baseMapper.selectCount(wrapper);
}
private LambdaQueryWrapper buildQueryWrapper(TForecastLibrary entity) {
private LambdaQueryWrapper<TForecastLibrary> buildQueryWrapper(TForecastLibrary entity) {
LambdaQueryWrapper<TForecastLibrary> wrapper = Wrappers.lambdaQuery();
if (Common.isNotNull(entity.getCreateTimeStart())) {
wrapper.ge(TForecastLibrary::getCreateTime, entity.getCreateTimeStart());
......@@ -238,7 +240,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
.eq(TForecastLibrary::getEmpIdcard, empIdCard)
.eq(TForecastLibrary::getDataType, CommonConstants.ZERO_INT)
.in(TForecastLibrary::getSocialPayMonth, payMonthList)
.and(obj->obj.eq(TForecastLibrary::getDataPush, CommonConstants.ONE_INT)
.and(obj -> obj.eq(TForecastLibrary::getDataPush, CommonConstants.ONE_INT)
.or().eq(TForecastLibrary::getSalarySocialFlag, CommonConstants.ONE_STRING)));
libraryFundList = baseMapper.selectList(Wrappers.<TForecastLibrary>query().lambda()
.eq(TForecastLibrary::getEmpIdcard, empIdCard)
......@@ -250,7 +252,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
.eq(TForecastLibrary::getEmpIdcard, empIdCard)
.eq(TForecastLibrary::getDataType, CommonConstants.ONE_INT)
.in(TForecastLibrary::getProvidentPayMonth, payMonthList)
.and(obj->obj.eq(TForecastLibrary::getDataPush, CommonConstants.ONE_INT)
.and(obj -> obj.eq(TForecastLibrary::getDataPush, CommonConstants.ONE_INT)
.or().eq(TForecastLibrary::getSalaryFundFlag, CommonConstants.ONE_STRING)));
socialInfoList = socialFundInfoMapper.getSocialList(empIdCard, null);
fundList = socialFundInfoMapper.getFundList(empIdCard, null);
......@@ -265,7 +267,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
.in(TForecastLibrary::getSettleDomainId, settleDomainIdList)
.eq(TForecastLibrary::getDataType, CommonConstants.ZERO_INT)
.in(TForecastLibrary::getSocialPayMonth, payMonthList)
.and(obj->obj.eq(TForecastLibrary::getDataPush, CommonConstants.ONE_INT)
.and(obj -> obj.eq(TForecastLibrary::getDataPush, CommonConstants.ONE_INT)
.or().eq(TForecastLibrary::getSalarySocialFlag, CommonConstants.ONE_STRING)));
libraryFundList = baseMapper.selectList(Wrappers.<TForecastLibrary>query().lambda()
......@@ -278,7 +280,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
.in(TForecastLibrary::getSettleDomainId, settleDomainIdList)
.eq(TForecastLibrary::getDataType, CommonConstants.ONE_INT)
.in(TForecastLibrary::getProvidentPayMonth, payMonthList)
.and(obj->obj.eq(TForecastLibrary::getDataPush, CommonConstants.ONE_INT)
.and(obj -> obj.eq(TForecastLibrary::getDataPush, CommonConstants.ONE_INT)
.or().eq(TForecastLibrary::getSalaryFundFlag, CommonConstants.ONE_STRING)));
socialInfoList = socialFundInfoMapper.getSocialList(null, settleDomainIdList);
fundList = socialFundInfoMapper.getFundList(null, settleDomainIdList);
......@@ -387,7 +389,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
/**
* @param type 类型:0社保,1公积金
* @Description:
* @Description:
* @Author: hgw
* @Date: 2022/8/4 9:50
* @return: java.lang.String
......@@ -446,26 +448,26 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
private void getChangeReduceData(TForecastLibrary libraryNew, TForecastLibrary libraryOld) {
//单位社保
libraryNew.setUnitPensionFee(BigDecimalUtils.safeSubtract( false, libraryNew.getUnitPensionFee(), libraryOld.getUnitPensionFee()));
libraryNew.setUnitMedicalFee(BigDecimalUtils.safeSubtract( false, libraryNew.getUnitMedicalFee(), libraryOld.getUnitMedicalFee()));
libraryNew.setUnitBirthFee(BigDecimalUtils.safeSubtract( false, libraryNew.getUnitBirthFee(), libraryOld.getUnitBirthFee()));
libraryNew.setUnitWorkInjuryFee(BigDecimalUtils.safeSubtract( false, libraryNew.getUnitWorkInjuryFee(), libraryOld.getUnitWorkInjuryFee()));
libraryNew.setUnitUnemploymentFee(BigDecimalUtils.safeSubtract( false, libraryNew.getUnitUnemploymentFee(), libraryOld.getUnitUnemploymentFee()));
libraryNew.setUnitBitailmentFee(BigDecimalUtils.safeSubtract( false, libraryNew.getUnitBitailmentFee(), libraryOld.getUnitBitailmentFee()));
libraryNew.setUnitInterestFee(BigDecimalUtils.safeSubtract( false, libraryNew.getUnitInterestFee(), libraryOld.getUnitInterestFee()));
libraryNew.setUnitSocialSum(BigDecimalUtils.safeSubtract( false, libraryNew.getUnitSocialSum(), libraryOld.getUnitSocialSum()));
libraryNew.setUnitPensionFee(BigDecimalUtils.safeSubtract(false, libraryNew.getUnitPensionFee(), libraryOld.getUnitPensionFee()));
libraryNew.setUnitMedicalFee(BigDecimalUtils.safeSubtract(false, libraryNew.getUnitMedicalFee(), libraryOld.getUnitMedicalFee()));
libraryNew.setUnitBirthFee(BigDecimalUtils.safeSubtract(false, libraryNew.getUnitBirthFee(), libraryOld.getUnitBirthFee()));
libraryNew.setUnitWorkInjuryFee(BigDecimalUtils.safeSubtract(false, libraryNew.getUnitWorkInjuryFee(), libraryOld.getUnitWorkInjuryFee()));
libraryNew.setUnitUnemploymentFee(BigDecimalUtils.safeSubtract(false, libraryNew.getUnitUnemploymentFee(), libraryOld.getUnitUnemploymentFee()));
libraryNew.setUnitBitailmentFee(BigDecimalUtils.safeSubtract(false, libraryNew.getUnitBitailmentFee(), libraryOld.getUnitBitailmentFee()));
libraryNew.setUnitInterestFee(BigDecimalUtils.safeSubtract(false, libraryNew.getUnitInterestFee(), libraryOld.getUnitInterestFee()));
libraryNew.setUnitSocialSum(BigDecimalUtils.safeSubtract(false, libraryNew.getUnitSocialSum(), libraryOld.getUnitSocialSum()));
// 个人社保
libraryNew.setPersonalPensionFee(BigDecimalUtils.safeSubtract( false, libraryNew.getPersonalPensionFee(), libraryOld.getPersonalPensionFee()));
libraryNew.setPersonalMedicalFee(BigDecimalUtils.safeSubtract( false, libraryNew.getPersonalMedicalFee(), libraryOld.getPersonalMedicalFee()));
libraryNew.setPersonalUnemploymentFee(BigDecimalUtils.safeSubtract( false, libraryNew.getPersonalUnemploymentFee(), libraryOld.getPersonalUnemploymentFee()));
libraryNew.setPersonalInterestFee(BigDecimalUtils.safeSubtract( false, libraryNew.getPersonalInterestFee(), libraryOld.getPersonalInterestFee()));
libraryNew.setPersonalBigailmentFee(BigDecimalUtils.safeSubtract( false, libraryNew.getPersonalBigailmentFee(), libraryOld.getPersonalBigailmentFee()));
libraryNew.setPersonalSocialSum(BigDecimalUtils.safeSubtract( false, libraryNew.getPersonalSocialSum(), libraryOld.getPersonalSocialSum()));
libraryNew.setPersonalPensionFee(BigDecimalUtils.safeSubtract(false, libraryNew.getPersonalPensionFee(), libraryOld.getPersonalPensionFee()));
libraryNew.setPersonalMedicalFee(BigDecimalUtils.safeSubtract(false, libraryNew.getPersonalMedicalFee(), libraryOld.getPersonalMedicalFee()));
libraryNew.setPersonalUnemploymentFee(BigDecimalUtils.safeSubtract(false, libraryNew.getPersonalUnemploymentFee(), libraryOld.getPersonalUnemploymentFee()));
libraryNew.setPersonalInterestFee(BigDecimalUtils.safeSubtract(false, libraryNew.getPersonalInterestFee(), libraryOld.getPersonalInterestFee()));
libraryNew.setPersonalBigailmentFee(BigDecimalUtils.safeSubtract(false, libraryNew.getPersonalBigailmentFee(), libraryOld.getPersonalBigailmentFee()));
libraryNew.setPersonalSocialSum(BigDecimalUtils.safeSubtract(false, libraryNew.getPersonalSocialSum(), libraryOld.getPersonalSocialSum()));
// 单位公积金
libraryNew.setUnitFundSum(BigDecimalUtils.safeSubtract( false, libraryNew.getUnitFundSum(), libraryOld.getUnitFundSum()));
libraryNew.setUnitFundSum(BigDecimalUtils.safeSubtract(false, libraryNew.getUnitFundSum(), libraryOld.getUnitFundSum()));
// 个人公积金
libraryNew.setPersonalFundSum(BigDecimalUtils.safeSubtract( false, libraryNew.getPersonalFundSum(), libraryOld.getPersonalFundSum()));
libraryNew.setSumAll(BigDecimalUtils.safeSubtract( false, libraryNew.getSumAll(), libraryOld.getSumAll()));
libraryNew.setPersonalFundSum(BigDecimalUtils.safeSubtract(false, libraryNew.getPersonalFundSum(), libraryOld.getPersonalFundSum()));
libraryNew.setSumAll(BigDecimalUtils.safeSubtract(false, libraryNew.getSumAll(), libraryOld.getSumAll()));
}
......@@ -702,15 +704,15 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
}
/**
* @param library 预估库
* @param socialInfo 社保
* @param library 预估库
* @param socialInfo 社保
* @Description: 从社保获取大病
* @Author: hgw
* @Date: 2020/11/25 15:51
* @return: void
**/
private void initLibraryBigMoneyBySocial(TForecastLibrary library, TSocialFundInfo socialInfo
) {
) {
if (CommonConstants.ONE_STRING.equals(socialInfo.getPaymentType())) {
// 自定义类型大病随基数配置变化:0不随配置 1随配置 2.单位大病随配置 3个人大病随配置
// 2022-7-20 11:46:32 与房工沟通,派单没这个逻辑,所以都是随配置直接计算
......@@ -1049,9 +1051,9 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
}
/**
* @param library 预估库
* @param socialInfo 社保
* @param paymentType 0最低缴纳、1自定义、2最高缴纳
* @param library 预估库
* @param socialInfo 社保
* @param paymentType 0最低缴纳、1自定义、2最高缴纳
* @Description: 塞大病金额
* @Author: hgw
* @Date: 2020/11/25 15:51
......@@ -1531,22 +1533,22 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
negateLib.setId(null);
negateLib.setDataPush(CommonConstants.ZERO_INT);
negateLib.setSalarySocialFlag(CommonConstants.ZERO_STRING);
negateLib.setUnitPensionFee(BigDecimalUtils.safeSubtract( false, zero, library.getUnitPensionFee()));
negateLib.setUnitMedicalFee(BigDecimalUtils.safeSubtract( false, zero, library.getUnitMedicalFee()));
negateLib.setUnitBirthFee(BigDecimalUtils.safeSubtract( false, zero, library.getUnitBirthFee()));
negateLib.setUnitWorkInjuryFee(BigDecimalUtils.safeSubtract( false, zero, library.getUnitWorkInjuryFee()));
negateLib.setUnitUnemploymentFee(BigDecimalUtils.safeSubtract( false, zero, library.getUnitUnemploymentFee()));
negateLib.setUnitBitailmentFee(BigDecimalUtils.safeSubtract( false, zero, library.getUnitBitailmentFee()));
negateLib.setUnitInterestFee(BigDecimalUtils.safeSubtract( false, zero, library.getUnitInterestFee()));
negateLib.setUnitSocialSum(BigDecimalUtils.safeSubtract( false, zero, library.getUnitSocialSum()));
negateLib.setUnitPensionFee(BigDecimalUtils.safeSubtract(false, zero, library.getUnitPensionFee()));
negateLib.setUnitMedicalFee(BigDecimalUtils.safeSubtract(false, zero, library.getUnitMedicalFee()));
negateLib.setUnitBirthFee(BigDecimalUtils.safeSubtract(false, zero, library.getUnitBirthFee()));
negateLib.setUnitWorkInjuryFee(BigDecimalUtils.safeSubtract(false, zero, library.getUnitWorkInjuryFee()));
negateLib.setUnitUnemploymentFee(BigDecimalUtils.safeSubtract(false, zero, library.getUnitUnemploymentFee()));
negateLib.setUnitBitailmentFee(BigDecimalUtils.safeSubtract(false, zero, library.getUnitBitailmentFee()));
negateLib.setUnitInterestFee(BigDecimalUtils.safeSubtract(false, zero, library.getUnitInterestFee()));
negateLib.setUnitSocialSum(BigDecimalUtils.safeSubtract(false, zero, library.getUnitSocialSum()));
// 个人社保
negateLib.setPersonalPensionFee(BigDecimalUtils.safeSubtract( false, zero, library.getPersonalPensionFee()));
negateLib.setPersonalMedicalFee(BigDecimalUtils.safeSubtract( false, zero, library.getPersonalMedicalFee()));
negateLib.setPersonalUnemploymentFee(BigDecimalUtils.safeSubtract( false, zero, library.getPersonalUnemploymentFee()));
negateLib.setPersonalInterestFee(BigDecimalUtils.safeSubtract( false, zero, library.getPersonalInterestFee()));
negateLib.setPersonalBigailmentFee(BigDecimalUtils.safeSubtract( false, zero, library.getPersonalBigailmentFee()));
negateLib.setPersonalSocialSum(BigDecimalUtils.safeSubtract( false, zero, library.getPersonalSocialSum()));
negateLib.setSumAll(BigDecimalUtils.safeSubtract( false, zero, library.getSumAll()));
negateLib.setPersonalPensionFee(BigDecimalUtils.safeSubtract(false, zero, library.getPersonalPensionFee()));
negateLib.setPersonalMedicalFee(BigDecimalUtils.safeSubtract(false, zero, library.getPersonalMedicalFee()));
negateLib.setPersonalUnemploymentFee(BigDecimalUtils.safeSubtract(false, zero, library.getPersonalUnemploymentFee()));
negateLib.setPersonalInterestFee(BigDecimalUtils.safeSubtract(false, zero, library.getPersonalInterestFee()));
negateLib.setPersonalBigailmentFee(BigDecimalUtils.safeSubtract(false, zero, library.getPersonalBigailmentFee()));
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 {
......@@ -1554,11 +1556,11 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
baseMapper.deleteById(library.getId());
}
//删除停缴月以后的收入数据
List<TIncomeDetail> updateList = detailService.list(Wrappers.<TIncomeDetail>query().lambda()
.eq(TIncomeDetail::getEmpIdcard,library.getEmpIdcard())
.eq(TIncomeDetail::getDeptId,library.getSettleDomainId())
.eq(TIncomeDetail::getSourceType,CommonConstants.ONE_STRING)
.eq(TIncomeDetail::getPayMonth,library.getSocialPayMonth()));
List<TIncomeDetail> updateList = detailService.list(Wrappers.<TIncomeDetail>query().lambda()
.eq(TIncomeDetail::getEmpIdcard, library.getEmpIdcard())
.eq(TIncomeDetail::getDeptId, library.getSettleDomainId())
.eq(TIncomeDetail::getSourceType, CommonConstants.ONE_STRING)
.eq(TIncomeDetail::getPayMonth, library.getSocialPayMonth()));
if (Common.isNotNull(updateList)) {
for (TIncomeDetail upd : updateList) {
TIncomeDetail detail = new TIncomeDetail();
......@@ -1592,11 +1594,11 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
}
//删除停缴月以后的收入数据
List<TIncomeDetail> updateList = detailService.list(Wrappers.<TIncomeDetail>query().lambda()
.eq(TIncomeDetail::getEmpIdcard,library.getEmpIdcard())
.eq(TIncomeDetail::getDeptId,library.getSettleDomainId())
.eq(TIncomeDetail::getSourceType,CommonConstants.TWO_STRING)
.eq(TIncomeDetail::getPayMonth,library.getSocialPayMonth()));
List<TIncomeDetail> updateList = detailService.list(Wrappers.<TIncomeDetail>query().lambda()
.eq(TIncomeDetail::getEmpIdcard, library.getEmpIdcard())
.eq(TIncomeDetail::getDeptId, library.getSettleDomainId())
.eq(TIncomeDetail::getSourceType, CommonConstants.TWO_STRING)
.eq(TIncomeDetail::getPayMonth, library.getSocialPayMonth()));
if (Common.isNotNull(updateList)) {
for (TIncomeDetail upd : updateList) {
TIncomeDetail detail = new TIncomeDetail();
......@@ -1610,8 +1612,8 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
}
/**
* @param isDispatch 是否是派单,是:区分社保数据与公积金数据
* @param isOnly 是否仅更新传过来的社保公积金,true:是(同时,true时,是户调基,要判断断缴)
* @param isDispatch 是否是派单,是:区分社保数据与公积金数据
* @param isOnly 是否仅更新传过来的社保公积金,true:是(同时,true时,是户调基,要判断断缴)
* @param socialFundInfo
* @Description: 根据社保公积金信息表更新预估库
* @Author: hgw
......@@ -1665,10 +1667,11 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
initConfigByPayMonths(configList, payMonthList, agentConfigHashMap);
}
//查询出所有对应条件的预估数、社保数据、公积金数据据用于重新生成
List<String> detailMonthList;
if (Common.isNotNull(empIdCard)) {
if (isDispatch) {
if (socialFundInfo.getSocialStartDate() != null) {
payMonthList = new ArrayList<>();
detailMonthList = new ArrayList<>();
// 获取最小的起缴月
Date minStartDate = this.getMinSocialDate(socialFundInfo);
// 再计算月份
......@@ -1677,19 +1680,19 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
return R.failed("派单同步预估库,社保起缴月份无法生成,monthDiff=" + monthDiff);
}
for (int i = 0; i < monthDiff; i++) {
payMonthList.add(DateUtil.addMonth(1 - i));
detailMonthList.add(DateUtil.addMonth(1 - i));
}
librarySocialList = baseMapper.selectList(Wrappers.<TForecastLibrary>query().lambda()
.eq(TForecastLibrary::getEmpIdcard, empIdCard)
.eq(TForecastLibrary::getDataType, CommonConstants.ZERO_INT)
.in(TForecastLibrary::getSocialPayMonth, payMonthList)
.in(TForecastLibrary::getSocialPayMonth, detailMonthList)
.eq(TForecastLibrary::getDataPush, CommonConstants.ZERO_INT)
.eq(TForecastLibrary::getSalarySocialFlag, CommonConstants.ZERO_STRING));
librarySocialListTemp = baseMapper.selectList(Wrappers.<TForecastLibrary>query().lambda()
.eq(TForecastLibrary::getEmpIdcard, empIdCard)
.eq(TForecastLibrary::getDataType, CommonConstants.ZERO_INT)
.in(TForecastLibrary::getSocialPayMonth, payMonthList)
.and(obj->obj.eq(TForecastLibrary::getDataPush, CommonConstants.ONE_INT)
.in(TForecastLibrary::getSocialPayMonth, detailMonthList)
.and(obj -> obj.eq(TForecastLibrary::getDataPush, CommonConstants.ONE_INT)
.or().eq(TForecastLibrary::getSalarySocialFlag, CommonConstants.ONE_STRING)));
}
} else {
......@@ -1703,12 +1706,12 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
.eq(TForecastLibrary::getEmpIdcard, empIdCard)
.eq(TForecastLibrary::getDataType, CommonConstants.ZERO_INT)
.in(TForecastLibrary::getSocialPayMonth, payMonthList)
.and(obj->obj.eq(TForecastLibrary::getDataPush, CommonConstants.ONE_INT)
.and(obj -> obj.eq(TForecastLibrary::getDataPush, CommonConstants.ONE_INT)
.or().eq(TForecastLibrary::getSalarySocialFlag, CommonConstants.ONE_STRING)));
}
if (isDispatch) {
if (socialFundInfo.getProvidentStart() != null) {
payMonthList = new ArrayList<>();
detailMonthList = new ArrayList<>();
// 获取最小的起缴月
Date minStartDate = socialFundInfo.getProvidentStart();
// 再计算月份
......@@ -1717,19 +1720,19 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
return R.failed("派单同步预估库,公积金起缴月份无法生成,monthDiff=" + monthDiff);
}
for (int i = 0; i < monthDiff; i++) {
payMonthList.add(DateUtil.addMonth(1 - i));
detailMonthList.add(DateUtil.addMonth(1 - i));
}
libraryFundList = baseMapper.selectList(Wrappers.<TForecastLibrary>query().lambda()
.eq(TForecastLibrary::getEmpIdcard, empIdCard)
.eq(TForecastLibrary::getDataType, CommonConstants.ONE_INT)
.in(TForecastLibrary::getProvidentPayMonth, payMonthList)
.in(TForecastLibrary::getProvidentPayMonth, detailMonthList)
.eq(TForecastLibrary::getDataPush, CommonConstants.ZERO_INT)
.eq(TForecastLibrary::getSalaryFundFlag, CommonConstants.ZERO_STRING));
libraryFundListTemp = baseMapper.selectList(Wrappers.<TForecastLibrary>query().lambda()
.eq(TForecastLibrary::getEmpIdcard, empIdCard)
.eq(TForecastLibrary::getDataType, CommonConstants.ONE_INT)
.in(TForecastLibrary::getProvidentPayMonth, payMonthList)
.and(obj->obj.eq(TForecastLibrary::getDataPush, CommonConstants.ONE_INT)
.in(TForecastLibrary::getProvidentPayMonth, detailMonthList)
.and(obj -> obj.eq(TForecastLibrary::getDataPush, CommonConstants.ONE_INT)
.or().eq(TForecastLibrary::getSalaryFundFlag, CommonConstants.ONE_STRING)));
}
} else {
......@@ -1743,7 +1746,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
.eq(TForecastLibrary::getEmpIdcard, empIdCard)
.eq(TForecastLibrary::getDataType, CommonConstants.ONE_INT)
.in(TForecastLibrary::getProvidentPayMonth, payMonthList)
.and(obj->obj.eq(TForecastLibrary::getDataPush, CommonConstants.ONE_INT)
.and(obj -> obj.eq(TForecastLibrary::getDataPush, CommonConstants.ONE_INT)
.or().eq(TForecastLibrary::getSalaryFundFlag, CommonConstants.ONE_STRING)));
}
if (isOnly) {
......@@ -1806,7 +1809,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
isSaveAndUpdate = true;
} else {
if (BigDecimal.ZERO.compareTo(BigDecimalUtils.isNullToZero(library.getUnitSocialSum())) != CommonConstants.ZERO_INT
|| BigDecimal.ZERO.compareTo(BigDecimalUtils.isNullToZero(library.getUnitFundSum())) != CommonConstants.ZERO_INT) {
|| BigDecimal.ZERO.compareTo(BigDecimalUtils.isNullToZero(library.getUnitFundSum())) != CommonConstants.ZERO_INT) {
library.setCreateBy(userId);
library.setCreateName(userName);
library.setCreateTime(LocalDateTime.now());
......@@ -1821,14 +1824,13 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
|| CommonConstants.THREE_STRING.equals(socialFundInfo.getSocialStatus())) {
//获取所有的预估数据
List<TForecastLibrary> librarySocialInfoList = null;
librarySocialInfoList = baseMapper.selectList(Wrappers.<TForecastLibrary>query().lambda()
List<TForecastLibrary> librarySocialInfoList = baseMapper.selectList(Wrappers.<TForecastLibrary>query().lambda()
.eq(TForecastLibrary::getEmpIdcard, empIdCard)
.eq(TForecastLibrary::getDataType, CommonConstants.ZERO_INT)
.eq(TForecastLibrary::getSettleDomainId,socialFundInfo.getSettleDomain())
.eq(TForecastLibrary::getSettleDomainId, socialFundInfo.getSettleDomain())
.in(TForecastLibrary::getSocialPayMonth, payMonthList));
if (Common.isNotNull(librarySocialInfoList)) {
for (TForecastLibrary library :librarySocialInfoList) {
for (TForecastLibrary library : librarySocialInfoList) {
//办理成功生成收入
createIncomeInfo(library);
}
......@@ -1870,7 +1872,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
}
if (socialFundInfo.getProvidentStart() != null
&& (null == minStartDate || socialFundInfo.getProvidentStart().before(minStartDate))) {
minStartDate = socialFundInfo.getProvidentStart();
minStartDate = socialFundInfo.getProvidentStart();
}
if (null == minStartDate) {
minStartDate = new Date();
......@@ -2050,11 +2052,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
List<TSocialFundInfo> socialFundInfoList = socialFundInfoMapper.selectList(Wrappers.<TSocialFundInfo>query().lambda());
if (socialFundInfoList != null && !socialFundInfoList.isEmpty()) {
String payMonth = DateUtil.addMonth(1);
int all = socialFundInfoList.size();
int i=1;
for (TSocialFundInfo socialFundInfo : socialFundInfoList) {
System.out.println("预估生成,当前第:"+ i + "条,总数:" + all + "条。当前身份证:"+ socialFundInfo.getEmpIdcard());
i++;
everyMonthCreateForecastLibaryCore(payMonth, socialFundInfo);
}
}
......@@ -2094,7 +2092,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
.eq(TForecastLibrary::getEmpIdcard, empIdCard)
.eq(TForecastLibrary::getDataType, CommonConstants.ZERO_INT)
.eq(TForecastLibrary::getSocialPayMonth, payMonth)
.and(obj->obj.eq(TForecastLibrary::getDataPush, CommonConstants.ONE_INT)
.and(obj -> obj.eq(TForecastLibrary::getDataPush, CommonConstants.ONE_INT)
.or().eq(TForecastLibrary::getSalarySocialFlag, CommonConstants.ONE_STRING)));
libraryFundList = baseMapper.selectList(Wrappers.<TForecastLibrary>query().lambda()
.eq(TForecastLibrary::getEmpIdcard, empIdCard)
......@@ -2106,7 +2104,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
.eq(TForecastLibrary::getEmpIdcard, empIdCard)
.eq(TForecastLibrary::getDataType, CommonConstants.ONE_INT)
.eq(TForecastLibrary::getProvidentPayMonth, payMonth)
.and(obj->obj.eq(TForecastLibrary::getDataPush, CommonConstants.ONE_INT)
.and(obj -> obj.eq(TForecastLibrary::getDataPush, CommonConstants.ONE_INT)
.or().eq(TForecastLibrary::getSalaryFundFlag, CommonConstants.ONE_STRING)));
socialInfoList = socialFundInfoMapper.getSocialList(empIdCard, null);
fundList = socialFundInfoMapper.getFundList(empIdCard, null);
......@@ -2165,10 +2163,10 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
librarySocialInfoList = baseMapper.selectList(Wrappers.<TForecastLibrary>query().lambda()
.eq(TForecastLibrary::getEmpIdcard, empIdCard)
.eq(TForecastLibrary::getDataType, CommonConstants.ZERO_INT)
.eq(TForecastLibrary::getSettleDomainId,socialFundInfo.getSettleDomain())
.eq(TForecastLibrary::getSettleDomainId, socialFundInfo.getSettleDomain())
.in(TForecastLibrary::getSocialPayMonth, payMonthList));
if (Common.isNotNull(librarySocialInfoList)) {
for (TForecastLibrary library :librarySocialInfoList) {
for (TForecastLibrary library : librarySocialInfoList) {
//办理成功生成收入
createIncomeInfo(library);
}
......@@ -2262,7 +2260,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
public List<String> initEkpPushSocialParam(List<TForecastLibrary> unPushInfo) {
List<String> pushList = new ArrayList<>();
for (TForecastLibrary library:unPushInfo) {
for (TForecastLibrary library : unPushInfo) {
//获取项目信息
TSettleDomain settleDomain = new TSettleDomain();
List<TSettleDomainSelectVo> settleDomainR = null;
......@@ -2272,8 +2270,8 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
TSettleDomainListVo tSettleDomainListVo = listVo.getData();
if (Common.isNotNull(tSettleDomainListVo) && Common.isNotEmpty(tSettleDomainListVo.getListSelectVO())) {
settleDomainR = tSettleDomainListVo.getListSelectVO();
for (TSettleDomainSelectVo vo :settleDomainR) {
BeanUtils.copyProperties(vo,settleDomain);
for (TSettleDomainSelectVo vo : settleDomainR) {
BeanUtils.copyProperties(vo, settleDomain);
}
}
}
......@@ -2394,7 +2392,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
//客户编码
if (Common.isNotNull(settleDomain.getCustomerNo())) {
socialParam.setFd_3adfe8c73cb5a4(settleDomain.getCustomerNo());
}else {
} else {
socialParam.setFd_3adfe8c73cb5a4(CommonConstants.EMPTY_STRING);
}
//客户名称
......@@ -2493,7 +2491,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
public List<String> initEkpPushFundParam(List<TForecastLibrary> unPushInfo) {
List<String> pushList = new ArrayList<>();
for (TForecastLibrary library:unPushInfo) {
for (TForecastLibrary library : unPushInfo) {
//获取项目信息
TSettleDomain settleDomain = new TSettleDomain();
List<TSettleDomainSelectVo> settleDomainR = null;
......@@ -2503,8 +2501,8 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
TSettleDomainListVo tSettleDomainListVo = listVo.getData();
if (Common.isNotNull(tSettleDomainListVo) && Common.isNotEmpty(tSettleDomainListVo.getListSelectVO())) {
settleDomainR = tSettleDomainListVo.getListSelectVO();
for (TSettleDomainSelectVo vo :settleDomainR) {
BeanUtils.copyProperties(vo,settleDomain);
for (TSettleDomainSelectVo vo : settleDomainR) {
BeanUtils.copyProperties(vo, settleDomain);
}
}
}
......@@ -2628,18 +2626,18 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
TSettleDomainListVo tSettleDomainListVo = listVo.getData();
if (Common.isNotNull(tSettleDomainListVo) && Common.isNotEmpty(tSettleDomainListVo.getListSelectVO())) {
settleDomainR = tSettleDomainListVo.getListSelectVO();
for (TSettleDomainSelectVo vo :settleDomainR) {
BeanUtils.copyProperties(vo,settleDomain);
for (TSettleDomainSelectVo vo : settleDomainR) {
BeanUtils.copyProperties(vo, settleDomain);
}
}
}
//判断是否存在当月的社保或公积金收入数据
Boolean isExist = false;
boolean isExist = false;
String sourceType = "";
if (Common.isNotNull(library.getProvidentId())) {
sourceType = CommonConstants.TWO_STRING;
}else if (Common.isNotNull(library.getSocialId())) {
} else if (Common.isNotNull(library.getSocialId())) {
sourceType = CommonConstants.ONE_STRING;
}
......@@ -2656,9 +2654,9 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
if (Common.isNotNull(detailList)) {
BigDecimal sumMoney = BigDecimal.ZERO;
for (TIncomeDetail income : detailList) {
sumMoney = BigDecimalUtils.safeAdd(income.getMoney(),sumMoney);
sumMoney = BigDecimalUtils.safeAdd(income.getMoney(), sumMoney);
}
if (sumMoney.compareTo(BigDecimal.ZERO) == CommonConstants.ONE_INT) {
if (sumMoney.compareTo(BigDecimal.ZERO) > CommonConstants.ZERO_INT) {
isExist = true;
}
}
......@@ -2684,16 +2682,16 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
}
}
} else {
BigDecimal gMoney = BigDecimal.ZERO;
BigDecimal gMoney;
if (CommonConstants.TWO_STRING.equals(settleDomain.getManagementType())) {
gMoney = settleDomain.getManagementFee();
} else if (CommonConstants.THREE_STRING.equals(settleDomain.getManagementType())) {
gMoney = settleDomain.getManagementFee();
isSum = 2;
} else {
gMoney = BigDecimalUtils.safeMultiply(library.getSumAll(),settleDomain.getManagementFee());
gMoney = BigDecimalUtils.safeMultiply(library.getSumAll(), settleDomain.getManagementFee());
}
if (!isExist || isSum ==2) {
if (!isExist || isSum == 2) {
createIncomeInsurance(library, settleDomain, CommonConstants.ONE_STRING,
settleDomain.getManagementFee().toString(), settleDomain.getManagementType(),
gMoney, sourceType);
......@@ -2712,11 +2710,11 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
if (!isExist || isSum == 3) {
createIncomeInsurance(library, settleDomain, CommonConstants.TWO_STRING,
settleDomain.getRiskFundFee().toString(), settleDomain.getRiskFundType(),
settleDomain.getRiskFundFee(),sourceType);
settleDomain.getRiskFundFee(), sourceType);
}
} else {
if (CommonConstants.ZERO_STRING.equals(settleDomain.getRiskFundTag())) {
BigDecimal money = BigDecimal.ZERO;
BigDecimal money;
if (CommonConstants.TWO_STRING.equals(settleDomain.getRiskFundType())) {
money = settleDomain.getRiskFundFee();
} else if (CommonConstants.THREE_STRING.equals(settleDomain.getManagementType())) {
......@@ -2737,7 +2735,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
}
public void createIncomeInsurance(TForecastLibrary library, TSettleDomain settleDomain, String feeType,
String charges, String feeMode, BigDecimal money,String sourceType) {
String charges, String feeMode, BigDecimal money, String sourceType) {
//生成收入数据
TIncomeDetail detail = new TIncomeDetail();
detail.setCreateTime(DateUtil.getCurrentDateTime());
......@@ -2772,8 +2770,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
public String dateStringInsert(String month) {
StringBuilder sb = new StringBuilder(month);
sb.insert(4, "-");
String replaceMonth = sb.toString();
return replaceMonth;
return sb.toString();
}
}
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