Merge branch 'feature/v2-welHistoryDetail-1104' into release/2.1.2.2211.01

This commit is contained in:
sy 2022-11-03 19:04:32 +08:00
commit 25d87c3480
4 changed files with 64 additions and 15 deletions

View File

@ -807,8 +807,9 @@ public class SIArchivesBiz {
if (primaryId ==null || paymentBaseString == null) {
return true;
}
//设置缴纳对象
//设置缴纳对象和缴费状态
Integer paymentScope = 2;
Integer isPayment = 1;
Map<String, String> paymentBaseJson = JSON.parseObject(paymentBaseString, new HashMap<String, String>().getClass());
if (paymentBaseJson == null) {
return true;
@ -824,8 +825,8 @@ public class SIArchivesBiz {
return false;
}
//根据福利方案id险种id缴纳对象查询明细
InsuranceSchemeDetailPO insuranceSchemeDetailPO = getInsuranceSchemeDetailMapper().getByPPI(primaryId, paymentScope, Long.valueOf(entry.getKey()));
//根据福利方案id险种id缴纳对象缴费状态查询明细
InsuranceSchemeDetailPO insuranceSchemeDetailPO = getInsuranceSchemeDetailMapper().getByPPII(primaryId, paymentScope, Long.valueOf(entry.getKey()), isPayment);
log.info("福利方案id: {}, 缴纳所属: {}, 福利明细项id{}", primaryId, paymentScope, Long.valueOf(entry.getKey()));
if (insuranceSchemeDetailPO == null) {
log.info("根据福利方案id、险种id、缴纳对象查询明细为null福利方案id: {}, 缴纳所属: {}, 福利明细项id{}", primaryId, paymentScope, Long.valueOf(entry.getKey()));
@ -1507,7 +1508,7 @@ public class SIArchivesBiz {
po.setCreateTime(new Date());
po.setDeleteType(0);
po.setCreator(creator);
po.setRunStatus(EmployeeStatusEnum.PAYING.getValue());
po.setRunStatus(EmployeeStatusEnum.STAY_ADD.getValue());
po.setUpdateTime(new Date());
po.setTenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY);

View File

@ -56,6 +56,8 @@ public interface InsuranceSchemeDetailMapper {
InsuranceSchemeDetailPO getByPPI(@Param("primaryId") Long primaryId, @Param("paymentScope") Integer paymentScope,
@Param("insuranceId") Long insuranceId);
InsuranceSchemeDetailPO getByPPII(@Param("primaryId") Long primaryId, @Param("paymentScope") Integer paymentScope,
@Param("insuranceId") Long insuranceId, @Param("isPayment") Integer isPayment);
/**
* 根据主键和是否缴费查询

View File

@ -95,6 +95,17 @@
AND delete_type = 0
</select>
<select id="getByPPII" resultMap="BaseResultMap" >
SELECT
<include refid="baseColumns"/>
FROM hrsa_scheme_detail t
WHERE t.insurance_id = #{insuranceId}
AND t.payment_scope = #{paymentScope}
AND t.primary_id = #{primaryId}
AND t.is_payment = #{isPayment}
AND delete_type = 0
</select>
<!-- 插入全部字段 -->
<insert id="insert" parameterType="com.engine.salary.entity.sischeme.po.InsuranceSchemeDetailPO"
keyProperty="id" keyColumn="id" useGeneratedKeys="true"

View File

@ -141,7 +141,7 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
StopWatch sw = new StopWatch();
sw.start("福利档案-历史数据处理");
// 1.历史数据处理
siArchivesBiz.createOldInsuranceBaseInfo(currentEmployeeId);
handleHistoryData(currentEmployeeId);
sw.stop();
sw.start("福利档案-待减员自动处理");
@ -179,6 +179,22 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
return apidatas;
}
/**
* 福利档案中历史数据自动处理
* @param currentEmployeeId
*/
private void handleHistoryData(long currentEmployeeId) {
List<InsuranceArchivesBaseInfoPO> nowBaseInfoList = getInsuranceBaseInfoMapper().getInsuranceBaseInfoList();
if (nowBaseInfoList.size() == 0) {
siArchivesBiz.createOldInsuranceBaseInfo(currentEmployeeId);
//全量增员
allStayAddToPay();
}
}
/**
* 福利档案中待减员数据自动处理
* @param currentEmployeeId
@ -706,14 +722,14 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
//减员失败
resultType = "fail";
if (baseInfoPOList.size() == 1) {
resultMsg = "减员失败,失败原因:数据未正常维护";
resultMsg = "减员失败,失败原因:最后缴纳月数据未正常维护";
} else {
resultMsg = "部分或全部失败:【共提交减员数据"
+ baseInfoIds.size()
+"条,成功" + toStopBaseInfoIdList.size()
+"条,失败" + noStopBaseInfoIds.size()
+"条,失败原因:数据未正常维护】";
+"条,失败原因:最后缴纳月数据未正常维护】";
}
}
@ -749,7 +765,13 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
if (CollectionUtils.isEmpty(ids)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(145969, "没有可以操作的记录"));
}
List<InsuranceArchivesBaseInfoPO> baseInfoPOList = getInsuranceBaseInfoMapper().listByIds(ids);
//
List<InsuranceArchivesBaseInfoPO> baseInfoPOList = new ArrayList<>();
List<List<Long>> partitionInfo = Lists.partition((List<Long>) ids, 100);
partitionInfo.forEach(part -> baseInfoPOList.addAll(
getInsuranceBaseInfoMapper().listByIds(part)));
//
//分别新建福利档案基础信息相关的社保公积金其他福利档案列表
List<InsuranceArchivesSocialSchemePO> socialList = new ArrayList<>();
@ -776,7 +798,10 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
//获取可进行增员的社保档案相关人员数据
if (socialIds.size() > 0) {
//获取社保档案
socialList = getSocialSchemeMapper().getSocialById(socialIds);
List<List<Long>> partitionSocial = Lists.partition((List<Long>) socialIds, 100);
partitionSocial.forEach(part -> socialList.addAll(
getSocialSchemeMapper().getSocialById(part)));
//筛选可增员的社保档案相关人员信息
toStopSocialIds = socialList.stream().filter(f->
{
@ -796,7 +821,10 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
}
if (fundIds.size() > 0) {
fundList = getFundSchemeMapper().getFundById(fundIds);
List<List<Long>> partitionFund = Lists.partition((List<Long>) fundIds, 100);
partitionFund.forEach(part -> fundList.addAll(
getFundSchemeMapper().getFundById(part)));
toStopFundIds = fundList.stream().filter(f->
{
boolean flag = true;
@ -814,7 +842,10 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
}
if (otherIds.size() > 0) {
otherList = getOtherSchemeMapper().getOtherById(otherIds);
List<List<Long>> partitionOther = Lists.partition((List<Long>) otherIds, 100);
partitionOther.forEach(part -> otherList.addAll(
getOtherSchemeMapper().getOtherById(part)));
toStopOtherIds = otherList.stream().filter(f->
{
boolean flag = true;
@ -838,8 +869,12 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
//进行增员操作
if (toPayBaseInfoIdList.size() > 0) {
getInsuranceBaseInfoMapper().updateRunStatusByIds(InsuranceArchivesBaseInfoPO.builder()
.ids(toPayBaseInfoIdList).runStatus(EmployeeStatusEnum.PAYING.getValue()).build());
List<List<Long>> partitionToPay = Lists.partition((List<Long>) toPayBaseInfoIdList, 100);
partitionToPay.forEach(part -> {
getInsuranceBaseInfoMapper().updateRunStatusByIds(InsuranceArchivesBaseInfoPO.builder()
.ids(part).runStatus(EmployeeStatusEnum.PAYING.getValue()).build());
});
}
Map<String, Object> resultMap = new HashMap<>(2);
@ -860,13 +895,13 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
//增员失败
resultType = "fail";
if (baseInfoPOList.size() == 1) {
resultMsg = "增员失败,失败原因:数据未正常维护";
resultMsg = "增员失败,失败原因:起始缴纳月/福利方案数据未正常维护";
} else {
resultMsg = "部分或全部失败:【共提交增员数据"
+ baseInfoIds.size()
+"条,成功" + toPayBaseInfoIdList.size()
+"条,失败" + noPayBaseInfoIds.size()
+"条,失败原因:数据未正常维护】";
+"条,失败原因:起始缴纳月/福利方案数据未正常维护】";
}
}