钱智 特殊人员社保福利台账计算

This commit is contained in:
Harryxzy 2025-02-13 13:34:22 +08:00
parent ad22c2df94
commit 09b358f5b2
14 changed files with 322 additions and 84 deletions

View File

@ -28,9 +28,22 @@ public class UfTsrysjsbfldaPO {
private String toSxyf;
private BigDecimal dyjs;
// 单位比例
private BigDecimal dybl;
// 个人比例
private BigDecimal grbl;
// 社保福利项目
private String sbflxm;
// 个人固定值
private BigDecimal grgdz;
// 单位固定值
private BigDecimal dwgdz;
private List<Integer> ygs;
}

View File

@ -0,0 +1,36 @@
package com.engine.salary.entity.siarchives.dto;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
/**
* @author Harryxzy
* @ClassName QzSocialInfoDTO
* @date 2025/02/12 10:55
* @description 钱智 - 特殊人员社保信息
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class QzSocialInfoDTO {
// 社保福利项目id
private Long insuranceId;
private String insuranceName;
// 基数
private BigDecimal paymentBase;
// 个人比例
private BigDecimal paymentProportion;
// 公司比例
private BigDecimal comPaymentProportion;
}

View File

@ -21,6 +21,9 @@ import java.util.List;
@NoArgsConstructor
@AllArgsConstructor
public class InsuranceArchivesListParam extends BaseQueryParam {
private Long employeeId;
//姓名
private String userName;

View File

@ -8,6 +8,9 @@
<result column="dyjs" property="dyjs" />
<result column="dybl" property="dybl" />
<result column="sbflxm" property="sbflxm" />
<result column="grbl" property="grbl" />
<result column="grgdz" property="grgdz" />
<result column="dwgdz" property="dwgdz" />
</resultMap>
<!-- 表字段 -->
@ -18,6 +21,9 @@
, dt1.dyjs
, dt1.dybl
, dt1.sbflxm
, dt1.grbl
, dt1.grgdz
, dt1.dwgdz
</sql>
<!-- 条件查询 -->

View File

@ -27,6 +27,8 @@ public interface InsuranceBaseInfoMapper {
*/
List<InsuranceArchivesBaseInfoPO> listByIds(@Param("ids")Collection<Long> ids);
List<InsuranceArchivesBaseInfoPO> listByEmployeeId(@Param("employeeId")Long employeeId);
/**
* 查询对应id的记录
*/

View File

@ -332,6 +332,13 @@
</foreach>
</if>
</select>
<select id="listByEmployeeId"
resultType="com.engine.salary.entity.siarchives.po.InsuranceArchivesBaseInfoPO">
SELECT
<include refid="baseColumns"/>
FROM hrsa_insurance_base_info t
WHERE delete_type=0 and employee_id = #{employeeId}
</select>
<update id="updateRunStatusByIds" parameterType="com.engine.salary.entity.siarchives.po.InsuranceArchivesBaseInfoPO">
UPDATE hrsa_insurance_base_info

View File

@ -164,4 +164,6 @@ public interface SIArchivesService {
List<InsuranceArchivesOtherSchemePO> listInsuranceArchivesOtherSchemeByIds(List<Long> ids);
List<InsuranceArchivesBaseInfoPO> listAll();
Map<String, Object> getSIInfo4Qz(Long employeeId);
}

View File

@ -12,6 +12,7 @@ import com.engine.salary.entity.sischeme.po.InsuranceSchemePO;
import com.engine.salary.util.page.PageInfo;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import java.util.Collection;
import java.util.List;
import java.util.Map;
@ -56,6 +57,8 @@ public interface SISchemeService {
XSSFWorkbook export(InsuranceArchivesListParam param);
Collection<InsuranceSchemeDetailPO> queryInsuranceSchemeDetailList(Long id);
/**
* 获取方案名称
*

View File

@ -104,20 +104,10 @@ public class ColumnBuildServiceImpl extends Service implements ColumnBuildServic
list.add(new WeaTableColumn("150px",k, v));
});
list.add(new WeaTableColumn("150px","<span style=\"color:blue\">" + SalaryI18nUtil.getI18nLabel( 100388, "社保个人合计") + "</span>", "socialPerSum"));
// 钱智 二开
specialColumns.get(WelfareTypeEnum.SOCIAL_SECURITY.getValue()).forEach((k, v) -> {
list.add(new WeaTableColumn("150px",k, v));
});
list.add(new WeaTableColumn("150px","<span style=\"color:blue\">" + SalaryI18nUtil.getI18nLabel( 0, "单位超额-社保合计") + "</span>", "socialSpecialSum"));
personColumns.get(WelfareTypeEnum.ACCUMULATION_FUND.getValue()).forEach((k, v) -> {
list.add(new WeaTableColumn("150px",k, v));
});
list.add(new WeaTableColumn("150px","<span style=\"color:blue\">" + SalaryI18nUtil.getI18nLabel( 100390, "公积金个人合计") + "</span>", "fundPerSum"));
// 钱智 二开
specialColumns.get(WelfareTypeEnum.ACCUMULATION_FUND.getValue()).forEach((k, v) -> {
list.add(new WeaTableColumn("150px",k, v));
});
list.add(new WeaTableColumn("150px","<span style=\"color:blue\">" + SalaryI18nUtil.getI18nLabel( 0, "单位超额-公积金合计") + "</span>", "fundSpecialSum"));
personColumns.get(WelfareTypeEnum.OTHER.getValue()).forEach((k, v) -> {
list.add(new WeaTableColumn("150px",k, v));
});
@ -127,19 +117,29 @@ public class ColumnBuildServiceImpl extends Service implements ColumnBuildServic
list.add(new WeaTableColumn("150px",k, v));
});
list.add(new WeaTableColumn("150px","<span style=\"color:blue\">" + SalaryI18nUtil.getI18nLabel( 100394, "社保单位合计") + "</span>", "socialComSum"));
// 钱智 二开
specialColumns.get(WelfareTypeEnum.SOCIAL_SECURITY.getValue()).forEach((k, v) -> {
list.add(new WeaTableColumn("150px",k, v));
});
list.add(new WeaTableColumn("150px","<span style=\"color:blue\">" + SalaryI18nUtil.getI18nLabel( 0, "单位超额-社保合计") + "</span>", "socialSpecialSum"));
comColumns.get(WelfareTypeEnum.ACCUMULATION_FUND.getValue()).forEach((k, v) -> {
list.add(new WeaTableColumn("150px",k, v));
});
list.add(new WeaTableColumn("150px","<span style=\"color:blue\">" + SalaryI18nUtil.getI18nLabel( 100395, "公积金单位合计") + "</span>", "fundComSum"));
// 钱智 二开
specialColumns.get(WelfareTypeEnum.ACCUMULATION_FUND.getValue()).forEach((k, v) -> {
list.add(new WeaTableColumn("150px",k, v));
});
list.add(new WeaTableColumn("150px","<span style=\"color:blue\">" + SalaryI18nUtil.getI18nLabel( 0, "单位超额-公积金合计") + "</span>", "fundSpecialSum"));
comColumns.get(WelfareTypeEnum.OTHER.getValue()).forEach((k, v) -> {
list.add(new WeaTableColumn("150px",k, v));
});
list.add(new WeaTableColumn("150px","<span style=\"color:blue\">" + SalaryI18nUtil.getI18nLabel( 100396, "其他福利单位合计") + "</span>", "otherComSum"));
list.add(new WeaTableColumn("150px","<span style=\"color:blue\">" + SalaryI18nUtil.getI18nLabel( 0, "单位超额-合计") + "</span>", "specialSum"));
list.add(new WeaTableColumn("150px","<span style=\"color:blue\">" + SalaryI18nUtil.getI18nLabel( 100397, "单位合计") + "</span>", "comSum"));
list.add(new WeaTableColumn("150px","<span style=\"color:blue\">" + SalaryI18nUtil.getI18nLabel( 100398, "社保合计") + "</span>", "socialSum"));
list.add(new WeaTableColumn("150px","<span style=\"color:blue\">" + SalaryI18nUtil.getI18nLabel( 100399, "公积金合计") + "</span>", "fundSum"));
list.add(new WeaTableColumn("150px","<span style=\"color:blue\">" + SalaryI18nUtil.getI18nLabel( 100400, "其他福利合计") + "</span>", "otherSum"));
list.add(new WeaTableColumn("150px","<span style=\"color:blue\">" + SalaryI18nUtil.getI18nLabel( 0, "单位超额-合计") + "</span>", "specialSum"));
list.add(new WeaTableColumn("150px","<span style=\"color:blue\">" + SalaryI18nUtil.getI18nLabel( 93278, "合计") + "</span>", "total"));
return list;
}

View File

@ -377,17 +377,18 @@ public class RecordsBuildServiceImpl extends Service implements RecordsBuildServ
Map<String, Object> socialSpecialJson = JSON.parseObject(item.getSocialSpecialJson(), new HashMap<String, Object>().getClass());
if(socialSpecialJson!=null){
socialSpecialJson.forEach((k, v) -> {
String standardSocialPer = Util.null2String(record.get(k + "socialPer"));
BigDecimal standardSocialPerVal = new BigDecimal(0);
if (NumberUtils.isCreatable(standardSocialPer)) {
standardSocialPerVal = new BigDecimal(standardSocialPer);
}
// String standardSocialPer = Util.null2String(record.get(k + "socialPer"));
// BigDecimal standardSocialPerVal = new BigDecimal(0);
// if (NumberUtils.isCreatable(standardSocialPer)) {
// standardSocialPerVal = new BigDecimal(standardSocialPer);
// }
BigDecimal specialComVal = v == null ? new BigDecimal("0") : new BigDecimal(v.toString());
String standardSocialCom = Util.null2String(record.get(k + "socialCom"));
BigDecimal standardComPerVal = new BigDecimal(0);
if (NumberUtils.isCreatable(standardSocialCom)) {
standardComPerVal = new BigDecimal(standardSocialCom);
}
BigDecimal subtract = standardSocialPerVal.subtract(standardComPerVal);
BigDecimal subtract = specialComVal.subtract(standardComPerVal);
socialSpecialSum[0] = socialSpecialSum[0].add(subtract);
record.put(k + "socialSpecial", subtract.toString());
});
@ -400,17 +401,18 @@ public class RecordsBuildServiceImpl extends Service implements RecordsBuildServ
Map<String, Object> fundSpecialJson = JSON.parseObject(item.getFundSpecialJson(), new HashMap<String, Object>().getClass());
if(fundSpecialJson!=null){
fundSpecialJson.forEach((k, v) -> {
String standardFundPer = Util.null2String(record.get(k + "fundPer"));
BigDecimal standardFundPerVal = new BigDecimal(0);
if (NumberUtils.isCreatable(standardFundPer)) {
standardFundPerVal = new BigDecimal(standardFundPer);
}
// String standardFundPer = Util.null2String(record.get(k + "fundPer"));
// BigDecimal standardFundPerVal = new BigDecimal(0);
// if (NumberUtils.isCreatable(standardFundPer)) {
// standardFundPerVal = new BigDecimal(standardFundPer);
// }
BigDecimal specialComVal = v == null ? new BigDecimal("0") : new BigDecimal(v.toString());
String standardFundCom = Util.null2String(record.get(k + "fundCom"));
BigDecimal standardFundComVal = new BigDecimal(0);
if (NumberUtils.isCreatable(standardFundCom)) {
standardFundComVal = new BigDecimal(standardFundCom);
}
BigDecimal subtract = standardFundPerVal.subtract(standardFundComVal);
BigDecimal subtract = specialComVal.subtract(standardFundComVal);
fundSpecialSum[0] = fundSpecialSum[0].add(subtract);
record.put(k + "fundSpecial", subtract.toString());
});

View File

@ -1103,17 +1103,18 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
Map<String, Object> socialSpecialJson = JSON.parseObject(item.getSocialSpecialJson(), new HashMap<String, Object>().getClass());
if(socialSpecialJson!=null){
socialSpecialJson.forEach((k, v) -> {
String standardSocialPer = Util.null2String(record.get(k + "socialCommonPer"));
BigDecimal standardSocialPerVal = new BigDecimal(0);
if (org.apache.commons.lang3.math.NumberUtils.isCreatable(standardSocialPer)) {
standardSocialPerVal = new BigDecimal(standardSocialPer);
}
// String standardSocialPer = Util.null2String(record.get(k + "socialCommonPer"));
// BigDecimal standardSocialPerVal = new BigDecimal(0);
// if (org.apache.commons.lang3.math.NumberUtils.isCreatable(standardSocialPer)) {
// standardSocialPerVal = new BigDecimal(standardSocialPer);
// }
BigDecimal specialComVal = v == null ? new BigDecimal("0") : new BigDecimal(v.toString());
String standardSocialCom = Util.null2String(record.get(k + "socialCommonCom"));
BigDecimal standardComPerVal = new BigDecimal(0);
if (org.apache.commons.lang3.math.NumberUtils.isCreatable(standardSocialCom)) {
standardComPerVal = new BigDecimal(standardSocialCom);
}
BigDecimal subtract = standardSocialPerVal.subtract(standardComPerVal);
BigDecimal subtract = specialComVal.subtract(standardComPerVal);
socialSpecialSum[0] = socialSpecialSum[0].add(subtract);
record.put(k + "socialSpecial", subtract.toString());
});
@ -1172,17 +1173,18 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
Map<String, Object> fundSpecialJson = JSON.parseObject(item.getFundSpecialJson(), new HashMap<String, Object>().getClass());
if(fundSpecialJson!=null){
fundSpecialJson.forEach((k, v) -> {
String standardFundPer = Util.null2String(record.get(k + "fundCommonPer"));
BigDecimal standardFundPerVal = new BigDecimal(0);
if (org.apache.commons.lang3.math.NumberUtils.isCreatable(standardFundPer)) {
standardFundPerVal = new BigDecimal(standardFundPer);
}
// String standardFundPer = Util.null2String(record.get(k + "fundCommonPer"));
// BigDecimal standardFundPerVal = new BigDecimal(0);
// if (org.apache.commons.lang3.math.NumberUtils.isCreatable(standardFundPer)) {
// standardFundPerVal = new BigDecimal(standardFundPer);
// }
BigDecimal specialComVal = v == null ? new BigDecimal("0") : new BigDecimal(v.toString());
String standardFundCom = Util.null2String(record.get(k + "fundCommonCom"));
BigDecimal standardFundComVal = new BigDecimal(0);
if (org.apache.commons.lang3.math.NumberUtils.isCreatable(standardFundCom)) {
standardFundComVal = new BigDecimal(standardFundCom);
}
BigDecimal subtract = standardFundPerVal.subtract(standardFundComVal);
BigDecimal subtract = specialComVal.subtract(standardFundComVal);
fundSpecialSum[0] = fundSpecialSum[0].add(subtract);
record.put(k + "fundSpecial", subtract.toString());
});
@ -5489,7 +5491,9 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
// 获取特殊人员缴纳的福利项
List<Long> xmidList = new ArrayList<>();
if (CollectionUtils.isNotEmpty(ufTsrysjsbfldaList)) {
xmidList = ufTsrysjsbfldaList.stream().map(UfTsrysjsbfldaPO::getSbflxm)
xmidList = ufTsrysjsbfldaList.stream()
.filter(po -> po.getGrbl() != null)
.map(UfTsrysjsbfldaPO::getSbflxm)
.filter(xmid -> NumberUtils.isNumber(xmid))
.map(Long::valueOf)
.collect(Collectors.toList());
@ -5530,7 +5534,6 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
List<BigDecimal> fundPer = new ArrayList<>();
Map<String, String> fundPerJsonMap = new HashMap<>();
Map<Long, UfTsrysjsbfldaPO> ufTsrysjsbfldaPOMap = SalaryEntityUtil.convert2Map(ufTsrysjsbfldaList, po -> Long.valueOf(po.getSbflxm()));
Map<String, String> specialFundJsonMap = new HashMap<>();
needArchivesPerson.stream().forEach(e -> {
// 获取特殊台账数据
UfTsrysjsbfldaPO ufTsrysjsbfldaPO = ufTsrysjsbfldaPOMap.get(e);
@ -5540,7 +5543,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost());
Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum();
BigDecimal result = new BigDecimal("0");
BigDecimal specialResult = new BigDecimal("0");
BigDecimal specialPerResult = new BigDecimal("0");
if (Objects.equals(po.getPaymentCycle(), 1)) {
int monthValue = 1;
for (int i = monthIndex - 1; i >= 0; i--) {
@ -5562,12 +5565,16 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
} else {
result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
}
if (ufTsrysjsbfldaPO != null && ufTsrysjsbfldaPO.getDybl() != null && ufTsrysjsbfldaPO.getDyjs() != null) {
BigDecimal specialProportion = ufTsrysjsbfldaPO.getDybl().divide(new BigDecimal("100"));
specialResult = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), ufTsrysjsbfldaPO.getDyjs().multiply(specialProportion));
specialFundJsonMap.put(String.valueOf(e), specialResult.toPlainString());
if (ufTsrysjsbfldaPO != null && ufTsrysjsbfldaPO.getGrbl() == null && ufTsrysjsbfldaPO.getGrgdz() != null) {
// 个人固定值
result = ufTsrysjsbfldaPO.getGrgdz();
}
if (ufTsrysjsbfldaPO != null && ufTsrysjsbfldaPO.getGrbl() != null && ufTsrysjsbfldaPO.getDyjs() != null && ufTsrysjsbfldaPO.getGrgdz() == null) {
BigDecimal specialProportion = ufTsrysjsbfldaPO.getGrbl().divide(new BigDecimal("100"));
specialPerResult = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), ufTsrysjsbfldaPO.getDyjs().multiply(specialProportion));
// 覆盖至个人部分
result = specialResult;
result = specialPerResult;
// 基数也要覆盖
if (fundBaseMap.containsKey(String.valueOf(e))) {
fundBaseMap.put(String.valueOf(e), ufTsrysjsbfldaPO.getDyjs().toPlainString());
@ -5577,7 +5584,6 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
fundPer.add(result);
});
insuranceAccountDetailPO.setFundPerJson(JSON.toJSONString(fundPerJsonMap));
insuranceAccountDetailPO.setFundSpecialJson(JSON.toJSONString(specialFundJsonMap));
insuranceAccountDetailPO.setFundPaymentBaseString(JSON.toJSONString(fundBaseMap));
BigDecimal funPerSum = new BigDecimal("0");
for (BigDecimal bigDecimal : fundPer) {
@ -5585,10 +5591,24 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
}
insuranceAccountDetailPO.setFundPerSum(funPerSum.toPlainString());
// 单位
// 获取特殊人员缴纳的福利项
List<Long> comXmidList = new ArrayList<>();
if (CollectionUtils.isNotEmpty(ufTsrysjsbfldaList)) {
comXmidList = ufTsrysjsbfldaList.stream()
.filter(po -> po.getGrbl() != null)
.map(UfTsrysjsbfldaPO::getSbflxm)
.filter(xmid -> NumberUtils.isNumber(xmid))
.map(Long::valueOf)
.collect(Collectors.toList());
}
List<Long> finalComXmidList = comXmidList;
//方案中包含的需要缴纳公积金的单位福利
Map<Long, InsuranceSchemeDetailPO> fundCom = detailPOS.stream()
.filter(item -> Objects.equals(IsPaymentEnum.YES.getValue(), item.getIsPayment()) && Objects.equals(item.getPaymentScope(), PaymentScopeEnum.SCOPE_COMPANY.getValue())
&& (item.getPaymentCycle() == null || item.getPaymentCycle() == 0 || (item.getPaymentCycle() == 1 && String.valueOf(item.getCycleSetting().charAt(monthIndex)).equals("1"))))
.filter(item ->
(finalComXmidList.contains(item.getInsuranceId()) && Objects.equals(item.getPaymentScope(), PaymentScopeEnum.SCOPE_COMPANY.getValue())) ||
(Objects.equals(IsPaymentEnum.YES.getValue(), item.getIsPayment()) && Objects.equals(item.getPaymentScope(), PaymentScopeEnum.SCOPE_COMPANY.getValue())
&& (item.getPaymentCycle() == null || item.getPaymentCycle() == 0 || (item.getPaymentCycle() == 1 && String.valueOf(item.getCycleSetting().charAt(monthIndex)).equals("1")))))
.collect(
Collectors.toMap(InsuranceSchemeDetailPO::getInsuranceId, Function.identity()));
//档案中包含的基数信息
@ -5621,13 +5641,17 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
List<BigDecimal> fundComList = new ArrayList<>();
Map<String, String> fundComJsonMap = new HashMap<>();
HashMap<String, String> finalArchivesCom = archivesCom;
Map<String, String> specialFundJsonMap = new HashMap<>();
needArchivesCom.stream().forEach(e -> {
// 获取特殊台账数据
UfTsrysjsbfldaPO ufTsrysjsbfldaPO = ufTsrysjsbfldaPOMap.get(e);
InsuranceSchemeDetailPO po = fundCom.get(e);
BigDecimal paymentProportion = new BigDecimal(StringUtils.isBlank(po.getPaymentProportion()) ? "0" : po.getPaymentProportion()).divide(new BigDecimal("100"));
BigDecimal paymentNum = new BigDecimal((ObjectUtil.isEmpty(finalArchivesCom) || StringUtils.isBlank(finalArchivesCom.get(String.valueOf(e)))) ? "0" : finalArchivesCom.get(String.valueOf(e)));
BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost());
Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum();
BigDecimal result = new BigDecimal("0");
BigDecimal specialComResult = new BigDecimal("0");
if (Objects.equals(po.getPaymentCycle(), 1)) {
int monthValue = 1;
for (int i = monthIndex - 1; i >= 0; i--) {
@ -5649,10 +5673,21 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
} else {
result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
}
if (ufTsrysjsbfldaPO != null && ufTsrysjsbfldaPO.getDybl() == null && ufTsrysjsbfldaPO.getDwgdz() != null) {
// 单位固定值
specialFundJsonMap.put(String.valueOf(e), ufTsrysjsbfldaPO.getDwgdz().toPlainString());
}
if (ufTsrysjsbfldaPO != null && ufTsrysjsbfldaPO.getDybl() != null && ufTsrysjsbfldaPO.getDyjs() != null && ufTsrysjsbfldaPO.getDwgdz() == null) {
BigDecimal specialProportion = ufTsrysjsbfldaPO.getDybl().divide(new BigDecimal("100"));
specialComResult = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), ufTsrysjsbfldaPO.getDyjs().multiply(specialProportion));
specialFundJsonMap.put(String.valueOf(e), specialComResult.toPlainString());
}
fundComJsonMap.put(String.valueOf(e), result.toPlainString());
fundComList.add(result);
});
insuranceAccountDetailPO.setFundComJson(JSON.toJSONString(fundComJsonMap));
insuranceAccountDetailPO.setFundSpecialJson(JSON.toJSONString(specialFundJsonMap));
BigDecimal fundComSum = new BigDecimal("0");
for (BigDecimal bigDecimal : fundComList) {
fundComSum = fundComSum.add(bigDecimal);
@ -5684,14 +5719,16 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
//方案中包含的需要缴纳社保的个人福利
int monthIndex = Integer.parseInt(billMonth.split("-")[1]) - 1;
// 获取特殊人员缴纳的福利项
List<Long> xmidList = new ArrayList<>();
List<Long> perXmidList = new ArrayList<>();
if (CollectionUtils.isNotEmpty(ufTsrysjsbfldaList)) {
xmidList = ufTsrysjsbfldaList.stream().map(UfTsrysjsbfldaPO::getSbflxm)
perXmidList = ufTsrysjsbfldaList.stream()
.filter(data -> data.getGrbl() != null)
.map(UfTsrysjsbfldaPO::getSbflxm)
.filter(xmid -> NumberUtils.isNumber(xmid))
.map(Long::valueOf)
.collect(Collectors.toList());
}
List<Long> finalXmidList = xmidList;
List<Long> finalXmidList = perXmidList;
Map<Long, InsuranceSchemeDetailPO> schemeperson = detailPOS.stream()
.filter(item ->
(finalXmidList.contains(item.getInsuranceId()) && Objects.equals(item.getPaymentScope(), PaymentScopeEnum.SCOPE_PERSON.getValue())) ||
@ -5726,7 +5763,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
List<BigDecimal> socialPer = new ArrayList<>();
Map<String, String> socialPerJsonMap = new HashMap<>();
Map<Long, UfTsrysjsbfldaPO> ufTsrysjsbfldaPOMap = SalaryEntityUtil.convert2Map(ufTsrysjsbfldaList, po -> Long.valueOf(po.getSbflxm()));
Map<String, String> specialSocialJsonMap = new HashMap<>();
needArchivesPerson.forEach(e -> {
// 获取特殊台账数据
UfTsrysjsbfldaPO ufTsrysjsbfldaPO = ufTsrysjsbfldaPOMap.get(e);
@ -5736,7 +5773,8 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost());
Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum();
BigDecimal result = new BigDecimal("0");
BigDecimal specialResult = new BigDecimal("0");
// 特殊个人值
BigDecimal specialPerResult = new BigDecimal("0");
if (Objects.equals(po.getPaymentCycle(), 1)) {
int monthValue = 1;
for (int i = monthIndex - 1; i >= 0; i--) {
@ -5758,12 +5796,15 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
} else {
result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
}
if (ufTsrysjsbfldaPO != null && ufTsrysjsbfldaPO.getDybl() != null && ufTsrysjsbfldaPO.getDyjs() != null) {
BigDecimal specialProportion = ufTsrysjsbfldaPO.getDybl().divide(new BigDecimal("100"));
specialResult = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), ufTsrysjsbfldaPO.getDyjs().multiply(specialProportion));
specialSocialJsonMap.put(String.valueOf(e), specialResult.toPlainString());
if (ufTsrysjsbfldaPO != null && ufTsrysjsbfldaPO.getGrbl() == null && ufTsrysjsbfldaPO.getGrgdz() != null) {
// 个人固定值
result = ufTsrysjsbfldaPO.getGrgdz();
}
if (ufTsrysjsbfldaPO != null && ufTsrysjsbfldaPO.getGrbl() != null && ufTsrysjsbfldaPO.getDyjs() != null && ufTsrysjsbfldaPO.getGrgdz() == null) {
BigDecimal specialProportion = ufTsrysjsbfldaPO.getGrbl().divide(new BigDecimal("100"));
specialPerResult = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), ufTsrysjsbfldaPO.getDyjs().multiply(specialProportion));
// 覆盖至个人部分
result = specialResult;
result = specialPerResult;
// 基数也要覆盖
if (socialBaseMap.containsKey(String.valueOf(e))) {
socialBaseMap.put(String.valueOf(e), ufTsrysjsbfldaPO.getDyjs().toPlainString());
@ -5773,7 +5814,6 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
socialPer.add(result);
});
insuranceAccountDetailPO.setSocialPerJson(JSON.toJSONString(socialPerJsonMap));
insuranceAccountDetailPO.setSocialSpecialJson(JSON.toJSONString(specialSocialJsonMap));
insuranceAccountDetailPO.setSocialPaymentBaseString(JSON.toJSONString(socialBaseMap));
BigDecimal socialPerSum = new BigDecimal("0");
for (BigDecimal bigDecimal : socialPer) {
@ -5781,9 +5821,21 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
}
insuranceAccountDetailPO.setSocialPerSum(socialPerSum.toPlainString());
//方案中包含的需要缴纳社保的单位福利
// 获取特殊人员缴纳的福利项
List<Long> comXmidList = new ArrayList<>();
if (CollectionUtils.isNotEmpty(ufTsrysjsbfldaList)) {
comXmidList = ufTsrysjsbfldaList.stream()
.filter(data -> data.getDybl() != null)
.map(UfTsrysjsbfldaPO::getSbflxm)
.filter(xmid -> NumberUtils.isNumber(xmid))
.map(Long::valueOf)
.collect(Collectors.toList());
}
List<Long> finalComXmidList = comXmidList;
Map<Long, InsuranceSchemeDetailPO> schemeCom = detailPOS.stream()
.filter(item -> Objects.equals(IsPaymentEnum.YES.getValue(), item.getIsPayment()) && Objects.equals(item.getPaymentScope(), PaymentScopeEnum.SCOPE_COMPANY.getValue()) &&
(item.getPaymentCycle() == null || item.getPaymentCycle() == 0 || (item.getPaymentCycle() == 1 && String.valueOf(item.getCycleSetting().charAt(monthIndex)).equals("1"))))
.filter(item -> (finalComXmidList.contains(item.getInsuranceId()) && Objects.equals(item.getPaymentScope(), PaymentScopeEnum.SCOPE_COMPANY.getValue())) ||
(Objects.equals(IsPaymentEnum.YES.getValue(), item.getIsPayment()) && Objects.equals(item.getPaymentScope(), PaymentScopeEnum.SCOPE_COMPANY.getValue()) &&
(item.getPaymentCycle() == null || item.getPaymentCycle() == 0 || (item.getPaymentCycle() == 1 && String.valueOf(item.getCycleSetting().charAt(monthIndex)).equals("1")))))
.collect(
Collectors.toMap(InsuranceSchemeDetailPO::getInsuranceId, Function.identity()));
//档案中包含的基数信息
@ -5816,13 +5868,18 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
List<BigDecimal> socialCom = new ArrayList<>();
Map<String, String> sociaComJsonMap = new HashMap<>();
HashMap<String, String> finalArchivesCom = archivesCom;
Map<String, String> specialSocialJsonMap = new HashMap<>();
needArchivesCom.stream().forEach(e -> {
// 获取特殊台账数据
UfTsrysjsbfldaPO ufTsrysjsbfldaPO = ufTsrysjsbfldaPOMap.get(e);
InsuranceSchemeDetailPO po = schemeCom.get(e);
BigDecimal paymentProportion = new BigDecimal(StringUtils.isBlank(po.getPaymentProportion()) ? "0" : po.getPaymentProportion()).divide(new BigDecimal("100"));
BigDecimal paymentNum = new BigDecimal((ObjectUtil.isEmpty(finalArchivesCom) || StringUtils.isBlank(finalArchivesCom.get(String.valueOf(e)))) ? "0" : finalArchivesCom.get(String.valueOf(e)));
BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost());
Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum();
BigDecimal result = new BigDecimal("0");
// 特殊个人值
BigDecimal specialComResult = new BigDecimal("0");
if (Objects.equals(po.getPaymentCycle(), 1)) {
int monthValue = 1;
for (int i = monthIndex - 1; i >= 0; i--) {
@ -5844,6 +5901,17 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
} else {
result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
}
if (ufTsrysjsbfldaPO != null && ufTsrysjsbfldaPO.getGrbl() == null && ufTsrysjsbfldaPO.getGrgdz() != null) {
// 个人固定值
specialSocialJsonMap.put(String.valueOf(e), ufTsrysjsbfldaPO.getGrgdz().toString());
}
if (ufTsrysjsbfldaPO != null && ufTsrysjsbfldaPO.getDybl() != null && ufTsrysjsbfldaPO.getDyjs() != null && ufTsrysjsbfldaPO.getDwgdz() == null) {
BigDecimal specialProportion = ufTsrysjsbfldaPO.getDybl().divide(new BigDecimal("100"));
specialComResult = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), ufTsrysjsbfldaPO.getDyjs().multiply(specialProportion));
specialSocialJsonMap.put(String.valueOf(e), specialComResult.toPlainString());
}
insuranceAccountDetailPO.setSocialSpecialJson(JSON.toJSONString(specialSocialJsonMap));
sociaComJsonMap.put(String.valueOf(e), result.toPlainString());
socialCom.add(result);

View File

@ -67,6 +67,7 @@ import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.apache.ibatis.session.SqlSession;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.BeanUtils;
@ -4226,4 +4227,81 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
public List<InsuranceArchivesBaseInfoPO> listAll() {
return getInsuranceBaseInfoMapper().listAll();
}
/**
* 根据员工查询社保福利基数缴纳比例信息
* @param employeeId
* @return
*/
@Override
public Map<String, Object> getSIInfo4Qz(Long employeeId) {
Map<String, Object> resultMap = new HashMap<>();
// 查询社保福利档案
List<InsuranceArchivesBaseInfoPO> insuranceArchivesBaseInfoList = getInsuranceBaseInfoMapper().listByEmployeeId(employeeId);
insuranceArchivesBaseInfoList = insuranceArchivesBaseInfoList.stream().filter(po -> (po.getRunStatus().equals(EmployeeStatusEnum.PAYING.getValue()) || po.getRunStatus().equals(EmployeeStatusEnum.STAY_DEL.getValue()))).collect(Collectors.toList());
if (CollectionUtils.isEmpty(insuranceArchivesBaseInfoList)) {
return resultMap;
}
if (insuranceArchivesBaseInfoList.size() > 1) {
resultMap.put("msg", "该员工在社保福利档案中存在"+insuranceArchivesBaseInfoList.size()+"条档案,请检查后保存");
}
InsuranceArchivesBaseInfoPO archivesBaseInfoPO = insuranceArchivesBaseInfoList.get(0);
InsuranceArchivesSocialSchemePO socialArchive = getSocialSchemeMapper().getOneById(archivesBaseInfoPO.getSocialArchivesId());
List<QzSocialInfoDTO> infoList = new ArrayList<>();
if (socialArchive != null && socialArchive.getSocialSchemeId() != null) {
// 获取社保方案信息
List<InsuranceSchemeDetailPO> insuranceSchemeDetailList = getSISchemeService(user).queryInsuranceSchemeDetailList(socialArchive.getSocialSchemeId()).stream().collect(Collectors.toList());
Map<Long, List<InsuranceSchemeDetailPO>> insuranceSchemeDetailMap = SalaryEntityUtil.group2Map(insuranceSchemeDetailList, InsuranceSchemeDetailPO::getInsuranceId);
Map<Long, String> iCategoryMap = SalaryEntityUtil.convert2Map(getICategoryMapper().listAll(), ICategoryPO::getId, ICategoryPO::getInsuranceName);
Map<String, Object> socialJson = JSON.parseObject(socialArchive.getSocialPaymentBaseString(), new TypeReference<Map<String, Object>>() {});
insuranceSchemeDetailMap.forEach((insuranceId, detailList) -> {
Map<Integer, String> paymentProportionMap = SalaryEntityUtil.convert2Map(detailList, detail -> detail.getPaymentScope(), detail -> detail.getPaymentProportion());
// 个人缴纳比例
String paymentProportionStr = paymentProportionMap.get(PaymentScopeEnum.SCOPE_PERSON.getValue());
BigDecimal paymentProportion = NumberUtils.isCreatable(paymentProportionStr) ? new BigDecimal(paymentProportionStr) : null;
// 公司缴纳比例
String paymentProportionComStr = paymentProportionMap.get(PaymentScopeEnum.SCOPE_COMPANY.getValue());
BigDecimal paymentProportionCom = NumberUtils.isCreatable(paymentProportionComStr) ? new BigDecimal(paymentProportionComStr) : null;
// 缴纳基数
String paymentBaseStr = socialJson.get(insuranceId.toString()) == null ? "" : socialJson.get(insuranceId.toString()).toString();
BigDecimal paymentBase = NumberUtils.isCreatable(paymentBaseStr) ? new BigDecimal(paymentBaseStr) : null;
infoList.add(QzSocialInfoDTO.builder()
.insuranceId(insuranceId)
.insuranceName(iCategoryMap.getOrDefault(insuranceId, ""))
.paymentBase(paymentBase)
.paymentProportion(paymentProportion)
.comPaymentProportion(paymentProportionCom)
.build());
});
}
// 获取公积金方案
InsuranceArchivesFundSchemePO fundArchive = getFundSchemeMapper().getOneById(archivesBaseInfoPO.getFundArchivesId());
if (fundArchive != null && fundArchive.getFundSchemeId() != null) {
// 获取社保方案信息
List<InsuranceSchemeDetailPO> insuranceSchemeDetailList = getSISchemeService(user).queryInsuranceSchemeDetailList(fundArchive.getFundSchemeId()).stream().collect(Collectors.toList());
Map<Long, List<InsuranceSchemeDetailPO>> insuranceSchemeDetailMap = SalaryEntityUtil.group2Map(insuranceSchemeDetailList, InsuranceSchemeDetailPO::getInsuranceId);
Map<String, Object> fundJson = JSON.parseObject(fundArchive.getFundPaymentBaseString(), new TypeReference<Map<String, Object>>() {});
insuranceSchemeDetailMap.forEach((insuranceId, detailList) -> {
Map<Integer, String> paymentProportionMap = SalaryEntityUtil.convert2Map(detailList, detail -> detail.getPaymentScope(), detail -> detail.getPaymentProportion());
// 个人缴纳比例
String paymentProportionStr = paymentProportionMap.get(PaymentScopeEnum.SCOPE_PERSON.getValue());
BigDecimal paymentProportion = NumberUtils.isCreatable(paymentProportionStr) ? new BigDecimal(paymentProportionStr) : null;
// 公司缴纳比例
String paymentProportionComStr = paymentProportionMap.get(PaymentScopeEnum.SCOPE_COMPANY.getValue());
BigDecimal paymentProportionCom = NumberUtils.isCreatable(paymentProportionComStr) ? new BigDecimal(paymentProportionComStr) : null;
// 缴纳基数
String paymentBaseStr = fundJson.get(insuranceId.toString()) == null ? "" : fundJson.get(insuranceId.toString()).toString();
BigDecimal paymentBase = NumberUtils.isCreatable(paymentBaseStr) ? new BigDecimal(paymentBaseStr) : null;
infoList.add(QzSocialInfoDTO.builder()
.insuranceId(insuranceId)
.paymentBase(paymentBase)
.paymentProportion(paymentProportion)
.paymentProportion(paymentProportionCom)
.build());
});
}
resultMap.put("dataList",infoList);
return resultMap;
}
}

View File

@ -565,17 +565,18 @@ public class SIExportServiceImpl extends Service implements SIExportService {
Map<String, Object> socialSpecialJson = JSON.parseObject(item.getSocialSpecialJson(), new HashMap<String, Object>().getClass());
if(socialSpecialJson!=null){
socialSpecialJson.forEach((k, v) -> {
String standardSocialPer = Util.null2String(record.get(k + "socialPer"));
BigDecimal standardSocialPerVal = new BigDecimal(0);
if (NumberUtils.isCreatable(standardSocialPer)) {
standardSocialPerVal = new BigDecimal(standardSocialPer);
}
// String standardSocialPer = Util.null2String(record.get(k + "socialPer"));
// BigDecimal standardSocialPerVal = new BigDecimal(0);
// if (NumberUtils.isCreatable(standardSocialPer)) {
// standardSocialPerVal = new BigDecimal(standardSocialPer);
// }
BigDecimal specialComVal = v == null ? new BigDecimal("0") : new BigDecimal(v.toString());
String standardSocialCom = Util.null2String(record.get(k + "socialCom"));
BigDecimal standardComPerVal = new BigDecimal(0);
if (NumberUtils.isCreatable(standardSocialCom)) {
standardComPerVal = new BigDecimal(standardSocialCom);
}
BigDecimal subtract = standardSocialPerVal.subtract(standardComPerVal);
BigDecimal subtract = specialComVal.subtract(standardComPerVal);
socialSpecialSum[0] = socialSpecialSum[0].add(subtract);
record.put(k + "socialSpecial", subtract.toString());
});
@ -588,17 +589,18 @@ public class SIExportServiceImpl extends Service implements SIExportService {
Map<String, Object> fundSpecialJson = JSON.parseObject(item.getFundSpecialJson(), new HashMap<String, Object>().getClass());
if(fundSpecialJson!=null){
fundSpecialJson.forEach((k, v) -> {
String standardFundPer = Util.null2String(record.get(k + "fundPer"));
BigDecimal standardFundPerVal = new BigDecimal(0);
if (NumberUtils.isCreatable(standardFundPer)) {
standardFundPerVal = new BigDecimal(standardFundPer);
}
// String standardFundPer = Util.null2String(record.get(k + "fundPer"));
// BigDecimal standardFundPerVal = new BigDecimal(0);
// if (NumberUtils.isCreatable(standardFundPer)) {
// standardFundPerVal = new BigDecimal(standardFundPer);
// }
BigDecimal specialComVal = v == null ? new BigDecimal("0") : new BigDecimal(v.toString());
String standardFundCom = Util.null2String(record.get(k + "fundCom"));
BigDecimal standardFundComVal = new BigDecimal(0);
if (NumberUtils.isCreatable(standardFundCom)) {
standardFundComVal = new BigDecimal(standardFundCom);
}
BigDecimal subtract = standardFundPerVal.subtract(standardFundComVal);
BigDecimal subtract = specialComVal.subtract(standardFundComVal);
fundSpecialSum[0] = fundSpecialSum[0].add(subtract);
record.put(k + "fundSpecial", subtract.toString());
});
@ -873,22 +875,10 @@ public class SIExportServiceImpl extends Service implements SIExportService {
list.add(new WeaTableColumn("150px", k, v));
});
list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(100388, "社保个人合计"), "socialPerSum"));
// 钱智 二开
specialColumns.get(WelfareTypeEnum.SOCIAL_SECURITY.getValue()).forEach((k, v) -> {
list.add(new WeaTableColumn("150px",k, v));
});
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 0, "单位超额-社保合计"), "socialSpecialSum"));
personColumns.get(WelfareTypeEnum.ACCUMULATION_FUND.getValue()).forEach((k, v) -> {
list.add(new WeaTableColumn("150px", k, v));
});
list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(100390, "公积金个人合计"), "fundPerSum"));
// 钱智 二开
specialColumns.get(WelfareTypeEnum.ACCUMULATION_FUND.getValue()).forEach((k, v) -> {
list.add(new WeaTableColumn("150px",k, v));
});
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 0, "单位超额-公积金合计"), "fundSpecialSum"));
personColumns.get(WelfareTypeEnum.OTHER.getValue()).forEach((k, v) -> {
list.add(new WeaTableColumn("150px", k, v));
});
@ -898,19 +888,29 @@ public class SIExportServiceImpl extends Service implements SIExportService {
list.add(new WeaTableColumn("150px", k, v));
});
list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(100394, "社保单位合计"), "socialComSum"));
// 钱智 二开
specialColumns.get(WelfareTypeEnum.SOCIAL_SECURITY.getValue()).forEach((k, v) -> {
list.add(new WeaTableColumn("150px",k, v));
});
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 0, "单位超额-社保合计"), "socialSpecialSum"));
comColumns.get(WelfareTypeEnum.ACCUMULATION_FUND.getValue()).forEach((k, v) -> {
list.add(new WeaTableColumn("150px", k, v));
});
list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(100395, "公积金单位合计"), "fundComSum"));
// 钱智 二开
specialColumns.get(WelfareTypeEnum.ACCUMULATION_FUND.getValue()).forEach((k, v) -> {
list.add(new WeaTableColumn("150px",k, v));
});
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 0, "单位超额-公积金合计"), "fundSpecialSum"));
comColumns.get(WelfareTypeEnum.OTHER.getValue()).forEach((k, v) -> {
list.add(new WeaTableColumn("150px", k, v));
});
list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(100396, "其他福利单位合计"), "otherComSum"));
list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(0, "单位超额-合计"), "specialSum"));
list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(100397, "单位合计"), "comSum"));
list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(100398, "社保合计"), "socialSum"));
list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(100399, "公积金合计"), "fundSum"));
list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(100400, "其他福利合计"), "otherSum"));
list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(0, "单位超额-合计"), "specialSum"));
list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(93278, "合计"), "total"));
return list;
}

View File

@ -265,4 +265,22 @@ public class SIArchivesController {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<SIArchiveBaseHistoryListParam, PageInfo<InsuranceArchivesBaseHistoryDTO>>(user).run(getService(user)::historyListByEmployeeIdAndOperator, param);
}
/**
* 根据员工查询社保福利基数缴纳比例信息
* @param request
* @param response
* @param param
* @return
*/
@POST
@Path("/getSIInfo4Qz")
@Produces(MediaType.APPLICATION_JSON)
public String getSIInfo4Qz(@Context HttpServletRequest request, @Context HttpServletResponse response,@RequestBody InsuranceArchivesListParam param) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<Long, Map<String, Object>>(user).run(getService(user)::getSIInfo4Qz, param.getEmployeeId());
}
}