钱智社保核算二开

This commit is contained in:
Harryxzy 2025-01-21 10:13:52 +08:00
parent 5e95742508
commit 06dd1e51cf
16 changed files with 648 additions and 34 deletions

View File

@ -0,0 +1,12 @@
ALTER TABLE hrsa_bill_detail ADD social_special_json text NULL
GO
ALTER TABLE hrsa_bill_detail ADD fund_special_json text NULL
GO
ALTER TABLE hrsa_bill_detail_temp ADD social_special_json text NULL
GO
ALTER TABLE hrsa_bill_detail_temp ADD fund_special_json text NULL
GO

View File

@ -178,6 +178,13 @@ public class InsuranceAccountDetailPO {
@ElogTransform(name = "社保个人缴费明细")
private String socialPerJson;
/**
* 特殊社保缴费明细
*/
@Encrypt
@ElogTransform(name = "特殊社保缴费明细")
private String socialSpecialJson;
/**
* 社保个人合计
*/
@ -192,6 +199,13 @@ public class InsuranceAccountDetailPO {
@ElogTransform(name = "公积金个人缴费明细")
private String fundPerJson;
/**
* 特殊公积金缴费明细
*/
@Encrypt
@ElogTransform(name = "特殊公积金缴费明细")
private String fundSpecialJson;
/**
* 公积金个人合计
*/

View File

@ -147,6 +147,11 @@ public class InsuranceAccountDetailTempPO {
*/
@Encrypt
private String socialPerJson;
/**
* 特殊社保缴费明细
*/
@Encrypt
private String socialSpecialJson;
/**
* 社保个人合计
@ -159,6 +164,11 @@ public class InsuranceAccountDetailTempPO {
*/
@Encrypt
private String fundPerJson;
/**
* 特殊公积金缴费明细
*/
@Encrypt
private String fundSpecialJson;
/**
* 公积金个人合计

View File

@ -0,0 +1,36 @@
package com.engine.salary.entity.siaccount.po;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
import java.util.List;
/**
* @author Harryxzy
* @ClassName UfTsrysjsbfldaPO
* @date 2025/01/20 11:12
* @description 钱智 社保福利特殊人员
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class UfTsrysjsbfldaPO {
private Integer id;
private Integer yg;
private String sxyf;
private String toSxyf;
private BigDecimal dyjs;
private BigDecimal dybl;
private String sbflxm;
private List<Integer> ygs;
}

View File

@ -58,6 +58,8 @@
<result column="jobcall" property="jobcall"/>
<result column="jobcall_id" property="jobcallId"/>
<result column="status" property="status"/>
<result column="social_special_json" property="socialSpecialJson"/>
<result column="fund_special_json" property="fundSpecialJson"/>
</resultMap>
@ -122,6 +124,8 @@
, t.jobcall
, t.jobcall_id
, t.status
, t.social_special_json
, t.fund_special_json
</sql>
<sql id="baseColumnsNoJoin">
t
@ -571,7 +575,7 @@
t.other_com_json,t.social_per_sum,t.social_com_sum,
t.fund_per_sum,t.fund_com_sum,t.other_per_sum,
t.other_com_sum,t.per_sum,t.com_sum,t.payment_status,
t.social_payment_base_string,t.fund_payment_base_string,t.other_payment_base_string
t.social_payment_base_string,t.fund_payment_base_string,t.other_payment_base_string,t.social_special_json, t.fund_special_json
FROM
hrsa_bill_detail t
WHERE t.delete_type = 0
@ -596,7 +600,7 @@
t.other_com_sum,t.per_sum,t.com_sum,t.payment_organization,
t.social_payment_base_string, t.fund_payment_base_string, t.other_payment_base_string,
t.social_payment_com_base_string, t.fund_payment_com_base_string, t.other_payment_com_base_string,
t.payment_status
t.payment_status,t.social_special_json,t.fund_special_json
FROM
hrsa_bill_detail t
WHERE t.delete_type = 0
@ -612,7 +616,7 @@
t.other_com_json,t.social_per_sum,t.social_com_sum,
t.fund_per_sum,t.fund_com_sum,t.other_per_sum,
t.other_com_sum,t.per_sum,t.com_sum,t.payment_organization,
t.payment_status
t.payment_status,t.social_special_json,t.fund_special_json
FROM
hrsa_bill_detail t
WHERE t.delete_type = 0
@ -901,7 +905,7 @@
social_per_sum,fund_per_json,fund_per_sum,other_per_json,other_per_sum,per_sum,social_com_json,social_com_sum,fund_com_json,fund_com_sum,other_com_json,other_com_sum,
com_sum,social_sum,fund_sum,other_sum,total,creator,create_time,update_time,delete_type,tenant_key,payment_organization,
social_payment_com_base_string,fund_payment_com_base_string,other_payment_com_base_string,
subcompany_name,subcompany_id,department_name,department_id,jobtitle_name,jobtitle_id,jobcall,jobcall_id,status)
subcompany_name,subcompany_id,department_name,department_id,jobtitle_name,jobtitle_id,jobcall,jobcall_id,status,social_special_json,fund_special_json)
VALUES
<foreach collection="accounts" item="item" separator=",">
(
@ -959,7 +963,9 @@
#{item.jobtitleId},
#{item.jobcall},
#{item.jobcallId},
#{item.status}
#{item.status},
#{item.socialSpecialJson},
#{item.fundSpecialJson}
)
</foreach>
</insert>
@ -970,7 +976,7 @@
social_per_sum,fund_per_json,fund_per_sum,other_per_json,other_per_sum,per_sum,social_com_json,social_com_sum,fund_com_json,fund_com_sum,other_com_json,other_com_sum,
com_sum,social_sum,fund_sum,other_sum,total,creator,create_time,update_time,delete_type,tenant_key,payment_organization,
social_payment_com_base_string,fund_payment_com_base_string,other_payment_com_base_string,
subcompany_name,subcompany_id,department_name,department_id,jobtitle_name,jobtitle_id,jobcall,jobcall_id,status)
subcompany_name,subcompany_id,department_name,department_id,jobtitle_name,jobtitle_id,jobcall,jobcall_id,status,social_special_json,fund_special_json)
<foreach collection="accounts" item="item" separator="union all">
select
#{item.employeeId,jdbcType=DOUBLE},
@ -1027,7 +1033,9 @@
#{item.jobtitleId,jdbcType=DOUBLE},
#{item.jobcall,jdbcType=VARCHAR},
#{item.jobcallId,jdbcType=DOUBLE},
#{item.status,jdbcType=VARCHAR}
#{item.status,jdbcType=VARCHAR},
#{item.socialSpecialJson,jdbcType=VARCHAR},
#{item.fundSpecialJson,jdbcType=VARCHAR}
from dual
</foreach>
</insert>
@ -1039,7 +1047,7 @@
social_per_sum,fund_per_json,fund_per_sum,other_per_json,other_per_sum,per_sum,social_com_json,social_com_sum,fund_com_json,fund_com_sum,other_com_json,other_com_sum,
com_sum,social_sum,fund_sum,other_sum,total,creator,create_time,update_time,delete_type,tenant_key,payment_organization,
social_payment_com_base_string,fund_payment_com_base_string,other_payment_com_base_string,
subcompany_name,subcompany_id,department_name,department_id,jobtitle_name,jobtitle_id,jobcall,jobcall_id,status)
subcompany_name,subcompany_id,department_name,department_id,jobtitle_name,jobtitle_id,jobcall,jobcall_id,status,social_special_json,fund_special_json)
VALUES
(
#{item.employeeId},
@ -1096,7 +1104,9 @@
#{item.jobtitleId},
#{item.jobcall},
#{item.jobcallId},
#{item.status}
#{item.status},
#{item.socialSpecialJson},
#{item.fundSpecialJson}
)
</foreach>
</insert>
@ -1313,6 +1323,8 @@
<if test="null != supplementaryMonth and '' != supplementaryMonth">supplementary_month =
#{supplementaryMonth},
</if>
<if test="null != socialSpecialJson">social_special_json = #{socialSpecialJson},</if>
<if test="null != fundSpecialJson">fund_special_json = #{fundSpecialJson}</if>
</set>
WHERE id = #{id}

View File

@ -111,6 +111,8 @@
, t.jobcall as jobcall
, t.jobcall_id as jobcallId
, t.status as status
, t.social_special_json as socialSpecialJson
, t.fund_special_json as fundSpecialJson
</sql>
@ -147,7 +149,7 @@
social_per_sum,fund_per_json,fund_per_sum,other_per_json,other_per_sum,per_sum,social_com_json,social_com_sum,fund_com_json,fund_com_sum,other_com_json,other_com_sum,
com_sum,social_sum,fund_sum,other_sum,total,creator,create_time,update_time,delete_type,tenant_key,payment_organization,
social_payment_com_base_string,fund_payment_com_base_string,other_payment_com_base_string,
subcompany_name,subcompany_id,department_name,department_id,jobtitle_name,jobtitle_id,jobcall,jobcall_id,status)
subcompany_name,subcompany_id,department_name,department_id,jobtitle_name,jobtitle_id,jobcall,jobcall_id,status,social_special_json,fund_special_json)
VALUES
<foreach collection="accounts" item="item" separator=",">
(
@ -204,7 +206,9 @@
#{item.jobtitleId},
#{item.jobcall},
#{item.jobcallId},
#{item.status}
#{item.status},
#{item.socialSpecialJson},
#{item.fundSpecialJson}
)
</foreach>
</insert>
@ -215,7 +219,7 @@
social_per_sum,fund_per_json,fund_per_sum,other_per_json,other_per_sum,per_sum,social_com_json,social_com_sum,fund_com_json,fund_com_sum,other_com_json,other_com_sum,
com_sum,social_sum,fund_sum,other_sum,total,creator,create_time,update_time,delete_type,tenant_key,payment_organization,
social_payment_com_base_string,fund_payment_com_base_string,other_payment_com_base_string,
subcompany_name,subcompany_id,department_name,department_id,jobtitle_name,jobtitle_id,jobcall,jobcall_id,status)
subcompany_name,subcompany_id,department_name,department_id,jobtitle_name,jobtitle_id,jobcall,jobcall_id,status,social_special_json,fund_special_json)
<foreach collection="accounts" item="item" separator="union all">
select
@ -272,7 +276,9 @@
#{item.jobtitleId,jdbcType=DOUBLE},
#{item.jobcall,jdbcType=VARCHAR},
#{item.jobcallId,jdbcType=DOUBLE},
#{item.status,jdbcType=VARCHAR}
#{item.status,jdbcType=VARCHAR},
#{item.socialSpecialJson,jdbcType=VARCHAR},
#{item.fundSpecialJson,jdbcType=VARCHAR}
from dual
</foreach>
</insert>
@ -284,7 +290,7 @@
social_per_sum,fund_per_json,fund_per_sum,other_per_json,other_per_sum,per_sum,social_com_json,social_com_sum,fund_com_json,fund_com_sum,other_com_json,other_com_sum,
com_sum,social_sum,fund_sum,other_sum,total,creator,create_time,update_time,delete_type,tenant_key,payment_organization,
social_payment_com_base_string,fund_payment_com_base_string,other_payment_com_base_string,
subcompany_name,subcompany_id,department_name,department_id,jobtitle_name,jobtitle_id,jobcall,jobcall_id,status)
subcompany_name,subcompany_id,department_name,department_id,jobtitle_name,jobtitle_id,jobcall,jobcall_id,status,social_special_json,fund_special_json)
VALUES
(
#{item.employeeId},
@ -340,7 +346,9 @@
#{item.jobtitleId},
#{item.jobcall},
#{item.jobcallId},
#{item.status}
#{item.status},
#{item.socialSpecialJson},
#{item.fundSpecialJson}
)
</foreach>
</insert>

View File

@ -0,0 +1,21 @@
package com.engine.salary.mapper.siaccount;
import com.engine.salary.entity.siaccount.po.UfTsrysjsbfldaPO;
import java.util.List;
/**
* @author Harryxzy
* @ClassName UfTsrysjsbfldaMapper
* @date 2025/01/20 11:14
* @description
*/
public interface UfTsrysjsbfldaMapper {
/**
* 条件查询
*
* @return 返回集合没有返回空List
*/
List<UfTsrysjsbfldaPO> listSome(UfTsrysjsbfldaPO ufTsrysjsbfldaDt1);
}

View File

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.engine.salary.mapper.siaccount.UfTsrysjsbfldaMapper">
<resultMap id="BaseResultMap" type="com.engine.salary.entity.siaccount.po.UfTsrysjsbfldaPO">
<result column="id" property="id" />
<result column="yg" property="yg" />
<result column="sxyf" property="sxyf" />
<result column="dyjs" property="dyjs" />
<result column="dybl" property="dybl" />
<result column="sbflxm" property="sbflxm" />
</resultMap>
<!-- 表字段 -->
<sql id="baseColumns">
t.id
, t.yg
, t.sxyf
, dt1.dyjs
, dt1.dybl
, dt1.sbflxm
</sql>
<!-- 条件查询 -->
<select id="listSome" resultMap="BaseResultMap" parameterType="com.engine.salary.entity.siaccount.po.UfTsrysjsbfldaPO">
SELECT
<include refid="baseColumns" />
FROM uf_tsrysjsbflda t left join uf_tsrysjsbflda_dt1 dt1 on t.id = dt1.mainid
WHERE 1 = 1
<if test="yg != null">
AND t.yg = #{yg}
</if>
<if test="sxyf != null">
AND t.sxyf = #{sxyf}
</if>
<if test="sxyf != null">
AND t.sxyf = #{sxyf}
</if>
<if test="ygs != null and ygs.size()>0">
AND t.yg IN
<foreach collection="ygs" open="(" item="empId" separator="," close=")">
#{empId}
</foreach>
</if>
<if test="toSxyf != null">
AND (t.sxyf is null or t.sxyf ='' or t.sxyf <![CDATA[ >= ]]> #{toSxyf})
</if>
ORDER BY t.id DESC
</select>
</mapper>

View File

@ -0,0 +1,17 @@
package com.engine.salary.service;
import com.engine.salary.entity.siaccount.po.UfTsrysjsbfldaPO;
import java.util.List;
/**
* @author Harryxzy
* @ClassName UfTsrysjsbfldaService
* @date 2025/01/20 11:21
* @description
*/
public interface UfTsrysjsbfldaService {
List<UfTsrysjsbfldaPO> listSome(UfTsrysjsbfldaPO param);
List<UfTsrysjsbfldaPO> listByEmpIdsAndMonth(List<Long> empIds, String billMonth);
}

View File

@ -50,6 +50,7 @@ public class ColumnBuildServiceImpl extends Service implements ColumnBuildServic
Map<String, String> categoryIdNameMap = getICategoryMapper().listAll().stream().collect(Collectors.toMap(ICategoryPO -> String.valueOf(ICategoryPO.getId()), ICategoryPO::getInsuranceName));
Map<Integer, Map<String, String>> columns = buildPaymentTitle(pos, categoryIdNameMap, employeeId, tenantKey);
Map<Integer, Map<String, String>> personColumns = buildPersonalTitle(pos, categoryIdNameMap, employeeId, tenantKey);
Map<Integer, Map<String, String>> specialColumns = buildSpecialTitle(pos, categoryIdNameMap, employeeId, tenantKey);
Map<Integer, Map<String, String>> comColumns = buildComTitle(pos, categoryIdNameMap, employeeId, tenantKey);
WeaTableColumn weaTableNameColumn = new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 85429, "姓名"), "userName");
weaTableNameColumn.setFixed("left");
@ -103,10 +104,20 @@ 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));
});
@ -367,6 +378,58 @@ public class ColumnBuildServiceImpl extends Service implements ColumnBuildServic
return result;
}
private Map<Integer, Map<String, String>> buildSpecialTitle(List<InsuranceAccountDetailPO> pos, Map<String, String> categoryIdNameMap, Long employeeId, String tenantKey) {
Set<String> socailIds = new HashSet<>();
Set<String> fundIds = new HashSet<>();
Map<Integer, Map<String, String>> result = new HashMap<>();
pos.stream().forEach(item -> {
if (StringUtils.isNotBlank(item.getSocialSpecialJson())) {
Map<String, String> socialSpecialJson = JSON.parseObject(item.getSocialSpecialJson(), new HashMap<String, String>().getClass());
if(socialSpecialJson!=null){
socialSpecialJson.forEach((k, v) -> {
socailIds.add(k);
});
}
}
if (StringUtils.isNotBlank(item.getFundSpecialJson())) {
Map<String, String> fundSpecialJson = JSON.parseObject(item.getFundSpecialJson(), new HashMap<String, String>().getClass());
if(fundSpecialJson!=null){
fundSpecialJson.forEach((k, v) -> {
fundIds.add(k);
});
}
}
});
Map<String, String> socialColumns = new HashMap<>();
Map<String, String> fundColumns = new HashMap<>();
socailIds.stream().forEach(social -> {
if (categoryIdNameMap.containsKey(social)) {
socialColumns.put(SalaryI18nUtil.getI18nLabel( 0, "个人额外-") + categoryIdNameMap.get(social) , social + "socialSpecial");
}
});
fundIds.stream().forEach(social -> {
if (categoryIdNameMap.containsKey(social)) {
fundColumns.put(SalaryI18nUtil.getI18nLabel( 0, "个人额外-") + categoryIdNameMap.get(social), social + "fundSpecial");
}
});
// map根据value排序
LinkedHashMap<String, String> socialColumnsWithAscValue = socialColumns.entrySet().stream()
.sorted(Map.Entry.comparingByValue())
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (oldValue, newValue) -> oldValue,
LinkedHashMap::new));
LinkedHashMap<String, String> fundColumnsWithAscValue = fundColumns.entrySet().stream()
.sorted(Map.Entry.comparingByValue())
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (oldValue, newValue) -> oldValue,
LinkedHashMap::new));
result.put(WelfareTypeEnum.SOCIAL_SECURITY.getValue(), socialColumnsWithAscValue);
result.put(WelfareTypeEnum.ACCUMULATION_FUND.getValue(), fundColumnsWithAscValue);
return result;
}
private Map<Integer, Map<String, String>> buildComTitle(List<InsuranceAccountDetailPO> pos, Map<String, String> categoryIdNameMap, Long employeeId, String tenantKey) {
Set<String> socailIds = new HashSet<>();
Set<String> fundIds = new HashSet<>();

View File

@ -30,9 +30,11 @@ import com.engine.salary.util.db.MapperProxyFactory;
import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import weaver.general.Util;
import weaver.hrm.User;
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
@ -269,7 +271,30 @@ public class RecordsBuildServiceImpl extends Service implements RecordsBuildServ
}
}
// 钱智 社保差异
final BigDecimal[] socialSpecialSum = {new BigDecimal(0)};
if (StringUtils.isNotEmpty(item.getSocialSpecialJson())) {
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);
BigDecimal specialSocialPerVal = new BigDecimal(0);
if (NumberUtils.isCreatable(standardSocialPer)) {
standardSocialPerVal = new BigDecimal(standardSocialPer);
}
if (v != null && NumberUtils.isCreatable(v.toString())) {
specialSocialPerVal = new BigDecimal(v.toString());
}
BigDecimal subtract = specialSocialPerVal.subtract(standardSocialPerVal);
socialSpecialSum[0] = socialSpecialSum[0].add(subtract);
record.put(k + "socialSpecial", subtract.toString());
});
}
}
record.put("socialPerSum", item.getSocialPerSum());
record.put("socialSpecialSum", socialSpecialSum[0]);
if (StringUtils.isNotEmpty(item.getFundPerJson())) {
Map<String, Object> fundPerJson = JSON.parseObject(item.getFundPerJson(), new HashMap<String, Object>().getClass());
if(fundPerJson!=null){
@ -279,7 +304,29 @@ public class RecordsBuildServiceImpl extends Service implements RecordsBuildServ
}
}
// 钱智 公积金差异
final BigDecimal[] fundSpecialSum = {new BigDecimal(0)};
if (StringUtils.isNotEmpty(item.getFundSpecialJson())) {
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);
BigDecimal specialFundPerVal = new BigDecimal(0);
if (NumberUtils.isCreatable(standardFundPer)) {
standardFundPerVal = new BigDecimal(standardFundPer);
}
if (v != null && NumberUtils.isCreatable(v.toString())) {
specialFundPerVal = new BigDecimal(v.toString());
}
BigDecimal subtract = specialFundPerVal.subtract(standardFundPerVal);
fundSpecialSum[0] = fundSpecialSum[0].add(subtract);
record.put(k + "fundSpecial", subtract.toString());
});
}
}
record.put("fundPerSum", item.getFundPerSum());
record.put("fundSpecialSum", fundSpecialSum[0]);
if (StringUtils.isNotEmpty(item.getOtherPerJson())) {
Map<String, Object> fundPerJson = JSON.parseObject(item.getOtherPerJson(), new HashMap<String, Object>().getClass());
if(fundPerJson!=null){

View File

@ -163,6 +163,10 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
return ServiceUtil.getService(SalaryEmployeeServiceImpl.class, user);
}
private UfTsrysjsbfldaService getUfTsrysjsbfldaService(User user) {
return ServiceUtil.getService(UfTsrysjsbfldaServiceImpl.class, user);
}
private SalarySysConfService getSalarySysConfService(User user) {
return ServiceUtil.getService(SalarySysConfServiceImpl.class, user);
}
@ -1087,6 +1091,28 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
record.put(k + "socialCommonPer", v);
});
}
// 钱智 社保差异
final BigDecimal[] socialSpecialSum = {new BigDecimal(0)};
if (StringUtils.isNotEmpty(item.getSocialSpecialJson())) {
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);
BigDecimal specialSocialPerVal = new BigDecimal(0);
if (org.apache.commons.lang3.math.NumberUtils.isCreatable(standardSocialPer)) {
standardSocialPerVal = new BigDecimal(standardSocialPer);
}
if (v != null && org.apache.commons.lang3.math.NumberUtils.isCreatable(v.toString())) {
specialSocialPerVal = new BigDecimal(v.toString());
}
BigDecimal subtract = specialSocialPerVal.subtract(standardSocialPerVal);
socialSpecialSum[0] = socialSpecialSum[0].add(subtract);
record.put(k + "socialSpecial", subtract.toString());
});
}
}
if (commonSiAcct != null && StringUtils.isNotEmpty(commonSiAcct.getSocialComJson())) {
Map<String, Object> socialJson = JSON.parseObject(commonSiAcct.getSocialComJson(), new HashMap<String, Object>().getClass());
socialJson.forEach((k, v) -> {
@ -1095,6 +1121,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
}
record.put("socialPerCommonSum", commonSiAcct != null ? commonSiAcct.getSocialPerSum() : new BigDecimal("0"));
record.put("socialComCommonSum", commonSiAcct != null ? commonSiAcct.getSocialComSum() : new BigDecimal("0"));
record.put("socialSpecialSum", socialSpecialSum[0]);
//社保-补缴
if (repairSiAcct != null && StringUtils.isNotEmpty(repairSiAcct.getSocialPerJson())) {
Map<String, Object> socialJson = JSON.parseObject(repairSiAcct.getSocialPerJson(), new HashMap<String, Object>().getClass());
@ -1133,6 +1160,27 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
record.put(k + "fundCommonPer", v);
});
}
// 钱智 公积金差异
final BigDecimal[] fundSpecialSum = {new BigDecimal(0)};
if (StringUtils.isNotEmpty(item.getFundSpecialJson())) {
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);
BigDecimal specialFundPerVal = new BigDecimal(0);
if (org.apache.commons.lang3.math.NumberUtils.isCreatable(standardFundPer)) {
standardFundPerVal = new BigDecimal(standardFundPer);
}
if (v != null && org.apache.commons.lang3.math.NumberUtils.isCreatable(v.toString())) {
specialFundPerVal = new BigDecimal(v.toString());
}
BigDecimal subtract = specialFundPerVal.subtract(standardFundPerVal);
fundSpecialSum[0] = fundSpecialSum[0].add(subtract);
record.put(k + "fundSpecial", subtract.toString());
});
}
}
if (commonSiAcct != null && StringUtils.isNotEmpty(commonSiAcct.getFundComJson())) {
Map<String, Object> socialJson = JSON.parseObject(commonSiAcct.getFundComJson(), new HashMap<String, Object>().getClass());
socialJson.forEach((k, v) -> {
@ -1141,6 +1189,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
}
record.put("fundPerCommonSum", commonSiAcct != null ? commonSiAcct.getFundPerSum() : new BigDecimal("0"));
record.put("fundComCommonSum", commonSiAcct != null ? commonSiAcct.getFundComSum() : new BigDecimal("0"));
record.put("fundSpecialSum", fundSpecialSum[0]);
//公积金-补缴
if (repairSiAcct != null && StringUtils.isNotEmpty(repairSiAcct.getFundPerJson())) {
Map<String, Object> fundJson = JSON.parseObject(repairSiAcct.getFundPerJson(), new HashMap<String, Object>().getClass());
@ -1254,6 +1303,8 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
commonResult.put(SalaryI18nUtil.getI18nLabel(0, "社保个人正常缴纳合计"), "socialPerCommonSum");
commonResult.put(SalaryI18nUtil.getI18nLabel(0, "公积金个人正常缴纳合计"), "fundPerCommonSum");
commonResult.put(SalaryI18nUtil.getI18nLabel(0, "其他福利个人正常缴纳合计"), "otherPerCommonSum");
commonResult.put(SalaryI18nUtil.getI18nLabel(0, "个人额外-社保合计"), "socialSpecialSum");
commonResult.put(SalaryI18nUtil.getI18nLabel(0, "个人额外-公积金合计"), "fundSpecialSum");
repairResult.put(SalaryI18nUtil.getI18nLabel(0, "个人补缴合计"), "perRepairSum");
repairResult.put(SalaryI18nUtil.getI18nLabel(0, "社保个人补缴合计"), "socialPerRepairSum");
repairResult.put(SalaryI18nUtil.getI18nLabel(0, "公积金个人补缴合计"), "fundPerRepairSum");
@ -1271,6 +1322,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
}
result.put(categoryIdNameMap.get(String.valueOf(item.getId())) + SalaryI18nUtil.getI18nLabel(87159, "个人"), item.getId() + "socialPer");
commonResult.put(categoryIdNameMap.get(String.valueOf(item.getId())) + SalaryI18nUtil.getI18nLabel(0, "正常缴纳个人"), item.getId() + "socialCommonPer");
commonResult.put(SalaryI18nUtil.getI18nLabel(0, "个人额外-") + categoryIdNameMap.get(String.valueOf(item.getId())) , item.getId() + "socialSpecial");
repairResult.put(categoryIdNameMap.get(String.valueOf(item.getId())) + SalaryI18nUtil.getI18nLabel(0, "补缴个人"), item.getId() + "socialRepairPer");
balanceResult.put(categoryIdNameMap.get(String.valueOf(item.getId())) + SalaryI18nUtil.getI18nLabel(0, "补差个人"), item.getId() + "socialBalancePer");
}
@ -1280,6 +1332,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
}
result.put(categoryIdNameMap.get(String.valueOf(item.getId())) + SalaryI18nUtil.getI18nLabel(87159, "个人"), item.getId() + "fundPer");
commonResult.put(categoryIdNameMap.get(String.valueOf(item.getId())) + SalaryI18nUtil.getI18nLabel(0, "正常缴纳个人"), item.getId() + "fundCommonPer");
commonResult.put(SalaryI18nUtil.getI18nLabel(0, "个人额外-") + categoryIdNameMap.get(String.valueOf(item.getId())) , item.getId() + "fundSpecial");
repairResult.put(categoryIdNameMap.get(String.valueOf(item.getId())) + SalaryI18nUtil.getI18nLabel(0, "补缴个人"), item.getId() + "fundRepairPer");
balanceResult.put(categoryIdNameMap.get(String.valueOf(item.getId())) + SalaryI18nUtil.getI18nLabel(0, "补差个人"), item.getId() + "fundBalancePer");
}
@ -1390,6 +1443,8 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
Map<String, String> socialComMap = new HashMap<>();
Map<String, String> fundComMap = new HashMap<>();
Map<String, String> otherComMap = new HashMap<>();
Map<String, String> socialSpecialMap = new HashMap<>();
Map<String, String> fundSpecialMap = new HashMap<>();
BigDecimal socialPer = new BigDecimal("0");
BigDecimal socialCom = new BigDecimal("0");
BigDecimal fundPer = new BigDecimal("0");
@ -1455,6 +1510,24 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
});
}
}
if (StringUtils.isNotBlank(item.getSocialSpecialJson())) {
Map<String, String> socialJson = JSON.parseObject(item.getSocialSpecialJson(), new HashMap<String, String>().getClass());
if (socialJson != null) {
socialJson.forEach((insuranceId, num) -> {
if (socialSpecialMap.get(insuranceId) == null) {
socialSpecialMap.put(insuranceId, num);
} else {
String oldNum = socialSpecialMap.get(insuranceId);
BigDecimal insuanceNum = new BigDecimal("0");
BigDecimal oldDecimal = new BigDecimal(oldNum);
BigDecimal numDecimal = num == null ? new BigDecimal("0") : new BigDecimal(num);
insuanceNum = insuanceNum.add(numDecimal).add(oldDecimal);
socialSpecialMap.put(insuranceId, insuanceNum.toPlainString());
}
});
}
}
if (StringUtils.isNotBlank(item.getFundPerJson())) {
Map<String, String> fundJson = JSON.parseObject(item.getFundPerJson(), new HashMap<String, String>().getClass());
@ -1491,6 +1564,24 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
});
}
}
if (StringUtils.isNotBlank(item.getFundSpecialJson())) {
Map<String, String> fundJson = JSON.parseObject(item.getFundSpecialJson(), new HashMap<String, String>().getClass());
if (fundJson != null) {
fundJson.forEach((insuranceId, num) -> {
if (fundSpecialMap.get(insuranceId) == null) {
fundSpecialMap.put(insuranceId, num);
} else {
String oldNum = fundSpecialMap.get(insuranceId);
BigDecimal insuanceNum = new BigDecimal("0");
BigDecimal oldDecimal = new BigDecimal(oldNum);
BigDecimal numDecimal = num == null ? new BigDecimal("0") : new BigDecimal(num);
insuanceNum = insuanceNum.add(numDecimal).add(oldDecimal);
fundSpecialMap.put(insuranceId, insuanceNum.toPlainString());
}
});
}
}
if (StringUtils.isNotBlank(item.getOtherPerJson())) {
Map<String, String> otherJson = JSON.parseObject(item.getOtherPerJson(), new HashMap<String, String>().getClass());
@ -1543,6 +1634,8 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
insuranceAccountDetailPO.setOtherComSum(otherCom.toPlainString());
insuranceAccountDetailPO.setPerSum(perSum.toPlainString());
insuranceAccountDetailPO.setComSum(comSum.toPlainString());
insuranceAccountDetailPO.setSocialSpecialJson(JSON.toJSONString(socialSpecialMap));
insuranceAccountDetailPO.setFundSpecialJson(JSON.toJSONString(fundSpecialMap));
newList.add(insuranceAccountDetailPO);
}
return newList;
@ -1618,7 +1711,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
List<String> welfareNames = (List<String>) param.getWelfareNames();
headerList.addAll(welfareNames);
//匹配welfareName对应的id
List<InsuranceAcctDetailImportFieldDTO> welfareList = getSalaryFormulaWrapper(user).welfareList();
List<InsuranceAcctDetailImportFieldDTO> welfareList = getSalaryFormulaWrapper(user).welfareList(null);
Map<String, String> welfareNameMap = welfareList.stream().collect(Collectors.toMap(InsuranceAcctDetailImportFieldDTO::getSalaryItemName, InsuranceAcctDetailImportFieldDTO::getFieldId, (key1, key2) -> key2));
welfareNames.forEach(f -> {
if (StringUtils.isNotBlank(welfareNameMap.get(f))) {
@ -2177,6 +2270,9 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
Map<String, String> fundComMap = new HashMap<>();
Map<String, String> otherComMap = new HashMap<>();
Map<String, String> socialSpecialMap = new HashMap<>();
Map<String, String> fundSpecialMap = new HashMap<>();
//筛选出福利核算项
Map<String, Object> toDealMap =
baseMap.entrySet().stream()
@ -2231,6 +2327,28 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
}
}
// 钱智二开
//获取元素名后缀方便之后判断个人单位
if (StringUtils.isNotBlank(keyName) && keyName.length() > 5) {
String specialScope = keyName.substring(0,5);
if (specialScope.equals("个人额外-")) {
categoryPOList = getSICategoryService(user).listByName(entry.getKey().substring(5));
if (categoryPOList.size() == 1) {
ICategoryPO iCategoryPO = categoryPOList.get(0);
welfareType = iCategoryPO.getWelfareType();
switch (welfareType) {
case 1:
socialSpecialMap.put(iCategoryPO.getId().toString(), entry.getValue().toString());
break;
case 2:
fundSpecialMap.put(iCategoryPO.getId().toString(), entry.getValue().toString());
break;
default:
throw new SalaryRunTimeException("福利类型不存在");
}
}
}
}
}
//组装新的insuranceAccountDetailPO对象数据
@ -2245,6 +2363,11 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
insuranceAccountDetailPO.setSocialComJson(JSON.toJSONString(socialComMap));
}
if (!socialSpecialMap.isEmpty()) {
checkJsonMap(socialSpecialMap, insuranceAccountDetailPO.getSocialSpecialJson());
insuranceAccountDetailPO.setSocialSpecialJson(JSON.toJSONString(socialSpecialMap));
}
if (!fundPerMap.isEmpty()) {
checkJsonMap(fundPerMap, insuranceAccountDetailPO.getFundPerJson());
insuranceAccountDetailPO.setFundPerJson(JSON.toJSONString(fundPerMap));
@ -2254,6 +2377,10 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
checkJsonMap(fundComMap, insuranceAccountDetailPO.getFundComJson());
insuranceAccountDetailPO.setFundComJson(JSON.toJSONString(fundComMap));
}
if (!fundSpecialMap.isEmpty()) {
checkJsonMap(fundSpecialMap, insuranceAccountDetailPO.getFundSpecialJson());
insuranceAccountDetailPO.setFundSpecialJson(JSON.toJSONString(fundSpecialMap));
}
if (!otherPerMap.isEmpty()) {
checkJsonMap(otherPerMap, insuranceAccountDetailPO.getOtherPerJson());
@ -5069,6 +5196,9 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
}
public void siCommonAccount(String billMonth, List<Long> ids, Long paymentOrganization, boolean isFirstFlag) {
// 获取这些员工的特殊人员社保福利档案数据
List<UfTsrysjsbfldaPO> ufTsrysjsbfldaPOS = getUfTsrysjsbfldaService(user).listByEmpIdsAndMonth(ids, billMonth);
Map<Integer, List<UfTsrysjsbfldaPO>> ufTsrysjsbfldaListMap = SalaryEntityUtil.group2Map(ufTsrysjsbfldaPOS, UfTsrysjsbfldaPO::getYg);
// Map<Long, InsuranceArchivesAccountPO> insuranceArchivesAccountPOS = siArchivesBiz.buildBatchAccount(ids, paymentOrganization);
Map<Long, InsuranceArchivesAccountPO> insuranceArchivesAccountPOS = getSIArchivesService(user).buildBatchAccount(ids, paymentOrganization);
@ -5130,10 +5260,12 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
}
}
// 获取特殊人员社保福利档案数据
List<UfTsrysjsbfldaPO> ufTsrysjsbfldaList = ufTsrysjsbfldaListMap.get(k.intValue());
//核算社保
accountSocial(insuranceAccountDetailPO, v, billMonth);
accountSocial(insuranceAccountDetailPO, v, billMonth, ufTsrysjsbfldaList);
//核算公积金
accountFund(insuranceAccountDetailPO, v, billMonth);
accountFund(insuranceAccountDetailPO, v, billMonth, ufTsrysjsbfldaList);
//核算其他福利
accountOther(insuranceAccountDetailPO, v, billMonth);
//计算合计
@ -5335,7 +5467,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
}
public InsuranceAccountDetailPO accountFund(InsuranceAccountDetailPO insuranceAccountDetailPO, InsuranceArchivesAccountPO accountPO, String billMonth) {
public InsuranceAccountDetailPO accountFund(InsuranceAccountDetailPO insuranceAccountDetailPO, InsuranceArchivesAccountPO accountPO, String billMonth, List<UfTsrysjsbfldaPO> ufTsrysjsbfldaList) {
// boolean welBaseDiffSign = siArchivesBiz.isDiffWelBase();
boolean welBaseDiffSign = getSIArchivesService(user).isDiffWelBase();
if (accountPO.getFund() != null) {
@ -5382,13 +5514,18 @@ 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);
InsuranceSchemeDetailPO po = fundperson.get(e);
BigDecimal paymentProportion = new BigDecimal(StringUtils.isBlank(po.getPaymentProportion()) ? "0" : po.getPaymentProportion()).divide(new BigDecimal("100"));
BigDecimal paymentNum = new BigDecimal((ObjectUtil.isEmpty(archivesPerson) || StringUtils.isBlank(archivesPerson.get(String.valueOf(e)))) ? "0" : archivesPerson.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 specialResult = new BigDecimal("0");
if (Objects.equals(po.getPaymentCycle(), 1)) {
int monthValue = 1;
for (int i = monthIndex - 1; i >= 0; i--) {
@ -5410,10 +5547,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());
}
fundPerJsonMap.put(String.valueOf(e), result.toPlainString());
fundPer.add(result);
});
insuranceAccountDetailPO.setFundPerJson(JSON.toJSONString(fundPerJsonMap));
insuranceAccountDetailPO.setFundSpecialJson(JSON.toJSONString(specialFundJsonMap));
BigDecimal funPerSum = new BigDecimal("0");
for (BigDecimal bigDecimal : fundPer) {
funPerSum = funPerSum.add(bigDecimal);
@ -5499,7 +5642,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
}
public InsuranceAccountDetailPO accountSocial(InsuranceAccountDetailPO insuranceAccountDetailPO, InsuranceArchivesAccountPO accountPO, String billMonth) {
public InsuranceAccountDetailPO accountSocial(InsuranceAccountDetailPO insuranceAccountDetailPO, InsuranceArchivesAccountPO accountPO, String billMonth, List<UfTsrysjsbfldaPO> ufTsrysjsbfldaList) {
// boolean welBaseDiffSign = siArchivesBiz.isDiffWelBase();
boolean welBaseDiffSign = getSIArchivesService(user).isDiffWelBase();
if (accountPO.getSocial() != null) {
@ -5548,13 +5691,18 @@ 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);
InsuranceSchemeDetailPO po = schemeperson.get(e);
BigDecimal paymentProportion = new BigDecimal(StringUtils.isBlank(po.getPaymentProportion()) ? "0" : po.getPaymentProportion()).divide(new BigDecimal("100"));
BigDecimal paymentNum = new BigDecimal((ObjectUtil.isEmpty(archivesPerson) || StringUtils.isBlank(archivesPerson.get(String.valueOf(e)))) ? "0" : archivesPerson.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 specialResult = new BigDecimal("0");
if (Objects.equals(po.getPaymentCycle(), 1)) {
int monthValue = 1;
for (int i = monthIndex - 1; i >= 0; i--) {
@ -5576,10 +5724,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));
specialSocialJsonMap.put(String.valueOf(e), specialResult.toPlainString());
}
socialPerJsonMap.put(String.valueOf(e), result.toPlainString());
socialPer.add(result);
});
insuranceAccountDetailPO.setSocialPerJson(JSON.toJSONString(socialPerJsonMap));
insuranceAccountDetailPO.setSocialSpecialJson(JSON.toJSONString(specialSocialJsonMap));
BigDecimal socialPerSum = new BigDecimal("0");
for (BigDecimal bigDecimal : socialPer) {
socialPerSum = socialPerSum.add(bigDecimal);
@ -6151,6 +6305,11 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
baseParam.getProjects() == null ? new ArrayList<>() : baseParam.getProjects().stream().map(String::valueOf).collect(Collectors.toList())));
insuranceAccountDetailPO.setTenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY);
insuranceAccountDetailPO.setResourceFrom(ResourceFromEnum.SYSTEM.getValue());
// 获取这些员工的特殊人员社保福利档案数据
List<UfTsrysjsbfldaPO> ufTsrysjsbfldaPOS = getUfTsrysjsbfldaService(user).listByEmpIdsAndMonth(Collections.singletonList(baseParam.getEmployeeId()), baseParam.getBillMonth());
Map<Integer, List<UfTsrysjsbfldaPO>> ufTsrysjsbfldaListMap = SalaryEntityUtil.group2Map(ufTsrysjsbfldaPOS, UfTsrysjsbfldaPO::getYg);
//缴纳组织=个税扣缴义务人
insuranceAccountDetailPO.setSocialPayOrg(baseParam.getPaymentOrganization());
if (projects.contains(ProjectTypeEnum.ALL.getValue())) {
@ -6164,16 +6323,16 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
if (accountPO.getOther() != null) {
accountPO.getOther().setOtherPaymentBaseString(baseParam.getOtherPaymentBaseString());
}
accountSocial(insuranceAccountDetailPO, accountPO, baseParam.getSupplementaryMonth());
accountFund(insuranceAccountDetailPO, accountPO, baseParam.getSupplementaryMonth());
accountSocial(insuranceAccountDetailPO, accountPO, baseParam.getSupplementaryMonth(), null);
accountFund(insuranceAccountDetailPO, accountPO, baseParam.getSupplementaryMonth(), null);
accountOther(insuranceAccountDetailPO, accountPO, baseParam.getSupplementaryMonth());
} else if ("3".equals(baseParam.getSupplementType())) {
accountSupSocialByData(insuranceAccountDetailPO, baseParam);
accountSupFundByData(insuranceAccountDetailPO, baseParam);
accountSupOtherByData(insuranceAccountDetailPO, baseParam);
} else {
accountSocial(insuranceAccountDetailPO, accountPO, baseParam.getSupplementaryMonth());
accountFund(insuranceAccountDetailPO, accountPO, baseParam.getSupplementaryMonth());
accountSocial(insuranceAccountDetailPO, accountPO, baseParam.getSupplementaryMonth(), null);
accountFund(insuranceAccountDetailPO, accountPO, baseParam.getSupplementaryMonth(), null);
accountOther(insuranceAccountDetailPO, accountPO, baseParam.getSupplementaryMonth());
}
@ -6184,11 +6343,11 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
if (accountPO.getSocial() != null) {
accountPO.getSocial().setSocialPaymentBaseString(baseParam.getSocialPaymentBaseString());
}
accountSocial(insuranceAccountDetailPO, accountPO, baseParam.getSupplementaryMonth());
accountSocial(insuranceAccountDetailPO, accountPO, baseParam.getSupplementaryMonth(), null);
} else if ("3".equals(baseParam.getSupplementType())) {
accountSupSocialByData(insuranceAccountDetailPO, baseParam);
} else {
accountSocial(insuranceAccountDetailPO, accountPO, baseParam.getSupplementaryMonth());
accountSocial(insuranceAccountDetailPO, accountPO, baseParam.getSupplementaryMonth(), null);
}
}
@ -6223,11 +6382,11 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
if (accountPO.getFund() != null) {
accountPO.getFund().setFundPaymentBaseString(baseParam.getFundPaymentBaseString());
}
accountFund(insuranceAccountDetailPO, accountPO, baseParam.getSupplementaryMonth());
accountFund(insuranceAccountDetailPO, accountPO, baseParam.getSupplementaryMonth(), null);
} else if ("3".equals(baseParam.getSupplementType())) {
accountSupFundByData(insuranceAccountDetailPO, baseParam);
} else {
accountFund(insuranceAccountDetailPO, accountPO, baseParam.getSupplementaryMonth());
accountFund(insuranceAccountDetailPO, accountPO, baseParam.getSupplementaryMonth(), null);
}
}
if (projects.contains(ProjectTypeEnum.OTHER.getValue())) {

View File

@ -39,12 +39,14 @@ import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.db.MapperProxyFactory;
import com.engine.salary.util.excel.ExcelUtil;
import com.engine.salary.util.excel.ExcelUtilPlus;
import org.apache.commons.lang3.math.NumberUtils;
import org.springframework.beans.BeanUtils;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.hrm.User;
import java.math.BigDecimal;
@ -459,7 +461,29 @@ public class SIExportServiceImpl extends Service implements SIExportService {
}
}
// 钱智 社保差异
final BigDecimal[] socialSpecialSum = {new BigDecimal(0)};
if (StringUtils.isNotEmpty(item.getSocialSpecialJson())) {
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);
BigDecimal specialSocialPerVal = new BigDecimal(0);
if (NumberUtils.isCreatable(standardSocialPer)) {
standardSocialPerVal = new BigDecimal(standardSocialPer);
}
if (v != null && NumberUtils.isCreatable(v.toString())) {
specialSocialPerVal = new BigDecimal(v.toString());
}
BigDecimal subtract = specialSocialPerVal.subtract(standardSocialPerVal);
socialSpecialSum[0] = socialSpecialSum[0].add(subtract);
record.put(k + "socialSpecial", subtract.toString());
});
}
}
record.put("socialPerSum", item.getSocialPerSum());
record.put("socialSpecialSum", socialSpecialSum[0]);
if (StringUtils.isNotEmpty(item.getFundPerJson())) {
Map<String, Object> fundPerJson = JSON.parseObject(item.getFundPerJson(), new HashMap<String, Object>().getClass());
if (fundPerJson != null) {
@ -469,7 +493,28 @@ public class SIExportServiceImpl extends Service implements SIExportService {
}
}
final BigDecimal[] fundSpecialSum = {new BigDecimal(0)};
if (StringUtils.isNotEmpty(item.getFundSpecialJson())) {
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);
BigDecimal specialFundPerVal = new BigDecimal(0);
if (NumberUtils.isCreatable(standardFundPer)) {
standardFundPerVal = new BigDecimal(standardFundPer);
}
if (v != null && NumberUtils.isCreatable(v.toString())) {
specialFundPerVal = new BigDecimal(v.toString());
}
BigDecimal subtract = specialFundPerVal.subtract(standardFundPerVal);
fundSpecialSum[0] = fundSpecialSum[0].add(subtract);
record.put(k + "fundSpecial", subtract.toString());
});
}
}
record.put("fundPerSum", item.getFundPerSum());
record.put("fundSpecialSum", fundSpecialSum[0]);
if (StringUtils.isNotEmpty(item.getOtherPerJson())) {
Map<String, Object> fundPerJson = JSON.parseObject(item.getOtherPerJson(), new HashMap<String, Object>().getClass());
if (fundPerJson != null) {
@ -674,12 +719,64 @@ public class SIExportServiceImpl extends Service implements SIExportService {
return result;
}
private Map<Integer, Map<String, String>> buildSpecialTitle(List<AccountExportPO> pos, Map<String, String> categoryIdNameMap) {
Set<String> socailIds = new HashSet<>();
Set<String> fundIds = new HashSet<>();
Map<Integer, Map<String, String>> result = new HashMap<>();
pos.stream().forEach(item -> {
if (StringUtils.isNotBlank(item.getSocialSpecialJson())) {
Map<String, String> socialSpecialJson = JSON.parseObject(item.getSocialSpecialJson(), new HashMap<String, String>().getClass());
if(socialSpecialJson!=null){
socialSpecialJson.forEach((k, v) -> {
socailIds.add(k);
});
}
}
if (StringUtils.isNotBlank(item.getFundSpecialJson())) {
Map<String, String> fundSpecialJson = JSON.parseObject(item.getFundSpecialJson(), new HashMap<String, String>().getClass());
if(fundSpecialJson!=null){
fundSpecialJson.forEach((k, v) -> {
fundIds.add(k);
});
}
}
});
Map<String, String> socialColumns = new HashMap<>();
Map<String, String> fundColumns = new HashMap<>();
socailIds.stream().forEach(social -> {
if (categoryIdNameMap.containsKey(social)) {
socialColumns.put(SalaryI18nUtil.getI18nLabel( 0, "个人额外-") + categoryIdNameMap.get(social) , social + "socialSpecial");
}
});
fundIds.stream().forEach(social -> {
if (categoryIdNameMap.containsKey(social)) {
fundColumns.put(SalaryI18nUtil.getI18nLabel( 0, "个人额外-") + categoryIdNameMap.get(social), social + "fundSpecial");
}
});
// map根据value排序
LinkedHashMap<String, String> socialColumnsWithAscValue = socialColumns.entrySet().stream()
.sorted(Map.Entry.comparingByValue())
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (oldValue, newValue) -> oldValue,
LinkedHashMap::new));
LinkedHashMap<String, String> fundColumnsWithAscValue = fundColumns.entrySet().stream()
.sorted(Map.Entry.comparingByValue())
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (oldValue, newValue) -> oldValue,
LinkedHashMap::new));
result.put(WelfareTypeEnum.SOCIAL_SECURITY.getValue(), socialColumnsWithAscValue);
result.put(WelfareTypeEnum.ACCUMULATION_FUND.getValue(), fundColumnsWithAscValue);
return result;
}
private List<WeaTableColumn> buildCommonColumns(List<AccountExportPO> pos, Integer paymentStatus) {
List<WeaTableColumn> list = new ArrayList<>();
Map<String, String> categoryIdNameMap = categoryIdNameMap();
Map<Integer, Map<String, String>> columns = buildPaymentTitle(pos, categoryIdNameMap);
Map<Integer, Map<String, String>> personColumns = buildPersonalTitle(pos, categoryIdNameMap);
Map<Integer, Map<String, String>> specialColumns = buildSpecialTitle(pos, categoryIdNameMap);
Map<Integer, Map<String, String>> comColumns = buildComTitle(pos, categoryIdNameMap);
list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(85429, "姓名"), "userName"));
list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(86185, "部门"), "department"));
@ -725,10 +822,22 @@ 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));
});

View File

@ -0,0 +1,49 @@
package com.engine.salary.service.impl;
import com.engine.core.impl.Service;
import com.engine.salary.entity.siaccount.po.UfTsrysjsbfldaPO;
import com.engine.salary.mapper.siaccount.UfTsrysjsbfldaMapper;
import com.engine.salary.service.UfTsrysjsbfldaService;
import com.engine.salary.util.db.MapperProxyFactory;
import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils;
import weaver.general.BaseBean;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author Harryxzy
* @ClassName UfTsrysjsbfldaServicePO
* @date 2025/01/20 11:22
* @description
*/
public class UfTsrysjsbfldaServiceImpl extends Service implements UfTsrysjsbfldaService {
private UfTsrysjsbfldaMapper getUfTsrysjsbfldaMapper (){
return MapperProxyFactory.getProxy(UfTsrysjsbfldaMapper.class);
}
@Override
public List<UfTsrysjsbfldaPO> listSome(UfTsrysjsbfldaPO param) {
return getUfTsrysjsbfldaMapper().listSome(param);
}
@Override
public List<UfTsrysjsbfldaPO> listByEmpIdsAndMonth(List<Long> empIds, String billMonth) {
if (CollectionUtils.isEmpty(empIds) || billMonth == null) {
return Collections.emptyList();
}
List<List<Long>> partition = Lists.partition(empIds, 100);
ArrayList<UfTsrysjsbfldaPO> resultList = new ArrayList<>();
partition.forEach(part -> {
List<Integer> ygs = part.stream().map(Long::intValue).collect(Collectors.toList());
resultList.addAll(listSome(UfTsrysjsbfldaPO.builder().toSxyf(billMonth).ygs(ygs).build()));
});
BaseBean baseBean = new BaseBean();
baseBean.writeLog("listByEmpIdsAndMonth"+billMonth + resultList.size());
return resultList;
}
}

View File

@ -438,9 +438,9 @@ public class SIAccountController {
@GET
@Path("/getWelfareList")
@Produces(MediaType.APPLICATION_JSON)
public String getWelfareList(@Context HttpServletRequest request, @Context HttpServletResponse response) {
public String getWelfareList(@Context HttpServletRequest request, @Context HttpServletResponse response, @QueryParam(value = "listType") Integer listType) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<String,List<InsuranceAcctDetailImportFieldDTO>>(user).run(getSalaryFormulaWrapper(user)::welfareList);
return new ResponseResult<Integer,List<InsuranceAcctDetailImportFieldDTO>>(user).run(getSalaryFormulaWrapper(user)::welfareList, listType);
}
/**

View File

@ -28,6 +28,7 @@ import com.engine.salary.util.JsonUtil;
import com.engine.salary.util.db.MapperProxyFactory;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.math.NumberUtils;
import weaver.hrm.User;
import weaver.servicefiles.DataSourceXML;
@ -107,14 +108,17 @@ public class SalaryFormulaWrapper extends Service {
/**
* 获取薪资项目中福利类项目
*/
public List<InsuranceAcctDetailImportFieldDTO> welfareList() {
public List<InsuranceAcctDetailImportFieldDTO> welfareList(Integer listType) {
List<InsuranceAcctDetailImportFieldDTO> welfareList = new ArrayList<>();
SalaryFormulaFieldQueryParam param = new SalaryFormulaFieldQueryParam();
param.setSourceId("welfare");
//获取福利类薪资项目
List<FormulaVar> list = getRemoteExcelService(user).fieldList(param.getSourceId(), param.getExtendParam());
list = list.stream().filter(f -> !(f.getName().contains("正常缴纳") || f.getName().contains("补缴") || f.getName().contains("补差") || f.getName().contains("申报基数"))).collect(Collectors.toList());
list = list.stream().filter(f -> !(f.getName().contains("正常缴纳") || f.getName().contains("补缴") || f.getName().contains("补差") || f.getName().contains("申报基数") || f.getName().contains("个人额外-社保合计") || f.getName().contains("个人额外-公积金合计"))).collect(Collectors.toList());
if (listType != null && listType.equals(NumberUtils.INTEGER_TWO)) {
list = list.stream().filter(f -> !(f.getName().contains("个人额外-"))).collect(Collectors.toList());
}
//提取出福利类项目名称
for (FormulaVar formulaVar : list) {
InsuranceAcctDetailImportFieldDTO insuranceAcctDetailImportFieldDTO = new InsuranceAcctDetailImportFieldDTO();
@ -146,8 +150,8 @@ public class SalaryFormulaWrapper extends Service {
*/
public List<InsuranceAcctDetailImportFieldDTO> balanceWelfareList() {
List<InsuranceAcctDetailImportFieldDTO> welfareList = welfareList();
welfareList = welfareList.stream().filter(f -> !f.getSalaryItemName().contains("合计")).collect(Collectors.toList());
List<InsuranceAcctDetailImportFieldDTO> welfareList = welfareList(null);
welfareList = welfareList.stream().filter(f -> !(f.getSalaryItemName().contains("合计") || f.getSalaryItemName().contains("个人额外-"))).collect(Collectors.toList());
List<ICategoryPO> noUseICategoryList= getICategoryMapper().listAll().stream().filter(f -> f.getIsUse() == 0).collect(Collectors.toList());
if (noUseICategoryList.size() > 0) {