Commit d528267d authored by hongguangwu's avatar hongguangwu

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

parents 15a2b241 3e7a814e
......@@ -1691,7 +1691,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
String policyNo = success.getPolicyNo();
boolean booleanInvoiceNo = StringUtils.isNotBlank(invoiceNo) && !invoiceNo.equals(detail.getInvoiceNo());
boolean booleanPolicyNo = StringUtils.isNotBlank(policyNo) && !policyNo.equals(detail.getPolicyNo());
boolean isEquals = Common.isNotNull(detail.getActualPremium()) && new BigDecimal(success.getActualPremium()).compareTo(detail.getActualPremium()) == 0;
boolean isEquals = Common.isNotNull(detail.getActualPremium()) && Common.isNotNull(success.getActualPremium()) && new BigDecimal(success.getActualPremium()).compareTo(detail.getActualPremium()) == 0;
//如果当前保费为空,且保单号或发票号不一样
if((StringUtils.isBlank(success.getActualPremium()) || isEquals) && (booleanInvoiceNo || booleanPolicyNo)){
if(StringUtils.isNotBlank(detail.getDefaultSettleId())){
......
......@@ -30,6 +30,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.net.URLDecoder;
import java.time.LocalDateTime;
import java.util.*;
......@@ -995,10 +996,10 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
|| SalaryConstants.ENTERPRISE_ANNUITY_JAVA.equals(item.getJavaFiedName())
|| SalaryConstants.WITHHOLIDING_PERSON_SOCIAL.equals(item.getJavaFiedName())
|| SalaryConstants.WITHHOLIDING_PERSON_FUND.equals(item.getJavaFiedName())) {
sum = sum.add(item.getSalaryMoney()).setScale(SalaryConstants.PLACES, BigDecimal.ROUND_HALF_UP);
sum = sum.add(item.getSalaryMoney()).setScale(SalaryConstants.PLACES, RoundingMode.HALF_UP);
}
}
sum = realSalary.subtract(sum).setScale(SalaryConstants.PLACES, BigDecimal.ROUND_HALF_UP);
sum = realSalary.subtract(sum).setScale(SalaryConstants.PLACES, RoundingMode.HALF_UP);
if (sum.compareTo(SalaryConstants.B_ZERO) < SalaryConstants.EQUAL) {
sum = SalaryConstants.B_ZERO;
}
......@@ -1104,7 +1105,7 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
**/
private BigDecimal getSocialFundMoney(TSalaryAccount a, List<TPaymentBySalaryVo> estmateList, boolean isSocial
, boolean isPerson, Set<String> socialList, Set<String> fundList, BigDecimal money, BigDecimal sub) {
money = money.setScale(SalaryConstants.PLACES, BigDecimal.ROUND_HALF_UP);
money = money.setScale(SalaryConstants.PLACES, RoundingMode.HALF_UP);
for (TPaymentBySalaryVo m : estmateList) {
if (Common.isNotNull(a.getEmpIdcard()) && a.getEmpIdcard().equals(m.getEmpIdcard())) {
//社保
......@@ -1276,7 +1277,7 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
if (res.compareTo(SalaryConstants.B_ZERO) < SalaryConstants.EQUAL) {
return SalaryConstants.B_ZERO;
}
res = res.setScale(SalaryConstants.PLACES, BigDecimal.ROUND_HALF_UP);
res = res.setScale(SalaryConstants.PLACES, RoundingMode.HALF_UP);
a.setSalaryTax(res);
return res;
}
......@@ -1340,12 +1341,12 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
BigDecimalUtils.safeMultiply(actualSalarySum, new BigDecimal("0.32")), new BigDecimal("7000"))
, new BigDecimal("0.68"));
}
nowTax = nowTax.setScale(SalaryConstants.PLACES, BigDecimal.ROUND_HALF_UP);
nowTax = nowTax.setScale(SalaryConstants.PLACES, RoundingMode.HALF_UP);
if (sumTax.compareTo(BigDecimal.ZERO) != 0) {
nowTax = BigDecimalUtils.safeSubtract(nowTax, sumTax).setScale(SalaryConstants.PLACES, BigDecimal.ROUND_HALF_UP);
nowTax = BigDecimalUtils.safeSubtract(nowTax, sumTax).setScale(SalaryConstants.PLACES, RoundingMode.HALF_UP);
}
BigDecimal relaySalary = BigDecimalUtils.safeAdd(actualSalarySumNow, nowTax).setScale(SalaryConstants.PLACES, BigDecimal.ROUND_HALF_UP);
BigDecimal relaySalary = BigDecimalUtils.safeAdd(actualSalarySumNow, nowTax).setScale(SalaryConstants.PLACES, RoundingMode.HALF_UP);
// 本次个人应发合计
TSalaryAccountItem sai = new TSalaryAccountItem();
sai.setCnName(SalaryConstants.RELAY_SALARY);
......@@ -1656,6 +1657,8 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
BigDecimal actualSalarySum = BigDecimal.ZERO;
// 历史个税合计
BigDecimal sumTax = BigDecimal.ZERO;
// 个人承担部分历史个税合计
BigDecimal sumOtherTax;
// 历史应发合计
BigDecimal sumSalaryTax = BigDecimal.ZERO;
// 本次实发
......@@ -1686,29 +1689,35 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
if (SalaryConstants.IS_PERSON_OTHER.equals(a.getIsPersonTax())) {
nowTaxT = getNowTax(actualSalarySumNow);
if (actualSalarySum.compareTo(actualSalarySumNow) != 0) {
actualSalarySumT = BigDecimalUtils.safeAdd(nowTaxT, sumSalaryTax, actualSalarySumNow).setScale(SalaryConstants.PLACES, BigDecimal.ROUND_HALF_UP);
//计算历史税费
sumOtherTax = getNowTaxNew(sumSalaryTax);
//计算本月实发合计
actualSalarySumT = BigDecimalUtils.safeAdd(nowTaxT, sumSalaryTax, actualSalarySumNow).setScale(SalaryConstants.PLACES, RoundingMode.HALF_UP);
//累计税费
nowTaxY = getNowTaxNew(actualSalarySumT);
if (sumTax.compareTo(BigDecimal.ZERO) != 0) {
nowTaxY = BigDecimalUtils.safeSubtract(nowTaxY, sumTax).setScale(SalaryConstants.PLACES, BigDecimal.ROUND_HALF_UP);
if (sumOtherTax.compareTo(BigDecimal.ZERO) != 0) {
nowTaxY = BigDecimalUtils.safeSubtract(nowTaxY, sumOtherTax).setScale(SalaryConstants.PLACES, RoundingMode.HALF_UP);
}
salaryTax = BigDecimalUtils.safeSubtract(nowTaxY, nowTaxT);
} else {
nowTaxY = nowTaxT;
}
relaySalary = BigDecimalUtils.safeAdd(actualSalarySumNow, nowTaxT).setScale(SalaryConstants.PLACES, BigDecimal.ROUND_HALF_UP);
//公司应发
relaySalary = BigDecimalUtils.safeAdd(actualSalarySumNow, nowTaxT).setScale(SalaryConstants.PLACES, RoundingMode.HALF_UP);
a.setSalaryTax(salaryTax);
a.setSalaryTaxUnit(nowTaxT);
a.setActualSalary(BigDecimalUtils.safeSubtract(actualSalarySumNow, salaryTax));
} else if (SalaryConstants.IS_COMPANY.equals(a.getIsPersonTax())) {
getNowTax(actualSalarySumNow);
nowTaxY = getNowTax(actualSalarySum);
a.setActualSalary(actualSalarySumNow);
if (sumTax.compareTo(BigDecimal.ZERO) != 0) {
nowTaxY = BigDecimalUtils.safeSubtract(nowTaxY, sumTax).setScale(SalaryConstants.PLACES, BigDecimal.ROUND_HALF_UP);
if (sumSalaryTax.compareTo(BigDecimal.ZERO) != 0) {
//历史应发税费
sumOtherTax = getNowTax(sumSalaryTax);
nowTaxY = BigDecimalUtils.safeSubtract(nowTaxY, sumOtherTax).setScale(SalaryConstants.PLACES, RoundingMode.HALF_UP);
}
a.setSalaryTaxUnit(nowTaxY);
relaySalary = BigDecimalUtils.safeAdd(actualSalarySumNow, nowTaxY).setScale(SalaryConstants.PLACES, BigDecimal.ROUND_HALF_UP);
relaySalary = BigDecimalUtils.safeAdd(actualSalarySumNow, nowTaxY).setScale(SalaryConstants.PLACES, RoundingMode.HALF_UP);
} else {
// TODO-@胡 :个人承担全部税费,实发要变为应发,推算出实发、个税
......@@ -1753,7 +1762,7 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
BigDecimalUtils.safeMultiply(actualSalarySum, new BigDecimal("0.32")), new BigDecimal("7000"))
, new BigDecimal("0.68"));
}
nowTax = nowTax.setScale(SalaryConstants.PLACES, BigDecimal.ROUND_HALF_UP);
nowTax = nowTax.setScale(SalaryConstants.PLACES, RoundingMode.HALF_UP);
return nowTax;
}
......@@ -1776,7 +1785,7 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
nowTax = BigDecimalUtils.safeSubtract(BigDecimalUtils.safeMultiply(actualSalarySum, new BigDecimal("0.32"))
, new BigDecimal("7000"));
}
nowTax = nowTax.setScale(SalaryConstants.PLACES, BigDecimal.ROUND_HALF_UP);
nowTax = nowTax.setScale(SalaryConstants.PLACES, RoundingMode.HALF_UP);
return nowTax;
}
......@@ -1930,7 +1939,7 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
//个人税费
BigDecimal nowTaxT = getNowTaxRemu(actualSalarySumNow);
BigDecimal relaySalary;
relaySalary = BigDecimalUtils.safeSubtract(actualSalarySumNow, nowTaxT).setScale(SalaryConstants.PLACES, BigDecimal.ROUND_HALF_UP);
relaySalary = BigDecimalUtils.safeSubtract(actualSalarySumNow, nowTaxT).setScale(SalaryConstants.PLACES, RoundingMode.HALF_UP);
a.setSalaryTax(nowTaxT);
a.setActualSalary(relaySalary);
a.setRelaySalaryUnit(actualSalarySumNow);
......@@ -1957,7 +1966,7 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
//x*0.16*0.7
nowTax = BigDecimalUtils.safeMultiply(actualSalarySum, new BigDecimal("0.112"));
}
nowTax = nowTax.setScale(SalaryConstants.PLACES, BigDecimal.ROUND_HALF_UP);
nowTax = nowTax.setScale(SalaryConstants.PLACES, RoundingMode.HALF_UP);
return nowTax;
}
......
......@@ -55,6 +55,7 @@ import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.net.URLEncoder;
import java.util.*;
import java.util.stream.Collectors;
......@@ -200,7 +201,6 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap
response.setHeader(CommonConstants.CONTENT_DISPOSITION, CommonConstants.ATTACHMENT_FILENAME + URLEncoder.encode(fileName , "UTF-8"));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
ExcelWriter excelWriter = EasyExcel.write(out, TStatisticsBonusImportVo.class).build();
int index = 0;
//个税配置
List<TSalaryTaxConfig> personTax = tSalaryTaxConfigService.getTaxConfigByPersonList(new TSalaryTaxConfig());
//年终奖配置
......@@ -245,13 +245,12 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap
isTax = BigDecimal.ZERO;
twlSalaryTax = BigDecimal.ZERO;
//12月是否发薪
Boolean isSend = false;
boolean isSend = false;
//年终奖单独扣税12月税费
finalSalaryNoSalary = BigDecimal.ZERO;
//年终奖合并扣税12月税费
finalSalaryWithSalary = BigDecimal.ZERO;
//12月份应纳税所得额扣除费用
BigDecimal deductTaxSalary = infoVo.getDeductTaxSalary();
//12月社保公积金扣费
socialFundTax = BigDecimal.ZERO;
//专项扣除列表
......@@ -523,30 +522,29 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap
//本次薪资纳税额
res = BigDecimal.ZERO;
//本次年终奖纳税额
anRes = BigDecimal.ZERO;;
anRes = BigDecimal.ZERO;
//年终奖金额
BigDecimal annous = BigDecimalUtils.safeSubtract(wSalary,i);
//计算个税
if (i.compareTo(BigDecimal.ZERO) == SalaryConstants.MORE_THAN ) {
if (i.compareTo(BigDecimal.ZERO) > 0 ) {
BigDecimal sumI = BigDecimalUtils.safeSubtract(BigDecimalUtils.safeAdd(i,ySalary),
BigDecimalUtils.safeAdd(sumDeductSalary));
for (TSalaryTaxConfig sub : personTax) {
if (sumI.compareTo(sub.getMinIncome()) == SalaryConstants.MORE_THAN
if (sumI.compareTo(sub.getMinIncome()) > 0
&& sumI.compareTo(sub.getMaxIncome()) != SalaryConstants.MORE_THAN) {
//sumI = realDeduSalary * ((double) ((i.getTaxRate() * 1.0) / 100)) - sumTax - sub.getQuick();
//累计个税
res = BigDecimalUtils.safeSubtract(sumI.multiply(new BigDecimal(sub.getWithholdingRate()).divide(
SalaryConstants.B_ONEHUNDRED, SalaryConstants.PLACES, BigDecimal.ROUND_HALF_UP)), sub.getQuickDeducation());
SalaryConstants.B_ONEHUNDRED, SalaryConstants.PLACES, RoundingMode.HALF_UP)), sub.getQuickDeducation());
//本次个税
BigDecimal bcTax = res.subtract(BigDecimalUtils.safeAdd(sumTax,twlSalaryTax));
if (bcTax.compareTo(BigDecimal.ZERO) == SalaryConstants.MORE_THAN ||
if (bcTax.compareTo(BigDecimal.ZERO) > 0 ||
bcTax.compareTo(BigDecimal.ZERO) == SalaryConstants.EQUAL) {
res = BigDecimalUtils.safeAdd(bcTax,twlSalaryTax);
} else {
res = BigDecimalUtils.safeAdd(twlSalaryTax,sumTax);
}
res = BigDecimalUtils.safeSubtract(sumI.multiply(new BigDecimal(sub.getWithholdingRate()).divide(
SalaryConstants.B_ONEHUNDRED, SalaryConstants.PLACES, BigDecimal.ROUND_HALF_UP)),
SalaryConstants.B_ONEHUNDRED, SalaryConstants.PLACES, RoundingMode.HALF_UP)),
BigDecimalUtils.safeAdd(sumTax,sub.getQuickDeducation()));
break;
}
......@@ -556,15 +554,15 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap
}
//计算年终奖税
//年终奖
if (annous != null && annous.compareTo(SalaryConstants.B_ZERO) == SalaryConstants.MORE_THAN
if (annous != null && annous.compareTo(SalaryConstants.B_ZERO) > 0
&& annousTax != null && annousTax.size() > CommonConstants.ZERO_INT) {
BigDecimal month = annous.divide(SalaryConstants.B_TWELVE, SalaryConstants.TAX_FEE_PLACES, BigDecimal.ROUND_HALF_UP);
BigDecimal month = annous.divide(SalaryConstants.B_TWELVE, SalaryConstants.TAX_FEE_PLACES, RoundingMode.HALF_UP);
// 应纳税额
for (TSalaryTaxConfig sub : annousTax) {
if (month.compareTo(sub.getMinIncome()) == SalaryConstants.MORE_THAN
if (month.compareTo(sub.getMinIncome()) > 0
&& month.compareTo(sub.getMaxIncome()) != SalaryConstants.MORE_THAN) {
anRes = annous.multiply(new BigDecimal(sub.getWithholdingRate()).divide(
SalaryConstants.B_ONEHUNDRED, SalaryConstants.TAX_FEE_PLACES, BigDecimal.ROUND_HALF_UP))
SalaryConstants.B_ONEHUNDRED, SalaryConstants.TAX_FEE_PLACES, RoundingMode.HALF_UP))
.subtract(sub.getQuickDeducation());
break;
}
......
......@@ -74,7 +74,7 @@ public class TPreDispatchInfo extends BaseEntity {
*/
@Schema(description ="接单分公司")
@Size(max = 50, message = "接单分公司不可超过50位")
@ExcelAttribute(name = "接单分公司", maxLength = 50)
@ExcelAttribute(name = "接单分公司", isNotEmpty = true ,errorInfo = "接单分公司不能为空", maxLength = 50)
private String company;
/**
......
......@@ -50,10 +50,7 @@ import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URLEncoder;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
* 预派单记录
......@@ -652,8 +649,8 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap
}
TSettleDomainSelectVo selectVo = domainR.getData();
// 获取基数配置信息
HashMap<String, SysBaseSetInfo> baseSocialSetMap = new HashMap<>();
HashMap<String, SysBaseSetInfo> baseFundSetMap = new HashMap<>();
HashMap<String, List<SysBaseSetInfo>> baseSocialSetMap = new HashMap<>();
HashMap<String, List<SysBaseSetInfo>> baseFundSetMap = new HashMap<>();
HashMap<String, TPreDispatchInfo> baseSocialTimeMap = new HashMap<>();
HashMap<String, TPreDispatchInfo> baseFundTimeMap = new HashMap<>();
initSocialAndFundBaseSet(listInfo, baseSocialSetMap, baseFundSetMap, baseSocialTimeMap, baseFundTimeMap);
......@@ -663,6 +660,11 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap
// 获取所有地市的最迟派单日限制
HashMap<String, Integer> dayConfMap = new HashMap<>();
initDayConfMap(dayConfMap);
// 存放所有社保户和公积金户信息,不用每次都去数据库处理 fxj 2022-11-09
HashMap<String, SysHouseHoldInfo> socialHoldMap = new HashMap<>();
HashMap<String, SysHouseHoldInfo> fundHoldMap = new HashMap<>();
SysHouseHoldInfo sh = null;
SysHouseHoldInfo fh = null;
int i = 1;
for (TPreDispatchInfo info : listInfo) {
i++;
......@@ -676,7 +678,7 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap
continue;
}
// 基础封装 其他
initBaseInfo(socialHouse, fundHouse, selectVo, info);
initBaseInfo(sh, fh, selectVo, info,socialHoldMap,fundHoldMap);
// 2.先校验已有数据
checkBatchSave(info, CommonConstants.ZERO_STRING);
// 3.封装 社保缴纳地 公积金缴纳地
......@@ -799,8 +801,8 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap
return errorList;
}
// 获取基数配置信息
HashMap<String, SysBaseSetInfo> baseSocialSetMap = new HashMap<>();
HashMap<String, SysBaseSetInfo> baseFundSetMap = new HashMap<>();
HashMap<String, List<SysBaseSetInfo>> baseSocialSetMap = new HashMap<>();
HashMap<String, List<SysBaseSetInfo>> baseFundSetMap = new HashMap<>();
HashMap<String, TPreDispatchInfo> baseSocialTimeMap = new HashMap<>();
HashMap<String, TPreDispatchInfo> baseFundTimeMap = new HashMap<>();
HashMap<String,TPreDispatchInfo> existsMap = new HashMap<>();
......@@ -1145,14 +1147,19 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap
/**
* 初始化基础数据 如 各种状态 合同数据等
* @param socialHouse
* @param selectVo
* @param info
* @param socialHoldMap
* @param fundHoldMap
* @return
* @Author huyc
* @Date 2022-07-18
**/
private void initBaseInfo(String socialHouse, String fundHouse, TSettleDomainSelectVo selectVo, TPreDispatchInfo info) {
private void initBaseInfo(SysHouseHoldInfo sysHouseHoldInfo, SysHouseHoldInfo sysHouseHoldFund,
TSettleDomainSelectVo selectVo,
TPreDispatchInfo info,
HashMap<String, SysHouseHoldInfo> socialHoldMap,
HashMap<String, SysHouseHoldInfo> fundHoldMap) {
info.setType(CommonConstants.ZERO_STRING);
info.setDataSubStatus(CommonConstants.ONE_STRING);
info.setStatus(CommonConstants.ZERO_STRING);
......@@ -1169,24 +1176,50 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap
// 默认合同名称为代理社保 合同类型为其他
info.setContractNameAdd(PreDispatchConstants.CONTRACT_NAME);
info.setContractTypeAdd(CommonConstants.ONE_STRING);
info.setContractStartAdd(DateUtil.getFirstDayString(info.getPensionStart()));
// 默认为开始时间后的两年时间
info.setContractEndAdd(DateUtil.getFirstDayString(DateUtil.getYearAndMonth(info.getPensionStart(),24)));
if (Common.isNotNull(info.getPensionStart())){
info.setContractStartAdd(DateUtil.getFirstDayString(info.getPensionStart()));
info.setContractEndAdd(DateUtil.getFirstDayString(DateUtil.getYearAndMonth(info.getPensionStart(),24)));
}
// 默认合同期限2年
info.setContractTermAdd(CommonConstants.TWO_STRING);
// 默认工时制 综合工时制2
info.setWorkingHoursAdd(CommonConstants.TWO_STRING);
SysHouseHoldInfo sysHouseHoldInfo = sysHouseHoldInfoMapper.selectOne(Wrappers.<SysHouseHoldInfo>query().lambda()
.eq(SysHouseHoldInfo::getName, socialHouse).eq(SysHouseHoldInfo::getType, CommonConstants.ZERO_STRING)
.eq(SysHouseHoldInfo::getDelFlag, CommonConstants.ZERO_STRING));
info.setSocialHouseAdd(sysHouseHoldInfo.getId());
SysHouseHoldInfo sysHouseHoldFund = sysHouseHoldInfoMapper.selectOne(Wrappers.<SysHouseHoldInfo>query().lambda()
.eq(SysHouseHoldInfo::getName, fundHouse).eq(SysHouseHoldInfo::getType, CommonConstants.ONE_STRING)
.eq(SysHouseHoldInfo::getDelFlag, CommonConstants.ZERO_STRING));
sysHouseHoldInfo = socialHoldMap.get(info.getCompany());
if (Common.isEmpty(sysHouseHoldInfo)){
sysHouseHoldInfo =sysHouseHoldInfoMapper.selectOne(Wrappers.<SysHouseHoldInfo>query().lambda()
.eq(SysHouseHoldInfo::getName, info.getCompany()).eq(SysHouseHoldInfo::getType, CommonConstants.ZERO_STRING)
.eq(SysHouseHoldInfo::getDelFlag, CommonConstants.ZERO_STRING));
if (Common.isNotNull(sysHouseHoldInfo)){
socialHoldMap.put(info.getCompany(),sysHouseHoldInfo);
}
}
if (Common.isNotNull(sysHouseHoldInfo)){
info.setSocialHouseAdd(sysHouseHoldInfo.getId());
}
if (Common.isEmpty(info.getSocialHouseAdd()) && Common.isNotNull(info.getPensionAddress())){
info.setPreStatus(CommonConstants.ONE_STRING);
info.setExceptionContent("未获取到可用社保户配置!");
return;
}
sysHouseHoldFund = fundHoldMap.get(info.getCompany());
if (Common.isEmpty(sysHouseHoldFund)){
sysHouseHoldFund =sysHouseHoldInfoMapper.selectOne(Wrappers.<SysHouseHoldInfo>query().lambda()
.eq(SysHouseHoldInfo::getName, info.getCompany()).eq(SysHouseHoldInfo::getType, CommonConstants.ONE_STRING)
.eq(SysHouseHoldInfo::getDelFlag, CommonConstants.ZERO_STRING));
if (Common.isNotNull(sysHouseHoldFund)){
fundHoldMap.put(info.getCompany(),sysHouseHoldFund);
}
}
if (Common.isNotNull(sysHouseHoldFund)) {
info.setFundHouseAdd(sysHouseHoldFund.getId());
}
if (Common.isEmpty(info.getFundHouseAdd()) && Common.isNotNull(info.getFundAddress())){
info.setPreStatus(CommonConstants.ONE_STRING);
info.setExceptionContent("未获取到可用公积金户配置!");
return;
}
}
/**
......@@ -1799,8 +1832,8 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap
* @Author huyc
* @Date 2022-07-18
**/
private void checkStartTime(Map<String, SysBaseSetInfo> baseSocialSetMap,
Map<String, SysBaseSetInfo> baseFundSetMap,
private void checkStartTime(Map<String, List<SysBaseSetInfo>> baseSocialSetMap,
Map<String, List<SysBaseSetInfo>> baseFundSetMap,
TPreDispatchInfo temp, TPreDispatchInfo info) {
if (CommonConstants.ZERO_STRING.equals(info.getType())) {
// 社保地址或缴纳时间变更 要重新校验
......@@ -1819,10 +1852,11 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap
* @Author huyc
* @Date 2022-07-18
*/
private void checkSocialStartTime(Map<String, SysBaseSetInfo> baseSocialSetMap, TPreDispatchInfo temp, TPreDispatchInfo info) {
private void checkSocialStartTime(Map<String, List<SysBaseSetInfo>> baseSocialSetMap, TPreDispatchInfo temp, TPreDispatchInfo info) {
boolean flag;
LocalDateTime dateTime;
SysBaseSetInfo socialBaseSetInfo;
Date dateTime;
List<SysBaseSetInfo> socialBases;
SysBaseSetInfo socialBaseSetInfo = null;
String str;
flag = Common.isNotNull(info.getPensionAddress()) &&
Common.isNotNull(info.getPensionStart()) &&
......@@ -1832,18 +1866,29 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap
!info.getPensionStart().equals(temp.getPensionStart()));
}
if (flag) {
dateTime = LocalDateTimeUtils.dateOfYearAndMonth(info.getPensionStart(), LocalDateTimeUtils.DATE_SHORT_PATTERN);
dateTime = DateUtil.stringToDate(info.getPensionStart()+"01", DateUtil.ISO_DATE_FORMAT);
if (null != dateTime) {
socialBaseSetInfo = baseSocialSetMap.get(LocalDateTimeUtils.formatTime(dateTime, ValidityConstants.DATEFORMAT3_PATTERN)
+ CommonConstants.DOWN_LINE_STRING + info.getSocialHouseAdd()
+ CommonConstants.DOWN_LINE_STRING + Common.isBlankToNullString(info.getSocialProvince())
+ CommonConstants.DOWN_LINE_STRING + Common.isBlankToNullString(info.getSocialCity())
+ CommonConstants.DOWN_LINE_STRING + Common.isBlankToNullString(info.getSocialTown()));
socialBases = baseSocialSetMap.get(info.getCompany());
if (Common.isNotNull(socialBases)){
for (SysBaseSetInfo base:socialBases){
if (Common.isNotNull(base.getApplyEndDate())
&& base.getApplyStartDate().before(dateTime)
&& base.getApplyEndDate().after(dateTime)){
socialBaseSetInfo = base;
}
if (Common.isEmpty(base.getApplyEndDate()) && base.getApplyStartDate().before(dateTime) ){
socialBaseSetInfo = base;
}
}
}
str = checkSocialStartDate(info, socialBaseSetInfo);
if (null != str) {
info.setPreStatus(CommonConstants.ONE_STRING);
info.setExceptionContent(str);
}
}else {
info.setPreStatus(CommonConstants.ONE_STRING);
info.setExceptionContent("获取社保起缴日期异常");
}
}
}
......@@ -1858,10 +1903,11 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap
* @Author huyc
* @Date 2022-07-18
**/
private void checkFundStartTime(Map<String, SysBaseSetInfo> baseFundSetMap, TPreDispatchInfo temp, TPreDispatchInfo info) {
private void checkFundStartTime(Map<String, List<SysBaseSetInfo>> baseFundSetMap, TPreDispatchInfo temp, TPreDispatchInfo info) {
boolean flag;
LocalDateTime dateTime;
SysBaseSetInfo fundBaseSetIfno;
Date dateTime;
List<SysBaseSetInfo> baseSetInfos;
SysBaseSetInfo fundBaseSetIfno = null;
String str;
flag = Common.isNotNull(info.getFundStart()) &&
Common.isNotNull(info.getFundAddress()) &&
......@@ -1871,18 +1917,29 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap
!info.getFundStart().equals(temp.getFundStart()));
}
if (flag) {
dateTime = LocalDateTimeUtils.dateOfYearAndMonth(info.getFundStart(), LocalDateTimeUtils.DATE_SHORT_PATTERN);
dateTime = DateUtil.stringToDate(info.getFundStart()+"01", DateUtil.ISO_DATE_FORMAT);
if (null != dateTime) {
fundBaseSetIfno = baseFundSetMap.get(LocalDateTimeUtils.formatTime(dateTime, ValidityConstants.DATEFORMAT3_PATTERN)
+ CommonConstants.DOWN_LINE_STRING + info.getFundHouseAdd()
+ CommonConstants.DOWN_LINE_STRING + Common.isBlankToNullString(info.getFundProvince())
+ CommonConstants.DOWN_LINE_STRING + Common.isBlankToNullString(info.getFundCity())
+ CommonConstants.DOWN_LINE_STRING + Common.isBlankToNullString(info.getFundTown()));
baseSetInfos = baseFundSetMap.get(info.getCompany());
if (Common.isNotNull(baseSetInfos)){
for (SysBaseSetInfo base:baseSetInfos){
if (Common.isNotNull(base.getApplyEndDate())
&& base.getApplyStartDate().before(dateTime)
&& base.getApplyEndDate().after(dateTime)){
fundBaseSetIfno = base;
}
if (Common.isEmpty(base.getApplyEndDate()) && base.getApplyStartDate().before(dateTime) ){
fundBaseSetIfno = base;
}
}
}
str = checkFundStartDate(info, fundBaseSetIfno);
if (null != str) {
info.setPreStatus(CommonConstants.ONE_STRING);
info.setExceptionContent(str);
}
}else {
info.setPreStatus(CommonConstants.ONE_STRING);
info.setExceptionContent("获取公积金起缴日期异常");
}
}
}
......@@ -1977,13 +2034,15 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap
* @Date 2022-07-18
**/
private void initSocialAndFundBaseSet(List<TPreDispatchInfo> listInfo,
Map<String, SysBaseSetInfo> baseSocialSetMap,
Map<String, SysBaseSetInfo> baseFundSetMap,
Map<String, List<SysBaseSetInfo>> baseSocialSetMap,
Map<String, List<SysBaseSetInfo>> baseFundSetMap,
Map<String, TPreDispatchInfo> baseSocialTimeMap,
Map<String, TPreDispatchInfo> baseFundTimeMap) {
List<String> idList = new ArrayList<>();
Map<String, String> houseMap = new HashMap<>();
if (Common.isNotNull(listInfo)) {
for (TPreDispatchInfo info : listInfo) {
houseMap.put(info.getCompany(),info.getCompany());
if (Common.isNotNull(info.getPensionStart())) {
baseSocialTimeMap.put(info.getPensionStart(), info);
}
......@@ -1993,8 +2052,36 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap
idList.add(info.getId());
}
}
// 获取所有户对应的社保户和公积金户对应的在用基数配置
if (Common.isNotNull(houseMap)){
List<SysBaseSetInfo> baseSetInfoList = sysBaseSetInfoMapper.selectList(Wrappers.<SysBaseSetInfo>query().lambda()
.eq(SysBaseSetInfo::getDeleteFlag,CommonConstants.ZERO_STRING)
.eq(SysBaseSetInfo::getStatus,CommonConstants.ZERO_INT)
.in(SysBaseSetInfo::getDepartName,houseMap.values()));
List<SysBaseSetInfo> baseList;
if (Common.isNotNull(baseSetInfoList)){
for (SysBaseSetInfo base:baseSetInfoList){
if (CommonConstants.ZERO_STRING.equals(base.getBaseType())){
baseList = baseSocialSetMap.get(base.getDepartName());
if (Common.isEmpty(baseList)){
baseList = new ArrayList<>();
}
baseList.add(base);
baseSocialSetMap.put(base.getDepartName(),baseList);
}
if (CommonConstants.ONE_STRING.equals(base.getBaseType())){
baseList = baseFundSetMap.get(base.getDepartName());
if (Common.isEmpty(baseList)){
baseList = new ArrayList<>();
}
baseList.add(base);
baseFundSetMap.put(base.getDepartName(),baseList);
}
}
}
}
// 初始化社保和公积金配置数据
initBaseSetMap(baseSocialTimeMap, baseFundTimeMap, baseSocialSetMap, baseFundSetMap);
//initBaseSetMap(baseSocialTimeMap, baseFundTimeMap, baseSocialSetMap, baseFundSetMap);
}
/**
......
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