中航富士达二开

This commit is contained in:
Harryxzy 2024-12-23 15:46:44 +08:00
parent 7b82b570e4
commit 20063639fd
10 changed files with 809 additions and 8 deletions

View File

@ -48,7 +48,15 @@ public class InsuranceArchivesEmployeePO {
private String subcompanyName;
private BigDecimal position;
/**
* 岗位
*/
private Long position;
/**
* 职务岗位类别
*/
private Long jobactivityid;
private Integer userStatus;
@ -66,6 +74,15 @@ public class InsuranceArchivesEmployeePO {
*/
private String dimissionDate;
/**
* 司龄
*/
private BigDecimal companyworkyear;
/**
* 职务岗位类别
*/
private Long siSchemeId;
private Long fundSchemeId;

View File

@ -0,0 +1,38 @@
package com.engine.salary.entity.siarchives.po;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
import java.util.Collection;
/**
* @author Harryxzy
* @ClassName UfHrSbjsgzbPO
* @date 2024/12/20 10:01
* @description 社保基数规则表
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class UfHrSbjsgzbPO {
private BigDecimal gjjjs;
private Integer glsx;
private Integer glxx;
private BigDecimal gongshangjs;
private String gw;
private String gwfl;
private Integer gzbs;
private Integer id;
private BigDecimal shengyujs;
private BigDecimal shiyejs;
private BigDecimal yanglaojs;
private BigDecimal yiliaojs;
//主键id集合
private Collection<Long> ids;
}

View File

@ -365,12 +365,15 @@
other.id AS otherId,
e.companystartdate as companystartdate,
e.enddate as dismissdate,
c.subcompanyname as subcompanyName
c.subcompanyname as subcompanyName,
t.JOBACTIVITYID as jobactivityid,
e.companyworkyear as companyworkyear
FROM hrsa_insurance_base_info base
LEFT JOIN hrmresource e ON base.employee_id = e.id
LEFT JOIN hrmdepartment d ON e.departmentid = d.ID
LEFT JOIN hrmsubcompany c ON c.id = e.subcompanyid1
LEFT JOIN hrmjobtitles t ON t.id = e.JOBTITLE
LEFT JOIN( SELECT social.id, social.employee_id, social.social_scheme_id AS siSchemeId, social.payment_organization FROM hrsa_social_archives social WHERE social.delete_type = 0 )social ON e.id = social.employee_id AND base.payment_organization = social.payment_organization
LEFT JOIN( SELECT fund.id, fund.employee_id, fund.fund_scheme_id AS fundSchemeId, fund.payment_organization FROM hrsa_fund_archives fund WHERE fund.delete_type = 0 )fund ON e.id = fund.employee_id AND base.payment_organization = fund.payment_organization
LEFT JOIN( SELECT other.id, other.employee_id, other.other_scheme_id AS otherSchemeId, other.payment_organization FROM hrsa_other_archives other WHERE other.delete_type = 0 )other ON e.id = other.employee_id AND base.payment_organization = other.payment_organization

View File

@ -0,0 +1,62 @@
package com.engine.salary.mapper.siarchives;
import com.engine.salary.entity.siarchives.po.UfHrSbjsgzbPO;
import java.util.List;
/**
* @author Harryxzy
* @ClassName UfHrSbjsgzbMapper
* @date 2024/12/20 10:17
* @description
*/
public interface UfHrSbjsgzbMapper {
/**
* 查询所有记录
*
* @return 返回集合没有返回空List
*/
List<UfHrSbjsgzbPO> listAll();
/**
* 条件查询
*
* @return 返回集合没有返回空List
*/
List<UfHrSbjsgzbPO> listSome(UfHrSbjsgzbPO ufHrSbjsgzb);
/**
* 根据主键查询
*
* @param id 主键
* @return 返回记录没有返回null
*/
UfHrSbjsgzbPO getById(Integer id);
/**
* 新增忽略null字段
*
* @param ufHrSbjsgzb 新增的记录
* @return 返回影响行数
*/
int insertIgnoreNull(UfHrSbjsgzbPO ufHrSbjsgzb);
/**
* 修改修改所有字段
*
* @param ufHrSbjsgzb 修改的记录
* @return 返回影响行数
*/
int update(UfHrSbjsgzbPO ufHrSbjsgzb);
/**
* 修改忽略null字段
*
* @param ufHrSbjsgzb 修改的记录
* @return 返回影响行数
*/
int updateIgnoreNull(UfHrSbjsgzbPO ufHrSbjsgzb);
}

View File

@ -0,0 +1,238 @@
<?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.siarchives.UfHrSbjsgzbMapper">
<resultMap id="BaseResultMap" type="com.engine.salary.entity.siarchives.po.UfHrSbjsgzbPO">
<result column="gjjjs" property="gjjjs" />
<result column="glsx" property="glsx" />
<result column="glxx" property="glxx" />
<result column="gongshangjs" property="gongshangjs" />
<result column="gw" property="gw" />
<result column="gwfl" property="gwfl" />
<result column="gzbs" property="gzbs" />
<result column="id" property="id" />
<result column="shengyujs" property="shengyujs" />
<result column="shiyejs" property="shiyejs" />
<result column="yanglaojs" property="yanglaojs" />
<result column="yiliaojs" property="yiliaojs" />
</resultMap>
<!-- 表字段 -->
<sql id="baseColumns">
t.gjjjs
, t.glsx
, t.glxx
, t.gongshangjs
, t.gw
, t.gwfl
, t.gzbs
, t.id
, t.shengyujs
, t.shiyejs
, t.yanglaojs
, t.yiliaojs
</sql>
<!-- 查询全部 -->
<select id="listAll" resultMap="BaseResultMap">
SELECT
<include refid="baseColumns" />
FROM uf_hr_sbjsgzb t
</select>
<!-- 根据主键获取单条记录 -->
<select id="getById" resultMap="BaseResultMap" parameterType="Integer">
SELECT
<include refid="baseColumns" />
FROM uf_hr_sbjsgzb t
WHERE id = #{id}
</select>
<!-- 条件查询 -->
<select id="listSome" resultMap="BaseResultMap" parameterType="com.engine.salary.entity.siarchives.po.UfHrSbjsgzbPO">
SELECT
<include refid="baseColumns" />
FROM uf_hr_sbjsgzb t
WHERE 1 = 1
<if test="gjjjs != null">
AND gjjjs = #{gjjjs}
</if>
<if test="glsx != null">
AND glsx = #{glsx}
</if>
<if test="glxx != null">
AND glxx = #{glxx}
</if>
<if test="gongshangjs != null">
AND gongshangjs = #{gongshangjs}
</if>
<if test="gw != null">
AND gw = #{gw}
</if>
<if test="gwfl != null">
AND gwfl = #{gwfl}
</if>
<if test="gzbs != null">
AND gzbs = #{gzbs}
</if>
<if test="shengyujs != null">
AND shengyujs = #{shengyujs}
</if>
<if test="shiyejs != null">
AND shiyejs = #{shiyejs}
</if>
<if test="yanglaojs != null">
AND yanglaojs = #{yanglaojs}
</if>
<if test="yiliaojs != null">
AND yiliaojs = #{yiliaojs}
</if>
<if test="ids != null and ids.size()>0">
AND id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</if>
ORDER BY id DESC
</select>
<!-- 插入不为NULL的字段 -->
<insert id="insertIgnoreNull" parameterType="com.engine.salary.entity.siarchives.po.UfHrSbjsgzbPO">
INSERT INTO uf_hr_sbjsgzb
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="gjjjs != null">
gjjjs,
</if>
<if test="glsx != null">
glsx,
</if>
<if test="glxx != null">
glxx,
</if>
<if test="gongshangjs != null">
gongshangjs,
</if>
<if test="gw != null">
gw,
</if>
<if test="gwfl != null">
gwfl,
</if>
<if test="gzbs != null">
gzbs,
</if>
<if test="shengyujs != null">
shengyujs,
</if>
<if test="shiyejs != null">
shiyejs,
</if>
<if test="yanglaojs != null">
yanglaojs,
</if>
<if test="yiliaojs != null">
yiliaojs,
</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="gjjjs != null" >
#{gjjjs},
</if>
<if test="glsx != null" >
#{glsx},
</if>
<if test="glxx != null" >
#{glxx},
</if>
<if test="gongshangjs != null" >
#{gongshangjs},
</if>
<if test="gw != null" >
#{gw},
</if>
<if test="gwfl != null" >
#{gwfl},
</if>
<if test="gzbs != null" >
#{gzbs},
</if>
<if test="shengyujs != null" >
#{shengyujs},
</if>
<if test="shiyejs != null" >
#{shiyejs},
</if>
<if test="yanglaojs != null" >
#{yanglaojs},
</if>
<if test="yiliaojs != null" >
#{yiliaojs},
</if>
</trim>
</insert>
<!-- 更新,更新全部字段 -->
<update id="update" parameterType="com.engine.salary.entity.siarchives.po.UfHrSbjsgzbPO">
UPDATE uf_hr_sbjsgzb
<set>
gjjjs=#{gjjjs},
glsx=#{glsx},
glxx=#{glxx},
gongshangjs=#{gongshangjs},
gw=#{gw},
gwfl=#{gwfl},
gzbs=#{gzbs},
shengyujs=#{shengyujs},
shiyejs=#{shiyejs},
yanglaojs=#{yanglaojs},
yiliaojs=#{yiliaojs},
</set>
WHERE id = #{id}
</update>
<!-- 更新不为NULL的字段 -->
<update id="updateIgnoreNull" parameterType="com.engine.salary.entity.siarchives.po.UfHrSbjsgzbPO">
UPDATE uf_hr_sbjsgzb
<set>
<if test="gjjjs != null" >
gjjjs=#{gjjjs},
</if>
<if test="glsx != null" >
glsx=#{glsx},
</if>
<if test="glxx != null" >
glxx=#{glxx},
</if>
<if test="gongshangjs != null" >
gongshangjs=#{gongshangjs},
</if>
<if test="gw != null" >
gw=#{gw},
</if>
<if test="gwfl != null" >
gwfl=#{gwfl},
</if>
<if test="gzbs != null" >
gzbs=#{gzbs},
</if>
<if test="shengyujs != null" >
shengyujs=#{shengyujs},
</if>
<if test="shiyejs != null" >
shiyejs=#{shiyejs},
</if>
<if test="yanglaojs != null" >
yanglaojs=#{yanglaojs},
</if>
<if test="yiliaojs != null" >
yiliaojs=#{yiliaojs},
</if>
</set>
WHERE id = #{id}
</update>
</mapper>

View File

@ -27,6 +27,9 @@ public interface SIArchivesService {
Map<String, Object> getPaymentForm(Map<String, Object> params);
UfHrSbjsgzbPO getGzByEmp(InsuranceArchivesEmployeePO archiveEmp, Map<Long, UfHrSbjsgzbPO> gwGzMap, Map<Long, List<UfHrSbjsgzbPO>> gwflGzMap, List<UfHrSbjsgzbPO> glGzList);
String insert(InsuranceArchivesSaveParam param);
Map<String, Object> listPage(InsuranceArchivesListParam insuranceArchivesListParam);

View File

@ -0,0 +1,54 @@
package com.engine.salary.service;
import com.engine.salary.entity.siarchives.po.UfHrSbjsgzbPO;
import java.util.List;
/**
* @author Harryxzy
* @ClassName UfHrSbjsgzbService
* @date 2024/12/20 10:03
* @description 社保基数规则
*/
public interface UfHrSbjsgzbService {
/**
* 查询所有记录
*
* @return 返回集合没有返回空List
*/
List<UfHrSbjsgzbPO> listAll();
/**
* 根据主键查询
*
* @param id 主键
* @return 返回记录没有返回null
*/
UfHrSbjsgzbPO getById(Integer id);
/**
* 新增忽略null字段
*
* @param ufHrSbjsgzb 新增的记录
* @return 返回影响行数
*/
int insertIgnoreNull(UfHrSbjsgzbPO ufHrSbjsgzb);
/**
* 修改修改所有字段
*
* @param ufHrSbjsgzb 修改的记录
* @return 返回影响行数
*/
int update(UfHrSbjsgzbPO ufHrSbjsgzb);
/**
* 修改忽略null字段
*
* @param ufHrSbjsgzb 修改的记录
* @return 返回影响行数
*/
int updateIgnoreNull(UfHrSbjsgzbPO ufHrSbjsgzb);
}

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;
@ -173,6 +174,9 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
return MapperProxyFactory.getProxy(ICategoryMapper.class);
}
private UfHrSbjsgzbService getUfHrSbjsgzbService(User user) {
return ServiceUtil.getService(UfHrSbjsgzbServiceImpl.class, user);
}
@Override
public Map<String, Object> getTips(Map<String, Object> params) {
@ -204,12 +208,13 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
Long employeeId = Long.valueOf(Util.null2String(params.get("employeeId")));
String schemeIdStr = Util.null2String(params.get("schemeId"));
Long paymentOrganization = Long.valueOf(Util.null2String(params.get("paymentOrganization")));
boolean changeScheme = Util.null2String(params.get("changeScheme")).equals("true");
Long schemeId = null;
if (StringUtils.isNotBlank(schemeIdStr)) {
schemeId = Long.valueOf(schemeIdStr);
}
// apidatas = siArchivesBiz.getPaymentForm(user, welfareTypeEnum, employeeId, (long) user.getUID(), schemeId, paymentOrganization);
apidatas = getPaymentForm(user, welfareTypeEnum, employeeId, schemeId, paymentOrganization);
apidatas = getPaymentForm(user, welfareTypeEnum, employeeId, schemeId, paymentOrganization, changeScheme);
return apidatas;
}
@ -2572,7 +2577,7 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
* @param schemeId
* @return
*/
public Map<String, Object> getPaymentForm(User user, WelfareTypeEnum welfareType, Long employeeId, Long schemeId, Long paymentOrganization) {
public Map<String, Object> getPaymentForm(User user, WelfareTypeEnum welfareType, Long employeeId, Long schemeId, Long paymentOrganization, boolean changeScheme) {
Map<String, Object> data = new HashMap<>(16);
//判断是否要区分个人和单位福利基数
SalarySysConfPO welBaseDiff = getSalarySysConfService(user).getOneByCode(WEL_BASE_DIFF_BY_PER_AND_COM);
@ -2581,12 +2586,43 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
SalarySysConfPO welBaseAutoAdjust = getSalarySysConfService(user).getOneByCode(WEL_BASE_AUTO_ADJUST);
boolean welBaseAutoAdjustSign = welBaseAutoAdjust != null && welBaseAutoAdjust.getConfValue().equals(OpenEnum.OPEN.getValue());
// 根据员工获取社保规则
InsuranceArchivesListParam archivesListParam = InsuranceArchivesListParam.builder().taxAgentId(paymentOrganization).employeeIds(Collections.singletonList(employeeId)).build();
List<InsuranceArchivesEmployeePO> archiveEmp = getSocialSchemeMapper().queryEmployeeList(archivesListParam);
// 获取建模基数信息
List<UfHrSbjsgzbPO> ufHrSbjsgzbList = getUfHrSbjsgzbService(user).listAll();
// 岗位规则
Map<Long, UfHrSbjsgzbPO> gwGzMap = new HashMap<>();
// 岗位分类规则
Map<Long, List<UfHrSbjsgzbPO>> gwflGzMap = new HashMap<>();
// 工龄规则
List<UfHrSbjsgzbPO> glGzList = new ArrayList<>();
for (UfHrSbjsgzbPO po : ufHrSbjsgzbList) {
if (StringUtils.isNotBlank(po.getGw())) {
// 岗位不为空
Arrays.stream(po.getGw().split(","))
.map(Long::valueOf)
.forEach(gw -> {
gwGzMap.put(Long.valueOf(gw), po);
});
} else if (NumberUtils.isCreatable(po.getGwfl())) {
// 岗位分类职务不为空
List<UfHrSbjsgzbPO> list = gwflGzMap.computeIfAbsent(Long.valueOf(NumberUtils.isCreatable(po.getGwfl()) ? po.getGwfl() : "0"), k -> new ArrayList<>());
list.add(po);
gwflGzMap.put(Long.valueOf(po.getGwfl()), list);
} else {
// 剩余根据工龄匹配
glGzList.add(po);
}
}
UfHrSbjsgzbPO sbjsgzPO = getGzByEmp(CollectionUtils.isEmpty(archiveEmp) ? null : archiveEmp.get(0), gwGzMap, gwflGzMap, glGzList);
switch (welfareType) {
case SOCIAL_SECURITY:
data = buildSocialPaymentForm(user, employeeId, schemeId,welfareType.getValue(), paymentOrganization, welBaseDiffSign, welBaseAutoAdjustSign);
data = buildSocialPaymentForm(user, employeeId, schemeId,welfareType.getValue(), paymentOrganization, welBaseDiffSign, welBaseAutoAdjustSign, changeScheme, sbjsgzPO);
break;
case ACCUMULATION_FUND:
data = buildFundPaymentForm(user, employeeId, schemeId, welfareType.getValue(), paymentOrganization, welBaseDiffSign, welBaseAutoAdjustSign);
data = buildFundPaymentForm(user, employeeId, schemeId, welfareType.getValue(), paymentOrganization, welBaseDiffSign, welBaseAutoAdjustSign, changeScheme, sbjsgzPO);
break;
case OTHER:
data = buildOtherPaymentForm(user, employeeId, schemeId, welfareType.getValue(), paymentOrganization, welBaseDiffSign, welBaseAutoAdjustSign);
@ -2596,6 +2632,43 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
return data;
}
/**
* 中航富士达 根据员工确定社保基数规则
* @param archiveEmp
* @param gwGzMap
* @param gwflGzMap
* @param glGzList
* @return
*/
public UfHrSbjsgzbPO getGzByEmp(InsuranceArchivesEmployeePO archiveEmp, Map<Long, UfHrSbjsgzbPO> gwGzMap, Map<Long, List<UfHrSbjsgzbPO>> gwflGzMap, List<UfHrSbjsgzbPO> glGzList) {
if (archiveEmp == null) {
return null;
}
if (gwGzMap.keySet().contains(archiveEmp.getPosition())) {
// 1匹配岗位
return gwGzMap.get(archiveEmp.getPosition());
} else if (gwflGzMap.keySet().contains(archiveEmp.getJobactivityid())) {
// 2匹配职务岗位分类
List<UfHrSbjsgzbPO> poList = gwflGzMap.get(archiveEmp.getJobactivityid());
if (CollectionUtils.isNotEmpty(poList)) {
// 根据司龄过滤
List<UfHrSbjsgzbPO> collect = poList.stream().filter(po -> {
double companyWorkYear = archiveEmp.getCompanyworkyear().doubleValue();
return companyWorkYear > po.getGlxx() && companyWorkYear <= po.getGlsx();
}).collect(Collectors.toList());
return CollectionUtils.isNotEmpty(collect) ? null : collect.get(0);
}
} else {
// 3以上都不匹配根据司龄匹配
double companyWorkYear = archiveEmp.getCompanyworkyear().doubleValue();
List<UfHrSbjsgzbPO> collect = glGzList.stream().filter(po -> {
return companyWorkYear > po.getGlxx() && companyWorkYear <= po.getGlsx();
}).collect(Collectors.toList());
return CollectionUtils.isEmpty(collect) ? null : collect.get(0);
}
return null;
}
/**
* 其他payForm
*
@ -2654,7 +2727,10 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
* @param schemeId
* @return
*/
public Map<String, Object> buildFundPaymentForm(User user, Long employeeId, Long schemeId, Integer welfareType, Long paymentOrganization, boolean welBaseDiffSign, boolean welBaseAutoAdjustSign) {
public Map<String, Object> buildFundPaymentForm(User user, Long employeeId, Long schemeId, Integer welfareType,
Long paymentOrganization, boolean welBaseDiffSign,
boolean welBaseAutoAdjustSign, boolean changeScheme,
UfHrSbjsgzbPO gzPO) {
Map<String, Object> dataMap = new HashMap<>();
InsuranceArchivesFundSchemeDTO data = buildFundForm(employeeId, paymentOrganization);
@ -2678,6 +2754,11 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
String basicValue = welBaseAutoAdjustSign ? ("0.000".equals(item.getMin()) ? "0" : item.getMin()) : "0";
insuranceValueMap.put(insuranceId, basicValue);
}
if (changeScheme) {
if (insuranceId.equals("9006")) {
insuranceValueMap.put("9006",Util.null2String(gzPO.getGjjjs()));
}
}
}
dataMap.put("data", insuranceValueMap);
addGroups.add(new SearchConditionGroup(SalaryI18nUtil.getI18nLabel(0, "公积金缴纳基数"), true, inputItems));
@ -2694,6 +2775,11 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
String basicValue = welBaseAutoAdjustSign ? ("0.000".equals(item.getMin()) ? "0" : item.getMin()) : "0";
insuranceComValueMap.put(insuranceId, basicValue);
}
if (changeScheme) {
if (insuranceId.equals("9006")) {
insuranceComValueMap.put("9006",Util.null2String(gzPO.getGjjjs()));
}
}
}
dataMap.put("comData", insuranceComValueMap);
}
@ -2707,7 +2793,10 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
* @param schemeId
* @return
*/
public Map<String, Object> buildSocialPaymentForm(User user, Long employeeId, Long schemeId, Integer welfareType, Long paymentOrganization, boolean welBaseDiffSign, boolean welBaseAutoAdjustSign) {
public Map<String, Object> buildSocialPaymentForm(User user, Long employeeId, Long schemeId, Integer welfareType,
Long paymentOrganization, boolean welBaseDiffSign,
boolean welBaseAutoAdjustSign, boolean changeScheme,
UfHrSbjsgzbPO gzPO) {
Map<String, Object> dataMap = new HashMap<>();
InsuranceArchivesSocialSchemeDTO data = buildSocialForm(employeeId, paymentOrganization);
Map<String, Object> insuranceValueMap = new HashMap<>();
@ -2730,6 +2819,19 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
String basicValue = welBaseAutoAdjustSign ? ("0.000".equals(item.getMin()) ? "0" : item.getMin()) : "0";
insuranceValueMap.put(insuranceId, basicValue);
}
if (changeScheme) {
if (insuranceId.equals("9001")) {
insuranceValueMap.put("9001",Util.null2String(gzPO.getYanglaojs()));
} else if (insuranceId.equals("9002")) {
insuranceValueMap.put("9002",Util.null2String(gzPO.getYiliaojs()));
} else if (insuranceId.equals("9003")) {
insuranceValueMap.put("9003",Util.null2String(gzPO.getGongshangjs()));
} else if (insuranceId.equals("9004")) {
insuranceValueMap.put("9004",Util.null2String(gzPO.getShiyejs()));
} else if (insuranceId.equals("9005")) {
insuranceValueMap.put("9005",Util.null2String(gzPO.getShengyujs()));
}
}
}
dataMap.put("data", insuranceValueMap);
addGroups.add(new SearchConditionGroup(SalaryI18nUtil.getI18nLabel(0, "社保缴纳基数"), true, inputItems));
@ -2746,6 +2848,19 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
String basicValue = welBaseAutoAdjustSign ? ("0.000".equals(item.getMin()) ? "0" : item.getMin()) : "0";
insuranceComValueMap.put(insuranceId, basicValue);
}
if (changeScheme) {
if (insuranceId.equals("9001")) {
insuranceComValueMap.put("9001",Util.null2String(gzPO.getYanglaojs()));
} else if (insuranceId.equals("9002")) {
insuranceComValueMap.put("9002",Util.null2String(gzPO.getYiliaojs()));
} else if (insuranceId.equals("9003")) {
insuranceComValueMap.put("9003",Util.null2String(gzPO.getGongshangjs()));
} else if (insuranceId.equals("9004")) {
insuranceComValueMap.put("9004",Util.null2String(gzPO.getShiyejs()));
} else if (insuranceId.equals("9005")) {
insuranceComValueMap.put("9005",Util.null2String(gzPO.getShengyujs()));
}
}
}
dataMap.put("comData", insuranceComValueMap);
}

View File

@ -0,0 +1,72 @@
package com.engine.salary.service.impl;
import com.engine.core.impl.Service;
import com.engine.salary.entity.siarchives.po.UfHrSbjsgzbPO;
import com.engine.salary.mapper.siarchives.UfHrSbjsgzbMapper;
import com.engine.salary.service.UfHrSbjsgzbService;
import com.engine.salary.util.db.MapperProxyFactory;
import java.util.List;
/**
* @author Harryxzy
* @ClassName UfHrSbjsgzbService
* @date 2024/12/20 10:06
* @description
*/
public class UfHrSbjsgzbServiceImpl extends Service implements UfHrSbjsgzbService {
private UfHrSbjsgzbMapper getUfHrSbjsgzbMapper(){
return MapperProxyFactory.getProxy(UfHrSbjsgzbMapper.class);
}
/**
* 查询所有记录
*
* @return 返回集合没有返回空List
*/
public List<UfHrSbjsgzbPO> listAll() {
return getUfHrSbjsgzbMapper().listAll();
}
/**
* 根据主键查询
*
* @param id 主键
* @return 返回记录没有返回null
*/
public UfHrSbjsgzbPO getById(Integer id) {
return getUfHrSbjsgzbMapper().getById(id);
}
/**
* 新增忽略null字段
*
* @param ufHrSbjsgzb 新增的记录
* @return 返回影响行数
*/
public int insertIgnoreNull(UfHrSbjsgzbPO ufHrSbjsgzb) {
return getUfHrSbjsgzbMapper().insertIgnoreNull(ufHrSbjsgzb);
}
/**
* 修改修改所有字段
*
* @param ufHrSbjsgzb 修改的记录
* @return 返回影响行数
*/
public int update(UfHrSbjsgzbPO ufHrSbjsgzb) {
return getUfHrSbjsgzbMapper().update(ufHrSbjsgzb);
}
/**
* 修改忽略null字段
*
* @param ufHrSbjsgzb 修改的记录
* @return 返回影响行数
*/
public int updateIgnoreNull(UfHrSbjsgzbPO ufHrSbjsgzb) {
return getUfHrSbjsgzbMapper().updateIgnoreNull(ufHrSbjsgzb);
}
}

View File

@ -0,0 +1,199 @@
package com.engine.salary.timer;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import com.engine.common.util.ServiceUtil;
import com.engine.salary.encrypt.EncryptUtil;
import com.engine.salary.entity.siarchives.param.InsuranceArchivesListParam;
import com.engine.salary.entity.siarchives.po.InsuranceArchivesEmployeePO;
import com.engine.salary.entity.siarchives.po.InsuranceArchivesFundSchemePO;
import com.engine.salary.entity.siarchives.po.InsuranceArchivesSocialSchemePO;
import com.engine.salary.entity.siarchives.po.UfHrSbjsgzbPO;
import com.engine.salary.enums.siaccount.EmployeeStatusEnum;
import com.engine.salary.mapper.siarchives.FundSchemeMapper;
import com.engine.salary.mapper.siarchives.SocialSchemeMapper;
import com.engine.salary.service.SIArchivesService;
import com.engine.salary.service.UfHrSbjsgzbService;
import com.engine.salary.service.impl.SIArchivesServiceImpl;
import com.engine.salary.service.impl.UfHrSbjsgzbServiceImpl;
import com.engine.salary.sys.entity.po.SalarySysConfPO;
import com.engine.salary.sys.enums.OpenEnum;
import com.engine.salary.sys.service.SalarySysConfService;
import com.engine.salary.sys.service.impl.SalarySysConfServiceImpl;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.db.MapperProxyFactory;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.interfaces.schedule.BaseCronJob;
import java.util.*;
import java.util.stream.Collectors;
import static com.engine.salary.sys.constant.SalarySysConstant.WEL_BASE_DIFF_BY_PER_AND_COM;
/**
* @ClassName SyncSIBaseJob
* @author Harryxzy
* @date 2024/12/20 9:55
* @description 中航富士达 设置员工社保福利档案基数
*/
@Slf4j
public class SyncSIBaseJob extends BaseCronJob {
private UfHrSbjsgzbService getUfHrSbjsgzbService(User user) {
return ServiceUtil.getService(UfHrSbjsgzbServiceImpl.class, user);
}
private SocialSchemeMapper getSocialSchemeMapper() {
return MapperProxyFactory.getProxy(SocialSchemeMapper.class);
}
public SIArchivesService getSIArchivesService(User user) {
return ServiceUtil.getService(SIArchivesServiceImpl.class,user);
}
private SalarySysConfService getSalarySysConfService(User user) {
return ServiceUtil.getService(SalarySysConfServiceImpl.class, user);
}
private FundSchemeMapper getFundSchemeMapper() {
return MapperProxyFactory.getProxy(FundSchemeMapper.class);
}
@Override
public void execute() {
User user = new User();
user.setUid(1);
EncryptUtil encryptUtil = new EncryptUtil();
// 获取建模基数信息
List<UfHrSbjsgzbPO> ufHrSbjsgzbList = getUfHrSbjsgzbService(user).listAll();
// 岗位规则
Map<Long, UfHrSbjsgzbPO> gwGzMap = new HashMap<>();
// 岗位分类规则
Map<Long, List<UfHrSbjsgzbPO>> gwflGzMap = new HashMap<>();
// 工龄规则
List<UfHrSbjsgzbPO> glGzList = new ArrayList<>();
for (UfHrSbjsgzbPO po : ufHrSbjsgzbList) {
if (StringUtils.isNotBlank(po.getGw())) {
// 岗位不为空
Arrays.stream(po.getGw().split(","))
.map(Long::valueOf)
.forEach(gw -> {
gwGzMap.put(Long.valueOf(gw), po);
});
} else if (NumberUtils.isCreatable(po.getGwfl())) {
// 岗位分类职务不为空
List<UfHrSbjsgzbPO> list = gwflGzMap.computeIfAbsent(Long.valueOf(NumberUtils.isCreatable(po.getGwfl()) ? po.getGwfl() : "0"), k -> new ArrayList<>());
list.add(po);
gwflGzMap.put(Long.valueOf(po.getGwfl()), list);
} else {
// 剩余根据工龄匹配
glGzList.add(po);
}
}
// 获取社保福利档案信息只获取在缴待减员数据
List<String> statusList = Arrays.asList(EmployeeStatusEnum.PAYING.getValue(), EmployeeStatusEnum.STAY_DEL.getValue());
InsuranceArchivesListParam archivesListParam = InsuranceArchivesListParam.builder().runStatuses(statusList).build();
List<InsuranceArchivesEmployeePO> insuranceArchivesEmployeePOS = getSocialSchemeMapper().queryEmployeeList(archivesListParam);
// 获取这些人的社保具体数据
List<Long> socialIdList = insuranceArchivesEmployeePOS.stream().map(InsuranceArchivesEmployeePO::getSocialId).collect(Collectors.toList());
List<InsuranceArchivesSocialSchemePO> socialArchiveList = getSIArchivesService(user).listInsuranceArchivesSocialSchemeByIds(socialIdList);
encryptUtil.decryptList(socialArchiveList, InsuranceArchivesSocialSchemePO.class);
Map<Long, InsuranceArchivesSocialSchemePO> socialArchiveMap = SalaryEntityUtil.convert2Map(socialArchiveList, InsuranceArchivesSocialSchemePO::getId);
// 获取这些人的公积金具体数据
List<Long> fundIdList = insuranceArchivesEmployeePOS.stream().map(InsuranceArchivesEmployeePO::getFundId).collect(Collectors.toList());
List<InsuranceArchivesFundSchemePO> fundArchiveList = getSIArchivesService(user).listInsuranceArchivesFundSchemeByIds(fundIdList);
encryptUtil.decryptList(fundArchiveList, InsuranceArchivesFundSchemePO.class);
Map<Long, InsuranceArchivesFundSchemePO> fundArchiveMap = SalaryEntityUtil.convert2Map(fundArchiveList, InsuranceArchivesFundSchemePO::getId);
//判断是否要区分个人和单位福利基数
SalarySysConfPO welBaseDiff = getSalarySysConfService(user).getOneByCode(WEL_BASE_DIFF_BY_PER_AND_COM);
boolean welBaseDiffSign = welBaseDiff != null && welBaseDiff.getConfValue().equals(OpenEnum.OPEN.getValue());
insuranceArchivesEmployeePOS.stream().forEach(archiveEmp -> {
// 确定唯一规则
UfHrSbjsgzbPO gzPO = getSIArchivesService(user).getGzByEmp(archiveEmp, gwGzMap, gwflGzMap, glGzList);
// 处理社保数据
InsuranceArchivesSocialSchemePO socialArchive = socialArchiveMap.get(archiveEmp.getSocialId());
if (socialArchive != null && socialArchive.getSocialSchemeId() != null && gzPO != null) {
Map<String, Object> socialJson = JSON.parseObject(socialArchive.getSocialPaymentBaseString(), new TypeReference<Map<String, Object>>() {
});
if (socialJson != null) {
for (Map.Entry<String, Object> entry : socialJson.entrySet()) {
if (entry.getKey().equals("9001")) {
socialJson.put("9001",Util.null2String(gzPO.getYanglaojs()));
} else if (entry.getKey().equals("9002")) {
socialJson.put("9002",Util.null2String(gzPO.getYiliaojs()));
} else if (entry.getKey().equals("9003")) {
socialJson.put("9003",Util.null2String(gzPO.getGongshangjs()));
} else if (entry.getKey().equals("9004")) {
socialJson.put("9004",Util.null2String(gzPO.getShiyejs()));
} else if (entry.getKey().equals("9005")) {
socialJson.put("9005",Util.null2String(gzPO.getShengyujs()));
}
}
socialArchive.setSocialPaymentBaseString(JSON.toJSONString(socialJson));
}
//如果需要区分个人和公司福利基数
if (welBaseDiffSign) {
Map<String, Object> socialComJson = JSON.parseObject(socialArchive.getSocialPaymentComBaseString(), new TypeReference<Map<String, Object>>() {
});
if (socialComJson != null) {
for (Map.Entry<String, Object> entry : socialComJson.entrySet()) {
if (entry.getKey().equals("9001")) {
socialComJson.put("9001",Util.null2String(gzPO.getYanglaojs()));
} else if (entry.getKey().equals("9002")) {
socialComJson.put("9002",Util.null2String(gzPO.getYiliaojs()));
} else if (entry.getKey().equals("9003")) {
socialComJson.put("9003",Util.null2String(gzPO.getGongshangjs()));
} else if (entry.getKey().equals("9004")) {
socialComJson.put("9004",Util.null2String(gzPO.getShiyejs()));
} else if (entry.getKey().equals("9005")) {
socialComJson.put("9005",Util.null2String(gzPO.getShengyujs()));
}
}
socialArchive.setSocialPaymentComBaseString(JSON.toJSONString(socialComJson));
}
}
// 更新(加密)
encryptUtil.encrypt(socialArchive, InsuranceArchivesSocialSchemePO.class);
getSocialSchemeMapper().updateById(socialArchive);
}
// 处理公积金数据
InsuranceArchivesFundSchemePO fundArchive = fundArchiveMap.get(archiveEmp.getFundId());
if (fundArchive != null && fundArchive.getFundSchemeId() != null && gzPO != null) {
Map<String, Object> fundJson = JSON.parseObject(fundArchive.getFundPaymentBaseString(), new TypeReference<Map<String, Object>>() {
});
if (fundJson != null) {
for (Map.Entry<String, Object> entry : fundJson.entrySet()) {
if (entry.getKey().equals("9006")) {
fundJson.put("9006", Util.null2String(gzPO.getGjjjs()));
}
}
fundArchive.setFundPaymentBaseString(JSON.toJSONString(fundJson));
}
//如果需要区分个人和公司福利基数
if (welBaseDiffSign) {
Map<String, Object> fundComJson = JSON.parseObject(fundArchive.getFundPaymentComBaseString(), new TypeReference<Map<String, Object>>() {
});
if (fundComJson != null) {
for (Map.Entry<String, Object> entry : fundComJson.entrySet()) {
if (entry.getKey().equals("9006")) {
fundComJson.put("9006",Util.null2String(gzPO.getGjjjs()));
}
}
fundArchive.setFundPaymentComBaseString(JSON.toJSONString(fundComJson));
}
}
// 更新(加密)
encryptUtil.encrypt(fundArchive, InsuranceArchivesFundSchemePO.class);
getFundSchemeMapper().updateById(fundArchive);
}
});
}
}