Commit efa12c41 authored by huyuchen's avatar huyuchen

Merge remote-tracking branch 'origin/develop' into develop

parents 2f0f63f5 ad8986bd
......@@ -26,7 +26,6 @@ import com.yifu.cloud.plus.v1.yifu.social.entity.TForecastLibrary;
import com.yifu.cloud.plus.v1.yifu.social.entity.TSocialFundInfo;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 预估费用
......@@ -46,8 +45,8 @@ public interface TForecastLibraryService extends IService<TForecastLibrary> {
void listExport(HttpServletResponse response, TForecastLibrary searchVo);
/**
* @param payMonths 缴纳月
* @param empIdCard 身份证
* @param payMonths 缴纳月
* @param empIdCard 身份证
* @param settleDomainIds 项目id
* @Description: 按缴纳月重新生成
* @Author: hgw
......@@ -74,6 +73,15 @@ public interface TForecastLibraryService extends IService<TForecastLibrary> {
**/
R<String> updateForecastLibaryByDispatch(TSocialFundInfo socialFundInfo);
/**
* @param socialFundInfo
* @Description: 派单减少变更预估库-派减
* @Author: hgw
* @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);
/**
* @Description: 基数变更,同步社保公积金查询、预估库 TODO-加定时器
* @Author: hgw
......
......@@ -16,6 +16,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.ExcelWriter;
import com.alibaba.excel.write.metadata.WriteSheet;
......@@ -1446,6 +1447,88 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
return this.updateForecastLibaryCore(socialFundInfo, null);
}
/**
* @Description: 派单减少变更预估库-派减
* @Author: hgw
* @Date: 2022/7/28 17:11
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
@Override
public R<String> updateForecastLibaryByDispatchReduce(TSocialFundInfo socialFundInfo) {
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)) {
BigDecimal zero = BigDecimal.ZERO;
if (socialReduceDate != null) {
socialLibraryList = baseMapper.selectList(Wrappers.<TForecastLibrary>query().lambda()
.eq(TForecastLibrary::getEmpIdcard, empIdCard)
.eq(TForecastLibrary::getDataType, CommonConstants.ZERO_INT));
if (Common.isNotNull(socialLibraryList)) {
for (TForecastLibrary library : socialLibraryList) {
// 存在社保派减且处于派减期间内,未被预估结算,工资结算引用则清空相关数据
if (Common.isNotNull(library.getSocialPayMonth()) && DateUtil.formatDateInt(socialReduceDate) < Integer.parseInt(library.getSocialPayMonth())) {
this.calculateType(zero, library);
}
}
}
}
if (socialReduceDate != null) {
fundLibraryList = baseMapper.selectList(Wrappers.<TForecastLibrary>query().lambda()
.eq(TForecastLibrary::getEmpIdcard, empIdCard)
.eq(TForecastLibrary::getDataType, CommonConstants.ONE_INT));
if (Common.isNotNull(fundLibraryList)) {
for (TForecastLibrary library : fundLibraryList) {
// 存在社保派减且处于派减期间内,未被预估结算,工资结算引用则清空相关数据
if (Common.isNotNull(library.getProvidentPayMonth()) && DateUtil.formatDateInt(fundReduceDate) < Integer.parseInt(library.getProvidentPayMonth())) {
this.calculateType(zero, library);
}
}
}
}
}
return R.ok();
}
private void calculateType(BigDecimal zero, TForecastLibrary library) {
if (library.getDataPush() == CommonConstants.ONE_INT) {
// 加负数
TForecastLibrary negateLib = new TForecastLibrary();
BeanUtil.copyProperties(library, negateLib);
negateLib.setUnitPensionFee(BigDecimalUtils.safeSubtract(zero, library.getUnitPensionFee()));
negateLib.setUnitMedicalFee(BigDecimalUtils.safeSubtract(zero, library.getUnitMedicalFee()));
negateLib.setUnitBirthFee(BigDecimalUtils.safeSubtract(zero, library.getUnitBirthFee()));
negateLib.setUnitWorkInjuryFee(BigDecimalUtils.safeSubtract(zero, library.getUnitWorkInjuryFee()));
negateLib.setUnitUnemploymentFee(BigDecimalUtils.safeSubtract(zero, library.getUnitUnemploymentFee()));
negateLib.setUnitBitailmentFee(BigDecimalUtils.safeSubtract(zero, library.getUnitBitailmentFee()));
negateLib.setUnitInterestFee(BigDecimalUtils.safeSubtract(zero, library.getUnitInterestFee()));
negateLib.setUnitSocialSum(BigDecimalUtils.safeSubtract(zero, library.getUnitSocialSum()));
// 个人社保
negateLib.setPersonalPensionFee(BigDecimalUtils.safeSubtract(zero, library.getPersonalPensionFee()));
negateLib.setPersonalMedicalFee(BigDecimalUtils.safeSubtract(zero, library.getPersonalMedicalFee()));
negateLib.setPersonalUnemploymentFee(BigDecimalUtils.safeSubtract(zero, library.getPersonalUnemploymentFee()));
negateLib.setPersonalInterestFee(BigDecimalUtils.safeSubtract(zero, library.getPersonalUnemploymentFee()));
negateLib.setPersonalBigailmentFee(BigDecimalUtils.safeSubtract(zero, library.getPersonalBigailmentFee()));
negateLib.setPersonalSocialSum(BigDecimalUtils.safeSubtract(zero, library.getPersonalSocialSum()));
// 单位公积金
negateLib.setUnitFundSum(BigDecimalUtils.safeSubtract(zero, library.getUnitFundSum()));
// 个人公积金
negateLib.setPersonalFundSum(BigDecimalUtils.safeSubtract(zero, library.getPersonalFundSum()));
negateLib.setSumAll(BigDecimalUtils.safeSubtract(zero, library.getSumAll()));
negateLib.setDiffType(SocialConstants.DIFF_TYPE_TWO);
baseMapper.insert(negateLib);
} else {
// 删除
baseMapper.deleteById(library.getId());
}
}
/**
* @param socialFundInfo
* @Description: 根据社保公积金信息表更新预估库
......
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