薪酬系统-福利档案,福利档案导入逻辑中增加基数调整记录
This commit is contained in:
parent
855effccc5
commit
e80a3497d9
|
|
@ -18,10 +18,7 @@ import com.engine.salary.encrypt.AESEncryptUtil;
|
|||
import com.engine.salary.encrypt.EncryptUtil;
|
||||
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
|
||||
import com.engine.salary.entity.siarchives.bo.InsuranceArchivesBO;
|
||||
import com.engine.salary.entity.siarchives.dto.InsuranceArchivesBaseDTO;
|
||||
import com.engine.salary.entity.siarchives.dto.InsuranceArchivesFundSchemeDTO;
|
||||
import com.engine.salary.entity.siarchives.dto.InsuranceArchivesOtherSchemeDTO;
|
||||
import com.engine.salary.entity.siarchives.dto.InsuranceArchivesSocialSchemeDTO;
|
||||
import com.engine.salary.entity.siarchives.dto.*;
|
||||
import com.engine.salary.entity.siarchives.param.*;
|
||||
import com.engine.salary.entity.siarchives.po.*;
|
||||
import com.engine.salary.entity.sicategory.po.ICategoryPO;
|
||||
|
|
@ -33,10 +30,7 @@ import com.engine.salary.enums.datacollection.DataCollectionEmployeeTypeEnum;
|
|||
import com.engine.salary.enums.siaccount.EmployeeStatusEnum;
|
||||
import com.engine.salary.enums.sicategory.*;
|
||||
import com.engine.salary.exception.SalaryRunTimeException;
|
||||
import com.engine.salary.mapper.siarchives.FundSchemeMapper;
|
||||
import com.engine.salary.mapper.siarchives.InsuranceBaseInfoMapper;
|
||||
import com.engine.salary.mapper.siarchives.OtherSchemeMapper;
|
||||
import com.engine.salary.mapper.siarchives.SocialSchemeMapper;
|
||||
import com.engine.salary.mapper.siarchives.*;
|
||||
import com.engine.salary.mapper.sicategory.ICategoryMapper;
|
||||
import com.engine.salary.mapper.sischeme.InsuranceSchemeDetailMapper;
|
||||
import com.engine.salary.mapper.sischeme.InsuranceSchemeMapper;
|
||||
|
|
@ -58,6 +52,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.ibatis.session.SqlSession;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.util.StopWatch;
|
||||
import weaver.conn.mybatis.MyBatisFactory;
|
||||
import weaver.general.Util;
|
||||
|
|
@ -1822,4 +1817,147 @@ public class SIArchivesBiz {
|
|||
}
|
||||
return getInsuranceBaseInfoMapper().listEndDateIsNull(employeeIds);
|
||||
}
|
||||
|
||||
public List<InsuranceArchivesBaseAdjustHistoryPO> dealSocialBaseAdjustInfoList(List<InsuranceArchivesSocialSchemePO> adjustList) {
|
||||
List<InsuranceArchivesBaseAdjustHistoryPO> adjustHistoryList = new ArrayList<>();
|
||||
if (adjustList.size() > 0) {
|
||||
for (InsuranceArchivesSocialSchemePO po : adjustList) {
|
||||
List<InsuranceArchivesSocialSchemePO> oldBaseInfoList = getSocialSchemeMapper().getSocialByEmployeeIdAndPayOrg(InsuranceArchivesEmployeePO.builder()
|
||||
.paymentOrganization(po.getPaymentOrganization()).employeeId(po.getEmployeeId()).build());
|
||||
|
||||
InsuranceArchivesBaseAdjustHistoryDTO adjustInfo = InsuranceArchivesBaseAdjustHistoryDTO.builder()
|
||||
.adjustAfterSchemeId(po.getSocialSchemeId())
|
||||
.adjustAfterBaseJson(po.getSocialPaymentBaseString())
|
||||
.welfareType(po.getWelfareType())
|
||||
.employeeId(po.getEmployeeId())
|
||||
.paymentOrganization(po.getPaymentOrganization())
|
||||
.build();
|
||||
if (oldBaseInfoList.size() == 1) {
|
||||
//新增调整记录,变更
|
||||
InsuranceArchivesSocialSchemePO oldBaseInfo = oldBaseInfoList.get(0);
|
||||
adjustInfo.setAdjustBeforeBaseJson(oldBaseInfo.getSocialPaymentBaseString());
|
||||
adjustInfo.setAdjustBeforeSchemeId(oldBaseInfo.getSocialSchemeId());
|
||||
} else if (oldBaseInfoList.size() > 1) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0,"社保档案存在冗余数据!"));
|
||||
}
|
||||
adjustHistoryList.addAll(createAdjustInfo(adjustInfo));
|
||||
}
|
||||
}
|
||||
return adjustHistoryList;
|
||||
|
||||
}
|
||||
public List<InsuranceArchivesBaseAdjustHistoryPO> dealFundBaseAdjustInfoList(List<InsuranceArchivesFundSchemePO> adjustList) {
|
||||
List<InsuranceArchivesBaseAdjustHistoryPO> adjustHistoryList = new ArrayList<>();
|
||||
if (adjustList.size() > 0) {
|
||||
for (InsuranceArchivesFundSchemePO po : adjustList) {
|
||||
List<InsuranceArchivesFundSchemePO> oldBaseInfoList = getFundSchemeMapper().getFundByEmployeeIdAndPayOrg(InsuranceArchivesEmployeePO.builder()
|
||||
.paymentOrganization(po.getPaymentOrganization()).employeeId(po.getEmployeeId()).build());
|
||||
|
||||
InsuranceArchivesBaseAdjustHistoryDTO adjustInfo = InsuranceArchivesBaseAdjustHistoryDTO.builder()
|
||||
.adjustAfterSchemeId(po.getFundSchemeId())
|
||||
.adjustAfterBaseJson(po.getFundPaymentBaseString())
|
||||
.welfareType(po.getWelfareType())
|
||||
.employeeId(po.getEmployeeId())
|
||||
.paymentOrganization(po.getPaymentOrganization())
|
||||
.build();
|
||||
if (oldBaseInfoList.size() == 1) {
|
||||
//新增调整记录,变更
|
||||
InsuranceArchivesFundSchemePO oldBaseInfo = oldBaseInfoList.get(0);
|
||||
adjustInfo.setAdjustBeforeBaseJson(oldBaseInfo.getFundPaymentBaseString());
|
||||
adjustInfo.setAdjustBeforeSchemeId(oldBaseInfo.getFundSchemeId());
|
||||
} else if (oldBaseInfoList.size() > 1) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0,"公积金档案存在冗余数据!"));
|
||||
}
|
||||
adjustHistoryList.addAll(createAdjustInfo(adjustInfo));
|
||||
}
|
||||
}
|
||||
return adjustHistoryList;
|
||||
}
|
||||
public List<InsuranceArchivesBaseAdjustHistoryPO> dealOtherBaseAdjustInfoList(List<InsuranceArchivesOtherSchemePO> adjustList) {
|
||||
List<InsuranceArchivesBaseAdjustHistoryPO> adjustHistoryList = new ArrayList<>();
|
||||
if (adjustList.size() > 0) {
|
||||
for (InsuranceArchivesOtherSchemePO po : adjustList) {
|
||||
List<InsuranceArchivesOtherSchemePO> oldBaseInfoList = getOtherSchemeMapper().getOtherByEmployeeIdAndPayOrg(InsuranceArchivesEmployeePO.builder()
|
||||
.paymentOrganization(po.getPaymentOrganization()).employeeId(po.getEmployeeId()).build());
|
||||
|
||||
InsuranceArchivesBaseAdjustHistoryDTO adjustInfo = InsuranceArchivesBaseAdjustHistoryDTO.builder()
|
||||
.adjustAfterSchemeId(po.getOtherSchemeId())
|
||||
.adjustAfterBaseJson(po.getOtherPaymentBaseString())
|
||||
.welfareType(po.getWelfareType())
|
||||
.employeeId(po.getEmployeeId())
|
||||
.paymentOrganization(po.getPaymentOrganization())
|
||||
.build();
|
||||
if (oldBaseInfoList.size() == 1) {
|
||||
//新增调整记录,变更
|
||||
InsuranceArchivesOtherSchemePO oldBaseInfo = oldBaseInfoList.get(0);
|
||||
adjustInfo.setAdjustBeforeBaseJson(oldBaseInfo.getOtherPaymentBaseString());
|
||||
adjustInfo.setAdjustBeforeSchemeId(oldBaseInfo.getOtherSchemeId());
|
||||
} else if (oldBaseInfoList.size() > 1) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0,"其他福利档案存在冗余数据!"));
|
||||
}
|
||||
adjustHistoryList.addAll(createAdjustInfo(adjustInfo));
|
||||
}
|
||||
}
|
||||
return adjustHistoryList;
|
||||
}
|
||||
|
||||
public List<InsuranceArchivesBaseAdjustHistoryPO> createAdjustInfo(InsuranceArchivesBaseAdjustHistoryDTO adjustInfo) {
|
||||
List<InsuranceArchivesBaseAdjustHistoryPO> toCreateAdjustHistoryList = new ArrayList<>();
|
||||
if(adjustInfo.getAdjustAfterBaseJson() != null && adjustInfo.getAdjustBeforeBaseJson() == null) {
|
||||
Map<String, Object> adjustAfterBaseMap = JSON.parseObject(adjustInfo.getAdjustAfterBaseJson(), new TypeReference<Map<String, Object>>() {
|
||||
});
|
||||
for (String key : adjustAfterBaseMap.keySet()) {
|
||||
InsuranceArchivesBaseAdjustHistoryPO adjustItem = new InsuranceArchivesBaseAdjustHistoryPO();
|
||||
BeanUtils.copyProperties(adjustInfo, adjustItem);
|
||||
adjustItem.setAdjustWelfareItemId(Long.valueOf(key));
|
||||
adjustItem.setAdjustAfterBaseValue((String) adjustAfterBaseMap.get(key));
|
||||
|
||||
toCreateAdjustHistoryList.add(adjustItem);
|
||||
}
|
||||
} else if (adjustInfo.getAdjustAfterBaseJson() != null && adjustInfo.getAdjustBeforeBaseJson() != null) {
|
||||
Map<String, Object> adjustAfterBaseMap = JSON.parseObject(adjustInfo.getAdjustAfterBaseJson(), new TypeReference<Map<String, Object>>() {
|
||||
});
|
||||
Map<String, Object> adjustBeforeBaseMap = JSON.parseObject(adjustInfo.getAdjustBeforeBaseJson(), new TypeReference<Map<String, Object>>() {
|
||||
});
|
||||
Map<String, Object> reDealMap = new HashMap<>();
|
||||
reDealMap.putAll(adjustAfterBaseMap);
|
||||
reDealMap.putAll(adjustBeforeBaseMap);
|
||||
for (String key : reDealMap.keySet()) {
|
||||
String beforeValue = (String) adjustBeforeBaseMap.get(key);
|
||||
String afterValue = (String) adjustAfterBaseMap.get(key);
|
||||
if (SalaryEntityUtil.empty2Zero(beforeValue).compareTo(SalaryEntityUtil.empty2Zero(afterValue)) == 0) {
|
||||
continue;
|
||||
}
|
||||
InsuranceArchivesBaseAdjustHistoryPO adjustItem = new InsuranceArchivesBaseAdjustHistoryPO();
|
||||
BeanUtils.copyProperties(adjustInfo, adjustItem);
|
||||
adjustItem.setAdjustWelfareItemId(Long.valueOf(key));
|
||||
adjustItem.setAdjustBeforeBaseValue(beforeValue);
|
||||
adjustItem.setAdjustAfterBaseValue(afterValue);
|
||||
|
||||
toCreateAdjustHistoryList.add(adjustItem);
|
||||
}
|
||||
}
|
||||
return toCreateAdjustHistoryList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增福利档案基数调整记录
|
||||
*
|
||||
*/
|
||||
public void batchInsertAdjustHistory(List<InsuranceArchivesBaseAdjustHistoryPO> adjustHistoryList, long employeeId) {
|
||||
|
||||
if (CollectionUtils.isEmpty(adjustHistoryList)) {
|
||||
return;
|
||||
}
|
||||
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
|
||||
try {
|
||||
InsuranceBaseAdjustHistoryMapper mapper = sqlSession.getMapper(InsuranceBaseAdjustHistoryMapper.class);
|
||||
List<List<InsuranceArchivesBaseAdjustHistoryPO>> partition = Lists.partition(adjustHistoryList, 100);
|
||||
partition.forEach(mapper::batchSave);
|
||||
sqlSession.commit();
|
||||
} finally {
|
||||
sqlSession.close();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,103 @@
|
|||
package com.engine.salary.entity.siarchives.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Author: sy
|
||||
* @Description:
|
||||
* @Date: 2023/10/16
|
||||
**/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class InsuranceArchivesBaseAdjustHistoryDTO {
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 员工id
|
||||
*/
|
||||
private Long employeeId;
|
||||
|
||||
/**
|
||||
* 个税扣缴义务人id
|
||||
*/
|
||||
private Long paymentOrganization;
|
||||
|
||||
/**
|
||||
* 福利类型
|
||||
*/
|
||||
private Integer welfareType;
|
||||
|
||||
/**
|
||||
* 调整前方案id
|
||||
*/
|
||||
private Long adjustBeforeSchemeId;
|
||||
/**
|
||||
* 调整后方案id
|
||||
*/
|
||||
private Long adjustAfterSchemeId;
|
||||
/**
|
||||
* 调整前基数值
|
||||
*/
|
||||
private String adjustBeforeBaseValue;
|
||||
/**
|
||||
* 调整后基数值
|
||||
*/
|
||||
private String adjustAfterBaseValue;
|
||||
|
||||
/**
|
||||
* 调整福利项id
|
||||
*/
|
||||
private Long adjustWelfareItemId;
|
||||
|
||||
/**
|
||||
* 操作人
|
||||
*/
|
||||
private Long operator;
|
||||
|
||||
/**
|
||||
* 操作时间
|
||||
*/
|
||||
private Date operateTime;
|
||||
|
||||
/**
|
||||
* 租户key
|
||||
*/
|
||||
private String tenantKey;
|
||||
|
||||
/**
|
||||
* 创建人id
|
||||
*/
|
||||
private Long creator;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
private Integer deleteType;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
|
||||
private String adjustBeforeBaseJson;
|
||||
|
||||
private String adjustAfterBaseJson;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,98 @@
|
|||
package com.engine.salary.entity.siarchives.po;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Author: sy
|
||||
* @Description: 福利基数调整历史记录表
|
||||
* @Date: 2023/10/16
|
||||
**/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
//hrsa_insurance_base_adjust_history
|
||||
public class InsuranceArchivesBaseAdjustHistoryPO {
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 员工id
|
||||
*/
|
||||
private Long employeeId;
|
||||
|
||||
/**
|
||||
* 个税扣缴义务人id
|
||||
*/
|
||||
private Long paymentOrganization;
|
||||
|
||||
/**
|
||||
* 福利类型
|
||||
*/
|
||||
private Integer welfareType;
|
||||
|
||||
/**
|
||||
* 调整前方案id
|
||||
*/
|
||||
private Long adjustBeforeSchemeId;
|
||||
/**
|
||||
* 调整后方案id
|
||||
*/
|
||||
private Long adjustAfterSchemeId;
|
||||
/**
|
||||
* 调整前基数值
|
||||
*/
|
||||
private String adjustBeforeBaseValue;
|
||||
/**
|
||||
* 调整后基数值
|
||||
*/
|
||||
private String adjustAfterBaseValue;
|
||||
|
||||
/**
|
||||
* 调整福利项id
|
||||
*/
|
||||
private Long adjustWelfareItemId;
|
||||
|
||||
/**
|
||||
* 操作人
|
||||
*/
|
||||
private Long operator;
|
||||
|
||||
/**
|
||||
* 操作时间
|
||||
*/
|
||||
private Date operateTime;
|
||||
|
||||
/**
|
||||
* 租户key
|
||||
*/
|
||||
private String tenantKey;
|
||||
|
||||
/**
|
||||
* 创建人id
|
||||
*/
|
||||
private Long creator;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
private Integer deleteType;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
package com.engine.salary.mapper.siarchives;
|
||||
|
||||
import com.engine.salary.entity.siarchives.po.InsuranceArchivesBaseAdjustHistoryPO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author sy
|
||||
* @Date 2023/10/16
|
||||
**/
|
||||
public interface InsuranceBaseAdjustHistoryMapper {
|
||||
|
||||
/**
|
||||
* 批量保存
|
||||
*/
|
||||
void batchSave(@Param("infos") List<InsuranceArchivesBaseAdjustHistoryPO> infos);
|
||||
|
||||
/**
|
||||
* 根据个税扣缴义务人和人员id获取调整记录
|
||||
*/
|
||||
List<InsuranceArchivesBaseAdjustHistoryPO> listByEmployeeIdAndPayOrg(@Param("paymentOrganization")Long paymentOrganization, @Param("employeeId")Long employeeId);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,137 @@
|
|||
<?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.InsuranceBaseAdjustHistoryMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.engine.salary.entity.siarchives.po.InsuranceArchivesBaseAdjustHistoryPO">
|
||||
<result column="id" property="id"/>
|
||||
<result column="employee_id" property="employeeId"/>
|
||||
<result column="payment_organization" property="paymentOrganization"/>
|
||||
<result column="adjust_before_scheme_id" property="adjustBeforeSchemeId"/>
|
||||
<result column="adjust_after_scheme_id" property="adjustAfterSchemeId"/>
|
||||
<result column="adjust_before_base_value" property="adjustBeforeBaseValue"/>
|
||||
<result column="adjust_after_base_value" property="adjustAfterBaseValue"/>
|
||||
<result column="adjust_welfare_item_id" property="adjustWelfareItemId"/>
|
||||
<result column="operator" property="operator"/>
|
||||
<result column="operate_time" property="operateTime"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
<result column="creator" property="creator"/>
|
||||
<result column="delete_type" property="deleteType"/>
|
||||
<result column="tenant_key" property="tenantKey"/>
|
||||
|
||||
</resultMap>
|
||||
|
||||
<!-- 表字段 -->
|
||||
<sql id="baseColumns">
|
||||
t.id
|
||||
, t.employee_id
|
||||
, t.payment_organization
|
||||
, t.adjust_before_scheme_id
|
||||
, t.adjust_after_scheme_id
|
||||
, t.adjust_before_base_value
|
||||
, t.adjust_after_base_value
|
||||
, t.adjust_welfare_item_id
|
||||
, t.operator
|
||||
, t.operate_time
|
||||
, t.create_time
|
||||
, t.update_time
|
||||
, t.creator
|
||||
, t.delete_type
|
||||
, t.tenant_key
|
||||
</sql>
|
||||
|
||||
<insert id="batchSave">
|
||||
INSERT INTO hrsa_insurance_base_adjust_history
|
||||
(id,employee_id,payment_organization,
|
||||
adjust_before_scheme_id,adjust_after_scheme_id,
|
||||
adjust_before_base_value,adjust_after_base_value,
|
||||
adjust_welfare_item_id,operator,operate_time,
|
||||
tenant_key,creator,delete_type,create_time,update_time)
|
||||
VALUES
|
||||
<foreach collection="infos" item="item" separator=",">
|
||||
(
|
||||
#{item.id},
|
||||
#{item.employeeId},
|
||||
#{item.paymentOrganization},
|
||||
#{item.adjustBeforeSchemeId},
|
||||
#{item.adjustAfterSchemeId},
|
||||
#{item.adjustBeforeBaseValue},
|
||||
#{item.adjustAfterBaseValue},
|
||||
#{item.adjustWelfareItemId},
|
||||
#{item.operator},
|
||||
#{item.operateTime},
|
||||
#{item.tenantKey},
|
||||
#{item.creator},
|
||||
#{item.deleteType},
|
||||
#{item.createTime},
|
||||
#{item.updateTime}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
<insert id="batchSave" databaseId="oracle">
|
||||
INSERT INTO hrsa_insurance_base_adjust_history
|
||||
(id,employee_id,payment_organization,
|
||||
adjust_before_scheme_id,adjust_after_scheme_id,
|
||||
adjust_before_base_value,adjust_after_base_value,
|
||||
adjust_welfare_item_id,operator,operate_time,
|
||||
tenant_key,creator,delete_type,create_time,update_time)
|
||||
<foreach collection="infos" item="item" separator="union all">
|
||||
select
|
||||
#{item.id,jdbcType=DOUBLE},
|
||||
#{item.employeeId,jdbcType=DOUBLE},
|
||||
#{item.paymentOrganization,jdbcType=DOUBLE},
|
||||
#{item.adjustBeforeSchemeId,jdbcType=DOUBLE},
|
||||
#{item.adjustAfterSchemeId,jdbcType=DOUBLE},
|
||||
#{item.adjustBeforeBaseValue,jdbcType=VARCHAR},
|
||||
#{item.adjustAfterBaseValue,jdbcType=VARCHAR},
|
||||
#{item.adjustWelfareItemId,jdbcType=DOUBLE},
|
||||
#{item.operator,jdbcType=DOUBLE},
|
||||
#{item.operateTime},
|
||||
#{item.tenantKey,jdbcType=VARCHAR},
|
||||
#{item.creator,jdbcType=DOUBLE},
|
||||
#{item.deleteType},
|
||||
#{item.createTime},
|
||||
#{item.updateTime}
|
||||
from dual
|
||||
</foreach>
|
||||
</insert>
|
||||
<insert id="batchSave" databaseId="sqlserver">
|
||||
<foreach collection="infos" item="item" separator=";">
|
||||
INSERT INTO hrsa_insurance_base_adjust_history
|
||||
(id,employee_id,payment_organization,
|
||||
adjust_before_scheme_id,adjust_after_scheme_id,
|
||||
adjust_before_base_value,adjust_after_base_value,
|
||||
adjust_welfare_item_id,operator,operate_time,
|
||||
tenant_key,creator,delete_type,create_time,update_time)
|
||||
VALUES
|
||||
(
|
||||
#{item.id},
|
||||
#{item.employeeId},
|
||||
#{item.paymentOrganization},
|
||||
#{item.adjustBeforeSchemeId},
|
||||
#{item.adjustAfterSchemeId},
|
||||
#{item.adjustBeforeBaseValue},
|
||||
#{item.adjustAfterBaseValue},
|
||||
#{item.adjustWelfareItemId},
|
||||
#{item.operator},
|
||||
#{item.operateTime},
|
||||
#{item.tenantKey},
|
||||
#{item.creator},
|
||||
#{item.deleteType},
|
||||
#{item.createTime},
|
||||
#{item.updateTime}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<select id="listByEmployeeIdAndPayOrg" resultType="com.engine.salary.entity.siarchives.po.InsuranceArchivesBaseAdjustHistoryPO">
|
||||
SELECT
|
||||
<include refid="baseColumns"/>
|
||||
FROM hrsa_insurance_base_adjust_history t
|
||||
WHERE t.delete_type = 0
|
||||
AND employee_id = #{employeeId}
|
||||
AND payment_organization = #{paymentOrganization}
|
||||
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -1379,53 +1379,63 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
|
|||
//导入社保档案
|
||||
List<InsuranceArchivesSocialSchemePO> socialSchemePOS = insuranceArchivesAccountPOS.stream().filter(Objects::nonNull).map(InsuranceArchivesAccountPO::getSocial).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(socialSchemePOS)) {
|
||||
// socialSchemePOS = socialSchemePOS.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(InsuranceArchivesSocialSchemePO::getEmployeeId))), ArrayList::new));
|
||||
//根据人员id和个税扣缴义务人id删除对应档案
|
||||
socialSchemePOS.forEach(getSocialSchemeMapper()::deleteByEmployeeIdAndPayOrg);
|
||||
// List<Long> socialEmployeeIds = socialSchemePOS.stream().map(InsuranceArchivesSocialSchemePO::getEmployeeId).collect(Collectors.toList());
|
||||
// List<List<Long>> socialEmployeeIdPartition = Lists.partition(socialEmployeeIds, 100);
|
||||
// socialEmployeeIdPartition.forEach(getSocialSchemeMapper()::batchDeleteByEmployeeIds);
|
||||
|
||||
//去除员工id+个税扣缴义务人下重复的数据
|
||||
socialSchemePOS = socialSchemePOS.stream()
|
||||
.collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(f -> f.getPaymentOrganization() + "-" + f.getEmployeeId()))), ArrayList::new));
|
||||
|
||||
//生成福利档案基数调整历史记录
|
||||
List<InsuranceArchivesBaseAdjustHistoryPO> adjustSocialHistoryPOList = siArchivesBiz.dealSocialBaseAdjustInfoList(socialSchemePOS);
|
||||
|
||||
//根据人员id和个税扣缴义务人id删除对应旧档案
|
||||
socialSchemePOS.forEach(getSocialSchemeMapper()::deleteByEmployeeIdAndPayOrg);
|
||||
|
||||
//新建新档案
|
||||
List<InsuranceArchivesSocialSchemePO> insuranceArchivesSocialSchemePOS = encryptUtil.encryptList(socialSchemePOS, InsuranceArchivesSocialSchemePO.class);
|
||||
List<List<InsuranceArchivesSocialSchemePO>> partition = Lists.partition(insuranceArchivesSocialSchemePOS, 100);
|
||||
partition.forEach(getSocialSchemeMapper()::batchSave);
|
||||
|
||||
//新建福利档案基数调整历史记录
|
||||
siArchivesBiz.batchInsertAdjustHistory(adjustSocialHistoryPOList, user.getUID());
|
||||
}
|
||||
//导入公积金档案
|
||||
List<InsuranceArchivesFundSchemePO> fundSchemePOS = insuranceArchivesAccountPOS.stream().filter(Objects::nonNull).map(InsuranceArchivesAccountPO::getFund).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(fundSchemePOS)) {
|
||||
// fundSchemePOS = fundSchemePOS.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(InsuranceArchivesFundSchemePO::getEmployeeId))), ArrayList::new));
|
||||
//根据人员id和个税扣缴义务人id删除对应档案
|
||||
fundSchemePOS.forEach(getFundSchemeMapper()::deleteByEmployeeIdAndPayOrg);
|
||||
// List<Long> fundEmployeeIds = fundSchemePOS.stream().map(InsuranceArchivesFundSchemePO::getEmployeeId).collect(Collectors.toList());
|
||||
// List<List<Long>> fundEmployeeIdsPartition = Lists.partition(fundEmployeeIds, 100);
|
||||
// fundEmployeeIdsPartition.forEach(getFundSchemeMapper()::batchDeleteByEmployeeIds);
|
||||
|
||||
//去除员工id+个税扣缴义务人下重复的数据
|
||||
fundSchemePOS = fundSchemePOS.stream()
|
||||
.collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(f -> f.getPaymentOrganization() + "-" + f.getEmployeeId()))), ArrayList::new));
|
||||
|
||||
//生成福利档案基数调整历史记录
|
||||
List<InsuranceArchivesBaseAdjustHistoryPO> adjustFundHistoryPOList = siArchivesBiz.dealFundBaseAdjustInfoList(fundSchemePOS);
|
||||
//根据人员id和个税扣缴义务人id删除对应档案
|
||||
fundSchemePOS.forEach(getFundSchemeMapper()::deleteByEmployeeIdAndPayOrg);
|
||||
//新建新档案
|
||||
List<InsuranceArchivesFundSchemePO> insuranceArchivesFundSchemePOS = encryptUtil.encryptList(fundSchemePOS, InsuranceArchivesFundSchemePO.class);
|
||||
List<List<InsuranceArchivesFundSchemePO>> partition = Lists.partition(insuranceArchivesFundSchemePOS, 100);
|
||||
partition.forEach(getFundSchemeMapper()::batchSave);
|
||||
//新建福利档案基数调整历史记录
|
||||
siArchivesBiz.batchInsertAdjustHistory(adjustFundHistoryPOList, user.getUID());
|
||||
}
|
||||
//导入其他福利档案
|
||||
List<InsuranceArchivesOtherSchemePO> otherSchemePOS = insuranceArchivesAccountPOS.stream().filter(Objects::nonNull).map(InsuranceArchivesAccountPO::getOther).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(otherSchemePOS)) {
|
||||
// otherSchemePOS = otherSchemePOS.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(InsuranceArchivesOtherSchemePO::getEmployeeId))), ArrayList::new));
|
||||
//根据人员id和个税扣缴义务人id删除对应档案
|
||||
otherSchemePOS.forEach(getOtherSchemeMapper()::deleteByEmployeeIdAndPayOrg);
|
||||
// List<Long> otherEmployeeIds = otherSchemePOS.stream().map(InsuranceArchivesOtherSchemePO::getEmployeeId).collect(Collectors.toList());
|
||||
// List<List<Long>> otherEmployeeIdsPartition = Lists.partition(otherEmployeeIds, 100);
|
||||
// otherEmployeeIdsPartition.forEach(getOtherSchemeMapper()::batchDeleteByEmployeeIds);
|
||||
|
||||
//去除员工id+个税扣缴义务人下重复的数据
|
||||
otherSchemePOS = otherSchemePOS.stream()
|
||||
.collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(f -> f.getPaymentOrganization() + "-" + f.getEmployeeId()))), ArrayList::new));
|
||||
|
||||
//生成福利档案基数调整历史记录
|
||||
List<InsuranceArchivesBaseAdjustHistoryPO> adjustOtherHistoryPOList = siArchivesBiz.dealOtherBaseAdjustInfoList(otherSchemePOS);
|
||||
|
||||
//根据人员id和个税扣缴义务人id删除对应档案
|
||||
otherSchemePOS.forEach(getOtherSchemeMapper()::deleteByEmployeeIdAndPayOrg);
|
||||
//新建新档案
|
||||
List<InsuranceArchivesOtherSchemePO> insuranceArchivesOtherSchemePOS = encryptUtil.encryptList(otherSchemePOS, InsuranceArchivesOtherSchemePO.class);
|
||||
List<List<InsuranceArchivesOtherSchemePO>> partition = Lists.partition(insuranceArchivesOtherSchemePOS, 100);
|
||||
partition.forEach(getOtherSchemeMapper()::batchSave);
|
||||
//新建福利档案基数调整历史记录
|
||||
siArchivesBiz.batchInsertAdjustHistory(adjustOtherHistoryPOList, user.getUID());
|
||||
}
|
||||
//导入福利档案基础信息
|
||||
List<InsuranceArchivesBaseInfoPO> baseInfoPOS = insuranceArchivesAccountPOS.stream().filter(Objects::nonNull).map(InsuranceArchivesAccountPO::getBaseInfo).collect(Collectors.toList());
|
||||
|
|
|
|||
Loading…
Reference in New Issue